mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 22:46:19 +01:00
autocomplete
This commit is contained in:
parent
454bdfe3c3
commit
d69665f802
13 changed files with 64 additions and 26 deletions
|
@ -4,7 +4,9 @@
|
||||||
#macro DIALOG_DRAW_FOCUS draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x - 8, dialog_y - 8, dialog_w + 16, dialog_h + 16, COLORS._main_accent, 1);
|
#macro DIALOG_DRAW_FOCUS draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x - 8, dialog_y - 8, dialog_w + 16, dialog_h + 16, COLORS._main_accent, 1);
|
||||||
|
|
||||||
#region data
|
#region data
|
||||||
with(_p_dialog) other.depth = min(depth - 1, other.depth);
|
on_top = false;
|
||||||
|
|
||||||
|
with(_p_dialog) { if(on_top) continue; other.depth = min(depth - 1, other.depth); }
|
||||||
|
|
||||||
ds_list_add(DIALOGS, self);
|
ds_list_add(DIALOGS, self);
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ event_inherited();
|
||||||
name = __txtx("color_selector_title", "Color selector");
|
name = __txtx("color_selector_title", "Color selector");
|
||||||
|
|
||||||
previous_color = c_black;
|
previous_color = c_black;
|
||||||
selector = new colorSelector();
|
selector = new colorSelector();
|
||||||
drop_target = noone;
|
drop_target = noone;
|
||||||
|
|
||||||
function setDefault(color) {
|
function setDefault(color) {
|
||||||
selector.setColor(color);
|
selector.setColor(color);
|
||||||
|
|
|
@ -137,7 +137,7 @@ event_inherited();
|
||||||
if(dl.status == 0 && hov) {
|
if(dl.status == 0 && hov) {
|
||||||
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS._main_accent, 1);
|
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS._main_accent, 1);
|
||||||
if(mouse_press(mb_left, sFOCUS)) {
|
if(mouse_press(mb_left, sFOCUS)) {
|
||||||
var path = get_save_filename("Compressed zip (.zip)| *.zip", $"PixelComposer {vr}.zip");
|
var path = get_save_filename_ext("Compressed zip (.zip)| *.zip", $"PixelComposer {vr}.zip", "", "Download location");
|
||||||
if(path != "") {
|
if(path != "") {
|
||||||
dl.status = 1;
|
dl.status = 1;
|
||||||
dl.download_path = path;
|
dl.download_path = path;
|
||||||
|
|
|
@ -14,12 +14,26 @@ if (_id == note_get) {
|
||||||
dls = json_try_parse(res, []);
|
dls = json_try_parse(res, []);
|
||||||
|
|
||||||
for( var i = 0, n = array_length(dls); i < n; i++ ) {
|
for( var i = 0, n = array_length(dls); i < n; i++ ) {
|
||||||
|
var _v = dls[i].version;
|
||||||
|
|
||||||
dls[i].status = 0;
|
dls[i].status = 0;
|
||||||
dls[i].download_path = "";
|
dls[i].download_path = "";
|
||||||
|
|
||||||
dls[i].size_total = 0;
|
dls[i].size_total = 0;
|
||||||
dls[i].size_downloaded = 0;
|
dls[i].size_downloaded = 0;
|
||||||
|
|
||||||
|
if(struct_has(PREFERENCES.versions, _v)) {
|
||||||
|
var _path = PREFERENCES.versions[$ _v];
|
||||||
|
|
||||||
|
if(file_exists(_path)) {
|
||||||
|
dls[i].status = 2;
|
||||||
|
dls[i].download_path = _path;
|
||||||
|
dls[i].size_total = file_size(_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PREF_SAVE();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( struct_has(downloading, _id)) {
|
} else if ( struct_has(downloading, _id)) {
|
||||||
|
@ -27,6 +41,8 @@ if (_id == note_get) {
|
||||||
|
|
||||||
if(_status == 0) {
|
if(_status == 0) {
|
||||||
dl.status = 2;
|
dl.status = 2;
|
||||||
|
PREFERENCES.versions[$ dl.version] = dl.download_path;
|
||||||
|
PREF_SAVE();
|
||||||
|
|
||||||
} else if(_status == 1) {
|
} else if(_status == 1) {
|
||||||
dl.size_total = ds_map_find_value(async_load, "contentLength");
|
dl.size_total = ds_map_find_value(async_load, "contentLength");
|
||||||
|
|
|
@ -8,6 +8,7 @@ event_inherited();
|
||||||
dialog_y = 0;
|
dialog_y = 0;
|
||||||
dialog_w = 300;
|
dialog_w = 300;
|
||||||
dialog_h = 160;
|
dialog_h = 160;
|
||||||
|
on_top = true;
|
||||||
|
|
||||||
selecting = 0;
|
selecting = 0;
|
||||||
textbox = noone;
|
textbox = noone;
|
||||||
|
@ -27,7 +28,7 @@ event_inherited();
|
||||||
INLINE
|
INLINE
|
||||||
if(textbox != self.textbox) return;
|
if(textbox != self.textbox) return;
|
||||||
|
|
||||||
self.textbox = noone;
|
self.textbox = noone;
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_content = new scrollPane(dialog_w, dialog_h, function(_y, _m) {
|
sc_content = new scrollPane(dialog_w, dialog_h, function(_y, _m) {
|
||||||
|
@ -43,8 +44,10 @@ event_inherited();
|
||||||
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0, _ly + 1, _dw, _ly + hght - 1)) {
|
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0, _ly + 1, _dw, _ly + hght - 1)) {
|
||||||
selecting = i;
|
selecting = i;
|
||||||
|
|
||||||
if(mouse_press(mb_left))
|
if(mouse_press(mb_left)) {
|
||||||
applyAutoComplete(_dat[3]);
|
applyAutoComplete(_dat[3]);
|
||||||
|
MOUSE_BLOCK = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selecting == i) {
|
if(selecting == i) {
|
||||||
|
@ -78,7 +81,8 @@ event_inherited();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyboard_check_pressed(vk_down)) {
|
if(keyboard_check_pressed(vk_down)) {
|
||||||
selecting = safe_mod(selecting + 1, array_length(data));
|
selecting++
|
||||||
|
if(selecting >= array_length(data) - 1) selecting = 0;
|
||||||
|
|
||||||
sc_content.scroll_y_to = -(selecting - 2) * hght;
|
sc_content.scroll_y_to = -(selecting - 2) * hght;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/// @description
|
/// @description
|
||||||
active = textbox != noone && array_length(data);
|
active = textbox != noone && array_length(data);
|
||||||
if(textbox == noone) exit;
|
if(textbox == noone) exit;
|
||||||
if(textbox != WIDGET_CURRENT) exit;
|
if(textbox != WIDGET_CURRENT) exit;
|
||||||
if(array_empty(data)) exit;
|
if(array_empty(data)) exit;
|
||||||
|
if(dialog_x == 0 && dialog_y == 0) exit;
|
||||||
|
|
||||||
#region
|
#region
|
||||||
dialog_x = clamp(dialog_x, 0, WIN_W - dialog_w - 1);
|
dialog_x = clamp(dialog_x, 0, WIN_W - dialog_w - 1);
|
||||||
|
@ -32,7 +33,7 @@ if(array_empty(data)) exit;
|
||||||
|
|
||||||
#region draw
|
#region draw
|
||||||
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h);
|
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||||
sc_content.setFocusHover(sFOCUS, sHOVER);
|
sc_content.setFocusHover(true, true);
|
||||||
sc_content.draw(dialog_x, dialog_y);
|
sc_content.draw(dialog_x, dialog_y);
|
||||||
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
|
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
9
objects/o_dialog_textbox_autocomplete/Step_0.gml
Normal file
9
objects/o_dialog_textbox_autocomplete/Step_0.gml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/// @description Insert description here
|
||||||
|
if(textbox == noone) exit;
|
||||||
|
if(textbox != WIDGET_CURRENT) exit;
|
||||||
|
if(array_empty(data)) exit;
|
||||||
|
|
||||||
|
if(point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h)) {
|
||||||
|
HOVER = self.id;
|
||||||
|
if(mouse_press(mb_left)) FOCUS = self.id;
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
"eventList":[
|
"eventList":[
|
||||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||||
|
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||||
],
|
],
|
||||||
"managed":true,
|
"managed":true,
|
||||||
"name":"o_dialog_textbox_autocomplete",
|
"name":"o_dialog_textbox_autocomplete",
|
||||||
|
@ -12,10 +13,7 @@
|
||||||
"name":"widget",
|
"name":"widget",
|
||||||
"path":"folders/dialog/widget.yy",
|
"path":"folders/dialog/widget.yy",
|
||||||
},
|
},
|
||||||
"parentObjectId":{
|
"parentObjectId":null,
|
||||||
"name":"_p_dialog",
|
|
||||||
"path":"objects/_p_dialog/_p_dialog.yy",
|
|
||||||
},
|
|
||||||
"persistent":false,
|
"persistent":false,
|
||||||
"physicsAngularDamping":0.1,
|
"physicsAngularDamping":0.1,
|
||||||
"physicsDensity":0.5,
|
"physicsDensity":0.5,
|
||||||
|
|
|
@ -165,7 +165,7 @@ function colorSelector(onApply = noone) constructor {
|
||||||
|
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, col_x - ui(8), col_y - ui(8), ui(256 + 16), ui(256 + 16));
|
draw_sprite_stretched(THEME.ui_panel_bg, 1, col_x - ui(8), col_y - ui(8), ui(256 + 16), ui(256 + 16));
|
||||||
|
|
||||||
color_surface = surface_verify(color_surface, 256, 256);
|
color_surface = surface_verify(color_surface, ui(256), ui(256));
|
||||||
surface_set_target(color_surface);
|
surface_set_target(color_surface);
|
||||||
if(disp_mode == 0) {
|
if(disp_mode == 0) {
|
||||||
shader_set(sh_color_picker_hue);
|
shader_set(sh_color_picker_hue);
|
||||||
|
@ -179,7 +179,7 @@ function colorSelector(onApply = noone) constructor {
|
||||||
shader_set_palette(palette);
|
shader_set_palette(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_sprite_uniform(s_fx_pixel, 0, 0, 0, 256);
|
draw_sprite_uniform(s_fx_pixel, 0, 0, 0, ui(256));
|
||||||
shader_reset();
|
shader_reset();
|
||||||
surface_reset_target();
|
surface_reset_target();
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
globalvar TOOLTIP, DRAGGING, DIALOG_DEPTH_HOVER;
|
globalvar TOOLTIP, DRAGGING, DIALOG_DEPTH_HOVER;
|
||||||
global.KEYS = {
|
global.KEYS = {
|
||||||
download_links: ""
|
download_links: "",
|
||||||
};
|
};
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,12 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group
|
||||||
})]);
|
})]);
|
||||||
|
|
||||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||||
if(attributes.show_objects)
|
var gr = is_instanceof(group, Node_Rigid_Group)? group : noone;
|
||||||
for( var i = 0, n = ds_list_size(group.nodes); i < n; i++ ) {
|
if(inline_context != noone) gr = inline_context;
|
||||||
var _node = group.nodes[| i];
|
|
||||||
|
if(attributes.show_objects && gr != noone)
|
||||||
|
for( var i = 0, n = ds_list_size(gr.nodes); i < n; i++ ) {
|
||||||
|
var _node = gr.nodes[| i];
|
||||||
if(!is_instanceof(_node, Node_Rigid_Object)) continue;
|
if(!is_instanceof(_node, Node_Rigid_Object)) continue;
|
||||||
var _hov = _node.drawOverlayPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
var _hov = _node.drawOverlayPreview(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||||
active &= !_hov;
|
active &= !_hov;
|
||||||
|
|
|
@ -128,11 +128,13 @@
|
||||||
|
|
||||||
#region //////////////////////////////////////////////////////////////////////// PATHS /////////////////////////////////////////////////////////////////////////
|
#region //////////////////////////////////////////////////////////////////////// PATHS /////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
PREFERENCES.temp_path = "%DIR%/temp/";
|
PREFERENCES.temp_path = "%DIR%/temp/";
|
||||||
PREFERENCES.ImageMagick_path = "%APP%/imagemagick/";
|
PREFERENCES.ImageMagick_path = "%APP%/imagemagick/";
|
||||||
PREFERENCES.webp_path = "%APP%/webp/";
|
PREFERENCES.webp_path = "%APP%/webp/";
|
||||||
PREFERENCES.gifski_path = "%APP%/gifski/";
|
PREFERENCES.gifski_path = "%APP%/gifski/";
|
||||||
PREFERENCES.ffmpeg_path = "%APP%/ffmpeg/";
|
PREFERENCES.ffmpeg_path = "%APP%/ffmpeg/";
|
||||||
|
|
||||||
|
PREFERENCES.versions = {};
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -749,6 +749,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) { #region
|
||||||
setParam(params);
|
setParam(params);
|
||||||
|
|
||||||
|
if(format == TEXT_AREA_FORMAT.codeHLSL || format == TEXT_AREA_FORMAT.codeLUA)
|
||||||
|
font = f_code;
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue