forked from KolibriOS/kolibrios
Eolite: run with -p key to show file/folder properties,
Calypte 0.3: full refactoring, use C-- menu, big fonts git-svn-id: svn://kolibrios.org@7041 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
cb0c6cee9a
commit
468d76a95e
@ -1,358 +1,299 @@
|
||||
//Calypte 0.3 - Leency
|
||||
//Calypte 0.15 - Punk Joker
|
||||
|
||||
#define MEMSIZE 1024*80
|
||||
|
||||
#ifndef AUTOBUILD
|
||||
#include "lang.h--"
|
||||
#endif
|
||||
|
||||
#define MEMSIZE 0x100000
|
||||
#include "..\lib\kolibri.h"
|
||||
#include "..\lib\strings.h"
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\file_system.h"
|
||||
#include "..\lib\dll.h"
|
||||
#include "..\lib\gui.h"
|
||||
#include "..\lib\obj\iconv.h"
|
||||
#include "..\lib\obj\box_lib.h"
|
||||
#include "..\lib\obj\proc_lib.h"
|
||||
#include "..\lib\obj\libio_lib.h"
|
||||
//#include "..\lib\obj\wword.h"
|
||||
|
||||
#ifdef LANG_RUS
|
||||
?define T_FILE "” ©«"
|
||||
?define T_TYPE "’¨¯"
|
||||
?define T_SIZE "<EFBFBD> §¬¥à"
|
||||
//===================================================//
|
||||
// //
|
||||
// LIB //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
?define MENU1 "” ©«"
|
||||
?define MENU1_SUBMENU1 "Žâªàëâì"
|
||||
?define MENU1_SUBMENU2 "‡ ªàëâì"
|
||||
?define MENU1_SUBMENU3 "‘¢®©á⢠"
|
||||
?define MENU1_SUBMENU4 "‚ë室"
|
||||
#include "../lib/kolibri.h"
|
||||
#include "../lib/file_system.h"
|
||||
#include "../lib/gui.h"
|
||||
#include "../lib/list_box.h"
|
||||
#include "../lib/menu.h"
|
||||
|
||||
?define MENU2 "Š®¤¨à®¢ª "
|
||||
?define MENU2_SUBMENU1 "UTF-8"
|
||||
?define MENU2_SUBMENU2 "KOI8-RU"
|
||||
?define MENU2_SUBMENU3 "CP1251"
|
||||
?define MENU2_SUBMENU4 "CP1252"
|
||||
?define MENU2_SUBMENU5 "ISO8859-5"
|
||||
?define MENU2_SUBMENU6 "CP866"
|
||||
#include "../lib/obj/iconv.h"
|
||||
//#include "../lib/obj/box_lib.h" //TO CHECK: boxlib doesn't work well with opendial
|
||||
#include "../lib/obj/proc_lib.h"
|
||||
#include "../lib/obj/libio_lib.h"
|
||||
|
||||
?define ERROR_LOAD_BOX_LIB "Žè¨¡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - box_lib.obj"
|
||||
?define ERROR_LOAD_LIBIO "Žè¨¡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - libio.obj"
|
||||
?define ERROR_LOAD_PROC_LIB "Žè¨¡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ - proc_lib.obj"
|
||||
#else
|
||||
?define T_FILE "File"
|
||||
?define T_TYPE "Type"
|
||||
?define T_SIZE "Size"
|
||||
?define MENU1 "File"
|
||||
#include "../lib/patterns/simple_open_dialog.h"
|
||||
|
||||
?define MENU1_SUBMENU1 "Open"
|
||||
?define MENU1_SUBMENU2 "Close"
|
||||
?define MENU1_SUBMENU3 "Properties"
|
||||
?define MENU1_SUBMENU4 "Exit"
|
||||
char default_dir[] = "/rd/1";
|
||||
od_filter filter2 = { "TXT",0};
|
||||
|
||||
?define MENU2 "Encoding"
|
||||
?define MENU2_SUBMENU1 "UTF-8"
|
||||
?define MENU2_SUBMENU2 "KOI8-RU"
|
||||
?define MENU2_SUBMENU3 "CP1251"
|
||||
?define MENU2_SUBMENU4 "CP1252"
|
||||
?define MENU2_SUBMENU5 "ISO8859-5"
|
||||
?define MENU2_SUBMENU6 "CP866"
|
||||
//===================================================//
|
||||
// //
|
||||
// DATA //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
?define ERROR_LOAD_BOX_LIB "Error while loading library - box_lib.obj"
|
||||
?define ERROR_LOAD_LIBIO "Error while loading library - libio.obj"
|
||||
?define ERROR_LOAD_PROC_LIB "Error while loading library - proc_lib.obj"
|
||||
#endif
|
||||
/*========= MENU ==========*/
|
||||
?define MENU1 "File"
|
||||
?define MENU2 "Encoding"
|
||||
?define MENU3 "Reopen"
|
||||
|
||||
#ifdef LANG_RUS
|
||||
struct menu1_text_struct
|
||||
{
|
||||
char menu[5];
|
||||
char sub_menu1[8];
|
||||
char sub_menu2[8];
|
||||
//char sub_menu3[9];
|
||||
char sub_menu4[6];
|
||||
byte end;
|
||||
char menu_file_list[] =
|
||||
"Open
|
||||
Close
|
||||
Properties
|
||||
Exit";
|
||||
|
||||
char menu_encoding_list[] =
|
||||
"UTF-8
|
||||
KOI8-RU
|
||||
CP1251
|
||||
CP1252
|
||||
ISO8859-5
|
||||
CP866";
|
||||
|
||||
char menu_reopen_list[] =
|
||||
"Tinypad
|
||||
TextEdit
|
||||
TextRead
|
||||
WebView
|
||||
FB2Read
|
||||
HexView";
|
||||
|
||||
enum {
|
||||
MENU_ID_FILE=10,
|
||||
FILE_SUBMENU_ID_OPEN=10,
|
||||
FILE_SUBMENU_ID_CLOSE,
|
||||
FILE_SUBMENU_ID_PROPERTIES,
|
||||
FILE_SUBMENU_ID_EXIT,
|
||||
|
||||
MENU_ID_ENCODING=20,
|
||||
|
||||
MENU_ID_REOPEN=30,
|
||||
FILE_SUBMENU_ID_TINYPAD=30,
|
||||
FILE_SUBMENU_ID_TEXTEDIT,
|
||||
FILE_SUBMENU_ID_TEXTREAD,
|
||||
FILE_SUBMENU_ID_WEBVIEW,
|
||||
FILE_SUBMENU_ID_FB2READ,
|
||||
FILE_SUBMENU_ID_HEXVIEW
|
||||
};
|
||||
struct menu2_text_struct
|
||||
{
|
||||
char menu[10];
|
||||
char sub_menu1[6];
|
||||
char sub_menu2[8];
|
||||
char sub_menu3[7];
|
||||
char sub_menu4[7];
|
||||
char sub_menu5[10];
|
||||
char sub_menu6[6];
|
||||
byte end;
|
||||
};
|
||||
#else
|
||||
struct menu1_text_struct
|
||||
{
|
||||
char menu[5];
|
||||
char sub_menu1[5];
|
||||
char sub_menu2[6];
|
||||
//char sub_menu3[11];
|
||||
char sub_menu4[5];
|
||||
byte end;
|
||||
};
|
||||
struct menu2_text_struct
|
||||
{
|
||||
char menu[9];
|
||||
char sub_menu1[6];
|
||||
char sub_menu2[8];
|
||||
char sub_menu3[7];
|
||||
char sub_menu4[7];
|
||||
char sub_menu5[10];
|
||||
char sub_menu6[6];
|
||||
byte end;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define TITLE "Calypte v0.15"
|
||||
int menu_file_x = 6;
|
||||
int menu_encoding_x = NULL;
|
||||
int menu_reopen_x = NULL;
|
||||
/*======== MENU END ==========*/
|
||||
|
||||
#define TOPPANELH 19
|
||||
#define TITLE "Calypte v0.3"
|
||||
char win_title[4096] = TITLE;
|
||||
|
||||
#define TOPPANELH 23
|
||||
#define BOTPANELH 10
|
||||
#define WIN_W 600
|
||||
#define WIN_H 400
|
||||
#define WIN_W 750
|
||||
#define WIN_H 550
|
||||
|
||||
proc_info Form;
|
||||
llist rows;
|
||||
|
||||
byte active_properties = 0;
|
||||
int encoding;
|
||||
dword properties_window;
|
||||
|
||||
#include "include\properties.h"
|
||||
|
||||
struct filter
|
||||
{
|
||||
dword size;
|
||||
char ext1[4];
|
||||
//char ext2[4];
|
||||
//char ext3[4];
|
||||
//char ext4[4];
|
||||
byte end;
|
||||
};
|
||||
|
||||
filter filter2;
|
||||
menu1_text_struct menu1_text_area1;
|
||||
menu2_text_struct menu2_text_area2;
|
||||
|
||||
char win_title[4096] = "Calypte v0.15";
|
||||
|
||||
int
|
||||
cur_row=0,
|
||||
read=0,
|
||||
pos=0,
|
||||
row_num=0,
|
||||
col_count=0,
|
||||
row_count=0;
|
||||
|
||||
dword old_width,old_height;
|
||||
|
||||
proc_info pr_inf;
|
||||
char communication_area_name[] = "FFFFFFFF_open_dialog";
|
||||
byte plugin_path[4096];
|
||||
char default_dir[] = "/rd/1";
|
||||
char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial
|
||||
byte openfile_path[2048];
|
||||
byte filename_area[4096];
|
||||
|
||||
opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path, #draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120};
|
||||
|
||||
dword bufpointer;
|
||||
dword bufsize;
|
||||
dword draw_sruct;
|
||||
|
||||
menu_data menudata1 = {0, 40, 2, 15, 2, #menu1_text_area1.menu, #menu1_text_area1.sub_menu1, #menu1_text_area1.end, 0, 0, 80, 2, 100, 18, 0xEEEEEE, 0xFF, 0xEEEEEE, 0, 0, 0, #Form, 0, 0, 0, 16, 0, 0, 0x00CC00, 0, 0xFFFFFF, 0, 8, 0, 0};
|
||||
menu_data menudata2 = {0, 70, 44, 15, 2, #menu2_text_area2.menu, #menu2_text_area2.sub_menu1, #menu2_text_area2.end, 0, 0, 80, 44, 100, 18, 0xEEEEEE, 0xFF, 0xEEEEEE, 0, 0, 0, #Form, 0, 0, 0, 16, 0, 0, 0x00CC00, 0, 0xFFFFFF, 0, 8, 0, 0};
|
||||
//===================================================//
|
||||
// //
|
||||
// CODE //
|
||||
// //
|
||||
//===================================================//
|
||||
|
||||
void InitDlls()
|
||||
{
|
||||
//load_dll(boxlib, #box_lib_init, 0);
|
||||
load_dll(libio, #libio_init, 1);
|
||||
load_dll(iconv_lib, #iconv_open, 0);
|
||||
load_dll(Proc_lib, #OpenDialog_init,0);
|
||||
OpenDialog_init stdcall (#o_dialog);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int id;
|
||||
|
||||
strcpy(#filter2.ext1, "TXT");
|
||||
//strcpy(#filter2.ext2, "ASM");
|
||||
//strcpy(#filter2.ext3, "INC\0");
|
||||
//strcpy(#filter2.ext4, "\0");
|
||||
filter2.size = 8;
|
||||
filter2.end = 0;
|
||||
InitDlls();
|
||||
|
||||
strcpy(#menu1_text_area1.menu, MENU1);
|
||||
strcpy(#menu1_text_area1.sub_menu1, MENU1_SUBMENU1);
|
||||
strcpy(#menu1_text_area1.sub_menu2, MENU1_SUBMENU2);
|
||||
//strcpy(#menu1_text_area1.sub_menu3, MENU1_SUBMENU3);
|
||||
strcpy(#menu1_text_area1.sub_menu4, MENU1_SUBMENU4);
|
||||
menu1_text_area1.end = 0;
|
||||
|
||||
strcpy(#menu2_text_area2.menu, MENU2);
|
||||
strcpy(#menu2_text_area2.sub_menu1, MENU2_SUBMENU1);
|
||||
strcpy(#menu2_text_area2.sub_menu2, MENU2_SUBMENU2);
|
||||
strcpy(#menu2_text_area2.sub_menu3, MENU2_SUBMENU3);
|
||||
strcpy(#menu2_text_area2.sub_menu4, MENU2_SUBMENU4);
|
||||
strcpy(#menu2_text_area2.sub_menu5, MENU2_SUBMENU5);
|
||||
strcpy(#menu2_text_area2.sub_menu6, MENU2_SUBMENU6);
|
||||
menu2_text_area2.end = 0;
|
||||
|
||||
//mem_Init();
|
||||
load_dll(boxlib, #box_lib_init,0);
|
||||
load_dll(libio, #libio_init,1);
|
||||
load_dll(iconv_lib, #iconv_open,0);
|
||||
load_dll(Proc_lib, #OpenDialog_init,0);
|
||||
OpenDialog_init stdcall (#o_dialog);
|
||||
|
||||
SetEventMask(0x27);
|
||||
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
||||
loop()
|
||||
{
|
||||
switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
menu_bar_mouse stdcall (#menudata1);
|
||||
menu_bar_mouse stdcall (#menudata2);
|
||||
if (menudata1.click==1)
|
||||
{
|
||||
switch(menudata1.cursor_out)
|
||||
{
|
||||
case 1:
|
||||
OpenDialog_start stdcall (#o_dialog);
|
||||
OpenFile(#openfile_path);
|
||||
Prepare();
|
||||
draw_window();
|
||||
mouse.get();
|
||||
rows.wheel_size = 3;
|
||||
if (rows.MouseScroll(mouse.vert)) {
|
||||
DrawText();
|
||||
break;
|
||||
case 2:
|
||||
read = 0;
|
||||
strcpy(#win_title, TITLE);
|
||||
FreeBuf();
|
||||
draw_window();
|
||||
break;
|
||||
case 3:
|
||||
if (!active_properties)
|
||||
{
|
||||
SwitchToAnotherThread();
|
||||
properties_window = CreateThread(#properties_dialog, #properties_stak+4092);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ActivateWindow(GetProcessSlot(properties_window));
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
ExitProcess();
|
||||
}
|
||||
}
|
||||
if (menudata2.click==1)
|
||||
{
|
||||
encoding = menudata2.cursor_out - 1;
|
||||
OpenFile(#openfile_path);
|
||||
Prepare();
|
||||
draw_window();
|
||||
}
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==1) || (id==10) ExitProcess();
|
||||
if (id==1) ExitProcess();
|
||||
if (id==MENU_ID_FILE) menu.show(
|
||||
Form.left+5 + menu_file_x,
|
||||
Form.top+skin_height + TOPPANELH,
|
||||
140,
|
||||
#menu_file_list,
|
||||
MENU_ID_FILE);
|
||||
|
||||
if (id==MENU_ID_ENCODING) menu.show(
|
||||
Form.left+5 + menu_encoding_x,
|
||||
Form.top+skin_height + TOPPANELH,
|
||||
120,
|
||||
#menu_encoding_list,
|
||||
MENU_ID_ENCODING);
|
||||
|
||||
if (id==MENU_ID_REOPEN) menu.show(
|
||||
Form.left+5 + menu_reopen_x,
|
||||
Form.top+skin_height + TOPPANELH,
|
||||
120,
|
||||
#menu_reopen_list,
|
||||
MENU_ID_REOPEN);
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
GetKeys();
|
||||
if (TestBit(key_modifier, 2))
|
||||
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
|
||||
{
|
||||
switch(key_scancode)
|
||||
{
|
||||
case 024: //Ctrl+O
|
||||
OpenDialog_start stdcall (#o_dialog);
|
||||
OpenFile(#openfile_path);
|
||||
Prepare();
|
||||
draw_window();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (key_scancode)
|
||||
{
|
||||
if (Form.status_window>2) break;
|
||||
case SCAN_CODE_HOME:
|
||||
cur_row = 0;
|
||||
DrawText();
|
||||
break;
|
||||
case SCAN_CODE_END:
|
||||
cur_row = row_num - row_count - 1;
|
||||
DrawText();
|
||||
break;
|
||||
case SCAN_CODE_UP:
|
||||
if (!cur_row) break;
|
||||
else cur_row = cur_row-1;
|
||||
DrawText();
|
||||
break;
|
||||
case SCAN_CODE_DOWN:
|
||||
if (cur_row+row_count>=row_num) break;
|
||||
cur_row = cur_row+1;
|
||||
DrawText();
|
||||
break;
|
||||
case SCAN_CODE_PGUP:
|
||||
if (!cur_row) break;
|
||||
if (cur_row<row_count) cur_row = 0;
|
||||
else cur_row = cur_row-row_count;
|
||||
DrawText();
|
||||
break;
|
||||
case SCAN_CODE_PGDN:
|
||||
if (cur_row+row_count>row_num) break;
|
||||
cur_row = cur_row+row_count;
|
||||
DrawText();
|
||||
if (key_scancode == SCAN_CODE_KEY_O) EventOpenFile();
|
||||
break;
|
||||
}
|
||||
if (rows.ProcessKey(key_scancode)) DrawText();
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
if (menu.list.cur_y) {
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_OPEN) EventOpenFile();
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_CLOSE) EventCloseFile();
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_PROPERTIES) EventShowFileProperties();
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_EXIT) ExitProcess();
|
||||
|
||||
if (menu.list.cur_y > MENU_ID_ENCODING) && (menu.list.cur_y < MENU_ID_ENCODING + 10)
|
||||
EventChangeEncoding(menu.list.cur_y - MENU_ID_ENCODING);
|
||||
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_TINYPAD) ReopenFileIn("/sys/tinypad");
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_TEXTEDIT) ReopenFileIn("/sys/develop/t_edit");
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_TEXTREAD) ReopenFileIn("/sys/txtread");
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_WEBVIEW) ReopenFileIn("/sys/network/webview");
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_FB2READ) ReopenFileIn("/sys/fb2read");
|
||||
if (menu.list.cur_y == FILE_SUBMENU_ID_HEXVIEW) ReopenFileIn("/sys/develop/heed");
|
||||
|
||||
|
||||
menu.list.cur_y = 0;
|
||||
};
|
||||
draw_window();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReopenFileIn(dword app)
|
||||
{
|
||||
RunProgram(app, #param);
|
||||
}
|
||||
|
||||
void EventOpenFile()
|
||||
{
|
||||
OpenDialog_start stdcall (#o_dialog);
|
||||
OpenFile(#openfile_path);
|
||||
Prepare();
|
||||
draw_window();
|
||||
}
|
||||
|
||||
void EventCloseFile()
|
||||
{
|
||||
strcpy(#win_title, TITLE);
|
||||
FreeBuf();
|
||||
draw_window();
|
||||
}
|
||||
|
||||
void EventShowFileProperties()
|
||||
{
|
||||
char ss_param[4096];
|
||||
if (!bufpointer) return;
|
||||
sprintf(#ss_param, "-p %s", #param);
|
||||
RunProgram("/sys/File managers/Eolite", #ss_param);
|
||||
}
|
||||
|
||||
void EventChangeEncoding(dword id)
|
||||
{
|
||||
encoding = id;
|
||||
OpenFile(#openfile_path);
|
||||
Prepare();
|
||||
draw_window();
|
||||
}
|
||||
|
||||
int DrawMenuButton(dword x,y,id,text)
|
||||
{
|
||||
int textlen = strlen(text)*8;
|
||||
int padding = 12;
|
||||
DefineHiddenButton(x, y, textlen+padding+padding, TOPPANELH-2, id);
|
||||
WriteText(x+padding,y+4, 0x90, MixColors(system.color.work, system.color.work_text, 70), text);
|
||||
return textlen+padding+padding;
|
||||
}
|
||||
|
||||
void draw_window()
|
||||
{
|
||||
system.color.get();
|
||||
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,0xFFFFFF,#win_title,0);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
DrawBar(0, 0, Form.cwidth, TOPPANELH, system.color.work);
|
||||
DrawBar(0, 0, Form.cwidth, TOPPANELH-1, system.color.work);
|
||||
DrawBar(0, TOPPANELH-1, Form.cwidth, 1, system.color.work_dark);
|
||||
DrawBar(0, Form.cheight-BOTPANELH, Form.cwidth, BOTPANELH, system.color.work);
|
||||
|
||||
menudata1.bckg_col = system.color.work;
|
||||
menudata2.bckg_col = system.color.work;
|
||||
menu_bar_draw stdcall (#menudata1);
|
||||
menu_bar_draw stdcall (#menudata2);
|
||||
menu_encoding_x = menu_file_x + DrawMenuButton(menu_file_x, 0, MENU_ID_FILE, MENU1);
|
||||
menu_reopen_x = menu_encoding_x + DrawMenuButton(menu_encoding_x, 0, MENU_ID_ENCODING, MENU2);
|
||||
DrawMenuButton(menu_reopen_x, 0, MENU_ID_REOPEN, MENU3);
|
||||
|
||||
if (old_width!=Form.width) || (old_height!=Form.height)
|
||||
{
|
||||
old_width = Form.width;
|
||||
old_height = Form.height;
|
||||
|
||||
col_count = Form.cwidth/6;
|
||||
row_count = Form.cheight-BOTPANELH-TOPPANELH-2;
|
||||
row_count = row_count/10;
|
||||
rows.no_selection = true;
|
||||
rows.SetFont(8, 14, 0x90);
|
||||
rows.SetSizes(0, TOPPANELH, Form.cwidth, Form.cheight - TOPPANELH - BOTPANELH, 20);
|
||||
rows.column_max = rows.w / rows.font_w;
|
||||
|
||||
if (read==1) Prepare();
|
||||
if (bufpointer) Prepare();
|
||||
rows.CheckDoesValuesOkey();
|
||||
}
|
||||
if (read==1)
|
||||
if (bufpointer)
|
||||
{
|
||||
DrawText();
|
||||
}
|
||||
else DrawBar(0, TOPPANELH, Form.cwidth, Form.cheight-BOTPANELH-TOPPANELH, 0xFFFFFF);
|
||||
}
|
||||
|
||||
void OpenFile(dword path)
|
||||
void OpenFile(dword _path)
|
||||
{
|
||||
strcpy(#win_title, TITLE);
|
||||
strcat(#win_title, " - ");
|
||||
strcat(#win_title, path);
|
||||
file_size stdcall (path);
|
||||
strcpy(#param, _path);
|
||||
sprintf(#win_title, "%s - %s", TITLE, #param);
|
||||
rows.KeyHome();
|
||||
file_size stdcall (#param);
|
||||
bufsize = EBX;
|
||||
if (bufsize)
|
||||
{
|
||||
mem_Free(bufpointer);
|
||||
bufpointer = mem_Free(bufpointer);
|
||||
bufpointer = mem_Alloc(bufsize);
|
||||
ReadFile(0, bufsize, bufpointer, path);
|
||||
read=1;
|
||||
if (ReadFile(0, bufsize, bufpointer, #param) != 0) {
|
||||
bufpointer = 0;
|
||||
notify("'Error opening file'-E");
|
||||
}
|
||||
}
|
||||
if (encoding!=CH_CP866) ChangeCharset(charsets[encoding], "CP866", bufpointer);
|
||||
}
|
||||
@ -360,106 +301,94 @@ void OpenFile(dword path)
|
||||
void FreeBuf()
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<row_num; i++)
|
||||
for (i=0; i<rows.count; i++)
|
||||
{
|
||||
mem_Free(DSDWORD[i*4+draw_sruct]);
|
||||
}
|
||||
mem_Free(draw_sruct);
|
||||
mem_Free(bufpointer);
|
||||
draw_sruct = mem_Free(draw_sruct);
|
||||
bufpointer = mem_Free(bufpointer);
|
||||
}
|
||||
|
||||
enum {
|
||||
PARSE_CALCULATE_ROWS_COUNT,
|
||||
PARSE_DRAW_PREPARE,
|
||||
};
|
||||
void Parse(int mode)
|
||||
{
|
||||
int pos=0;
|
||||
int sub_pos=0;
|
||||
int len_str = 0;
|
||||
bool do_eof = false;
|
||||
word bukva[2];
|
||||
|
||||
while(1)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
bukva = DSBYTE[bufpointer+pos+len_str];
|
||||
if (bukva=='\0')
|
||||
{
|
||||
do_eof = true;
|
||||
break;
|
||||
}
|
||||
if (bukva==0x0a) break;
|
||||
else len_str++;
|
||||
}
|
||||
if (len_str<=rows.column_max)
|
||||
{
|
||||
if (mode==PARSE_DRAW_PREPARE)
|
||||
{
|
||||
ESDWORD[sub_pos*4+draw_sruct] = mem_Alloc(len_str+1);
|
||||
strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, len_str); //-1 to do not show \n symbol
|
||||
}
|
||||
pos += len_str+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mode==PARSE_DRAW_PREPARE)
|
||||
{
|
||||
ESDWORD[sub_pos*4+draw_sruct] = mem_Alloc(len_str+1);
|
||||
strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, rows.column_max);
|
||||
}
|
||||
pos += rows.column_max;
|
||||
}
|
||||
sub_pos++;
|
||||
if (mode==PARSE_CALCULATE_ROWS_COUNT) if (do_eof) break;
|
||||
if (mode==PARSE_DRAW_PREPARE) if (pos>=bufsize-1) break;
|
||||
len_str = 0;
|
||||
}
|
||||
if (mode == PARSE_CALCULATE_ROWS_COUNT)
|
||||
{
|
||||
rows.count = sub_pos;
|
||||
draw_sruct = mem_Free(draw_sruct);
|
||||
draw_sruct = mem_Alloc(rows.count*4);
|
||||
Parse(PARSE_DRAW_PREPARE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Prepare()
|
||||
{
|
||||
int i, sub_pos;
|
||||
int len_str = 0;
|
||||
byte do_eof = 0;
|
||||
word bukva[2];
|
||||
dword address;
|
||||
row_num = 0;
|
||||
while(1)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
bukva = DSBYTE[bufpointer+pos+len_str];
|
||||
if (bukva=='\0')
|
||||
{
|
||||
do_eof = 1;
|
||||
break;
|
||||
}
|
||||
if (bukva==0x0a) break;
|
||||
else len_str++;
|
||||
}
|
||||
if (len_str<=col_count)
|
||||
{
|
||||
pos=pos+len_str+1;
|
||||
row_num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos=pos+col_count;
|
||||
row_num++;
|
||||
}
|
||||
len_str = 0;
|
||||
if (do_eof) break;
|
||||
}
|
||||
mem_Free(draw_sruct);
|
||||
draw_sruct = mem_Alloc(row_num*4);
|
||||
pos=0;
|
||||
sub_pos=0;
|
||||
len_str = 0;
|
||||
do_eof = 0;
|
||||
while(1)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
bukva = DSBYTE[bufpointer+pos+len_str];
|
||||
if (bukva=='\0')
|
||||
{
|
||||
do_eof = 1;
|
||||
break;
|
||||
}
|
||||
if (bukva==0x0a) break;
|
||||
else len_str++;
|
||||
}
|
||||
if (len_str<=col_count)
|
||||
{
|
||||
address = mem_Alloc(len_str+1);
|
||||
ESDWORD[sub_pos*4+draw_sruct] = address;
|
||||
strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, len_str);
|
||||
pos=pos+len_str+1;
|
||||
sub_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
address = mem_Alloc(len_str+1);
|
||||
ESDWORD[sub_pos*4+draw_sruct] = address;
|
||||
strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, col_count);
|
||||
pos=pos+col_count;
|
||||
sub_pos++;
|
||||
}
|
||||
len_str = 0;
|
||||
if (pos>=bufsize-1) break;
|
||||
}
|
||||
pos=0;
|
||||
Parse(PARSE_CALCULATE_ROWS_COUNT);
|
||||
}
|
||||
|
||||
void DrawText()
|
||||
{
|
||||
int i, top, num_line;
|
||||
if (row_num<row_count) top = row_num;
|
||||
int i, top;
|
||||
|
||||
if (rows.count<rows.visible) top = rows.count;
|
||||
else
|
||||
{
|
||||
if (row_num-cur_row<=row_count) top = row_num-cur_row-1;
|
||||
else top = row_count;
|
||||
if (rows.count-rows.first<=rows.visible) top = rows.count-rows.first-1;
|
||||
else top = rows.visible;
|
||||
}
|
||||
DrawBar(0, TOPPANELH, Form.cwidth, 3, 0xFFFFFF);
|
||||
for (i=0, num_line = cur_row; i<top; i++, num_line++)
|
||||
|
||||
for (i=0; i<top; i++)
|
||||
{
|
||||
DrawBar(0, i*10+TOPPANELH+3, Form.cwidth, 10, 0xFFFFFF);
|
||||
WriteText(2, i*10+TOPPANELH+3, 0x80, 0x000000, DSDWORD[num_line*4+draw_sruct]);
|
||||
DrawBar(0, i*rows.item_h+TOPPANELH, Form.cwidth, rows.item_h, 0xFFFFFF);
|
||||
WriteText(2, i*rows.item_h+TOPPANELH, 0x90, 0x000000, DSDWORD[i+rows.first*4+draw_sruct]);
|
||||
}
|
||||
DrawBar(0, i*10+TOPPANELH+3, Form.cwidth, -i*10-TOPPANELH-BOTPANELH+Form.cheight, 0xFFFFFF);
|
||||
DrawBar(0, i*rows.item_h+rows.y, rows.w, -i*rows.item_h + rows.h, 0xFFFfff);
|
||||
}
|
||||
|
||||
stop:
|
||||
char properties_stak[4096];
|
@ -1,11 +0,0 @@
|
||||
@del lang.h--
|
||||
@echo #define LANG_RUS 1 >lang.h--
|
||||
|
||||
@del Calypte
|
||||
cls
|
||||
c-- Calypte.c
|
||||
@kpack Calypte.com
|
||||
@rename Calypte.com Calypte
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
@pause
|
@ -1,88 +0,0 @@
|
||||
#ifdef LANG_RUS
|
||||
?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
|
||||
?define BTN_CLOSE "‡ ªàëâì"
|
||||
?define PR_T_NAME "ˆ¬ï:"
|
||||
?define PR_T_DEST "<EFBFBD> ᯮ«®¦¥¨¥:"
|
||||
?define PR_T_SIZE "<EFBFBD> §¬¥à:"
|
||||
?define SET_3 "‘®§¤ :"
|
||||
?define SET_4 "Žâªàëâ:"
|
||||
?define SET_5 "ˆ§¬¥¥:"
|
||||
?define SET_6 "” ©«®¢: "
|
||||
?define SET_7 " <20> ¯®ª: "
|
||||
?define PR_T_CONTAINS "‘®¤¥à¦¨â: "
|
||||
?define FLAGS " €ââਡãâë "
|
||||
?define PR_T_HIDDEN "‘ªàëâë©"
|
||||
?define PR_T_SYSTEM "‘¨á⥬ë©"
|
||||
?define PR_T_ONLY_READ "’®«ìª® ç⥨¥"
|
||||
#else
|
||||
?define WINDOW_TITLE_PROPERTIES "Properties"
|
||||
?define BTN_CLOSE "Close"
|
||||
?define PR_T_NAME "Name:"
|
||||
?define PR_T_DEST "Destination:"
|
||||
?define PR_T_SIZE "Size:"
|
||||
?define SET_3 "Created:"
|
||||
?define SET_4 "Opened:"
|
||||
?define SET_5 "Modified:"
|
||||
?define SET_6 "Files: "
|
||||
?define SET_7 " Folders: "
|
||||
?define PR_T_CONTAINS "Contains: "
|
||||
?define FLAGS " Attributes "
|
||||
?define PR_T_HIDDEN "Hidden"
|
||||
?define PR_T_SYSTEM "System"
|
||||
?define PR_T_ONLY_READ "Read-only"
|
||||
#endif
|
||||
|
||||
dword mouse_ddd2;
|
||||
char path_to_file[4096]="\0";
|
||||
char file_name2[4096]="\0";
|
||||
edit_box file_name_ed = {195,50,25,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#file_name2,#mouse_ddd2, 1000000000000000b,2,2};
|
||||
edit_box path_to_file_ed = {145,100,46,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#path_to_file,#mouse_ddd2, 1000000000000000b,2,2};
|
||||
frame flags_frame = { 0, 280, 10, 83, 151, 0x000111, 0xFFFfff, 1, FLAGS, 0, 0, 6, 0x000111, 0xCCCccc };
|
||||
|
||||
int file_count, dir_count, size_dir;
|
||||
char folder_info[200];
|
||||
BDVK file_info_general;
|
||||
BDVK file_info_dirsize;
|
||||
|
||||
byte readonly, hidden, System;
|
||||
|
||||
void properties_dialog()
|
||||
{
|
||||
byte id;
|
||||
byte key;
|
||||
proc_info settings_form;
|
||||
|
||||
IF (active_properties) ExitProcess();
|
||||
active_properties=1;
|
||||
|
||||
SetEventMask(0x27);
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
IF (id==1) || (id==10)
|
||||
{
|
||||
active_properties=0;
|
||||
ExitProcess();
|
||||
}
|
||||
break;
|
||||
|
||||
case evMouse:
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
IF (key==27)
|
||||
{
|
||||
active_properties=0;
|
||||
ExitProcess();
|
||||
}
|
||||
EAX=key<<8;
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(Form.left + 150,150,270,285+skin_height,0x34,system.color.work,WINDOW_TITLE_PROPERTIES,0);
|
||||
GetProcessInfo(#settings_form, SelfInfo);
|
||||
DrawCaptButton(settings_form.cwidth-70-13, settings_form.cheight-34, 70, 22, 10, 0x288FBD, 0xFFFfff, BTN_CLOSE);
|
||||
}
|
||||
}
|
@ -142,6 +142,16 @@ void main()
|
||||
LoadIniSettings();
|
||||
SystemDiscs.Get();
|
||||
SetAppColors();
|
||||
|
||||
//-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();
|
||||
}
|
||||
|
||||
if (param)
|
||||
{
|
||||
if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" in the end
|
||||
|
@ -16,8 +16,6 @@
|
||||
?define PR_T_SYSTEM "‘¨á⥬ë©"
|
||||
?define PR_T_ONLY_READ "’®«ìª® ç⥨¥"
|
||||
?define SET_BYTE_LANG "¡ ©â"
|
||||
?define TAB_T_BASIC "Ž¡é¨¥"
|
||||
?define TAB_T_DETAILS "<EFBFBD>®¤à®¡¥¥"
|
||||
#else // Apply to all subfolders
|
||||
?define WINDOW_TITLE_PROPERTIES "Properties"
|
||||
?define BTN_CLOSE "Close"
|
||||
@ -36,24 +34,15 @@
|
||||
?define PR_T_SYSTEM "System"
|
||||
?define PR_T_ONLY_READ "Read-only"
|
||||
?define SET_BYTE_LANG "byte"
|
||||
?define TAB_T_BASIC "Basic"
|
||||
?define TAB_T_DETAILS "Details"
|
||||
#endif
|
||||
|
||||
dword mouse_ddd2;
|
||||
char path_to_file[4096]="\0";
|
||||
char file_name2[4096]="\0";
|
||||
edit_box file_name_ed = {230,50,57,0xffffff,0x94AECE,0xFFFfff,0xffffff,2,4098,#file_name2,#mouse_ddd2, 1000000000000000b,2,2};
|
||||
edit_box path_to_file_ed = {160,120,79,0xffffff,0x94AECE,0xFFFfff,0xffffff,2,4098,#path_to_file,#mouse_ddd2, 1000000000000000b,2,2};
|
||||
dword mouse_2;
|
||||
char path_to_file[4096];
|
||||
char file_name2[4096];
|
||||
edit_box file_name_ed = {230,55,35,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2),#file_name2,#mouse_2, 1000000000000000b,2,2};
|
||||
edit_box path_to_file_ed = {160,120,79,0xffffff,0x94AECE,0xFFFfff,0xffffff,2,sizeof(path_to_file),#path_to_file,#mouse_2, 1000000000000000b,2,2};
|
||||
frame flags_frame = { 0, NULL, 10, 92, 212, 0x000111, 0xFFFfff, 1, FLAGS, 0, 1, 12, 0x000111, 0xFFFFFF };
|
||||
|
||||
//NewElement options
|
||||
enum {
|
||||
TAB_BASIC,
|
||||
TAB_DETAILS,
|
||||
};
|
||||
|
||||
byte active_tab;
|
||||
int file_count, dir_count, size_dir;
|
||||
char folder_info[200];
|
||||
dword element_size;
|
||||
@ -274,16 +263,6 @@ void properties_dialog()
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (id==12)
|
||||
{
|
||||
active_tab = TAB_BASIC;
|
||||
DrawPropertiesWindow();
|
||||
}
|
||||
if (id==13)
|
||||
{
|
||||
active_tab = TAB_DETAILS;
|
||||
DrawPropertiesWindow();
|
||||
}
|
||||
if (id==20)
|
||||
{
|
||||
atr_readonly ^= 1;
|
||||
@ -333,7 +312,6 @@ void properties_dialog()
|
||||
}
|
||||
break;
|
||||
}
|
||||
EAX = key_editbox;
|
||||
edit_box_key stdcall(#file_name_ed);
|
||||
edit_box_key stdcall(#path_to_file_ed);
|
||||
break;
|
||||
@ -369,13 +347,10 @@ void DrawPropertiesWindow()
|
||||
file_name_ed.color = 0xffffff;
|
||||
}
|
||||
GetProcessInfo(#settings_form, SelfInfo);
|
||||
DrawFlatButton(10, 5, 12, TAB_T_BASIC);
|
||||
if (exif_load==1) DrawFlatButton(92, 5, 13, TAB_T_DETAILS);
|
||||
|
||||
DrawFlatButton(settings_form.cwidth - 96, settings_form.cheight-34, 10, BTN_CLOSE);
|
||||
DrawFlatButton(settings_form.cwidth -208, settings_form.cheight-34, 11, BTN_APPLY);
|
||||
|
||||
if (active_tab == TAB_BASIC)
|
||||
{
|
||||
WriteText(10, 78, 0x90, system.color.work_text, PR_T_DEST);
|
||||
edit_box_draw stdcall (#path_to_file_ed);
|
||||
|
||||
@ -383,24 +358,23 @@ void DrawPropertiesWindow()
|
||||
|
||||
if (selected_count)
|
||||
{
|
||||
DrawIconByExtension(NULL, NULL, 18, 49, system.color.work);
|
||||
PropertiesDrawIcon(NULL, NULL);
|
||||
sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count);
|
||||
WriteText(50, 49, 0x90, system.color.work_text, #folder_info);
|
||||
WriteText(file_name_ed.left+4, 30, 0x90, system.color.work_text, #folder_info);
|
||||
sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(size_dir, NULL),size_dir,SET_BYTE_LANG);
|
||||
WriteText(120, 97, 0x90, system.color.work_text, #element_size_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( file_info_general.isfolder )
|
||||
DrawIconByExtension(NULL, "<DIR>", 18, 49, system.color.work);
|
||||
PropertiesDrawIcon(NULL, "<DIR>");
|
||||
else {
|
||||
sprintf(#temp_path,"%s/%s",#path,#file_name2);
|
||||
debugln(#temp_path);
|
||||
ext1 = strrchr(#file_name2,'.');
|
||||
if (ext1) ext1 += #file_name2;
|
||||
DrawIconByExtension(#temp_path, ext1, 18, 49, system.color.work);
|
||||
PropertiesDrawIcon(#temp_path, ext1);
|
||||
}
|
||||
WriteText(50, 40, 0x90, system.color.work_text, PR_T_NAME);
|
||||
WriteText(file_name_ed.left+4, 20, 0x80, system.color.work_text, PR_T_NAME);
|
||||
edit_box_draw stdcall (#file_name_ed);
|
||||
|
||||
if (!itdir) element_size = file_info_general.sizelo;
|
||||
@ -425,11 +399,13 @@ void DrawPropertiesWindow()
|
||||
flags_frame.font_backgr_color = system.color.work;
|
||||
frame_draw stdcall (#flags_frame);
|
||||
DrawPropertiesCheckBoxes();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteText(10, 78, 0x90, system.color.work_text, "EXIF");
|
||||
}
|
||||
}
|
||||
|
||||
void PropertiesDrawIcon(dword file_path, extension)
|
||||
{
|
||||
#define ICON_PADDING 10
|
||||
DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, system.color.work_light);
|
||||
DrawIconByExtension(file_path, extension, 20, 30, system.color.work_light);
|
||||
}
|
||||
|
||||
void DrawPropertiesCheckBoxes()
|
||||
|
@ -135,7 +135,7 @@ void LoadIniSettings()
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", 1); show_status_bar = EAX;
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", 1); real_files_names_case = EAX;
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", 0); info_after_copy = EAX;
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 12); kfont.size.pt = EAX;
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 13); kfont.size.pt = EAX;
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "TwoPanels", 0); two_panels = EAX;
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "LineHeight", 19); files.item_h = EAX;
|
||||
ini_get_int stdcall (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#define TITLE "Eolite File Manager v3.8"
|
||||
#define ABOUT_TITLE "EOLITE 3.8"
|
||||
#define TITLE "Eolite File Manager v3.81"
|
||||
#define ABOUT_TITLE "EOLITE 3.81"
|
||||
|
||||
#ifdef LANG_RUS
|
||||
?define T_FILE "” ©«"
|
||||
|
Loading…
Reference in New Issue
Block a user