home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / fm2000 / taskwindow.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-02-04  |  3.6 KB  |  146 lines

  1. /*
  2.      Filemaster - Multitasking directory utility.
  3.      Copyright (C) 2000  Toni Wilen
  4.      
  5.      This program is free software; you can redistribute it and/or
  6.      modify it under the terms of the GNU General Public License
  7.      as published by the Free Software Foundation; either version 2
  8.      of the License, or (at your option) any later version.
  9.      
  10.      This program is distributed in the hope that it will be useful,
  11.      but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.      GNU General Public License for more details.
  14.      
  15.      You should have received a copy of the GNU General Public License
  16.      along with this program; if not, write to the Free Software
  17.      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19.  
  20.  
  21. #include <proto/all.h>
  22. #include <exec/types.h>
  23. #include <intuition/intuition.h>
  24. #include <strings.h>
  25. #include <stdio.h>
  26. #include "fmnode.h"
  27. #include "fmlocale.h"
  28. #include "fmgui.h"
  29. #include "child.h"
  30.  
  31. void setsource(struct FMList*);
  32. void bdrives(struct FMList*);
  33. void updatetasknumbers(struct ListInfo*);
  34. WORD setlist(struct ListInfo*,struct FMList*);
  35. void gadgettables(void);
  36.  
  37. extern struct FMMain fmmain;
  38. extern struct FMList fmlist[];
  39. extern struct FMConfig *fmconfig;
  40.  
  41. void taskwindow(WORD listnum)
  42. {
  43. struct GUIBase *gb;
  44. UBYTE text[500],title[80];
  45. WORD cnt,c;
  46. UBYTE *txtptr;
  47. UBYTE *ptr1;
  48. struct IntuiMessage *imsg;
  49.  
  50. #ifdef V39
  51.     SetWindowPointer(fmmain.ikkuna,WA_BusyPointer,TRUE,WA_PointerDelay,TRUE,TAG_DONE);
  52. #endif
  53. Forbid();
  54. txtptr=text;
  55. for (cnt=0;cnt<LISTS;cnt++) {
  56.     c=0;
  57.     ptr1=getstring(MSG_TASKWINDOW_EMPTY);
  58.     if (fmlist[cnt].flags) {
  59.         if (fmlist[cnt].flags&LDEVLIST) ptr1=getstring(MSG_TASKWINDOW_DEVLIST);
  60.         if (fmlist[cnt].workname[0]) {
  61.             ptr1=fmlist[cnt].workname;
  62.         } else {
  63.             if (fmlist[cnt].path[0]) ptr1=fmlist[cnt].path;
  64.         }
  65.     }
  66.     sformat(txtptr,"(_%ld) %-39.39s",cnt,ptr1);
  67.     txtptr+=45;
  68. }
  69. Permit();
  70. txtptr=text; c=0;
  71. sformat(title,getstring(MSG_TASKWINDOW_LISTS),(WORD)fmmain.li[listnum]->list->listnumber);
  72. gb=getguibase(title);
  73. for(cnt=0;cnt<LISTS;cnt++) {
  74.     reqbutton(gb,txtptr,cnt+10,guiLEFT);
  75.     txtptr+=45;
  76. }
  77. cnt=quickreq(gb);
  78.  
  79. if(cnt>=10&&cnt<=19) {
  80.     cnt-=10;
  81.     setlist(fmmain.li[listnum],&fmlist[cnt]);
  82. }
  83. #ifdef V39
  84.     SetWindowPointer(fmmain.ikkuna,TAG_DONE);
  85. #endif
  86. while(imsg=(struct IntuiMessage*)GetMsg(fmmain.ikkuna->UserPort)) ReplyMsg((struct Message*)imsg);
  87. }
  88.  
  89. void nextlist(struct ListInfo *li,WORD cnt)
  90. {
  91. WORD apu1;
  92.  
  93. apu1=li->list-&fmlist[0];
  94. for(;;) {
  95.     apu1+=cnt;
  96.     if(apu1>=LISTS) apu1=0;
  97.     if(apu1<0) apu1=LISTS-1;
  98.     if(setlist(li,&fmlist[apu1])) break;
  99. }
  100. }
  101.  
  102. WORD setlist(struct ListInfo *li,struct FMList *list)
  103. {
  104. WORD apu1;
  105.  
  106. for(apu1=0;apu1<LISTS;apu1++) {
  107.     if(fmmain.li[apu1]&&fmmain.li[apu1]->list==list&&fmmain.li[apu1]!=li) return(0);
  108. }
  109. if (li->list) li->list->li=0;
  110. li->list=list;
  111. list->li=li;
  112. li->rscroll2.fmlist=li->rscroll1.fmlist=list;
  113. updatetasknumbers(li);
  114. if(list->path[0]==0||list->flags&LDEVLIST) bdrives(list);
  115. if(list->flags&LALLOCATED)
  116.     offgadget(&li->slider1,LISTGADGETS);
  117.     else
  118.     ongadget(&li->slider1,LISTGADGETS);
  119. li->sinfo.Buffer=list->path;
  120. csortlist(list);
  121. parselist(list,0);
  122. RefreshGList(&li->string,fmmain.ikkuna,0,1);
  123. setsource(list);
  124. outputlist(list);
  125. updadirmeter(list);
  126. return(1);
  127. }
  128.  
  129. void updatetasknumbers(struct ListInfo *li)
  130. {
  131. WORD cnt;
  132.  
  133. if(!li) {
  134.     for(cnt=0;cnt<LISTS;cnt++) {
  135.         if(fmmain.li[cnt]) {
  136.             fmmain.li[cnt]->taskgadget.UserData=(APTR)(fmmain.li[cnt]->list->listnumber+'0');
  137.             ongadget(&fmmain.li[cnt]->taskgadget,LISTGADGETS);
  138.         }
  139.     }    
  140. } else {
  141.     li->taskgadget.UserData=(APTR)(li->list->listnumber+'0');
  142.     ongadget(&li->taskgadget,LISTGADGETS);
  143. }
  144. gadgettables();
  145. }
  146.