Pixel-Composer/objects/o_dialog_migration/Draw_64.gml

62 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-02-14 05:32:32 +01:00
/// @description init
if !ready exit;
draw_set_color(c_black);
draw_set_alpha(0.5);
draw_rectangle(0, 0, WIN_W, WIN_H, false);
draw_set_alpha(1);
#region base UI
draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
if(sFOCUS)
draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
#endregion
#region text
var py = dialog_y + ui(16);
2023-06-10 13:59:45 +02:00
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text);
2023-06-04 18:28:29 +02:00
draw_text(dialog_x + ui(24), py, __txtx("dialog_migration_title", "Program directory changed in 1.13"));
2023-05-28 20:00:51 +02:00
py += line_get_height(, 4);
2023-02-14 05:32:32 +01:00
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
2023-06-05 19:41:01 +02:00
draw_text_line(dialog_x + ui(24), py, __txtx("dialog_migration_content",
2023-02-14 05:32:32 +01:00
"You can press migrate files or manually move all custom collections, assets, palettes, gradients, fonts and presets."), -1, dialog_w - ui(48));
2023-02-14 07:37:13 +01:00
var bw = ui(112), bh = TEXTBOX_HEIGHT;
2023-02-14 05:32:32 +01:00
var bx1 = dialog_x + dialog_w - ui(16);
var by1 = dialog_y + dialog_h - ui(16);
var bx0 = bx1 - bw;
var by0 = by1 - bh;
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
2023-06-05 18:27:53 +02:00
draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Ignore"));
2023-02-14 05:32:32 +01:00
if(b == 2)
instance_destroy();
bx0 -= bw + ui(12);
var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
2023-06-05 18:27:53 +02:00
draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Migrate files"));
2023-02-14 05:32:32 +01:00
if(b == 2) {
2023-03-08 12:14:01 +01:00
var oldDir = environment_get_variable("userprofile") + "/AppData/Local/Pixels_Composer/";
2023-02-14 07:37:13 +01:00
var folders = [ "Assets", "Collections", "Fonts", "Gradients", "Palettes", "Presets", "Themes"];
2023-07-25 20:12:40 +02:00
for( var i = 0, n = array_length(folders); i < n; i++ ) {
var _o = oldDir + folders[i] + "/";
var _n = DIRECTORY + folders[i] + "/";
2023-02-14 07:37:13 +01:00
2023-07-25 20:12:40 +02:00
if(directory_exists(_o)) {
var shell = "/E /I " + _o + " " + _n;
2023-02-14 07:37:13 +01:00
execute_shell("Xcopy", shell);
}
}
2023-02-14 05:32:32 +01:00
instance_destroy();
}
bx0 = dialog_x + ui(16);
2023-02-14 07:37:13 +01:00
bw = ui(160);
2023-02-14 05:32:32 +01:00
var b = buttonInstant(THEME.button, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
2023-06-04 18:28:29 +02:00
draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("migrate_open_directory", "Open directory") + "...");
2023-02-14 05:32:32 +01:00
if(b == 2) {
2023-02-14 07:37:13 +01:00
if(directory_exists(DIRECTORY))
shellOpenExplorer(DIRECTORY);
2023-02-14 05:32:32 +01:00
}
#endregion