UIMessagef
This commit is contained in:
@@ -158,15 +158,24 @@ void Appendf(View *view, const char *fmt, ...) {
|
|||||||
Append(view, string, true);
|
Append(view, string, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UIMessagef(const char *fmt, ...) {
|
||||||
|
Scratch scratch;
|
||||||
|
STRING_FORMAT(scratch, fmt, string);
|
||||||
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||||
|
JumpGarbageBuffer(&main);
|
||||||
|
NextActiveWindowID = main.window->id;
|
||||||
|
RawAppendf(main.buffer, "\n %S\n", string);
|
||||||
|
}
|
||||||
|
|
||||||
void ReportErrorf(const char *fmt, ...) {
|
void ReportErrorf(const char *fmt, ...) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
STRING_FORMAT(scratch, fmt, string);
|
STRING_FORMAT(scratch, fmt, string);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error!", string.data, NULL);
|
|
||||||
View *view = GetView(NullViewID);
|
View *view = GetView(NullViewID);
|
||||||
if (view) {
|
if (view) {
|
||||||
Appendf(view, "%S\n", string);
|
Appendf(view, "%S\n", string);
|
||||||
NextActiveWindowID = NullWindowID;
|
NextActiveWindowID = NullWindowID;
|
||||||
}
|
}
|
||||||
|
UIMessagef("%S", string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportConsolef(const char *fmt, ...) {
|
void ReportConsolef(const char *fmt, ...) {
|
||||||
@@ -577,7 +586,7 @@ BSet Open(Window *window, String path, String meta, bool set_active = true) {
|
|||||||
} else if (o.kind == OpenKind_Skip) {
|
} else if (o.kind == OpenKind_Skip) {
|
||||||
return {};
|
return {};
|
||||||
} else {
|
} else {
|
||||||
ReportWarningf("Failed to open: %S", path);
|
ReportErrorf("Failed to open: %S", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetBSet(window);
|
return GetBSet(window);
|
||||||
|
|||||||
Reference in New Issue
Block a user