From 935f95675a496fd6ed22335968a03d63141957a8 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 9 Sep 2015 14:24:42 +0000 Subject: [PATCH] list_box: structure improvements git-svn-id: svn://kolibrios.org@5825 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/Calypte/Calypte.c | 22 +-- programs/cmm/TWB/TWB.c | 29 ++-- programs/cmm/TWB/history.h | 32 ++-- programs/cmm/TWB/img_cache.h | 6 +- programs/cmm/TWB/links.h | 4 +- programs/cmm/appearance/appearance.c | 18 +-- programs/cmm/browser/WebView.c | 8 +- programs/cmm/browser/menu.h | 12 +- programs/cmm/eolite/Eolite.c | 70 ++++----- programs/cmm/eolite/include/menu.h | 14 +- programs/cmm/eolite/include/settings.h | 18 +-- programs/cmm/experimental/easyshot/easyshot.c | 12 +- programs/cmm/lib/list_box.h | 139 ++++++++++++------ programs/cmm/liza/mail_box.c | 20 +-- programs/cmm/liza/parselist.c | 2 +- programs/cmm/pixie/get_files_list.h | 2 +- programs/cmm/pixie/pixie.c | 33 +++-- programs/cmm/textreader/menu.h | 16 +- programs/cmm/textreader/textreader.c | 17 ++- 19 files changed, 260 insertions(+), 214 deletions(-) diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index 54445cfcc8..cc83dfd05c 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -153,7 +153,7 @@ void main() break; case 2: read = 0; - tview.current = 0; + tview.cur_y = 0; strcpy(#win_title, TITLE); FreeBuf(); draw_window(); @@ -207,14 +207,14 @@ void main() if (tview.ProcessKey(key_scancode)) DrawText(); break;*/ case SCAN_CODE_PGUP: - if (!tview.current) break; - if (tview.currenttview.count) break; - tview.current = tview.current+tview.visible; + if (tview.cur_y+tview.visible>tview.count) break; + tview.cur_y = tview.cur_y+tview.visible; DrawText(); break; } @@ -364,16 +364,16 @@ void DrawText() if (tview.count1 - if (style.s) DrawBuf.DrawBar(start_x, list.line_h / 2 - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); - if (style.u) DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); + if (style.i) { stolbec++; DrawBuf.Skew(start_x, start_y, line_length, list.item_h); } // bug with zoom>1 + if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); + if (style.u) DrawBuf.DrawBar(start_x, list.item_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); if (link) { - DrawBuf.DrawBar(start_x, list.line_h*style.h + list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); - PageLinks.AddText(#line, line_length, list.line_h*style.h + list.line_h, UNDERLINE); + DrawBuf.DrawBar(start_x, list.item_h*style.h + list.item_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]); + PageLinks.AddText(#line, line_length, list.item_h*style.h + list.item_h, UNDERLINE); } stolbec += stolbec_len; } @@ -251,7 +250,7 @@ void TWebBrowser::Perenos() //============================================================================================ void TWebBrowser::SetStyle() { int left1 = 5 + list.x; - int top1 = stroka * list.line_h + list.y + 5; + int top1 = stroka * list.item_h + list.y + 5; byte opened; byte meta_encoding; //проверяем тег открывается или закрывается @@ -394,7 +393,7 @@ void TWebBrowser::SetStyle() { if (opened) { NewLine(); - DrawBuf.DrawBar(style.li_tab * 5 * list.font_w * DrawBuf.zoom + list.x, stroka +1 * list.line_h - 3 + DrawBuf.DrawBar(style.li_tab * 5 * list.font_w * DrawBuf.zoom + list.x, stroka +1 * list.item_h - 3 - DrawBuf.zoom - DrawBuf.zoom, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x454545); } return; @@ -413,7 +412,7 @@ void TWebBrowser::SetStyle() { $push edi; NewLine(); $pop edi; - DrawBuf.DrawBar(5, list.line_h*stroka+4, list.w-10, 1, EDI); + DrawBuf.DrawBar(5, list.item_h*stroka+4, list.w-10, 1, EDI); NewLine(); return; } @@ -472,12 +471,12 @@ void TWebBrowser::NewLine() int onleft, ontop; onleft = list.x + 5; - ontop = stroka * list.line_h + list.y + 5; + ontop = stroka * list.item_h + list.y + 5; if (t_html) && (!t_body) return; - if (stroka * list.line_h + 5 >= 0) && ( stroka + 1 * list.line_h + 5 < list.h) && (!anchor) + if (stroka * list.item_h + 5 >= 0) && ( stroka + 1 * list.item_h + 5 < list.h) && (!anchor) { - if (style.align == ALIGN_CENTER) && (DrawBuf.zoom==1) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); - if (style.align == ALIGN_RIGHT) && (DrawBuf.zoom==1) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); + if (style.align == ALIGN_CENTER) && (DrawBuf.zoom==1) DrawBuf.AlignCenter(onleft,ontop,list.w,list.item_h,stolbec * list.font_w); + if (style.align == ALIGN_RIGHT) && (DrawBuf.zoom==1) DrawBuf.AlignRight(onleft,ontop,list.w,list.item_h,stolbec * list.font_w); } stroka++; if (style.blq) stolbec = 6; else stolbec = 0; @@ -490,6 +489,6 @@ int isval(dword text) { if (!strcmp(#val,text)) return 1; else return 0; } //============================================================================================ void TWebBrowser::DrawPage() { - PutPaletteImage(list.first * list.line_h * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); + PutPaletteImage(list.first * list.item_h * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); DrawScroller(); } \ No newline at end of file diff --git a/programs/cmm/TWB/history.h b/programs/cmm/TWB/history.h index da6375bfcd..f71399b741 100644 --- a/programs/cmm/TWB/history.h +++ b/programs/cmm/TWB/history.h @@ -8,7 +8,7 @@ path_string history_list[MAX_HISTORY_NUM]; struct UrlsHistory { int links_count; - int current; + int cur_y; dword CurrentUrl(); dword GetUrl(); dword GetFirstLine(); @@ -18,7 +18,7 @@ struct UrlsHistory { } BrowserHistory; dword UrlsHistory::CurrentUrl() { - return #history_list[current].Item; + return #history_list[cur_y].Item; } dword UrlsHistory::GetUrl(int id) { @@ -31,35 +31,35 @@ dword UrlsHistory::GetFirstLine(int id) { void UrlsHistory::AddUrl() { int i; - if (links_count>0) && (!strcmp(#URL,#history_list[current].Item)) return; + if (links_count>0) && (!strcmp(#URL,#history_list[cur_y].Item)) return; - if (current>=MAX_HISTORY_NUM-1) + if (cur_y>=MAX_HISTORY_NUM-1) { - current/=2; - for (i=0; i width1) imgw = width1; if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //fill first line - stroka += imgh / WB1.list.line_h; - if (imgh % WB1.list.line_h) stroka++; + stroka += imgh / WB1.list.item_h; + if (imgh % WB1.list.item_h) stroka++; if (top1+imghWB1.list.y+WB1.list.h-10) return; //if all image is out of visible area if (top1links[i].x) && (my>links[i].y) && (mx 0) { StopLoading(); - BrowserHistory.current--; + BrowserHistory.cur_y--; } strcpy(#URL, PageLinks.GetURL(PageLinks.active)); diff --git a/programs/cmm/browser/menu.h b/programs/cmm/browser/menu.h index a7a29c5b52..c0a1697fd1 100644 --- a/programs/cmm/browser/menu.h +++ b/programs/cmm/browser/menu.h @@ -59,19 +59,19 @@ void DrawMenuList() for (N=0; N=files.y)//&&(mouse.click) { - id = mouse.y - files.y / files.line_h + files.first; - if (files.current!=id) + id = mouse.y - files.y / files.item_h + files.first; + if (files.cur_y!=id) { mouse.clearTime(); if(!mouse.up)&&(id-files.first18) DrawBar(files.x+3,y+18,16,files.line_h-18,bgcol); - if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,bgcol); + if (files.item_h>18) DrawBar(files.x+3,y+18,16,files.item_h-18,bgcol); + if (files.item_h>15) DrawBar(files.x+3,y,16,files.item_h-15,bgcol); file_offet = file_mas[filenum+files.first]*304 + buf+32; attr = ESDWORD[file_offet]; @@ -674,13 +674,13 @@ void Line_ReDraw(dword bgcol, filenum){ { ext1 = strrchr(file_name_off,'.') + file_name_off; if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing - Put_icon(ext1, files.x+3, files.line_h/2-7+y, bgcol, 0); + Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0); WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y +1,files.font_type,0,ConvertSize(file.sizelo)); } else { if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1=""; - Put_icon(ext1, files.x+3, files.line_h/2-7+y, bgcol, 0); + Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0); } if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? @@ -708,11 +708,11 @@ void Line_ReDraw(dword bgcol, filenum){ else { font.bg_color = bgcol; - font.prepare(files.x + 23, files.line_h - font.height / 2 + y, file_name_off); + font.prepare(files.x + 23, files.item_h - font.height / 2 + y, file_name_off); font.show(); } - DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1 - DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //gray line 2 + DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1 + DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2 } @@ -734,7 +734,7 @@ void Open_Dir(dword dir_path, redraw){ } maxcount = sizeof(file_mas)/sizeof(dword)-1; if (files.count>maxcount) files.count = maxcount; - if (files.count>0) && (files.current-files.first==-1) files.current=0; + if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; } if (files.count!=-1) { @@ -746,7 +746,7 @@ void Open_Dir(dword dir_path, redraw){ PathShow_draw stdcall(#PathShow); } HistoryPath(ADD_NEW_PATH); - files.visible = files.h / files.line_h; + files.visible = files.h / files.item_h; if (files.count < files.visible) files.visible = files.count; if (redraw!=ONLY_SHOW) Sorting(); list_full_redraw = true; @@ -943,7 +943,7 @@ void SelectFileByName(dword that_file) Open_Dir(#path,ONLY_OPEN); if (!real_files_names_case) strttl(that_file); for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } - files.current = ind - 1; + files.cur_y = ind - 1; files.KeyDown(); List_ReDraw(); } @@ -983,7 +983,7 @@ void Open(byte rez) if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } strcpy(#path, #file_path); if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end - files.first=files.current=0; + files.first=files.cur_y=0; Open_Dir(#path,WITH_REDRAW); } } diff --git a/programs/cmm/eolite/include/menu.h b/programs/cmm/eolite/include/menu.h index e827a74355..597c7999d6 100644 --- a/programs/cmm/eolite/include/menu.h +++ b/programs/cmm/eolite/include/menu.h @@ -64,7 +64,7 @@ void FileMenu() menu.visible++; } menu.w = menu.w + 3 * menu.font_w + 50; - menu.h = menu.count * menu.line_h; + menu.h = menu.count * menu.item_h; SetEventMask(100111b); goto _MENU_DRAW; @@ -86,7 +86,7 @@ void FileMenu() case evReDraw: _MENU_DRAW: if (menu_call_mouse) DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); - else DefineAndDrawWindow(Form.left+files.x+15, files.line_h*files.current+files.y+Form.top+30,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); + else DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); GetProcessInfo(#MenuForm, SelfInfo); DrawRectangle(0,0,menu.w+1,menu.h+2,system.color.work_graph); DrawBar(1,1,menu.w,1,0xFFFfff); @@ -102,19 +102,19 @@ void MenuListRedraw() for (index=0; file_captions[index*3]!=0; index++) { if ((itdir) && (file_captions[index*3+2]>=200)) continue; - DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff); - if (start_y/menu.line_h==menu.current) + DrawBar(1,start_y+2,1,menu.item_h,0xFFFfff); + if (start_y/menu.item_h==menu.cur_y) { cur_action_buf = file_captions[index*3+2]; - DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff); + DrawBar(2,start_y+2,menu.w-1,menu.item_h,0xFFFfff); } else { - DrawBar(2,start_y+2,menu.w-1,menu.line_h,system.color.work); + DrawBar(2,start_y+2,menu.w-1,menu.item_h,system.color.work); WriteText(8,start_y+menu.text_y+4,menu.font_type,0xf2f2f2,file_captions[index*3]); } WriteText(7, start_y + menu.text_y + 3, menu.font_type, system.color.work_text, file_captions[index*3]); WriteText(-strlen(file_captions[index*3+1])-1*menu.font_w + menu.w, start_y + menu.text_y + 3, menu.font_type, 0x888888, file_captions[index*3+1]); - start_y+=menu.line_h; + start_y+=menu.item_h; } } \ No newline at end of file diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 488ee7755d..9eb728bf8b 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -43,8 +43,8 @@ void settings_dialog() else if (id==21) { action_buf=109; real_files_names_case ^= 1; } else if (id==22) info_after_copy ^= 1; else if (id==24) two_panels ^= 1; - else if (id==25) { files.line_h++; files_active.line_h = files_inactive.line_h = files.line_h; } - else if (id==26) && (files.line_h>18) files.line_h--; + else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; } + else if (id==26) && (files.item_h>18) files.item_h--; else if (id==27) MOUSE_TIME++; else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--; else if (id==30) { font.size.text++; IF(!font.changeSIZE()) font.size.text--; BigFontsChange(); } @@ -81,7 +81,7 @@ void DrawSettingsCheckBoxes() CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy); CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels); MoreLessBox(10, 103, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK); - MoreLessBox(10, 130, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT); + MoreLessBox(10, 130, 18, 25, 26, #system.color, files.item_h, LIST_LINE_HEIGHT); if (font.data) MoreLessBox(10, 157, 18, 30, 31, #system.color, font.size.text, FONT_SIZE_LABEL); } @@ -96,7 +96,7 @@ void LoadIniSettings() ini_get_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", 0); info_after_copy = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 9); font.size.text = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "TwoPanels", 0); two_panels = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "LineHeight", 18); files.line_h = EAX; + ini_get_int stdcall (eolite_ini_path, #config_section, "LineHeight", 18); files.item_h = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "TimeDoubleClick", 50); MOUSE_TIME = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX; @@ -112,7 +112,7 @@ void SaveIniSettings() ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy); ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", font.size.text); ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels); - ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.line_h); + ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h); ini_set_int stdcall (eolite_ini_path, #config_section, "TimeDoubleClick", MOUSE_TIME); ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left); ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top); @@ -126,7 +126,7 @@ void Write_Error(int error_number) { char error_message[500]; dword ii; - if (files.current>=0) Line_ReDraw(0xFF0000, files.current); + if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y); pause(5); sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE"); notify(#error_message); @@ -148,9 +148,9 @@ void SetAppColors() void BigFontsChange() { - files.line_h = font.size.text + 4; - if (files.line_h<18) files.line_h = 18; - files_active.line_h = files_inactive.line_h = files.line_h; + files.item_h = font.size.text + 4; + if (files.item_h<18) files.item_h = 18; + files_active.item_h = files_inactive.item_h = files.item_h; } diff --git a/programs/cmm/experimental/easyshot/easyshot.c b/programs/cmm/experimental/easyshot/easyshot.c index 546dce4a29..f7563c5232 100644 --- a/programs/cmm/experimental/easyshot/easyshot.c +++ b/programs/cmm/experimental/easyshot/easyshot.c @@ -79,7 +79,7 @@ void TakeScreenshot() { void ZoomImageTo50percent() { dword point_x, - line_h= b_screen_width * 3, + item_h= b_screen_width * 3, s_off = s_screen + 3, b_off = b_screen + 6, b_off_r, @@ -91,7 +91,7 @@ void ZoomImageTo50percent() { while( (s_off < s_screen + s_screen_length) && (b_off < b_screen + b_screen_length ) ) { - if (b_off < b_screen + line_h) || (b_off > b_screen + b_screen_length - line_h) + if (b_off < b_screen + item_h) || (b_off > b_screen + b_screen_length - item_h) { ESBYTE[s_off] = ESBYTE[b_off]; ESBYTE[s_off+1] = ESBYTE[b_off+1]; @@ -105,9 +105,9 @@ void ZoomImageTo50percent() { b_off_r = b_off; b_off_g = b_off + 1; b_off_b = b_off + 2; - rez_r = ESBYTE[b_off_r+3] + ESBYTE[b_off_r] + ESBYTE[b_off_r-3] + ESBYTE[b_off_r-line_h] + ESBYTE[b_off_r+line_h] / 5; - rez_g = ESBYTE[b_off_g+3] + ESBYTE[b_off_g] + ESBYTE[b_off_g-3] + ESBYTE[b_off_g-line_h] + ESBYTE[b_off_g+line_h] / 5; - rez_b = ESBYTE[b_off_b+3] + ESBYTE[b_off_b] + ESBYTE[b_off_b-3] + ESBYTE[b_off_b-line_h] + ESBYTE[b_off_b+line_h] / 5; + rez_r = ESBYTE[b_off_r+3] + ESBYTE[b_off_r] + ESBYTE[b_off_r-3] + ESBYTE[b_off_r-item_h] + ESBYTE[b_off_r+item_h] / 5; + rez_g = ESBYTE[b_off_g+3] + ESBYTE[b_off_g] + ESBYTE[b_off_g-3] + ESBYTE[b_off_g-item_h] + ESBYTE[b_off_g+item_h] / 5; + rez_b = ESBYTE[b_off_b+3] + ESBYTE[b_off_b] + ESBYTE[b_off_b-3] + ESBYTE[b_off_b-item_h] + ESBYTE[b_off_b+item_h] / 5; ESBYTE[s_off] = rez_r; ESBYTE[s_off+1] = rez_g; ESBYTE[s_off+2] = rez_b; @@ -120,7 +120,7 @@ void ZoomImageTo50percent() { point_x+=2; if (point_x >= b_screen_width) { - b_off += line_h; + b_off += item_h; point_x = 0; } } diff --git a/programs/cmm/lib/list_box.h b/programs/cmm/lib/list_box.h index 38eab21457..1abad2fb16 100644 --- a/programs/cmm/lib/list_box.h +++ b/programs/cmm/lib/list_box.h @@ -9,55 +9,57 @@ struct llist { - int x, y, w, h, line_h, text_y; - int count, visible, first, current, column_max; //visible = row_max + int x, y, w, h, item_h, item_w; + int count, visible, first, column_max; //visible = row_max + int cur_x, cur_y; + int text_y; byte font_w, font_h, font_type; byte wheel_size; byte active; byte no_selection; + byte horisontal_selelection; void ClearList(); - int MouseOver(int xx, yy); - int ProcessMouse(int xx, yy); - int ProcessKey(dword key); - int KeyDown(); - int KeyUp(); - int KeyHome(); - int KeyEnd(); - int KeyPgDown(); - int KeyPgUp(); - void CheckDoesValuesOkey(); - void SetSizes(int xx, yy, ww, hh, line_hh); + void SetSizes(int xx, yy, ww, hh, item_hh); void SetFont(dword font_ww, font_hh, font_tt); + int ProcessKey(dword key); + int ProcessMouse(int xx, yy); + int MouseOver(int xx, yy); int MouseScroll(dword scroll_state); + int KeyDown(); + int KeyUp(); + int KeyHome(); + int KeyEnd(); + int KeyPgDown(); + int KeyPgUp(); + int KeyLeft(); + int KeyRight(); + void CheckDoesValuesOkey(); void debug_values(); -}; - +}; void llist::debug_values() { char yi[128]; - sprintf(#yi, "%s %d %s %d %s %d %s %d", "current:", current, "first:", first, - "visible:", visible, "count:", count); + sprintf(#yi, "%s %d %s %d %s %d %s %d %s %d %s %d", "first:", first, "visible:", visible, "count:", count, "col_max:", column_max, "cur_y:", cur_y, "cur_x:", cur_x); debugln(#yi); } - void llist::ClearList() { - count = visible = first = current = 0; + count = visible = first = cur_y = cur_x = 0; } -void llist::SetSizes(int xx, yy, ww, hh, line_hh) +void llist::SetSizes(int xx, yy, ww, hh, item_hh) { x = xx; y = yy; w = ww; h = hh; - line_h = line_hh; - text_y = line_h - font_h / 2; - visible = h / line_h; + item_h = item_hh; + text_y = item_h - font_h / 2; + visible = h / item_h; wheel_size = 3; CheckDoesValuesOkey(); } @@ -97,17 +99,23 @@ int llist::MouseOver(int xx, yy) int llist::ProcessMouse(int xx, yy) { - int current_temp; + int cur_y_temp, cur_x_temp, ret=0; if (MouseOver(xx, yy)) { - current_temp = yy - y / line_h + first; - if (current_temp != current) && (current_temp= count) return 0; - current++; + if (cur_y + 1 >= count) return 0; + cur_y++; } else { if (visible + first >= count) return 0; first++; - current++; + cur_y++; } - if (current < first) || (current > first + visible) + if (cur_y < first) || (cur_y > first + visible) { - first = current; + first = cur_y; CheckDoesValuesOkey(); } return 1; @@ -161,19 +174,19 @@ int llist::KeyUp() return 1; } - if (current > first) + if (cur_y > first) { - current--; + cur_y--; } else { if (first == 0) return 0; first--; - current--; + cur_y--; } - if (current < first) || (current > first + visible) + if (cur_y < first) || (cur_y > first + visible) { - first = current; + first = cur_y; CheckDoesValuesOkey(); } return 1; @@ -181,15 +194,15 @@ int llist::KeyUp() int llist::KeyHome() { - if (current==0) && (first==0) return 0; - current = first = 0; + if (cur_y==0) && (first==0) return 0; + cur_y = first = 0; return 1; } int llist::KeyEnd() { - if (current==count-1) && (first==count-visible) return 0; - current = count-1; + if (cur_y==count-1) && (first==count-visible) return 0; + cur_y = count-1; first = count - visible; return 1; } @@ -216,10 +229,40 @@ void llist::CheckDoesValuesOkey() { if (visible + first > count) first = count - visible; if (first < 0) first = 0; - if (current >= count) current = count - 1; - if (current < 0) current = 0; + if (cur_y >= count) cur_y = count - 1; + if (cur_y < 0) cur_y = 0; + if (cur_x < 0) cur_x = 0; } +int llist::KeyRight() +{ + if (cur_x < column_max) + { + cur_x++; + } + else + { + if (!KeyDown()) return 0; + cur_x = 0; + } + return 1; +} + +int llist::KeyLeft() +{ + if (cur_x > 0) + { + cur_x--; + } + else + { + if (!KeyUp()) return 0; + cur_x = column_max; + } + return 1; +} + + void llist_copy(dword dest, src) { EDI = dest; @@ -228,7 +271,7 @@ void llist_copy(dword dest, src) EDI.llist.y = ESI.llist.y; EDI.llist.w = ESI.llist.w; EDI.llist.h = ESI.llist.h; - EDI.llist.line_h = ESI.llist.line_h; + EDI.llist.item_h = ESI.llist.item_h; EDI.llist.text_y = ESI.llist.text_y; EDI.llist.font_w = ESI.llist.font_w; EDI.llist.font_h = ESI.llist.font_h; @@ -236,7 +279,7 @@ void llist_copy(dword dest, src) EDI.llist.count = ESI.llist.count; EDI.llist.visible = ESI.llist.visible; EDI.llist.first = ESI.llist.first; - EDI.llist.current = ESI.llist.current; + EDI.llist.cur_y = ESI.llist.cur_y; EDI.llist.column_max = ESI.llist.column_max; EDI.llist.active = ESI.llist.active; } diff --git a/programs/cmm/liza/mail_box.c b/programs/cmm/liza/mail_box.c index 4d53fefb9c..92c784a672 100644 --- a/programs/cmm/liza/mail_box.c +++ b/programs/cmm/liza/mail_box.c @@ -91,13 +91,13 @@ void MailBoxNetworkProcess() { from = to = date = subj = cur_charset = NULL; WB1.list.ClearList(); DrawMailBox(); - request_len = GetRequest("RETR", itoa(mail_list.current+1)); + request_len = GetRequest("RETR", itoa(mail_list.cur_y+1)); if (Send(socketnum, #request, request_len, 0) == 0xffffffff) { StopConnect("Error while trying to get letter from server"); break; } - mailsize = atr.GetSize(mail_list.current+1) + 1024; + mailsize = atr.GetSize(mail_list.cur_y+1) + 1024; free(mailstart); mailstart = malloc(mailsize); mailend = mailstart; @@ -305,25 +305,25 @@ void DrawToolbar() { void DrawMailList() { int i, on_y, on_x, direction; dword sel_col; - mail_list.visible = mail_list.h / mail_list.line_h; + mail_list.visible = mail_list.h / mail_list.item_h; for (i=30; i<150; i++) DeleteButton(i); for (i=0; (i47) strcpy(#temp_filename+44, "..."); - yyy = i*list.line_h+list.y; + yyy = i*list.item_h+list.y; //this is selected file - if (list.current - list.first == i) + if (list.cur_y - list.first == i) { if (i>=list.count) continue; - DrawBar(list.x, yyy, list.w, list.line_h, theme.color_list_active_bg); + DrawBar(list.x, yyy, list.w, list.item_h, theme.color_list_active_bg); WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename); } //this is not selected file else { if (i>=list.count) continue; - DrawBar(list.x,yyy,list.w, list.line_h, theme.color_list_bg); + DrawBar(list.x,yyy,list.w, list.item_h, theme.color_list_bg); WriteText(12,yyy+list.text_y,0x80, theme.color_list_text, #temp_filename); } - //this is current playing file + //this is cur_y playing file if (i + list.first == current_playing_file_n) && (playback_mode == PLAYBACK_MODE_PLAYING) { WriteText(3, yyy+list.text_y,0x80, theme.color_list_active_pointer, "\x10"); WriteText(12,yyy+list.text_y,0x80, theme.color_list_active_text, #temp_filename); } } - DrawBar(list.x,list.visible * list.line_h + list.y, list.w, -list.visible * list.line_h + list.h, theme.color_list_bg); + DrawBar(list.x,list.visible * list.item_h + list.y, list.w, -list.visible * list.item_h + list.h, theme.color_list_bg); DrawScroller(); } @@ -319,7 +320,7 @@ void StartPlayingMp3() if (current_playing_file_n > list.count) { current_playing_file_n = list.count; return; } if (current_playing_file_n < 0) { current_playing_file_n = 0; return; } playback_mode = PLAYBACK_MODE_PLAYING; - strlcpy(#current_filename, GetCurrentItemName(), sizeof(current_filename)); + strlcpy(#current_filename, Getcur_yItemName(), sizeof(current_filename)); sprintf(#item_path,"\"%s/%s\"",#work_folder,#current_filename); DrawPlayList(); DrawTopPanel(); @@ -343,7 +344,7 @@ void draw_window() { void DrawTopPanel() { - char current_playing_title[245]; + char cur_y_playing_title[245]; img_draw stdcall(skin.image, 0, 0, Form.width - 14, skin.h, 0, 0); img_draw stdcall(skin.image, Form.width - 14, 0, 15, skin.h, skin.w - 15, 0); if (playback_mode == PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0); @@ -358,10 +359,10 @@ void DrawTopPanel() if (window_mode == WINDOW_MODE_NORMAL) { DefineButton(Form.width - 26, 1, 12, 11, BUTTON_WINDOW_MINIMIZE + BT_HIDE, 0); - strcpy(#current_playing_title, #current_filename); - current_playing_title[strlen(#current_playing_title)-4] = '\0'; - if (strlen(#current_playing_title) > 29) strcpy(#current_playing_title + 26, "..."); - WriteText(90, 9, 0x80, theme.color_top_panel_text, #current_playing_title); + strcpy(#cur_y_playing_title, #current_filename); + cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0'; + if (strlen(#cur_y_playing_title) > 29) strcpy(#cur_y_playing_title + 26, "..."); + WriteText(90, 9, 0x80, theme.color_top_panel_text, #cur_y_playing_title); } else { diff --git a/programs/cmm/textreader/menu.h b/programs/cmm/textreader/menu.h index 5477feaedb..3ceb1bee5e 100644 --- a/programs/cmm/textreader/menu.h +++ b/programs/cmm/textreader/menu.h @@ -40,23 +40,23 @@ void DrawMenuList() int N; for (N=0; N=list.w) || (ch==10) { srch_pos = bufoff; loop() @@ -161,7 +164,7 @@ void PreparePage() list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, font.size.text+1); if (list.count < list.visible) list.count = list.visible; - font.size.height = list.count+1*list.line_h; + font.size.height = list.count+1*list.item_h; font.buffer_size = 0; line_length = 30; @@ -169,7 +172,7 @@ void PreparePage() for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++) { ch = ESBYTE[bufoff]; - line_length += ch_width[ch]; + line_length += char_width[ch]; if (line_length>=list.w) || (ch==10) { //set word break @@ -183,7 +186,7 @@ void PreparePage() i = bufoff-line_start; strlcpy(#line, line_start, i); font.prepare_buf(8,stroka_y,list.w,font.size.height, #line); - stroka_y += list.line_h; + stroka_y += list.item_h; line_start = bufoff; line_length = 30; }