Pixel-Composer/objects/o_dialog_add_node/Draw_64.gml

169 lines
6 KiB
Text
Raw Normal View History

2022-01-13 11:24:03 +07:00
/// @description init
if !ready exit;
2025-01-03 10:11:13 +07:00
DIALOG_DRAW_BG
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
2022-01-13 11:24:03 +07:00
2024-12-28 13:29:49 +07:00
#region content
2023-01-17 14:11:55 +07:00
WIDGET_CURRENT = tb_search;
2023-12-15 18:56:36 +07:00
tb_search.setFocusHover(sFOCUS, sHOVER);
2022-09-21 11:09:40 +07:00
var tw = dialog_w - ui(96);
var th = ui(32);
var tx = dialog_x + ui(14);
var ty = dialog_y + ui(14);
var sy = ty + th + ui(6);
2022-01-13 11:24:03 +07:00
if(search_string == "") {
2023-06-21 20:36:53 +02:00
catagory_pane.setFocusHover(sFOCUS, sHOVER);
catagory_pane.draw(dialog_x + ui(12), sy);
2023-06-05 18:27:53 +02:00
2024-12-29 16:12:24 +07:00
var _x = dialog_x + category_width + ui(20);
draw_sprite_stretched(THEME.ui_panel_bg, 1, _x, sy, dialog_w - category_width - ui(34), dialog_h - ui(66));
var _content_w = dialog_w - category_width - ui(40);
var _content_h = dialog_h - ui(66);
var _content_x = _x;
if(PREFERENCES.dialog_add_node_grouping == 2 && !array_empty(subgroups)) {
var _subw = ui(128);
_content_w -= _subw;
_content_x += _subw;
subcatagory_pane.verify(_subw, _content_h);
subcatagory_pane.setFocusHover(sFOCUS, sHOVER);
subcatagory_pane.draw(_x, sy);
}
content_pane.verify(_content_w, _content_h);
2023-06-21 20:36:53 +02:00
content_pane.setFocusHover(sFOCUS, sHOVER);
2024-12-29 16:12:24 +07:00
content_pane.draw(_content_x, sy);
2022-01-18 11:31:19 +07:00
node_selecting = 0;
2024-12-17 17:29:44 +07:00
2022-01-13 11:24:03 +07:00
} else {
2024-12-17 17:29:44 +07:00
draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(14), sy, dialog_w - ui(28), dialog_h - ui(66));
2023-06-21 20:36:53 +02:00
search_pane.setFocusHover(sFOCUS, sHOVER);
2024-12-17 17:29:44 +07:00
search_pane.draw(dialog_x + ui(16), sy);
tw -= ui(32);
2022-01-13 11:24:03 +07:00
}
2022-09-21 11:09:40 +07:00
2025-01-05 07:48:23 +07:00
if(junction_called != noone) tw -= ui(32);
tb_search.draw(tx, ty, tw, th, search_string, mouse_ui);
2023-01-09 09:14:20 +07:00
2024-12-29 16:12:24 +07:00
view_tooltip.index = PREFERENCES.dialog_add_node_view;
group_tooltip.index = PREFERENCES.dialog_add_node_grouping;
2022-11-03 17:44:49 +07:00
var bx = dialog_x + dialog_w - ui(44);
var by = dialog_y + ui(16);
2025-01-05 17:21:56 +07:00
var b = buttonInstant(THEME.button_hide_fill, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, view_tooltip, THEME.view_mode, PREFERENCES.dialog_add_node_view, COLORS._main_icon);
if(b == 1) {
if(key_mod_press(SHIFT) && mouse_wheel_up()) mod_dec_mf0 PREFERENCES.dialog_add_node_view mod_dec_mf1 PREFERENCES.dialog_add_node_view mod_dec_mf2 2 mod_dec_mf3 2 mod_dec_mf4;
if(key_mod_press(SHIFT) && mouse_wheel_down()) mod_inc_mf0 PREFERENCES.dialog_add_node_view mod_inc_mf1 PREFERENCES.dialog_add_node_view mod_inc_mf2 2 mod_inc_mf3;
}
if(b == 2) mod_inc_mf0 PREFERENCES.dialog_add_node_view mod_inc_mf1 PREFERENCES.dialog_add_node_view mod_inc_mf2 2 mod_inc_mf3;
2023-01-09 09:14:20 +07:00
bx -= ui(32);
2025-01-05 17:21:56 +07:00
var b = buttonInstant(THEME.button_hide_fill, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, group_tooltip, THEME.view_group, PREFERENCES.dialog_add_node_grouping, COLORS._main_icon);
if(b == 1) {
if(key_mod_press(SHIFT) && mouse_wheel_up()) mod_dec_mf0 PREFERENCES.dialog_add_node_grouping mod_dec_mf1 PREFERENCES.dialog_add_node_grouping mod_dec_mf2 3 mod_dec_mf3 3 mod_dec_mf4;
if(key_mod_press(SHIFT) && mouse_wheel_down()) mod_inc_mf0 PREFERENCES.dialog_add_node_grouping mod_inc_mf1 PREFERENCES.dialog_add_node_grouping mod_inc_mf2 3 mod_inc_mf3;
}
if(b == 2) mod_inc_mf0 PREFERENCES.dialog_add_node_grouping mod_inc_mf1 PREFERENCES.dialog_add_node_grouping mod_inc_mf2 3 mod_inc_mf3;
2023-02-14 17:40:24 +07:00
2025-01-05 07:48:23 +07:00
if(junction_called != 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 17:40:24 +07:00
var cc = node_show_connectable? COLORS._main_accent : COLORS._main_icon;
bx -= ui(32);
2025-01-05 17:21:56 +07:00
var b = buttonInstant(THEME.button_hide_fill, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.filter_type, node_show_connectable, cc);
if(b == 2) node_show_connectable = !node_show_connectable;
2023-02-14 17:40:24 +07:00
}
if(search_string != "") {
var txt = __txtx("add_node_highlight", "Hightlight Query");
bx -= ui(32);
2025-01-05 17:21:56 +07:00
if(buttonInstant(THEME.button_hide_fill, bx, by, ui(28), ui(28), mouse_ui, sHOVER, sFOCUS, txt, THEME.add_node_search_high, PREFERENCES.dialog_add_node_search_high, COLORS._main_icon) == 2)
PREFERENCES.dialog_add_node_search_high = !PREFERENCES.dialog_add_node_search_high;
}
2023-01-25 12:49:00 +07:00
#endregion
2023-03-05 13:16:44 +07: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();
2025-01-09 16:33:38 +07:00
var spr = node_tooltip.getTooltipSpr();
2023-03-05 13:16:44 +07:00
draw_set_font(f_p1);
var _th = string_height_ext(txt, -1, ww - ui(16));
2023-03-05 13:16:44 +07:00
if(spr) {
ww = sprite_get_width(spr);
hh = sprite_get_height(spr) + (_th - ui(8)) * (txt != "");
2023-03-05 13:16:44 +07:00
} else
hh = ui(16) + string_height_ext(txt, -1, ww - ui(16));
tooltip_surface = surface_verify(tooltip_surface, ww, hh);
surface_set_shader(tooltip_surface, noone);
draw_set_text(f_p1, fa_left, fa_bottom, COLORS._main_text)
if(spr) {
draw_sprite(spr, 0, 0, 0);
BLEND_NORMAL
if(txt != "") draw_sprite_stretched_ext(THEME.add_node_bg, 0, 0, hh - _th - 32, ww, _th + 32, CDEF.main_dkblack);
} else
draw_clear_alpha(c_white, 0);
draw_text_ext_add(ui(8), hh - ui(8), txt, -1, ww - ui(16));
BLEND_MULTIPLY
draw_sprite_stretched(THEME.ui_panel_bg, 4, 0, 0, ww, hh);
BLEND_NORMAL
2025-01-11 10:31:00 +07:00
var _aut = node_tooltip[$ "author"] ?? "";
var _lic = node_tooltip[$ "license"] ?? "";
draw_set_text(f_p2b, fa_right, fa_top, COLORS._main_text);
draw_text_add(ww - ui(8), ui(8), _aut);
draw_set_text(f_p3, fa_right, fa_top, COLORS._main_text, 0.75);
draw_text_ext_add(ww - ui(8), ui(8 + 20), _lic, -1, ww - ui(16));
draw_set_alpha(1);
surface_reset_shader();
2023-03-05 13:16:44 +07:00
var x0 = min(node_tooltip_x, WIN_W - ww - ui(8));
var y0 = node_tooltip_y - hh - ui(8);
2023-03-05 13:16:44 +07:00
2023-06-10 13:59:45 +02:00
draw_sprite_stretched(THEME.textbox, 3, x0, y0, ww, hh);
draw_surface(tooltip_surface, x0, y0);
2023-03-05 13:16:44 +07:00
draw_sprite_stretched(THEME.textbox, 0, x0, y0, ww, hh);
2025-01-05 07:48:23 +07:00
node_tooltip = noone;
}
if(sprite_exists(node_icon)) {
2025-01-05 07:48:23 +07:00
var _sx = node_icon_x - ui(16);
var _sy = node_icon_y;
2025-01-11 10:31:00 +07:00
var _sw = ui(64);
var _sh = ui(64);
2025-01-05 07:48:23 +07:00
var _bgx = _sx - _sw / 2;
var _bgy = _sy - _sh / 2;
draw_sprite_stretched(THEME.node_junction_name_bg, 0, _bgx - ui(10), _bgy - ui(10), _sw + ui(20), _sh + ui(20));
2025-01-11 10:31:00 +07:00
draw_sprite_stretched(node_icon, 0, _bgx, _bgy, _sw, _sh);
2023-03-05 13:16:44 +07:00
}
node_icon = noone;
2023-03-05 13:16:44 +07:00
2024-03-14 20:35:19 +07:00
ADD_NODE_SCROLL = content_pane.scroll_y_to;
if(mouse_release(mb_right))
right_free = true;
2025-01-05 07:48:23 +07:00
#endregion