Subversion Repositories Kolibri OS

Rev

Rev 9471 | Rev 9534 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7491 leency 1
 
9510 leency 2
#define COPYFORM_H 100
3
#define PR_LEFT 14
7491 leency 4
#define PR_TOP  32
7658 leency 5
#define PR_W  COPYFORM_W-PR_LEFT-PR_LEFT
9510 leency 6
#define PR_H  18
7658 leency 7
7491 leency 8
 
5804 punk_joker 9
progress_bar copy_bar = {0,PR_LEFT,PR_TOP,PR_W,PR_H,0,0,1,0xFFFFFF,0x00FF00,0x555555};
7491 leency 10
checkbox remember_choice = { T_COPY_REMEMBER_CHOICE, false };
9510 leency 11
5804 punk_joker 12
 
6278 leency 13
	REDRAW_FLAG,
7878 leency 14
	COPY_FLAG,
6278 leency 15
	MOVE_FLAG,
16
	DELETE_FLAG,
17
};
18
5804 punk_joker 19
 
9510 leency 20
	BTN_ABORT=2,
21
	BTN_REPLACE,
22
	BTN_SKIP
23
};
24
25
 
7878 leency 26
{
5804 punk_joker 27
	dword title;
7491 leency 28
	dword event_mode;
9510 leency 29
	if (operation_flag==COPY_FLAG) {
7491 leency 30
		title = T_COPY_WINDOW_TITLE;
31
		copy_bar.progress_color = 0x00FF00;
32
		copy_bar.value = 0;
7878 leency 33
		copy_bar.max = 0;
34
	}
7491 leency 35
	else if (operation_flag==MOVE_FLAG) {
36
		title = T_MOVE_WINDOW_TITLE;
37
		copy_bar.progress_color = 0x00FF00;
38
		copy_bar.value = 0;
7878 leency 39
		copy_bar.max = 0;
40
	}
7491 leency 41
	else if (operation_flag==DELETE_FLAG) {
42
		title = T_DELETE_WINDOW_TITLE;
43
		copy_bar.progress_color = 0xF17A65;
44
		copy_bar.value = 0;
7878 leency 45
		copy_bar.max = 0;
46
	}
7491 leency 47
	copy_bar.frame_color = sc.work_graph;
7806 leency 48
	if (copy_state == FILE_DEFAULT) event_mode = #CheckEvent;
9510 leency 49
	if (copy_state == FILE_EXISTS) event_mode = #WaitEvent;
50
	event_mode();
51
	switch(EAX)
52
	{
6278 leency 53
		 case evButton:
5804 punk_joker 54
			switch(GetButtonID())
9510 leency 55
			{
9471 punk_joker 56
				case 1:
9510 leency 57
				case BTN_ABORT:
58
					DialogExit();
9471 punk_joker 59
					break;
60
				case BTN_REPLACE:
9510 leency 61
					copy_state = FILE_REPLACE;
9471 punk_joker 62
					break;
63
				case BTN_SKIP:
9510 leency 64
					copy_state = FILE_SKIP;
9471 punk_joker 65
					break;
66
				default:
9510 leency 67
					if (remember_choice.click(EAX+1)) {
68
						notify(itoa(remember_choice.checked));
69
					}
70
			}
9471 punk_joker 71
			break;
5804 punk_joker 72
		case evReDraw:
73
			DefineAndDrawWindow(Form.left+Form.width-200, Form.top+90, COPYFORM_W+9,
9510 leency 74
				skin_height+COPYFORM_H, 0x34, sc.work, title, 0);
75
			GetProcessInfo(#Dialog_Form, SelfInfo);
5804 punk_joker 76
			DrawCaptButton(COPYFORM_W-PR_LEFT-101, PR_TOP+PR_H+6, 100,26, BTN_ABORT, sc.button, sc.button_text, T_COPY_ABORT);
9510 leency 77
7491 leency 78
 
9471 punk_joker 79
			{
80
				#define REPLACEY PR_TOP+PR_H+48
9510 leency 81
				draw_icon_16w(PR_LEFT, REPLACEY-3, 20);
82
				WriteText(PR_LEFT+25, REPLACEY, 0x90, sc.work_text, T_OVERWRITE_ALERT);
83
				DrawCaptButton(PR_LEFT, REPLACEY+30, 100,26, BTN_REPLACE, sc.button, sc.button_text, T_COPY_REPLACE);
84
				DrawCaptButton(PR_LEFT+110, REPLACEY+30, 100,26, BTN_SKIP, sc.button, sc.button_text, T_COPY_SKIP);
85
				remember_choice.draw(PR_LEFT+225, REPLACEY+37);
86
			}
9471 punk_joker 87
88
 
7806 leency 89
	}
6278 leency 90
}
5804 punk_joker 91
92
 
93
	ActivateWindow(GetProcessSlot(Form.ID));
94
	ExitProcess();
95
}
96
97
 
6278 leency 98
	static int old_state;
9510 leency 99
	if (Dialog_Form.cwidth==0)
5804 punk_joker 100
	{
101
		copy_bar.value++;
102
		return;
103
	}
104
9510 leency 105
 
106
		old_state = copy_state;
107
		if (copy_state == FILE_EXISTS) MoveSize(OLD,OLD,OLD,skin_height+COPYFORM_H+70);
108
		if (copy_state == FILE_DEFAULT) MoveSize(OLD,OLD,OLD,skin_height+COPYFORM_H);
109
	}
110
111
 
7878 leency 112
7491 leency 113
 
5804 punk_joker 114
	if (copy_state == FILE_DEFAULT)
9471 punk_joker 115
	{
116
		DrawBar(PR_LEFT, PR_TOP-20, COPYFORM_W-PR_LEFT, 15, sc.work);
9510 leency 117
		progressbar_progress stdcall (#copy_bar);
9471 punk_joker 118
	}
119
	WriteTextWithBg(PR_LEFT, PR_TOP-20, 0xD0, sc.work_text, filename, sc.work);
9510 leency 120
7491 leency 121
 
7806 leency 122
		sprintf(#param, "%i/%i", copy_bar.value, copy_bar.max), sc.work);
123
}
5804 punk_joker 124