@icon: fixed by GerdtR

notes: final version
mouse: better hold wheel with other buttongs clicked

git-svn-id: svn://kolibrios.org@7437 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-10-05 22:10:27 +00:00
parent 66a0391246
commit 839dde62cc
12 changed files with 327 additions and 103 deletions

View File

@ -126,6 +126,7 @@ void main()
load_dll(libHTTP, #http_lib_init,1);
load_dll(iconv_lib, #iconv_open,0);
Libimg_LoadImage(#skin, "/sys/toolbar.png");
skin.h = 26;
wv_progress_bar.progress_color = 0x72B7EB;
CreateDir("/tmp0/1/downloads");
if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);

View File

@ -1,10 +1,10 @@
enum { TAG, OPTION_VALUE, TEXT, COMMENT };
enum { TAG, OPTION_VALUE, TEXT, COMMENT, INLINE_COMMENT, CODE };
//you are butifull, you are butifull
dword ShowSource()
{
dword new_buf, new_buf_start, i;
byte ww, mode;
int mode;
if (souce_mode) return;
souce_mode = true;
@ -15,8 +15,7 @@ dword ShowSource()
new_buf += strlen(new_buf);
for (i=bufpointer; i<bufpointer+bufsize; i++)
{
ww = ESBYTE[i];
switch (ww)
switch (ESBYTE[i])
{
case '<':
if (mode == COMMENT)
@ -86,7 +85,7 @@ dword ShowSource()
break;
}
default:
ESBYTE[new_buf] = ww;
ESBYTE[new_buf] = ESBYTE[i];
new_buf++;
}
}
@ -95,3 +94,124 @@ dword ShowSource()
free(bufpointer);
bufpointer = new_buf_start;
}
/*
char* C_HL_keywords[] = {
"switch", "if", "while", "for", "break", "continue", "return", "else",
"union", "typedef", "static", "class", "case", "#include",
"volatile", "register", "sizeof", "typedef", "union", "goto", "const", "auto",
"#define", "#endif", "#error", "#ifdef", "#ifndef", "#undef", "#if", "#else",
"inline",
"int ", "dword ", "long ", "double ", "float ", "char ", "unsigned ", "signed ",
"void ", "bool ", "enum ", "byte ", "word ", "struct ", "NULL", "loop", "stdcall ",
":void ", ":int ", ":bool ", ":dword ", NULL
};
dword ShowCodeSource()
{
dword new_buf, new_buf_start, i;
int mode = CODE;
char spstr[64];
dword keylen;
dword keyn;
dword keycolor;
new_buf = malloc(bufsize*10);
new_buf_start = new_buf;
sprintf(new_buf,"<html><head><title>C/C++/C-- source: %s</title><body><pre>",#URL);
new_buf += strlen(new_buf);
for (i=bufpointer; i<bufpointer+bufsize; i++)
{
if ('<' == ESBYTE[i]) {
strcpy(new_buf, "&lt;");
new_buf+=4;
continue;
}
if ('>' == ESBYTE[i]) {
strcpy(new_buf, "&gt;");
new_buf+=4;
continue;
}
if (ESBYTE[i] >= '0') && (ESBYTE[i] <= '9') && (CODE == mode) {
strcpy(new_buf, "<font color=#CF00FF>?</font>");
ESBYTE[new_buf+20] = ESBYTE[i];
new_buf+=28;
if (ESBYTE[i+1] == 'x') {
strcpy(new_buf, "<font color=#CF00FF>x</font>");
new_buf+=28;
i++;
}
continue;
}
if (CODE == mode) && ('\"' == ESBYTE[i]) {
mode = TEXT;
strcpy(new_buf, "<font color=#080>\"");
new_buf+=18;
continue;
}
if (TEXT == mode) && ('\"' == ESBYTE[i]) {
mode = CODE;
strcpy(new_buf, "\"</font>");
new_buf+=8;
continue;
}
if (! strncmp(i, "//", 2) ) && (mode == CODE) {
mode = INLINE_COMMENT;
strcpy(new_buf, "<font color=#777>//");
new_buf+=19;
i++;
continue;
}
if (INLINE_COMMENT == mode) {
if (13 == ESBYTE[i]) {
mode = CODE;
strcpy(new_buf, "\13</font>");
new_buf+=8;
continue;
}
}
if (! strncmp(i, "/*", 2) ) {
mode = COMMENT;
strcpy(new_buf, "<font color=#665>/*");
new_buf+=19;
i++;
continue;
}
if (! strncmp(i, "*/", 2) ) {
mode = CODE;
strcpy(new_buf, "*/</font>");
new_buf+=9;
i++;
continue;
}
if (CODE == mode) for (keyn=0; C_HL_keywords[keyn]!=NULL; keyn++)
{
keylen = strlen(C_HL_keywords[keyn]);
if (! strncmp(i, C_HL_keywords[keyn], keylen) ) {
if (keyn<31) keycolor="#f00"; else keycolor="#00f";
sprintf(#spstr, "<font color=%s>%s</font>", keycolor, C_HL_keywords[keyn]);
strcpy(new_buf, #spstr);
new_buf += keylen + 24;
i += keylen-1;
goto _CONTINUE;
}
}
ESBYTE[new_buf] = ESBYTE[i];
new_buf++;
_CONTINUE:
}
ESBYTE[new_buf] = 0;
bufsize = new_buf - new_buf_start;
free(bufpointer);
bufpointer = new_buf_start;
}
*/

View File

@ -1,4 +1,4 @@
// Mouse Configuration Utility ver 1.6
// Mouse Configuration Utility ver 1.61
#ifndef AUTOBUILD
#include "lang.h--"
@ -61,7 +61,7 @@ void main() {
case evMouse:
mouse.get();
IF (mouse_frame.hovered()) DrawMouseImage(mouse.lkm,mouse.pkm,mouse.mkm,mouse.vert);
IF (mouse.up) DrawMouseImage(0,0,0,0);
IF (mouse.click) DrawMouseImage(0,0,0,0);
break;
CASE evButton:
@ -109,7 +109,7 @@ void main() {
#define white 0xffffff
#define dgrey 0x2d353d
:struct IMG_PAL{ dword back, shad1, mbody, left, right, middle, white; }
:struct IMG_PAL{ dword back, shad1, contour, left, right, middle, mwhite; }
pal = { 0xF0F2F3,0xABB0B2, dgrey, white, white, dgrey, white };
void DrawMouseImage(dword l,r,m,v) {
@ -124,9 +124,9 @@ void DrawMouseImage(dword l,r,m,v) {
PutPaletteImage(#panels_img_data,IMG_W,IMG_H,18+30,18+15,8,#pal);
pal.left = pal.right = white;
pal.middle = dgrey;
if (v) {
IF (v) {
pause(10);
DrawMouseImage(0,0,0,0);
DrawMouseImage(l,r,m,0);
}
}

View File

@ -53,12 +53,13 @@ int NOTES::OpenTxt(dword file_path)
int i=0, linepos=0;
int item_n=-1;
count = LINES_COUNT;
strcpy(#txt_path, 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
@ -84,7 +85,6 @@ int NOTES::OpenTxt(dword file_path)
//lines[item_n].Delete();
item_n++;
}
count = LINES_COUNT;
return 1;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 661 B

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,15 +1,10 @@
// Notes v0.9 Beta
// Notes v1.0
#define MEMSIZE 0xDAE80
#include "..\lib\kolibri.h"
#include "..\lib\mem.h"
#include "..\lib\strings.h"
#include "..\lib\fs.h"
#include "..\lib\dll.h"
#include "..\lib\obj\box_lib.h"
#include "..\lib\gui.h"
#include "..\lib\encoding.h"
#include "..\lib\list_box.h"
//===================================================//
@ -68,7 +63,6 @@ void main()
load_dll(boxlib, #box_lib_init,0);
if (param) notes.OpenTxt(#param); else notes.OpenTxt(abspath("notes.txt"));
//notes.cur_y = 0;
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
@ -173,7 +167,7 @@ void draw_window()
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.x+RED_LINE_X, notes.y-1, COL_RED_LINE);
PutPixel(notes.x, notes.y-1, COL_RED_LINE);
ECX-=1; $int 0x40;
DrawCloseButton(WIN_W-23,4,16,16);
DrawRectangle(0,TITLE_H,WIN_W,WIN_H-HEADER_HEIGHT+EDGE_H,0xBBBBBB);
@ -188,6 +182,7 @@ void DrawEditBoxN()
notebox.offset = notebox.shift = notebox.shift_old = 0;
notebox.cl_curs_x = notebox.cl_curs_y = 0;
notebox.size = strlen(notebox.text);
notebox.flags = ed_always_focus+ed_focus;
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);

View File

@ -348,26 +348,9 @@ DMouse:
cmp eax,[icon_count]
jae DMessages
mov bl,10
div bl
add ah,30h
test al,al
jz @f
add al,30h
mov byte[DAreaIcon],al
mov byte[DAreaIcon+1],ah
mov byte[DAreaIcon+2],0
mov dword[edtIcon.size],2
jmp .RedrawNum
@@:
mov byte[DAreaIcon],ah
mov byte[DAreaIcon+1],0
mov dword[edtIcon.size],1
jmp .RedrawNum
.RedrawNum:
; stdcall byteToHex,al,DAreaIcon ;2
stdcall intToStr,eax,DAreaIcon
mov dword[edtIcon.size],edx
; stdcall [edit_box_draw],edtIcon
@ -647,8 +630,6 @@ local IcoX:DWORD,\
endp
proc DrawSelIcon
mov edx,[sc.work]
mcall 13,<ICONSX+18,3*8>,<59,12>
@ -662,25 +643,8 @@ proc DrawSelIcon
ret
@@:
mov al,[edi]
cmp al,'9'
ja .PathToIcon
cmp al,'/'
jne .GetIconInd
.PathToIcon:
mov al,30h ;§ £«ã誠!!!!!!!!!!!!!
mov byte[edi+1],0
.GetIconInd:
;int3
sub al,30h
cmp byte[edi+1],0
je @f
shl eax,1
lea eax,[eax*4+eax]
xor edx,edx
mov dl,[edi+1]
sub dl,30h
add eax,edx
;stdcall hexToInt, edi
stdcall strToInt, edi
@@: ;eax=num icon
cmp eax,[icon_count]
jb @f
@ -725,3 +689,154 @@ proc DrawSelIcon
ret
endp
;NOT USED
proc hexToInt strz:DWORD
push ebx
mov ebx,[strz]
mov al,[ebx]
xor edx,edx
.loop:
xor ecx,ecx
inc ebx
shl edx,4
cmp al,'0'
jb .err
cmp al,'9'
jbe .conv
mov ecx,10
sub al,11h
cmp al,'0'
jb .err
cmp al,'6'
ja .err
.conv:
sub al,30h
add dl,al
mov al,[ebx]
add dl,cl
test al,al
jnz .loop
mov eax,edx
pop ebx
ret
.err:
xor eax,eax
pop ebx
ret
endp
;NOT USED
proc byteToHex byti:BYTE,target:DWORD
push ebx
mov ebx,[target]
mov dl,[byti]
rol dl,4
mov ecx,2
.loop:
mov al,dl
and al,0xF
cmp al,10
jae @f
add al,0x30
jmp .n
@@:
add al,0x41-10
.n:
mov [ebx],al
inc ebx
rol dl,4
loop .loop
mov byte[ebx],0
@@: pop ebx
ret
jmp @b
endp
proc strToInt strz:DWORD
push ebx edi esi
stdcall strLen, [strz]
xor edx,edx
xor ebx,ebx
xor edi,edi
std
inc ebx
mov esi,[strz]
lea esi,[esi+eax-2]
.loop:
xor eax,eax
lodsb
cmp al,'0'
jb .err
cmp al,'9'
ja .err
sub al,0x30
mul ebx
lea ebx,[ebx*4+ebx] ;ebx = ebx*10
shl ebx,1
add edi,eax
cmp esi,[strz]
jae .loop
cld
mov eax,edi
pop esi edi ebx
ret
.err:
cld
or eax,-1
pop esi edi ebx
ret
endp
;ret: target - string, edx - length string
proc intToStr inti:DWORD, target:DWORD
locals
resl rb 16
endl
lea edi,[resl]
mov eax,[inti]
xor ecx,ecx
mov ebx,10
jmp .stlp
.loop:
xor edx,edx
div ebx
mov [edi],dl
inc edi
inc ecx
.stlp: cmp eax,10
jae .loop
mov [edi],al
inc ecx
mov edx,ecx
mov ebx,[target]
.conv:
mov al,[edi]
add al,0x30
mov [ebx],al
inc ebx
dec edi
loop .conv
mov byte[ebx],0
ret
endp
;for 'ab',0 strLen = 3
proc strLen stringZ:DWORD
push edi
xor al,al
mov edi,[stringZ]
or ecx,-1
repne scasb
sub edi,[stringZ]
mov eax,edi
pop edi
ret
endp

View File

@ -39,9 +39,18 @@ include '../../macros.inc'
include '../../proc32.inc'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../dll.inc'
;include '../../debug.inc'
include '../../debug.inc'
; include '../include/lang.inc'
; include '../include/macros.inc'
; include '../include/proc32.inc'
; include '../include/box_lib.mac'
; include '../include/dll.inc'
;------------------------------------------------------------------------------
START: ; start of execution
mcall 68,11
stdcall dll.Load,IMPORTS
test eax,eax
@ -119,7 +128,7 @@ START: ; start of execution
rep stosd
mov [nLoadIcon],0
stdcall [ini_enum_sections],IconIni,LoadIconsData
;int3
mov eax,dword[PIcoDB]
sub eax,[BegData]
mov dword[SizeData],eax
@ -533,28 +542,9 @@ local IconData:DWORD
repne scasb
repne scasb
repne scasb
mov al,[edi]
;cmp al,'9'
;ja PathToIcon
cmp al,'/'
jne GetIconInd
PathToIcon:
mov al,30h ;§ £«ã誠!!!!!!!!!!!!!
mov byte[edi+1],0
jmp CopyToMem
GetIconInd:
sub al,30h
cmp byte[edi+1],0
je @f
shl eax,1
lea eax,[eax*4+eax]
xor edx,edx
mov dl,[edi+1]
sub dl,30h
add eax,edx
;stdcall hexToInt,edi
stdcall strToInt,edi
@@: ;eax=num icon
cmp eax,[icon_count]
jb @f
@ -913,7 +903,7 @@ endp
;ä®à¬ â IPC-á®®¡é¥­¨ï
;dd X
;dd Y
;asciiz Icon
;asciiz Icon - in decimal
;asciiz Name
;asciiz Path
;asciiz Params
@ -926,7 +916,6 @@ endl
mov eax,IPCbuffer+8
mov dword[IPCbuffer],1
;mov edx,dword[IPCbuffer+4]
lea edx,[eax+8]
m2m dword[ix],dword[edx]
@ -1285,10 +1274,10 @@ DlgBufImg rb IMG_SIZE*IMG_SIZE*3
align 4
bufStdIco rb 40
IconsOffs rd 100 ;â ¡«¨æ  á 㪠§ â¥«ï¬¨ ­  ª®­ªà¥â­ë¥ ¨ª®­ª¨(¤«ï ã᪮७¨ï)
PIcoDB rd 1
IconsOffs rd 100h ;â ¡«¨æ  á 㪠§ â¥«ï¬¨ ­  ª®­ªà¥â­ë¥ ¨ª®­ª¨(¤«ï ã᪮७¨ï)
PIcoDB rd 1 ;㪠§ â¥«ì ­  ¡ãää¥à á ¨­ä®© ®¡® ¢á¥å ¨ª®­ª å
nLoadIcon rd 1 ;­®¬¥à ç¨â ¥¬®© ¨§ ini ¨ª®­ª¨
IconsID rd 100 ;ID ¨ª®­®ª - 2 ¡ ©âa + ¡ ©â 0 + ¢ëà ¢­¨¢ î騩 ¡ ©â - áâப  á 2¬ï è¥á­ ¤æ¥â¨à¨ç­ë¬¨ æ¨äà ¬¨
IconsID rd 100h ;ID ¨ª®­®ª - 2 ¡ ©âa + ¡ ©â 0 + ¢ëà ¢­¨¢ î騩 ¡ ©â - áâப  á 2¬ï è¥á­ ¤æ¥â¨à¨ç­ë¬¨ æ¨äà ¬¨
nameSection rb 4
@ -1335,4 +1324,8 @@ stack_bredraw:
rb 512
stack_main:
;------------------------------------------------------------------------------
ENDMEM: