Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7878 → Rev 7877

/programs/cmm/lib/strings.h
491,7 → 491,7
}
}
 
inline signed int strcmpi(dword cmp1, cmp2)
inline dword strcmpi(dword cmp1, cmp2)
{
char si, ue;
 
501,7 → 501,7
ue = DSBYTE[cmp2];
if (si>='A') && (si<='Z') si +=32;
if (ue>='A') && (ue<='Z') ue +=32;
if (si != ue) return si-ue;
if (si != ue) return -1;
cmp1++;
cmp2++;
if ((DSBYTE[cmp1]=='\0') && (DSBYTE[cmp2]=='\0')) return 0;
/programs/cmm/lib/collection.h
20,8 → 20,6
dword get_pos_by_name();
void drop();
void increase_data_size();
dword get_last();
bool delete_last();
};
 
:void collection::increase_data_size() {
42,10 → 40,7
}
 
:int collection::addn(dword in, len) {
if (count >= 4000) {
debugln("collection: more than 4000 elements!");
return 0;
}
if (count >= 4000) return 0;
if (element_offset[count]+len+2 > data_size) {
increase_data_size();
addn(in, len);
62,10 → 57,6
return data_start + element_offset[pos];
}
 
:dword collection::get_last() {
return get(count-1);
}
 
:dword collection::get_pos_by_name(dword name) {
dword i;
for (i=0; i<count; i++) {
82,9 → 73,6
count = 0;
}
 
:bool collection::delete_last() {
count--;
}
 
/*========================================================
= =
/programs/cmm/lib/copyf.h
15,7 → 15,7
if (!from1) || (!in1)
{
notify("Error: too few copyf() params!");
return -1;
return;
}
if (error = GetFileInfo(from1, #CopyFile_atr1))
{
/programs/cmm/lib/fs.h
6,10 → 6,6
#include "../lib/date.h"
#endif
 
#ifndef INCLUDE_COLLECTION_H
#include "../lib/collection.h"
#endif
 
//===================================================//
// //
// Basic System Functions //
239,14 → 235,14
DIRS_ONLYREAL
};
:int GetDir(dword dir_buf, file_count, path, doptions)
{
dword buf, fcount, error;
char readbuf[32];
{
error = ReadDir(0, #readbuf, path);
buf = malloc(32);
error = ReadDir(0, buf, path);
if (!error)
{
fcount = ESDWORD[#readbuf+8];
buf = malloc(fcount+1*304+32);
fcount = ESDWORD[buf+8];
buf = realloc(buf, fcount+1*304+32);
ReadDir(fcount, buf, path);
//fcount=EBX;
 
265,7 → 261,7
}
else
{
ESDWORD[dir_buf] = 0;
ESDWORD[dir_buf] = free(buf);
ESDWORD[file_count] = 0;
}
return error;
425,28 → 421,26
// //
//===================================================//
 
:struct DIR_SIZE
:struct _dir_size
{
BDVK dir_info;
dword folders;
dword files;
dword bytes;
dword get();
dword calculate_loop();
};
void get();
void calculate_loop();
} dir_size;
 
:dword DIR_SIZE::get(dword way1)
:void _dir_size::get(dword way)
{
folders = files = bytes = 0;
if (!way1) return 0;
calculate_loop(way1);
if (way) calculate_loop(way);
}
 
:dword DIR_SIZE::calculate_loop(dword way)
:void _dir_size::calculate_loop(dword way)
{
dword dirbuf, fcount, i, filename;
dword cur_file;
if (!way) return 0;
if (dir_exists(way))
{
cur_file = malloc(4096);
473,8 → 467,6
free(cur_file);
free(dirbuf);
}
return files;
}
 
 
#endif
/programs/cmm/examples/collections.c
15,15 → 15,9
collection s;
{
s.add("Hello");
s.add("World");
s.add("World!");
debugln(s.get(0)); //-> Hello
debugln(s.get(1)); //-> World
s.delete_last();
debugln(s.get(0)); //-> Hello
debugln(s.get(1)); //-> 0
s.add("Kolibri");
debugln(s.get(0)); //-> Hello
debugln(s.get(1)); //-> Kolibri
s.drop();
}
 
/programs/cmm/eolite/Eolite.c
107,7 → 107,7
 
char scroll_used=false;
 
dword about_stak=0,properties_stak=0,settings_stak=0,delete_stak=0;
dword about_stak,properties_stak,settings_stak,copy_stak,delete_stak;
 
proc_info Form;
int sc_slider_h;
138,11 → 138,12
#include "include\gui.h"
#include "include\settings.h"
#include "include\progress_dialog.h"
#include "include\copy_and_delete.h"
#include "include\copy.h"
#include "include\sorting.h"
#include "include\icons.h"
#include "include\left_panel.h"
#include "include\menu.h"
#include "include\delete.h"
#include "include\about.h"
#include "include\properties.h"
#include "include\breadcrumbs.h"
155,33 → 156,6
load_dll(libimg, #libimg_init,1);
}
 
void handle_param()
{
//-p : just show file/folder properties dialog
//-v : paste thread
//-d : delete thread
if (param) && (param[0]=='-') switch (param[1])
{
case 'p':
strcpy(#file_path, #param + 3);
strcpy(#file_name, #param + strrchr(#param, '/'));
itdir = dir_exists(#file_path);
properties_dialog();
return;
case 'v':
cut_active = param[2] - '0';
strcpy(#path, #param + 4);
PasteThread();
return;
case 'd':
strcpy(#file_path, #param + 3);
itdir = dir_exists(#file_path);
DisplayOperationForm(DELETE_FLAG);
DeleteSingleElement();
return;
}
}
 
void main()
{
dword id;
195,7 → 169,14
LoadIniSettings();
SystemDiscs.Get();
 
handle_param();
//-p just show file/folder properties dialog
if (param) && (param[0]=='-') && (param[1]=='p')
{
strcpy(#file_path, #param + 3);
strcpy(#file_name, #param + strrchr(#param, '/'));
properties_dialog();
ExitProcess();
}
 
ESBYTE[0] = NULL;
 
319,9 → 300,12
id=GetButtonID();
 
if (new_element_active) || (del_active) {
if (POPUP_BTN1==id) && (del_active) EventDelete();
if (POPUP_BTN1==id) && (new_element_active) NewElement();
if (POPUP_BTN2==id) EventClosePopinForm();
if(POPUP_BTN1==id) || (POPUP_BTN2==id) {
if (del_active) Del_File(id-POPUP_BTN2);
if (new_element_active) NewElement(id-POPUP_BTN2);
DeleteButton(POPUP_BTN1);
DeleteButton(POPUP_BTN2);
}
break;
}
 
345,13 → 329,13
Dir_Up();
break;
case 24:
EventCopy(CUT);
Copy(#file_path, CUT);
break;
case 25:
EventCopy(NOCUT);
Copy(#file_path, NOCUT);
break;
case 26:
EventPaste();
Paste();
break;
case 31...33:
EventSort(id-30);
384,13 → 368,13
{
if (del_active)
{
if (key_scancode == SCAN_CODE_ENTER) EventDelete();
if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
if (key_scancode == SCAN_CODE_ENTER) Del_File(true);
if (key_scancode == SCAN_CODE_ESC) Del_File(false);
}
if (new_element_active)
{
if (key_scancode == SCAN_CODE_ENTER) NewElement();
if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
if (key_scancode == SCAN_CODE_ENTER) NewElement(true);
if (key_scancode == SCAN_CODE_ESC) NewElement(false);
EAX = key_editbox;
edit_box_key stdcall (#new_file_ed);
}
421,16 → 405,16
SystemDiscs.Click(key_scancode);
break;
case SCAN_CODE_KEY_X:
EventCopy(CUT);
Copy(#file_path, CUT);
break;
case SCAN_CODE_KEY_C:
EventCopy(NOCUT);
Copy(#file_path, NOCUT);
break;
case SCAN_CODE_KEY_G:
EventOpenConsoleHere();
break;
case SCAN_CODE_KEY_V:
EventPaste();
Paste();
break;
case SCAN_CODE_KEY_D: //set image as bg
strlcpy(#temp, "\\S__",4);
501,6 → 485,7
if (action_buf==OPERATION_END)
{
FnProcess(5);
if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
action_buf=0;
}
break;
514,6 → 499,7
if(cmd_free==2) about_stak=free(about_stak);
else if(cmd_free==3) properties_stak=free(properties_stak);
else if(cmd_free==4) settings_stak=free(settings_stak);
else if(cmd_free==5) copy_stak=free(copy_stak);
else if(cmd_free==6) delete_stak=free(delete_stak);
cmd_free = false;
}
967,11 → 953,12
RunProgram("/sys/@open", #open_param);
}
 
void NewElement()
void NewElement(byte newf)
{
BDVK element_info;
byte del_rezult, copy_rezult, info_result;
 
if (newf)
{
sprintf(#temp,"%s/%s",#path,new_file_ed.text);
info_result = GetFileInfo(#temp, #element_info);
switch(new_element_active)
1039,10 → 1026,13
notify(FS_ITEM_ALREADY_EXISTS);
}
}
new_element_active = 0;
Open_Dir(#path,WITH_REDRAW);
SelectFileByName(new_file_ed.text);
EventClosePopinForm();
}
new_element_active = 0;
Open_Dir(#path,WITH_REDRAW);
}
 
void NewElement_Form(byte crt, dword strng)
{
1103,7 → 1093,8
NewElement_Form(CREATE_FILE, T_NEW_FILE);
break;
case 8:
EventShowProperties();
properties_stak = malloc(8096);
CreateThread(#properties_dialog, properties_stak+8092);
break;
case 10: //F10
if (!active_settings)
1262,45 → 1253,4
}
}
 
void EventPaste() {
char paste_line[4096+6];
sprintf(#paste_line, "-v%i %s", cut_active, #path);
RunProgram(#program_path, #paste_line);
EventClosePopinForm();
}
 
void EventDelete()
char line_param[4096+5];
{
EventClosePopinForm();
if (!selected_count) {
sprintf(#line_param, "-d %s", #file_path);
RunProgram(#program_path, #line_param);
} else {
delete_stak = malloc(40000);
CreateThread(#DeleteSelectedElements,delete_stak+40000-4);
}
}
 
void EventClosePopinForm()
{
del_active=0;
new_element_active = 0;
draw_window();
DeleteButton(POPUP_BTN1);
DeleteButton(POPUP_BTN2);
}
 
void EventShowProperties()
char line_param[4096+5];
{
if (!selected_count) {
sprintf(#line_param, "-p %s", #file_path);
RunProgram(#program_path, #line_param);
} else {
properties_stak = malloc(8096);
CreateThread(#properties_dialog, properties_stak+8092);
}
}
 
stop:
/programs/cmm/eolite/include/copy_and_delete.h
File deleted
/programs/cmm/eolite/include/translations.h
1,5 → 1,5
#define TITLE "Eolite File Manager 4.28"
#define ABOUT_TITLE "EOLITE 4.28"
#define TITLE "Eolite File Manager 4.24b"
#define ABOUT_TITLE "EOLITE 4.24b"
 
#ifdef LANG_RUS
?define T_FILE "” ©«"
/programs/cmm/eolite/include/menu.h
95,14 → 95,14
void EventMenuClick(dword _id)
{
if (active_menu == MENU_NO_FILE) switch(_id) {
case 1: EventPaste(); break;
case 1: Paste(); break;
}
if (active_menu == MENU_FILE) switch(_id) {
case 1: Open(0); break;
case 2: ShowOpenWithDialog(); break;
case 3: EventCopy(NOCUT); break;
case 4: EventCopy(CUT); break;
case 5: EventPaste(); break;
case 3: Copy(#file_path, NOCUT); break;
case 4: Copy(#file_path, CUT); break;
case 5: Paste(); break;
case 6: FnProcess(2); break;
case 7: Del_Form(); break;
case 8: FnProcess(8); break;
109,9 → 109,9
}
if (active_menu == MENU_DIR) switch(_id) {
case 1: Open(0); break;
case 2: EventCopy(NOCUT); break;
case 3: EventCopy(CUT); break;
case 4: EventPaste(); break;
case 2: Copy(#file_path, NOCUT); break;
case 3: Copy(#file_path, CUT); break;
case 4: Paste(); break;
case 5: Del_Form(); break;
case 6: FnProcess(8); break;
}
/programs/cmm/eolite/include/progress_dialog.h
8,9 → 8,10
 
proc_info Dialog_Form;
progress_bar copy_bar = {0,PR_LEFT,PR_TOP,PR_W,PR_H,0,0,1,0xFFFFFF,0x00FF00,0x555555};
//sensor copying = {PR_LEFT,PR_TOP,WIN_DIALOG_W-PR_LEFT-PR_LEFT,19};
 
int operation_flag;
enum {
REDRAW_FLAG,
COPY_FLAG,
MOVE_FLAG,
DELETE_FLAG,
17,26 → 18,20
OPERATION_END
};
 
void DisplayOperationForm(int operation_flag)
void DisplayOperationForm()
{
dword title;
if (operation_flag==COPY_FLAG) {
title = T_COPY_WINDOW_TITLE;
copy_bar.progress_color = 0x00FF00;
copy_bar.value = 0;
copy_bar.max = 0;
}
else if (operation_flag==MOVE_FLAG) {
title = T_MOVE_WINDOW_TITLE;
copy_bar.progress_color = 0x00FF00;
copy_bar.value = 0;
copy_bar.max = 0;
}
else if (operation_flag==DELETE_FLAG) {
title = T_DELETE_WINDOW_TITLE;
copy_bar.progress_color = 0xF17A65;
copy_bar.value = 0;
copy_bar.max = 0;
}
copy_bar.frame_color = sc.work_graph;
switch(CheckEvent())
47,13 → 42,13
break;
case evReDraw:
DefineAndDrawWindow(Form.left+Form.width-200, Form.top+90, WIN_DIALOG_W+9,
skin_height+WIN_DIALOG_H, 0x34, sc.work, title, 0);
DefineAndDrawWindow(Form.left+Form.width-200,Form.top+90,WIN_DIALOG_W+9,skin_height+WIN_DIALOG_H,0x34,sc.work,title,0);
GetProcessInfo(#Dialog_Form, SelfInfo);
DrawCaptButton(WIN_DIALOG_W-PR_LEFT-101, PR_TOP+PR_H+6, 100,26, 2,
sc.button, sc.button_text, T_ABORT_WINDOW_BUTTON);
 
DrawRectangle3D(PR_LEFT-1, PR_TOP-1, PR_W+1, PR_H+1, sc.work_dark, sc.work_light);
//copying.draw_wrapper();
}
}
 
69,12 → 64,15
copy_bar.value++;
return;
}
DisplayOperationForm(REDRAW_FLAG);
DisplayOperationForm();
DrawBar(PR_LEFT, PR_TOP-20, WIN_DIALOG_W-PR_LEFT, 15, sc.work);
WriteText(PR_LEFT, PR_TOP-20, 0x90, sc.work_text, filename);
 
progressbar_draw stdcall (#copy_bar);
progressbar_progress stdcall (#copy_bar);
//copy_bar.value++;
//pause(1);
//copying.draw_progress(copy_bar.value*copying.w/copy_bar.max, copy_bar.value, copy_bar.max-copy_bar.value, "");
 
WriteTextWithBg(PR_LEFT, PR_TOP+PR_H+5, 0xD0, sc.work_text,
sprintf(#param, "%i/%i", copy_bar.value, copy_bar.max), sc.work);
/programs/cmm/eolite/include/properties.h
51,8 → 51,7
 
bool apply_question_active;
 
DIR_SIZE more_files_count;
DIR_SIZE dir_size;
_dir_size more_files_count;
 
checkbox ch_read_only = { PR_T_ONLY_READ, NULL };
checkbox ch_hidden = { PR_T_HIDDEN, NULL };
/programs/cmm/eolite/include/copy.h
0,0 → 1,141
 
byte copy_to[4096];
byte copy_from[4096];
byte cut_active=0;
 
enum {NOCUT, CUT};
 
void setElementSelectedFlag(dword n, int state) {
dword selected_offset = file_mas[n]*304 + buf+32 + 7;
ESBYTE[selected_offset] = state;
if (n==0) && (strncmp(file_mas[n]*304+buf+72,"..",2)==0) {
ESBYTE[selected_offset] = false; //do not selec ".." directory
return;
}
if (state==true) selected_count++;
if (state==false) selected_count--;
if (selected_count<0) selected_count=0;
}
 
int getElementSelectedFlag(dword n) {
dword selected_offset = file_mas[n]*304 + buf+32 + 7;
return ESBYTE[selected_offset];
}
 
void Copy(dword pcth, char cut)
{
byte copy_t[4096];
dword buff_data;
dword path_len = 0;
dword size_buf = 0;
dword copy_buf_offset = 0;
dword i;
 
if (files.count<=0) return; //no files
 
//if no element selected by "Insert" key, then we copy current element
if (!selected_count)
setElementSelectedFlag(files.cur_y, true);
 
if (!selected_count) return;
size_buf = 4;
for (i=0; i<files.count; i++)
{
if (getElementSelectedFlag(i) == true) {
sprintf(#copy_t,"%s/%s",#path,file_mas[i]*304+buf+72);
path_len = strlen(#copy_t);
size_buf += path_len + 1;
}
}
size_buf += 20;
buff_data = malloc(size_buf);
ESDWORD[buff_data] = size_buf;
ESDWORD[buff_data+4] = SLOT_DATA_TYPE_RAW;
ESINT[buff_data+8] = selected_count;
copy_buf_offset = buff_data + 10;
for (i=0; i<files.count; i++)
{
if (getElementSelectedFlag(i) == true) {
sprintf(copy_buf_offset,"%s/%s",#path,file_mas[i]*304+buf+72);
copy_buf_offset += strlen(copy_buf_offset) + 1;
}
}
if (selected_count==1) setElementSelectedFlag(files.cur_y, false);
Clipboard__SetSlotData(size_buf, buff_data);
cut_active = cut;
free(buff_data);
}
 
void Paste() {
copy_stak = free(copy_stak);
copy_stak = malloc(64000);
CreateThread(#PasteThread,copy_stak+64000-4);
}
 
void PasteThread()
{
char copy_rezult;
int j;
int paste_elements_count = 0;
dword buf;
dword path_offset;
dword file_count_paste = 0;
_dir_size paste_dir_size;
BDVK file_info_count;
 
copy_bar.value = 0;
buf = Clipboard__GetSlotData(Clipboard__GetSlotCount()-1);
if (DSDWORD[buf+4] != 3) return;
paste_elements_count = ESINT[buf+8];
path_offset = buf + 10;
//calculate copy files count for progress bar
for (j = 0; j < paste_elements_count; j++) {
GetFileInfo(path_offset, #file_info_count);
if ( file_info_count.isfolder ) {
paste_dir_size.get(path_offset);
file_count_paste += paste_dir_size.files;
}
else file_count_paste++;
path_offset += strlen(path_offset) + 1;
}
copy_bar.max = file_count_paste;
if (cut_active) operation_flag = MOVE_FLAG;
else operation_flag = COPY_FLAG;
path_offset = buf + 10;
DisplayOperationForm();
for (j = 0; j < paste_elements_count; j++) {
strcpy(#copy_from, path_offset);
if (!copy_from) DialogExit();
sprintf(#copy_to, "%s/%s", #path, #copy_from+strrchr(#copy_from,'/'));
if (!strcmp(#copy_from,#copy_to))
{
sprintf(#copy_to, "%s/NEW_%s", #path, #copy_from+strrchr(#copy_from,'/'));
}
if (strstr(#copy_to, #copy_from))
{
notify("Copy directory into itself is a bad idea...");
DialogExit();
}
 
if (copy_rezult = copyf(#copy_from,#copy_to))
{
Write_Error(copy_rezult);
if (copy_rezult==8) DialogExit(); //not enough space
}
else if (cut_active)
{
strcpy(#file_path, #copy_from);
Del_File2(#copy_from, 0);
}
path_offset += strlen(path_offset) + 1;
}
cut_active=false;
if (info_after_copy.checked) notify(INFO_AFTER_COPY);
DialogExit();
}
 
/programs/cmm/eolite/include/sorting.h
16,9 → 16,8
int j;
int isn = a;
if (a >= b) return;
for (j = a; j <= b; j++) {
if (strcmpi(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
}
for (j = a; j <= b; j++)
if (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
Sort_by_Name(a, isn-2);
Sort_by_Name(isn, b);
}
51,3 → 50,5
Sort_by_Type(isn, b);
}
 
 
 
/programs/cmm/eolite/include/delete.h
0,0 → 1,95
int del_error;
int Del_File2(dword way, sh_progr)
{
dword dirbuf, fcount, i, filename;
int error;
char del_from[4096];
if (dir_exists(way))
{
if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
for (i=0; i<fcount; i++)
{
if (CheckEvent()==evReDraw) draw_window();
filename = i*304+dirbuf+72;
sprintf(#del_from,"%s/%s",way,filename);
if ( TestBit(ESDWORD[filename-40], 4) )
{
Del_File2(#del_from, 1);
}
else
{
if (sh_progr) Operation_Draw_Progress(filename);
if (error = DeleteFile(#del_from)) del_error = error;
}
}
}
if (error = DeleteFile(way)) del_error = error;
}
 
void Del_File_Thread()
{
byte del_from[4096];
int tst, count, i;
 
BDVK file_info_count;
_dir_size delete_dir_size;
dword file_count_delete = 0;
copy_bar.value = 0;
operation_flag = DELETE_FLAG;
if (selected_count)
{
for (i=0; i<files.count; i++)
{
if (getElementSelectedFlag(i) == true) {
sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72);
GetFileInfo(#del_from, #file_info_count);
if ( file_info_count.isfolder ) {
delete_dir_size.get(#del_from);
file_count_delete += delete_dir_size.files;
}
else file_count_delete++;
}
}
}
else
{
if (itdir) {
delete_dir_size.get(#file_path);
file_count_delete += delete_dir_size.files;
}
else file_count_delete++;
}
copy_bar.max = file_count_delete;
del_error = 0;
DisplayOperationForm();
if (selected_count)
{
for (i=0; i<files.count; i++)
{
if (getElementSelectedFlag(i) == true) {
sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72);
Del_File2(#del_from, 1);
}
}
}
else
{
Del_File2(#file_path, 1);
}
if (del_error) Write_Error(del_error);
cmd_free = 6;
DialogExit();
}
 
void Del_File(byte dodel) {
del_active=0;
if (dodel)
{
delete_stak = malloc(40000);
CreateThread(#Del_File_Thread,delete_stak+40000-4);
}
else draw_window();
}
/programs/cmm/menu/menu.c
147,13 → 147,6
}
}
 
void CorrectLastItem()
{
if (menu1.cur_y > menu1.count - GetSeparatorsCount() - 1) {
menu1.cur_y = menu1.count - GetSeparatorsCount() - 1;
}
}
 
void ProcessKeys()
{
switch(key_scancode)
171,19 → 164,10
break;
 
case SCAN_CODE_UP:
if (!menu1.KeyUp()) {
menu1.KeyEnd();
CorrectLastItem();
}
if (!menu1.KeyUp()) menu1.KeyEnd();
draw_list();
break;
 
case SCAN_CODE_END:
menu1.KeyEnd();
CorrectLastItem();
draw_list();
break;
 
default:
if (menu1.ProcessKey(key_scancode)) draw_list();
}
/programs/cmm/sysmon/general.h
21,7 → 21,6
 
void General__Main()
{
DIR_SIZE dir_size;
dword cpu_frequency;
incn y;
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON);