Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
4042 leency 1
 
4428 leency 2
byte copy_from[4096];
5514 leency 3
byte cut_active=0;
4428 leency 4
4896 punk_joker 5
 
5691 punk_joker 6
7
 
4042 leency 8
4427 punk_joker 9
 
10
11
 
4896 punk_joker 12
{
4698 punk_joker 13
    dword selected_offset2;
5513 punk_joker 14
    byte copy_t[4096];
15
    dword buff_data;
16
    int ind = 0;
5691 punk_joker 17
    if (selected_count)
5513 punk_joker 18
	{
19
        buff_data = malloc(selected_count*4096+10);
20
        ESDWORD[buff_data] = selected_count*4096+10;
21
        ESDWORD[buff_data+4] = 3;
22
        ESINT[buff_data+8] = selected_count;
23
        for (i=0; i
5174 punk_joker 24
        {
25
            selected_offset2 = file_mas[i]*304 + buf+32 + 7;
5513 punk_joker 26
            if (ESBYTE[selected_offset2]) {
27
                strcpy(#copy_t, #path);
28
                strcat(#copy_t, file_mas[i]*304+buf+72);
29
                strlcpy(ind*4096+buff_data+10, #copy_t, 4096);;
30
                ind++;
31
            }
32
        }
5174 punk_joker 33
		clipboard.SetSlotData(selected_count*4096+10, buff_data);
5513 punk_joker 34
	}
35
	else
36
	{
37
		buff_data = malloc(4106);
38
        ESDWORD[buff_data] = 4106;
39
        ESDWORD[buff_data+4] = 3;
40
        ESINT[buff_data+8] = 1;
41
        strlcpy(buff_data+10, #file_path, 4096);;
42
		clipboard.SetSlotData(4106, buff_data);
43
	}
44
	cut_active = cut;
4042 leency 45
	free(buff_data);
5209 punk_joker 46
}
4042 leency 47
48
 
49
 
5609 leency 50
	copy_stak = malloc(20000);
51
	CreateThread(#PasteThread,copy_stak+20000-4);
5620 leency 52
}
5609 leency 53
54
 
5691 punk_joker 55
int file_count_copy;
56
5609 leency 57
 
5691 punk_joker 58
{
59
	dword dirbuf, fcount, i, filename;
60
	dword cur_file;
61
	if (isdir(way))
62
	{
63
		cur_file = malloc(4096);
64
		// In the process of recursive descent, memory must be allocated dynamically, because the static memory -> was a bug !!! But unfortunately pass away to sacrifice speed.
65
		GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
66
		for (i=0; i
67
		{
68
			filename = i*304+dirbuf+72;
69
			sprintf(cur_file,"%s/%s",way,filename);
70
71
 
72
			{
73
				file_count_copy++;
74
				DirFileCount(cur_file);
75
			}
76
			else
77
			{
78
				file_count_copy++;
79
			}
80
		}
81
		free(cur_file);
82
	}
83
}
84
85
 
5608 leency 86
{
4042 leency 87
	char copy_rezult;
88
	int j;
5174 punk_joker 89
	int cnt = 0;
5514 leency 90
	dword buf;
4864 punk_joker 91
	file_count_copy = 0;
5691 punk_joker 92
	copy_bar.value = 0;
93
4042 leency 94
 
4864 punk_joker 95
	if (DSDWORD[buf+4] != 3) return;
5514 leency 96
	cnt = ESINT[buf+8];
5174 punk_joker 97
	for (j = 0; j < cnt; j++) {
5514 leency 98
		strlcpy(#copy_from, j*4096+buf+10, 4096);
5174 punk_joker 99
		GetFileInfo(#copy_from, #file_info_count);
5691 punk_joker 100
		if ( file_info_count.isfolder ) DirFileCount(#copy_from);
101
		else file_count_copy++;
102
	}
103
	copy_bar.max = file_count_copy;
104
	DisplayCopyfForm();
105
	for (j = 0; j < cnt; j++) {
106
		strlcpy(#copy_from, j*4096+buf+10, 4096);
107
		if (!copy_from) CopyExit();
4861 leency 108
		strcpy(#copy_to, #path);
4042 leency 109
		strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
110
		if (!strcmp(#copy_from,#copy_to))
4698 punk_joker 111
		{
112
			strcpy(#copy_to, #path);
113
			strcat(#copy_to, "new_");
114
			strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
115
		}
116
		if (strstr(#copy_to, #copy_from))
117
		{
118
			notify("Copy directory into itself is a bad idea...");
119
			CopyExit();
4861 leency 120
		}
4698 punk_joker 121
5514 leency 122
 
4698 punk_joker 123
		{
124
			Write_Error(copy_rezult);
125
		}
126
		else if (cut_active)
4894 punk_joker 127
		{
128
			strcpy(#file_path, #copy_from);
129
			Del_File(true);
130
131
 
132
	}
4042 leency 133
	if (cut_active)
4894 punk_joker 134
	{
4042 leency 135
		cut_active=false;
136
	}
137
	if (info_after_copy) notify(INFO_AFTER_COPY);
5459 punk_joker 138
	CopyExit();
4861 leency 139
}
140
141
 
5514 leency 142
#define WIN_COPY_H 110
5691 punk_joker 143
proc_info Copy_Form;
5514 leency 144
145
 
146
{
4861 leency 147
	  switch(CheckEvent())
5514 leency 148
	  {
149
		 case evButton:
150
			notify(T_CANCEL_PASTE);
151
			CopyExit();
152
			break;
153
154
 
155
			DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_COPY_W,GetSkinHeight()+WIN_COPY_H,0x34,0xFFFFFF,T_PASTE_WINDOW_TITLE);
5689 punk_joker 156
			GetProcessInfo(#Copy_Form, SelfInfo);
5514 leency 157
			WriteText(45, 11, 0x80, system.color.work_text, T_PASTE_WINDOW_TEXT);
5674 pavelyakov 158
			DrawFlatButton(Copy_Form.cwidth - 96, Copy_Form.cheight - 32, 80, 22, 10, system.color.work_button, T_PASTE_WINDOW_BUTTON);
5691 punk_joker 159
			DrawBar(8, 10, 32, 32, 0xFFFfff);
5514 leency 160
			break;
161
	  }
162
}
163
164
 
165
	action_buf = COPY_PASTE_END;
4861 leency 166
	ActivateWindow(GetProcessSlot(Form.ID));
4042 leency 167
	ExitProcess();
168
}
5514 leency 169
170
 
171
 
172
	if (Copy_Form.cwidth==0)
5691 punk_joker 173
	{
174
		copy_bar.value++;
175
		return;
176
	}
177
	copy_bar.width = Copy_Form.cwidth-32;
178
	DisplayCopyfForm();
5514 leency 179
	Put_icon(copying_filename+strrchr(copying_filename,'.'), 16, 19, 0xFFFfff, 0);
180
	DrawBar(45, 29, Copy_Form.cwidth-45, 10, 0xFFFFFF);
5689 punk_joker 181
	WriteText(45, 29, 0x80, 0x000000, copying_filename);
5691 punk_joker 182
	progressbar_draw stdcall (#copy_bar);
183
	progressbar_progress stdcall (#copy_bar);
184
	//copy_bar.value++;
185
	//pause(10);
5694 leency 186
}
4861 leency 187