mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-26 11:44:52 +01:00
Opening context menu now keep focus frame on the parent panel / dialog.
This commit is contained in:
parent
21626889d9
commit
48a57ea4d8
28 changed files with 73 additions and 83 deletions
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region about
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(16), __txtx("add_images_title_single", "Import image as"));
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(16), __txtx("add_images_title_images", "Import multiple images as"));
|
||||
|
|
|
@ -3,7 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS) DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region search
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/// @description init
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region draw
|
||||
|
|
|
@ -7,8 +7,7 @@ draw_set_alpha(1);
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region text
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(16), __txtx("add_images_title_direcory", "Import directory"));
|
||||
|
|
|
@ -21,7 +21,7 @@ DIALOG_WINCLEAR
|
|||
|
||||
var _des = false;
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS) DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
#region text
|
||||
var py = dialog_y + ui(16);
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/// @description init
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region draw TB
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/// @description init
|
||||
#region base UI
|
||||
// DIALOG_DRAW_BG
|
||||
// if(sFOCUS)
|
||||
// DIALOG_DRAW_FOCUS
|
||||
// if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||
if(sFOCUS) draw_sprite_stretched_ext(THEME.textbox, 2, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent);
|
||||
else draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_order_title", "IO order"));
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_output_order_title", "Output order"));
|
||||
|
|
|
@ -4,8 +4,7 @@ if !target exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(padding), dialog_y + ui(20), __txtx("array_edit_title", "Image array edit"));
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(padding), dialog_y + ui(20), "Lindenmayer System reference");
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(padding), dialog_y + ui(20), "Lua reference");
|
||||
|
|
|
@ -25,6 +25,9 @@ event_inherited();
|
|||
|
||||
setFocus(self.id);
|
||||
|
||||
#endregion
|
||||
|
||||
#region menu
|
||||
item_sel_submenu = noone;
|
||||
remove_parents = true;
|
||||
selecting_menu = noone;
|
||||
|
@ -119,3 +122,10 @@ event_inherited();
|
|||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region focus
|
||||
function getContextPanel() {
|
||||
if(is(context, PanelContent)) return context.panel;
|
||||
return context;
|
||||
}
|
||||
#endregion
|
|
@ -7,8 +7,7 @@ draw_set_alpha(1);
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region text
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("output_visibility_title", "Outputs visibility"));
|
||||
|
|
|
@ -95,34 +95,31 @@ if(window == noone && instanceof(content) != "Panel_Menu") {
|
|||
if(b == 2) destroy_on_click_out = !destroy_on_click_out;
|
||||
}
|
||||
|
||||
if(sFOCUS) {
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
if(window == noone && !m_in && m_ot) {
|
||||
var p = DIALOG_PAD;
|
||||
var p2 = DIALOG_PAD * 2;
|
||||
draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - p, dialog_y - p, dialog_w + p2, dialog_h + p2, c_white, 0.4);
|
||||
if(sFOCUS && window == noone && !m_in && m_ot) {
|
||||
var p = DIALOG_PAD;
|
||||
var p2 = DIALOG_PAD * 2;
|
||||
draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - p, dialog_y - p, dialog_w + p2, dialog_h + p2, c_white, 0.4);
|
||||
|
||||
if(DOUBLE_CLICK) {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
if(DOUBLE_CLICK) {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
|
||||
instance_destroy();
|
||||
instance_destroy();
|
||||
|
||||
} else if(mouse_press(mb_right)) {
|
||||
menuCall("panel_window_menu", [
|
||||
menuItem(__txt("Move"), function() {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
panel_mouse = 1;
|
||||
|
||||
instance_destroy();
|
||||
}),
|
||||
]);
|
||||
}
|
||||
} else if(mouse_press(mb_right)) {
|
||||
menuCall("panel_window_menu", [
|
||||
menuItem(__txt("Move"), function() {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
panel_mouse = 1;
|
||||
|
||||
instance_destroy();
|
||||
}),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ if !ready exit;
|
|||
instance_destroy();
|
||||
}
|
||||
|
||||
if(sFOCUS) DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region patreon login
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(56), dialog_y + ui(20), __txt("Preferences"));
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txt("Presets"));
|
||||
|
|
|
@ -3,8 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region text
|
||||
|
|
|
@ -12,7 +12,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS) DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region text
|
||||
|
|
|
@ -8,8 +8,7 @@ draw_set_alpha(1);
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region text
|
||||
|
|
|
@ -3,7 +3,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS) DIALOG_DRAW_FOCUS
|
||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region content
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
#macro mouse_raw_y display_mouse_get_y()
|
||||
|
||||
#macro sFOCUS (FOCUS == self.id)
|
||||
#macro DIALOG_SHOW_FOCUS (FOCUS == self.id || (instance_exists(o_dialog_menubox) && o_dialog_menubox.getContextPanel() == self))
|
||||
#macro sHOVER (!CURSOR_IS_LOCK && (HOVER == self.id || (WINDOW_ACTIVE != noone && winwin_mouse_is_over_safe(WINDOW_ACTIVE))))
|
||||
|
||||
#macro DELTA_TIME delta_time / 1_000_000
|
||||
|
|
|
@ -714,24 +714,24 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
|
|||
draw_sprite_stretched_ext(THEME.ui_panel, 1, tx + padding, ty + padding, _tw, _th, COLORS.panel_frame);
|
||||
if(tab) draw_sprite_bbox(THEME.ui_panel_tab, 3, tab_cover);
|
||||
|
||||
if(FOCUS == self && parent != noone) {
|
||||
if(FOCUS == self || (instance_exists(o_dialog_menubox) && o_dialog_menubox.getContextPanel() == self)) {
|
||||
var _color = PREFERENCES.panel_outline_accent? COLORS._main_accent : COLORS.panel_select_border;
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, tx + padding, ty + padding, tw - padding * 2, th - padding * 2, _color, 1);
|
||||
}
|
||||
|
||||
if(hasContent() && !m_in && m_ot) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, tx + padding, ty + padding, tw - padding * 2, th - padding * 2, c_white, 0.4);
|
||||
if(FOCUS == self && parent != noone && !m_in && m_ot) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel, 1, tx + padding, ty + padding, tw - padding * 2, th - padding * 2, c_white, 0.4);
|
||||
|
||||
if(DOUBLE_CLICK) {
|
||||
extract();
|
||||
panel_mouse = 0;
|
||||
if(DOUBLE_CLICK) {
|
||||
extract();
|
||||
panel_mouse = 0;
|
||||
|
||||
} else if(mouse_press(mb_right)) {
|
||||
var menu = array_clone(border_rb_menu);
|
||||
if(instanceof(getContent()) == "Panel_Menu")
|
||||
array_remove(menu, border_rb_close);
|
||||
} else if(mouse_press(mb_right)) {
|
||||
var menu = array_clone(border_rb_menu);
|
||||
if(instanceof(getContent()) == "Panel_Menu")
|
||||
array_remove(menu, border_rb_close);
|
||||
|
||||
menuCall("panel_border_menu", menu);
|
||||
}
|
||||
menuCall("panel_border_menu", menu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue