Pixel-Composer/objects/o_dialog_add_node/Draw_64.gml

91 lines
3.2 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
if !ready exit;
#region base UI
2023-11-13 15:42:14 +01:00
DIALOG_DRAW_BG
if(sFOCUS) DIALOG_DRAW_FOCUS
2022-01-13 05:24:03 +01:00
#endregion
#region search
2023-01-17 08:11:55 +01:00
WIDGET_CURRENT = tb_search;
2023-12-15 12:56:36 +01:00
tb_search.setFocusHover(sFOCUS, sHOVER);
2022-09-21 06:09:40 +02:00
2022-01-13 05:24:03 +01:00
if(search_string == "") {
2023-06-21 20:36:53 +02:00
catagory_pane.setFocusHover(sFOCUS, sHOVER);
2022-11-03 11:44:49 +01:00
catagory_pane.draw(dialog_x + ui(14), dialog_y + ui(52));
2023-06-05 18:27:53 +02:00
var _x = dialog_x + category_width - ui(12);
draw_sprite_stretched(THEME.ui_panel_bg, 1, _x, dialog_y + ui(52), dialog_w - category_width - ui(2), dialog_h - ui(66));
2023-06-21 20:36:53 +02:00
content_pane.setFocusHover(sFOCUS, sHOVER);
2023-06-05 18:27:53 +02:00
content_pane.draw(_x, dialog_y + ui(52));
2022-01-18 05:31:19 +01:00
node_selecting = 0;
2022-01-13 05:24:03 +01:00
} else {
draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(14), dialog_y + ui(52), dialog_w - ui(28), dialog_h - ui(66));
2023-06-21 20:36:53 +02:00
search_pane.setFocusHover(sFOCUS, sHOVER);
2022-11-03 11:44:49 +01:00
search_pane.draw(dialog_x + ui(16), dialog_y + ui(52));
2022-01-13 05:24:03 +01:00
}
2022-09-21 06:09:40 +02:00
2023-02-14 11:40:24 +01:00
var tw = dialog_w - ui(96);
if(node_called != noone || junction_hovering != noone)
tw -= ui(32);
tb_search.draw(dialog_x + ui(14), dialog_y + ui(14), tw, ui(32), search_string, mouse_ui);
2023-01-09 03:14:20 +01:00
2022-11-03 11:44:49 +01:00
var bx = dialog_x + dialog_w - ui(44);
var by = dialog_y + ui(16);
2022-11-18 03:20:31 +01:00
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER,
2023-10-31 05:30:42 +01:00
PREFERENCES.dialog_add_node_view? __txtx("view_list", "List view") : __txtx("view_grid", "Grid view"),
THEME.view_mode, PREFERENCES.dialog_add_node_view, COLORS._main_icon);
2022-09-21 06:09:40 +02:00
if(b == 2)
2023-10-31 05:30:42 +01:00
PREFERENCES.dialog_add_node_view = !PREFERENCES.dialog_add_node_view;
2023-01-09 03:14:20 +01:00
bx -= ui(32);
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER,
2023-10-31 05:30:42 +01:00
PREFERENCES.dialog_add_node_grouping? __txtx("add_node_group_enabled", "Group enabled") : __txtx("add_node_group_disabled", "Group disabled"),
THEME.view_group, PREFERENCES.dialog_add_node_grouping, COLORS._main_icon);
2023-01-09 03:14:20 +01:00
if(b == 2)
2023-10-31 05:30:42 +01:00
PREFERENCES.dialog_add_node_grouping = !PREFERENCES.dialog_add_node_grouping;
2023-02-14 11:40:24 +01:00
if(node_called != noone || junction_hovering != noone) {
2023-06-04 18:28:29 +02:00
var txt = node_show_connectable? __txtx("add_node_show_connect", "Showing connectable") : __txtx("add_node_show_all", "Showing all");
2023-02-14 11:40:24 +01:00
var cc = node_show_connectable? COLORS._main_accent : COLORS._main_icon;
bx -= ui(32);
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, txt, THEME.filter_type, node_show_connectable, cc);
if(b == 2)
node_show_connectable = !node_show_connectable;
}
2023-01-25 06:49:00 +01:00
#endregion
2023-03-05 07:16:44 +01:00
#region tooltip
if(node_tooltip != noone) {
var ww = ui(300 + 8);
var hh = ui(16);
2023-06-05 18:27:53 +02:00
var txt = node_tooltip.getTooltip();
2023-03-05 07:16:44 +01:00
var spr = node_tooltip.tooltip_spr;
draw_set_font(f_p1);
if(spr) {
ww = ui(8) + sprite_get_width(spr);
hh = ui(8) + sprite_get_height(spr);
} else
hh = ui(16) + string_height_ext(txt, -1, ww - ui(16));
var x0 = min(node_tooltip_x, WIN_W - ww - ui(8));
var x1 = node_tooltip_x + ww;
var y1 = node_tooltip_y - ui(8);
var y0 = y1 - hh;
2023-06-10 13:59:45 +02:00
draw_sprite_stretched(THEME.textbox, 3, x0, y0, ww, hh);
2023-03-05 07:16:44 +01:00
draw_sprite_stretched(THEME.textbox, 0, x0, y0, ww, hh);
2023-06-05 18:27:53 +02:00
if(spr) draw_sprite(spr, 0, x0 + ui(4), y0 + ui(4));
2023-03-05 07:16:44 +01:00
draw_set_text(f_p1, fa_left, fa_bottom, COLORS._main_text)
2023-06-05 19:41:01 +02:00
draw_text_line(x0 + ui(8), y1 - ui(8), txt, -1, ww - ui(16));
2023-03-05 07:16:44 +01:00
}
node_tooltip = noone;
2024-03-14 14:35:19 +01:00
ADD_NODE_SCROLL = content_pane.scroll_y_to;
#endregion