2015-09-05 19:50:37 +02:00
|
|
|
|
2021-12-28 00:19:58 +01:00
|
|
|
#define COPYFORM_W 380
|
|
|
|
#define COPYFORM_H 100
|
2018-10-20 13:00:31 +02:00
|
|
|
#define PR_LEFT 14
|
2019-05-16 12:48:21 +02:00
|
|
|
#define PR_TOP 32
|
2021-12-28 00:19:58 +01:00
|
|
|
#define PR_W COPYFORM_W-PR_LEFT-PR_LEFT
|
2019-05-16 12:48:21 +02:00
|
|
|
#define PR_H 18
|
2018-10-20 13:00:31 +02:00
|
|
|
|
|
|
|
proc_info Dialog_Form;
|
|
|
|
progress_bar copy_bar = {0,PR_LEFT,PR_TOP,PR_W,PR_H,0,0,1,0xFFFFFF,0x00FF00,0x555555};
|
2021-12-28 00:19:58 +01:00
|
|
|
checkbox remember_choice = { T_COPY_REMEMBER_CHOICE, false };
|
2015-09-05 19:50:37 +02:00
|
|
|
|
2016-02-21 22:57:22 +01:00
|
|
|
enum {
|
2020-05-06 17:53:34 +02:00
|
|
|
REDRAW_FLAG,
|
2016-02-21 22:57:22 +01:00
|
|
|
COPY_FLAG,
|
|
|
|
MOVE_FLAG,
|
|
|
|
DELETE_FLAG,
|
|
|
|
};
|
2015-09-05 19:50:37 +02:00
|
|
|
|
2021-12-28 00:19:58 +01:00
|
|
|
enum {
|
|
|
|
BTN_ABORT=2,
|
|
|
|
BTN_REPLACE,
|
|
|
|
BTN_SKIP
|
|
|
|
};
|
|
|
|
|
2020-05-06 17:53:34 +02:00
|
|
|
void DisplayOperationForm(int operation_flag)
|
2015-09-05 19:50:37 +02:00
|
|
|
{
|
2018-10-20 13:00:31 +02:00
|
|
|
dword title;
|
2021-12-28 00:19:58 +01:00
|
|
|
dword event_mode;
|
2018-10-20 13:00:31 +02:00
|
|
|
if (operation_flag==COPY_FLAG) {
|
|
|
|
title = T_COPY_WINDOW_TITLE;
|
|
|
|
copy_bar.progress_color = 0x00FF00;
|
2020-05-06 17:53:34 +02:00
|
|
|
copy_bar.value = 0;
|
|
|
|
copy_bar.max = 0;
|
2018-10-20 13:00:31 +02:00
|
|
|
}
|
|
|
|
else if (operation_flag==MOVE_FLAG) {
|
|
|
|
title = T_MOVE_WINDOW_TITLE;
|
|
|
|
copy_bar.progress_color = 0x00FF00;
|
2020-05-06 17:53:34 +02:00
|
|
|
copy_bar.value = 0;
|
|
|
|
copy_bar.max = 0;
|
2018-10-20 13:00:31 +02:00
|
|
|
}
|
|
|
|
else if (operation_flag==DELETE_FLAG) {
|
|
|
|
title = T_DELETE_WINDOW_TITLE;
|
|
|
|
copy_bar.progress_color = 0xF17A65;
|
2020-05-06 17:53:34 +02:00
|
|
|
copy_bar.value = 0;
|
|
|
|
copy_bar.max = 0;
|
2018-10-20 13:00:31 +02:00
|
|
|
}
|
2022-01-09 07:36:16 +01:00
|
|
|
copy_bar.frame_color = sc.line;
|
2021-12-31 01:03:12 +01:00
|
|
|
|
2021-12-31 01:35:57 +01:00
|
|
|
if (copy_state == FILE_EXISTS) {
|
|
|
|
event_mode = #WaitEvent;
|
|
|
|
} else {
|
|
|
|
event_mode = #CheckEvent;
|
|
|
|
}
|
2021-12-28 00:19:58 +01:00
|
|
|
event_mode();
|
|
|
|
switch(EAX)
|
2016-02-21 22:57:22 +01:00
|
|
|
{
|
2015-09-05 19:50:37 +02:00
|
|
|
case evButton:
|
2021-12-28 00:19:58 +01:00
|
|
|
switch(GetButtonID())
|
2021-12-25 23:43:50 +01:00
|
|
|
{
|
2021-12-28 00:19:58 +01:00
|
|
|
case 1:
|
|
|
|
case BTN_ABORT:
|
2021-12-25 23:43:50 +01:00
|
|
|
DialogExit();
|
|
|
|
break;
|
2021-12-28 00:19:58 +01:00
|
|
|
case BTN_REPLACE:
|
2021-12-31 01:03:12 +01:00
|
|
|
if (is_remember == true) {
|
|
|
|
saved_state = FILE_REPLACE;
|
|
|
|
}
|
2021-12-25 23:43:50 +01:00
|
|
|
copy_state = FILE_REPLACE;
|
|
|
|
break;
|
2021-12-28 00:19:58 +01:00
|
|
|
case BTN_SKIP:
|
2021-12-31 01:03:12 +01:00
|
|
|
if (is_remember == true) {
|
|
|
|
saved_state = FILE_SKIP;
|
|
|
|
}
|
2021-12-25 23:43:50 +01:00
|
|
|
copy_state = FILE_SKIP;
|
|
|
|
break;
|
2021-12-28 00:19:58 +01:00
|
|
|
default:
|
|
|
|
if (remember_choice.click(EAX+1)) {
|
2021-12-31 01:03:12 +01:00
|
|
|
is_remember = remember_choice.checked;
|
2021-12-28 00:19:58 +01:00
|
|
|
}
|
2021-12-25 23:43:50 +01:00
|
|
|
}
|
2015-09-05 19:50:37 +02:00
|
|
|
break;
|
2016-02-21 22:57:22 +01:00
|
|
|
case evReDraw:
|
2021-12-28 00:19:58 +01:00
|
|
|
DefineAndDrawWindow(Form.left+Form.width-200, Form.top+90, COPYFORM_W+9,
|
2022-01-08 20:52:20 +01:00
|
|
|
skin_h+COPYFORM_H, 0x34, sc.work, title, 0);
|
2015-09-05 19:50:37 +02:00
|
|
|
GetProcessInfo(#Dialog_Form, SelfInfo);
|
2021-12-28 00:19:58 +01:00
|
|
|
DrawCaptButton(COPYFORM_W-PR_LEFT-101, PR_TOP+PR_H+6, 100,26, BTN_ABORT, sc.button, sc.button_text, T_COPY_ABORT);
|
2018-10-20 13:00:31 +02:00
|
|
|
|
2021-12-25 23:43:50 +01:00
|
|
|
if (copy_state == FILE_EXISTS)
|
|
|
|
{
|
2021-12-28 00:19:58 +01:00
|
|
|
#define REPLACEY PR_TOP+PR_H+48
|
|
|
|
draw_icon_16w(PR_LEFT, REPLACEY-3, 20);
|
|
|
|
WriteText(PR_LEFT+25, REPLACEY, 0x90, sc.work_text, T_OVERWRITE_ALERT);
|
|
|
|
DrawCaptButton(PR_LEFT, REPLACEY+30, 100,26, BTN_REPLACE, sc.button, sc.button_text, T_COPY_REPLACE);
|
|
|
|
DrawCaptButton(PR_LEFT+110, REPLACEY+30, 100,26, BTN_SKIP, sc.button, sc.button_text, T_COPY_SKIP);
|
|
|
|
remember_choice.draw(PR_LEFT+225, REPLACEY+37);
|
2021-12-25 23:43:50 +01:00
|
|
|
}
|
|
|
|
|
2022-01-09 07:36:16 +01:00
|
|
|
DrawRectangle3D(PR_LEFT-1, PR_TOP-1, PR_W+1, PR_H+1, sc.dark, sc.light);
|
2016-02-21 22:57:22 +01:00
|
|
|
}
|
2015-09-05 19:50:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void DialogExit() {
|
|
|
|
ActivateWindow(GetProcessSlot(Form.ID));
|
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
|
2016-02-21 22:57:22 +01:00
|
|
|
void Operation_Draw_Progress(dword filename) {
|
2021-12-28 00:19:58 +01:00
|
|
|
static int old_state;
|
2015-09-05 19:50:37 +02:00
|
|
|
if (Dialog_Form.cwidth==0)
|
|
|
|
{
|
|
|
|
copy_bar.value++;
|
|
|
|
return;
|
|
|
|
}
|
2021-12-28 00:19:58 +01:00
|
|
|
|
|
|
|
if (old_state != copy_state) {
|
|
|
|
old_state = copy_state;
|
2022-01-08 20:52:20 +01:00
|
|
|
if (copy_state == FILE_EXISTS) MoveSize(OLD,OLD,OLD,skin_h+COPYFORM_H+70);
|
|
|
|
if (copy_state == FILE_DEFAULT) MoveSize(OLD,OLD,OLD,skin_h+COPYFORM_H);
|
2021-12-28 00:19:58 +01:00
|
|
|
}
|
|
|
|
|
2020-05-06 17:53:34 +02:00
|
|
|
DisplayOperationForm(REDRAW_FLAG);
|
2018-10-20 13:00:31 +02:00
|
|
|
|
2015-09-05 19:50:37 +02:00
|
|
|
progressbar_draw stdcall (#copy_bar);
|
2021-12-25 23:43:50 +01:00
|
|
|
if (copy_state == FILE_DEFAULT)
|
|
|
|
{
|
2021-12-28 00:19:58 +01:00
|
|
|
DrawBar(PR_LEFT, PR_TOP-20, COPYFORM_W-PR_LEFT, 15, sc.work);
|
2021-12-25 23:43:50 +01:00
|
|
|
progressbar_progress stdcall (#copy_bar);
|
|
|
|
}
|
2021-12-28 00:19:58 +01:00
|
|
|
WriteTextWithBg(PR_LEFT, PR_TOP-20, 0xD0, sc.work_text, filename, sc.work);
|
2018-10-20 13:00:31 +02:00
|
|
|
|
2020-04-18 01:52:24 +02:00
|
|
|
WriteTextWithBg(PR_LEFT, PR_TOP+PR_H+5, 0xD0, sc.work_text,
|
|
|
|
sprintf(#param, "%i/%i", copy_bar.value, copy_bar.max), sc.work);
|
2015-09-05 19:50:37 +02:00
|
|
|
}
|