From ae5398fe8a5bef2424355ce4bff58f7c0bfded92 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 29 May 2021 09:22:28 +0000 Subject: [PATCH] cmm: remove calypte and esyshot small optimisations git-svn-id: svn://kolibrios.org@8752 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/misc/Tupfile.lua | 1 - programs/cmm/misc/calypte.c | 484 ---------------------------------- programs/cmm/misc/easyshot.c | 19 +- 3 files changed, 8 insertions(+), 496 deletions(-) delete mode 100644 programs/cmm/misc/calypte.c diff --git a/programs/cmm/misc/Tupfile.lua b/programs/cmm/misc/Tupfile.lua index f68fcf1fbf..8cd25bbe67 100644 --- a/programs/cmm/misc/Tupfile.lua +++ b/programs/cmm/misc/Tupfile.lua @@ -4,7 +4,6 @@ then C_LANG = "LANG_RUS" else C_LANG = "LANG_ENG" -- this includes default case without config end tup.rule("easyshot.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "easyshot.com") -tup.rule("calypte.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "calypte.com") tup.rule("mblocks.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "mblocks.com") tup.rule("notify.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "notify.com") tup.rule("osupdate.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "osupdate.com") diff --git a/programs/cmm/misc/calypte.c b/programs/cmm/misc/calypte.c deleted file mode 100644 index 5487182015..0000000000 --- a/programs/cmm/misc/calypte.c +++ /dev/null @@ -1,484 +0,0 @@ -//Calypte 0.35 - Leency -//Calypte 0.15 - Punk Joker - -/* -TODO -- word wrap -- draw by line -- text selection -*/ - -#define MEMSIZE 1024*200 - -#ifndef AUTOBUILD - #include "lang.h--" -#endif - -//===================================================// -// // -// LIB // -// // -//===================================================// - -#include "../lib/kolibri.h" -#include "../lib/fs.h" -#include "../lib/gui.h" -#include "../lib/list_box.h" -#include "../lib/collection.h" - -#include "../lib/obj/iconv.h" -#include "../lib/obj/box_lib.h" -#include "../lib/obj/proc_lib.h" -#include "../lib/obj/librasterworks.h" - -#include "../lib/patterns/simple_open_dialog.h" - -//===================================================// -// // -// DATA // -// // -//===================================================// - -char default_dir[] = "/rd/1"; -od_filter filter2 = { 8, "TXT\0\0" }; - -/*========= MENU ==========*/ -?define MENU1 "File" -?define MENU2 "Encoding" -?define MENU3 "Reopen" - -char menu_file_list[] = -"Open|Ctrl+O -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 -}; - -int menu_file_x = 6; -int menu_encoding_x = NULL; -int menu_reopen_x = NULL; -/*======== MENU END ==========*/ - -#define TITLE "Calypte v0.38 dev" -char win_title[4096] = TITLE; - -#define TOPPANELH 23 -#define BOTPANELH 10 -#define WIN_W 750 -#define WIN_H 550 -#define SCROLL_SIZE 15 - -proc_info Form; -llist rows; - -int encoding; - -dword old_width,old_height; - -dword bufpointer; -dword bufsize; - -scroll_bar scroll_v = { SCROLL_SIZE,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; -scroll_bar scroll_h = { SCROLL_SIZE,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; - -collection s=0; - -//===================================================// -// // -// CODE // -// // -//===================================================// - -void main() -{ - int id; - - load_dll(boxlib, #box_lib_init, 0); - //load_dll(libini, #lib_init, 1); - load_dll(iconv_lib, #iconv_open, 0); - load_dll(Proc_lib, #OpenDialog_init,0); - load_dll(librasterworks, #rasterworks_drawText,0); - OpenDialog_init stdcall (#o_dialog); - - if (param) - { - draw_window(); - OpenFile(#param); - Prepare(); - DrawText(); - } - - SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); - - loop() - { - switch(WaitEvent()) - { - case evMouse: - mouse.get(); - rows.wheel_size = 3; - if (rows.MouseScroll(mouse.vert)) - { - DrawText(); - } - break; - - case evButton: - id=GetButtonID(); - if (id==1) - { - ExitProcess(); - } - if (id==MENU_ID_FILE) - { - EventShowMenu(menu_file_x, #menu_file_list, MENU_ID_FILE, NULL); - } - if (id==MENU_ID_ENCODING) - { - EventShowMenu(menu_encoding_x, #menu_encoding_list, MENU_ID_ENCODING, encoding+1); - } - if (id==MENU_ID_REOPEN) - { - EventShowMenu(menu_reopen_x, #menu_reopen_list, MENU_ID_REOPEN, NULL); - } - break; - - case evKey: - GetKeys(); - if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) - { - if (key_scancode == SCAN_CODE_KEY_O) - { - EventOpenFile(); - } - break; - } - if (rows.ProcessKey(key_scancode)) - { - DrawText(); - } - break; - - case evReDraw: - if (CheckActiveProcess(Form.ID)) EventMenuClick(); - draw_window(); - break; - } - } -} - -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(sc.work, sc.work_text, 70), text); - return textlen+padding+padding; -} - -void draw_window() -{ - sc.get(); - DefineAndDrawWindow(screen.width-WIN_W/2,screen.height-WIN_H/2,WIN_W,WIN_H,0x73,0xFFFFFF,#win_title,0); - GetProcessInfo(#Form, SelfInfo); - DrawBar(0, 0, Form.cwidth, TOPPANELH-1, sc.work); - DrawBar(0, TOPPANELH-1, Form.cwidth, 1, sc.work_dark); - DrawBar(0, Form.cheight-BOTPANELH, Form.cwidth, BOTPANELH, sc.work); - - 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; - - rows.no_selection = true; - rows.SetFont(8, 14, 0x90); - rows.SetSizes(0, TOPPANELH, Form.cwidth - SCROLL_SIZE, Form.cheight - TOPPANELH - BOTPANELH, 20); - rows.column_max = rows.w / rows.font_w; - - if (bufpointer) - { - Prepare(); - } - rows.CheckDoesValuesOkey(); - } - DrawRectangle(rows.x+rows.w-1, rows.y, SCROLL_SIZE, rows.h-1, 0xEEEeee); - DrawText(); -} - -void OpenFile(dword _path) -{ - strcpy(#param, _path); - sprintf(#win_title, "%s - %s", TITLE, #param); - rows.KeyHome(); - read_file(#param, #bufpointer, #bufsize); - if (!EAX) - { - bufpointer = 0; - notify("'Error opening file'-E"); - return; - } - if (encoding!=CH_CP866) - { - ChangeCharset(encoding, "CP866", 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) - { - s.addn(bufpointer+pos, len_str); - } - pos += len_str+1; - } - else - { - if (mode==PARSE_DRAW_PREPARE) - { - s.addn(bufpointer+pos, rows.column_max); - } - pos += rows.column_max; - } - sub_pos++; - if (mode==PARSE_CALCULATE_ROWS_COUNT) && (do_eof) - { - break; - } - if (mode==PARSE_DRAW_PREPARE) && (pos>=bufsize-1) - { - break; - } - len_str = 0; - } - if (mode == PARSE_CALCULATE_ROWS_COUNT) - { - rows.count = sub_pos; - Parse(PARSE_DRAW_PREPARE); - } -} - -void Prepare() -{ - Parse(PARSE_CALCULATE_ROWS_COUNT); -} - -void DrawText() -{ - int i=0, top; - - if (rows.count>= 16; if (SCAN_CODE_ENTER == AL) EventTakeScreenshot(); @@ -142,8 +140,7 @@ void EventChooseSavePath() { OpenDialog_start stdcall (#open_folder_dialog); if (open_folder_dialog.status) { - strcpy(#save_path, open_folder_dialog.opendir_path); - EditBox_UpdateText(#edit_save, 0); + edit_box_set_text stdcall (#edit_save, #save_path); } } @@ -151,7 +148,7 @@ void EventChooseSavePath() void EventClickSettings() { show_settings ^= 1; - MoveSize(OLD, OLD, show_settings*75 + 270, + @MoveSize(OLD, OLD, show_settings*75 + 270, show_settings*110 + skin_height + PD+PD+30); }