C-- app updates

WebView 1.8b: 
- key scroll by up and down lists 12 pixels instead of 1
- open app with param when href="" contains '|' symbol, example: href="/sys/tmpdisk|a0"
Eolite 3.96b: 
- fix sorting
- an option to highlight odd lines
- copy path to clipboard by clicking on path bar
- rewrite the code related to device an folder update: so this change removed unnecessary refreshes
- add refresh when /kolibrios mounted
IconEdit 0.57b:
- improve color gradient block
- press Delete key when smth selected fill selection by color2 and resents selection
- impove window appearance when the dark skin is set
- fix a stupid but issue which made impossible to open non-square images
- fix an issue that wrong zoom number displayed
Notes 0.8: 
- reworking, work in progress
- delete binary
Sysmon 0.87:
- minor visible improvement in progress bars
TmpDisk 0.67a:
- deny users to shoot in the foot: show forbid message on /tmp0 deletion

git-svn-id: svn://kolibrios.org@7422 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-10-01 16:41:14 +00:00
parent dd9e50c167
commit 2ec87d22f7
31 changed files with 572 additions and 413 deletions

View File

@ -1,5 +1,5 @@
//HTML Viewer in C--
//Copyright 2007-2017 by Veliant & Leency
//Copyright 2007-2018 by Veliant & Leency
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
#ifndef AUTOBUILD
@ -32,7 +32,7 @@ _http http = {0, 0, 0, 0, 0, 0, 0};
char homepage[] = FROM "html\\homepage.htm""\0";
#ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.8";
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.8b";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
@ -117,6 +117,7 @@ edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000
void main()
{
int i;
load_dll(boxlib, #box_lib_init,0);
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
@ -164,6 +165,9 @@ void main()
}
else
{
#define KEY_SCROLL_N 11
if (SCAN_CODE_UP == key_scancode) for (i=0;i<KEY_SCROLL_N;i++) WB1.list.KeyUp();
if (SCAN_CODE_DOWN == key_scancode) for (i=0;i<KEY_SCROLL_N;i++) WB1.list.KeyDown();
if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
else ProcessEvent(key_scancode);
}
@ -542,7 +546,13 @@ void ClickLink()
{
if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true)
{
if (strchr(#URL, '|')) {
ESBYTE[strchr(#URL, '|')] = NULL;
RunProgram(#URL, strlen(#URL)+1+#URL);
}
else {
RunProgram("/sys/@open", #URL);
}
strcpy(#editURL, history.current());
strcpy(#URL, history.current());
return;

View File

@ -32,6 +32,7 @@
//Button IDs
enum {
PATH_BTN = 10,
POPUP_BTN1 = 201,
POPUP_BTN2 = 202,
BREADCRUMB_ID = 300
@ -51,7 +52,7 @@ enum {
ONLY_OPEN
};
dword col_padding, col_selec, col_lpanel, col_work, col_graph, col_list_line=0xDDD7CF;
dword col_padding=0, col_selec, col_lpanel, col_work, col_graph, col_list_line=0xDDD7CF;
int toolbar_buttons_x[7]={9,46,85,134,167,203};
@ -94,7 +95,6 @@ dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak,delete_stak;
proc_info Form;
int sc_slider_h;
int j, i;
int action_buf;
int rand_n;
@ -133,21 +133,12 @@ byte cmd_free=0;
void main()
{
bool update_files_list = false;
dword files_count = 0;
dword countPathFile = 0;
dword countPathFile2 = 0;
dword files_y = 0;
dword countDisk = 0;
dword id;
dword devbuf;
byte count_sl = 0;
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
char stats;
rand_n = random(40);
devbuf = malloc(10000);
load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1);
@ -171,6 +162,8 @@ void main()
ExitProcess();
}
ESBYTE[0] = NULL;
if (param)
{
if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end
@ -304,7 +297,7 @@ void main()
{
if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
id = files.first;
files.first = -sc_slider_h / 2 + mouse.y -j -files.y * files.count;
files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count;
files.first /= files.h - 18;
if (files.visible+files.first>files.count) files.first=files.count-files.visible;
if (files.first<0) files.first=0;
@ -351,6 +344,10 @@ void main()
KillProcess(about_window);
SaveIniSettings();
ExitProcess();
case PATH_BTN:
notify(COPY_PATH_STR);
Clipboard__CopyText(#path);
break;
case 21: //Back
GoBack();
break;
@ -467,15 +464,11 @@ void main()
else Open(1);
break;
case 030: //Ctrl+A - select all files
for (i=0; i<files.count; i++) setElementSelectedFlag(i, true);
List_ReDraw();
DrawStatusBar();
EventSelectAllFiles(true);
break;
case 022: //Ctrl+U - unselect all files
for (i=0; i<files.count; i++) setElementSelectedFlag(i, false);
selected_count = 0;
List_ReDraw();
DrawStatusBar();
EventSelectAllFiles(false);
break;
}
break;
@ -494,7 +487,7 @@ void main()
if (!two_panels.checked) break;
if (active_panel==1) active_panel=2; else active_panel=1;
ChangeActivePanel();
DrawStatusBar();
DrawFilePanels();
break;
case 093: //menu
menu_call_mouse=0;
@ -515,17 +508,7 @@ void main()
FnProcess(key_scancode-58);
break;
default:
for (i=files.cur_y+1; i<files.count; i++)
{
strcpy(#temp, file_mas[i]*304+buf+72);
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
{
files.cur_y = i - 1;
files.KeyDown();
List_ReDraw();
break;
}
}
EventSelectFileByKeyPress();
}
break;
case evIPC:
@ -553,49 +536,9 @@ void main()
}
break;
default:
ReadDir(19, devbuf, "/"); // get disk
if(countDisk != EBX) // if different then
{
countDisk = EBX;
FnProcess(5);
if (Form.status_window>2) break;
EventRefreshDisksAndFolders();
}
else // get current files
{
if(two_panels.checked)
{
// this add code update list files
update_files_list = false;
//strcpy(#inactive_path,#path);
ReadDir(19, devbuf, #inactive_path);
if(countPathFile != EBX) // if different then
{
countPathFile = EBX;
update_files_list = true;
}
//strcpy(#active_path,#path);
ReadDir(19, devbuf, #active_path);
if(countPathFile2 != EBX) // if different then
{
countPathFile2 = EBX;
update_files_list = true;
}
if(update_files_list) DrawFilePanels();
}
else
{
ReadDir(19, devbuf, #path);
if(countPathFile != EBX) // if different then
{
countPathFile = EBX;
Open_Dir(#path,WITH_REDRAW);
}
}
}
}
if(cmd_free)
{
@ -613,11 +556,12 @@ void main()
void DrawFavButton(int x)
{
_PutImage(x,10,20,22,#fav);
DefineButton(x+1,11,20-2,22-3,61+BT_HIDE,NULL);
DefineHiddenButton(x+1,11,20-2,22-3,61);
}
void draw_window()
{
int i;
if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0);
GetProcessInfo(#Form, SelfInfo);
@ -627,11 +571,11 @@ void draw_window()
GetProcessInfo(#Form, SelfInfo); //if win_size changed
_PutImage(0,0,246,34,#toolbar);
DrawBar(127, 8, 1, 25, col_graph);
for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,NULL);
for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,NULL);
for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i);
for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, 21+i);
DrawBar(246,0, Form.cwidth - 246, 34, col_work);
_PutImage(Form.cwidth-17,11,6,18,#dots);
DefineButton(Form.cwidth-24,7,20,25,51+BT_HIDE+BT_NOFRAME,0); //dots
DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
//main rectangles
DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,col_graph);
DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg
@ -723,6 +667,7 @@ void DrawFilePanels()
void List_ReDraw()
{
int all_lines_h;
dword j;
static int old_cur_y, old_first;
files.CheckDoesValuesOkey(); //prevent some shit
@ -769,9 +714,10 @@ void Line_ReDraw(dword bgcol, filenum){
char label_file_name[4096];
if (filenum==-1) return;
DrawBar(files.x,y,4,files.item_h,bgcol);
DrawBar(files.x+20,y,files.w-20,files.item_h,bgcol);
DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol);
if (colored_lines.checked) && (bgcol!=col_selec) && (filenum%2) bgcol=0xF1F1F1;
DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
file_offet = file_mas[filenum+files.first]*304 + buf+32;
attr = ESDWORD[file_offet];
@ -804,7 +750,7 @@ void Line_ReDraw(dword bgcol, filenum){
DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol);
if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
if (bgcol!=0xFFFfff)
if (bgcol==col_selec)
{
itdir = TestBit(attr, 4);
strcpy(#file_name, file_name_off);
@ -883,7 +829,9 @@ void Open_Dir(dword dir_path, redraw){
inline Sorting()
{
dword k=0, l=1;
int j=0;
dword file_off;
if (!strcmp(#path,"/")) //do not sort root folder
{
for(k=1;k<files.count;k++;) file_mas[k]=k;
@ -908,8 +856,8 @@ inline Sorting()
//sorting: files first, then folders
Sort_by_Name(0,k-1);
if (sort_num==1) Sort_by_Name(k,files.count-1);
if (sort_num==2) Sort_by_Type(k,files.count-1);
if (sort_num==3) Sort_by_Size(k,files.count-1);
else if (sort_num==2) Sort_by_Type(k,files.count-1);
else if (sort_num==3) Sort_by_Size(k,files.count-1);
//make ".." first item in list
if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0)
for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]><file_mas[0]; break;}
@ -965,13 +913,13 @@ void SelectFileByName(dword that_file)
void Dir_Up()
{
int iii;
char old_folder_name[4096];
i=strlen(#path)-1;
if (i==0) return;
//path[i]=0x00;
i = strrchr(#path, '/');
strcpy(#old_folder_name, #path+i);
if (i>1) path[i-1]=NULL; else path[i]=NULL;
iii=strlen(#path)-1;
if (iii==0) return;
iii = strrchr(#path, '/');
strcpy(#old_folder_name, #path+iii);
if (iii>1) path[iii-1]=NULL; else path[iii]=NULL;
SelectFileByName(#old_folder_name);
}
@ -1188,5 +1136,59 @@ void ChangeActivePanel()
DrawFilePanels();
}
void EventSelectAllFiles(dword state)
{
int i;
for (i=0; i<files.count; i++) setElementSelectedFlag(i, state);
List_ReDraw();
DrawStatusBar();
}
void EventSelectFileByKeyPress()
{
int i;
for (i=files.cur_y+1; i<files.count; i++)
{
strcpy(#temp, file_mas[i]*304+buf+72);
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
{
files.cur_y = i - 1;
files.KeyDown();
List_ReDraw();
return;
}
}
}
int GetRealFileCountInFolder(dword folder_path)
{
int fcount;
dword countbuf;
GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT);
if (countbuf) free(countbuf);
return fcount;
}
void EventRefreshDisksAndFolders()
{
if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) {
FnProcess(5);
}
if(two_panels.checked)
{
if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) {
ChangeActivePanel();
Open_Dir(#path,WITH_REDRAW);
ChangeActivePanel();
}
if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW);
}
else
{
if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW);
}
}
stop:

View File

@ -5,6 +5,7 @@ void DrawPathBar()
PathShow.area_size_x = Form.cwidth-300;
DrawBar(PathShow.start_x-3, PathShow.start_y-6, PathShow.area_size_x+3, 19, 0xFFFfff);
DrawRectangle(PathShow.start_x-4,PathShow.start_y-7,PathShow.area_size_x+4,20,col_graph);
DefineHiddenButton(PathShow.start_x-4+1,PathShow.start_y-7+1,PathShow.area_size_x+4-2,20-2,PATH_BTN);
DrawBar(PathShow.start_x-4, PathShow.start_y+14, PathShow.area_size_x+4, 1, MixColors(col_work,0xFFFfff,120));
DrawFavButton(PathShow.start_x+PathShow.area_size_x);
PathShow_prepare stdcall(#PathShow);
@ -65,7 +66,7 @@ void DrawBreadcrumbButton(dword x,y,w,h,id,text)
int i;
DrawRectangle(x,y,w,h,col_graph);
for (i=0; i<h-1; i++) DrawBar(x+1, y+i+1, w-1, 1, col_palette_br[i]);
DefineButton(x+1,y+1,w-2,h-2,id+BT_HIDE,0xEFEBEF);
DefineHiddenButton(x+1,y+1,w-2,h-2,id);
WriteText(-strlen(text)*8+w/2+x,h/2+y-7,0x90,0x444444,text);
DrawBar(x, y+h+1, w+1, 1, MixColors(col_work,0xFFFfff,120));
}

View File

@ -28,6 +28,7 @@ void Copy(dword pcth, char cut)
dword path_len = 0;
dword size_buf = 0;
dword copy_buf_offset = 0;
dword i;
if (files.count<=0) return; //no files

View File

@ -40,7 +40,8 @@
struct _SystemDiscs
{
collection list;
byte Get();
int dev_num;
void Get();
void Draw();
void Click();
} SystemDiscs;
@ -88,26 +89,19 @@ void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
strcpy(disc_name, T_UNC);
}
}
dword __countSysDiscs = 0;
byte _SystemDiscs::Get()
void _SystemDiscs::Get()
{
byte ret = 0;
char dev_name[10], sys_discs[10];
int i1, j1, dev_num, dev_disc_num;
dword temp_file_count, tempbuf;
int i1, j1, dev_num_i, dev_disc_num;
dword devbuf;
list.drop();
devbuf = malloc(10000);
ReadDir(19, devbuf, "/");
dev_num = EBX;
IF (dev_num != __countSysDiscs)
{
__countSysDiscs = dev_num;
ret = 0xFF;
}
ELSE ret = 0;
for (i1=0; i1<dev_num; i1++)
dev_num = dev_num_i = EBX;
for (i1=0; i1<dev_num_i; i1++)
{
sprintf(#dev_name,"/%s",i1*304+ devbuf+72);
Open_Dir(#dev_name, ONLY_OPEN);
@ -119,13 +113,13 @@ byte _SystemDiscs::Get()
}
if (!strcmp(#sys_discs, "/rd/1"))
{
GetDir(#tempbuf, #temp_file_count, "/kolibrios", DIRS_ONLYREAL);
if (temp_file_count) list.add("/kolibrios");
free(tempbuf);
if (dir_exists("/kolibrios")) {
list.add("/kolibrios");
dev_num++;
}
}
}
free(devbuf);
return ret;
}
void _SystemDiscs::Draw()
@ -214,6 +208,7 @@ void Tip(int y, dword caption, id, arrow)
void ActionsDraw()
{
int i;
int actions_y= SystemDiscs.list.count*16+108, lineh=16;
Tip(actions_y-18, T_ACTIONS, 77, ""); //çàãîëîâîê
for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)

View File

@ -89,6 +89,7 @@ void SetPropertiesDir(dword way)
void SetProperties(byte prop)
{
dword cur_file;
dword i;
if (prop==1) || (prop==2)
{
@ -146,6 +147,7 @@ void ShowConfirmQuestionPopin()
void GetSizeMoreFiles(dword way)
{
char cur_file[4096];
dword i;
for (i=0; i<files.count; i++)
{

View File

@ -8,6 +8,7 @@
?define SHOW_BREADCRUMBS "ˆá¯®«ì§®¢ âì 'å«¥¡­ë¥ ªà®èª¨'"
?define BIG_ICONS "ˆá¯®«ì§®¢ âì ¡®«ì訥 ¨ª®­ª¨"
?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
?define COLORED_LINES "<EFBFBD>®¤á¢¥ç¨¢ âì ç¥â­ë¥ «¨­¨¨ ¢ ᯨ᪥"
?define FONT_SIZE_LABEL "<EFBFBD> §¬¥à èà¨äâ "
?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
?define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
@ -23,6 +24,7 @@
?define SHOW_BREADCRUMBS "Show breadcrumbs"
?define BIG_ICONS "Big icons in list"
?define USE_TWO_PANELS "Two panels"
?define COLORED_LINES "Highlight even lines in list"
?define FONT_SIZE_LABEL "Font size"
?define LIST_LINE_HEIGHT "List line height"
?define SAVE_PATH_AS_DEFAULT "Current path"
@ -44,6 +46,7 @@ checkbox info_after_copy = { NOTIFY_COPY_END };
checkbox show_breadcrumb = { SHOW_BREADCRUMBS };
checkbox big_icons = { BIG_ICONS };
checkbox two_panels = { USE_TWO_PANELS };
checkbox colored_lines = { COLORED_LINES };
void settings_dialog()
@ -88,6 +91,7 @@ void settings_dialog()
two_panels.click(id);
show_breadcrumb.click(id);
show_status_bar.click(id);
colored_lines.click(id);
if (font_size.click(id)) {
kfont.size.pt = font_size.value;
kfont.changeSIZE();
@ -108,7 +112,7 @@ void settings_dialog()
case evReDraw:
DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400,
410+skin_height,0x34,system.color.work,TITLE_SETT,0);
435+skin_height,0x34,system.color.work,TITLE_SETT,0);
GetProcessInfo(#Settings, SelfInfo);
DrawSettingsCheckBoxes();
}
@ -135,6 +139,7 @@ void DrawSettingsCheckBoxes()
show_breadcrumb.draw(x, y.inc(25));
big_icons.draw(x, y.inc(25));
two_panels.draw(x, y.inc(25));
colored_lines.draw(x, y.inc(25));
font_size.draw(x, y.inc(31));
line_height.draw(x, y.inc(31));
@ -161,6 +166,7 @@ void LoadIniSettings()
info_after_copy.checked = ini.GetInt("InfoAfterCopy", false);
big_icons.checked = ini.GetInt("BigIcons", false); BigIconsSwitch();
two_panels.checked = ini.GetInt("TwoPanels", false);
colored_lines.checked = ini.GetInt("ColoredLines", false);
kfont.size.pt = ini.GetInt("FontSize", 13);
files.item_h = ini.GetInt("LineHeight", 19);
Form.left = ini.GetInt("WinX", 200);
@ -184,9 +190,10 @@ void SaveIniSettings()
ini.SetInt("ShowStatusBar", show_status_bar.checked);
ini.SetInt("RealFileNamesCase", show_real_names.checked);
ini.SetInt("InfoAfterCopy", info_after_copy.checked);
ini.SetInt("FontSize", kfont.size.pt);
ini.SetInt("BigIcons", big_icons.checked);
ini.SetInt("TwoPanels", two_panels.checked);
ini.SetInt("ColoredLines", colored_lines.checked);
ini.SetInt("FontSize", kfont.size.pt);
ini.SetInt("LineHeight", files.item_h);
ini.SetInt("WinX", Form.left);
ini.SetInt("WinY", Form.top);

View File

@ -1,6 +1,7 @@
void Sort_by_Size(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{
int j;
int iss = a;
if (a >= b) return;
for (j = a; j <= b; j++)
@ -12,6 +13,7 @@ void Sort_by_Size(int a, b) //
void Sort_by_Name(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{
int j;
int isn = a;
if (a >= b) return;
for (j = a; j <= b; j++)
@ -23,6 +25,7 @@ void Sort_by_Name(int a, b) //
void Sort_by_Type(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
{
int j;
dword filename1, filename2, ext1, ext2;
int n, isn = a;
if (a >= b) return;

View File

@ -1,5 +1,5 @@
#define TITLE "Eolite File Manager v3.94"
#define ABOUT_TITLE "EOLITE 3.94"
#define TITLE "Eolite File Manager v3.96b"
#define ABOUT_TITLE "EOLITE 3.96b"
#ifdef LANG_RUS
?define T_FILE "” ©«"
@ -30,6 +30,7 @@
?define DEL_MORE_FILES_1 "¢ë¡à ­­ë¥ í«¥¬¥­âë ("
?define DEL_MORE_FILES_2 " èâ.)?"
?define STATUS_STR "<EFBFBD>«¥¬¥­â®¢: %d <20> ¯®ª: %d ” ©«®¢: %d ‚뤥«¥­­®: %d"
?define COPY_PATH_STR "'<27>ãâì ¯ ¯ª¨ ᪮¯¨à®¢ ­ ¢ ¡ãä¥à ®¡¬¥­ ' -I"
#else
?define T_FILE "File"
?define T_TYPE "Type"
@ -60,4 +61,5 @@
?define DEL_MORE_FILES_1 "selected items("
?define DEL_MORE_FILES_2 " pcs.)?"
?define STATUS_STR "Elements: %d Dirs: %d Files: %d Selected: %d"
?define COPY_PATH_STR "'Directory path copied to clipboard' -I"
#endif

View File

@ -1,4 +1,4 @@
#define MAX_CELL_SIZE 128
#define MAX_CELL_SIZE 256
//////////////////////////////////////////////////////////////////////////////////////
// //

View File

@ -9,10 +9,11 @@ cls
@del lang.h--
if exist iconedit (
"C:\Program Files\WinImage\winimage.exe" "D:\Soft\Kolibri\QEMU\kolibri.img" /H /Q /I iconedit
"C:\Program Files (x86)\WinImage\winimage.exe" "C:\Users\Leency\Desktop\kolibri.img" /H /Q /I iconedit
d:
cd "D:\Soft\Kolibri\QEMU"
call "D:\Soft\Kolibri\QEMU\qemu-kos-img.bat"
cd "D:\Kolibri\Infrastructure\QEMU"
call "z_kos.bat"
) else (
@pause
)

View File

@ -9,10 +9,10 @@ cls
@del lang.h--
if exist iconedit (
"C:\Program Files\WinImage\winimage.exe" "D:\Soft\Kolibri\QEMU\kolibri.img" /H /Q /I iconedit
"C:\Program Files (x86)\WinImage\winimage.exe" "C:\Users\Leency\Desktop\kolibri.img" /H /Q /I iconedit
d:
cd "D:\Soft\Kolibri\QEMU"
call "D:\Soft\Kolibri\QEMU\qemu-kos-img.bat"
cd "D:\Kolibri\Infrastructure\QEMU"
call "z_kos.bat"
) else (
@pause
)

View File

@ -31,9 +31,9 @@
#ifdef LANG_RUS
#define T_NOTIFY_OPEN "'IconEdit
¤ ­­ë© ¬®¬¥­â IconEdit ¬®¦¥â ®âªà뢠âì ⮫쪮 ¨ª®­ª¨, ᮧ¤ ­­ë¥ ¢ á ¬®¬ । ªâ®à¥.
᫨ ­ã¦­® ®âªàëâì ¤à㣮¥ ¨§®¡à ¦¥­¨¥, ¢®á¯®«ì§ã©â¥áì ¨­áâà㬥­â®¬ <®â® ¯¯ à â>
¤«ï § å¢ â  ª à⨭ª¨ á íªà ­ .' -Wt"
¤ ­­ë© ¬®¬¥­â IconEdit ¬®¦¥â ®âªà뢠âì ⮫쪮 ¨ª®­ª¨, ᮧ¤ ­­ë¥ ¢ á ¬®¬ । ªâ®à¥.
᫨ ­ã¦­® ®âªàëâì ¤à㣮¥ ¨§®¡à ¦¥­¨¥, ¢®á¯®«ì§ã©â¥áì ¨­áâà㬥­â®¬ <®â® ¯¯ à â>
¤«ï § å¢ â  ª à⨭ª¨ á íªà ­ .' -Wt"
#else
#define T_NOTIFY_OPEN "'IconEdit
You can open only files created in IconEdit for now!
@ -41,7 +41,7 @@ In other case please use <Photo> tool to get an image from screen.' -Wt"
#endif
#define T_TITLE "Icon Editor 0.56 Alpha"
#define T_TITLE "Icon Editor 0.57b Alpha"
#define TOPBAR_H 24+8
#define LEFTBAR_W 16+5+5+3+3
@ -58,10 +58,13 @@ block canvas = { NULL, NULL, NULL, NULL };
block wrapper = { LEFTBAR_W, TOPBAR_H, NULL, NULL };
block right_bar = { NULL, 10+TOPBAR_H, RIGHT_BAR_W+10, NULL };
block b_color_gradient = {NULL, 40+TOPBAR_H, RIGHT_BAR_W, 30};
block b_last_colors = {NULL, 80+TOPBAR_H, RIGHT_BAR_W, COLSIZE*2};
block b_default_palette = {NULL, COLSIZE*2+10+80+TOPBAR_H, RIGHT_BAR_W, COLSIZE*9};
dword linear_gradient[RIGHT_BAR_W];
block b_color_gradient = {NULL, 40+TOPBAR_H, RIGHT_BAR_W, 25};
//block b_opacity_gradient = {NULL, 75+TOPBAR_H, RIGHT_BAR_W, 15};
block b_last_colors = {NULL, 75+TOPBAR_H, RIGHT_BAR_W, COLSIZE};
block b_default_palette = {NULL, COLSIZE+10+75+TOPBAR_H, RIGHT_BAR_W, COLSIZE*9};
dword transparent = 0xBFCAD2;
dword color1 = 0x000000;
dword color2 = 0xBFCAD2;
dword tool_color;
@ -103,6 +106,7 @@ enum {
proc_info Form;
dword semi_white;
bool bg_dark=false;
more_less_box zoom = { 11, 1, 40, "Zoom" };
@ -120,10 +124,11 @@ dword default_palette[] = {
0xCC99FF,0xFF99FF,0xFF99CC,0xE0E0E0,0xFFCCCC,0xFFE5CC,0xFFFFCC,0xE5FFCC,0xCCFFCC,0xCCFFE5,
0xCCFFFF,0xCCE5FF,0xCCCCFF,0xE5CCFF,0xFFCCFF,0xFFCCE5,0xFFFFFF
};
dword last_used_colors[13*2] = {
#define LAST_USED_MAX 13
dword last_used_colors[LAST_USED_MAX] = {
0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,
0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,
0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF,0xFFFFFF
0xFFFFFF,0xFFFFFF,0xFFFFFF
};
CustomCursor Cursor;
@ -157,6 +162,7 @@ void main()
{
word btn;
libimg_image open_image;
dword tmp_bg_col;
load_dll(libio, #libio_init, 1);
load_dll(libimg, #libimg_init, 1);
@ -166,6 +172,7 @@ void main()
Libimg_LoadImage(#left_icons, "/sys/icons16.png");
system.color.get();
semi_white = MixColors(system.color.work, 0xFFFfff, 96);
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
@ -173,6 +180,12 @@ void main()
Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffFFFfff, system.color.work);
Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffCACBD6, MixColors(system.color.work, 0, 200));
//fix line and rectandle color for dark skins
if (GrayScaleImage(#system.color.work,1,1)<65) bg_dark=true; else bg_dark=false;
if (bg_dark) Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xff545454, 0xffD3D3D4);
EventSetActiveColor(1, color1);
if (!param[0]) {
image.create(32, 32);
}
@ -185,7 +198,7 @@ void main()
ExitProcess();
}
else {
image.create(open_image.w, open_image.h);
image.create(open_image.h, open_image.w);
image.set_image(open_image.imgsrc);
}
}
@ -257,8 +270,7 @@ void main()
EventCreateNewIcon();
break;
case BTN_OPEN:
notify(T_NOTIFY_OPEN);
RunProgram("/sys/lod", sprintf(#param, "*png* %s",#program_path));
EventOpenIcon();
break;
case BTN_SAVE:
EventSaveIconToFile();
@ -323,11 +335,26 @@ void main()
case evKey:
GetKeys();
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
{
switch(key_scancode)
{
case SCAN_CODE_KEY_S:
EventSaveIconToFile();
break;
case SCAN_CODE_KEY_O:
EventOpenIcon();
break;
}
}
if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
if (key_scancode == SCAN_CODE_DEL) EventCleanCanvas();
}
if (currentTool != TOOL_NONE) && (tools[currentTool].onKeyEvent != 0)
tools[currentTool].onKeyEvent(key_scancode);
if (key_scancode == SCAN_CODE_DEL) EventCleanCanvas();
if (key_scancode == SCAN_CODE_KEY_P) setCurrentTool(TOOL_PENCIL);
if (key_scancode == SCAN_CODE_KEY_I) setCurrentTool(TOOL_PIPETTE);
if (key_scancode == SCAN_CODE_KEY_F) setCurrentTool(TOOL_FILL);
@ -470,6 +497,7 @@ void DrawEditArea()
canvas.h = image.rows * zoom.value;
if (canvas.w+2 > wrapper.w) || (canvas.h+2 > wrapper.h) {
zoom.value--;
if (zoom.x) zoom.redraw();
DrawEditArea();
return;
}
@ -507,37 +535,59 @@ void DrawActiveColor(dword iny)
if (iny != NULL) outy = iny;
DrawFrame(right_bar.x, outy, CELL, CELL, NULL);
DrawBar(right_bar.x+2, outy+2, CELL-4, CELL-4, color1);
sprintf(#param, "%A", color1);
WriteTextWithBg(right_bar.x+30, outy+3, 0xD0, system.color.work_text, #param+4, system.color.work);
DrawFrame(right_bar.x+110, outy, CELL, CELL, NULL);
DrawBar(right_bar.x+110+2, outy+2, CELL-4, CELL-4, color2);
sprintf(#param, "%A", color2);
WriteTextWithBg(right_bar.x+30+110, outy+3, 0xD0, system.color.work_text, #param+4, system.color.work);
DrawCurrentColorGradientByLightness();
DrawFrame(right_bar.x+CELL+5, outy, CELL, CELL, NULL);
DrawBar(right_bar.x+CELL+5+2, outy+2, CELL-4, CELL-4, color2);
//sprintf(#param, "%A", color1);
//WriteTextWithBg(right_bar.x+30, outy+3, 0xD0, system.color.work_text, #param+4, system.color.work);
DrawCurrentColorGradient();
}
void DrawCurrentColorGradientByLightness()
int lmax;
void GenerateCurrentColorGradient()
{
int i, avg, rmax;
rgb.DwordToRgb(color1);
avg = 255 - calc(rgb.r + rgb.g + rgb.b / 3);
lmax = b_color_gradient.w *avg/255 | 1;
rmax = b_color_gradient.w - lmax | 1;
if (lmax == 0) lmax=1;
if (rmax == 0) rmax=1;
for (i=0; i<lmax; i++) {
linear_gradient[i] = MixColors(color1,0xFFFfff,255*i/lmax);
}
for (i=0 ; i<=rmax; i++) {
linear_gradient[lmax+rmax - i] = MixColors(color1,0x000000,255*i/rmax);
}
}
void DrawCurrentColorGradient()
{
int i;
int w = right_bar.w-10/2;
for (i=0; i<w; i++)
DrawBar(b_color_gradient.x+i, b_color_gradient.y,
1, b_color_gradient.h, MixColors(color1,0xFFFfff,255*i/w));
dword hitch_color=system.color.work;
int hitch_x = b_color_gradient.x+lmax-1;
if (lmax>b_color_gradient.w-2) hitch_x=b_color_gradient.x+b_color_gradient.w-3;
for (i=0 ; i<b_color_gradient.w; i++) {
DrawBar(b_color_gradient.x+i, b_color_gradient.y, 1, b_color_gradient.h, linear_gradient[i]);
}
//current color marker
DrawBar(b_color_gradient.x+i-1, b_color_gradient.y-2, 3,2, 0x000000);
DrawBar( b_color_gradient.x-1, b_color_gradient.y-2, b_color_gradient.w+4, 2, system.color.work);
for (i=0 ; i<=w; i++)
DrawBar(b_color_gradient.x+w+w-i, b_color_gradient.y,
1, b_color_gradient.h, MixColors(color1,0x000000,255*i/w));
if (bg_dark) hitch_color=0xFFFfff; else hitch_color=0;
DrawBar(hitch_x, b_color_gradient.y-2, 3,2, hitch_color);
}
void DrawColorPallets()
{
int r, c, i=0;
//Last used colors
for (r = 0; r < 2; r++)
for (r = 0; r < LAST_USED_MAX/PAL_ITEMS_X_COUNT; r++)
{
for (c = 0; c < PAL_ITEMS_X_COUNT; c++, i++)
{
@ -611,6 +661,10 @@ void DrawImageWithBg(dword _x, _y, _col_to)
void ShowWindow_TestIcon()
{
if (image.rows>=preview_size) || (image.columns>=preview_size) {
notify("'IconEdit\nImage is too big for preview!' -tE");
return;
}
loop() switch(WaitEvent())
{
case evButton:
@ -645,6 +699,12 @@ void EventCreateNewIcon()
Window_CanvasReSize.create();
}
void EventOpenIcon()
{
//notify(T_NOTIFY_OPEN);
RunProgram("/sys/lod", sprintf(#param, "*png* %s",#program_path));
}
void EventSaveIconToFile()
{
int i=0;
@ -674,7 +734,8 @@ void EventExitIconEdit()
void EventSetActiveColor(int _number, _color)
{
int i;
for (i=13*2-1; i>0; i--) {
if (last_used_colors[0] == _color) return;
for (i=LAST_USED_MAX-1; i>0; i--) {
last_used_colors[i] = last_used_colors[i-1];
}
last_used_colors[0] = _color;
@ -682,6 +743,12 @@ void EventSetActiveColor(int _number, _color)
if (_number == 1) color1 = _color;
if (_number == 2) color2 = _color;
if (b_color_gradient.hovered()) {
lmax = mouse.x - b_color_gradient.x;
}
else {
GenerateCurrentColorGradient();
}
DrawActiveColor(NULL);
DrawColorPallets();
}

View File

@ -8,7 +8,7 @@ void PipetteTool_onKeyEvent() {
}
void PipetteTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area"
//if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area"
tool_color = GetPixelUnderMouse();
DrawBar(Form.cwidth-30, 5, 20, 20, tool_color);

View File

@ -209,6 +209,7 @@ void SelectTool_onKeyEvent(dword keycode) {
dword r, c;
if (SCAN_CODE_DEL == keycode) {
DrawBarIcon(selection.start_x, selection.start_y, selection.end_x, selection.end_y, color2, TOIMAGE);
selection.reset();
DrawCanvas();
}

View File

@ -1,32 +1,37 @@
#define MEMSIZE 0xA1000
#define MEMSIZE 4096*15
#include "..\lib\strings.h"
#include "..\lib\mem.h"
#include "..\lib\io.h"
#include "..\lib\copyf.h"
#include "..\lib\patterns\restart_process.h"
#include "..\lib\added_sysdir.c";
?define T_END "\'“áâ ­®¢ª  KolibriN ãᯥ譮 § ¢¥à襭 .\' -O"
?define T_LESS_RAM "Œ «® ᢮¡®¤­®© ®¯¥à â¨¢­®© ¯ ¬ïâ¨. Œ®£ãâ ¢®§­¨ª­ãâì ¯à®¡«¥¬ë"
//#include "..\lib\added_sysdir.c";
void main()
{
SetAdditionalSystemDirectory("kolibrios", abspath("install/kolibrios")+1);
io.run("/sys/media/kiv", "\\S__/kolibrios/res/Wallpapers/In the wind there is longing.png");
io.del("/sys/docpack");
copyf(abspath("install/sys"), "/sys");
RestartProcessByName("@icon", MULTIPLE);
RestartProcessByName("@taskbar", SINGLE);
RestartProcessByName("@docky", SINGLE);
notify(T_END);
io.run("/sys/tmpdisk", "a0s10");
//SetAdditionalSystemDirectory("kolibrios", abspath("install/kolibrios")+1);
io.run("/sys/tmpdisk", "a0");
pause(50);
copyf(abspath("install/tmp"), "/tmp0/1");
io.del("/sys/docpack");
copyf(abspath("rd"), "/sys");
copyf(abspath("kos"), "/kolibrios");
copyf(abspath("tmp"), "/tmp0/1");
KillProcessByName("@icon", MULTIPLE);
KillProcessByName("@taskbar", SINGLE);
KillProcessByName("@docky", SINGLE);
RunProgram("/sys/@icon", NULL);
RunProgram("/sys/@taskbar", NULL);
RunProgram("/sys/@docky", NULL);
io.run("/sys/media/kiv", "\\S__/kolibrios/res/Wallpapers/deink.png");
//notify("'KolibriNext\nInstall complete'-tO");
ExitProcess();
}
void Operation_Draw_Progress(dword filename) { return; }
void Operation_Draw_Progress(dword filename) { debug("copying: "); debugln(filename); }
stop:

View File

@ -8,33 +8,24 @@ void main()
{
dword dirbuf, fcount, filename, i;
dword dirbuf2, fcount2, filename2, j;
char cd_path[4096];
char drive_name[4096];
char install_path[4096];
signed int result;
pause(200);
GetDir(#dirbuf, #fcount, "/", DIRS_ONLYREAL);
for (i=0; i<fcount; i++)
{
filename = i*304+dirbuf+72;
if (!strstr(filename, "fd"))
{
strcpy(#cd_path, "/");
strcat(#cd_path, filename);
strcpy(#drive_name, "/");
strcat(#drive_name, i*304+dirbuf+72);
if (!strcmp(#drive_name, "/fd")) continue;
free(dirbuf2);
GetDir(#dirbuf2, #fcount2, #cd_path, DIRS_ONLYREAL);
GetDir(#dirbuf2, #fcount2, #drive_name, DIRS_ONLYREAL);
for (j=0; j<fcount2; j++)
{
filename2 = j*304+dirbuf2+72;
strcpy(#install_path, #cd_path);
strcat(#install_path, "/");
strcat(#install_path, filename2);
strcat(#install_path, "/installer.kex");
result = RunProgram(#install_path, NULL);
if (result>0) ExitProcess();
}
sprintf(#install_path, "%s/%s/installer.kex", #drive_name, j*304+dirbuf2+72);
if (RunProgram(#install_path, NULL) > 0) ExitProcess();
}
}
notify("'KolibriN\n<EFBFBD>¥ ¬®£ã ­ ©â¨ installer.kex ­¨ ¢ ®¤­®¬ ª®à­¥ ¤¨áª !\n<EFBFBD>®¯à®¡ã©â¥ ­ ©â¨ ¨ § ¯ãáâ¨âì ¥£® ¢àãç­ãî.' -dtE");

View File

@ -177,6 +177,13 @@
$int 0x40
}
inline fastcall void SetCurDir( ECX)
{
EAX=30;
EBX=1;
$int 0x40
}
//===================================================//
// //
// Misc //

View File

@ -193,7 +193,7 @@
PutShadow(x+1,y+h+3,w+1,1,skinned,1);
}
:void GrayScaleImage(dword color_image, w, h)
:dword GrayScaleImage(dword color_image, w, h)
{
dword i,gray,to,rr,gg,bb;
to = w*h*3 + color_image;
@ -208,6 +208,7 @@
gray = sqrt(gray) / 3;
DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray;
}
return gray;
}
:void ShadowImage(dword color_image, w, h, strength)

View File

@ -10,6 +10,10 @@
#define ASCII_KEY_INS 185
#define ASCII_KEY_SPACE 032
#define ASCII_KEY_PLUS 043
#define ASCII_KEY_MINUS 045
#define ASCII_KEY_EQU 061
#define ASCII_KEY_LEFT 176
#define ASCII_KEY_RIGHT 179
#define ASCII_KEY_DOWN 177

View File

@ -287,14 +287,6 @@ inline fastcall ExitProcess()
//------------------------------------------------------------------------------
inline fastcall void SetCurDir( ECX)
{
EAX=30;
EBX=1;
$int 0x40
}
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
#define SYS_LANG_ENG 1
#define SYS_LANG_FIN 2
@ -592,18 +584,20 @@ inline fastcall void PutPixel( EBX,ECX,EDX)
:void EventDragWindow()
{
proc_info Form1;
dword tmp_x,tmp_y;
dword z1,z2;
tmp_x = mouse.x;
tmp_y = mouse.y;
do {
GetProcessInfo(#Form1, SelfInfo);
mouse.get();
if (tmp_x!=mouse.x) || (tmp_y!=mouse.y)
{
z1 = Form.left + mouse.x - tmp_x;
z2 = Form.top + mouse.y - tmp_y;
if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form.width-10)z1=screen.width-Form.width;
if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form.height-10)z2=screen.height-Form.height;
z1 = Form1.left + mouse.x - tmp_x;
z2 = Form1.top + mouse.y - tmp_y;
if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form1.width-10)z1=screen.width-Form1.width;
if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form1.height-10)z2=screen.height-Form1.height;
MoveSize(z1 , z2, OLD, OLD);
draw_window();
}

View File

@ -27,7 +27,8 @@
:struct MOUSE
{
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top;
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,left,top;
bool down,up,move,click,dblclick,drag;
dword handle,_;
byte cmd;
void get();
@ -187,8 +188,6 @@
vert = EBX;
}
:void MOUSE::slider()
{
signed _x,_y;

View File

@ -81,6 +81,29 @@ PathShow_prepare stdcall(#PathShow);
PathShow_draw stdcall(#PathShow);
*/
//editbox flags
#define ed_pass 1b
#define ed_focus 10b //focused
#define ed_shift 100b //flag is set when Shift is pressed
#define ed_shift_on 1000b
#define ed_shift_bac 10000b //bif for Shift reset, if set the smth is selected
#define ed_left_fl 100000b
#define ed_offset_fl 1000000b
#define ed_insert 10000000b
#define ed_mouse_on 100000000b
#define ed_mous_adn_b 100011000b
#define ed_always_focus 100000000000000b
#define ed_figure_only 1000000000000000b //symbols only
#define ed_shift_cl 1111111111100011b
#define ed_shift_mcl 1111111111111011b
#define ed_shift_off 1111111111111011b
#define ed_shift_on_off 1111111111110111b
#define ed_shift_bac_cl 1111111111101111b
#define ed_right_fl 1111111111011111b
#define ed_offset_cl 1111111110111111b
#define ed_insert_cl 1111111101111111b
#define ed_mouse_on_off 1111111011111111b
struct edit_box{
dword width,
left,

View File

@ -164,7 +164,7 @@ int check_is_the_adress_local(dword _in)
if(!strncmp(_in,"sys/",4)) return true;
if(!strncmp(_in,"tmp/",4)) return true;
if(!strncmp(_in,"usbhd",5)) return true;
if(!strncmp(_in,"kolibrios",10)) return true;
if(!strncmp(_in,"kolibrios",9)) return true;
return false;
}

View File

@ -32,10 +32,14 @@
return _r + _g + _b;
}
:dword MixColors(dword _base, _overlying, byte a)
:dword MixColors(dword _base, _overlying, dword a)
{
_rgb rgb1, rgb2, rgb_final;
byte n_a;
dword n_a;
if (a<0) || (a>255) {
debug("Wrong alpha param in MixColors()!");
debugval("alpha", a);
}
rgb1.DwordToRgb(_base);
rgb2.DwordToRgb(_overlying);

View File

@ -1,11 +1,10 @@
#define LINES_COUNT 13
#define MAX_LINE_CHARS 256
#define CHBOX 12
#define CHECKBOX_ID 50
unsigned char checkbox[sizeof(file "checkbox.raw")]= FROM "checkbox.raw";
#define COL_BG_ACTIVE 0xFFE56B
#define COL_BG_ACTIVE 0xFFF0A9
#define COL_BG_INACTIVE 0xFFFFFF
//===================================================//
@ -18,16 +17,23 @@ struct NOTE_LINE
{
bool state;
char data[MAX_LINE_CHARS];
void Delete();
};
void NOTE_LINE::Delete()
{
state=false;
data[0]=' ';
data[1]=NULL;
}
//===================================================//
// //
// LIST //
// //
//===================================================//
struct NOTES {
llist list;
struct NOTES : llist {
char txt_path[4096];
char txt_data[MAX_LINE_CHARS*LINES_COUNT];
@ -36,7 +42,7 @@ struct NOTES {
char edit_active;
int OpenTxt();
int SaveTxt();
void DeleteCurrentNode();
void DeleteNode();
void DrawList();
dword DrawLine(int line_n, draw_h);
} notes;
@ -71,7 +77,12 @@ int NOTES::OpenTxt(dword file_path)
linepos++;
i++;
}
list.count = item_n;
while (item_n < LINES_COUNT)
{
//lines[item_n].Delete();
item_n++;
}
count = LINES_COUNT;
return 1;
}
}
@ -81,7 +92,7 @@ int NOTES::SaveTxt()
int i;
dword tm;
strcpy(#txt_data, "notes");
for (i=0; i<=list.count; i++)
for (i=0; i<=count; i++)
{
if (lines[i].state==false) strcat(#txt_data, "\n- "); else strcat(#txt_data, "\n+ ");
tm = #lines[i].data;
@ -90,15 +101,10 @@ int NOTES::SaveTxt()
WriteFile(0, strlen(#txt_data), #txt_data, #txt_path);
}
void NOTES::DeleteCurrentNode()
{
return;
}
void NOTES::DrawList()
{
int i;
for (i=0; i<list.visible; i++) DrawLine(i, list.item_h);
for (i=0; i<visible; i++) DrawLine(i, item_h);
}
@ -109,24 +115,26 @@ dword NOTES::DrawLine(int line_n, draw_h) {
cur_text;
char line_text[4096];
if (line_n<0) return;
if (line_n==list.cur_y) COL_BG = COL_BG_ACTIVE; else COL_BG = COL_BG_INACTIVE;
DrawBar(list.x, line_n*list.item_h+list.y, RED_LINE_X, draw_h-1, COL_BG_INACTIVE);
DrawBar(list.x+RED_LINE_X+1, line_n*list.item_h+list.y, list.w-RED_LINE_X-1, draw_h-1, COL_BG);
x = 1;
if (line_n==cur_y) COL_BG = COL_BG_ACTIVE; else COL_BG = COL_BG_INACTIVE;
DrawBar(x, line_n*item_h+y, RED_LINE_X, draw_h-1, COL_BG_INACTIVE);
DrawBar(x+RED_LINE_X+1, line_n*item_h+y, w-RED_LINE_X-1, draw_h-1, COL_BG);
cur_text = #lines[line_n].data;
if (draw_h!=list.item_h)
if (draw_h!=item_h)
{
COL_BOTTOM_LINE=COL_BG;
}
else
{
DefineButton(RED_LINE_X-CHBOX/2+list.x, list.item_h*line_n+5+list.y, CHBOX-1,CHBOX-1, CHECKBOX_ID+line_n+BT_HIDE, 0); //checkbox
_PutImage(RED_LINE_X-CHBOX/2+list.x, list.item_h*line_n+5+list.y, CHBOX,CHBOX, lines[line_n].state*CHBOX*CHBOX*3+#checkbox);
if (cur_text) WriteText(list.x+RED_LINE_X+6, list.item_h*line_n+7+list.y, 0x80, lines[line_n].state*0x777777, cur_text);
if (lines[line_n].state == true) DrawBar(list.x+RED_LINE_X+6, list.item_h*line_n+11+list.y, strlen(cur_text)*6, 1, 0x444444); //strike
DefineButton(RED_LINE_X-CHBOX/2+x, item_h*line_n+5+y, CHBOX-1,CHBOX-1, CHECKBOX_ID+line_n+BT_HIDE, 0); //checkbox
_PutImage(RED_LINE_X-CHBOX/2+x, item_h*line_n+5+y, CHBOX,CHBOX, lines[line_n].state*CHBOX*CHBOX*3+#checkbox);
if (cur_text) WriteText(x+RED_LINE_X+6, item_h*line_n+7+y, 0x80, lines[line_n].state*0x777777, cur_text);
if (lines[line_n].state == true) DrawBar(x+RED_LINE_X+6, item_h*line_n+11+y, strlen(cur_text)*6, 1, 0x444444); //strike
}
DrawBar(list.x, line_n*list.item_h+draw_h-1+list.y, list.w, 1, COL_BOTTOM_LINE);
DrawBar(list.x+RED_LINE_X, line_n*list.item_h+list.y, 1, draw_h, COL_RED_LINE);
DrawBar(x, line_n*item_h+draw_h-1+y, w, 1, COL_BOTTOM_LINE);
DrawBar(x+RED_LINE_X, line_n*item_h+y, 1, draw_h, COL_RED_LINE);
x = RED_LINE_X;
return cur_text;
}

Binary file not shown.

View File

@ -1,4 +1,4 @@
// Notes v0.7 ALPHA
// Notes v0.8 ALPHA
#define MEMSIZE 0xDAE80
#include "..\lib\kolibri.h"
@ -22,11 +22,9 @@
#include "lang.h--"
#endif
#define LANG_RUS
#ifdef LANG_RUS
?define WINDOW_CAPTION "‡ ¬¥âª¨"
?define DELETE_TEXT "Udoli";
?define DELETE_TEXT "“¤ «¨âì";
#else
?define WINDOW_CAPTION "Notes and reminders"
?define DELETE_TEXT "Delete";
@ -38,36 +36,30 @@ unsigned char edge[sizeof(file "edge.raw")]= FROM "edge.raw"; //292x6
#define EDGE_H 6
#define TITLE_H 24
#define HEADER_HEIGHT TITLE_H+EDGE_H
#define LINES_COUNT 13
#define WIN_W 270
#define WIN_H RED_LINE_X*LINES_COUNT+HEADER_HEIGHT+4
#define DELETE_BTN 4;
#define DELETE_W sizeof(DELETE_TEXT)+2*6
#include "engine.h"
dword editbox_text;
proc_info Form;
edit_box edit_box= {0,999,0,COL_BG_ACTIVE,0x94AECE,COL_BG_ACTIVE,0xffffff,0,MAX_LINE_CHARS-1,#editbox_text,#mouse,100000000000010b};
dword ed_mouse;
edit_box notebox = {0,999,0,COL_BG_ACTIVE,0x94AECE,COL_BG_ACTIVE,0xffffff,0,
MAX_LINE_CHARS-1,NULL,#ed_mouse,ed_always_focus+ed_focus};
dword lists[] = { 0xEAEAEA, 0xCDCDCD, 0xF0F0F0, 0xD8D8D8, 0 };
bool delete_active = false;
block delBtn;
//===================================================//
// //
// CODE //
// //
//===================================================//
struct KDelete {
char width;
char active;
void Draw();
} DeleteBtn;
void KDelete::Draw(dword x, y, h)
{
width = strlen(DELETE_TEXT)+2*6;
x -= width+1;
DefineButton(x, y, width, h-1, DELETE_BTN, 0xFF0000);
WriteText(x+6+1, h/2-4+y, 0x80, 0xFFFfff, DELETE_TEXT);
}
void main()
{
int btn;
@ -75,50 +67,72 @@ void main()
load_dll(boxlib, #box_lib_init,0);
if (param) notes.OpenTxt(#param); else notes.OpenTxt(abspath("notes.txt"));
notes.list.cur_y = -1;
notes.cur_y = -1;
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
SetEventMask(0x27);
loop() switch(WaitEvent())
{
case evMouse:
edit_box_mouse stdcall (#notebox);
mouse.get();
if (notes.list.MouseOver(mouse.x, mouse.y)) {
notes.list.ProcessMouse(mouse.x, mouse.y);
if (mouse.lkm) EventSelectItem();
if (mouse.pkm) EventDrawDeleteButton();
if (delete_active) && (delBtn.hovered()) break;
if (mouse.lkm) && (mouse.y<TITLE_H) && (mouse.x<WIN_W-39) EventDragWindow();
if (mouse.pkm)
&& (notes.MouseOver(mouse.x, mouse.y)) {
if (notes.ProcessMouse(mouse.x, mouse.y)) EventListRedraw();
EventDrawDeleteButton();
}
if (mouse.lkm) && (mouse.y<TITLE_H) && (mouse.x<Form.width-30) EventDragWindow();
if (mouse.key&MOUSE_LEFT)&&(mouse.up)
&& (notes.ProcessMouse(mouse.x, mouse.y)) {
EventListRedraw();
EventActivateLine(notes.cur_y);
}
if (notes.list.cur_y>=0) edit_box_mouse stdcall (#edit_box);
break;
case evButton:
btn = GetButtonID();
if (CLOSE_BTN == btn) EventExitApp();
if (DELETE_BTN == btn)
switch(btn)
{
notes.DeleteCurrentNode();
notes.DrawList();
DeleteBtn.active = 0;
case CLOSE_BTN:
EventExitApp();
break;
}
if (btn>=CHECKBOX_ID) //checkboxes
{
case DELETE_BTN:
EventDeleteCurrentNode();
break;
default:
notes.lines[btn-CHECKBOX_ID].state ^= 1;
notes.DrawList();
EventListRedraw();
break;
}
break;
case evKey:
GetKeys();
if (SCAN_CODE_ESC == key_scancode) EventExitApp();
if (SCAN_CODE_DOWN == key_scancode) { EventActivateLine(notes.list.cur_y+1); break; }
if (SCAN_CODE_UP == key_scancode) { EventActivateLine(notes.list.cur_y-1); break; }
if (notes.list.cur_y>=0) edit_box_key stdcall (#edit_box);
switch(key_scancode)
{
case SCAN_CODE_ESC:
EventExitApp();
break;
case SCAN_CODE_DOWN:
EventActivateLine(notes.cur_y+1);
break;
case SCAN_CODE_UP:
EventActivateLine(notes.cur_y-1);
break;
default:
if (notes.cur_y>=0) {
EAX = key_editbox;
edit_box_key stdcall (#notebox);
}
}
break;
case evReDraw:
@ -126,7 +140,6 @@ void main()
}
}
void DrawCloseButton(dword x,y,w,h)
{
DrawRectangle(x,y,w,h,0xC96832);
@ -139,33 +152,31 @@ void DrawCloseButton(dword x,y,w,h)
void draw_window()
{
int i;
notes.list.SetSizes(1, HEADER_HEIGHT, 270, RED_LINE_X*LINES_COUNT, RED_LINE_X);
DefineAndDrawWindow(100,100,notes.list.w+1,notes.list.h+HEADER_HEIGHT+4,0x01,0,0,0x01fffFFF);
//DefineDragableWindow(100, 100, notes.list.w+1, notes.list.h+HEADER_HEIGHT+4);
GetProcessInfo(#Form, SelfInfo);
DrawRectangle3D(0,0,Form.width,TITLE_H-1,0xBB6535, 0xCD6F3B);
DrawRectangle3D(1,1,Form.width-2,TITLE_H-3,0xEFBFA4, 0xDD8452);
DrawBar(2,2,Form.width-3,TITLE_H-4,0xE08C5E);
DefineUnDragableWindow(100,100,WIN_W, WIN_H);
notes.SetSizes(RED_LINE_X+1, HEADER_HEIGHT, WIN_W-1, RED_LINE_X*LINES_COUNT, RED_LINE_X);
DrawRectangle3D(0,0,WIN_W,TITLE_H-1,0xBB6535, 0xCD6F3B);
DrawRectangle3D(1,1,WIN_W-2,TITLE_H-3,0xEFBFA4, 0xDD8452);
DrawBar(2,2,WIN_W-3,TITLE_H-4,0xE08C5E);
WriteText(9,TITLE_H/2-6,0x90,0xA9613A,WINDOW_CAPTION);
WriteTextB(7,TITLE_H/2-7,0x90,0xFFFfff,WINDOW_CAPTION);
_PutImage(1, TITLE_H, 292,EDGE_H, #edge);
PutPixel(notes.list.x+RED_LINE_X, notes.list.y-1, COL_RED_LINE);
PutPixel(notes.x+RED_LINE_X, notes.y-1, COL_RED_LINE);
ECX-=1; $int 0x40;
DrawCloseButton(Form.width-23,4,16,16);
DrawRectangle(0,TITLE_H,Form.width,Form.height-HEADER_HEIGHT+EDGE_H,0xBBBBBB);
for (i=0; lists[i]!=0; i++) DrawBar(1,Form.height-i-1, Form.width-1, 1, lists[i]);
edit_box.width = notes.list.w-RED_LINE_X-8;
edit_box.left = notes.list.x+RED_LINE_X+4;
notes.DrawList();
DrawCloseButton(WIN_W-23,4,16,16);
DrawRectangle(0,TITLE_H,WIN_W,WIN_H-HEADER_HEIGHT+EDGE_H,0xBBBBBB);
for (i=0; lists[i]!=0; i++) DrawBar(1,WIN_H-i-1, WIN_W-1, 1, lists[i]);
EventListRedraw();
}
void DrawEditBox_Notes()
void DrawEditBoxN()
{
edit_box.pos = edit_box.offset = edit_box.shift = 0;
edit_box.size = strlen(edit_box.text);
edit_box.top = notes.list.cur_y*notes.list.item_h+4+notes.list.y;
edit_box_draw stdcall(#edit_box);
notebox.width = notes.w-notes.x-8;
notebox.left = notes.x+5;
notebox.pos = notebox.offset = notebox.shift = notebox.shift_old = 0;
notebox.cl_curs_x = notebox.cl_curs_y = 0;
notebox.size = strlen(notebox.text);
notebox.top = notes.cur_y*notes.item_h+4+notes.y;
edit_box_draw stdcall(#notebox);
}
//===================================================//
@ -176,17 +187,13 @@ void DrawEditBox_Notes()
void EventActivateLine(int line_n)
{
int old;
if (line_n<0) || (line_n>notes.list.count) return;
DeleteBtn.active = 0;
//redraw lines
notes.list.cur_y = line_n;
edit_box.text = notes.DrawLine(notes.list.cur_y, notes.list.item_h);
notes.DrawList();
DrawEditBox_Notes();
if (line_n<0) || (line_n>notes.count) return;
notes.cur_y = line_n;
notebox.text = notes.DrawLine(notes.cur_y, notes.item_h);
EventListRedraw();
DrawEditBoxN();
}
void EventExitApp()
{
notes.SaveTxt();
@ -195,19 +202,25 @@ void EventExitApp()
void EventDrawDeleteButton()
{
notes.DrawLine(notes.list.cur_y, notes.list.item_h);
DeleteBtn.Draw(notes.list.x+notes.list.w, notes.list.cur_y*notes.list.item_h+notes.list.y, notes.list.item_h);
edit_box.top=-20;
DeleteBtn.active = 1;
notes.DrawLine(notes.cur_y, notes.item_h);
delBtn.set_size(WIN_W-DELETE_W-1, notes.cur_y*notes.item_h+notes.y, DELETE_W, notes.item_h-1);
DefineButton(delBtn.x, delBtn.y, delBtn.w, delBtn.h, DELETE_BTN, 0xFF0000);
WriteText(delBtn.x+10, delBtn.h/2-3 + delBtn.y, 0x80, 0xFFFfff, DELETE_TEXT);
notebox.top=-20;
delete_active = true;
}
void EventSelectItem()
void EventDeleteCurrentNode()
{
int id;
id = mouse.y-notes.list.y/notes.list.item_h;
if (DeleteBtn.active) && (mouse.x>notes.list.x+notes.list.w-DeleteBtn.width) return;
if (id!=notes.list.cur_y) && (id<notes.list.count) EventActivateLine(id);
else { notes.list.cur_y=-1; notes.DrawList(); }
notes.lines[notes.cur_y].Delete();
EventListRedraw();
}
void EventListRedraw()
{
delete_active = false;
DeleteButton(DELETE_BTN);
notes.DrawList();
}
stop:

View File

@ -1,5 +1,5 @@
@del sysmon.kex
@del sysmon
@c-- sysmon.c
@rename *.com *.kex
@rename sysmon.com sysmon
@del warning.txt
@pause

View File

@ -1,6 +1,6 @@
/*
* System Monitor
* version 0.86
* version 0.87
* Author: Leency
*/
@ -21,9 +21,10 @@
//===================================================//
#define MIN_PB_BLOCK_W 19
#define LOAD_BG 0xFFFfff
#define LOAD_ACTIVE 0x6C81DC
#define LOAD_BG_TEXT 0x696969
#define LOAD_CPU 0x2460C8
#define PROGRESS_ACTIVE 0x489FE4
#define PROGRESS_BG 0xFFFfff
#define PROGRESS_BG_TEXT 0x696969
struct sensor {
int x,y,w,h;
@ -52,13 +53,18 @@ void sensor::draw_progress(dword progress_w, active_value, bg_value, mesure)
if (progress_w < MIN_PB_BLOCK_W) progress_w = MIN_PB_BLOCK_W;
if (progress_w > w-MIN_PB_BLOCK_W) progress_w = w-MIN_PB_BLOCK_W;
DrawBar(x, y, w-progress_w, h, LOAD_ACTIVE);
sprintf(#param, "%i%s", active_value, mesure);
WriteText(w-progress_w- calc(strlen(#param)*8) /2 + x, h/2-7+y, 0x90, LOAD_BG, #param);
DrawBar(x+w-progress_w, y, progress_w, h, LOAD_BG);
DrawBar(x, y, w-progress_w, 1, MixColors(PROGRESS_ACTIVE, PROGRESS_BG, 200));
DrawBar(x, y+1, w-progress_w, h-2, PROGRESS_ACTIVE);
DrawBar(x, y+h-1, w-progress_w, 1, MixColors(PROGRESS_ACTIVE, system.color.work_graph, 200));
sprintf(#param, "%i%s", active_value, mesure);
WriteText(w-progress_w- calc(strlen(#param)*8) /2 + x, h/2-7+y, 0x90, PROGRESS_BG, #param);
DrawBar(x+w-progress_w, y, progress_w, h, PROGRESS_BG);
sprintf(#param, "%i%s", bg_value, mesure);
WriteText(-progress_w - calc(strlen(#param)*8)/2 + w+x, h/2-7+y, 0x90, LOAD_BG_TEXT, #param);
WriteText(-progress_w - calc(strlen(#param)*8)/2 + w+x, h/2-7+y, 0x90, PROGRESS_BG_TEXT, #param);
}
//===================================================//
@ -232,10 +238,10 @@ void MonitorCpu()
WriteText(cpu.x+cpu.w-calc(strlen(#param)*8), cpu.y-25, 0x90, system.color.work_text, #param);
for (i=0; i<CPU_STACK; i+=2) {
DrawBar(i+cpu.x, cpu.y, 1, cpu.h-cpu_stack[i], LOAD_BG);
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, 1, cpu_stack[i], LOAD_ACTIVE);
DrawBar(i+cpu.x, cpu.y, 1, cpu.h-cpu_stack[i], PROGRESS_BG);
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, 1, cpu_stack[i], LOAD_CPU);
DrawBar(i+1+cpu.x, cpu.y, 1, cpu.h, LOAD_BG);
DrawBar(i+1+cpu.x, cpu.y, 1, cpu.h, PROGRESS_BG);
}
pos++;

View File

@ -13,6 +13,8 @@
?define INTRO_TEXT_3 "<EFBFBD>®¯à®¡ã©â¥ ¤®¡ ¢¨âì ®¤¨­..."
?define SIZE_TEXT "<EFBFBD> §¬¥à:"
?define NOTIFY_TEXT_NO_DISK "'„«ï ­ ç «  ¤®¡ ¢ì⥠å®âï ¡ë ®¤¨­ ¤¨áª' -W"
?define NOTIFY_SYSTEM_DISK0 "'„¨áª á ­®¬¥à®¬ 0 ï¥âáï á¨á⥬­ë¬ ¨ 㤠«ïâì ¥£® ­¥ ४®¬¥­¤ã¥âáï.
á«ãç ¥, ¥á«¨ ¢ë â®ç­® §­ ¥â¥, çâ® ¤¥« ¥â¥, 㤠«¨âì ¥£® ¬®¦­® á § ¦ â®© ª« ¢¨è¥© SHIFT.' -W"
?define NOTIFY_TEXT_DISK_LIMIT "'„®á⨣­ã⠯।¥« ª®«¨ç¥á⢠ ¢¨àâã «ì­ëå ¤¨áª®¢' -W"
?define FREE_RAM_TEXT "<EFBFBD> §¬¥à ᢮¡®¤­®© ®¯¥à â¨¢­®© ¯ ¬ïâ¨: "
@ -24,6 +26,8 @@
?define INTRO_TEXT_3 " Try to add one..."
?define SIZE_TEXT "Size:"
?define NOTIFY_TEXT_NO_DISK "'You need to have at least one disk' -W"
?define NOTIFY_SYSTEM_DISK0 "'Disc number 0 is a system disk. It is not recommended to delete it.
In case when you know what you are doing you can delete it with the SHIFT key pressed.' -W"
?define NOTIFY_TEXT_DISK_LIMIT "'Reached the limit of the number of virtual disks' -W"
?define FREE_RAM_TEXT "Free RAM size: "
#endif
@ -67,7 +71,10 @@ void Main_Window()
id=GetButtonID();
if (id==1) return;
if (id==10) AddDisk();
if (id==11) DelDisk();
if (id==11) {
GetKeys();
DelDisk();
}
if (id>=20)
{
if (selected==id-20) OpenTmpDisk();
@ -109,7 +116,7 @@ void Main_Window()
AddDisk();
break;
case SCAN_CODE_DEL:
if (disk_num<>0) DelDisk();
DelDisk();
break;
case SCAN_CODE_ENTER:
OpenTmpDisk();
@ -135,7 +142,7 @@ void Main_Window()
break;
case evReDraw:
system.color.get();
DefineAndDrawWindow(170,150,405,290,0x74,system.color.work,"Virtual Disk Manager 0.67",0);
DefineAndDrawWindow(170,150,405,290,0x74,system.color.work,"Virtual Disk Manager 0.67a",0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
@ -284,6 +291,11 @@ void DelDisk()
notify(NOTIFY_TEXT_NO_DISK);
return;
}
if (disk_list[selected].Item[3]=='0') && (! key_modifier & KEY_LSHIFT) && (! key_modifier & KEY_RSHIFT)
{
notify(NOTIFY_SYSTEM_DISK0);
return;
}
param[0]='d';
param[1]=disk_list[selected].Item[3];
err = byte Console_Work();