2023-03-19 09:17:39 +01:00
|
|
|
function Panel_Globalvar() : PanelContent() constructor {
|
2023-06-04 18:28:29 +02:00
|
|
|
title = __txtx("panel_globalvar", "Global Variables");
|
2023-03-19 09:17:39 +01:00
|
|
|
context_str = "Globalvar";
|
|
|
|
showHeader = false;
|
|
|
|
|
|
|
|
title_height = 64;
|
|
|
|
padding = 24;
|
|
|
|
|
|
|
|
w = ui(320);
|
|
|
|
h = ui(480);
|
|
|
|
|
|
|
|
globalvar_viewer_init();
|
|
|
|
drawWidgetInit();
|
|
|
|
|
|
|
|
function onResize() {
|
|
|
|
PANEL_PADDING
|
|
|
|
|
|
|
|
contentPane.resize(w - ui(padding + padding), h - ui(title_height + padding));
|
|
|
|
}
|
|
|
|
|
|
|
|
contentPane = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding), function(_y, _m) {
|
|
|
|
var _hover = pHOVER && contentPane.hover;
|
|
|
|
|
|
|
|
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
|
|
|
|
|
|
|
var hh = 0;
|
|
|
|
var yy = _y;
|
2023-10-12 12:25:38 +02:00
|
|
|
var _x = ui(8);
|
2023-03-19 09:17:39 +01:00
|
|
|
|
2023-10-12 12:25:38 +02:00
|
|
|
var gvh = globalvar_viewer_draw(_x, yy, contentPane.surface_w - _x - ui(8), _m, pFOCUS, _hover, contentPane, x + _x + ui(padding), y + ui(title_height));
|
2023-03-19 09:17:39 +01:00
|
|
|
yy += gvh + ui(8);
|
|
|
|
hh += gvh + ui(8);
|
|
|
|
|
|
|
|
return hh;
|
|
|
|
});
|
|
|
|
|
|
|
|
function drawContent(panel) {
|
2023-06-10 13:59:45 +02:00
|
|
|
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
2023-03-19 09:17:39 +01:00
|
|
|
PANEL_PADDING
|
|
|
|
PANEL_TITLE
|
|
|
|
|
|
|
|
var px = ui(padding);
|
|
|
|
var py = ui(title_height);
|
|
|
|
var pw = w - ui(padding + padding);
|
|
|
|
var ph = h - ui(title_height + padding);
|
|
|
|
|
2023-11-13 05:38:37 +01:00
|
|
|
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
|
2023-03-19 09:17:39 +01:00
|
|
|
|
2023-06-21 20:36:53 +02:00
|
|
|
contentPane.setFocusHover(pFOCUS, pHOVER);
|
2023-03-19 09:17:39 +01:00
|
|
|
contentPane.draw(px, py, mx - px, my - py);
|
|
|
|
|
|
|
|
var bx = w - ui(32 + 16);
|
|
|
|
var by = title_height / 2 - ui(16 + !in_dialog * 2);
|
|
|
|
|
2023-06-04 18:28:29 +02:00
|
|
|
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_globalvar_add", "Add variable"), THEME.add, 1, COLORS._main_value_positive) == 2)
|
2023-07-06 19:49:16 +02:00
|
|
|
PROJECT.globalNode.createValue();
|
2023-03-19 09:17:39 +01:00
|
|
|
|
|
|
|
bx -= ui(32 + 4);
|
2023-10-12 12:25:38 +02:00
|
|
|
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Edit"), var_editing? THEME.accept : THEME.gear) == 2)
|
2023-03-19 09:17:39 +01:00
|
|
|
var_editing = !var_editing;
|
|
|
|
}
|
|
|
|
}
|