commit 7e78b8981dd573cacf145e1c91f38bae9583d7ea
parent 1a7e63b4c2f6b7e19ca058cb6fe8e71844a3bd31
Author: bsandro <email@bsandro.tech>
Date: Mon, 14 Aug 2023 01:57:17 +0300
ui label with a full input file path
Diffstat:
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/gui/main.c b/gui/main.c
@@ -265,13 +265,6 @@ void update_preview(UIImageDisplay *img_disp) {
UIElementRefresh(img_disp->e.parent);
UIElementRefresh(&img_disp->e);
- /*for (int i=0; i<16; ++i) {
- printf("b 8[%2d] = %x\n", i, ss.data[i]);
- }
- for (int i=0; i<4; ++i) {
- printf("b32[%2d] = %x\n", i, frame0[i]);
- }*/
-
free(frame0);
free(ss.data);
@@ -305,6 +298,7 @@ int main(int argc, const char **argv) {
UIInitialise();
UIWindow *win = UIWindowCreate(0, 0, "emote2ss gui", 0, 0);
UIPanel *panelv = UIPanelCreate(&win->e, UI_PANEL_GRAY|UI_PANEL_MEDIUM_SPACING);
+ UILabel *lbl_title = 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);
@@ -330,11 +324,13 @@ int main(int argc, const char **argv) {
assert(img!=NULL);
bzero(img, sizeof(animation_t));
char out_name[NAME_MAX-1];
- img->path = strndup(argv[1], PATH_MAX-1);
+ img->path = realpath(argv[1], NULL);
assert(img->path!=NULL);
int r = read_webp(img->path, img);
assert(r==0);
+ UILabelSetContent(lbl_title, img->path, -1);
+
char *in_name = basename(img->path);
char *in_dir = dirname(img->path);
int n = snprintf(out_name, NAME_MAX-1, "atlas_%s", in_name);
@@ -343,6 +339,7 @@ int main(int argc, const char **argv) {
update_preview(img_disp);
+ //@todo cleanup on new image load!
//free(img->path);
//free(img);