forked from KolibriOS/kolibrios
Calypte 0.35: add scroll, mark current encoding in list
git-svn-id: svn://kolibrios.org@7043 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
30b0c444f3
commit
7ed0962aa5
@ -1,7 +1,7 @@
|
||||
//Calypte 0.3 - Leency
|
||||
//Calypte 0.35 - Leency
|
||||
//Calypte 0.15 - Punk Joker
|
||||
|
||||
#define MEMSIZE 1024*80
|
||||
#define MEMSIZE 1024*100
|
||||
|
||||
#ifndef AUTOBUILD
|
||||
#include "lang.h--"
|
||||
@ -19,14 +19,17 @@
|
||||
#include "../lib/gui.h"
|
||||
#include "../lib/list_box.h"
|
||||
#include "../lib/menu.h"
|
||||
//#include "../lib/collection.h"
|
||||
|
||||
|
||||
#include "../lib/obj/iconv.h"
|
||||
//#include "../lib/obj/box_lib.h" //TO CHECK: boxlib doesn't work well with opendial
|
||||
#include "../lib/obj/box_lib.h"
|
||||
#include "../lib/obj/libio_lib.h" //TO CHECK: why opendial is a peace of shit!
|
||||
#include "../lib/obj/proc_lib.h"
|
||||
#include "../lib/obj/libio_lib.h"
|
||||
|
||||
#include "../lib/patterns/simple_open_dialog.h"
|
||||
|
||||
|
||||
char default_dir[] = "/rd/1";
|
||||
od_filter filter2 = { "TXT",0};
|
||||
|
||||
@ -93,6 +96,7 @@ char win_title[4096] = TITLE;
|
||||
#define BOTPANELH 10
|
||||
#define WIN_W 750
|
||||
#define WIN_H 550
|
||||
#define SCROLL_SIZE 15
|
||||
|
||||
proc_info Form;
|
||||
llist rows;
|
||||
@ -105,6 +109,11 @@ dword bufpointer;
|
||||
dword bufsize;
|
||||
dword draw_sruct;
|
||||
|
||||
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;
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// CODE //
|
||||
@ -113,7 +122,7 @@ dword draw_sruct;
|
||||
|
||||
void InitDlls()
|
||||
{
|
||||
//load_dll(boxlib, #box_lib_init, 0);
|
||||
load_dll(boxlib, #box_lib_init, 0);
|
||||
load_dll(libio, #libio_init, 1);
|
||||
load_dll(iconv_lib, #iconv_open, 0);
|
||||
load_dll(Proc_lib, #OpenDialog_init,0);
|
||||
@ -143,26 +152,12 @@ void main()
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==1) ExitProcess();
|
||||
if (id==MENU_ID_FILE) menu.show(
|
||||
Form.left+5 + menu_file_x,
|
||||
Form.top+skin_height + TOPPANELH,
|
||||
140,
|
||||
#menu_file_list,
|
||||
MENU_ID_FILE);
|
||||
|
||||
if (id==MENU_ID_ENCODING) menu.show(
|
||||
Form.left+5 + menu_encoding_x,
|
||||
Form.top+skin_height + TOPPANELH,
|
||||
120,
|
||||
#menu_encoding_list,
|
||||
MENU_ID_ENCODING);
|
||||
|
||||
if (id==MENU_ID_REOPEN) menu.show(
|
||||
Form.left+5 + menu_reopen_x,
|
||||
Form.top+skin_height + TOPPANELH,
|
||||
120,
|
||||
#menu_reopen_list,
|
||||
MENU_ID_REOPEN);
|
||||
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);
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
@ -201,14 +196,26 @@ void main()
|
||||
}
|
||||
}
|
||||
|
||||
void ReopenFileIn(dword app)
|
||||
void ReopenFileIn(dword _app)
|
||||
{
|
||||
RunProgram(app, #param);
|
||||
RunProgram(_app, #param);
|
||||
}
|
||||
|
||||
void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected)
|
||||
{
|
||||
menu.selected = _selected;
|
||||
menu.show(
|
||||
Form.left+5 + _menu_item_x,
|
||||
Form.top+skin_height + TOPPANELH,
|
||||
140,
|
||||
_menu_list,
|
||||
_id);
|
||||
}
|
||||
|
||||
void EventOpenFile()
|
||||
{
|
||||
OpenDialog_start stdcall (#o_dialog);
|
||||
if (!o_dialog.status) return;
|
||||
OpenFile(#openfile_path);
|
||||
Prepare();
|
||||
draw_window();
|
||||
@ -216,6 +223,7 @@ void EventOpenFile()
|
||||
|
||||
void EventCloseFile()
|
||||
{
|
||||
if (!bufpointer) return;
|
||||
strcpy(#win_title, TITLE);
|
||||
FreeBuf();
|
||||
draw_window();
|
||||
@ -266,18 +274,15 @@ void draw_window()
|
||||
|
||||
rows.no_selection = true;
|
||||
rows.SetFont(8, 14, 0x90);
|
||||
rows.SetSizes(0, TOPPANELH, Form.cwidth, Form.cheight - TOPPANELH - BOTPANELH, 20);
|
||||
rows.SetSizes(0, TOPPANELH, Form.cwidth - SCROLL_SIZE, Form.cheight - TOPPANELH - BOTPANELH, 20);
|
||||
rows.column_max = rows.w / rows.font_w;
|
||||
|
||||
if (bufpointer) Prepare();
|
||||
rows.CheckDoesValuesOkey();
|
||||
}
|
||||
if (bufpointer)
|
||||
{
|
||||
DrawRectangle(rows.x+rows.w-1, rows.y, SCROLL_SIZE, rows.h-1, 0xEEEeee);
|
||||
DrawText();
|
||||
}
|
||||
else DrawBar(0, TOPPANELH, Form.cwidth, Form.cheight-BOTPANELH-TOPPANELH, 0xFFFFFF);
|
||||
}
|
||||
|
||||
void OpenFile(dword _path)
|
||||
{
|
||||
@ -301,6 +306,7 @@ void OpenFile(dword _path)
|
||||
void FreeBuf()
|
||||
{
|
||||
int i;
|
||||
if (!bufpointer) return;
|
||||
for (i=0; i<rows.count; i++)
|
||||
{
|
||||
mem_Free(DSDWORD[i*4+draw_sruct]);
|
||||
@ -374,7 +380,7 @@ void Prepare()
|
||||
|
||||
void DrawText()
|
||||
{
|
||||
int i, top;
|
||||
int i=0, top;
|
||||
|
||||
if (rows.count<rows.visible) top = rows.count;
|
||||
else
|
||||
@ -383,12 +389,25 @@ void DrawText()
|
||||
else top = rows.visible;
|
||||
}
|
||||
|
||||
for (i=0; i<top; i++)
|
||||
if (bufpointer) for (i=0; i<top; i++)
|
||||
{
|
||||
DrawBar(0, i*rows.item_h+TOPPANELH, Form.cwidth, rows.item_h, 0xFFFFFF);
|
||||
DrawBar(0, i*rows.item_h+TOPPANELH, rows.w, rows.item_h, 0xFFFFFF);
|
||||
WriteText(2, i*rows.item_h+TOPPANELH, 0x90, 0x000000, DSDWORD[i+rows.first*4+draw_sruct]);
|
||||
}
|
||||
DrawBar(0, i*rows.item_h+rows.y, rows.w, -i*rows.item_h + rows.h, 0xFFFfff);
|
||||
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);
|
||||
}
|
||||
|
||||
stop:
|
@ -4,7 +4,6 @@
|
||||
@del Calypte
|
||||
cls
|
||||
c-- Calypte.c
|
||||
@kpack Calypte.com
|
||||
@rename Calypte.com Calypte
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
|
@ -454,7 +454,6 @@ void TWebBrowser::DrawScroller()
|
||||
scroll_wv.start_x = list.x + list.w;
|
||||
scroll_wv.start_y = list.y;
|
||||
scroll_wv.size_y = list.h;
|
||||
scroll_wv.start_x = list.w + list.x;
|
||||
scrollbar_v_draw(#scroll_wv);
|
||||
}
|
||||
//============================================================================================
|
||||
|
@ -63,7 +63,7 @@ void collection::drop() {
|
||||
= =
|
||||
========================================================*/
|
||||
|
||||
:struct collection_int
|
||||
struct collection_int
|
||||
{
|
||||
int count;
|
||||
dword element[4096*3];
|
||||
@ -72,19 +72,19 @@ void collection::drop() {
|
||||
void drop();
|
||||
};
|
||||
|
||||
:int collection_int::add(dword in) {
|
||||
int collection_int::add(dword in) {
|
||||
if (count >= 4096*3) return 0;
|
||||
element[count] = in;
|
||||
count++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
:dword collection_int::get(dword pos) {
|
||||
dword collection_int::get(dword pos) {
|
||||
if (pos<0) || (pos>=count) return 0;
|
||||
return element[pos];
|
||||
}
|
||||
|
||||
:void collection_int::drop() {
|
||||
void collection_int::drop() {
|
||||
element[0] =
|
||||
count = 0;
|
||||
}
|
||||
|
@ -20,11 +20,6 @@ dword edit_box_key = #aEdit_box_key;
|
||||
dword edit_box_mouse = #aEdit_box_mouse;
|
||||
dword version_ed = #aVersion_ed;
|
||||
|
||||
dword menu_bar_draw = #aMenu_bar_draw;
|
||||
dword menu_bar_activate = #aMenu_bar_activate;
|
||||
dword menu_bar_mouse = #aMenu_bar_mouse;
|
||||
dword version_menu_bar = #aVersion_menu_bar;
|
||||
|
||||
dword scrollbar_v_draw = #aScrollbar_v_draw;
|
||||
dword scrollbar_v_mouse = #aScrollbar_v_mouse;
|
||||
dword scrollbar_h_draw = #aScrollbar_h_draw;
|
||||
@ -37,10 +32,6 @@ dword PathShow_draw = #aPathShow_draw;
|
||||
dword progressbar_draw = #aProgressbar_draw;
|
||||
dword progressbar_progress = #aProgressbar_progress;
|
||||
|
||||
dword check_box_draw = #aCheck_box_draw;
|
||||
dword check_box_mouse = #aCheck_box_mouse;
|
||||
dword version_ch = #aVersion_ch;
|
||||
|
||||
dword frame_draw = #aFrame_draw;
|
||||
|
||||
$DD 2 dup 0
|
||||
@ -50,11 +41,6 @@ char aEdit_box_key [] = "edit_box_key";
|
||||
char aEdit_box_mouse[] = "edit_box_mouse";
|
||||
char aVersion_ed [] = "version_ed";
|
||||
|
||||
char aMenu_bar_draw [] = "menu_bar_draw";
|
||||
char aMenu_bar_activate[] = "menu_bar_activate";
|
||||
char aMenu_bar_mouse [] = "menu_bar_mouse";
|
||||
char aVersion_menu_bar [] = "version_menu_bar";
|
||||
|
||||
char aboxlib_init[] = "lib_init";
|
||||
char aScrollbar_v_draw [] = "scrollbar_v_draw";
|
||||
char aScrollbar_v_mouse[] = "scrollbar_v_mouse";
|
||||
@ -62,14 +48,6 @@ char aScrollbar_h_draw [] = "scrollbar_h_draw";
|
||||
char aScrollbar_h_mouse[] = "scrollbar_h_mouse";
|
||||
char aVersion_scrollbar[] = "version_scrollbar";
|
||||
|
||||
char aCheck_box_draw [] = "check_box_draw2";
|
||||
char aCheck_box_mouse [] = "check_box_mouse2";
|
||||
char aVersion_ch [] = "version_ch2";
|
||||
|
||||
char aOption_box_draw [] = "option_box_draw";
|
||||
char aOption_box_mouse [] = "option_box_mouse";
|
||||
char aVersion_op [] = "version_op" ;
|
||||
|
||||
char aPathShow_prepare [] = "PathShow_prepare";
|
||||
char aPathShow_draw [] = "PathShow_draw";
|
||||
|
||||
@ -101,48 +79,6 @@ PathShow_prepare stdcall(#PathShow);
|
||||
PathShow_draw stdcall(#PathShow);
|
||||
*/
|
||||
|
||||
struct menu_data
|
||||
{
|
||||
dword type;
|
||||
|
||||
word size_x;
|
||||
word start_x;
|
||||
|
||||
word size_y;
|
||||
word start_y;
|
||||
dword text_pointer;
|
||||
dword pos_pointer;
|
||||
dword text_end;
|
||||
dword mouse_pos;
|
||||
dword mouse_keys;
|
||||
|
||||
word size_x1;
|
||||
word start_x1;
|
||||
|
||||
word size_y1;
|
||||
word start_y1;
|
||||
dword bckg_col;
|
||||
dword frnt_col;
|
||||
dword menu_col;
|
||||
dword select;
|
||||
dword out_select;
|
||||
dword buf_adress;
|
||||
dword procinfo;
|
||||
dword click;
|
||||
dword cursor;
|
||||
dword cursor_old;
|
||||
dword interval;
|
||||
dword cursor_max;
|
||||
dword extended_key;
|
||||
dword menu_sel_col;
|
||||
dword bckg_text_col;
|
||||
dword frnt_text_col;
|
||||
dword mouse_keys_old;
|
||||
dword font_height;
|
||||
dword cursor_out;
|
||||
dword get_mouse_flag;
|
||||
};
|
||||
|
||||
struct edit_box{
|
||||
dword width,
|
||||
left,
|
||||
@ -167,26 +103,6 @@ dword width,
|
||||
ed_char_width;
|
||||
};
|
||||
|
||||
struct checkbox2
|
||||
{
|
||||
dword
|
||||
left_s,
|
||||
top_s,
|
||||
ch_text_margin,
|
||||
color,
|
||||
border_color,
|
||||
text_color,
|
||||
text,
|
||||
flags,
|
||||
size_of_str;
|
||||
};
|
||||
|
||||
//flags for checkbox2
|
||||
#define CH_FLAG_EN 10b
|
||||
#define CH_FLAG_TOP 0x0
|
||||
#define CH_FLAG_MIDDLE 100b
|
||||
#define CH_FLAG_BOTTOM 1000b
|
||||
|
||||
struct scroll_bar
|
||||
{
|
||||
word size_x,
|
||||
|
@ -6,10 +6,28 @@ struct od_filter
|
||||
|
||||
proc_info pr_inf;
|
||||
char communication_area_name[] = "FFFFFFFF_open_dialog";
|
||||
byte plugin_path[4096];
|
||||
char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial
|
||||
byte openfile_path[2048];
|
||||
byte filename_area[4096];
|
||||
char opendir_path[4096];
|
||||
char open_dialog_path[] = "/rd/1/File managers/opendial";
|
||||
char openfile_path[4096];
|
||||
char filename_area[256];
|
||||
|
||||
opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path,
|
||||
#draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120};
|
||||
opendialog o_dialog = {
|
||||
0,
|
||||
#pr_inf,
|
||||
#communication_area_name,
|
||||
0,
|
||||
#opendir_path,
|
||||
#default_dir,
|
||||
#open_dialog_path,
|
||||
#draw_window,
|
||||
0,
|
||||
#openfile_path,
|
||||
#filename_area,
|
||||
#filter2,
|
||||
|
||||
420,
|
||||
200,
|
||||
|
||||
320,
|
||||
120
|
||||
};
|
||||
|
@ -14,6 +14,5 @@ void DrawScroller()
|
||||
scroll.start_x = list.x + list.w;
|
||||
scroll.start_y = list.y;
|
||||
scroll.size_y = list.h;
|
||||
scroll.start_x = list.x + list.w;
|
||||
scrollbar_v_draw(#scroll);
|
||||
}
|
@ -277,6 +277,7 @@ void draw_window()
|
||||
DrawToolbarButton(RUN_EDIT, 135);
|
||||
DrawToolbarButton(SHOW_INFO, Form.cwidth - 34);
|
||||
|
||||
|
||||
if ((Form.cwidth-scroll.size_x-1 == list.w) &&
|
||||
(Form.cheight-TOOLBAR_H == list.h) &&
|
||||
(list.count)
|
||||
|
Loading…
Reference in New Issue
Block a user