paint: ui tweaks

This commit is contained in:
luboslenco
2026-06-12 18:27:17 +02:00
parent dd2123d6c9
commit c2173f5ea5
8 changed files with 13 additions and 27 deletions
+1 -1
View File
@@ -672,7 +672,7 @@ void ui_end_element_of_size(float h);
void ui_fade_color(float amount);
void ui_draw_string(char *text, float x, float y, int align, int truncate);
void ui_draw_shadow(float x, float y, float w, float h);
void ui_draw_rect(int fill, float x, float y, float w, float h);
void ui_draw_rect(int fill, int shadows, float x, float y, float w, float h);
void ui_start_text_edit(ui_handle_t *handle, int align);
float UI_SCALE(void);
float UI_ELEMENT_W(void);
-2
View File
@@ -474,8 +474,6 @@ void config_load_theme(char *theme, bool tag_redraw) {
gc_root(g_theme);
}
g_theme->FILL_WINDOW_BG = true;
if (tag_redraw) {
g_ui->ops->theme = g_theme;
base_redraw_ui();
+1 -1
View File
@@ -1038,7 +1038,7 @@ void minic_register_builtins() {
R(ui_fade_color, "v(f)");
R(ui_draw_string, "v(p,f,f,i,i)");
R(ui_draw_shadow, "v(f,f,f,f)");
R(ui_draw_rect, "v(i,f,f,f,f)");
R(ui_draw_rect, "v(i,i,f,f,f,f)");
R(ui_start_text_edit, "v(p,i)");
R(UI_SCALE, "f()");
R(UI_ELEMENT_W, "f()");
+1 -2
View File
@@ -325,8 +325,7 @@ void box_preferences_theme_tab() {
g_ui->changed = false;
if (string_equals(key, "FILL_WINDOW_BG") || string_equals(key, "FILL_BUTTON_BG") || string_equals(key, "FULL_TABS") ||
string_equals(key, "ROUND_CORNERS") || string_equals(key, "SHADOWS")) {
if (string_equals(key, "FILL_BUTTON_BG") || string_equals(key, "FULL_TABS") || string_equals(key, "SHADOWS")) {
h->b = val > 0;
bool b = ui_check(h, key, "");
*(u32_theme + i) = b;
+1 -1
View File
@@ -727,7 +727,7 @@ void tab_layers_draw_layer_context_menu_draw() {
5);
ui_combo(base_res_handle, ar, tr("Resolution"), true, UI_ALIGN_LEFT, true);
if (base_res_handle->changed) {
ui_menu_keep_open = true;
ui_menu_show_first = true;
config_set_texture_res(base_res_handle->i);
layers_on_resized();
}
-14
View File
@@ -19,18 +19,6 @@ void ui_box_init() {
ui_box_click_to_hide = true;
}
void ui_box_window_border() {
if (g_ui->scissor) {
g_ui->scissor = false;
gpu_disable_scissor();
}
// Border
draw_set_color(g_theme->SEPARATOR_COL);
draw_filled_rect(0, 0, 1, g_ui->_window_h);
draw_filled_rect(0 + g_ui->_window_w - 1, 0, 1, g_ui->_window_h);
draw_filled_rect(0, 0 + g_ui->_window_h - 1, g_ui->_window_w, 1);
}
void ui_box_render() {
if (!ui_menu_show) {
bool in_use = g_ui->combo_selected_handle != NULL;
@@ -124,7 +112,6 @@ void ui_box_render() {
if (ui_icon_button(tr("OK"), ICON_CHECK, UI_ALIGN_CENTER)) {
ui_box_hide();
}
ui_box_window_border();
}
ui_end();
}
@@ -134,7 +121,6 @@ void ui_box_render() {
if (ui_window(ui_box_hwnd, left, top, mw, mh, ui_box_draggable)) {
g_ui->_y += 10;
ui_box_commands();
ui_box_window_border();
}
g_ui->input_enabled = true;
ui_end();
+8 -5
View File
@@ -50,7 +50,8 @@ void ui_menu_render() {
}
// First draw out of screen, then align the menu based on menu height
if (ui_menu_show_first) {
bool out_of_screen = ui_menu_show_first;
if (out_of_screen) {
ui_menu_x -= iron_window_width() * 2;
ui_menu_y -= iron_window_height() * 2;
}
@@ -80,8 +81,10 @@ void ui_menu_render() {
ui_menu_show_first = false;
ui_menu_keep_open = true;
ui_menu_h = g_ui->_y - ui_menu_y;
ui_menu_x += iron_window_width() * 2;
ui_menu_y += iron_window_height() * 2;
if (out_of_screen) {
ui_menu_x += iron_window_width() * 2;
ui_menu_y += iron_window_height() * 2;
}
ui_menu_fit_to_screen();
ui_menu_render(); // Render at correct position now
}
@@ -245,7 +248,7 @@ void ui_menu_align() {
void ui_menu_begin() {
ui_draw_shadow(g_ui->_x, g_ui->_y, g_ui->_w, ui_menu_h);
draw_set_color(g_theme->SEPARATOR_COL);
ui_draw_rect(true, g_ui->_x, g_ui->_y, g_ui->_w, ui_menu_h);
ui_draw_rect(true, true, g_ui->_x, g_ui->_y, g_ui->_w, ui_menu_h);
draw_set_color(0xffffffff);
}
@@ -258,7 +261,7 @@ void ui_menu_sub_begin(i32 items) {
g_ui->_y -= UI_ELEMENT_H();
ui_draw_shadow(g_ui->_x, g_ui->_y, g_ui->_w, UI_ELEMENT_H() * items);
draw_set_color(g_theme->SEPARATOR_COL);
ui_draw_rect(true, g_ui->_x, g_ui->_y, g_ui->_w, UI_ELEMENT_H() * items);
ui_draw_rect(true, true, g_ui->_x, g_ui->_y, g_ui->_w, UI_ELEMENT_H() * items);
draw_set_color(0xffffffff);
}
+1 -1
View File
@@ -42,7 +42,7 @@ void ui_toolbar_tool_properties_menu() {
void ui_toolbar_draw_highlight() {
i32 size = ui_toolbar_w(false) - 4;
draw_set_color(g_theme->HIGHLIGHT_COL);
ui_draw_rect(true, g_ui->_x + -1, g_ui->_y + 2, size + 2, size + 2);
ui_draw_rect(true, true, g_ui->_x + -1, g_ui->_y + 2, size + 2, size + 2);
}
void ui_toolbar_draw_tool(i32 tool, gpu_texture_t *img, i32 icon_accent) {