Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Saturday, October 17, 2026

Diff for tucniak/cuchar/cc_mouse.c between version 1.2 and 1.3

version 1.2, 2005/11/27 20:14:50 version 1.3, 2005/11/29 18:46:31
Line 1 
Line 1 
 /*  /*
   Name: lc_mouse.c    Name: cc_mouse.c
   Author: Michal Sudolsky    Author: Michal Sudolsky <michals@sulysoft.com>
   Date: 22.09.2005 16:12    Date: 22.09.2005 16:12
 */  */
 // modified by Juraj Kolesar <koli@koli.sk>  // modified by Juraj Kolesar <koli@koli.sk>
Line 20  bool eventq=false;
Line 20  bool eventq=false;
 pthread_t gpmthreadp;  pthread_t gpmthreadp;
 WIN *lastfocused=NULL;  WIN *lastfocused=NULL;
   
   void setlistactiveitem(LIST *list,long old,long new)
   {
     if(new==old)return;
     if(new==-1)list->activeitem=NULL;
     else
     {
       if(old==-1)list->activeitem=g_list_nth(list->lines,new);
       else
       {
         if(new>old)
           while(new>old)
           {
             list->activeitem=g_list_next(list->activeitem);
             old++;
           }
         else
           while(old>new)
           {
             list->activeitem=g_list_previous(list->activeitem);
             new++;
           }
       }
     }
   }
   
 void buttondoubletimer(TIMER *sender)  void buttondoubletimer(TIMER *sender)
 {  {
   redraw();    redraw();
Line 453  bool dosendmousemessage(WIN *p,long vx,l
Line 478  bool dosendmousemessage(WIN *p,long vx,l
       case MM_MOUSEMOVE:        case MM_MOUSEMOVE:
       if(capturewin==p)        if(capturewin==p)
       {        {
         long actline=list->activeline;          actline=list->activeline;
         if((list->combotyp!=CT_COMBO)||((list->combotyp==CT_COMBO)&&(stat==1)))list->activeline=y-1+vscroll->pos;          if((list->combotyp!=CT_COMBO)||((list->combotyp==CT_COMBO)&&(stat==1)))list->activeline=y-1+vscroll->pos;
         list->exvscroll=EX_NONE;          list->exvscroll=EX_NONE;
         list->exhscroll=EX_NONE;          list->exhscroll=EX_NONE;
Line 464  bool dosendmousemessage(WIN *p,long vx,l
Line 489  bool dosendmousemessage(WIN *p,long vx,l
           if(x<1)if(stat>=1)list->exhscroll=EX_UP;            if(x<1)if(stat>=1)list->exhscroll=EX_UP;
           if(x>=p->vx-2)if(stat>=1)list->exhscroll=EX_DOWN;            if(x>=p->vx-2)if(stat>=1)list->exhscroll=EX_DOWN;
         }          }
         if((list->activeline!=actline)&&(list->change!=NULL))list->change(p);          if(list->activeline!=actline)
           {
             setlistactiveitem(list,actline,list->activeline);
             if(list->change!=NULL)list->change(p);
           }
         chang=true;          chang=true;
       }        }
       break;        break;
       case MM_LBUTTONDOWN:        case MM_LBUTTONDOWN:
       list->exvscroll=EX_NONE;        list->exvscroll=EX_NONE;
       list->exhscroll=EX_NONE;        list->exhscroll=EX_NONE;
         actline=list->activeline;
       if(list->combotyp!=CT_COMBO)        if(list->combotyp!=CT_COMBO)
       {        {
         if((found==p)&&inrect(1,1,p->vx-2,p->vy-2,x,y))          if((found==p)&&inrect(1,1,p->vx-2,p->vy-2,x,y))
Line 481  bool dosendmousemessage(WIN *p,long vx,l
Line 511  bool dosendmousemessage(WIN *p,long vx,l
           list->activeline=y-1+vscroll->pos;            list->activeline=y-1+vscroll->pos;
           if(list->activeline<minpoz)list->activeline=minpoz;            if(list->activeline<minpoz)list->activeline=minpoz;
           if(list->activeline>maxpoz)list->activeline=maxpoz;            if(list->activeline>maxpoz)list->activeline=maxpoz;
             setlistactiveitem(list,actline,list->activeline);
         }          }
       }        }
       else        else
Line 499  bool dosendmousemessage(WIN *p,long vx,l
Line 530  bool dosendmousemessage(WIN *p,long vx,l
               list->activeline=y-1+vscroll->pos;                list->activeline=y-1+vscroll->pos;
               if(list->activeline<minpoz)list->activeline=minpoz;                if(list->activeline<minpoz)list->activeline=minpoz;
               if(list->activeline>maxpoz)list->activeline=maxpoz;                if(list->activeline>maxpoz)list->activeline=maxpoz;
                 setlistactiveitem(list,actline,list->activeline);
             }              }
           }            }
           else            else
Line 518  bool dosendmousemessage(WIN *p,long vx,l
Line 550  bool dosendmousemessage(WIN *p,long vx,l
       }        }
       break;        break;
       case MM_LBUTTONUP:        case MM_LBUTTONUP:
         actline=list->activeline;
       if(list->combotyp==CT_COMBO)        if(list->combotyp==CT_COMBO)
       {        {
         long act;          long act;
Line 526  bool dosendmousemessage(WIN *p,long vx,l
Line 559  bool dosendmousemessage(WIN *p,long vx,l
         {          {
           act=y-1+vscroll->pos;            act=y-1+vscroll->pos;
           if((act>=minpoz)&&(act<=maxpoz))list->activeline=act;            if((act>=minpoz)&&(act<=maxpoz))list->activeline=act;
             setlistactiveitem(list,actline,list->activeline);
         }          }
         else          else
         {          {
Line 549  bool dosendmousemessage(WIN *p,long vx,l
Line 583  bool dosendmousemessage(WIN *p,long vx,l
             if((found==p)&&inrect(1,1,p->vx-2,p->vy-2,x,y))              if((found==p)&&inrect(1,1,p->vx-2,p->vy-2,x,y))
             {              {
               if((list->combotyp==CT_COMBO)&&(p->parent!=NULL)&&                if((list->combotyp==CT_COMBO)&&(p->parent!=NULL)&&
                  (p->parent->extra->type==TP_COMBO))                   (p->parent->extra->type==TP_COMBO)&&(list->activeitem!=NULL))
               {                {
                 combo=&p->parent->extra->combo;                  combo=&p->parent->extra->combo;
                 char *data=g_list_nth_data(list->lines,list->activeline);                  char *data=list->activeitem->data;
                 set_text(combo->edit,data);                  set_text(combo->edit,data);
               }                }
               if(list->dblclk!=NULL)list->dblclk(p);                if(list->dblclk!=NULL)list->dblclk(p);
Line 567  bool dosendmousemessage(WIN *p,long vx,l
Line 601  bool dosendmousemessage(WIN *p,long vx,l
         if((found==p)&&inrect(1,1,p->vx-2,p->vy-2,x,y))          if((found==p)&&inrect(1,1,p->vx-2,p->vy-2,x,y))
         {          {
           if((list->combotyp==CT_COMBO)&&(p->parent!=NULL)&&            if((list->combotyp==CT_COMBO)&&(p->parent!=NULL)&&
              (p->parent->extra->type==TP_COMBO))               (p->parent->extra->type==TP_COMBO)&&(list->activeitem!=NULL))
           {            {
             combo=&p->parent->extra->combo;              combo=&p->parent->extra->combo;
             char *data=g_list_nth_data(list->lines,list->activeline);              char *data=list->activeitem->data;
             set_text(combo->edit,data);              set_text(combo->edit,data);
           }            }
           if(list->dblclk!=NULL)list->dblclk(p);            if(list->dblclk!=NULL)list->dblclk(p);
Line 597  bool dosendmousemessage(WIN *p,long vx,l
Line 631  bool dosendmousemessage(WIN *p,long vx,l
       combo->pushed=SC_DOWN;        combo->pushed=SC_DOWN;
       list=&combo->list->extra->list;        list=&combo->list->extra->list;
       vscroll=&list->vscroll->extra->scroll;        vscroll=&list->vscroll->extra->scroll;
         long actline=list->activeline;
       list->activeline=combo->activeline;        list->activeline=combo->activeline;
       if(list->activeline<vscroll->pos)vscroll->pos=list->activeline;        if(list->activeline<vscroll->pos)vscroll->pos=list->activeline;
       if(list->activeline-combo->list->vy+3>vscroll->pos)vscroll->pos=list->activeline-combo->list->vy+3;        if(list->activeline-combo->list->vy+3>vscroll->pos)vscroll->pos=list->activeline-combo->list->vy+3;
         setlistactiveitem(list,actline,list->activeline);
       show_win(combo->list,true);        show_win(combo->list,true);
       break;        break;
       case MM_LBUTTONUP:        case MM_LBUTTONUP:

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top