home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / DOpus4-GPL / Program / main15.c < prev    next >
C/C++ Source or Header  |  2000-01-27  |  19KB  |  692 lines

  1. /*
  2.  
  3. Directory Opus 4
  4. Original GPL release version 4.12
  5. Copyright 1993-2000 Jonathan Potter
  6.  
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. All users of Directory Opus 4 (including versions distributed
  22. under the GPL) are entitled to upgrade to the latest version of
  23. Directory Opus version 5 at a reduced price. Please see
  24. http://www.gpsoft.com.au for more information.
  25.  
  26. The release of Directory Opus 4 under the GPL in NO WAY affects
  27. the existing commercial status of Directory Opus 5.
  28.  
  29. */
  30.  
  31. #include "DOpus.h"
  32. #include "music.h"
  33.  
  34. void ftype_doubleclick(path,name,state)
  35. char *path,*name;
  36. int state;
  37. {
  38.     int in,a,dodef=0,size;
  39.     ULONG threelongs[3];
  40.     char buf[256],buf2[256];
  41.     struct dopusfiletype *type;
  42.     struct dopusfuncpar par;
  43.     struct Directory *file;
  44.  
  45.     if (status_flags&STATUS_IANSCRAP) state=1-state;
  46.     strcpy(buf,path);
  47.     TackOn(buf,name,256);
  48.  
  49.     threelongs[0]=0;
  50.  
  51.     if (CheckExist(buf,&size)>=0) {
  52.         doerror(205);
  53.         return;
  54.     }
  55.     if (!size) {
  56.         doselinfo(data_active_window);
  57.         return;
  58.     }
  59.     dostatustext(globstring[STR_INTERROGATING_FILES]);
  60.     file=findfile(dopus_curwin[data_active_window],name,NULL);
  61.     busy();
  62.     if ((type=checkfiletype(buf,FTFUNC_DOUBLECLICK,0))) {
  63.         par.which=type->which[FTFUNC_DOUBLECLICK];
  64.         par.stack=type->stack[FTFUNC_DOUBLECLICK];
  65.         par.pri=type->pri[FTFUNC_DOUBLECLICK];
  66.         par.delay=type->delay[FTFUNC_DOUBLECLICK];
  67.         par.key=par.qual=0; par.type=3;
  68.  
  69.         if ((strcmp(type->type,"Default")==0) ||
  70.             (strcmp(type->type,globstring[STR_FTYPE_DEFAULT])==0)) dodef=1;
  71.         else {
  72.             char title[256];
  73.  
  74.             if (type->actionstring[FTFUNC_DOUBLECLICK][0]) {
  75.                 do_title_string(type->actionstring[FTFUNC_DOUBLECLICK],title,0,name);
  76.                 dostatustext(title);
  77.             }
  78.             else title[0]=0;
  79.             strcpy(func_single_file,name);
  80.             dofunctionstring(type->function[FTFUNC_DOUBLECLICK],name,title,&par);
  81.             if (file && file->selected) unselect(data_active_window,file);
  82.             func_single_file[0]=0;
  83.             return;
  84.         }
  85.     }
  86.  
  87.     if (file) {
  88.         int old;
  89.  
  90.         old=file->selected;
  91.         file->selected=1;
  92.         makereselect(&func_reselection,data_active_window);
  93.         file->selected=old;
  94.     }
  95.  
  96.     if (checkexec(buf)) {
  97.         if (checkisfont(buf,buf2)) {
  98.             dostatustext(globstring[STR_SHOWING_FONT]);
  99.             if (showfont(buf2,atoi(name),1)) okay();
  100.             return;
  101.         }
  102.         dostatustext(globstring[STR_RUNNING_FILE]);
  103.         StrCombine(buf2,buf,".info",256);
  104.         if (CheckExist(buf2,NULL)<0) a=1;
  105.         else a=0;
  106.         if ((a=dorun(buf,state,a))>0 || a==-2) okay();
  107.         return;
  108.     }
  109.     if (!(in=Open(buf,MODE_OLDFILE))) {
  110.         doerror(IoErr());
  111.         return;
  112.     }
  113.     Read(in,(char *)threelongs,sizeof(threelongs));
  114.     Close(in);
  115.  
  116.     if (threelongs[0]==ID_FORM) {
  117.         if (threelongs[2]==ID_8SVX) {
  118.             dostatustext(globstring[STR_PLAYING_FILE]);
  119.             if (MUSICBase) FlushModule();
  120.             strcpy(func_single_file,name);
  121.             a=doplay8svx(buf,(config->viewbits&VIEWBITS_PLAYLOOP)?1:0);
  122.             kill8svx();
  123.             if (a==1 || a==-1) okay();
  124.             else handle8svxerror(a);
  125.             func_single_file[0]=0;
  126.             return;
  127.         }
  128.         else if (threelongs[2]==ID_ILBM || threelongs[2]==ID_ANIM) {
  129.             dostatustext(globstring[(threelongs[2]==ID_ILBM)?STR_SHOWING_FILE:STR_PLAYING_ANIM]);
  130.             strcpy(func_single_file,name);
  131.             a=showpic(buf,1);
  132.             if (a) okay();
  133.             func_single_file[0]=0;
  134.             return;
  135.         }
  136.     }
  137.  
  138.     a=strlen(name);
  139.     if (a>5 && LStrCmpI(&name[a-5],".info")==0) {
  140.         dostatustext(globstring[STR_SHOWING_FILE]);
  141.         a=showpic(buf,1);
  142.         if (a) okay();
  143.         return;
  144.     }
  145.     if (check_is_module(buf)) {
  146.         dostatustext(globstring[STR_PLAYING_ST_MOD]);
  147.         a=playmod(buf);
  148.         if (a) okay();
  149.         return;
  150.     }
  151.     if (dodef) {
  152.         char title[256];
  153.  
  154.         if (type->actionstring[FTFUNC_DOUBLECLICK][0]) {
  155.             do_title_string(type->actionstring[FTFUNC_DOUBLECLICK],title,0,name);
  156.             dostatustext(title);
  157.         }
  158.         else title[0]=0;
  159.  
  160.         if (!status_iconified) strcpy(func_single_file,name);
  161.         dofunctionstring(type->function[FTFUNC_DOUBLECLICK],name,title,&par);
  162.     }
  163.     else {
  164.         dostatustext(globstring[STR_READING_SELECTED_FILE]);
  165.         strcpy(func_single_file,name);
  166.         if (viewfile(buf,name,FUNC_SMARTREAD,NULL,NULL,0,1)) okay();
  167.         func_single_file[0]=0;
  168.     }
  169.     if (strcmp(str_last_statustext,globstring[STR_INTERROGATING_FILES])==0)
  170.         okay();
  171.     return;
  172. }
  173.  
  174. filesearch(name,found,skipall)
  175. char *name;
  176. int *found,skipall;
  177. {
  178.     char *message;
  179.     int rec,in,suc;
  180.  
  181.     *found=0;
  182.     if (!(in=Open(name,MODE_OLDFILE))) return(0);
  183.     suc=typesearch(in,str_search_string,search_flags,NULL,0);
  184.     Close(in);
  185.     if (suc>-1) {
  186.         char buf[350];
  187.  
  188.         *found=1;
  189.         if (skipall>-1) {
  190.             lsprintf(buf,globstring[STR_FOUND_A_MATCH_READ],name);
  191.             if ((rec=simplerequest(buf,
  192.                 str_okaystring,
  193.                 globstring[STR_ABORT],
  194.                 globstring[STR_SKIP],
  195.                 (skipall)?globstring[STR_SKIP_ALL]:NULL,
  196.                 NULL))==1) {
  197.                 message=BaseName(name);
  198.                 busy();
  199.                 rec=viewfile(name,message,0,str_search_string,NULL,1,0);
  200.                 unbusy();
  201.                 if (rec==-1) return(-1);
  202.                 return(2);
  203.             }
  204.             if (rec==0) return(-1);
  205.             if (rec==3) return(4);
  206.         }
  207.         return(3);
  208.     }
  209.     if (status_justabort) return(-1);
  210.     return(1);
  211. }
  212.  
  213. void initclock()
  214. {
  215.     if (!clock_task) {
  216.         clockmsg_port=NULL;
  217.         clock_task=(struct Task *) CreateTask("dopus_clock",config->priority+1,clocktask,4000);
  218.     }
  219. }
  220.  
  221. internal_function(function,rexx,source,dest)
  222. int function,rexx;
  223. char *source,*dest;
  224. {
  225.     int a,b,actwin=-1,inactwin=-1,flag=0;
  226.     char buf[256],buf2[256],*spath=NULL,*dpath=NULL;
  227.     struct Directory dummy_entry;
  228.     struct CommandList *command=NULL;
  229.  
  230.     for (a=0;;a++) {
  231.         if (!commandlist[a].name) break;
  232.         if (commandlist[a].function==function) {
  233.             command=&commandlist[a];
  234.             break;
  235.         }
  236.     }
  237.     if (status_iconified && command && command->flags&RCL_NOBUTTON)
  238.         return(0);
  239.     status_justabort=status_haveaborted=0;
  240.     if (function==FUNC_HELP && !dopus_firsthelp) return(0);
  241.  
  242.     if (function!=FUNC_HELP && function!=FUNC_ABOUT &&
  243.         function!=FUNC_READ && function!=FUNC_HEXREAD) busy();
  244.  
  245.     if (function!=FUNC_RESELECT && !(status_flags&STATUS_HELP))
  246.         makereselect(&func_reselection,data_active_window);
  247.  
  248.     rexx_pathbuffer[0][0]=rexx_pathbuffer[1][0]=0;
  249.     dos_global_entry.name[0]=0;
  250.  
  251.     if (status_flags&STATUS_HELP && function!=FUNC_HELP) {
  252.         if (function>=DRIVE1 && function<=DRIVE6) {
  253.             a=data_drive_offset+(function-DRIVE1);
  254.             if (config->drive[a].name[0])
  255.                 dohelp(NULL,"*drivegadgets",config->drive[a].key,config->drive[a].qual,NULL);
  256.         }
  257.         else if (command) {
  258.             strcpy(buf,"*"); strcat(buf,command->name);
  259.             dohelp(NULL,buf,0,0,NULL);
  260.         }
  261.     }
  262.     else {
  263.         if (function>=DRIVE1 && function<=DRIVE6) {
  264.             a=(function-DRIVE1)+data_drive_offset;
  265.             if (config->drive[a].name[0] && config->drive[a].function) {
  266.                 strcpy(str_pathbuffer[data_active_window],config->drive[a].function);
  267.                 startgetdir(data_active_window,SGDFLAGS_CANMOVEEMPTY|SGDFLAGS_CANCHECKBUFS);
  268.             }
  269.         }
  270.         else switch (function) {
  271.             case FUNC_SETCURDIR:
  272.                 setcurdir(rexx);
  273.                 break;
  274.             case FUNC_ICONIFYBUTTONS:
  275.                 if (rexx) {
  276.                     a=atoi(rexx_args[0])+1;
  277.                     b=atoi(rexx_args[1])-1;
  278.                 }
  279.                 else {
  280.                     a=1;
  281.                     b=0;
  282.                 }
  283.                 if (!status_iconified && checkwindowquit()) iconify(2,a,b);
  284.                 break;
  285.             case FUNC_ERRORHELP:
  286.                 geterrorhelp(rexx);
  287.                 break;
  288.             case FUNC_FORMAT:
  289.             case FUNC_DISKCOPY:
  290.             case FUNC_INSTALL:
  291.                 dopus_diskop(function,rexx,0);
  292.                 break;
  293.             case FUNC_BGFORMAT:
  294.             case FUNC_BGDISKCOPY:
  295.             case FUNC_BGINSTALL:
  296.                 dopus_diskop(function,rexx,1);
  297.                 break;
  298.             case FUNC_PRINTDIR:
  299.                 dopus_print(rexx,NULL,1,str_arexx_portname,NULL);
  300.                 break;
  301.             case FUNC_NEWCLI:
  302.                 newcli();
  303.                 break;
  304.             case FUNC_SELECT:
  305.                 doselect(rexx);
  306.                 break;
  307.             case FUNC_AREXX:
  308.                 doarexx(rexx);
  309.                 break;
  310.             case FUNC_ASSIGN:
  311.                 doassign(rexx);
  312.                 break;
  313.             case FUNC_MAKEDIR:
  314.                 makedir(rexx);
  315.                 break;
  316.             case FUNC_RESCAN:
  317.                 if (rexx) a=atoi(rexx_args[0]);
  318.                 else a=data_active_window;
  319.                 if (a==-1) a=data_active_window;
  320.                 if (a>=0 && a<=1) {
  321.                     struct DirWindowPars rescanpars;
  322.  
  323.                     rescanpars.reselection_list=NULL;
  324.                     makereselect(&rescanpars,a);
  325.                     startgetdir(a,0);
  326.                     doreselect(&rescanpars,0);
  327.                     makereselect(&rescanpars,-1);
  328.                 }
  329.                 break;
  330.             case FUNC_ICONIFY:
  331.                 if (!status_iconified && checkwindowquit()) iconify(2,0,0);
  332.                 break;
  333.             case FUNC_ABOUT:
  334.                 about();
  335.                 break;
  336.             case FUNC_VERSION:
  337.                 give_version_info();
  338.                 break;
  339.             case FUNC_CONFIGURE:
  340.                 doconfig();
  341.                 break;
  342.             case FUNC_QUIT:
  343.                 if ((rexx_argcount<1 ||
  344.                     (LStrCmpI(rexx_args[0],"force"))!=0) &&
  345.                     !(simplerequest(globstring[STR_REALLY_QUIT],
  346.                         globstring[STR_QUIT],str_cancelstring,NULL))) break;
  347.  
  348.                 if (!checkwindowquit()) break;
  349.                 if (config_changed && !(a=simplerequest(globstring[STR_CONFIG_CHANGED_QUIT],
  350.                     globstring[STR_QUIT],str_cancelstring,globstring[STR_SAVE_QUIT],NULL)))
  351.                     break;
  352.                 if (a==2) {
  353.                     dostatustext(globstring[STR_SAVING_CONFIG]);
  354.                     busy();
  355.                     if (!(savesetup())) {
  356.                         doerror(IoErr());
  357.                         unbusy();
  358.                         break;
  359.                     }
  360.                     unbusy();
  361.                 }
  362.                 quit();
  363.             case FUNC_SAVECONFIG:
  364.                 dostatustext(globstring[STR_SAVING_CONFIG]);
  365.                 if (!(savesetup())) doerror(IoErr());
  366.                 else okay();
  367.                 break;
  368.             case FUNC_LASTSAVEDCONFIG:
  369.                 if (checklastsaved()) {
  370.                     if (!(checkwindowquit())) break;
  371.                     shutthingsdown(0);
  372.                     read_configuration(0);
  373.                     SetUp(0);
  374.                     okay();
  375.                 }
  376.                 break;
  377.             case FUNC_DEFAULTCONFIG:
  378.                 a=checkdefaults();
  379.                 if (a==2) break;
  380.                 if (a) {
  381.                     dostatustext(globstring[STR_SAVING_CONFIG]);
  382.                     if (!(savesetup())) {
  383.                         doerror(IoErr());
  384.                         break;
  385.                     }
  386.                 }
  387.                 unbusy();
  388.                 if (!(checkwindowquit())) break;
  389.                 shutthingsdown(0);
  390.                 read_configuration(1);
  391.                 SetUp(0);
  392.                 okay();
  393.                 break;
  394.             case FUNC_REDRAW:
  395.                 if (!(checkwindowquit())) break;
  396.                 shutthingsdown(10);
  397.                 SetUp(0);
  398.                 okay();
  399.                 break;
  400.             case FUNC_ALL:
  401.                 globalselect(data_active_window,1);
  402.                 globalselect(data_active_window,1);
  403.                 refreshwindow(data_active_window,0);
  404.                 break;
  405.             case FUNC_NONE:
  406.                 globalselect(data_active_window,0);
  407.                 globalselect(data_active_window,0);
  408.                 refreshwindow(data_active_window,0);
  409.                 break;
  410.             case FUNC_TOGGLE:
  411.                 globaltoggle(data_active_window);
  412.                 refreshwindow(data_active_window,0);
  413.                 break;
  414.             case FUNC_PARENT:
  415.                 if (!rexx || !rexx_argcount>0 ||
  416.                     (a=atoi(rexx_args[0]))<0 || a>1) a=data_active_window;
  417.                 if (doparent(str_pathbuffer[a])) do_parent_root(a);
  418.                 break;
  419.             case FUNC_ROOT:
  420.                 if (!rexx || rexx_argcount<1 ||
  421.                     (a=atoi(rexx_args[0]))<0 || a>1) a=data_active_window;
  422.                 if (doroot(str_pathbuffer[a])) do_parent_root(a);
  423.                 break;
  424.             case FUNC_PARENTLIST:
  425.                 if (!rexx || !rexx_argcount>0 ||
  426.                     (a=atoi(rexx_args[0]))<0 || a>1) a=data_active_window;
  427.                 if (str_pathbuffer[a][0] && do_parent_multi(str_pathbuffer[a]))
  428.                     startgetdir(a,SGDFLAGS_CANMOVEEMPTY|SGDFLAGS_CANCHECKBUFS);
  429.                 break;
  430.             case FUNC_STOPST:
  431.                 if (MUSICBase) StopModule();
  432.                 break;
  433.             case FUNC_CONTST:
  434.                 if (MUSICBase) ContModule();
  435.                 break;
  436.             case FUNC_HELP:
  437.                 status_flags^=STATUS_HELP;
  438.                 if ((status_flags&STATUS_HELP && !(screen_gadgets[SCRGAD_TINYHELP].Flags&GFLG_SELECTED)) ||
  439.                     (!(status_flags&STATUS_HELP) && screen_gadgets[SCRGAD_TINYHELP].Flags&GFLG_SELECTED)) {
  440.                     screen_gadgets[SCRGAD_TINYHELP].Flags^=GFLG_SELECTED;
  441.                     if (config->generalscreenflags&SCR_GENERAL_TINYGADS)
  442.                         dolittlegads(&screen_gadgets[SCRGAD_TINYHELP],&globstring[STR_TINY_BUTTONS][4],1);
  443.                 }
  444.                 if (status_flags&STATUS_HELP) dostatustext(globstring[STR_SELECT_FUNCTION]);
  445.                 else okay();
  446.                 break;
  447.             case FUNC_RESELECT:
  448.                 doreselect(&func_reselection,1);
  449.                 break;
  450.             case FUNC_BUFFERLIST:
  451.                 if (!rexx || rexx_argcount<1 ||
  452.                     (a=atoi(rexx_args[0]))<0 || a>1) a=data_active_window;
  453.                 dolistbuffers(a);
  454.                 break;
  455.             case FUNC_CLEARBUFFERS:
  456.                 clearbuffers();
  457.                 break;
  458.             case FUNC_REMEMBER:
  459.                 do_remember_config(remember_data);
  460.                 break;
  461.             case FUNC_RESTORE:
  462.                 do_restore_config(remember_data);
  463.                 break;
  464.             case FUNC_BEEP:
  465.                 dosound(0);
  466.                 break;
  467.             case FUNC_ALARM:
  468.                 dosound(1);
  469.                 break;
  470.             default:
  471.                 if (!command) return(0);
  472.                 if (func_external_file[0]) {
  473.                     spath=source; dpath=dest;
  474.                     if (!status_iconified) {
  475.                         actwin=0;
  476.                         inactwin=data_active_window;
  477.                     }
  478.                 }
  479.                 else if (!status_iconified) {
  480.                     actwin=((spath=getarexxpath(rexx,data_active_window,0,0))!=
  481.                         str_pathbuffer[data_active_window])?-1:data_active_window;
  482.                     inactwin=((dpath=getarexxpath(rexx,1-data_active_window,1,(actwin!=-1)))!=
  483.                         str_pathbuffer[1-data_active_window])?-1:1-data_active_window;
  484.                 }
  485.                 if (status_iconified) {
  486.                     if (rexx &&
  487.                         rexx_argcount>0 &&
  488.                         (CheckExist(rexx_args[0],NULL))) {
  489.                         char *ptr;
  490.  
  491.                         strcpy(func_external_file,rexx_args[0]);
  492.                         strcpy(buf2,func_external_file);
  493.                         if (ptr=BaseName(buf2)) {
  494.                             strcpy(func_single_file,ptr);
  495.                             *ptr=0;
  496.                         }
  497.                         spath=buf2;
  498.                         if (!(filloutdummy(func_external_file,&dummy_entry))) return(0);
  499.                         func_single_entry=&dummy_entry;
  500.                     }
  501.                     else if (!func_external_file[0]) {
  502.                         struct DOpusFileReq freq;
  503.  
  504.                         buf2[0]=0;
  505.                         if (command->flags&RCL_NOFILE) {
  506.                             if (!(getdummypath(buf2,STR_SELECT_A_DIRECTORY))) return(0);
  507.                             spath=buf2;
  508.                         }
  509.                         else {
  510.                             if (!(getdummyfile(&dummy_entry,buf2,&freq))) return(0);
  511.                             TackOn(buf2,NULL,256);
  512.                             spath=buf2;
  513.                             func_single_entry=&dummy_entry;
  514.                             strcpy(func_external_file,buf2);
  515.                             strcpy(func_single_file,dummy_entry.name);
  516.                         }
  517.                     }
  518.                     else {
  519.                         strcpy(buf2,source);
  520.                         TackOn(buf2,func_single_file,256);
  521.                         if (!(filloutdummy(buf2,&dummy_entry))) return(0);
  522.                         func_single_entry=&dummy_entry;
  523.                     }
  524.                     if (command->flags&RCL_NEEDDEST && (!dpath || !dpath[0])) {
  525.                         buf[0]=0;
  526.                         if (!(getdummypath(buf,STR_SELECT_DESTINATION_DIR))) return(0);
  527.                         dpath=buf;
  528.                     }
  529.                 }
  530.                 switch (function) {
  531.                     case FUNC_RELABEL:
  532.                         relabel_disk(rexx,spath);
  533.                         break;
  534.                     case FUNC_SEARCH:
  535.                         dofilefunction(FUNC_SEARCH,FUNCFLAGS_ANYTHING,spath,NULL,actwin,-1,rexx);
  536.                         break;
  537.                     case FUNC_PROTECT:
  538.                         dofilefunction(FUNC_PROTECT,0,spath,NULL,actwin,-1,rexx);
  539.                         break;
  540.                     case FUNC_PRINT:
  541.                         dofilefunction(FUNC_PRINT,FUNCFLAGS_FILES,spath,NULL,actwin,-1,rexx);
  542.                         break;
  543.                     case FUNC_HUNT:
  544.                         dofilefunction(FUNC_HUNT,FUNCFLAGS_DIRS|FUNCFLAGS_DEVS,spath,NULL,actwin,-1,rexx);
  545.                         break;
  546.                     case FUNC_ENCRYPT:
  547.                         dofilefunction(FUNC_ENCRYPT,FUNCFLAGS_FILES,spath,dpath,actwin,inactwin,rexx);
  548.                         break;
  549.                     case FUNC_DATESTAMP:
  550.                         dofilefunction(FUNC_DATESTAMP,0,spath,NULL,actwin,-1,rexx);
  551.                         break;
  552.                     case FUNC_COMMENT:
  553.                         dofilefunction(FUNC_COMMENT,0,spath,NULL,actwin,-1,rexx);
  554.                         break;
  555.                     case FUNC_ADDICON:
  556.                         dofilefunction(FUNC_ADDICON,0,spath,NULL,actwin,-1,rexx);
  557.                         break;
  558.                     case FUNC_DELETE:
  559.                         dofilefunction(FUNC_DELETE,0,spath,NULL,actwin,-1,rexx);
  560.                         break;
  561.                     case FUNC_CLONE:
  562.                         dofilefunction(FUNC_COPYAS,FUNCFLAGS_COPYISCLONE,spath,spath,actwin,actwin,rexx);
  563.                         break;
  564.                     case FUNC_COPY:
  565.                     case FUNC_COPYAS:
  566.                         dofilefunction(function,0,spath,dpath,actwin,inactwin,rexx);
  567.                         break;
  568.                     case FUNC_RENAME:
  569.                         dofilefunction(FUNC_RENAME,0,spath,NULL,actwin,-1,rexx);
  570.                         break;
  571.                     case FUNC_MOVE:
  572.                     case FUNC_MOVEAS:
  573.                         dofilefunction(function,0,spath,dpath,actwin,inactwin,rexx);
  574.                         break;
  575.                     case FUNC_RUN:
  576.                         dofilefunction(function,0,spath,NULL,actwin,-1,rexx);
  577.                         break;
  578.                     case FUNC_CHECKFIT:
  579.                         flag=FUNCFLAGS_BYTEISCHECKFIT;
  580.                     case FUNC_BYTE:
  581.                         if (!rexx || rexx_argcount<1 ||
  582.                             (a=atoi(rexx_args[0]))<0 || a>1) a=actwin;
  583.                         if (a!=actwin) {
  584.                             char *temp;
  585.  
  586.                             temp=spath;
  587.                             spath=dpath;
  588.                             dpath=temp;
  589.                         }
  590.                         dofilefunction(FUNC_BYTE,flag,spath,dpath,a,1-a,rexx);
  591.                         break;
  592.                     case FUNC_UNBYTE:
  593.                         if (!rexx || rexx_argcount<1 ||
  594.                             (a=atoi(rexx_args[0]))<0 || a>1) a=data_active_window;
  595.                         unbyte(a);
  596.                         break;
  597.                     case FUNC_PLAY:
  598.                     case FUNC_LOOPPLAY:
  599.                     case FUNC_PLAYST:
  600.                         dofilefunction(function,FUNCFLAGS_FILES,spath,NULL,actwin,-1,rexx);
  601.                         break;
  602.                     case FUNC_SHOW:
  603.                         dofilefunction(FUNC_SHOW,FUNCFLAGS_FILES,spath,NULL,actwin,-1,rexx);
  604.                         break;
  605.                     case FUNC_READ:
  606.                     case FUNC_HEXREAD:
  607.                     case FUNC_ANSIREAD:
  608.                     case FUNC_SMARTREAD:
  609.                         dofilefunction(function,FUNCFLAGS_FILES,spath,NULL,actwin,-1,rexx);
  610.                         break;
  611.                     case FUNC_AUTO:
  612.                     case FUNC_AUTO2:
  613.                     case FUNC_AUTO3:
  614.                     case FUNC_AUTO4:
  615.                         dofilefunction(function,FUNCFLAGS_FILES,spath,NULL,actwin,-1,rexx);
  616.                         break;
  617.                     case FUNC_ICONINFO:
  618.                         dofilefunction(FUNC_ICONINFO,0,spath,NULL,actwin,-1,rexx);
  619.                         break;
  620.                     default:
  621.                         func_global_function=function;
  622.                         rexxdisp(NULL,NULL,NULL);
  623.                         break;
  624.                 }
  625.                 break;
  626.         }
  627.     }
  628.     func_global_function=0; func_single_entry=NULL;
  629. /*
  630.     func_single_file[0]=0; func_external_file[0]=0;
  631. */
  632.  
  633.     if (function!=FUNC_READ && function!=FUNC_HEXREAD &&
  634.         function!=FUNC_SMARTREAD && function!=FUNC_ANSIREAD) unbusy();
  635.     a=status_previousabort=status_justabort; status_justabort=0;
  636.     return(a);
  637. }
  638.  
  639. void do_parent_root(win)
  640. int win;
  641. {
  642.     if (!(config->dirflags&DIRFLAGS_SMARTPARENT) ||
  643.         !(findbuffer(str_pathbuffer[win],win,0,0)))
  644.         startgetdir(win,SGDFLAGS_CANMOVEEMPTY);
  645. }
  646.  
  647. checklastsaved()
  648. {
  649.     if (config_changed && !(simplerequest(globstring[STR_CONFIG_CHANGED_LASTSAVED],
  650.         globstring[STR_LOAD],str_cancelstring,NULL)))
  651.         return(0);
  652.     return(1);
  653. }
  654.  
  655. checkdefaults()
  656. {
  657.     if (!config_changed) return(0);
  658.     return((simplerequest(globstring[STR_CONFIG_CHANGED_DEFAULTS],
  659.         globstring[STR_SAVE],globstring[STR_DEFAULTS],str_cancelstring,NULL)));
  660. }
  661.  
  662. checknewconfig()
  663. {
  664.     if (config_changed && !(simplerequest(globstring[STR_CONFIG_CHANGED_LOAD],
  665.         globstring[STR_LOAD],str_cancelstring,NULL)))
  666.         return(0);
  667.     return(1);
  668. }
  669.  
  670. void dragcompgad(gad,state)
  671. int gad,state;
  672. {
  673.     if (main_gadgets[gad].GadgetRender) {
  674.         if (state) {
  675.             DrawBorder(main_rp,
  676.                 main_gadgets[gad].SelectRender,
  677.                 main_gadgets[gad].LeftEdge,main_gadgets[gad].TopEdge);
  678.         }
  679.         else {
  680.             DrawBorder(main_rp,
  681.                 main_gadgets[gad].GadgetRender,
  682.                 main_gadgets[gad].LeftEdge,main_gadgets[gad].TopEdge);
  683.         }
  684.     }
  685.     else {
  686.         SetDrMd(main_rp,COMPLEMENT);
  687.         rectfill(main_rp,scrdata_gadget_xpos+((gad%7)*scrdata_gadget_width),
  688.             scrdata_gadget_ypos+((gad/7)*scrdata_gadget_height)-1,scrdata_gadget_width,scrdata_gadget_height);
  689.         SetDrMd(main_rp,JAM2);
  690.     }
  691. }
  692.