menuitem actions

This commit is contained in:
Tanasart 2024-08-10 12:30:41 +07:00
parent 5644cffee8
commit f4065ae249
34 changed files with 10378 additions and 10334 deletions

View File

@ -7,5 +7,4 @@ ds_list_remove(DIALOGS, self);
if(parent) array_remove(parent.children, id);
if(!passthrough)
MOUSE_BLOCK = true;
if(!passthrough) MOUSE_BLOCK = true;

View File

@ -12,8 +12,8 @@ event_inherited();
show_graph = false;
menu = [
menuItemAction("Toggle double click bar", function() /*=>*/ { show_doubleclick = !show_doubleclick; }),
menuItemAction("Toggle graph", function() /*=>*/ { show_graph = !show_graph; }),
menuItem("Toggle double click bar", function() /*=>*/ { show_doubleclick = !show_doubleclick; }),
menuItem("Toggle graph", function() /*=>*/ { show_graph = !show_graph; }),
];
extra_keys = [

View File

@ -78,7 +78,7 @@ event_inherited();
node_menu_selecting = node;
var fav = array_exists(global.FAV_NODES, node.node);
var menu = [
menuItemAction(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star)
menuItem(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star)
];
menuCall("add_node_window_manu",,, menu,, node_menu_selecting);

View File

@ -101,10 +101,10 @@ event_inherited();
hovering = pal;
menuCall("palette_window_preset_menu",,, [
menuItemAction(__txtx("palette_editor_set_default", "Set as default"), function() {
menuItem(__txtx("palette_editor_set_default", "Set as default"), function() {
PROJECT.setPalette(array_clone(hovering.palette));
}),
menuItemAction(__txtx("palette_editor_delete", "Delete palette"), function() {
menuItem(__txtx("palette_editor_delete", "Delete palette"), function() {
file_delete(hovering.path);
__initPalette();
}),

View File

@ -138,7 +138,7 @@ event_inherited();
if(mouse_press(mb_right, interactable && sFOCUS)) {
hovering_name = _gradient.path;
menuCall("gradient_window_preset_menu",,, [
menuItemAction(__txtx("gradient_editor_delete", "Delete gradient"), function() {
menuItem(__txtx("gradient_editor_delete", "Delete gradient"), function() {
file_delete(hovering_name);
__initGradient();
})
@ -227,7 +227,7 @@ event_inherited();
hovering = pal;
menuCall("palette_window_preset_menu",,, [
menuItemAction(__txtx("gradient_set_palette", "Convert to Gradient"), function() {
menuItem(__txtx("gradient_set_palette", "Convert to Gradient"), function() {
var _p = hovering.palette;
if(array_length(_p) < 2) return;

View File

@ -100,11 +100,11 @@ if !ready exit;
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("gradient_editor_key_blend", "Key blending"), THEME.grad_blend) == 2) {
menuCall("gradient_window_blend_menu", bx + ui(32), by, [
menuItemAction(__txtx("gradient_editor_blend_hard", "Solid"), function() { gradient.type = 1; onApply(gradient); }),
menuItemAction(__txtx("gradient_editor_blend_RGB", "RGB"), function() { gradient.type = 0; onApply(gradient); }),
menuItemAction(__txtx("gradient_editor_blend_sRGB", "sRGB"), function() { gradient.type = 4; onApply(gradient); }),
menuItemAction(__txtx("gradient_editor_blend_HSV", "HSV"), function() { gradient.type = 2; onApply(gradient); }),
menuItemAction(__txtx("gradient_editor_blend_OKLAB", "OKLAB"), function() { gradient.type = 3; onApply(gradient); }),
menuItem(__txtx("gradient_editor_blend_hard", "Solid"), function() { gradient.type = 1; onApply(gradient); }),
menuItem(__txtx("gradient_editor_blend_RGB", "RGB"), function() { gradient.type = 0; onApply(gradient); }),
menuItem(__txtx("gradient_editor_blend_sRGB", "sRGB"), function() { gradient.type = 4; onApply(gradient); }),
menuItem(__txtx("gradient_editor_blend_HSV", "HSV"), function() { gradient.type = 2; onApply(gradient); }),
menuItem(__txtx("gradient_editor_blend_OKLAB", "OKLAB"), function() { gradient.type = 3; onApply(gradient); }),
],, gradient);
}
bx -= ui(32);

View File

@ -112,7 +112,7 @@ event_inherited();
if(menu > -1) {
menuCall("image_array_edit_menu",,, [
menuItemAction(__txt("Remove"), function() {
menuItem(__txt("Remove"), function() {
var arr = target.getValue();
array_delete(arr, menuOn, 1);

View File

@ -10,7 +10,8 @@ event_inherited();
menu_id = "";
alarm[0] = -1;
menu = 1;
hght = ui(36);
font = f_p1;
hght = line_get_height(font, 12);
tooltips = [];
show_icon = false;
context = noone;
@ -20,6 +21,7 @@ event_inherited();
setFocus(self.id);
item_selecting = noone;
remove_parents = true;
selecting_menu = noone;
hk_editing = noone;
@ -39,7 +41,7 @@ event_inherited();
instance_destroy(children[i]);
children = [];
draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text);
draw_set_text(font, fa_center, fa_center, COLORS._main_text);
for(var i = 0; i < array_length(menu); i++) {
var _menuItem = menu[i];
if(_menuItem == -1) {
@ -54,7 +56,7 @@ event_inherited();
continue;
}
draw_set_font(f_p0);
draw_set_font(font);
var ww = string_width(_menuItem.name) + ui(64);
if(instanceof(_menuItem) == "MenuItemGroup") {
@ -67,7 +69,7 @@ event_inherited();
if(_menuItem.hotkey != noone) {
var _key = find_hotkey(_menuItem.hotkey[0], _menuItem.hotkey[1]);
if(_key) {
draw_set_font(f_p1);
draw_set_font(font);
var ss = key_get_name(_key.key, _key.modi);
ww += string_width(ss) + ui(16);
}

View File

@ -0,0 +1,4 @@
event_inherited();
for( var i = 0, n = array_length(children); i < n; i++ )
instance_destroy(children[i]);

View File

@ -5,6 +5,10 @@ if(!ready) exit;
var yy = dialog_y;
var _lclick = sFOCUS && (!mouse_init_inside && mouse_release(mb_left)) || (keyboard_check_pressed(vk_enter) && hk_editing == noone);
var _rclick = sFOCUS && (!mouse_init_inside && mouse_release(mb_right));
if(!mouse_init_inside && mouse_press(mb_right) && item_selecting) {
instance_destroy(item_selecting);
item_selecting = noone;
}
draw_sprite_stretched(THEME.s_box_r2_clr, 0, dialog_x, dialog_y, dialog_w, dialog_h);
@ -23,8 +27,8 @@ if(!ready) exit;
_menuItem = _menuItem.shiftMenu;
if(_menuItem == -1) {
var bx = dialog_x + ui(8);
var bw = dialog_w - ui(16);
var bx = dialog_x + ui(16);
var bw = dialog_w - ui(32);
draw_set_color(CDEF.main_mdblack);
draw_line_width(bx, yy + ui(3), bx + bw, yy + ui(3), 2);
yy += ui(8);
@ -50,9 +54,9 @@ if(!ready) exit;
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc, _ha);
if(is_instanceof(_menuItem, MenuItem) && _menuItem.active && _hovering_ch) {
if(is_instanceof(_menuItem, MenuItem) && _hovering_ch) {
if(_lclick) {
if(_menuItem.active && _lclick) {
var _dat = {
_x: dialog_x,
x: dialog_x + dialog_w,
@ -72,7 +76,7 @@ if(!ready) exit;
if(_key && _rclick) {
var _dat = {
_x: dialog_x,
_x: mouse_mx + ui(4),
x: mouse_mx + ui(4),
y: mouse_my + ui(4),
depth: depth,
@ -83,19 +87,21 @@ if(!ready) exit;
};
selecting_menu = _menuItem;
var _loadKey = $"{_key.context}.{_key.name}";
var _loadKey = string_to_var($"{_key.context}.{_key.name}");
var context_menu_settings = [
_loadKey,
menuItemAction("Edit hotkey", function() /*=>*/ {
menuItem("Edit hotkey", function() /*=>*/ {
hk_editing = selecting_menu;
keyboard_lastchar = hk_editing.hoykeyObject.key;
}),
];
with(o_dialog_menubox) { if(!remove_parents) instance_destroy(); }
var _menu = submenuCall(_dat, context_menu_settings);
_menu.remove_parents = false;
item_selecting = submenuCall(_dat, context_menu_settings);
item_selecting.remove_parents = false;
array_push(children, item_selecting.id);
}
}
} else if(cc != c_white)
@ -103,7 +109,7 @@ if(!ready) exit;
if(is_instanceof(_menuItem, MenuItemGroup)) {
var _submenus = _menuItem.group;
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
draw_set_text(font, fa_center, fa_center, COLORS._main_text_sub);
draw_set_alpha(_menuItem.active * 0.75 + 0.25);
draw_text(dialog_x + dialog_w / 2, yy + hght / 2, label);
draw_set_alpha(1);
@ -166,7 +172,7 @@ if(!ready) exit;
if(_menuItem.spr != noone) {
var spr = is_array(_menuItem.spr)? _menuItem.spr[0] : _menuItem.spr;
var ind = is_array(_menuItem.spr)? _menuItem.spr[1] : 0;
draw_sprite_ui(spr, ind, dialog_x + ui(24), yy + hght / 2,,,, COLORS._main_icon, _menuItem.active * 0.5 + 0.25);
draw_sprite_ui(spr, ind, dialog_x + ui(24), yy + hght / 2, .8, .8, 0, COLORS._main_icon, _menuItem.active * 0.5 + 0.25);
}
if(_menuItem.toggle != noone) {
@ -175,19 +181,21 @@ if(!ready) exit;
}
var tx = dialog_x + show_icon * ui(32) + ui(16);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_set_text(font, fa_left, fa_center, COLORS._main_text);
draw_set_alpha(_menuItem.active * 0.75 + 0.25);
draw_text(tx, yy + hght / 2, label);
draw_set_alpha(1);
var _hx = dialog_x + dialog_w - ui(16);
var _hy = yy + hght / 2 + ui(2);
if(_menuItem.isShelf) {
draw_sprite_ui_uniform(THEME.arrow, 0, dialog_x + dialog_w - ui(20), yy + hght / 2, 1, COLORS._main_icon);
} else if(_key) {
var _hx = dialog_x + dialog_w - ui(16);
var _hy = yy + hght / 2 + ui(2);
draw_set_font(f_p1);
_hx -= ui(24);
}
if(_key) {
draw_set_font(font);
var _ktxt = key_get_name(_key.key, _key.modi);
var _tw = string_width(_ktxt);
@ -199,11 +207,11 @@ if(!ready) exit;
var _bh = _th + ui(3);
if(hk_editing == _menuItem) {
draw_set_text(f_p1, fa_right, fa_center, COLORS._main_accent);
draw_set_text(font, fa_right, fa_center, COLORS._main_accent);
draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, COLORS._main_text_accent);
} else if(_ktxt != "") {
draw_set_text(f_p1, fa_right, fa_center, COLORS._main_text_sub);
draw_set_text(font, fa_right, fa_center, COLORS._main_text_sub);
draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, CDEF.main_dkgrey);
}
@ -217,11 +225,12 @@ if(!ready) exit;
if(hk_editing != noone) {
if(keyboard_check_pressed(vk_enter))
hk_editing = noone;
else if(keyboard_check_pressed(vk_escape))
hk_editing = noone;
else
hotkey_editing(hk_editing.hoykeyObject);
if(keyboard_check_pressed(vk_escape))
hk_editing = noone;
} else if(sFOCUS) {
if(keyboard_check_pressed(vk_up)) {
selecting--;

View File

@ -9,5 +9,4 @@ for( var i = 0, n = array_length(children); i < n; i++ ) {
}
_hovering_ch = hov;
if((mouse_check_button_pressed(mb_left)) && !hov)
instance_destroy();
if(!hov && mouse_press(mb_left)) instance_destroy();

View File

@ -3,6 +3,7 @@
"%Name":"o_dialog_menubox",
"eventList":[
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],

View File

@ -122,10 +122,10 @@ event_inherited();
hovering = pal;
menuCall("palette_window_preset_menu",,, [
menuItemAction(__txtx("palette_editor_set_default", "Set as default"), function() {
menuItem(__txtx("palette_editor_set_default", "Set as default"), function() {
PROJECT.setPalette(array_clone(hovering.palette));
}),
menuItemAction(__txtx("palette_editor_delete", "Delete palette"), function() {
menuItem(__txtx("palette_editor_delete", "Delete palette"), function() {
file_delete(hovering.path);
__initPalette();
}),

View File

@ -87,12 +87,12 @@ if palette == 0 exit;
if(b) mouse_draggable = false;
if(b == 2) {
menuCall("palette_window_sort_menu", bx + ui(32), by, [
menuItemAction(__txtx("palette_editor_sort_brighter", "Brighter"), function() { sortPalette(__sortBright); }),
menuItemAction(__txtx("palette_editor_sort_darker", "Darker"), function() { sortPalette(__sortDark); }),
menuItem(__txtx("palette_editor_sort_brighter", "Brighter"), function() { sortPalette(__sortBright); }),
menuItem(__txtx("palette_editor_sort_darker", "Darker"), function() { sortPalette(__sortDark); }),
-1,
menuItemAction(__txtx("palette_editor_sort_hue", "Hue"), function() { sortPalette(__sortHue); }),
menuItemAction(__txtx("palette_editor_sort_sat", "Saturation"), function() { sortPalette(__sortSat); }),
menuItemAction(__txtx("palette_editor_sort_val", "Value"), function() { sortPalette(__sortVal); }),
menuItem(__txtx("palette_editor_sort_hue", "Hue"), function() { sortPalette(__sortHue); }),
menuItem(__txtx("palette_editor_sort_sat", "Saturation"), function() { sortPalette(__sortSat); }),
menuItem(__txtx("palette_editor_sort_val", "Value"), function() { sortPalette(__sortVal); }),
],, palette);
}
bx -= ui(32);

View File

@ -13,6 +13,8 @@ event_inherited();
adding = false;
add_txt = "";
tb_add = new textBox(TEXTBOX_INPUT.text, function(txt) /*=>*/ { add_txt = txt; newPresetFromNode(txt); adding = false; });
selecting_path = "";
#endregion
#region content
@ -52,13 +54,8 @@ event_inherited();
}
if(mouse_click(mb_right, sFOCUS)) {
var dia = menuCall("preset_window_menu",,, [
menuItemAction(__txt("Delete"), function() {
file_delete(o_dialog_menubox.path);
__initPresets();
}),
],, preset);
dia.path = preset.path;
selecting_path = preset.path;
var dia = menuCall("preset_window_menu",,, [ menuItem(__txt("Delete"), function() { file_delete(selecting_path); __initPresets(); }), ]);
}
}

View File

@ -41,7 +41,7 @@ function addonContextItem(_addon, _name, _function) constructor {
self._name = _name;
self._function = _function;
menu_item = menuItemAction(_name, function(_data) {
menu_item = menuItem(_name, function(_data) {
lua_call(_addon.thread, self._function, lua_byref(_data.context, true));
})//.setColor(COLORS._main_accent);
}
@ -50,7 +50,7 @@ function addonContextSubMenu(_name, _content) constructor {
self.name = _name;
self.content = _content;
menu_item = menuItemAction(name, function(_dat) {
menu_item = menuItem(name, function(_dat) {
return submenuCall(_dat, content);
})//.setColor(COLORS._main_accent)
.setIsShelf();

View File

@ -33,7 +33,9 @@ function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], cont
return dia;
}
function submenuCall(_data, menu = []) {
function submenuCall(_data = undefined, menu = []) {
if(is_undefined(_data)) return menuCall("",,, menu);
var dia = instance_create_depth(_data.x - ui(4), _data.y, _data.depth - 1, o_dialog_menubox);
dia.context = _data.context;
dia.setMenu(menu);
@ -41,7 +43,6 @@ function submenuCall(_data, menu = []) {
if(_data.x - ui(4) + dia.dialog_w > WIN_W - ui(2))
dia.dialog_x = _data._x - dia.dialog_w + ui(4);
return dia;
}

View File

@ -11,27 +11,63 @@
}
function __fnInit() {
globalvar CMD_FUNCTIONS, ACTION_MAP;
globalvar CMD_FUNCTIONS, ACTION_MAP, MENU_ITEMS, FUNCTIONS;
FUNCTIONS = {};
CMD_FUNCTIONS = {};
ACTION_MAP = {};
MENU_ITEMS = {};
__fnInit_Global();
__fnInit_Panels();
__fnInit_Preview();
__fnInit_Inspector();
__fnInit_Animation();
__fnInit_Graph();
__fnInit_Collection();
__fnInit_Presets();
__fnInit_Notification();
__fnInit_Preview_Window();
}
#endregion
function registerFunction(_context, _name, _key, _mod, _action, _args = []) {
function registerFunction(_context, _name, _key, _mod, _action) { return new functionOnject(_context, _name, _key, _mod, _action); }
function functionOnject(_context, _name, _key, _mod, _action) constructor {
addHotkey(_context, _name, _key, _mod, _action);
var _fnName = _context == ""? _name : $"{_context} {_name}";
_fnName = string_to_var(_fnName);
context = _context;
name = _name;
dkey = _key;
dmod = _mod;
action = _action;
hide = false;
fnName = _context == ""? _name : $"{_context} {_name}";
fnName = string_to_var(fnName);
CMD_FUNCTIONS[$ _fnName] = { _action, _args };
ACTION_MAP[$ _action] = [ _context, _name ];
FUNCTIONS[$ fnName] = self;
CMD_FUNCTIONS[$ fnName] = { action: _action, args: [] };
ACTION_MAP[$ _action] = [ _context, _name ];
static setArg = function(_args = []) {
CMD_FUNCTIONS[$ fnName] = { action, args: _args };
return self;
}
static setMenu = function(_id, _spr = noone, shelf = false) {
var men = menuItemAction(__txt(name), action, _spr);
if(shelf) men.setIsShelf();
MENU_ITEMS[$ _id] = men;
return self;
}
static hidePalette = function() {
hide = true;
return self;
}
}
function callStatusFunction(name) {

View File

@ -178,62 +178,6 @@
DEF_SURFACE_RESET();
#endregion
#region functions
function global_fullscreen() { CALL("fullscreen"); winMan_setFullscreen(!window_is_fullscreen); }
function global_project_close() { CALL("close_project"); PANEL_GRAPH.close(); }
function global_project_close_all() { CALL("close_project_all"); for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); }
function global_theme_reload() { CALL("reload_theme"); loadGraphic(PREFERENCES.theme); resetPanel(); }
function global_render_all() { CALL("render_all"); RENDER_ALL_REORDER }
function global_export_all() {
for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) {
var node = PROJECT.allNodes[i];
if(!node.active) continue;
if(instanceof(node) != "Node_Export") continue;
node.doInspectorAction();
}
}
function __fnInit_Global() {
registerFunction("", "New file", "N", MOD_KEY.ctrl, NEW);
if(!DEMO) {
registerFunction("", "Save", "S", MOD_KEY.ctrl, SAVE);
registerFunction("", "Save as", "S", MOD_KEY.ctrl | MOD_KEY.shift, SAVE_AS);
registerFunction("", "Save at", "", MOD_KEY.none, SAVE_AT, [ ARG("project", function() { return PROJECT; }, true), ARG("path", ""), ARG("log", "save at ") ]);
registerFunction("", "Save all", "S", MOD_KEY.ctrl | MOD_KEY.alt, SAVE_ALL);
registerFunction("", "Open", "O", MOD_KEY.ctrl, LOAD);
registerFunction("", "Open Safe", "", MOD_KEY.none, LOAD_SAFE);
registerFunction("", "Open at", "", MOD_KEY.none, LOAD_AT, [ ARG("path", ""), ARG("readonly", false), ARG("override", false) ]);
registerFunction("", "Append", "", MOD_KEY.none, APPEND, [ ARG("path", ""), ARG("context", function() { return PANEL_GRAPH.getCurrentContext(); }, true) ]);
registerFunction("", "Import .zip", "", MOD_KEY.none, __IMPORT_ZIP);
registerFunction("", "Export .zip", "", MOD_KEY.none, __EXPORT_ZIP);
}
registerFunction("", "Undo", "Z", MOD_KEY.ctrl, UNDO);
registerFunction("", "Redo", "Z", MOD_KEY.ctrl | MOD_KEY.shift, REDO);
registerFunction("", "Full panel", "`", MOD_KEY.none, set_focus_fullscreen);
registerFunction("", "Reset layout", vk_f10, MOD_KEY.ctrl, resetPanel);
registerFunction("", "Open notification", vk_f12, MOD_KEY.none, function() /*=>*/ { dialogPanelCall(new Panel_Notification()); });
registerFunction("", "Fullscreen", vk_f11, MOD_KEY.none, global_fullscreen);
registerFunction("", "Render all", vk_f5, MOD_KEY.none, global_render_all);
registerFunction("", "Export all", "", MOD_KEY.none, global_export_all);
registerFunction("", "Close file", "Q", MOD_KEY.ctrl, global_project_close);
registerFunction("", "Close all files", "", MOD_KEY.none, global_project_close_all);
registerFunction("", "Close program", vk_f4, MOD_KEY.alt, window_close);
registerFunction("", "Close project", "", MOD_KEY.none, closeProject, [ ARG("project", function() { return PROJECT; }, true) ]);
registerFunction("", "Reload theme", vk_f10, MOD_KEY.ctrl | MOD_KEY.shift, global_theme_reload);
}
#endregion
#region debug
global.FLAG = {
render : 0,

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
#region funtion calls
function __fnInit_Collection() {
registerFunction("Collection", "Replace", "", MOD_KEY.none, panel_collection_replace);
registerFunction("Collection", "Edit Meta", "", MOD_KEY.none, panel_collection_edit_meta);
registerFunction("Collection", "Update Thumbnail", "", MOD_KEY.none, panel_collection_update_thumbnail);
registerFunction("Collection", "Delete Collection", "", MOD_KEY.none, panel_collection_delete_collection);
registerFunction("Collection", "Replace", "", MOD_KEY.none, panel_collection_replace ).setMenu("collection_replace")
registerFunction("Collection", "Edit Meta", "", MOD_KEY.none, panel_collection_edit_meta ).setMenu("collection_edit_meta")
registerFunction("Collection", "Update Thumbnail", "", MOD_KEY.none, panel_collection_update_thumbnail ).setMenu("collection_update_thumbnail")
registerFunction("Collection", "Delete Collection", "", MOD_KEY.none, panel_collection_delete_collection ).setMenu("collection_delete_collection")
registerFunction("Collection", "Upload To Steam", "", MOD_KEY.none, panel_collection_steam_file_upload);
registerFunction("Collection", "Update Steam", "", MOD_KEY.none, panel_collection_steam_file_update);
registerFunction("Collection", "Unsubscribe", "", MOD_KEY.none, panel_collection_steam_unsubscribe);
registerFunction("Collection", "Upload To Steam", "", MOD_KEY.none, panel_collection_steam_file_upload ).setMenu("collection_upload_to_steam")
registerFunction("Collection", "Update Steam", "", MOD_KEY.none, panel_collection_steam_file_update ).setMenu("collection_update_steam")
registerFunction("Collection", "Unsubscribe", "", MOD_KEY.none, panel_collection_steam_unsubscribe ).setMenu("collection_unsubscribe")
}
function panel_collection_replace() { CALL("collection_replace"); PANEL_COLLECTION.replace(); }
@ -163,11 +163,11 @@ function Panel_Collection() : PanelContent() constructor {
if(meta == noone || !meta.steam) {
contentMenu = [
menuItemAction(__txtx("panel_collection_replace", "Replace with selected"), panel_collection_replace),
menuItemAction(__txtx("panel_collection_edit_meta", "Edit metadata") + "...", panel_collection_edit_meta),
menuItemAction(__txtx("panel_collection_update_thumbnail", "Update thumbnail"), panel_collection_update_thumbnail),
MENU_ITEMS.collection_replace,
MENU_ITEMS.collection_edit_meta,
MENU_ITEMS.collection_update_thumbnail,
-1,
menuItemAction(__txt("Delete"), panel_collection_delete_collection)
MENU_ITEMS.collection_delete_collection,
];
if(STEAM_ENABLED)
@ -176,11 +176,11 @@ function Panel_Collection() : PanelContent() constructor {
if(STEAM_ENABLED) {
if(meta.steam == FILE_STEAM_TYPE.local) {
array_push(contentMenu, menuItemAction(__txtx("panel_collection_workshop_upload", "Upload to Steam Workshop") + "...", panel_collection_steam_file_upload));
array_push(contentMenu, MENU_ITEMS.collection_upload_to_steam);
} else {
if(meta.author_steam_id == STEAM_USER_ID && meta.file_id != 0)
array_push(contentMenu, menuItemAction(__txtx("panel_collection_workshop_update", "Update Steam Workshop content") + "...", panel_collection_steam_file_update));
array_push(contentMenu, menuItemAction(__txt("Unsubscribe"), panel_collection_steam_unsubscribe));
array_push(contentMenu, MENU_ITEMS.collection_update_steam);
array_push(contentMenu, MENU_ITEMS.collection_unsubscribe);
}
}
}

View File

@ -327,15 +327,15 @@ function Panel_Color() : PanelContent() constructor {
if(mouse_press(mb_right, pFOCUS)) {
menuCall("color_window_menu",,, [
menuItemAction(__txt("Hue"), function() { mode = 0; } ),
menuItemAction(__txt("Value"), function() { mode = 1; } ),
menuItemAction(__txt("Saturation"), function() { mode = 2; } ),
menuItem(__txt("Hue"), function() { mode = 0; } ),
menuItem(__txt("Value"), function() { mode = 1; } ),
menuItem(__txt("Saturation"), function() { mode = 2; } ),
-1,
menuItemAction(__txt("Toggle Alpha"), function() { show_alpha = !show_alpha; }, noone, noone, function() /*=>*/ {return show_alpha} ),
menuItemAction(__txt("Toggle Palette"), function() { show_palette = !show_palette; }, noone, noone, function() /*=>*/ {return show_palette} ),
menuItemAction(__txt("Toggle Hex"), function() { show_hex = !show_hex; }, noone, noone, function() /*=>*/ {return show_hex} ),
menuItem(__txt("Toggle Alpha"), function() { show_alpha = !show_alpha; }, noone, noone, function() /*=>*/ {return show_alpha} ),
menuItem(__txt("Toggle Palette"), function() { show_palette = !show_palette; }, noone, noone, function() /*=>*/ {return show_palette} ),
menuItem(__txt("Toggle Hex"), function() { show_hex = !show_hex; }, noone, noone, function() /*=>*/ {return show_hex} ),
-1,
menuItemAction(__txt("Discretize"), function() { discretize_pal = !discretize_pal; }, noone, noone, function() /*=>*/ {return discretize_pal} ),
menuItem(__txt("Discretize"), function() { discretize_pal = !discretize_pal; }, noone, noone, function() /*=>*/ {return discretize_pal} ),
]);
}

View File

@ -207,29 +207,29 @@ function Panel_File_Explorer() : PanelContent() constructor {
__menu_cnxt_selecting = noone;
menu_file_image = [
menuItemAction("Add as node", function() {
menuItem("Add as node", function() {
var node = Node_create_Image_path(PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy, __menu_file_selecting.path);
PANEL_PREVIEW.setNodePreview(node);
PANEL_INSPECTOR.inspecting = node;
}),
menuItemAction("Add as canvas", function() {
menuItem("Add as canvas", function() {
var node = nodeBuild("Node_Canvas", PANEL_GRAPH.graph_cx, PANEL_GRAPH.graph_cy).loadImagePath(__menu_file_selecting.path);
PANEL_PREVIEW.setNodePreview(node);
PANEL_INSPECTOR.inspecting = node;
}),
menuItemAction("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
menuItem("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
];
menu_file_project = [
menuItemAction("Open", function() { LOAD_AT(__menu_file_selecting.path); }),
menuItem("Open", function() { LOAD_AT(__menu_file_selecting.path); }),
menuItemAction("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
menuItem("Copy path", function() { clipboard_set_text(__menu_file_selecting.path); }, THEME.copy),
];
menu_general = [
menuItemAction("New Canvas", function() {
menuItem("New Canvas", function() {
var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8);
dia.onModify = function (txt) {
var _s = surface_create(DEF_SURF_W, DEF_SURF_H);
@ -246,7 +246,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
dia.path = __menu_cnxt_selecting.path + "/";
}, THEME.new_file),
menuItemAction("New Folder", function() {
menuItem("New Folder", function() {
var dia = dialogCall(o_dialog_file_name, mouse_mx + 8, mouse_my + 8);
dia.name = "New Folder";
dia.onModify = function (txt) {
@ -257,7 +257,7 @@ function Panel_File_Explorer() : PanelContent() constructor {
}, THEME.folder),
-1,
menuItemAction("Refresh", function() { if(rootFile) rootFile.getContent() }),
menuItem("Refresh", function() { if(rootFile) rootFile.getContent() }),
];
#endregion

View File

@ -174,7 +174,6 @@
panelDisplayInit();
checkPanelValid();
__initPanelHotkeys();
} #endregion
function setPanel() { #region
@ -446,73 +445,75 @@
#region hotkey
function call_dialog_preference() { dialogCall(o_dialog_preference); }
function call_dialog_splash() { dialogCall(o_dialog_splash); }
function call_dialog_release_note() { dialogCall(o_dialog_release_note); }
function open_autosave_folder() { shellOpenExplorer(DIRECTORY + "autosave"); }
function call_dialog_preference() { dialogCall(o_dialog_preference); }
function call_dialog_splash() { dialogCall(o_dialog_splash); }
function call_dialog_release_note() { dialogCall(o_dialog_release_note); }
function open_autosave_folder() { shellOpenExplorer(DIRECTORY + "autosave"); }
function call_panel_addon() { dialogPanelCall(new Panel_Addon()); }
function call_panel_history() { dialogPanelCall(new Panel_History()); }
function call_panel_addon() { dialogPanelCall(new Panel_Addon()); }
function call_panel_history() { dialogPanelCall(new Panel_History()); }
function call_panel_Notification() { panelAdd("Panel_Notification", true); }
function call_panel_Collection() { panelAdd("Panel_Collection", true); }
function call_panel_Graph() { panelAdd("Panel_Graph", true); }
function call_panel_Notification() { panelAdd("Panel_Notification", true); }
function call_panel_Collection() { panelAdd("Panel_Collection", true); }
function call_panel_Graph() { panelAdd("Panel_Graph", true); }
function call_panel_Preview() { panelAdd("Panel_Preview", true); }
function call_panel_Preview_Histogram() { panelAdd("Panel_Preview_Histogram", true); }
function call_panel_Preview() { panelAdd("Panel_Preview", true); }
function call_panel_Preview_Histogram() { panelAdd("Panel_Preview_Histogram", true); }
function call_panel_Inspector() { panelAdd("Panel_Inspector", true); }
function call_panel_Workspace() { panelAdd("Panel_Workspace", true); }
function call_panel_Animation() { panelAdd("Panel_Animation", true); }
function call_panel_Node_Align() { panelAdd("Panel_Node_Align", true); }
function call_panel_Nodes() { panelAdd("Panel_Nodes", true); }
function call_panel_Tunnels() { panelAdd("Panel_Tunnels", true); }
function call_panel_Inspector() { panelAdd("Panel_Inspector", true); }
function call_panel_Workspace() { panelAdd("Panel_Workspace", true); }
function call_panel_Animation() { panelAdd("Panel_Animation", true); }
function call_panel_Node_Align() { panelAdd("Panel_Node_Align", true); }
function call_panel_Nodes() { panelAdd("Panel_Nodes", true); }
function call_panel_Tunnels() { panelAdd("Panel_Tunnels", true); }
function call_panel_Color() { panelAdd("Panel_Color", true); }
function call_panel_Palette() { panelAdd("Panel_Palette", true); }
function call_panel_Palette_Mixer() { panelAdd("Panel_Palette_Mixer", true); }
function call_panel_Gradient() { panelAdd("Panel_Gradient", true); }
function call_panel_Color() { panelAdd("Panel_Color", true); }
function call_panel_Palette() { panelAdd("Panel_Palette", true); }
function call_panel_Palette_Mixer() { panelAdd("Panel_Palette_Mixer", true); }
function call_panel_Gradient() { panelAdd("Panel_Gradient", true); }
function call_panel_Console() { panelAdd("Panel_Console", true); }
function call_panel_Globalvar() { panelAdd("Panel_Globalvar", true); }
function call_panel_File_Explorer() { panelAdd("Panel_File_Explorer", true); }
function call_panel_Console() { panelAdd("Panel_Console", true); }
function call_panel_Globalvar() { panelAdd("Panel_Globalvar", true); }
function call_panel_File_Explorer() { panelAdd("Panel_File_Explorer", true); }
function __initPanelHotkeys() {
registerFunction("", "Preference", "", MOD_KEY.none, call_dialog_preference);
registerFunction("", "Splash screen", "", MOD_KEY.none, call_dialog_splash);
registerFunction("", "Release note", "", MOD_KEY.none, call_dialog_release_note);
registerFunction("", "Autosave folder", "", MOD_KEY.none, open_autosave_folder);
function __fnInit_Panels() {
registerFunction("", "Preference", "", MOD_KEY.none, call_dialog_preference ).setMenu("preference", THEME.gear)
registerFunction("", "Splash screen", "", MOD_KEY.none, call_dialog_splash ).setMenu("splash_screen")
registerFunction("", "Release note", "", MOD_KEY.none, call_dialog_release_note ).setMenu("release_note")
registerFunction("", "Autosave folder", "", MOD_KEY.none, open_autosave_folder ).setMenu("autosave_folder", THEME.save_auto)
registerFunction("", "Addons", "", MOD_KEY.none, call_panel_addon ).setMenu("addons")
registerFunction("", "History", "", MOD_KEY.none, call_panel_history ).setMenu("history")
registerFunction("", "Notification Panel", vk_f12, MOD_KEY.none, call_panel_Notification ).setMenu("notification_panel")
registerFunction("", "Collections Panel", "", MOD_KEY.none, call_panel_Collection ).setMenu("collections_panel")
registerFunction("", "Graph Panel", "", MOD_KEY.none, call_panel_Graph ).setMenu("graph_panel")
registerFunction("", "Preview Panel", "", MOD_KEY.none, call_panel_Preview ).setMenu("preview_panel")
registerFunction("", "Preview Histogram", "", MOD_KEY.none, call_panel_Preview_Histogram ).setMenu("preview_histogram")
registerFunction("", "Inspector Panel", "", MOD_KEY.none, call_panel_Inspector ).setMenu("inspector_panel")
registerFunction("", "Workspace Panel", "", MOD_KEY.none, call_panel_Workspace ).setMenu("workspace_panel")
registerFunction("", "Animation Panel", "", MOD_KEY.none, call_panel_Animation ).setMenu("animation_panel")
registerFunction("", "Align Panel", "", MOD_KEY.none, call_panel_Node_Align ).setMenu("align_panel")
registerFunction("", "Nodes Panel", "", MOD_KEY.none, call_panel_Nodes ).setMenu("nodes_panel")
registerFunction("", "Tunnels Panel", "", MOD_KEY.none, call_panel_Tunnels ).setMenu("tunnels_panel")
registerFunction("", "Color Panel", "", MOD_KEY.none, call_panel_Color ).setMenu("color_panel")
registerFunction("", "Palettes Panel", "", MOD_KEY.none, call_panel_Palette ).setMenu("palettes_panel")
registerFunction("", "Palettes Mixer Panel", "", MOD_KEY.none, call_panel_Palette_Mixer ).setMenu("palettes_mixer_panel")
registerFunction("", "Gradients Panel", "", MOD_KEY.none, call_panel_Gradient ).setMenu("gradients_panel")
registerFunction("", "Console Panel", "", MOD_KEY.none, call_panel_Console ).setMenu("console_panel")
registerFunction("", "Globalvar Panel", "", MOD_KEY.none, call_panel_Globalvar ).setMenu("globalvar_panel")
registerFunction("", "File Explorer Panel", "", MOD_KEY.none, call_panel_File_Explorer ).setMenu("file_explorer_panel")
registerFunction("", "Recent files", "R", MOD_KEY.ctrl | MOD_KEY.shift, function() /*=>*/ {
registerFunction("", "Recent files", "R", MOD_KEY.ctrl | MOD_KEY.shift, function() /*=>*/ {
var arr = [];
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++)
array_push(arr, menuItemAction(RECENT_FILES[| i], function(_dat) { LOAD_PATH(_dat.name); }));
return menuCall("Recent files",,, arr);
});
}).setMenu("recent_files");
registerFunction("", "Addons", "", MOD_KEY.none, call_panel_addon);
registerFunction("", "History", "", MOD_KEY.none, call_panel_history);
registerFunction("", "Notification Panel", "", MOD_KEY.none, call_panel_Notification );
registerFunction("", "Collections Panel", "", MOD_KEY.none, call_panel_Collection );
registerFunction("", "Graph Panel", "", MOD_KEY.none, call_panel_Graph );
registerFunction("", "Preview Panel", "", MOD_KEY.none, call_panel_Preview );
registerFunction("", "Preview Histogram", "", MOD_KEY.none, call_panel_Preview_Histogram );
registerFunction("", "Inspector Panel", "", MOD_KEY.none, call_panel_Inspector );
registerFunction("", "Workspace Panel", "", MOD_KEY.none, call_panel_Workspace );
registerFunction("", "Animation Panel", "", MOD_KEY.none, call_panel_Animation );
registerFunction("", "Align Panel", "", MOD_KEY.none, call_panel_Node_Align );
registerFunction("", "Nodes Panel", "", MOD_KEY.none, call_panel_Nodes );
registerFunction("", "Tunnels Panel", "", MOD_KEY.none, call_panel_Tunnels );
registerFunction("", "Color Panel", "", MOD_KEY.none, call_panel_Color );
registerFunction("", "Palettes Panel", "", MOD_KEY.none, call_panel_Palette );
registerFunction("", "Palettes Mixer Panel","", MOD_KEY.none, call_panel_Palette_Mixer );
registerFunction("", "Gradients Panel", "", MOD_KEY.none, call_panel_Gradient );
registerFunction("", "Console Panel", "", MOD_KEY.none, call_panel_Console );
registerFunction("", "Globalvar Panel", "", MOD_KEY.none, call_panel_Globalvar );
registerFunction("", "File Explorer Panel", "", MOD_KEY.none, call_panel_File_Explorer );
}
#endregion

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,40 @@
#region funtion calls
function __fnInit_Notification() {
registerFunction("Notifications", "Clear log messages", "", MOD_KEY.none, notification_clear_all ).setMenu("noti_clear_all");
registerFunction("Notifications", "Clear warning messages", "", MOD_KEY.none, notification_clear_log ).setMenu("noti_clear_log");
registerFunction("Notifications", "Clear all notifications", "", MOD_KEY.none, notification_clear_warning ).setMenu("noti_clear_warning");
registerFunction("Notifications", "Open log file", "", MOD_KEY.none, notification_open_log ).setMenu("noti_open_log");
}
function notification_clear_all() { CALL("notification_clear_all"); ds_list_clear(STATUSES); }
function notification_clear_log() { CALL("notification_clear_log"); for( var i = ds_list_size(STATUSES) - 1; i >= 0; i-- ) if(STATUSES[| i].type == NOTI_TYPE.log) ds_list_delete(STATUSES, i); }
function notification_clear_warning() { CALL("notification_clear_warning"); for( var i = ds_list_size(STATUSES) - 1; i >= 0; i-- ) if(STATUSES[| i].type == NOTI_TYPE.warning) ds_list_delete(STATUSES, i); }
function notification_open_log() { CALL("notification_open_log"); shellOpenExplorer(DIRECTORY + "log/log.txt"); }
#endregion
function Panel_Notification() : PanelContent() constructor {
title = __txt("Notifications");
w = ui(720);
h = ui(480);
title_height = 64;
padding = 20;
padding = 20;
current_page = 0;
filter = NOTI_TYPE.log | NOTI_TYPE.warning | NOTI_TYPE.error;
showHeader = false;
current_page = 0;
filter = NOTI_TYPE.log | NOTI_TYPE.warning | NOTI_TYPE.error;
showHeader = false;
noti_selecting = noone;
rightClickMenu = [
menuItemAction(__txtx("noti_clear_log", "Clear log messages"), function() {
for( var i = ds_list_size(STATUSES) - 1; i >= 0; i-- ) {
if(STATUSES[| i].type == NOTI_TYPE.log)
ds_list_delete(STATUSES, i);
}
}),
menuItemAction(__txtx("noti_clear_warn", "Clear warning messages"), function() {
for( var i = ds_list_size(STATUSES) - 1; i >= 0; i-- ) {
if(STATUSES[| i].type == NOTI_TYPE.warning)
ds_list_delete(STATUSES, i);
}
}),
MENU_ITEMS.noti_clear_all,
MENU_ITEMS.noti_clear_log,
MENU_ITEMS.noti_clear_warning,
-1,
menuItemAction(__txtx("noti_clear_all", "Clear all notifications"), function() {
ds_list_clear(STATUSES);
}),
-1,
menuItemAction(__txtx("noti_open_log", "Open log file"), function() {
shellOpenExplorer(DIRECTORY + "log/log.txt");
}),
MENU_ITEMS.noti_open_log,
];
function onResize() {
@ -76,16 +80,13 @@ function Panel_Notification() : PanelContent() constructor {
noti.onClick();
if(mouse_press(mb_right, pFOCUS)) {
var dia = menuCall("notification_menu",,, [
menuItemAction(__txtx("noti_copy_message", "Copy notification message"), function() {
clipboard_set_text(o_dialog_menubox.noti.txt);
}),
menuItemAction(__txtx("noti_delete_message", "Delete notification"), function() {
ds_list_remove(STATUSES, o_dialog_menubox.noti);
}),
],, noti);
noti_selecting = noti;
var dia = menuCall("notification_menu",,, [
menuItem(__txtx("noti_copy_message", "Copy notification message"), function() { clipboard_set_text(noti_selecting.txt); }),
menuItem(__txtx("noti_delete_message", "Delete notification"), function() { ds_list_remove(STATUSES, noti_selecting); }),
]);
dia.noti = noti;
}
}

View File

@ -14,17 +14,17 @@ function Panel_Palette() : PanelContent() constructor {
__save_palette_data = [];
view_label = true;
menu_refresh = menuItemAction(__txt("Refresh"), function() { __initPalette(); });
menu_add = menuItemAction(__txt("Add"), function(_dat) {
menu_refresh = menuItem(__txt("Refresh"), function() { __initPalette(); });
menu_add = menuItem(__txt("Add"), function(_dat) {
return submenuCall(_dat, [
menuItemAction(__txt("File..."), function() {
menuItem(__txt("File..."), function() {
var _p = get_open_filename("hex|*.hex|gpl|*.gpl|Image|.png", "palette");
if(!file_exists_empty(_p)) return;
file_copy(_p, $"{DIRECTORY}Palettes/{filename_name(_p)}");
__initPalette();
}),
menuItemAction(__txt("Lospec..."), function() {
menuItem(__txt("Lospec..."), function() {
fileNameCall("", function(txt) {
if(txt == "") return;
txt = string_lower(txt);
@ -37,8 +37,8 @@ function Panel_Palette() : PanelContent() constructor {
]);
}).setIsShelf();
menu_stretch = menuItemAction(__txt("Stretch"), function() { PREFERENCES.palette_stretch = !PREFERENCES.palette_stretch; }, noone, noone, function() /*=>*/ {return PREFERENCES.palette_stretch});
menu_mini = menuItemAction(__txt("Label"), function() { view_label = !view_label; }, noone, noone, function() /*=>*/ {return view_label});
menu_stretch = menuItem(__txt("Stretch"), function() { PREFERENCES.palette_stretch = !PREFERENCES.palette_stretch; }, noone, noone, function() /*=>*/ {return PREFERENCES.palette_stretch});
menu_mini = menuItem(__txt("Label"), function() { view_label = !view_label; }, noone, noone, function() /*=>*/ {return view_label});
function onResize() {
sp_palettes.resize(w - ui(padding + padding), h - ui(padding + padding));
@ -164,10 +164,10 @@ function Panel_Palette() : PanelContent() constructor {
menu_add,
menu_refresh,
-1,
menuItemAction(__txtx("palette_editor_set_default", "Set as default"), function() {
menuItem(__txtx("palette_editor_set_default", "Set as default"), function() {
PROJECT.setPalette(array_clone(hovering.palette));
}),
menuItemAction(__txtx("palette_editor_delete", "Delete palette"), function() {
menuItem(__txtx("palette_editor_delete", "Delete palette"), function() {
file_delete(hovering.path);
__initPalette();
}),

View File

@ -188,7 +188,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
var _b = buttonInstant(THEME.button_hide, _bx, _by, _bs, pal_h, [ mx, my ], pFOCUS, pHOVER, "", THEME.hamburger_s);
if(_b == 2) {
menuCall("",,, [
menuItemAction("Save palette as...", function() {
menuItem("Save palette as...", function() {
var _path = get_save_filename_pxc("Hex paleete|*.hex", "Palette");
if(_path != "") {
var _str = palette_string_hex(palette, false);
@ -392,7 +392,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
conn_menu_ctx = [ blnd_hovering ];
menuCall(,,, [
menuItemAction("Delete Blend point", function() { array_delete(palette_data.blends, conn_menu_ctx[0], 1); } ),
menuItem("Delete Blend point", function() { array_delete(palette_data.blends, conn_menu_ctx[0], 1); } ),
]);
}
@ -443,7 +443,7 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
conn_menu_ctx = [ conn[0], conn[1], _con_rat ];
menuCall(,,, [
menuItemAction("New Blend point", function() { array_push(palette_data.blends, { from : conn_menu_ctx[0], to : conn_menu_ctx[1], amount : conn_menu_ctx[2] }) } ),
menuItem("New Blend point", function() { array_push(palette_data.blends, { from : conn_menu_ctx[0], to : conn_menu_ctx[1], amount : conn_menu_ctx[2] }) } ),
]);
}
@ -467,18 +467,18 @@ function Panel_Palette_Mixer() : PanelContent() constructor {
if(mouse_press(mb_right)) {
menuCall(,,, [
menuItemAction("Center view", function() { centerView(); } ),
menuItem("Center view", function() { centerView(); } ),
-1,
menuItemAction("Save mixed...", function() {
menuItem("Save mixed...", function() {
var _path = get_save_filename_pxc("JSON|*.json", "New mixed");
if(_path != "") save_palette_mixer(palette_data, _path);
}, THEME.save),
menuItemAction("Load mixed...", function() {
menuItem("Load mixed...", function() {
var _path = get_open_filename_pxc("JSON|*.json", "");
if(_path != "") palette_data = load_palette_mixer(_path);
}, THEME.noti_icon_file_load),
-1,
menuItemAction("Clear palette", function() { palette_data = { nodes: [], connections: [], blends: [], } }, THEME.cross),
menuItem("Clear palette", function() { palette_data = { nodes: [], connections: [], blends: [], } }, THEME.cross),
]);
}
}

View File

@ -4,6 +4,12 @@ function panel_preset_replace() { CHECK_PANEL_PRESETS CALL("panel_preset_replace
function panel_preset_delete() { CHECK_PANEL_PRESETS CALL("panel_preset_delete"); file_delete(FOCUS_CONTENT.selecting_preset.path); FOCUS_CONTENT.__initPresets(); }
function panel_preset_reset() { CHECK_PANEL_PRESETS CALL("panel_preset_reset"); FOCUS_CONTENT.newPresetFromNode("_default"); }
function __fnInit_Presets() {
registerFunction("Presets", "Replace", "", MOD_KEY.none, panel_preset_replace).setMenu("preset_replace").hidePalette();
registerFunction("Presets", "Delete", "", MOD_KEY.none, panel_preset_delete ).setMenu("preset_delete", THEME.cross).hidePalette();
registerFunction("Presets", "Reset To Default", "", MOD_KEY.none, panel_preset_reset ).setMenu("preset_reset")
}
function Panel_Presets(_node) : PanelContent() constructor {
title = __txt("Presets");
padding = 8;
@ -29,17 +35,13 @@ function Panel_Presets(_node) : PanelContent() constructor {
directory_verify($"{DIRECTORY}Presets/{instanceof(node)}/");
__initPresets();
registerFunction("Presets", "Replace", "", MOD_KEY.none, panel_preset_replace);
registerFunction("Presets", "Delete", "", MOD_KEY.none, panel_preset_delete);
registerFunction("Presets", "Reset To Default", "", MOD_KEY.none, panel_preset_reset);
context_menu = [
menuItemAction(__txt("Replace preset"), panel_preset_replace),
menuItemAction(__txt("Delete"), panel_preset_delete, THEME.cross),
MENU_ITEMS.preset_replace,
MENU_ITEMS.preset_delete,
];
context_def = [
menuItemAction(__txt("Set to default"), panel_preset_reset),
MENU_ITEMS.preset_reset,
];
thumbnail_mask = surface_create(1, 1);

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,12 @@ function panel_preview_window_reset() { CHECK_PANEL_PREVIEW_WINDOW CALL("preview
function panel_preview_window_inspect() { CHECK_PANEL_PREVIEW_WINDOW CALL("preview_window_inspect"); PANEL_GRAPH.nodes_selecting = [ FOCUS_CONTENT.node_target ]; }
function panel_preview_window_preview() { CHECK_PANEL_PREVIEW_WINDOW CALL("preview_window_preview"); PANEL_PREVIEW.setNodePreview(FOCUS_CONTENT.node_target); }
function __fnInit_Preview_Window() {
registerFunction("Preview Window", "Reset view", "", MOD_KEY.none, panel_preview_window_reset ).setMenu("preview_window_reset_view")
registerFunction("Preview Window", "Inspect", "", MOD_KEY.none, panel_preview_window_inspect ).setMenu("preview_window_inspect")
registerFunction("Preview Window", "Preview", "", MOD_KEY.none, panel_preview_window_preview ).setMenu("preview_window_preview")
}
function Panel_Preview_Window() : PanelContent() constructor {
min_w = ui(64);
min_h = ui(64);
@ -54,15 +60,11 @@ function Panel_Preview_Window() : PanelContent() constructor {
content_surface = noone;
surfaceCheck();
registerFunction("Preview Window", "Reset view", "", MOD_KEY.none, panel_preview_window_reset);
registerFunction("Preview Window", "Inspect", "", MOD_KEY.none, panel_preview_window_inspect);
registerFunction("Preview Window", "Preview", "", MOD_KEY.none, panel_preview_window_preview);
menu = [
menuItemAction(__txtx("reset_view", "Reset view"), panel_preview_window_reset),
MENU_ITEMS.preview_window_reset_view,
-1,
menuItemAction(__txt("Inspect"), panel_preview_window_inspect),
menuItemAction(__txtx("panel_graph_send_to_preview", "Send to preview"), panel_preview_window_preview),
MENU_ITEMS.preview_window_inspect,
MENU_ITEMS.preview_window_preview,
-1,
]
@ -161,7 +163,7 @@ function Panel_Preview_Window() : PanelContent() constructor {
var o = node_target.outputs[i];
if(o.type != VALUE_TYPE.surface) continue;
array_push(_menu, menuItemAction(o.name, function(_dat) { changeChannel(_dat.index); }));
array_push(_menu, menuItem(o.name, function(_dat) { changeChannel(_dat.index); }));
}
menuCall("preview_window_menu",,, _menu,, node_target);
}

View File

@ -103,9 +103,9 @@ function Panel_Workspace() : PanelContent() constructor {
if(mouse_press(mb_right, pFOCUS)) {
layout_selecting = str;
menuCall("workspace_menu",,, [
menuItemAction(__txt("Select"), apply_space),
menuItemAction(__txtx("workspace_replace_current", "Replace with current"), replace_space),
menuItemAction(__txt("Delete"), delete_space, THEME.cross),
menuItem(__txt("Select"), apply_space),
menuItem(__txtx("workspace_replace_current", "Replace with current"), replace_space),
menuItem(__txt("Delete"), delete_space, THEME.cross),
]);
}
}