Subversion Repositories Kolibri OS

Rev

Rev 9597 | 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.line;
9602 leency 48
9534 punk_joker 49
 
9537 leency 50
		event_mode = #WaitEvent;
51
	} else {
52
		event_mode = #CheckEvent;
53
	}
54
	event_mode();
9510 leency 55
	switch(EAX)
56
	{
6278 leency 57
		 case evButton:
5804 punk_joker 58
			switch(GetButtonID())
9510 leency 59
			{
9471 punk_joker 60
				case 1:
9510 leency 61
				case BTN_ABORT:
62
					DialogExit();
9471 punk_joker 63
					break;
64
				case BTN_REPLACE:
9510 leency 65
					if (is_remember == true) {
9534 punk_joker 66
						saved_state = FILE_REPLACE;
67
					}
68
					copy_state = FILE_REPLACE;
9471 punk_joker 69
					break;
70
				case BTN_SKIP:
9510 leency 71
					if (is_remember == true) {
9534 punk_joker 72
						saved_state = FILE_SKIP;
73
					}
74
					copy_state = FILE_SKIP;
9471 punk_joker 75
					break;
76
				default:
9510 leency 77
					if (remember_choice.click(EAX+1)) {
78
						is_remember = remember_choice.checked;
9534 punk_joker 79
					}
9510 leency 80
			}
9471 punk_joker 81
			break;
5804 punk_joker 82
		case evReDraw:
83
			DefineAndDrawWindow(Form.left+Form.width-200, Form.top+90, COPYFORM_W+9,
9510 leency 84
				skin_h+COPYFORM_H, 0x34, sc.work, title, 0);
9597 leency 85
			GetProcessInfo(#Dialog_Form, SelfInfo);
5804 punk_joker 86
			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 87
7491 leency 88
 
9471 punk_joker 89
			{
90
				#define REPLACEY PR_TOP+PR_H+48
9510 leency 91
				draw_icon_16w(PR_LEFT, REPLACEY-3, 20);
92
				WriteText(PR_LEFT+25, REPLACEY, 0x90, sc.work_text, T_OVERWRITE_ALERT);
93
				DrawCaptButton(PR_LEFT, REPLACEY+30, 100,26, BTN_REPLACE, sc.button, sc.button_text, T_COPY_REPLACE);
94
				DrawCaptButton(PR_LEFT+110, REPLACEY+30, 100,26, BTN_SKIP, sc.button, sc.button_text, T_COPY_SKIP);
95
				remember_choice.draw(PR_LEFT+225, REPLACEY+37);
96
			}
9471 punk_joker 97
98
 
9602 leency 99
	}
6278 leency 100
}
5804 punk_joker 101
102
 
103
	ActivateWindow(GetProcessSlot(Form.ID));
104
	ExitProcess();
105
}
106
107
 
6278 leency 108
	static int old_state;
9510 leency 109
	if (Dialog_Form.cwidth==0)
5804 punk_joker 110
	{
111
		copy_bar.value++;
112
		return;
113
	}
114
9510 leency 115
 
116
		old_state = copy_state;
117
		if (copy_state == FILE_EXISTS) MoveSize(OLD,OLD,OLD,skin_h+COPYFORM_H+70);
9597 leency 118
		if (copy_state == FILE_DEFAULT) MoveSize(OLD,OLD,OLD,skin_h+COPYFORM_H);
119
	}
9510 leency 120
121
 
7878 leency 122
7491 leency 123
 
5804 punk_joker 124
	if (copy_state == FILE_DEFAULT)
9471 punk_joker 125
	{
126
		DrawBar(PR_LEFT, PR_TOP-20, COPYFORM_W-PR_LEFT, 15, sc.work);
9510 leency 127
		progressbar_progress stdcall (#copy_bar);
9471 punk_joker 128
	}
129
	WriteTextWithBg(PR_LEFT, PR_TOP-20, 0xD0, sc.work_text, filename, sc.work);
9510 leency 130
7491 leency 131
 
7806 leency 132
		sprintf(#param, "%i/%i", copy_bar.value, copy_bar.max), sc.work);
133
}
5804 punk_joker 134