commit ce322176ffa44de3b737c9ba29206203b4158b62
parent a9fb16bf9a5104297363c4ecfd7210894f330120
Author: bsandro <email@bsandro.tech>
Date: Fri, 25 Aug 2023 01:05:03 +0300
Default window size is 750x400 now.
Diffstat:
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/TODO b/TODO
@@ -1,7 +1,7 @@
- Add 'debug' and 'release' builds into makefile
- Wrap errors into sane messages and not just asserts
- Support drag-n-drop for GUI version
-- Implement file open window
++ Implement file open window
+ Implement file save window
- i18n
- Status bar with service/info messages
diff --git a/gui/main.c b/gui/main.c
@@ -33,6 +33,8 @@
#endif
#define NUM_CHANNELS 4
+#define WIN_WIDTH 750
+#define WIN_HEIGHT 400
#define UI_COLOR_FROM_RGBA(r, g, b, a) (((uint32_t) (r) << 16) | ((uint32_t) (g) << 8) | ((uint32_t) (b) << 0) | ((uint32_t) (a) << 24))
@@ -71,6 +73,7 @@ static Animation *img = NULL;
static int cols = 1;
static volatile UIWindow *modal_win = NULL;
static UIImageDisplay *img_disp = NULL;
+static UILabel *lbl_header = NULL;
//@todo headers!
Animation * ImageLoad(const char *);
@@ -335,7 +338,7 @@ typedef int (*CallbackFn)(struct UIElement *element, UIMessage message, int di,
void ShowModalWindow(UIWindow *parent, const char *def_dir, const char *def_file, CallbackFn cb) {
if (modal_win == NULL) {
printf("create modal window\n");
- modal_win = UIWindowCreate(parent, NULL, def_file?"Save File":"Open File", 0, 0);
+ modal_win = UIWindowCreate(parent, NULL, def_file?"Save File":"Open File", WIN_WIDTH, WIN_HEIGHT);
modal_win->e.messageUser = WinModalEvent;
UIPanel *panel_out = UIPanelCreate(&modal_win->e, UI_PANEL_GRAY|UI_PANEL_EXPAND);
@@ -409,7 +412,7 @@ void PreviewUpdate(Animation *img, UIImageDisplay *img_disp) {
UILabel *label = (UILabel *)img_disp->e.cp;
char label_text[256] = {0};
- snprintf(&label_text, 255, "spritesheet width: %3d", cols);
+ snprintf(&label_text, 255, "Width: %3d tiles", cols);
UILabelSetContent(label, label_text, -1);
UIElementRefresh(label->e.parent);
}
@@ -465,7 +468,7 @@ Animation * ImageLoad(const char *path) {
printf("[%s/%s]\ncols: %d\ndimensions: %dx%dpx\nframes: %d\n", img->dirname, img->filename, cols, img->width, img->height, img->frame_count);
- //UILabelSetContent(lbl_title, img->path, -1);
+ UILabelSetContent(lbl_header, img->path, -1);
return img;
}
@@ -480,10 +483,10 @@ int WinMain(HINSTANCE instance, HINSTANCE previousInstance, LPSTR commandLine, i
UIInitialise();
- UIWindow *win = UIWindowCreate(0, 0, "emote2ss gui", 0, 0);
+ UIWindow *win = UIWindowCreate(0, 0, "emote2ss", WIN_WIDTH, WIN_HEIGHT);
win->e.messageUser = WinMainEvent;
UIPanel *panelv = UIPanelCreate(&win->e, UI_PANEL_GRAY|UI_PANEL_MEDIUM_SPACING);
- UILabel *lbl_title = UILabelCreate(&panelv->e, 0, "filename", -1);
+ lbl_header = UILabelCreate(&panelv->e, 0, "filename", -1);
UIPanel *panelh = UIPanelCreate(&panelv->e, UI_PANEL_GRAY|UI_PANEL_MEDIUM_SPACING|UI_PANEL_HORIZONTAL);
UILabel *label = UILabelCreate(&panelh->e, 0, "webp to spritesheet converter", -1);