cmm editboxes: various fixes

git-svn-id: svn://kolibrios.org@7506 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-10-29 11:39:31 +00:00
parent 9f39170af8
commit ad662d3962
17 changed files with 134 additions and 126 deletions

View File

@ -204,12 +204,12 @@ void HandleKeyEvent()
EventOpenAddress(#address);
return;
case SCAN_CODE_BS:
if (! address_box.flags & 0b10) {
if (! address_box.flags & ed_focus) {
EventGoBack();
return;
}
}
if (list.ProcessKey(key_scancode)) && (! address_box.flags & 0b10) {
if (list.ProcessKey(key_scancode)) && (! address_box.flags & ed_focus) {
DrawPage();
return;
}

View File

@ -64,11 +64,11 @@ _tabs tabs = { LP, LP, NULL, NULL, SKINS };
checkbox checkbox1 = { "Checkbox", true };
more_less_box spinbox1 = { 23, 0, 999, "SpinBox" };
edit_box edit_cmm = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(param),#param,0, 0b};
0x10000000,sizeof(param)-2,#param,0, 0b};
char st_str[16];
edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(st_str),#st_str,0, 0b};
0x10000000,sizeof(st_str)-2,#st_str,0, 0b};
char default_dir[] = "/rd/1";
od_filter filter2 = { 8, "TXT\0\0" };
@ -130,7 +130,7 @@ void main()
}
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
if (! edit_cmm.flags & 0b10) && (! edit_st.flags & 0b10)
if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus)
for (id=select_list.cur_y+1; id<select_list.count; id++)
{
strcpy(#temp_filename, io.dir.position(files_mas[id]));

View File

@ -111,8 +111,7 @@ enum {
#include "download_manager.h"
char editURL[sizeof(URL)];
int mouse_twb;
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL),#editURL,#mouse_twb,2,19,19};
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,2,19,19};
#define SKIN_Y 24
@ -158,7 +157,7 @@ void main()
case evKey:
GetKeys();
if (address_box.flags & 0b10)
if (address_box.flags & ed_focus)
{
if (key_ascii == ASCII_KEY_ENTER) ProcessEvent(key_scancode); else {
EAX = key_editbox;
@ -308,8 +307,6 @@ void ProcessEvent(dword id__)
}
OpenPage();
return;
case SCAN_CODE_F5:
IF(address_box.flags & 0b10) return;
case REFRESH_BUTTON:
if (http.transfer > 0)
{
@ -454,8 +451,9 @@ DrawEditBoxWebView()
int skin_x_offset;
DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
address_box.offset = 0;
//address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
//address_box.offset = 0;
EditBox_UpdateText(#address_box, address_box.flags);
edit_box_draw stdcall(#address_box);
if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51;
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);

View File

@ -22,7 +22,7 @@ char save_to[4096] = "/tmp0/1/Downloads";
proc_info DL_Form;
char downloader_edit[10000];
char filepath[4096];
edit_box ed = {NULL,57,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit),#downloader_edit,0,2,19,19};
edit_box ed = {NULL,57,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit)-2,#downloader_edit,0,2,19,19};
progress_bar pb = {0, 20, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
//progress_bar pb = {0, 180, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;

View File

@ -8,8 +8,8 @@ od_filter filter2 = {0,0};
char src_box_text[4096];
char dst_box_text[4096];
edit_box src_box = {340,20,35,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(src_box_text),#src_box_text,0, 10b};
edit_box dst_box = {340,20,95,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(dst_box_text),#dst_box_text,0, 0b};
edit_box src_box = {340,20,35,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(src_box_text)-2,#src_box_text,0, ed_focus};
edit_box dst_box = {340,20,95,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(dst_box_text)-2,#dst_box_text,0, 0b};
#define BID_EXIT_PRC 01
#define BID_SRC_OPEN 10
@ -44,16 +44,14 @@ void gui()
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#src_box_text, #openfile_path);
src_box.size = src_box.pos
= src_box.shift = src_box.shift_old = strlen(#src_box_text);
EditBox_UpdateText(#src_box, #src_box.flags);
}
break;
case BID_DST_OPEN:
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#dst_box_text, #openfile_path);
dst_box.size = dst_box.pos
= dst_box.shift = dst_box.shift_old = strlen(#dst_box_text);
EditBox_UpdateText(#dst_box, #dst_box.flags);
}
break;
case BID_COMPARE:
@ -67,12 +65,12 @@ void gui()
GetKeys();
if (key_scancode == SCAN_CODE_ESC) ExitProcess();
if (key_scancode == SCAN_CODE_TAB) {
if ( src_box.flags & 10b ) {
src_box.flags -= 10b;
dst_box.flags += 10b;
if ( src_box.flags & ed_focus ) {
src_box.flags -= ed_focus;
dst_box.flags += ed_focus;
} else {
src_box.flags += 10b;
dst_box.flags -= 10b;
src_box.flags += ed_focus;
dst_box.flags -= ed_focus;
}
edit_box_draw stdcall (#src_box);
edit_box_draw stdcall (#dst_box);

View File

@ -56,7 +56,7 @@ char save_path_stable[4096];
char open_dir[4096];
edit_box edit_save = {250,25,100,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(save_path),#save_path,0, 0b};
0x10000000,sizeof(save_path)-2,#save_path,0, 0b};
more_less_box delay = { 1, 0, 64, T_DELAY };
checkbox minimize = { T_MINIMIZE, true };

View File

@ -1060,7 +1060,7 @@ void NewElement_Form(byte crt, dword strng)
{
new_element_active = crt;
strcpy(#new_element_name, strng);
new_file_ed.size = new_file_ed.pos = strlen(strng);
EditBox_UpdateText(#new_file_ed, ed_focus+ed_always_focus);
}
if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL);
else DrawEolitePopup(T_CREATE, T_CANCEL);

View File

@ -38,8 +38,8 @@
char path_to_file[4096];
char file_name2[4096];
edit_box file_name_ed = {230,59,32,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2),#file_name2,NULL, 1000000000000000b,2,2};
edit_box path_to_file_ed = {160,120,79,0xffffff,0x94AECE,0xFFFfff,0xffffff,2,sizeof(path_to_file),#path_to_file,NULL, 1000000000000000b,2,2};
edit_box file_name_ed = {230,59,32,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2)-2,#file_name2,NULL, 0b,2,2};
edit_box path_to_file_ed = {160,120,79,0xffffff,0x94AECE,0xFFFfff,0xffffff,2,sizeof(path_to_file)-2,#path_to_file,NULL, 0b,2,2};
BDVK file_info_general;
BDVK file_info_dirsize;
@ -185,7 +185,7 @@ void properties_dialog()
{
GetFileInfo(#file_path, #file_info_general);
strcpy(#file_name2, #file_name);
file_name_ed.size = strlen(#file_name2);
EditBox_UpdateText(#file_name_ed, 0);
if(itdir) dir_size.get(#file_path);
ch_read_only.checked = file_info_general.readonly;
ch_hidden.checked = file_info_general.hidden;

View File

@ -7,13 +7,13 @@ child_window Window_CanvasReSize = {#CanvasReSize_Thread};
// //
//===================================================//
char text_columns[4];
char text_rows[4];
char text_columns[5];
char text_rows[5];
edit_box edit_columns = {60,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(text_columns)-1,#text_columns,0, 1000000000000010b};
edit_box edit_rows = {60,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(text_rows)-1,#text_rows,0, 1000000000000000b};
edit_box edit_columns = {60,NULL,NULL,0xffffff,0x94AECE,0xffc90E,0xffffff,
0x10000000,sizeof(text_columns)-2,#text_columns,0, ed_figure_only+ed_focus};
edit_box edit_rows = {60,NULL,NULL,0xffffff,0x94AECE,0xffc90E,0xffffff,
0x10000000,sizeof(text_rows)-2,#text_rows,0, ed_figure_only};
#define BTN_APPLY 10
@ -23,8 +23,8 @@ void CanvasReSize_Thread()
sprintf(#text_columns, "%i", image.columns);
sprintf(#text_rows, "%i", image.rows);
edit_columns.size = edit_columns.pos = edit_columns.shift = edit_columns.shift_old = strlen(#text_columns);
edit_rows.size = edit_rows.pos = edit_rows.shift = edit_rows.shift_old = strlen(#text_rows);
EditBox_UpdateText(#edit_columns, ed_figure_only+ed_focus);
EditBox_UpdateText(#edit_rows, ed_figure_only);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop() switch(WaitEvent())
@ -94,7 +94,12 @@ void EventApplyClick()
void EventTabClick()
{
if (edit_columns.flags & 0b10) { edit_columns.flags -= 0b10; edit_rows.flags += 0b10; }
else { edit_columns.flags += 0b10; edit_rows.flags -= 0b10; }
if ( edit_columns.flags & ed_focus ) {
EditBox_UpdateText(#edit_columns, ed_figure_only);
EditBox_UpdateText(#edit_rows, ed_focus+ed_figure_only);
} else {
EditBox_UpdateText(#edit_columns, ed_focus+ed_figure_only);
EditBox_UpdateText(#edit_rows, ed_figure_only);
}
DrawEditBoxes();
}

View File

@ -22,7 +22,7 @@ void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
for (i = 0; i < image.columns*image.rows; i++;)
{
image.mas[i] = ESDWORD[i*3+screen_copy] & 0xFFFFFF;
image.mas[i] = ESDWORD[i*3+screen_copy]; // & 0xFFFFFF;
}
DrawCanvas();

View File

@ -86,12 +86,13 @@ PathShow_draw stdcall(#PathShow);
#define ed_focus 10b //focused
#define ed_shift 100b //flag is set when Shift is pressed
#define ed_shift_on 1000b
#define ed_shift_bac 10000b //bif for Shift reset, if set the smth is selected
#define ed_shift_bac 10000b //bit for Shift reset, if set the smth is selected
#define ed_left_fl 100000b
#define ed_offset_fl 1000000b
#define ed_insert 10000000b
#define ed_mouse_on 100000000b
#define ed_mous_adn_b 100011000b
#define ed_mouse_adn_b 100011000b
#define ed_disabled 100000000000b
#define ed_always_focus 100000000000000b
#define ed_figure_only 1000000000000000b //numbers only
#define ed_shift_cl 1111111111100011b
@ -124,10 +125,20 @@ dword width,
cl_curs_y,
shift,
shift_old,
ed_height,
ed_char_width;
height,
char_width;
};
:void EditBox_UpdateText(dword ed, _flags)
{
dword ed_text;
ESI = ed;
ESI.edit_box.offset = ESI.edit_box.shift = ESI.edit_box.shift_old = 0;
ESI.edit_box.flags = _flags;
ed_text = ESI.edit_box.text;
ESI.edit_box.pos = ESI.edit_box.size = strlen(ed_text);
}
struct scroll_bar
{
word size_x,

View File

@ -21,7 +21,7 @@
#include "../lib/obj/libimg.h"
#include "../lib/obj/netcode.h"
#include "../lib/obj/iconv.h"
//patternts
//patterns
#include "../lib/patterns/history.h"
#include "../lib/patterns/http_downloader.h"
//images
@ -119,7 +119,7 @@ void main() {
load_dll(libimg, #libimg_init,1);
load_dll(iconv_lib, #iconv_open,0);
OpenMailDat();
SetEventMask(0x27);
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
LoginBoxLoop();
}

View File

@ -120,7 +120,6 @@ void LoginBoxLoop()
switch(EAX & 0xFF)
{
case evMouse:
if (!CheckActiveProcess(Form.ID)) break;
edit_box_mouse stdcall (#login_box);
edit_box_mouse stdcall (#pass_box);
break;

View File

@ -159,7 +159,6 @@ void MailBoxLoop() {
switch(EAX & 0xFF)
{
case evMouse:
IF (!CheckActiveProcess(Form.ID)) break;
mouse.get();
if (!mouse.lkm) panels_drag=0;

View File

@ -3,33 +3,32 @@
char *text1[] = {"POP server adress:", "POP server port:", "SMTP server adress:", "SMTP server port:", '\0'};
unsigned char POP_server1[128]="pop.server.com";
unsigned char POP_server_port1[5]="110";
unsigned char POP_server_port1[7]="110";
unsigned char SMTP_server1[128]="smtp.server.com";
unsigned char SMTP_server_port1[5]="25";
edit_box POP_server_box = {210,230,125 ,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(POP_server1),#POP_server1,0,100000000000b};
edit_box POP_server_port_box = {210,230,160,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,5,#POP_server_port1,0,100000000000b};
edit_box SMTP_server_box = {210,230,195,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(SMTP_server1),#SMTP_server1,0,100000000000b};
edit_box SMTP_server_port_box = {210,230,230,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,5,#SMTP_server_port1,0,100000000000b};
unsigned char SMTP_server_port1[7]="25";
edit_box POP_server_box = {210,230,125,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(POP_server1)-2,#POP_server1,0,0};
edit_box POP_server_port_box = {210,230,160,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(POP_server_port1)-2,#POP_server_port1,0,0};
edit_box SMTP_server_box = {210,230,195,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(SMTP_server1)-2,#SMTP_server1,0,0};
edit_box SMTP_server_port_box = {210,230,230,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(SMTP_server_port1)-2,#SMTP_server_port1,0,0};
checkbox automatic = { "Automatic configuration", true };
void UpdateEditboxFlags(dword additional_flag)
{
EditBox_UpdateText(#POP_server_box, additional_flag + 0);
EditBox_UpdateText(#POP_server_port_box, additional_flag + ed_figure_only + 0);
EditBox_UpdateText(#SMTP_server_box, additional_flag + 0);
EditBox_UpdateText(#SMTP_server_port_box, additional_flag + ed_figure_only + 0);
}
void SettingsDialog()
{
int key, id;
POP_server_box.size = strlen(#POP_server1);
POP_server_port_box.size = strlen(#POP_server_port1);
SMTP_server_box.size = strlen(#SMTP_server1);
SMTP_server_port_box.size = strlen(#SMTP_server_port1);
int id;
UpdateEditboxFlags(ed_disabled);
goto _OPT_WIN;
loop()
{
switch(WaitEvent())
loop() switch(WaitEvent())
{
case evMouse:
IF (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break;
edit_box_mouse stdcall(#POP_server_box);
edit_box_mouse stdcall(#POP_server_port_box);
edit_box_mouse stdcall(#SMTP_server_box);
@ -43,14 +42,14 @@ void SettingsDialog()
if (automatic.click(id))
{
if (automatic.checked) {
POP_server_box.flags = POP_server_box.flags = POP_server_port_box.flags = SMTP_server_box.flags = SMTP_server_port_box.flags = 100000000000b;
POP_server_box.blur_border_color = POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
UpdateEditboxFlags(ed_disabled);
POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
SMTP_server_box.blur_border_color = SMTP_server_port_box.blur_border_color = 0xCACACA;
}
else {
UpdateEditboxFlags(0);
POP_server_box.flags = 0b10;
POP_server_port_box.flags = SMTP_server_box.flags = SMTP_server_port_box.flags = 0b;
POP_server_box.blur_border_color = POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
SMTP_server_box.blur_border_color = SMTP_server_port_box.blur_border_color = 0xFFFfff;
}
DrawOptionsWindow();
@ -63,11 +62,11 @@ void SettingsDialog()
if (automatic.checked==true) break;
if (key_scancode==SCAN_CODE_TAB)
{
if (POP_server_box.flags & 0b10) { POP_server_box.flags -= 0b10; POP_server_port_box.flags += 0b10; } else
if (POP_server_port_box.flags & 0b10) { POP_server_port_box.flags -= 0b10; SMTP_server_box.flags += 0b10; } else
if (SMTP_server_box.flags & 0b10) { SMTP_server_box.flags -= 0b10; SMTP_server_port_box.flags += 0b10; } else
if (SMTP_server_port_box.flags & 0b10) { SMTP_server_port_box.flags -= 0b10; POP_server_box.flags += 0b10; } else
POP_server_box.flags = 0b10;
if (POP_server_box.flags & ed_focus) { UpdateEditboxFlags(0); POP_server_port_box.flags += ed_focus; } else
if (POP_server_port_box.flags & ed_focus) { UpdateEditboxFlags(0); SMTP_server_box.flags += ed_focus; } else
if (SMTP_server_box.flags & ed_focus) { UpdateEditboxFlags(0); SMTP_server_port_box.flags += ed_focus; } else
if (SMTP_server_port_box.flags & ed_focus) { UpdateEditboxFlags(0); POP_server_box.flags += ed_focus; } else
{ UpdateEditboxFlags(0); POP_server_box.flags = 0b10; }
DrawOptionsWindow();
}
@ -85,7 +84,6 @@ void SettingsDialog()
break;
}
}
}
void DrawOptionsWindow()
{

View File

@ -45,9 +45,9 @@ unsigned char icons[] = FROM "icons.raw";
#define TOPPANELH 68
#define BOTPANELH 26
char new_disk_size[5];
char new_disk_size[7];
edit_box edit_disk_size= {50,0,7,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,
4,#new_disk_size,0, 1000000000000010b};
sizeof(new_disk_size)-2,#new_disk_size,0, ed_focus+ed_figure_only};
void Main_Window()
{
@ -169,7 +169,7 @@ void GetSizeDisk()
fr = GetFreeRAM() / 5 * 2;
fr = itoa(fr / 2048);
strcpy(#new_disk_size, fr);
edit_disk_size.size = edit_disk_size.pos = strlen(#new_disk_size);
EditBox_UpdateText(#edit_disk_size, edit_disk_size.flags);
edit_box_draw stdcall (#edit_disk_size);
}
@ -243,7 +243,7 @@ void DrawTmpDisks()
WriteText(disk_pos_x[i]+27,disk_pos_y[i]+24, 0x80, 0x555555, ConvertSize(disk_sizes[real_id]));
_PutImage(disk_pos_x[i]+6,disk_pos_y[i]+6, 14,14, 2*14*14*3+#icons);
if (selected==i) {
if ( !asm test edit_disk_size.flags, 2) selection_color = selection_active; else selection_color = selection_inactive;
if ( edit_disk_size.flags & ed_focus) selection_color = selection_inactive; else selection_color = selection_active;
DrawWideRectangle(disk_pos_x[i], disk_pos_y[i], 80, 40, 2, selection_color);
PutPixel(disk_pos_x[i], disk_pos_y[i], 0xFFFfff);
}