Subversion Repositories Kolibri OS

Rev

Rev 6597 | 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
 
5804 punk_joker 6
5691 punk_joker 7
 
4427 punk_joker 8
9
 
4896 punk_joker 10
{
4698 punk_joker 11
    dword selected_offset2;
5513 punk_joker 12
    byte copy_t[4096];
13
    dword buff_data;
14
    dword path_len = 0;
6597 punk_joker 15
    dword buffer_len = 0;
16
    dword size_buf = 0;
17
    int ind = 0;
5691 punk_joker 18
    if (selected_count)
5513 punk_joker 19
	{
20
        for (i=0; i
6597 punk_joker 21
        {
22
            selected_offset2 = file_mas[i]*304 + buf+32 + 7;
23
            if (ESBYTE[selected_offset2]) {
24
                strcpy(#copy_t, #path);
25
                strcat(#copy_t, file_mas[i]*304+buf+72);
26
                path_len = strlen(#copy_t);
27
                size_buf = size_buf + path_len + 4;
6600 punk_joker 28
            }
6597 punk_joker 29
        }
30
31
 
32
        ESDWORD[buff_data] = size_buf;
33
        ESDWORD[buff_data+4] = 3;
5513 punk_joker 34
        ESINT[buff_data+8] = selected_count;
6597 punk_joker 35
36
 
5174 punk_joker 37
        {
38
            selected_offset2 = file_mas[i]*304 + buf+32 + 7;
5513 punk_joker 39
            if (ESBYTE[selected_offset2]) {
40
                strcpy(#copy_t, #path);
41
                strcat(#copy_t, file_mas[i]*304+buf+72);
6597 punk_joker 42
                path_len = strlen(#copy_t);
43
                ESDWORD[buff_data+10+buffer_len] = path_len;
6600 punk_joker 44
                strlcpy(buff_data+10+4+buffer_len, #copy_t, path_len);
45
                buffer_len = buffer_len + 4 + path_len;
46
                ind++;
5513 punk_joker 47
            }
48
        }
5174 punk_joker 49
		clipboard.SetSlotData(size_buf+10, buff_data);
6597 punk_joker 50
	}
5513 punk_joker 51
	else
52
	{
53
		path_len = strlen(#file_path)+4;
6600 punk_joker 54
		buff_data = malloc(path_len);
55
        ESDWORD[buff_data] = path_len;
56
        ESDWORD[buff_data+4] = 3;
5513 punk_joker 57
        ESINT[buff_data+8] = 1;
58
        ESDWORD[buff_data+10] = path_len;
6600 punk_joker 59
        strlcpy(buff_data+14, #file_path, path_len);;
60
		clipboard.SetSlotData(path_len+10, buff_data);
61
	}
5513 punk_joker 62
	cut_active = cut;
4042 leency 63
	free(buff_data);
5209 punk_joker 64
}
4042 leency 65
66
 
5609 leency 67
	copy_stak = malloc(64000);
5962 leency 68
	CreateThread(#PasteThread,copy_stak+64000-4);
69
}
5609 leency 70
71
 
5608 leency 72
{
4042 leency 73
	char copy_rezult;
74
	int j;
5174 punk_joker 75
	int cnt = 0;
5514 leency 76
	dword buf;
4864 punk_joker 77
	dword path_len = 0;
6597 punk_joker 78
    dword buffer_len = 0;
79
    file_count_copy = 0;
80
	copy_bar.value = 0;
5691 punk_joker 81
6597 punk_joker 82
 
83
	if (DSDWORD[buf+4] != 3) return;
84
	cnt = ESINT[buf+8];
85
	for (j = 0; j < cnt; j++) {
86
		path_len = ESDWORD[buf+10+buffer_len];
6600 punk_joker 87
		strlcpy(#copy_from, buf+10+buffer_len+4, path_len);
88
		buffer_len = buffer_len + 4 + path_len;
89
		GetFileInfo(#copy_from, #file_info_count);
6597 punk_joker 90
		if ( file_info_count.isfolder ) DirFileCount(#copy_from);
91
		else file_count_copy++;
92
	}
93
	copy_bar.max = file_count_copy;
94
5931 punk_joker 95
 
6597 punk_joker 96
	else  operation_flag = COPY_FLAG;
97
98
 
99
    buffer_len = 0;
100
    DisplayOperationForm();
101
	for (j = 0; j < cnt; j++) {
102
		path_len = ESDWORD[buf+10+buffer_len];
6600 punk_joker 103
		strlcpy(#copy_from, buf+10+buffer_len+4, path_len);
104
		buffer_len = buffer_len + 4 + path_len;
105
		if (!copy_from) DialogExit();
6597 punk_joker 106
		strcpy(#copy_to, #path);
107
		strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
108
		if (!strcmp(#copy_from,#copy_to))
109
		{
110
			strcpy(#copy_to, #path);
111
			strcat(#copy_to, "new_");
112
			strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
113
		}
114
		if (strstr(#copy_to, #copy_from))
115
		{
116
			notify("Copy directory into itself is a bad idea...");
117
			DialogExit();
118
		}
119
120
 
121
		{
122
			Write_Error(copy_rezult);
123
		}
124
		else if (cut_active)
125
		{
126
			strcpy(#file_path, #copy_from);
127
			Del_File2(#copy_from, 0);
128
129
 
130
	}
131
	if (cut_active)
132
	{
133
		cut_active=false;
134
	}
135
	if (info_after_copy) notify(INFO_AFTER_COPY);
136
	DialogExit();
137
}
138
139
 
140
141
 
142
void Copy(dword pcth, char cut)
143
{
144
    dword selected_offset2;
145
    byte copy_t[4096];
146
    dword buff_data;
147
    dword path_len = 0;
148
    dword buffer_len = 0;
149
    dword size_buf = 0;
150
    int ind = 0;
151
    if (selected_count)
152
	{
153
        for (i=0; i
154
        {
155
            selected_offset2 = file_mas[i]*304 + buf+32 + 7;
156
            if (ESBYTE[selected_offset2]) {
157
                strcpy(#copy_t, #path);
158
                strcat(#copy_t, file_mas[i]*304+buf+72);
159
                path_len = strlen(#copy_t);
160
                size_buf = size_buf + path_len;
6600 punk_joker 161
            }
6597 punk_joker 162
        }
163
164
 
165
        ESDWORD[buff_data] = size_buf;
166
        ESDWORD[buff_data+4] = 3;
167
        ESINT[buff_data+8] = selected_count;
168
169
 
170
        {
171
            selected_offset2 = file_mas[i]*304 + buf+32 + 7;
172
            if (ESBYTE[selected_offset2]) {
173
                strcpy(#copy_t, #path);
174
                strcat(#copy_t, file_mas[i]*304+buf+72);
175
                path_len = strlen(#copy_t);
176
                strlcpy(buff_data+10+buffer_len+1, #copy_t, path_len);
6600 punk_joker 177
                buffer_len = buffer_len + path_len;
178
                ind++;
6597 punk_joker 179
            }
180
        }
181
		clipboard.SetSlotData(size_buf+10, buff_data);
182
	}
183
	else
184
	{
185
		buff_data = malloc(4106);
186
        ESDWORD[buff_data] = 4106;
187
        ESDWORD[buff_data+4] = 3;
188
        ESINT[buff_data+8] = 1;
189
        strlcpy(buff_data+10, #file_path, 4096);;
190
		clipboard.SetSlotData(4106, buff_data);
191
	}
192
	cut_active = cut;
193
	free(buff_data);
194
}
195
196
 
197
 
6600 punk_joker 198
	copy_stak = malloc(64000);
199
	CreateThread(#PasteThread,copy_stak+64000-4);
200
}
201
202
 
6597 punk_joker 203
{
204
	char copy_rezult;
205
	int j;
206
	int cnt = 0;
207
	dword buf;
208
	dword path_len = 0;
209
    dword buffer_len = 0;
210
    file_count_copy = 0;
211
	copy_bar.value = 0;
212
    debugln("Step 1");
6600 punk_joker 213
    buf = clipboard.GetSlotData(clipboard.GetSlotCount()-1);
6597 punk_joker 214
	if (DSDWORD[buf+4] != 3) return;
5514 leency 215
	cnt = ESINT[buf+8];
5174 punk_joker 216
	for (j = 0; j < cnt; j++) {
5957 punk_joker 217
		if (j==0) strlcpy(#copy_from, buf+10+buffer_len);
6600 punk_joker 218
		else strlcpy(#copy_from, buf+10+buffer_len+1);
219
		buffer_len = buffer_len + path_len;
220
		GetFileInfo(#copy_from, #file_info_count);
5957 punk_joker 221
		if ( file_info_count.isfolder ) DirFileCount(#copy_from);
222
		else file_count_copy++;
223
	}
224
	copy_bar.max = file_count_copy;
225
5804 punk_joker 226
 
5957 punk_joker 227
	else  operation_flag = COPY_FLAG;
228
229
 
6600 punk_joker 230
    path_len = 0;
231
    buffer_len = 0;
6597 punk_joker 232
    DisplayOperationForm();
233
	for (j = 0; j < cnt; j++) {
5691 punk_joker 234
		if (j==0) strlcpy(#copy_from, buf+10+buffer_len);
6600 punk_joker 235
		else strlcpy(#copy_from, buf+10+buffer_len+1);
236
		debugln(#copy_from);
237
		path_len = strlen(#copy_from);
238
		debugi(path_len);
239
		debug("Step ");
240
		debugi(j);
241
		debugln(" ");
242
		buffer_len = buffer_len + path_len;
243
		if (!copy_from) DialogExit();
5804 punk_joker 244
		strcpy(#copy_to, #path);
4042 leency 245
		strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
246
		if (!strcmp(#copy_from,#copy_to))
5957 punk_joker 247
		{
248
			strcpy(#copy_to, #path);
249
			strcat(#copy_to, "new_");
250
			strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
251
		}
252
		if (strstr(#copy_to, #copy_from))
4698 punk_joker 253
		{
254
			notify("Copy directory into itself is a bad idea...");
255
			DialogExit();
5804 punk_joker 256
		}
4698 punk_joker 257
5957 punk_joker 258
 
259
		{
260
			Write_Error(copy_rezult);
261
		}
262
		else if (cut_active)
263
		{
264
			strcpy(#file_path, #copy_from);
6597 punk_joker 265
			Del_File2(#copy_from, 0);
5957 punk_joker 266
267
 
268
	}
5931 punk_joker 269
	debugln("Step 3000");
6600 punk_joker 270
	if (cut_active)
5957 punk_joker 271
	{
272
		cut_active=false;
273
	}
274
	if (info_after_copy) notify(INFO_AFTER_COPY);
5459 punk_joker 275
	DialogExit();
5931 punk_joker 276
}*/
6600 punk_joker 277