CMM: mouse: new event drag

git-svn-id: svn://kolibrios.org@5657 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2015-08-02 23:43:40 +00:00
parent b8267310e8
commit db3c02d4c3
2 changed files with 30 additions and 18 deletions

View File

@ -189,13 +189,13 @@ void main()
if (param)
{
tmp = strlen(#path);
strncpy(#path, #param, tmp);
strlcpy(#path, #param, tmp);
$dec tmp
if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string
}
else
{
strncpy(#path, "/rd/1/", 6);
strlcpy(#path, "/rd/1/", 6);
}
Open_Dir(#path,ONLY_OPEN);
SetEventMask(1100111b);
@ -213,7 +213,7 @@ void main()
mouse.get();
if (!mouse.mkm) && (stats>0) stats = 0;
if (mouse.mkm) && (stats==0)
if (mouse.mkm) && (!stats)
{
x_old = mouse.x;
y_old = mouse.y;
@ -252,7 +252,7 @@ void main()
}
}
}
if (files.MouseOver(mouse.x, mouse.y))&&((mouse.up)||(mouse.down)||(mouse.dblclick))
if (files.MouseOver(mouse.x, mouse.y))&&((mouse.down)||(mouse.dblclick))
{
//select/open file {
if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
@ -263,7 +263,7 @@ void main()
if (files.current!=id)
{
mouse.clearTime();
if (id<files.visible) List_Current(id-files.current);
if(id<files.visible) List_Current(id-files.current);
}
else if(mouse.dblclick)Open(0);
}

View File

@ -4,7 +4,6 @@
#startaddress 0
#code32 TRUE
char os_name[8] = {'M','E','N','U','E','T','0','1'};
dword os_version = 0x00000001;
dword start_addr = #______INIT______;
@ -93,12 +92,13 @@ char program_path[4096];
* move - event MOUSE movements
* click - when clicked
* dblclick - double-click the default 50 (500 ms)
* drag - drag the element event
*/
:dword __TMP_TIME,MOUSE_TIME;
:struct MOUSE
{
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top;
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top;
dword handle,_;
byte cmd;
void clearTime();
@ -203,14 +203,26 @@ char program_path[4096];
mkm = ECX;
//when you release the MOUSE button
// Mouse Move Event
if(xx!=x)||(yy!=y)
{
move = true;
xx = x;
yy = y;
}
else move = false;
// Mouse Up Event
if((cmd)&&!(key)){
up = true;
if(cmd)&&(!key){
up = true;
down = false;
drag = false;
if(!move) click = true;
move = false;
__TMP_TIME = GetStartTime();
if(__TMP_TIME-tmp_time<=MOUSE_TIME){ dblclick = true;click = false; }
if(__TMP_TIME-tmp_time<=MOUSE_TIME)
{
dblclick = true;
click = false;
}
tmp_time = __TMP_TIME;
//returns the key code
key = tmp;
@ -224,20 +236,20 @@ char program_path[4096];
//when you press the MOUSE button
// Mouse Down Event/Move Event
else {
else
{
up = false;
click = false;
dblclick = false;
down = false;
// Mouse Move Event
if((xx!=x)||(yy!=y))
if(key)if(!cmd)
{
move = true;
xx = x;
yy = y;
down = true;
if(move)drag = true;
cmd = true;
tmp=key;
}
else move = false;
if(key)if(!cmd) {down = true;cmd = true;tmp=key;}
}
//scroll