2017-10-03 16:55:12 +02:00
|
|
|
//Calypte 0.35 - Leency
|
2017-10-03 14:10:48 +02:00
|
|
|
//Calypte 0.15 - Punk Joker
|
|
|
|
|
2017-10-03 16:55:12 +02:00
|
|
|
#define MEMSIZE 1024*100
|
2017-10-03 14:10:48 +02:00
|
|
|
|
2015-07-24 22:08:01 +02:00
|
|
|
#ifndef AUTOBUILD
|
|
|
|
#include "lang.h--"
|
|
|
|
#endif
|
|
|
|
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// LIB //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
#include "../lib/kolibri.h"
|
|
|
|
#include "../lib/file_system.h"
|
|
|
|
#include "../lib/gui.h"
|
|
|
|
#include "../lib/list_box.h"
|
|
|
|
#include "../lib/menu.h"
|
2017-10-03 16:55:12 +02:00
|
|
|
//#include "../lib/collection.h"
|
|
|
|
|
2015-11-15 04:02:20 +01:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
#include "../lib/obj/iconv.h"
|
2017-10-03 16:55:12 +02:00
|
|
|
#include "../lib/obj/box_lib.h"
|
|
|
|
#include "../lib/obj/libio_lib.h" //TO CHECK: why opendial is a peace of shit!
|
2017-10-03 14:10:48 +02:00
|
|
|
#include "../lib/obj/proc_lib.h"
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
#include "../lib/patterns/simple_open_dialog.h"
|
2015-08-04 16:36:07 +02:00
|
|
|
|
2017-10-03 16:55:12 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
char default_dir[] = "/rd/1";
|
|
|
|
od_filter filter2 = { "TXT",0};
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// DATA //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
/*========= MENU ==========*/
|
|
|
|
?define MENU1 "File"
|
|
|
|
?define MENU2 "Encoding"
|
|
|
|
?define MENU3 "Reopen"
|
|
|
|
|
|
|
|
char menu_file_list[] =
|
|
|
|
"Open
|
|
|
|
Close
|
|
|
|
Properties
|
|
|
|
Exit";
|
|
|
|
|
|
|
|
char menu_encoding_list[] =
|
|
|
|
"UTF-8
|
|
|
|
KOI8-RU
|
|
|
|
CP1251
|
|
|
|
CP1252
|
|
|
|
ISO8859-5
|
|
|
|
CP866";
|
|
|
|
|
|
|
|
char menu_reopen_list[] =
|
|
|
|
"Tinypad
|
|
|
|
TextEdit
|
|
|
|
TextRead
|
|
|
|
WebView
|
|
|
|
FB2Read
|
|
|
|
HexView";
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MENU_ID_FILE=10,
|
|
|
|
FILE_SUBMENU_ID_OPEN=10,
|
|
|
|
FILE_SUBMENU_ID_CLOSE,
|
|
|
|
FILE_SUBMENU_ID_PROPERTIES,
|
|
|
|
FILE_SUBMENU_ID_EXIT,
|
|
|
|
|
|
|
|
MENU_ID_ENCODING=20,
|
|
|
|
|
|
|
|
MENU_ID_REOPEN=30,
|
|
|
|
FILE_SUBMENU_ID_TINYPAD=30,
|
|
|
|
FILE_SUBMENU_ID_TEXTEDIT,
|
|
|
|
FILE_SUBMENU_ID_TEXTREAD,
|
|
|
|
FILE_SUBMENU_ID_WEBVIEW,
|
|
|
|
FILE_SUBMENU_ID_FB2READ,
|
|
|
|
FILE_SUBMENU_ID_HEXVIEW
|
2015-07-24 20:15:43 +02:00
|
|
|
};
|
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
int menu_file_x = 6;
|
|
|
|
int menu_encoding_x = NULL;
|
|
|
|
int menu_reopen_x = NULL;
|
|
|
|
/*======== MENU END ==========*/
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
#define TITLE "Calypte v0.3"
|
|
|
|
char win_title[4096] = TITLE;
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
#define TOPPANELH 23
|
|
|
|
#define BOTPANELH 10
|
|
|
|
#define WIN_W 750
|
|
|
|
#define WIN_H 550
|
2017-10-03 16:55:12 +02:00
|
|
|
#define SCROLL_SIZE 15
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
proc_info Form;
|
|
|
|
llist rows;
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
int encoding;
|
|
|
|
|
|
|
|
dword old_width,old_height;
|
2015-07-24 20:15:43 +02:00
|
|
|
|
|
|
|
dword bufpointer;
|
|
|
|
dword bufsize;
|
|
|
|
dword draw_sruct;
|
|
|
|
|
2017-10-03 16:55:12 +02:00
|
|
|
scroll_bar scroll_v = { SCROLL_SIZE,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};
|
|
|
|
scroll_bar scroll_h = { SCROLL_SIZE,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};
|
|
|
|
|
|
|
|
//collection s;
|
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// CODE //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
|
|
|
|
|
|
|
void InitDlls()
|
|
|
|
{
|
2017-10-03 16:55:12 +02:00
|
|
|
load_dll(boxlib, #box_lib_init, 0);
|
2017-10-03 14:10:48 +02:00
|
|
|
load_dll(libio, #libio_init, 1);
|
|
|
|
load_dll(iconv_lib, #iconv_open, 0);
|
|
|
|
load_dll(Proc_lib, #OpenDialog_init,0);
|
|
|
|
OpenDialog_init stdcall (#o_dialog);
|
|
|
|
}
|
2015-07-24 20:15:43 +02:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2015-08-10 09:55:50 +02:00
|
|
|
int id;
|
2017-10-03 14:10:48 +02:00
|
|
|
|
|
|
|
InitDlls();
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
2015-07-24 20:15:43 +02:00
|
|
|
loop()
|
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
switch(WaitEvent())
|
|
|
|
{
|
2015-07-24 20:15:43 +02:00
|
|
|
case evMouse:
|
2017-10-03 14:10:48 +02:00
|
|
|
mouse.get();
|
|
|
|
rows.wheel_size = 3;
|
|
|
|
if (rows.MouseScroll(mouse.vert)) {
|
|
|
|
DrawText();
|
|
|
|
break;
|
2015-11-15 04:02:20 +01:00
|
|
|
}
|
2015-07-24 20:15:43 +02:00
|
|
|
break;
|
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
case evButton:
|
2015-11-15 04:02:20 +01:00
|
|
|
id=GetButtonID();
|
2017-10-03 14:10:48 +02:00
|
|
|
if (id==1) ExitProcess();
|
2017-10-03 16:55:12 +02:00
|
|
|
if (id==MENU_ID_FILE)
|
|
|
|
EventShowMenu(menu_file_x, #menu_file_list, MENU_ID_FILE, NULL);
|
|
|
|
if (id==MENU_ID_ENCODING)
|
|
|
|
EventShowMenu(menu_encoding_x, #menu_encoding_list, MENU_ID_ENCODING, encoding+1);
|
|
|
|
if (id==MENU_ID_REOPEN)
|
|
|
|
EventShowMenu(menu_reopen_x, #menu_reopen_list, MENU_ID_REOPEN, NULL);
|
2015-07-24 20:15:43 +02:00
|
|
|
break;
|
2015-11-15 04:02:20 +01:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
case evKey:
|
|
|
|
GetKeys();
|
|
|
|
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
|
2015-07-24 20:15:43 +02:00
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
if (key_scancode == SCAN_CODE_KEY_O) EventOpenFile();
|
2015-08-10 09:55:50 +02:00
|
|
|
break;
|
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
if (rows.ProcessKey(key_scancode)) DrawText();
|
2015-07-24 20:15:43 +02:00
|
|
|
break;
|
2017-10-03 14:10:48 +02:00
|
|
|
|
|
|
|
case evReDraw:
|
|
|
|
if (menu.list.cur_y) {
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_OPEN) EventOpenFile();
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_CLOSE) EventCloseFile();
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_PROPERTIES) EventShowFileProperties();
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_EXIT) ExitProcess();
|
|
|
|
|
|
|
|
if (menu.list.cur_y > MENU_ID_ENCODING) && (menu.list.cur_y < MENU_ID_ENCODING + 10)
|
|
|
|
EventChangeEncoding(menu.list.cur_y - MENU_ID_ENCODING);
|
|
|
|
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_TINYPAD) ReopenFileIn("/sys/tinypad");
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_TEXTEDIT) ReopenFileIn("/sys/develop/t_edit");
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_TEXTREAD) ReopenFileIn("/sys/txtread");
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_WEBVIEW) ReopenFileIn("/sys/network/webview");
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_FB2READ) ReopenFileIn("/sys/fb2read");
|
|
|
|
if (menu.list.cur_y == FILE_SUBMENU_ID_HEXVIEW) ReopenFileIn("/sys/develop/heed");
|
|
|
|
|
|
|
|
|
|
|
|
menu.list.cur_y = 0;
|
|
|
|
};
|
2015-07-24 20:15:43 +02:00
|
|
|
draw_window();
|
|
|
|
break;
|
2017-10-03 14:10:48 +02:00
|
|
|
}
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-03 16:55:12 +02:00
|
|
|
void ReopenFileIn(dword _app)
|
|
|
|
{
|
|
|
|
RunProgram(_app, #param);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected)
|
2017-10-03 14:10:48 +02:00
|
|
|
{
|
2017-10-03 16:55:12 +02:00
|
|
|
menu.selected = _selected;
|
|
|
|
menu.show(
|
|
|
|
Form.left+5 + _menu_item_x,
|
|
|
|
Form.top+skin_height + TOPPANELH,
|
|
|
|
140,
|
|
|
|
_menu_list,
|
|
|
|
_id);
|
2017-10-03 14:10:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventOpenFile()
|
|
|
|
{
|
|
|
|
OpenDialog_start stdcall (#o_dialog);
|
2017-10-03 16:55:12 +02:00
|
|
|
if (!o_dialog.status) return;
|
2017-10-03 14:10:48 +02:00
|
|
|
OpenFile(#openfile_path);
|
|
|
|
Prepare();
|
|
|
|
draw_window();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventCloseFile()
|
|
|
|
{
|
2017-10-03 16:55:12 +02:00
|
|
|
if (!bufpointer) return;
|
2017-10-03 14:10:48 +02:00
|
|
|
strcpy(#win_title, TITLE);
|
|
|
|
FreeBuf();
|
|
|
|
draw_window();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventShowFileProperties()
|
|
|
|
{
|
|
|
|
char ss_param[4096];
|
|
|
|
if (!bufpointer) return;
|
|
|
|
sprintf(#ss_param, "-p %s", #param);
|
|
|
|
RunProgram("/sys/File managers/Eolite", #ss_param);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventChangeEncoding(dword id)
|
|
|
|
{
|
|
|
|
encoding = id;
|
|
|
|
OpenFile(#openfile_path);
|
|
|
|
Prepare();
|
|
|
|
draw_window();
|
|
|
|
}
|
|
|
|
|
|
|
|
int DrawMenuButton(dword x,y,id,text)
|
|
|
|
{
|
|
|
|
int textlen = strlen(text)*8;
|
|
|
|
int padding = 12;
|
|
|
|
DefineHiddenButton(x, y, textlen+padding+padding, TOPPANELH-2, id);
|
|
|
|
WriteText(x+padding,y+4, 0x90, MixColors(system.color.work, system.color.work_text, 70), text);
|
|
|
|
return textlen+padding+padding;
|
|
|
|
}
|
2015-07-24 20:15:43 +02:00
|
|
|
|
|
|
|
void draw_window()
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
system.color.get();
|
2016-11-23 12:37:13 +01:00
|
|
|
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,0xFFFFFF,#win_title,0);
|
2015-07-24 20:15:43 +02:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2017-10-03 14:10:48 +02:00
|
|
|
DrawBar(0, 0, Form.cwidth, TOPPANELH-1, system.color.work);
|
|
|
|
DrawBar(0, TOPPANELH-1, Form.cwidth, 1, system.color.work_dark);
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawBar(0, Form.cheight-BOTPANELH, Form.cwidth, BOTPANELH, system.color.work);
|
2015-07-24 20:15:43 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
menu_encoding_x = menu_file_x + DrawMenuButton(menu_file_x, 0, MENU_ID_FILE, MENU1);
|
|
|
|
menu_reopen_x = menu_encoding_x + DrawMenuButton(menu_encoding_x, 0, MENU_ID_ENCODING, MENU2);
|
|
|
|
DrawMenuButton(menu_reopen_x, 0, MENU_ID_REOPEN, MENU3);
|
|
|
|
|
2015-07-24 20:15:43 +02:00
|
|
|
if (old_width!=Form.width) || (old_height!=Form.height)
|
|
|
|
{
|
|
|
|
old_width = Form.width;
|
|
|
|
old_height = Form.height;
|
2015-11-15 04:02:20 +01:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
rows.no_selection = true;
|
|
|
|
rows.SetFont(8, 14, 0x90);
|
2017-10-03 16:55:12 +02:00
|
|
|
rows.SetSizes(0, TOPPANELH, Form.cwidth - SCROLL_SIZE, Form.cheight - TOPPANELH - BOTPANELH, 20);
|
2017-10-03 14:10:48 +02:00
|
|
|
rows.column_max = rows.w / rows.font_w;
|
|
|
|
|
|
|
|
if (bufpointer) Prepare();
|
|
|
|
rows.CheckDoesValuesOkey();
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
2017-10-03 16:55:12 +02:00
|
|
|
DrawRectangle(rows.x+rows.w-1, rows.y, SCROLL_SIZE, rows.h-1, 0xEEEeee);
|
|
|
|
DrawText();
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
void OpenFile(dword _path)
|
2015-07-24 20:15:43 +02:00
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
strcpy(#param, _path);
|
|
|
|
sprintf(#win_title, "%s - %s", TITLE, #param);
|
|
|
|
rows.KeyHome();
|
|
|
|
file_size stdcall (#param);
|
2015-07-24 20:15:43 +02:00
|
|
|
bufsize = EBX;
|
|
|
|
if (bufsize)
|
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
bufpointer = mem_Free(bufpointer);
|
2015-07-24 20:15:43 +02:00
|
|
|
bufpointer = mem_Alloc(bufsize);
|
2017-10-03 14:10:48 +02:00
|
|
|
if (ReadFile(0, bufsize, bufpointer, #param) != 0) {
|
|
|
|
bufpointer = 0;
|
|
|
|
notify("'Error opening file'-E");
|
|
|
|
}
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
2015-11-15 04:02:20 +01:00
|
|
|
if (encoding!=CH_CP866) ChangeCharset(charsets[encoding], "CP866", bufpointer);
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void FreeBuf()
|
|
|
|
{
|
|
|
|
int i;
|
2017-10-03 16:55:12 +02:00
|
|
|
if (!bufpointer) return;
|
2017-10-03 14:10:48 +02:00
|
|
|
for (i=0; i<rows.count; i++)
|
2015-07-24 20:15:43 +02:00
|
|
|
{
|
|
|
|
mem_Free(DSDWORD[i*4+draw_sruct]);
|
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
draw_sruct = mem_Free(draw_sruct);
|
|
|
|
bufpointer = mem_Free(bufpointer);
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
enum {
|
|
|
|
PARSE_CALCULATE_ROWS_COUNT,
|
|
|
|
PARSE_DRAW_PREPARE,
|
|
|
|
};
|
|
|
|
void Parse(int mode)
|
2015-07-24 20:15:43 +02:00
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
int pos=0;
|
|
|
|
int sub_pos=0;
|
2015-07-24 20:15:43 +02:00
|
|
|
int len_str = 0;
|
2017-10-03 14:10:48 +02:00
|
|
|
bool do_eof = false;
|
2015-07-24 20:15:43 +02:00
|
|
|
word bukva[2];
|
2017-10-03 14:10:48 +02:00
|
|
|
|
2015-07-24 20:15:43 +02:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
while(1)
|
|
|
|
{
|
2015-11-15 04:02:20 +01:00
|
|
|
bukva = DSBYTE[bufpointer+pos+len_str];
|
2015-07-24 20:15:43 +02:00
|
|
|
if (bukva=='\0')
|
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
do_eof = true;
|
2015-07-24 20:15:43 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bukva==0x0a) break;
|
|
|
|
else len_str++;
|
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
if (len_str<=rows.column_max)
|
2015-07-24 20:15:43 +02:00
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
if (mode==PARSE_DRAW_PREPARE)
|
2015-07-24 20:15:43 +02:00
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
ESDWORD[sub_pos*4+draw_sruct] = mem_Alloc(len_str+1);
|
|
|
|
strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, len_str); //-1 to do not show \n symbol
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
pos += len_str+1;
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
if (mode==PARSE_DRAW_PREPARE)
|
|
|
|
{
|
|
|
|
ESDWORD[sub_pos*4+draw_sruct] = mem_Alloc(len_str+1);
|
|
|
|
strlcpy(DSDWORD[sub_pos*4+draw_sruct], bufpointer+pos, rows.column_max);
|
|
|
|
}
|
|
|
|
pos += rows.column_max;
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
sub_pos++;
|
|
|
|
if (mode==PARSE_CALCULATE_ROWS_COUNT) if (do_eof) break;
|
|
|
|
if (mode==PARSE_DRAW_PREPARE) if (pos>=bufsize-1) break;
|
2015-07-24 20:15:43 +02:00
|
|
|
len_str = 0;
|
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
if (mode == PARSE_CALCULATE_ROWS_COUNT)
|
|
|
|
{
|
|
|
|
rows.count = sub_pos;
|
|
|
|
draw_sruct = mem_Free(draw_sruct);
|
|
|
|
draw_sruct = mem_Alloc(rows.count*4);
|
|
|
|
Parse(PARSE_DRAW_PREPARE);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Prepare()
|
|
|
|
{
|
|
|
|
Parse(PARSE_CALCULATE_ROWS_COUNT);
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrawText()
|
|
|
|
{
|
2017-10-03 16:55:12 +02:00
|
|
|
int i=0, top;
|
2017-10-03 14:10:48 +02:00
|
|
|
|
|
|
|
if (rows.count<rows.visible) top = rows.count;
|
2015-07-24 20:15:43 +02:00
|
|
|
else
|
|
|
|
{
|
2017-10-03 14:10:48 +02:00
|
|
|
if (rows.count-rows.first<=rows.visible) top = rows.count-rows.first-1;
|
|
|
|
else top = rows.visible;
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
|
2017-10-03 16:55:12 +02:00
|
|
|
if (bufpointer) for (i=0; i<top; i++)
|
2015-07-24 20:15:43 +02:00
|
|
|
{
|
2017-10-03 16:55:12 +02:00
|
|
|
DrawBar(0, i*rows.item_h+TOPPANELH, rows.w, rows.item_h, 0xFFFFFF);
|
2017-10-03 14:10:48 +02:00
|
|
|
WriteText(2, i*rows.item_h+TOPPANELH, 0x90, 0x000000, DSDWORD[i+rows.first*4+draw_sruct]);
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
DrawBar(0, i*rows.item_h+rows.y, rows.w, -i*rows.item_h + rows.h, 0xFFFfff);
|
2017-10-03 16:55:12 +02:00
|
|
|
DrawVerticalScroll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawVerticalScroll()
|
|
|
|
{
|
|
|
|
scroll_v.max_area = rows.count;
|
|
|
|
scroll_v.cur_area = rows.visible;
|
|
|
|
scroll_v.position = rows.first;
|
|
|
|
scroll_v.start_y = rows.y;
|
|
|
|
scroll_v.size_y = rows.h;
|
|
|
|
scroll_v.start_x = rows.w + rows.x -1;
|
|
|
|
scroll_v.all_redraw = 0;
|
|
|
|
scrollbar_v_draw(#scroll_v);
|
2015-07-24 20:15:43 +02:00
|
|
|
}
|
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
stop:
|