diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index e6cb6c5baa..0d2e183585 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -24,7 +24,7 @@ #include "../lib/obj/box_lib.h" #include "../lib/obj/libio.h" #include "../lib/obj/proc_lib.h" -//#include "../lib/obj/libini.h" +#include "../lib/obj/librasterworks.h" #include "../lib/patterns/simple_open_dialog.h" @@ -64,7 +64,8 @@ WebView FB2Read HexView"; -enum { +enum +{ MENU_ID_FILE=10, FILE_SUBMENU_ID_OPEN=10, FILE_SUBMENU_ID_CLOSE, @@ -87,7 +88,7 @@ int menu_encoding_x = NULL; int menu_reopen_x = NULL; /*======== MENU END ==========*/ -#define TITLE "Calypte v0.37" +#define TITLE "Calypte v0.38 dev" char win_title[4096] = TITLE; #define TOPPANELH 23 @@ -126,6 +127,7 @@ void main() //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) @@ -145,35 +147,53 @@ void main() case evMouse: mouse.get(); rows.wheel_size = 3; - if (rows.MouseScroll(mouse.vert)) { + if (rows.MouseScroll(mouse.vert)) + { DrawText(); - break; } break; case evButton: id=GetButtonID(); - if (id==1) ExitProcess(); + 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(); + if (key_scancode == SCAN_CODE_KEY_O) + { + EventOpenFile(); + } break; } - if (rows.ProcessKey(key_scancode)) DrawText(); + if (rows.ProcessKey(key_scancode)) + { + DrawText(); + } break; case evReDraw: - if (menu.list.cur_y) EventMenuClick(); + if (menu.list.cur_y) + { + EventMenuClick(); + } draw_window(); break; } @@ -212,7 +232,10 @@ void draw_window() rows.SetSizes(0, TOPPANELH, Form.cwidth - SCROLL_SIZE, Form.cheight - TOPPANELH - BOTPANELH, 20); rows.column_max = rows.w / rows.font_w; - if (bufpointer) Prepare(); + if (bufpointer) + { + Prepare(); + } rows.CheckDoesValuesOkey(); } DrawRectangle(rows.x+rows.w-1, rows.y, SCROLL_SIZE, rows.h-1, 0xEEEeee); @@ -230,19 +253,25 @@ void OpenFile(dword _path) { bufpointer = mem_Free(bufpointer); bufpointer = mem_Alloc(bufsize); - if (ReadFile(0, bufsize, bufpointer, #param) != 0) { + if (ReadFile(0, bufsize, bufpointer, #param) != 0) + { bufpointer = 0; notify("'Error opening file'-E"); return; } } - if (encoding!=CH_CP866) ChangeCharset(charsets[encoding], "CP866", bufpointer); + if (encoding!=CH_CP866) + { + ChangeCharset(charsets[encoding], "CP866", bufpointer); + } } -enum { +enum +{ PARSE_CALCULATE_ROWS_COUNT, PARSE_DRAW_PREPARE, }; + void Parse(int mode) { int pos=0; @@ -261,22 +290,40 @@ void Parse(int mode) do_eof = true; break; } - if (bukva==0x0a) break; - else len_str++; + if (bukva==0x0a) + { + break; + } + else + { + len_str++; + } } if (len_str<=rows.column_max) { - if (mode==PARSE_DRAW_PREPARE) s.addn(bufpointer+pos, len_str); + 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); + if (mode==PARSE_DRAW_PREPARE) + { + s.addn(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; + 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) @@ -295,17 +342,29 @@ void DrawText() { int i=0, top; - if (rows.countlang.h-- @del Calypte @@ -7,4 +6,4 @@ c-- Calypte.c @rename Calypte.com Calypte @del warning.txt @del lang.h-- -@pause \ No newline at end of file +@pause