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

Diff for tucniak/cuchar/cc_user.c between version 1.3 and 1.4

version 1.3, 2005/11/29 18:46:32 version 1.4, 2005/12/01 18:52:29
Line 518  void edit_paste(WIN *edit)
Line 518  void edit_paste(WIN *edit)
   for(j=0;j<clen;j++)ed->text[j+i]=clipboard[j];    for(j=0;j<clen;j++)ed->text[j+i]=clipboard[j];
   ed->maskpos=-1;    ed->maskpos=-1;
   ed->curpos=i+clen;    ed->curpos=i+clen;
   redraw();    redrawclientwin(edit);
 }  }
   
 void edit_delete(WIN *edit)  void edit_delete(WIN *edit)
Line 547  void edit_delete(WIN *edit)
Line 547  void edit_delete(WIN *edit)
   ed->text[len-l]='\0';    ed->text[len-l]='\0';
   ed->maskpos=-1;    ed->maskpos=-1;
   ed->curpos=i;    ed->curpos=i;
   redraw();    redrawclientwin(edit);
 }  }
   
 void edit_cut(WIN *edit)  void edit_cut(WIN *edit)
Line 573  void edit_select(WIN *edit,long sta,long
Line 573  void edit_select(WIN *edit,long sta,long
     if(end>len)end=len;      if(end>len)end=len;
   ed->maskpos=sta;    ed->maskpos=sta;
   ed->curpos=end;    ed->curpos=end;
   redraw();    redrawclientwin(edit);
 }  }
   
 void edit_get_selection(WIN *edit,long *sta,long *end)  void edit_get_selection(WIN *edit,long *sta,long *end)
Line 641  void add_menu_item(WIN *menu,CMENU *cmen
Line 641  void add_menu_item(WIN *menu,CMENU *cmen
   p->shortcut=cmenu->shortcut;    p->shortcut=cmenu->shortcut;
   p->submenu=cmenu->submenu;    p->submenu=cmenu->submenu;
   menu->extra->menu.lines=g_list_append(menu->extra->menu.lines,p);    menu->extra->menu.lines=g_list_append(menu->extra->menu.lines,p);
   if(isvisible(menu))redraw();    redraw();
 }  }
   
 void ins_menu_item(WIN *menu,long pos,CMENU *cmenu)  void ins_menu_item(WIN *menu,long pos,CMENU *cmenu)
Line 654  void ins_menu_item(WIN *menu,long pos,CM
Line 654  void ins_menu_item(WIN *menu,long pos,CM
   p->shortcut=cmenu->shortcut;    p->shortcut=cmenu->shortcut;
   p->submenu=cmenu->submenu;    p->submenu=cmenu->submenu;
   menu->extra->menu.lines=g_list_insert(menu->extra->menu.lines,p,pos);    menu->extra->menu.lines=g_list_insert(menu->extra->menu.lines,p,pos);
   if(isvisible(menu))redraw();    redraw();
 }  }
   
 void set_menu_item(WIN *menu,long pos,CMENU *cmenu)  void set_menu_item(WIN *menu,long pos,CMENU *cmenu)
Line 671  void set_menu_item(WIN *menu,long pos,CM
Line 671  void set_menu_item(WIN *menu,long pos,CM
   p->text=cmenu->text;    p->text=cmenu->text;
   p->shortcut=cmenu->shortcut;    p->shortcut=cmenu->shortcut;
   p->submenu=cmenu->submenu;    p->submenu=cmenu->submenu;
   if(isvisible(menu))redraw();    redrawclientwin(menu);
 }  }
   
 void get_menu_item(WIN *menu,long pos,CMENU *cmenu)  void get_menu_item(WIN *menu,long pos,CMENU *cmenu)
Line 688  void get_menu_item(WIN *menu,long pos,CM
Line 688  void get_menu_item(WIN *menu,long pos,CM
   cmenu->text=p->text;    cmenu->text=p->text;
   cmenu->shortcut=p->shortcut;    cmenu->shortcut=p->shortcut;
   cmenu->submenu=p->submenu;    cmenu->submenu=p->submenu;
   if(isvisible(menu))redraw();  
 }  }
   
 void del_menu_item(WIN *menu,long pos)  void del_menu_item(WIN *menu,long pos)
Line 700  void del_menu_item(WIN *menu,long pos)
Line 699  void del_menu_item(WIN *menu,long pos)
   if(lines==NULL)return;    if(lines==NULL)return;
   pmenu->lines=g_list_remove(pmenu->lines,lines->data);    pmenu->lines=g_list_remove(pmenu->lines,lines->data);
   free(lines->data);    free(lines->data);
   if(isvisible(menu))redraw();    redraw();
 }  }
   
 void set_api_run(bool run)  void set_api_run(bool run)
Line 726  WIN *get_capture()
Line 725  WIN *get_capture()
   
 bool set_focus(WIN *win)  bool set_focus(WIN *win)
 {  {
   if(win==NULL){focuswin=NULL;redraw();return false;}    if(win==NULL)
     {
       WIN *p=focuswin;
       focuswin=NULL;
       redrawclientwin(p);
       return false;
     }
   while(win!=NULL)    while(win!=NULL)
   {    {
     if(isactive(win)&&((win->extra->type==TP_EDIT)||((win->extra->type==TP_BUTTON)&&(win->extra->button.hasfocus))||      if(isactive(win)&&((win->extra->type==TP_EDIT)||((win->extra->type==TP_BUTTON)&&(win->extra->button.hasfocus))||
Line 903  void set_text(WIN *win,char *text)
Line 908  void set_text(WIN *win,char *text)
     win->extra->edit.text=er;      win->extra->edit.text=er;
     win->extra->edit.maskpos=-1;      win->extra->edit.maskpos=-1;
     strcpy((char*)win->extra->edit.text,(const char*)text);      strcpy((char*)win->extra->edit.text,(const char*)text);
     redraw();      redrawclientwin(win);
   }    }
   else if(win->extra->type==TP_TEXT)    else if(win->extra->type==TP_TEXT)
   {    {
     win->extra->text.text=text;      win->extra->text.text=text;
     redraw();      redrawclientwin(win);
   }    }
   else if((win->extra->type==TP_COMBO)&&(win->extra->combo.edit!=NULL))    else if((win->extra->type==TP_COMBO)&&(win->extra->combo.edit!=NULL))
   {    {
Line 917  void set_text(WIN *win,char *text)
Line 922  void set_text(WIN *win,char *text)
   else if(win->extra->type==TP_DIALOG)    else if(win->extra->type==TP_DIALOG)
   {    {
     win->extra->dialog.caption=text;      win->extra->dialog.caption=text;
     redraw();      redrawclientwin(win);
   }    }
 }  }
   
Line 944  void set_pos(WIN *win,long pos)
Line 949  void set_pos(WIN *win,long pos)
   if(win->extra->type==TP_EDIT)    if(win->extra->type==TP_EDIT)
   {    {
     win->extra->edit.curpos=pos;      win->extra->edit.curpos=pos;
     redraw();      redrawclientwin(win);
   }    }
   else if(win->extra->type==TP_SCROLL)    else if(win->extra->type==TP_SCROLL)
   {    {
     win->extra->scroll.pos=pos;      win->extra->scroll.pos=pos;
     redraw();      redrawclientwin(win);
     if(win->extra->scroll.change!=NULL)win->extra->scroll.change(win);      if(win->extra->scroll.change!=NULL)win->extra->scroll.change(win);
   }    }
   else if(win->extra->type==TP_COMBO)    else if(win->extra->type==TP_COMBO)
   {    {
       setcomboactiveitem(&win->extra->combo,win->extra->combo.activeline,pos);
     win->extra->combo.activeline=pos;      win->extra->combo.activeline=pos;
     redraw();      redrawclientwin(win);
     if(win->extra->combo.change!=NULL)win->extra->combo.change(win);      if(win->extra->combo.change!=NULL)win->extra->combo.change(win);
   }    }
   else if(win->extra->type==TP_LIST)    else if(win->extra->type==TP_LIST)
Line 966  void set_pos(WIN *win,long pos)
Line 972  void set_pos(WIN *win,long pos)
     long actline=win->extra->list.activeline;      long actline=win->extra->list.activeline;
     win->extra->list.activeline=pos;      win->extra->list.activeline=pos;
     setlistactiveitem(&win->extra->list,actline,win->extra->list.activeline);      setlistactiveitem(&win->extra->list,actline,win->extra->list.activeline);
     redraw();      redrawclientwin(win);
     if(win->extra->list.change!=NULL)win->extra->list.change(win);      if(win->extra->list.change!=NULL)win->extra->list.change(win);
   }    }
   else if(win->extra->type==TP_STATUS)    else if(win->extra->type==TP_STATUS)
   {    {
     win->extra->status.pos=pos;      win->extra->status.pos=pos;
     redraw();      redrawclientwin(win);
   }    }
 }  }
   
Line 1014  void set_list(WIN *win,GList *list)
Line 1020  void set_list(WIN *win,GList *list)
     LIST *llist=&win->extra->list;      LIST *llist=&win->extra->list;
     llist->lines=list;      llist->lines=list;
     setuplistparams(win);      setuplistparams(win);
     redraw();      redrawclientwin(win);
   }    }
   else if(win->extra->type==TP_COMBO)    else if(win->extra->type==TP_COMBO)
   {    {
     win->extra->combo.list->extra->list.lines=list;      win->extra->combo.list->extra->list.lines=list;
     redraw();      redrawclientwin(win);
   }    }
   else if(win->extra->type==TP_MENU)    else if(win->extra->type==TP_MENU)
   {    {
Line 1509  WIN *create_win(WIN *parent,long x,long
Line 1515  WIN *create_win(WIN *parent,long x,long
     scroll.type=TP_SCROLL;      scroll.type=TP_SCROLL;
     scroll.pos=0;      scroll.pos=0;
     scroll.cnt=1;      scroll.cnt=1;
     scroll.change=NULL;      scroll.change=scrollincombochangeproc;
     list->exvscroll=EX_NONE;      list->exvscroll=EX_NONE;
     list->exhscroll=EX_NONE;      list->exhscroll=EX_NONE;
     list->lencells=NULL;      list->lencells=NULL;
     list->numlines=0;      list->numlines=0;
     list->maxitemlen=0;      list->maxitemlen=0;
       list->oldscrollpos=-1;
     list->activeitem=NULL;      list->activeitem=NULL;
       list->scrollupitem=NULL;
     scroll.vert=true;      scroll.vert=true;
     list->vscroll=create_win(ne,ne->vx-1,1,1,ne->vy-2,(PUNION*)&scroll,0,NULL);      list->vscroll=create_win(ne,ne->vx-1,1,1,ne->vy-2,(PUNION*)&scroll,0,NULL);
     scroll.vert=false;      scroll.vert=false;
Line 1548  WIN *create_win(WIN *parent,long x,long
Line 1556  WIN *create_win(WIN *parent,long x,long
     list.dblclk=combodblclkproc;      list.dblclk=combodblclkproc;
     combo->pushed=SC_UP;      combo->pushed=SC_UP;
     combo->scroll=0;      combo->scroll=0;
       combo->activeitem=NULL;
     combo->list=create_win(ne,x,y,ne->vx+2,ne->extra->combo.lstvy,(PUNION*)&list,ST_TOP_WIN,NULL);      combo->list=create_win(ne,x,y,ne->vx+2,ne->extra->combo.lstvy,(PUNION*)&list,ST_TOP_WIN,NULL);
     if((style&ST_CO_WITH_EDIT)==ST_CO_WITH_EDIT)      if((style&ST_CO_WITH_EDIT)==ST_CO_WITH_EDIT)
     {      {
Line 1639  void set_win_params(WIN *win,PUNION *par
Line 1648  void set_win_params(WIN *win,PUNION *par
     case TP_MENU:setmenuparams(win,params);break;      case TP_MENU:setmenuparams(win,params);break;
     case TP_DIALOG:setdialogparams(win,params);break;      case TP_DIALOG:setdialogparams(win,params);break;
   }    }
   if(isvisible(win))redraw();    redrawclientwin(win);
 }  }
   
 void get_win_params(WIN *win,PUNION *params)  void get_win_params(WIN *win,PUNION *params)
Line 1672  void message_pump()
Line 1681  void message_pump()
   TIMER *p,*pnext;    TIMER *p,*pnext;
   long time;    long time;
   static MEVENT event;    static MEVENT event;
     bool isevent;
   Gpm_Event ev;    Gpm_Event ev;
   mousex=NOCHANGE;    mousex=NOCHANGE;
   mousey=NOCHANGE;    mousey=NOCHANGE;
   res=6;    res=6;
   mod=0;    mod=0;
   key=getch();    key=getch();
   if(ioctl(0,TIOCLINUX,&res)>=0)    if(mouseactive==MOUSE_GPM)isevent=gpmgetevent(&ev);else isevent=false;
     if(isevent||(key!=-1))
   {    {
     if((res&SHIFT_PRESSED)==SHIFT_PRESSED)mod|=MD_SHIFT;      if(ioctl(0,TIOCLINUX,&res)>=0)
     if((res&CTRL_PRESSED)==CTRL_PRESSED)mod|=MD_CTRL;  
     if(((res&ALTL_PRESSED)==ALTL_PRESSED)||((res&ALTR_PRESSED)==ALTR_PRESSED))  
     {      {
       mod|=MD_ALT;        if((res&SHIFT_PRESSED)==SHIFT_PRESSED)mod|=MD_SHIFT;
       if(key==27)key=getch();        if((res&CTRL_PRESSED)==CTRL_PRESSED)mod|=MD_CTRL;
         if(((res&ALTL_PRESSED)==ALTL_PRESSED)||((res&ALTR_PRESSED)==ALTR_PRESSED))
         {
           mod|=MD_ALT;
           if(key==27)key=getch();
         }
     }      }
   }      if(key==27)
   if(key==27)  
   {  
     if((temp=getch())!=27)  
       ungetch(temp);  
     else  
     {      {
       key=temp;        if((temp=getch())!=27)
       mod|=MD_ALT;          ungetch(temp);
         else
         {
           key=temp;
           mod|=MD_ALT;
         }
     }      }
   }    }
   if((mouseactive==MOUSE_GPM)&&(gpmgetevent(&ev)))    if(isevent)
   {    {
     event.x=ev.x;      event.x=ev.x;
     event.y=ev.y;      event.y=ev.y;
Line 1718  void message_pump()
Line 1732  void message_pump()
     if(((ev.modifiers&ALTL_PRESSED)==ALTL_PRESSED)||((ev.modifiers&ALTR_PRESSED)==ALTR_PRESSED))      if(((ev.modifiers&ALTL_PRESSED)==ALTL_PRESSED)||((ev.modifiers&ALTR_PRESSED)==ALTR_PRESSED))
       event.bstate|=BUTTON_ALT;        event.bstate|=BUTTON_ALT;
     domouseevent(&event);      domouseevent(&event);
   }    }
   dokey(key,mod);    if(key!=-1)dokey(key,mod);
   if((screenx!=columns)||(screeny!=lines))    if((screenx!=columns)||(screeny!=lines))
   {    {
     screenx=columns;      screenx=columns;
     screeny=lines;      screeny=lines;
     mainwin.vx=screenx;      mainwin.vx=screenx;

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

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