forked from KolibriOS/kolibrios
@menu: return to orthodox flat design
git-svn-id: svn://kolibrios.org@7786 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a385ed42e0
commit
4ad25a75b3
@ -150,18 +150,22 @@ byte cmd_free=0;
|
||||
#include "include\properties.h"
|
||||
#include "include\breadcrumbs.h"
|
||||
|
||||
void main()
|
||||
void load_libraries()
|
||||
{
|
||||
dword id;
|
||||
byte count_sl = 0;
|
||||
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
||||
char stats;
|
||||
rand_n = random(40);
|
||||
|
||||
load_dll(boxlib, #box_lib_init,0);
|
||||
load_dll(libini, #lib_init,1);
|
||||
load_dll(libio, #libio_init,1);
|
||||
load_dll(libimg, #libimg_init,1);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
dword id;
|
||||
byte count_sl = 0;
|
||||
|
||||
rand_n = random(40);
|
||||
|
||||
load_libraries();
|
||||
|
||||
SetAppColors();
|
||||
LoadIniSettings();
|
||||
@ -182,12 +186,9 @@ void main()
|
||||
{
|
||||
if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end
|
||||
|
||||
if (dir_exists(#param)==true)
|
||||
{
|
||||
if (dir_exists(#param)) {
|
||||
strcpy(#path, #param);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
notify(T_NOTIFY_APP_PARAM_WRONG);
|
||||
}
|
||||
}
|
||||
@ -196,8 +197,7 @@ void main()
|
||||
strcpy(#inactive_path, #path);
|
||||
llist_copy(#files_inactive, #files);
|
||||
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
||||
loop(){
|
||||
switch(WaitEventTimeout(50))
|
||||
loop() switch(WaitEventTimeout(50))
|
||||
{
|
||||
case evMouse:
|
||||
if (del_active) || (Form.status_window>2) break;
|
||||
@ -209,47 +209,8 @@ void main()
|
||||
|
||||
mouse.get();
|
||||
|
||||
if (!mouse.mkm) && (stats>0) stats = 0;
|
||||
if (mouse.mkm) && (!stats)
|
||||
{
|
||||
x_old = mouse.x;
|
||||
y_old = mouse.y;
|
||||
stats = 1;
|
||||
}
|
||||
if (mouse.mkm) && (stats==1)
|
||||
{
|
||||
dif_x = mouse.x-x_old;
|
||||
dif_y = mouse.y-y_old;
|
||||
adif_x = fabs(dif_x);
|
||||
adif_y = fabs(dif_y);
|
||||
ProceedMouseGestures();
|
||||
|
||||
if (adif_x>adif_y)
|
||||
{
|
||||
if (dif_x > 150)
|
||||
{
|
||||
if (history.forward())
|
||||
{
|
||||
strcpy(#path, history.current());
|
||||
files.KeyHome();
|
||||
Open_Dir(#path,WITH_REDRAW);
|
||||
}
|
||||
stats = 0;
|
||||
}
|
||||
if (dif_x < -150)
|
||||
{
|
||||
GoBack();
|
||||
stats = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dif_y < -100)
|
||||
{
|
||||
Dir_Up();
|
||||
stats = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (files.MouseOver(mouse.x, mouse.y))
|
||||
{
|
||||
//select file
|
||||
@ -336,7 +297,7 @@ void main()
|
||||
}
|
||||
}
|
||||
break;
|
||||
//Button pressed-----------------------------------------------------------------------------
|
||||
//Button pressed-----------------------------------------------------------------------------
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
|
||||
@ -361,15 +322,10 @@ void main()
|
||||
Clipboard__CopyText(#path);
|
||||
break;
|
||||
case 21: //Back
|
||||
GoBack();
|
||||
EventHistoryGoBack();
|
||||
break;
|
||||
case 22: //Forward
|
||||
if (history.forward())
|
||||
{
|
||||
strcpy(#path, history.current());
|
||||
files.KeyHome();
|
||||
Open_Dir(#path,WITH_REDRAW);
|
||||
}
|
||||
EventHistoryGoForward();
|
||||
break;
|
||||
case 23:
|
||||
Dir_Up();
|
||||
@ -401,7 +357,7 @@ void main()
|
||||
}
|
||||
break;
|
||||
|
||||
//Key pressed-----------------------------------------------------------------------------
|
||||
//Key pressed-----------------------------------------------------------------------------
|
||||
case evKey:
|
||||
GetKeys();
|
||||
|
||||
@ -486,7 +442,7 @@ void main()
|
||||
switch (key_scancode)
|
||||
{
|
||||
case SCAN_CODE_BS:
|
||||
//GoBack();
|
||||
//EventHistoryGoBack();
|
||||
Dir_Up();
|
||||
break;
|
||||
case SCAN_CODE_ENTER:
|
||||
@ -545,7 +501,6 @@ void main()
|
||||
else if(cmd_free==6) delete_stak=free(delete_stak);
|
||||
cmd_free = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void draw_window()
|
||||
@ -817,7 +772,7 @@ void Open_Dir(dword dir_path, redraw){
|
||||
if (errornum)
|
||||
{
|
||||
history.add(#path);
|
||||
GoBack();
|
||||
EventHistoryGoBack();
|
||||
Write_Error(errornum);
|
||||
return;
|
||||
}
|
||||
@ -973,7 +928,7 @@ void Open(byte rez)
|
||||
}
|
||||
}
|
||||
|
||||
inline fastcall void GoBack()
|
||||
inline fastcall void EventHistoryGoBack()
|
||||
{
|
||||
char cur_folder[4096];
|
||||
strcpy(#cur_folder, #path);
|
||||
@ -1091,26 +1046,22 @@ void FnProcess(byte N)
|
||||
switch(N)
|
||||
{
|
||||
case 1:
|
||||
if (!active_about)
|
||||
{
|
||||
if (!active_about) {
|
||||
about_stak = malloc(4096);
|
||||
about_thread_id = CreateThread(#about_dialog,about_stak+4092);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ActivateWindow(GetProcessSlot(about_thread_id));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!files.count) break;
|
||||
NewElement_Form(RENAME_ITEM, #file_name);
|
||||
if (files.count) NewElement_Form(RENAME_ITEM, #file_name);
|
||||
break;
|
||||
case 3:
|
||||
if (!itdir) RunProgram("/sys/tinypad", #file_path);
|
||||
if (files.count) && (!itdir) RunProgram("/sys/tinypad", #file_path);
|
||||
break;
|
||||
case 4:
|
||||
if (!itdir) RunProgram("/sys/develop/heed", #file_path);
|
||||
if (files.count) && (!itdir) RunProgram("/sys/develop/heed", #file_path);
|
||||
break;
|
||||
case 5: //refresh cur dir & devs
|
||||
if (two_panels.checked)
|
||||
@ -1238,4 +1189,49 @@ void EventSort(dword id)
|
||||
SelectFileByName(#selected_filename);
|
||||
}
|
||||
|
||||
void EventHistoryGoForward()
|
||||
{
|
||||
if (history.forward()) {
|
||||
strcpy(#path, history.current());
|
||||
files.KeyHome();
|
||||
Open_Dir(#path,WITH_REDRAW);
|
||||
}
|
||||
}
|
||||
|
||||
void ProceedMouseGestures()
|
||||
{
|
||||
char stats;
|
||||
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
||||
if (!mouse.mkm) && (stats>0) stats = 0;
|
||||
if (mouse.mkm) && (!stats)
|
||||
{
|
||||
x_old = mouse.x;
|
||||
y_old = mouse.y;
|
||||
stats = 1;
|
||||
}
|
||||
if (mouse.mkm) && (stats==1)
|
||||
{
|
||||
dif_x = mouse.x-x_old;
|
||||
dif_y = mouse.y-y_old;
|
||||
adif_x = fabs(dif_x);
|
||||
adif_y = fabs(dif_y);
|
||||
|
||||
if (adif_x>adif_y) {
|
||||
if (dif_x > 150) {
|
||||
EventHistoryGoForward();
|
||||
stats = 0;
|
||||
}
|
||||
if (dif_x < -150) {
|
||||
EventHistoryGoBack();
|
||||
stats = 0;
|
||||
}
|
||||
} else {
|
||||
if (dif_y < -100) {
|
||||
Dir_Up();
|
||||
stats = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stop:
|
||||
|
@ -5,8 +5,8 @@ struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.work_3d_dark dd ?
|
||||
.work_3d_light dd ?
|
||||
.work_dark dd ?
|
||||
.work_light dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
|
@ -5,8 +5,8 @@ struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.work_3d_dark dd ?
|
||||
.work_3d_light dd ?
|
||||
.work_dark dd ?
|
||||
.work_light dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
|
@ -5,8 +5,8 @@ struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.work_3d_dark dd ?
|
||||
.work_3d_light dd ?
|
||||
.work_dark dd ?
|
||||
.work_light dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
|
@ -28,8 +28,8 @@ align 4
|
||||
app_colours:
|
||||
w_frame dd ?
|
||||
w_grab dd ?
|
||||
w_work_3d_dark dd ?
|
||||
w_work_3d_light dd ?
|
||||
w_work_dark dd ?
|
||||
w_work_light dd ?
|
||||
w_grab_text dd ?
|
||||
w_work dd ?
|
||||
w_work_button dd ?
|
||||
|
@ -3207,8 +3207,8 @@ app_colours:
|
||||
|
||||
w_frame rd 1
|
||||
w_grab rd 1
|
||||
w_work_3d_dark rd 1
|
||||
w_work_3d_light rd 1
|
||||
w_work_dark rd 1
|
||||
w_work_light rd 1
|
||||
w_grab_text rd 1
|
||||
w_work rd 1
|
||||
w_work_button rd 1
|
||||
|
@ -47,7 +47,7 @@ inline fastcall void GetProcessInfo(dword EBX, ECX)
|
||||
}
|
||||
|
||||
struct system_colors{
|
||||
dword frame,grab,work_3d_dark,work_3d_light,grab_text,work,work_button,work_button_text,work_text,work_graph;
|
||||
dword frame,grab,work_dark,work_light,grab_text,work,work_button,work_button_text,work_text,work_graph;
|
||||
void get();
|
||||
};
|
||||
|
||||
|
@ -73,8 +73,8 @@ struct SystemColours
|
||||
{
|
||||
dword nonset1,
|
||||
nonset2,
|
||||
work_3d_dark,
|
||||
work_3d_light,
|
||||
work_dark,
|
||||
work_light,
|
||||
w_title,
|
||||
w_work,
|
||||
w_work_button,
|
||||
|
@ -1,3 +1,12 @@
|
||||
BT_DEL equ 0x80000000
|
||||
BT_HIDE equ 0x40000000
|
||||
BT_NOFRAME equ 0x20000000
|
||||
|
||||
macro DefineButton x, y, w, h, id, background_color
|
||||
{
|
||||
mcall 8, (x) shl 16 + (w), (y) shl 16 + (h), id, background_color
|
||||
}
|
||||
|
||||
macro DrawBar x, y, width, height, color
|
||||
{
|
||||
mcall 13, (x) shl 16 + (width), (y) shl 16 + (height), color
|
||||
@ -39,11 +48,3 @@ macro WriteTextBold x, y, fontType, color, text
|
||||
mcall
|
||||
}
|
||||
|
||||
BT_DEL equ 0x80000000
|
||||
BT_HIDE equ 0x40000000
|
||||
BT_NOFRAME equ 0x20000000
|
||||
|
||||
macro DefineButton x, y, w, h, id, background_color
|
||||
{
|
||||
mcall 8, (x) shl 16 + (w), (y) shl 16 + (h), id, background_color
|
||||
}
|
||||
|
@ -469,8 +469,8 @@ ends
|
||||
struct system_colors
|
||||
frame dd ? ;nonset1
|
||||
grab dd ? ;nonset2
|
||||
work_3d_dark dd ?
|
||||
work_3d_light dd ?
|
||||
work_dark dd ?
|
||||
work_light dd ?
|
||||
grab_text dd ? ;window_title
|
||||
work dd ?
|
||||
work_button dd ?
|
||||
|
@ -224,8 +224,8 @@ struc sys_color_table
|
||||
{
|
||||
.frames: dd ? ;+0
|
||||
.grab: dd ? ;+4
|
||||
.work_3d_dark: dd ? ;+8
|
||||
.work_3d_light: dd ? ;+12
|
||||
.work_dark: dd ? ;+8
|
||||
.work_light: dd ? ;+12
|
||||
.grab_text: dd ? ;+16
|
||||
.work: dd ? ;+20
|
||||
.work_button: dd ?;+24
|
||||
|
@ -59,8 +59,8 @@ window:
|
||||
sc:
|
||||
.frames dd 0
|
||||
.grab dd 0
|
||||
.work_3d_dark dd 0
|
||||
.work_3d_light dd 0
|
||||
.work_dark dd 0
|
||||
.work_light dd 0
|
||||
.grab_text dd 0
|
||||
.work dd 0
|
||||
.work_button dd 0
|
||||
|
@ -715,7 +715,7 @@ next_button:
|
||||
cmp [edx], byte 'x'
|
||||
jne next_line
|
||||
|
||||
DrawRectangle3D DISPLAY_X-1,DISPLAY_Y-1,DISPLAY_W+2,DISPLAY_H+2, [sc.work_3d_dark], [sc.work_3d_light]
|
||||
DrawRectangle3D DISPLAY_X-1,DISPLAY_Y-1,DISPLAY_W+2,DISPLAY_H+2, [sc.work_dark], [sc.work_light]
|
||||
DrawRectangle DISPLAY_X,DISPLAY_Y,DISPLAY_W,DISPLAY_H, [sc.work_graph]
|
||||
mcall 38, < DISPLAY_X+1, DISPLAY_W+DISPLAY_X-1>, <DISPLAY_Y+1, DISPLAY_Y+1>, 0xE0E0E0 ; internal shadow
|
||||
mcall , < DISPLAY_X+1, DISPLAY_X+1>, <DISPLAY_Y+2, DISPLAY_Y+DISPLAY_H-1>, ; internal shadow
|
||||
|
@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm -m 16384 menu.asm @menu
|
||||
@kpack @menu
|
||||
@erase lang.inc
|
||||
@pause
|
@ -21,6 +21,7 @@
|
||||
; Compile with FASM for Menuet
|
||||
;******************************************************************************
|
||||
BTN_HEIGHT = 22
|
||||
BTN_WIDTH = 140
|
||||
TXT_Y = (BTN_HEIGHT)/2-4
|
||||
|
||||
PANEL_HEIGHT = 20
|
||||
@ -39,8 +40,8 @@
|
||||
dd bootparam ; boot parameters
|
||||
dd 0x0 ; path
|
||||
;------------------------------------------------------------------------------
|
||||
include "lang.inc"
|
||||
include "..\..\..\macros.inc"
|
||||
include "..\..\..\gui_patterns.inc"
|
||||
;include "../../../debug.inc" ; debug macros
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
@ -475,7 +476,7 @@ mouse: ; MOUSE EVENT HANDLER
|
||||
jnz click
|
||||
mcall 37,1
|
||||
ror eax,16 ; eax = [ Y | X ] relative to window
|
||||
cmp ax,140 ; pointer in window?
|
||||
cmp ax,BTN_WIDTH ; pointer in window?
|
||||
ja noinwindow
|
||||
; *** in window ***
|
||||
shr eax,16 ; eax = [ 0 | Y ]
|
||||
@ -722,10 +723,11 @@ align 4
|
||||
.1:
|
||||
shl ecx,16
|
||||
add ecx,eax ; ecx = [ Y_START | Y_SIZE ]
|
||||
dec ecx
|
||||
|
||||
movzx ebx,[edi + x_start]
|
||||
shl ebx,16
|
||||
mov bx,140 ; ebx = [ X_START | X_SIZE ]
|
||||
mov bx,BTN_WIDTH ; ebx = [ X_START | X_SIZE ]
|
||||
mov edx,0x01000000 ; color of work area RRGGBB,8->color gl
|
||||
mov esi,edx ; unmovable window
|
||||
|
||||
@ -788,9 +790,10 @@ draw_one_button:
|
||||
; receives number of button in dl
|
||||
push edx
|
||||
mov eax,8
|
||||
mov ebx,140
|
||||
mov ebx,BTN_WIDTH
|
||||
movzx ecx,dl
|
||||
imul ecx,BTN_HEIGHT
|
||||
mov [draw_y], ecx
|
||||
shl ecx,16
|
||||
add ecx,BTN_HEIGHT
|
||||
; edx = button identifier
|
||||
@ -798,6 +801,7 @@ draw_one_button:
|
||||
cmp esi,0xdfdfdf
|
||||
jb nocorrect
|
||||
sub esi,0x1b1b1b
|
||||
|
||||
;--------------------------------------
|
||||
align 4
|
||||
nocorrect:
|
||||
@ -808,12 +812,24 @@ nocorrect:
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.nohighlight:
|
||||
or edx,0x20000000
|
||||
or edx,BT_NOFRAME + BT_HIDE
|
||||
; dunkaist[
|
||||
add edx,0xd1ff00 ; This makes first menu buttons differ
|
||||
; from system close button with 0x000001 id
|
||||
; dunkaist]
|
||||
mcall
|
||||
pusha
|
||||
|
||||
mov edx, esi
|
||||
mcall 13
|
||||
|
||||
mcall , BTN_WIDTH, <[draw_y],1>, [sc.work_light]
|
||||
mcall , 1, <[draw_y],BTN_HEIGHT>
|
||||
mcall , <BTN_WIDTH,1>, <[draw_y],BTN_HEIGHT+1>, [sc.work_dark]
|
||||
add [draw_y], BTN_HEIGHT-1
|
||||
mcall , BTN_WIDTH, <[draw_y],1>
|
||||
|
||||
popa
|
||||
movzx edx,dl
|
||||
dec dl
|
||||
imul ebx,edx,BTN_HEIGHT
|
||||
@ -911,6 +927,8 @@ screen_size:
|
||||
.y dw ?
|
||||
.x dw ?
|
||||
;--------------------------------------
|
||||
draw_y dd ?
|
||||
;--------------------------------------
|
||||
x_working_area:
|
||||
.right: dw ?
|
||||
.left: dw ?
|
||||
|
@ -359,7 +359,7 @@ draw_window:
|
||||
m2m dword [frame_data.font_backgr_color],[sc.work]
|
||||
m2m dword [frame_data.font_color],[sc.work_text]
|
||||
m2m dword [frame_data.ext_fr_col],[sc.work_graph]
|
||||
m2m dword [frame_data.int_fr_col],[sc.work_3d_light]
|
||||
m2m dword [frame_data.int_fr_col],[sc.work_light]
|
||||
|
||||
push dword frame_data
|
||||
call [Frame_draw]
|
||||
|
@ -33,8 +33,8 @@ app_colours:
|
||||
|
||||
w_frame dd ?
|
||||
w_grab dd ?
|
||||
w_work_3d_dark dd ?
|
||||
w_work_3d_light dd ?
|
||||
w_work_dark dd ?
|
||||
w_work_light dd ?
|
||||
w_grab_text dd ?
|
||||
w_work dd ?
|
||||
w_work_button dd ?
|
||||
|
Loading…
Reference in New Issue
Block a user