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:
Kirill Lipatov (Leency) 2017-10-03 14:55:12 +00:00
parent 30b0c444f3
commit 7ed0962aa5
8 changed files with 84 additions and 133 deletions

View File

@ -1,7 +1,7 @@
//Calypte 0.3 - Leency //Calypte 0.35 - Leency
//Calypte 0.15 - Punk Joker //Calypte 0.15 - Punk Joker
#define MEMSIZE 1024*80 #define MEMSIZE 1024*100
#ifndef AUTOBUILD #ifndef AUTOBUILD
#include "lang.h--" #include "lang.h--"
@ -19,14 +19,17 @@
#include "../lib/gui.h" #include "../lib/gui.h"
#include "../lib/list_box.h" #include "../lib/list_box.h"
#include "../lib/menu.h" #include "../lib/menu.h"
//#include "../lib/collection.h"
#include "../lib/obj/iconv.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/proc_lib.h"
#include "../lib/obj/libio_lib.h"
#include "../lib/patterns/simple_open_dialog.h" #include "../lib/patterns/simple_open_dialog.h"
char default_dir[] = "/rd/1"; char default_dir[] = "/rd/1";
od_filter filter2 = { "TXT",0}; od_filter filter2 = { "TXT",0};
@ -93,6 +96,7 @@ char win_title[4096] = TITLE;
#define BOTPANELH 10 #define BOTPANELH 10
#define WIN_W 750 #define WIN_W 750
#define WIN_H 550 #define WIN_H 550
#define SCROLL_SIZE 15
proc_info Form; proc_info Form;
llist rows; llist rows;
@ -105,6 +109,11 @@ dword bufpointer;
dword bufsize; dword bufsize;
dword draw_sruct; 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 // // CODE //
@ -113,7 +122,7 @@ dword draw_sruct;
void InitDlls() void InitDlls()
{ {
//load_dll(boxlib, #box_lib_init, 0); load_dll(boxlib, #box_lib_init, 0);
load_dll(libio, #libio_init, 1); load_dll(libio, #libio_init, 1);
load_dll(iconv_lib, #iconv_open, 0); load_dll(iconv_lib, #iconv_open, 0);
load_dll(Proc_lib, #OpenDialog_init,0); load_dll(Proc_lib, #OpenDialog_init,0);
@ -143,26 +152,12 @@ void main()
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==1) ExitProcess(); if (id==1) ExitProcess();
if (id==MENU_ID_FILE) menu.show( if (id==MENU_ID_FILE)
Form.left+5 + menu_file_x, EventShowMenu(menu_file_x, #menu_file_list, MENU_ID_FILE, NULL);
Form.top+skin_height + TOPPANELH, if (id==MENU_ID_ENCODING)
140, EventShowMenu(menu_encoding_x, #menu_encoding_list, MENU_ID_ENCODING, encoding+1);
#menu_file_list, if (id==MENU_ID_REOPEN)
MENU_ID_FILE); EventShowMenu(menu_reopen_x, #menu_reopen_list, MENU_ID_REOPEN, NULL);
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);
break; break;
case evKey: 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() void EventOpenFile()
{ {
OpenDialog_start stdcall (#o_dialog); OpenDialog_start stdcall (#o_dialog);
if (!o_dialog.status) return;
OpenFile(#openfile_path); OpenFile(#openfile_path);
Prepare(); Prepare();
draw_window(); draw_window();
@ -216,6 +223,7 @@ void EventOpenFile()
void EventCloseFile() void EventCloseFile()
{ {
if (!bufpointer) return;
strcpy(#win_title, TITLE); strcpy(#win_title, TITLE);
FreeBuf(); FreeBuf();
draw_window(); draw_window();
@ -266,17 +274,14 @@ void draw_window()
rows.no_selection = true; rows.no_selection = true;
rows.SetFont(8, 14, 0x90); 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; rows.column_max = rows.w / rows.font_w;
if (bufpointer) Prepare(); if (bufpointer) Prepare();
rows.CheckDoesValuesOkey(); rows.CheckDoesValuesOkey();
} }
if (bufpointer) DrawRectangle(rows.x+rows.w-1, rows.y, SCROLL_SIZE, rows.h-1, 0xEEEeee);
{ DrawText();
DrawText();
}
else DrawBar(0, TOPPANELH, Form.cwidth, Form.cheight-BOTPANELH-TOPPANELH, 0xFFFFFF);
} }
void OpenFile(dword _path) void OpenFile(dword _path)
@ -301,6 +306,7 @@ void OpenFile(dword _path)
void FreeBuf() void FreeBuf()
{ {
int i; int i;
if (!bufpointer) return;
for (i=0; i<rows.count; i++) for (i=0; i<rows.count; i++)
{ {
mem_Free(DSDWORD[i*4+draw_sruct]); mem_Free(DSDWORD[i*4+draw_sruct]);
@ -374,7 +380,7 @@ void Prepare()
void DrawText() void DrawText()
{ {
int i, top; int i=0, top;
if (rows.count<rows.visible) top = rows.count; if (rows.count<rows.visible) top = rows.count;
else else
@ -383,12 +389,25 @@ void DrawText()
else top = rows.visible; 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]); 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); 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: stop:

View File

@ -4,7 +4,6 @@
@del Calypte @del Calypte
cls cls
c-- Calypte.c c-- Calypte.c
@kpack Calypte.com
@rename Calypte.com Calypte @rename Calypte.com Calypte
@del warning.txt @del warning.txt
@del lang.h-- @del lang.h--

View File

@ -454,7 +454,6 @@ void TWebBrowser::DrawScroller()
scroll_wv.start_x = list.x + list.w; scroll_wv.start_x = list.x + list.w;
scroll_wv.start_y = list.y; scroll_wv.start_y = list.y;
scroll_wv.size_y = list.h; scroll_wv.size_y = list.h;
scroll_wv.start_x = list.w + list.x;
scrollbar_v_draw(#scroll_wv); scrollbar_v_draw(#scroll_wv);
} }
//============================================================================================ //============================================================================================

View File

@ -63,7 +63,7 @@ void collection::drop() {
= = = =
========================================================*/ ========================================================*/
:struct collection_int struct collection_int
{ {
int count; int count;
dword element[4096*3]; dword element[4096*3];
@ -72,19 +72,19 @@ void collection::drop() {
void drop(); void drop();
}; };
:int collection_int::add(dword in) { int collection_int::add(dword in) {
if (count >= 4096*3) return 0; if (count >= 4096*3) return 0;
element[count] = in; element[count] = in;
count++; count++;
return 1; return 1;
} }
:dword collection_int::get(dword pos) { dword collection_int::get(dword pos) {
if (pos<0) || (pos>=count) return 0; if (pos<0) || (pos>=count) return 0;
return element[pos]; return element[pos];
} }
:void collection_int::drop() { void collection_int::drop() {
element[0] = element[0] =
count = 0; count = 0;
} }

View File

@ -20,11 +20,6 @@ dword edit_box_key = #aEdit_box_key;
dword edit_box_mouse = #aEdit_box_mouse; dword edit_box_mouse = #aEdit_box_mouse;
dword version_ed = #aVersion_ed; 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_draw = #aScrollbar_v_draw;
dword scrollbar_v_mouse = #aScrollbar_v_mouse; dword scrollbar_v_mouse = #aScrollbar_v_mouse;
dword scrollbar_h_draw = #aScrollbar_h_draw; dword scrollbar_h_draw = #aScrollbar_h_draw;
@ -37,10 +32,6 @@ dword PathShow_draw = #aPathShow_draw;
dword progressbar_draw = #aProgressbar_draw; dword progressbar_draw = #aProgressbar_draw;
dword progressbar_progress = #aProgressbar_progress; 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; dword frame_draw = #aFrame_draw;
$DD 2 dup 0 $DD 2 dup 0
@ -50,11 +41,6 @@ char aEdit_box_key [] = "edit_box_key";
char aEdit_box_mouse[] = "edit_box_mouse"; char aEdit_box_mouse[] = "edit_box_mouse";
char aVersion_ed [] = "version_ed"; 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 aboxlib_init[] = "lib_init";
char aScrollbar_v_draw [] = "scrollbar_v_draw"; char aScrollbar_v_draw [] = "scrollbar_v_draw";
char aScrollbar_v_mouse[] = "scrollbar_v_mouse"; 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 aScrollbar_h_mouse[] = "scrollbar_h_mouse";
char aVersion_scrollbar[] = "version_scrollbar"; 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_prepare [] = "PathShow_prepare";
char aPathShow_draw [] = "PathShow_draw"; char aPathShow_draw [] = "PathShow_draw";
@ -101,48 +79,6 @@ PathShow_prepare stdcall(#PathShow);
PathShow_draw 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{ struct edit_box{
dword width, dword width,
left, left,
@ -167,26 +103,6 @@ dword width,
ed_char_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 struct scroll_bar
{ {
word size_x, word size_x,

View File

@ -6,10 +6,28 @@ struct od_filter
proc_info pr_inf; proc_info pr_inf;
char communication_area_name[] = "FFFFFFFF_open_dialog"; char communication_area_name[] = "FFFFFFFF_open_dialog";
byte plugin_path[4096]; char opendir_path[4096];
char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial char open_dialog_path[] = "/rd/1/File managers/opendial";
byte openfile_path[2048]; char openfile_path[4096];
byte filename_area[4096]; char filename_area[256];
opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path, opendialog o_dialog = {
#draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120}; 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
};

View File

@ -14,6 +14,5 @@ void DrawScroller()
scroll.start_x = list.x + list.w; scroll.start_x = list.x + list.w;
scroll.start_y = list.y; scroll.start_y = list.y;
scroll.size_y = list.h; scroll.size_y = list.h;
scroll.start_x = list.x + list.w;
scrollbar_v_draw(#scroll); scrollbar_v_draw(#scroll);
} }

View File

@ -277,6 +277,7 @@ void draw_window()
DrawToolbarButton(RUN_EDIT, 135); DrawToolbarButton(RUN_EDIT, 135);
DrawToolbarButton(SHOW_INFO, Form.cwidth - 34); DrawToolbarButton(SHOW_INFO, Form.cwidth - 34);
if ((Form.cwidth-scroll.size_x-1 == list.w) && if ((Form.cwidth-scroll.size_x-1 == list.w) &&
(Form.cheight-TOOLBAR_H == list.h) && (Form.cheight-TOOLBAR_H == list.h) &&
(list.count) (list.count)