some ui enhancements

isolation_bkp/dynres
Dominik Madarász 2021-05-16 14:45:30 +02:00
parent f7ec80f332
commit 11f84ba241
2 changed files with 11 additions and 10 deletions

View File

@ -282,6 +282,7 @@ void texed_new(int32_t w, int32_t h) {
ctx.img = GenImageColor(w, h, WHITE);
ctx.filepath = NULL;
ctx.selected_op = 0;
ctx.msgbox.result = -1;
zpl_array_init(ctx.ops, zpl_heap());
is_repaint_locked = true;

View File

@ -149,7 +149,7 @@ void texed_draw_oplist_pane(zpl_aabb2 r) {
// NOTE(zaklaus): operator list
for (int i = 0; i < zpl_array_count(ctx.ops); i += 1) {
zpl_aabb2 op_item_r = zpl_aabb2_cut_top(&r, 22.5f);
zpl_aabb2 op_item_r = zpl_aabb2_cut_top(&r, 25.0f);
zpl_aabb2_cut_top(&op_item_r, 2.5f);
zpl_aabb2_cut_bottom(&op_item_r, 2.5f);
Rectangle list_item = aabb2_ray(op_item_r);
@ -190,15 +190,6 @@ void texed_draw_oplist_pane(zpl_aabb2 r) {
}
GuiSetState(GUI_STATE_NORMAL);
if (ctx.selected_op == i) GuiSetState(GUI_STATE_DISABLED);
zpl_aabb2 select_r = zpl_aabb2_cut_right(&op_item_r, 20.0f);
if (GuiButton(aabb2_ray(select_r), "#141#")) {
ctx.selected_op = i;
ctx.is_saved = false;
}
GuiSetState(GUI_STATE_NORMAL);
zpl_aabb2 lock_r = zpl_aabb2_cut_right(&op_item_r, 20.0f);
if (default_ops[ctx.ops[i].kind].is_locked) GuiSetState(GUI_STATE_DISABLED);
@ -208,6 +199,15 @@ void texed_draw_oplist_pane(zpl_aabb2 r) {
}
GuiSetState(GUI_STATE_NORMAL);
if (ctx.selected_op == i) GuiSetState(GUI_STATE_DISABLED);
zpl_aabb2 select_r = zpl_aabb2_cut_right(&op_item_r, 20.0f);
if (GuiButton(aabb2_ray(select_r), "#141#")) {
ctx.selected_op = i;
ctx.is_saved = false;
}
GuiSetState(GUI_STATE_NORMAL);
GuiDrawText(zpl_bprintf("%s %s", ctx.ops[i].name, ctx.ops[i].is_locked ? "(locked)" : ""), GetTextBounds(LABEL, list_text), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(RAYWHITE, guiAlpha));
}