list_box: structure improvements

git-svn-id: svn://kolibrios.org@5825 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-09-09 14:24:42 +00:00
parent 2cc8fd4d51
commit 935f95675a
19 changed files with 260 additions and 214 deletions

View File

@ -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.current<tview.visible) tview.current = 0;
else tview.current = tview.current-tview.visible;
if (!tview.cur_y) break;
if (tview.cur_y<tview.visible) tview.cur_y = 0;
else tview.cur_y = tview.cur_y-tview.visible;
DrawText();
break;
case SCAN_CODE_PGDN:
if (tview.current+tview.visible>tview.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.count<tview.visible) top = tview.count;
else
{
if (tview.count-tview.current<=tview.visible) top = tview.count-tview.current-1;
if (tview.count-tview.cur_y<=tview.visible) top = tview.count-tview.cur_y-1;
else top = tview.visible;
}
DrawBar(tview.x, tview.y, tview.w, 3, 0xFFFFFF);
for (i=0, num_line = tview.current; i<top; i++, num_line++)
for (i=0, num_line = tview.cur_y; i<top; i++, num_line++)
{
DrawBar(tview.x, i * tview.line_h + tview.y + 3, tview.w, tview.line_h, 0xFFFFFF);
WriteText(tview.x + 2, i * tview.line_h + tview.y + 3, 0x80, 0x000000, DSDWORD[num_line*4+draw_sruct]);
DrawBar(tview.x, i * tview.item_h + tview.y + 3, tview.w, tview.item_h, 0xFFFFFF);
WriteText(tview.x + 2, i * tview.item_h + tview.y + 3, 0x80, 0x000000, DSDWORD[num_line*4+draw_sruct]);
}
DrawBar(0, i * tview.line_h + tview.y + 3, tview.w, -i* tview.line_h + tview.h, 0xFFFFFF);
DrawBar(0, i * tview.item_h + tview.y + 3, tview.w, -i* tview.item_h + tview.h, 0xFFFFFF);
}
stop:

View File

@ -30,7 +30,6 @@ struct TWebBrowser {
} WB1;
byte
link,
ignor_text,
@ -90,19 +89,19 @@ void TWebBrowser::DrawStyle()
if (line) && (!anchor)
{
start_x = stolbec * list.font_w + body_magrin * DrawBuf.zoom + list.x;
start_y = stroka * list.line_h + body_magrin;
start_y = stroka * list.item_h + body_magrin;
stolbec_len = utf8_strlen(#line) * DrawBuf.zoom;
line_length = stolbec_len * list.font_w;
if (style.h) stroka++;
WriteBufText(start_x, start_y, list.font_type, text_colors[text_color_index], #line, buf_data);
if (style.b) WriteBufText(start_x+1, start_y, list.font_type, text_colors[text_color_index], #line, buf_data);
if (style.i) { stolbec++; DrawBuf.Skew(start_x, start_y, line_length, list.line_h); } // bug with zoom>1
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();
}

View File

@ -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<current; i++;)
cur_y/=2;
for (i=0; i<cur_y; i++;)
{
strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(URL));
}
}
current++;
cur_y++;
// history_list[i].was_first = WB1.list.first;
strlcpy(#history_list[current].Item, #URL, sizeof(URL));
links_count=current;
strlcpy(#history_list[cur_y].Item, #URL, sizeof(URL));
links_count=cur_y;
}
byte UrlsHistory::GoBack() {
if (current<=1) return 0;
current--;
strlcpy(#URL, #history_list[current].Item, sizeof(URL));
// stroka = history_list[current].was_first;
if (cur_y<=1) return 0;
cur_y--;
strlcpy(#URL, #history_list[cur_y].Item, sizeof(URL));
// stroka = history_list[cur_y].was_first;
return 1;
}
byte UrlsHistory::GoForward() {
if (current==links_count) return 0;
current++;
strlcpy(#URL, #history_list[current].Item, sizeof(URL));
if (cur_y==links_count) return 0;
cur_y++;
strlcpy(#URL, #history_list[cur_y].Item, sizeof(URL));
return 1;
}

View File

@ -68,8 +68,8 @@ void ImageCache::Images(int left1, top1, width1)
if (imgw > 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+imgh<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //if all image is out of visible area
if (top1<WB1.list.y) //if image partly visible (at the top)
{
@ -86,7 +86,7 @@ void ImageCache::Images(int left1, top1, width1)
img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color);
DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.line_h + WB1.list.line_h, bg_color);
DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, bg_color);
if (link)
{
UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);

View File

@ -68,7 +68,7 @@ PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
{
int i;
signed int WBY = -WB1.list.first*WB1.list.line_h - WB1.DrawBuf.zoom;
signed int WBY = -WB1.list.first*WB1.list.item_h - WB1.DrawBuf.zoom;
for (i=0; i<count; i++)
{
if (mx>links[i].x) && (my>links[i].y) && (mx<links[i].x+links[i].w) && (my<links[i].y+links[i].h)
@ -133,7 +133,7 @@ void LinksArray::GetAbsoluteURL(dword in_URL)
}
else
{
strcpy(#newurl, #history_list[BrowserHistory.current-1].Item);
strcpy(#newurl, #history_list[BrowserHistory.cur_y-1].Item);
}
if (ESBYTE[in_URL] == '/') //remove everything after site domain name

View File

@ -78,28 +78,28 @@ void Draw_List()
cur = list[active].first;
strcpy(#temp_filename, io.dir.position(files_mas[i+cur]));
temp_filename[strlen(#temp_filename)-4] = 0;
yyy = i*list[active].line_h+list[active].y;
yyy = i*list[active].item_h+list[active].y;
if (list[active].current-list[active].first==i)
if (list[active].cur_y-list[active].first==i)
{
if (system.color.work_button!=system.color.work)
{
DrawBar(0, yyy, list[active].w, list[active].line_h, system.color.work_button);
DrawBar(0, yyy, list[active].w, list[active].item_h, system.color.work_button);
if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,system.color.work_button_text, #temp_filename);
}
else
{
DrawBar(0, yyy, list[active].w, list[active].line_h, system.color.grab_button);
DrawBar(0, yyy, list[active].w, list[active].item_h, system.color.grab_button);
if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,system.color.grab_button_text, #temp_filename);
}
}
else
{
DrawBar(0,yyy,list[active].w, list[active].line_h, 0xFFFfff);
DrawBar(0,yyy,list[active].w, list[active].item_h, 0xFFFfff);
WriteText(12,yyy+list[active].text_y,0x80,0, #temp_filename);
}
}
DrawBar(0,list_last*list[active].line_h+list[active].y, list[active].w, -list_last*list[active].line_h+ list[active].h, 0xFFFfff);
DrawBar(0,list_last*list[active].item_h+list[active].y, list[active].w, -list_last*list[active].item_h+ list[active].h, 0xFFFfff);
DrawScroller();
}
@ -123,13 +123,13 @@ void Apply()
{
if (list[SKINS].active)
{
cur = list[SKINS].current;
cur = list[SKINS].cur_y;
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
SetSystemSkin(#cur_file_path);
}
if (list[WALLPAPERS].active)
{
cur = list[WALLPAPERS].current;
cur = list[WALLPAPERS].cur_y;
sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur]));
RunProgram("/sys/media/kiv", #cur_file_path);
Draw_List();
@ -149,7 +149,7 @@ void main()
SetEventMask(0x27);
load_dll(boxlib, #box_lib_init,0);
list[SKINS].current = list[WALLPAPERS].current = -1;
list[SKINS].cur_y = list[WALLPAPERS].cur_y = -1;
list[SKINS].first = list[WALLPAPERS].first = 0;
TabClick(WALLPAPERS);
list[WALLPAPERS].SetSizes(0, 230, 350, 400-PANEL_H, 18);

View File

@ -124,7 +124,7 @@ void main()
mouse.get();
if (WB1.list.MouseOver(mouse.x, mouse.y))
{
PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.line_h + mouse.y, link_color_inactive, link_color_active, bg_color);
PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.item_h + mouse.y, link_color_inactive, link_color_active, bg_color);
if (bufsize) && (mouse.pkm) && (mouse.up) { CreateThread(#menu_rmb,#stak+4092); break; }
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
}
@ -214,7 +214,7 @@ void main()
http_free stdcall (http_transfer);
http_transfer=0;
PageLinks.GetAbsoluteURL(#URL);
BrowserHistory.current--;
BrowserHistory.cur_y--;
strcpy(#editURL, #URL);
DrawEditBox();
OpenPage();
@ -244,7 +244,7 @@ void SetElementSizes()
Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
WB1.list.wheel_size = 7;
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h;
if (WB1.list.w!=WB1.DrawBuf.bufw) WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 30);
}
@ -486,7 +486,7 @@ void ClickLink()
if (http_transfer > 0)
{
StopLoading();
BrowserHistory.current--;
BrowserHistory.cur_y--;
}
strcpy(#URL, PageLinks.GetURL(PageLinks.active));

View File

@ -59,19 +59,19 @@ void DrawMenuList()
for (N=0; N<menu.count; N++;)
{
if (N==menu.current)
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
if (N==menu.cur_y)
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, 0x94AECE);
else
{
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_bg);
WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N]);
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, col_bg);
WriteText(19,N*menu.item_h+9,0x80,0xf2f2f2,ITEMS_LIST[N]);
}
WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N]);
WriteText(18,N*menu.item_h+8,0x80,0x000000,ITEMS_LIST[N]);
}
}
void ItemClick()
{
action_buf = VIEW_SOURCE + menu.current;
action_buf = VIEW_SOURCE + menu.cur_y;
ExitProcess();
}

View File

@ -193,12 +193,12 @@ void main()
{
if (mouse.y>=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.first<files.visible) {
files.current = id;
files.cur_y = id;
List_ReDraw();
}
}
@ -214,7 +214,7 @@ void main()
if (files.MouseOver(mouse.x, mouse.y))
{
files.current = mouse.y - files.y / files.line_h + files.first;
files.cur_y = mouse.y - files.y / files.item_h + files.first;
List_ReDraw();
menu_stak = malloc(4096);
CreateThread(#FileMenu,menu_stak+4092);
@ -457,8 +457,8 @@ void main()
Del_Form();
break;
case SCAN_CODE_INS:
selected_offset = file_mas[files.current]*304 + buf+32 + 7;
if (files.current==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7;
if (files.cur_y==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
if (ESBYTE[selected_offset])
{
ESBYTE[selected_offset]=0;
@ -476,12 +476,12 @@ void main()
FnProcess(key_scancode-58);
break;
default:
for (i=files.current+1; i<files.count; i++)
for (i=files.cur_y+1; i<files.count; i++)
{
strcpy(#temp, file_mas[i]*304+buf+72);
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
{
files.current = i - 1;
files.cur_y = i - 1;
files.KeyDown();
List_ReDraw();
break;
@ -575,7 +575,7 @@ void DrawFilePanels()
if (!two_panels)
{
DrawDeviceAndActionsLeftPanel();
files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.line_h);
files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.item_h);
DrawList();
Open_Dir(#path,ONLY_SHOW);
}
@ -590,25 +590,25 @@ void DrawFilePanels()
llist_copy(#files, #files_inactive);
strcpy(#path, #inactive_path);
col_selec = 0xCCCccc;
files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h);
files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.item_h);
DrawList();
Open_Dir(#path,WITH_REDRAW);
llist_copy(#files, #files_active);
strcpy(#path, #active_path);
col_selec = 0x94AECE;
files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h);
files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.item_h);
DrawList();
Open_Dir(#path,WITH_REDRAW);
}
if (active_panel==2)
{
files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h);
files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.item_h);
DrawList();
Open_Dir(#path,WITH_REDRAW);
llist_copy(#files, #files_active);
strcpy(#path, #active_path);
col_selec = 0x94AECE;
files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h);
files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.item_h);
DrawList();
Open_Dir(#path,WITH_REDRAW);
}
@ -619,30 +619,30 @@ void DrawFilePanels()
void List_ReDraw()
{
int all_lines_h;
static int old_current, old_first;
static int old_cur_y, old_first;
files.CheckDoesValuesOkey(); //prevent some shit
if (list_full_redraw) || (old_first != files.first)
{
old_current = files.current;
old_cur_y = files.cur_y;
old_first = files.first;
list_full_redraw = false;
goto _ALL_LIST_REDRAW;
}
if (old_current != files.current)
if (old_cur_y != files.cur_y)
{
if (old_current-files.first<files.visible) Line_ReDraw(0xFFFFFF, old_current-files.first);
Line_ReDraw(col_selec, files.current-files.first);
old_current = files.current;
if (old_cur_y-files.first<files.visible) Line_ReDraw(0xFFFFFF, old_cur_y-files.first);
Line_ReDraw(col_selec, files.cur_y-files.first);
old_cur_y = files.cur_y;
return;
}
_ALL_LIST_REDRAW:
for (j=0; j<files.visible; j++) if (files.current-files.first!=j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.current-files.first);
for (j=0; j<files.visible; j++) if (files.cur_y-files.first!=j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.cur_y-files.first);
//in the bottom
all_lines_h = j * files.line_h;
all_lines_h = j * files.item_h;
DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF);
DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work);
DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work);
@ -655,14 +655,14 @@ void Line_ReDraw(dword bgcol, filenum){
ext1, attr,
file_offet,
file_name_off,
y=filenum*files.line_h+files.y;
y=filenum*files.item_h+files.y;
BDVK file;
if (filenum==-1) return;
DrawBar(files.x,y,3,files.line_h,bgcol);
DrawBar(files.x+19,y,files.w-19,files.line_h,bgcol);
DrawBar(files.x,y,3,files.item_h,bgcol);
DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol);
DrawBar(files.x+3,y+17,16,1,bgcol);
if (files.line_h>18) 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="<DIR>";
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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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)
cur_y_temp = yy - y / item_h + first;
if (cur_y_temp != cur_y) && (cur_y_temp<count)
{
current = current_temp;
return 1;
cur_y = cur_y_temp;
ret = 1;
}
cur_x_temp = xx - x / item_w;
if (cur_x_temp != cur_x) && (cur_x_temp<column_max)
{
cur_x = cur_x_temp;
ret = 1;
}
}
return 0;
return ret;
}
int llist::ProcessKey(dword key)
@ -121,6 +129,11 @@ int llist::ProcessKey(dword key)
case SCAN_CODE_PGUP: return KeyPgUp();
case SCAN_CODE_PGDN: return KeyPgDown();
}
if (horisontal_selelection) switch(key)
{
case SCAN_CODE_LEFT: return KeyLeft();
case SCAN_CODE_RIGHT: return KeyRight();
}
return 0;
}
@ -133,20 +146,20 @@ int llist::KeyDown()
return 1;
}
if (current-first+1<visible)
if (cur_y-first+1<visible)
{
if (current + 1 >= 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;
}

View File

@ -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; (i<mail_list.visible) && (i+mail_list.first<mail_list.count); i++)
{
on_y = i*mail_list.line_h + mail_list.y;
if (mail_list.current==mail_list.first+i) sel_col=0xEEEeee; else sel_col=0xFFFfff;
DrawBar(0, on_y, mail_list.w, mail_list.line_h-1, sel_col);
on_y = i*mail_list.item_h + mail_list.y;
if (mail_list.cur_y==mail_list.first+i) sel_col=0xEEEeee; else sel_col=0xFFFfff;
DrawBar(0, on_y, mail_list.w, mail_list.item_h-1, sel_col);
direction = atr.GetDirection(i+mail_list.first+1);
on_x = strlen(itoa(i+mail_list.first+1))*6;
letter_icons_pal[0]=sel_col;
PutPaletteImage(sizeof(letter_icons)/3*direction + #letter_icons, 18,12, on_x+18,
mail_list.line_h-12/2+ on_y, 8, #letter_icons_pal);
mail_list.item_h-12/2+ on_y, 8, #letter_icons_pal);
WriteText(on_x + 42, on_y+5, 0x80, 0, atr.GetSubject(i+mail_list.first+1));
DrawBar(0, on_y + mail_list.line_h-1, mail_list.w, 1, 0xCCCccc);
DrawBar(0, on_y + mail_list.item_h-1, mail_list.w, 1, 0xCCCccc);
WriteText(10, on_y+5, 0x80, 0, itoa(i+mail_list.first+1));
WriteText(mail_list.w - 40, on_y+5, 0x80, 0, ConvertSize(atr.GetSize(i+mail_list.first+1)));
}
DrawBar(0, i*mail_list.line_h + mail_list.y, mail_list.w, -i*mail_list.line_h+mail_list.h, 0xFFFfff);
DrawBar(0, i*mail_list.item_h + mail_list.y, mail_list.w, -i*mail_list.item_h+mail_list.h, 0xFFFfff);
DrawScroller1();
}
@ -352,7 +352,7 @@ void InitTWB() {
WB1.list.SetSizes(0, mail_list.y+mail_list.h+LIST_INFO_H+1, Form.cwidth - scroll_wv.size_x - 1,
Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 12);
WB1.list.column_max = WB1.list.w - 30 / 6;
WB1.list.visible = WB1.list.h / WB1.list.line_h;
WB1.list.visible = WB1.list.h / WB1.list.item_h;
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h);
strcpy(#header, #version);

View File

@ -44,7 +44,7 @@ void ParseMail()
debug("ConvertToDOS");
ConvertToDOS(mdata, mailstart);
debug("SetAtrFromCurr");
atr.SetAtrFromCurr(mail_list.current+1);
atr.SetAtrFromCurr(mail_list.cur_y+1);
DrawMailBox();
}
}

View File

@ -48,6 +48,6 @@ void SetOpenedFileFirst(dword in_name)
}
}
dword GetCurrentItemName() {
dword Getcur_yItemName() {
return files_mas[current_playing_file_n]*304 + buf+72;
}

View File

@ -26,8 +26,9 @@ Goto next/previous track: Ctrl + Left/Right
Change sound volume: Left/Right key\nMute: M key' -St\n"
scroll_bar scroll1 = { 5,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};
llist list;
proc_info Form;
llist list;
char pixie_ini_path[4096];
@ -83,7 +84,7 @@ void OpenFolder(dword path111)
list.SetSizes(1, skin.h, skin.w-1, 198, 18);
if (list.count <= list.visible)
{
list.h = list.count * list.line_h;
list.h = list.count * list.item_h;
list.visible = list.count;
}
else
@ -136,7 +137,7 @@ void main()
if (list.MouseOver(mouse.x, mouse.y))
{
if (mouse.vert) if (list.MouseScroll(mouse.vert)) DrawPlayList();
if (mouse.dblclick) {current_playing_file_n=list.current; StartPlayingMp3();}
if (mouse.dblclick) {current_playing_file_n=list.cur_y; StartPlayingMp3();}
if (mouse.down) && (mouse.key&MOUSE_LEFT) if (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList();
if (mouse.down) && (mouse.key&MOUSE_RIGHT) NotifyAndBackFocus(ABOUT_MESSAGE);
}
@ -215,7 +216,7 @@ void main()
if (key_scancode==SCAN_CODE_LEFT) RunProgram("@VOLUME", "-");
if (key_scancode==SCAN_CODE_RIGHT) RunProgram("@VOLUME", "+");
if (key_scancode==050) RunProgram("@VOLUME", "m");
if (key_scancode==SCAN_CODE_ENTER) { current_playing_file_n=list.current; StartPlayingMp3(); }
if (key_scancode==SCAN_CODE_ENTER) { current_playing_file_n=list.cur_y; StartPlayingMp3(); }
if (key_scancode==025) || (key_scancode==SCAN_CODE_SPACE) PlayAndPauseClick();
if (list.ProcessKey(key_scancode)) DrawPlayList();
break;
@ -260,30 +261,30 @@ void DrawPlayList()
temp_filename[strlen(#temp_filename)-4] = '\0';
if (strlen(#temp_filename)>47) 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
{

View File

@ -40,23 +40,23 @@ void DrawMenuList()
int N;
for (N=0; N<menu.count; N++;)
{
if (N==menu.current)
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0xFFFfff);
if (N==menu.cur_y)
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, 0xFFFfff);
else
{
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0xE4DFE1);
WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,charsets[N]);
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, 0xE4DFE1);
WriteText(19,N*menu.item_h+9,0x80,0xf2f2f2,charsets[N]);
}
WriteText(18,N*menu.line_h+8,0x80,0x000000,charsets[N]);
WriteText(18,N*menu.item_h+8,0x80,0x000000,charsets[N]);
}
WriteText(5, encoding*menu.line_h+7, 0x80, 0x777777, "\x10");
WriteText(5, encoding*menu.item_h+7, 0x80, 0x777777, "\x10");
}
void ItemClick()
{
if (encoding!=menu.current)
if (encoding!=menu.cur_y)
{
encoding = menu.current;
encoding = menu.cur_y;
action_buf = true;
}
ExitProcess();

View File

@ -23,6 +23,10 @@ char title[4196];
byte help_opened = false;
char char_width[255];
dword line_offset;
#define DWORD 4;
enum {
OPEN_FILE,
MAGNIFY_MINUS,
@ -119,7 +123,7 @@ void draw_window()
void DrawPage()
{
_PutImage(list.x,list.y,list.w,list.h,list.first*list.line_h*list.w*3 + font.buffer);
_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + font.buffer);
DrawScroller();
}
@ -132,17 +136,16 @@ void PreparePage()
dword line_length=30;
dword stroka_y = 5;
dword stroka=0;
char ch_width[255];
int i, srch_pos;
font.changeSIZE();
list.w = Form.cwidth-scroll.size_x-1;
//get font chars width, need to increase performance
for (i=0; i<256; i++) ch_width[i] = font.symbol_size(i);
for (i=0; i<256; i++) char_width[i] = font.symbol_size(i);
//get font buffer height
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) {
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;
}