From 8bd9dd2363e7e5fedc0898c1b5c1e9dd0be4eb76 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 4 Oct 2018 20:08:44 +0000 Subject: [PATCH] Notes: pre final version MouseCfg: optimized version (thans, Lev) RtfRead: fix hotkeys git-svn-id: svn://kolibrios.org@7434 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/mousecfg/mouse_image.png | Bin 1175 -> 1262 bytes programs/cmm/mousecfg/mouse_image.raw | Bin 71508 -> 5959 bytes programs/cmm/mousecfg/mousecfg.c | 96 ++++++++++++---------- programs/cmm/notes/engine.h | 7 +- programs/cmm/notes/{ => img}/checkbox.png | Bin programs/cmm/notes/{ => img}/checkbox.raw | Bin programs/cmm/notes/{ => img}/edge.png | Bin programs/cmm/notes/{ => img}/edge.raw | 0 programs/cmm/notes/notes | Bin 0 -> 13751 bytes programs/cmm/notes/notes.c | 39 +++++++-- programs/cmm/template/template.c | 29 ++++++- programs/other/rtfread/trunk/bgifont.inc | 28 +++---- programs/other/rtfread/trunk/rtfread.asm | 60 ++++++-------- 13 files changed, 153 insertions(+), 106 deletions(-) rename programs/cmm/notes/{ => img}/checkbox.png (100%) rename programs/cmm/notes/{ => img}/checkbox.raw (100%) rename programs/cmm/notes/{ => img}/edge.png (100%) rename programs/cmm/notes/{ => img}/edge.raw (100%) create mode 100644 programs/cmm/notes/notes diff --git a/programs/cmm/mousecfg/mouse_image.png b/programs/cmm/mousecfg/mouse_image.png index e7efa10c4711bf86cc99e19fccd12c2284165373..93f872cc8bd7dafef7abf479d1bf923fa48e11b2 100644 GIT binary patch literal 1262 zcmeAS@N?(olHy`uVBq!ia0vp^)}k9B!j%Yyj$o zfK-NJ1_mYuh6E0dML-g$k%2(~O!9ygFtQ{%FfjaOVBlHJwS$3y@BjBai1^z?hqpNg z7#JLZ1_EV4CNs6XeLDka*IU60tGPR%f*=u~`HWy)K$FGaG93YP>%kT=h%<1%Wl8`m zZUCxzTN1IF`@-A04#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v9vvnFfHtk+fXXnp0dW^S#9i!e?n{6MW-p{Pf z_~(eV4hD+Sw)vf7)~wLx8x|h2QDyUNy~@HvHWmvS>z}c(SpQ`kC;Re5)5MW`_BGqs zZK2pmoG@j}-)@DSFNcc-rF|*ve7ch*PMEN9xi;&z<$vmbvCw7VV3ERb!{YzSi;bRo zThi9|+PTrVTi33LolJpM61LAgvddt-oUhg@LhN zTDJOICVwb=E?Y7g5r%WwB?}VZ)04IgN`TK#sj{!r%9k4pe=WP_b?0L~?mS1|qaRtEG^5)mv8o*R%TZzB=jW>QhK%Ddy^{yRO;y%+(+7*d{KYtH0ds zCHY)^<4!Tj=jxkxYtp%T91G^^(Y6J1^`V7@bM@`KRW?^20@Af$u08~$Yr$MSa$7B$ ztH*B1C3E$N70uNL~iJ&(-6WpMR^TEOU)8C~O``8U%CoL1mlYIcCiYZN6dQ zAscU4|8<-0ThLhlj7|J({O?(MHa-#mNqfg~bM*;tnVqXAEIU`9h|{&K-m-ej>Mg6c ztlqME%jzwwx2)c>dduqncvf$F;0Uw&&->FH$`fSu?`eHncOYz5|9&$V&+0#meSf2E z<5~Sm+viMY^^|4y!1<7t-UElW^d2~@C9-5 j)mv6?S^Xc#>i+?|U|v4t-MJ(H015yANkvXXu0mjfjgn)W diff --git a/programs/cmm/mousecfg/mouse_image.raw b/programs/cmm/mousecfg/mouse_image.raw index 7364c87329fa36b7b95f796102762d07f6e9f7f0..23d9992dc161e3de29220657cd9f92298b06cfa1 100644 GIT binary patch literal 5959 zcmeI0;cmkq41`14_5B}tJ_ExhHkh!fnpA!yP2lsLO(0Q^b zZN?gDK29cQtVIsd=UJXG)9x6ptSLG}xm3331kJLx=wG7b*zr44h2ss>Np-H8j{B(R zH=z0#Xpyy64puEKJy(_X2xq-AIY!M5CUY~@4_fOqoSaXY-d`qfoA6$e#WCjfKcVzt zaM$oVQNP6QcE}$=lz*4W7H)xiaPm2oE~EMgMd!X2={hI zk?bl8r}$o@)2ic&-bfZkp$c@(F%uPCb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zIi^VRvx2L9ta;1N1RRec{lF%|gNz!sk2Cb}6mq_B)!O3jjTdLpPt>aftDXq3##-_WHfeEG z<#;d!tg@VuW2e;CK$V&b{`l>GfAX`x;W#x)$r38atbA3N3V>=q%h*AkYiUWom3hs3 z+yXkm%By&4kCZI+uDk(Se3U;M2(Jy6MJ96>Sj(B^RDR2;o@HPZr;IIg#tbMs@B^?j zz*5pOt5b5#2K#_P(i$Tv?^cBctoJj!Q+MeZ)=Yh5u0b~j-qf0c~~0#acSwn4^+%VS#%_Fy5;0@kzRYDMTj?}{rw5b{=G zq%H64+Q5N&I0fMGik=93(iOMrMHGG<@JUyU4IK3F6M@gT;?}@a7&gA$h%>;q7;#`^ zuH96pMm-BS;)f}Pce^42tapj4*GsoYQ~Nuc?B?n=u_(SvL{^6i`$UcdOaX&=R<~e& zSI@SSv^=(FyFEKZ4$2Fj1z?N{iWX1nD${miT^2aL%vzD-^IF;|S77Z`%yC*|w!rb> zCCpRPwY2P+DuU#=QC;TjL|4G*Z{0rbnf-$|{;kotraL>J(%RFz746WeLV3(kZ8Noj6a#V{=a!irr RX9ZXJSo4;j2{`7F{twX8qF(?2 diff --git a/programs/cmm/mousecfg/mousecfg.c b/programs/cmm/mousecfg/mousecfg.c index ffe8a2df1e..84bc96d916 100644 --- a/programs/cmm/mousecfg/mousecfg.c +++ b/programs/cmm/mousecfg/mousecfg.c @@ -1,10 +1,11 @@ -// Mouse Configuration Utility ver 1.51 +// Mouse Configuration Utility ver 1.6 #ifndef AUTOBUILD #include "lang.h--" #endif -#define MEMSIZE 0x23E80 +#define MEMSIZE 4096*11 + #include "..\lib\strings.h" #include "..\lib\mem.h" #include "..\lib\fs.h" @@ -34,25 +35,18 @@ ?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad" ?define MADMOUSE "Through screen sides for pointer" #endif -proc_info Form; -block mouse_frame = { 18, 18, NULL, 130 }; -more_less_box pointer_speed = { NULL, 0, 64, POINTER_SPEED }; -more_less_box acceleration = { NULL, 0, 64, ACCELERATION_TEXT }; -more_less_box double_click_delay = { NULL, 0, 999, DOUBLE_CLICK_TEXT, 8 }; -checkbox emulation = { MOUSE_EMULATION, NULL }; -checkbox madmouse = { MADMOUSE, NULL }; - -unsigned char panels_img_data[] = FROM "mouse_image.raw"; -raw_image panels_img = { 59, 101, #panels_img_data }; +:block mouse_frame = { 18, 18, NULL, 130 }; +:more_less_box pointer_speed = { NULL, 0, 64, POINTER_SPEED }; +:more_less_box acceleration = { NULL, 0, 64, ACCELERATION_TEXT }; +:more_less_box double_click_delay = { NULL, 0, 999, DOUBLE_CLICK_TEXT, 8 }; +:checkbox emulation = { MOUSE_EMULATION, NULL }; +:checkbox madmouse = { MADMOUSE, NULL }; _ini ini = { "/sys/settings/system.ini", "mouse" }; -dword click_status; - - - void main() { + proc_info Form; int id; load_dll(libini, #lib_init,1); @@ -66,44 +60,36 @@ void main() { { case evMouse: mouse.get(); - if (mouse.down) && (click_status==0) && (mouse_frame.hovered()) { - if (mouse.key&MOUSE_LEFT) click_status = 1; - if (mouse.key&MOUSE_RIGHT) click_status = 2; - if (mouse.key&MOUSE_CENTER) click_status = 3; - DrawMouseImage(); - } - if (mouse.up) { - click_status=0; - DrawMouseImage(); - } + IF (mouse_frame.hovered()) DrawMouseImage(mouse.lkm,mouse.pkm,mouse.mkm, mouse.vert); + IF (mouse.up) DrawMouseImage(0,0,0,0); break; - case evButton: + CASE evButton: id = GetButtonID(); - if (1 == id) ExitApp(); - else if (pointer_speed.click(id)) ApplyCfg(); - else if (acceleration.click(id)) ApplyCfg(); - else if (double_click_delay.click(id)) ApplyCfg(); - else if (emulation.click(id)) { - if (emulation.checked == true) RunProgram("/sys/mousemul", 0); - else KillProcessByName("/sys/mousemul", SINGLE); + IF (1 == id) ExitApp(); + else IF (pointer_speed.click(id)) ApplyCfg(); + else IF (acceleration.click(id)) ApplyCfg(); + else IF (double_click_delay.click(id)) ApplyCfg(); + ELSE IF (emulation.click(id)) { + IF (emulation.checked == true) RunProgram("/sys/mousemul", 0); + ELSE KillProcessByName("/sys/mousemul", SINGLE); break; } - else if (madmouse.click(id)) { - if (madmouse.checked == true) RunProgram("/sys/madmouse", 0); - else KillProcessByName("/sys/madmouse", SINGLE); + ELSE IF (madmouse.click(id)) { + IF (madmouse.checked == true) RunProgram("/sys/madmouse", 0); + ELSE KillProcessByName("/sys/madmouse", SINGLE); break; } break; case evKey: GetKeys(); - if (key_scancode == SCAN_CODE_ESC) ExitApp(); + IF (key_scancode == SCAN_CODE_ESC) ExitApp(); break; case evReDraw: system.color.get(); - DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0); + DefineAndDrawWindow(430, 150, 424, 313+skin_height,0x34,system.color.work,WINDOW_TITLE,0); GetProcessInfo(#Form, SelfInfo); if (Form.status_window>2) break; mouse_frame.w = - mouse_frame.x * 2 + Form.cwidth; @@ -111,15 +97,37 @@ void main() { mouse_frame.h, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image WriteText(mouse_frame.x + 110, mouse_frame.y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1); WriteText(mouse_frame.x + 110, mouse_frame.y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2); - DrawMouseImage(); + DrawMouseImage(0,0,0,0); DrawControls(); } } +:byte panels_img_data[] = FROM "mouse_image.raw"; -void DrawMouseImage() { - _PutImage(mouse_frame.x+30, mouse_frame.y + 15, panels_img.w, panels_img.h, - click_status * panels_img.w * panels_img.h * 3 + panels_img.data); +#define red 0xff0000 +#define yellow 0xfff600 +#define white 0xffffff +#define dgrey 0x2d353d + +:struct IMG_PAL{ dword back, shad1, mbody, left, right, middle, white; } + pal = { 0xF0F2F3,0xABB0B2, dgrey, white, white, dgrey, white }; + +void DrawMouseImage(dword l,r,m,v) { + #define IMG_W 59 + #define IMG_H 101 + + IF (l) pal.left = red; + IF (m) pal.middle = red; + IF (r) pal.right = red; + IF (v) pal.middle = yellow; + + PutPaletteImage(#panels_img_data,IMG_W,IMG_H,18+30,18+15,8,#pal); + pal.left = pal.right = white; + pal.middle = dgrey; + if (v) { + pause(10); + DrawMouseImage(0,0,0,0); + } } void DrawControls() { @@ -153,4 +161,4 @@ void ApplyCfg() { SetMouseDoubleClickDelay(double_click_delay.value); } -stop: \ No newline at end of file +stop: diff --git a/programs/cmm/notes/engine.h b/programs/cmm/notes/engine.h index a26e034ad7..e7e9d1f01a 100644 --- a/programs/cmm/notes/engine.h +++ b/programs/cmm/notes/engine.h @@ -2,7 +2,7 @@ #define CHBOX 12 #define CHECKBOX_ID 50 -unsigned char checkbox[sizeof(file "checkbox.raw")]= FROM "checkbox.raw"; +unsigned char checkbox[sizeof(file "img/checkbox.raw")]= FROM "img/checkbox.raw"; #define COL_BG_ACTIVE 0xFFF0A9 #define COL_BG_INACTIVE 0xFFFFFF @@ -36,13 +36,13 @@ void NOTE_LINE::Delete() struct NOTES : llist { char txt_path[4096]; char txt_data[MAX_LINE_CHARS*LINES_COUNT]; + bool txt_file_exists; NOTE_LINE lines[LINES_COUNT]; char edit_active; int OpenTxt(); int SaveTxt(); - void DeleteNode(); void DrawList(); dword DrawLine(int line_n, draw_h); } notes; @@ -57,11 +57,13 @@ int NOTES::OpenTxt(dword file_path) ReadFile(0, 4096, #txt_data, #txt_path); if (!txt_data) || (strncmp(#txt_data, "notes", 5)!=0) { + txt_file_exists = false; notify("'Notes\nData file does not exists or is not valid' -tE"); return 0; } else { + txt_file_exists = true; i+=5; //skip "notes" indefinier while (txt_data[i]) { @@ -98,6 +100,7 @@ int NOTES::SaveTxt() tm = #lines[i].data; strcat(#txt_data, #lines[i].data); } + if (!txt_file_exists) CreateFile(0, 0, #txt_path); WriteFile(0, strlen(#txt_data), #txt_data, #txt_path); } diff --git a/programs/cmm/notes/checkbox.png b/programs/cmm/notes/img/checkbox.png similarity index 100% rename from programs/cmm/notes/checkbox.png rename to programs/cmm/notes/img/checkbox.png diff --git a/programs/cmm/notes/checkbox.raw b/programs/cmm/notes/img/checkbox.raw similarity index 100% rename from programs/cmm/notes/checkbox.raw rename to programs/cmm/notes/img/checkbox.raw diff --git a/programs/cmm/notes/edge.png b/programs/cmm/notes/img/edge.png similarity index 100% rename from programs/cmm/notes/edge.png rename to programs/cmm/notes/img/edge.png diff --git a/programs/cmm/notes/edge.raw b/programs/cmm/notes/img/edge.raw similarity index 100% rename from programs/cmm/notes/edge.raw rename to programs/cmm/notes/img/edge.raw diff --git a/programs/cmm/notes/notes b/programs/cmm/notes/notes new file mode 100644 index 0000000000000000000000000000000000000000..2e02e13ad5f5508c83b662ef8d04afca67aa5325 GIT binary patch literal 13751 zcmeI3e|S{Yna6L)Oc-J4jJpw2OKsK?P=k>l#Tu1%D$Eq0iXFAsD8(2{=ww9VCK=Ry z3b06#?OnAR;3czz-6mI59YMo*+P$Wp z(QLyoE7FXN_Hw$^lMEw54cq2;!?0gH-7xO$foQ+YD3IE4WcZv6pM{$0kWukCy6vaZ zRh?lNU1vAn+-#xvIu%qat?&PL%TbET1#^RP*^7pISaQ z@VS-G5Bc2B=MQ{(_`JwxH=hAMgROpELrX2##^9j#y84@sTwLE6Ypy?X*<9aJ+fsj1 zi?OJ_skxzXVQu|91EXpi7B;jP&EIZnT(IEUx~AGiwey)UrcaPQtdzqa4X?0)l?OP2m5p7@dZc;5 z|G`~9yzSPX|NHmu{>42%{h488Rr~0pkM!XGLVw`EfnB?Hz4FQ{fBMs(dV71Hdg`gw zsy+GSliRj!`$sI?zkmOWFTU8_-3=c7nl)?Qdh4x!1aPSA`|rR1&O7g9GMT-5_x|;- ze;vy3cT)xi298tqgAYC^;M}oe$J0+gtpoVshaVQq4!s27wbx!F^6S^H-?VAd@kHs+ zp+ldD3Z`B5_uhL$wI72*5MEc!i7ll|9-n{y`DdSf_K7E+*t&HqDL4iK zd3p2AH~*Il9>=K)tlF|=3)a$W3-Mz2?%jX>^PdSaJ!Mbv>nPy}A;Q$7MU{Xf`|`^# zvqsjgUAtk!23E(h<4I(QKk<9vg%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>aH_3f>0eA>$_F<77?3i&gXgf4tSVJhQ?Z< zatvm3`@9VN(P1@eP_}7t88;I(E?vL4bXa$&#>mKyV$Q#S&kQ~@`Cx)rrJlx=r3p?R zO3}H>uK1u`7Xwgag~lX9HaV|w z97~2K$b)l!V(VUEuL(X%RUXok|nQU_OO2t-g3@Ms0(f*|HM^7c<=!w8QrA@zF6&es~bmCKs4?*%8z9 z$7>Gs#Kx1C6^V^6F@^gjrf@K{f_rnk|$@VPI? zC}>WY{iJdquQJsg*8T$zCilv}5{aI`jnr$+;?8MJKhv~NNKXH%HNDEWYLv{L(Zl0^ za{AZg6xSj9iJY;-LVcc#diC}{C2h?et8PtWtXbvi)>LNAE?vL9Y~*ae)hg?`F95UJ z>*scs8y#{gUM-G4CN~I;ruHgXf-LbwEU_(rGsuAGw#Rd{ep9{89_^tKG^3tTy;#0SSA4SyAF3$dDd~q-#7@BY Oe)UTcL9D%6as4-rbIcR~ literal 0 HcmV?d00001 diff --git a/programs/cmm/notes/notes.c b/programs/cmm/notes/notes.c index 42f9718983..35f43e8aa1 100644 --- a/programs/cmm/notes/notes.c +++ b/programs/cmm/notes/notes.c @@ -1,4 +1,4 @@ -// Notes v0.8 ALPHA +// Notes v0.9 Beta #define MEMSIZE 0xDAE80 #include "..\lib\kolibri.h" @@ -32,7 +32,7 @@ #define RED_LINE_X 22 #define COL_RED_LINE 0xF3C9C9 -unsigned char edge[sizeof(file "edge.raw")]= FROM "edge.raw"; //292x6 +unsigned char edge[sizeof(file "img/edge.raw")]= FROM "img/edge.raw"; //292x6 #define EDGE_H 6 #define TITLE_H 24 #define HEADER_HEIGHT TITLE_H+EDGE_H @@ -47,7 +47,7 @@ unsigned char edge[sizeof(file "edge.raw")]= FROM "edge.raw"; //292x6 #include "engine.h" dword ed_mouse; -edit_box notebox = {0,999,0,COL_BG_ACTIVE,0x94AECE,COL_BG_ACTIVE,0xffffff,0, +edit_box notebox = {NULL,NULL,NULL,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 }; @@ -63,13 +63,14 @@ block delBtn; void main() { int btn; + bool first_redraw=true; dword cur_line_offset; load_dll(boxlib, #box_lib_init,0); if (param) notes.OpenTxt(#param); else notes.OpenTxt(abspath("notes.txt")); - notes.cur_y = -1; + //notes.cur_y = 0; - SetEventMask(0x27); + SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); loop() switch(WaitEvent()) { @@ -90,6 +91,7 @@ void main() if (mouse.key&MOUSE_LEFT)&&(mouse.up) && (notes.ProcessMouse(mouse.x, mouse.y)) { + notebox.pos = mouse.x - notebox.left / 6; EventListRedraw(); EventActivateLine(notes.cur_y); } @@ -107,14 +109,21 @@ void main() EventDeleteCurrentNode(); break; default: - notes.lines[btn-CHECKBOX_ID].state ^= 1; - EventListRedraw(); + EventCheckBoxClick(btn-CHECKBOX_ID); break; } break; case evKey: GetKeys(); + if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) + { + if (key_scancode == SCAN_CODE_SPACE) + { + EventCheckBoxClick(notes.cur_y); + } + break; + } switch(key_scancode) { case SCAN_CODE_ESC: @@ -137,6 +146,10 @@ void main() case evReDraw: draw_window(); + if (first_redraw) { + first_redraw = false; + EventActivateLine(0); + } } } @@ -172,9 +185,10 @@ void DrawEditBoxN() { notebox.width = notes.w-notes.x-8; notebox.left = notes.x+5; - notebox.pos = notebox.offset = notebox.shift = notebox.shift_old = 0; + notebox.offset = notebox.shift = notebox.shift_old = 0; notebox.cl_curs_x = notebox.cl_curs_y = 0; notebox.size = strlen(notebox.text); + if (notebox.pos > notebox.size) notebox.pos = notebox.size; notebox.top = notes.cur_y*notes.item_h+4+notes.y; edit_box_draw stdcall(#notebox); } @@ -212,7 +226,8 @@ void EventDrawDeleteButton() void EventDeleteCurrentNode() { - notes.lines[notes.cur_y].Delete(); + int t = notes.cur_y; + notes.lines[t].Delete(); EventListRedraw(); } @@ -223,4 +238,10 @@ void EventListRedraw() notes.DrawList(); } +void EventCheckBoxClick(int id) +{ + notes.lines[id].state ^= 1; + EventListRedraw(); +} + stop: diff --git a/programs/cmm/template/template.c b/programs/cmm/template/template.c index c7b128dc90..18a6661693 100644 --- a/programs/cmm/template/template.c +++ b/programs/cmm/template/template.c @@ -2,15 +2,36 @@ * Template C-- program. */ -#define MEMSIZE 4096*5 +#define MEMSIZE 4096*10 -#include "../lib/kolibri.h" -#include "../lib/fs.h" +#include "../lib/io.h" +#include "../lib/gui.h" proc_info Form; void main() { - RunProgram("/sys/syspanel", "/sys/settings/games.ini"); + word btn; + loop() switch(WaitEvent()) + { + case evButton: + btn = GetButtonID(); + if (btn == 1) ExitProcess(); + break; + + case evKey: + GetKeys(); + if (key_scancode == SCAN_CODE_ESC) ExitProcess(); + break; + + case evReDraw: + draw_window(); + break; + } } +void draw_window() +{ + DefineAndDrawWindow(215, 100, 350, 300, 0x34, 0xEEEeee, "Window title",0); + GetProcessInfo(#Form, SelfInfo); +} diff --git a/programs/other/rtfread/trunk/bgifont.inc b/programs/other/rtfread/trunk/bgifont.inc index bd1fba4644..41fafe258e 100644 --- a/programs/other/rtfread/trunk/bgifont.inc +++ b/programs/other/rtfread/trunk/bgifont.inc @@ -154,20 +154,20 @@ _BGIfont_Prepare: mov dword[.font],edx ; filename mov esi,edi ; esi->FontName mov [.dest],edi ; ptr to load font - mov eax, 70 - mov ebx, .fontattr - mcall - test eax, eax - ;jnz .fail - dps2 '1' - mov eax, [.fileattr+32] - mov [.fsize], litt_end-litt_file - mov ebx,.fontinfo - mov eax,70 - mcall ; ebx - file size - ;mov ebx, litt_end-litt_file - ;mov edi, litt_file - ;mov [.dest],litt_file ; ptr to load font + ; mov eax, 70 + ; mov ebx, .fontattr + ; mcall + ; test eax, eax + ; ;jnz .fail + ; dps2 '1' + ; mov eax, [.fileattr+32] + ;mov [.fsize], litt_end-litt_file + ;mov ebx,.fontinfo + ;mov eax,70 + ;mcall ; ebx - file size + mov ebx, litt_end-litt_file + mov edi, litt_file + mov [.dest],litt_file ; ptr to load font cmp dword[edi],0x08084b50 ; 'PK',8,8 jne .fail diff --git a/programs/other/rtfread/trunk/rtfread.asm b/programs/other/rtfread/trunk/rtfread.asm index 0c640b2631..d5a10007c2 100644 --- a/programs/other/rtfread/trunk/rtfread.asm +++ b/programs/other/rtfread/trunk/rtfread.asm @@ -163,8 +163,8 @@ key: ; mov dh,ah jmp key -.next: ;]Leency - cmp ah,104 ; HELP +.next: + cmp ah,'h' ; H - help jne .nohelp .help: mov [is_scroll_bar_needed], 0 @@ -192,15 +192,15 @@ key: ; ; je still ; jmp prep_load .nohelp2: - cmp ah,114 ; R - redraw + cmp ah,'r' ; R - redraw je red - cmp ah,99 ; C - color + cmp ah,'c' ; C - color jne .nocolor .color: xor [mode],RTF_COLORLESS jmp red .nocolor: - cmp ah,97 ; A - alignment + cmp ah,'a' ; A - alignment jne .noalign .alignment: xor [mode],RTF_ALIGNLESS @@ -212,12 +212,30 @@ key: ; dec [pitch] jmp red .nopd: - cmp ah,46 ; < - pitch inc + cmp ah,46 ; > - pitch inc jne .nopi .incp: inc [pitch] jmp red .nopi: + cmp ah,43 ;zoom+ + je .zplus + cmp ah,61 ;zoom= + jne .noplus + .zplus: + fld [FreeFontscale] + fmul [Zoomscale] + .zoom: + fstp [FreeFontscale] + jmp red + .noplus: + cmp ah,45 ;zoom- + jne .home + .zminus: + fld [FreeFontscale] + fdiv [Zoomscale] + jmp .zoom + .home: cmp ah,180 ; Home je top_red @@ -307,21 +325,7 @@ key: ; ; je still jmp red .noarup: - cmp ah,56 ;zoom+ - jne .noplus - .zplus: - fld [FreeFontscale] - fmul [Zoomscale] - .zoom: - fstp [FreeFontscale] - jmp red - .noplus: - cmp ah,54 ;zoom- - jne .nominus - .zminus: - fld [FreeFontscale] - fdiv [Zoomscale] - jmp .zoom + .nominus: cmp ah,0xB5 ; end jne .pre_file_open @@ -336,7 +340,7 @@ key: ; call Set_position jmp red .pre_file_open: - cmp ah,108 ; L - load + cmp ah,'l' ; L - load jne still .file_open: ;--------------------------------------------------------------------- @@ -351,16 +355,6 @@ key: ; cmp [OpenDialog_data.status],1 je prep_load jmp still -;--------------------------------------------------------------------- -;.sysxtree: -; or [mode],RTF_OPENING -; opendialog draw_window, prep_load, st_1, fname_buf -; st_1: -; and [mode],not RTF_OPENING -; jmp still;red -; stilld: -; jmp still -;--------------------------------------------------------------------- button: mcall 17 ; 17 - получить идентификатор нажатой кнопки @@ -744,7 +738,7 @@ end if ; интерфейс программы многоязычный ; Вы можете задать язык в MACROS.INC (lang fix язык) -window_title: db 'RtfRead v1.4',0 +window_title: db 'RtfRead v1.5',0 is_scroll_bar_needed dd 0x0 window_width dd 0x0 window_height dd 0x0