//=======================================================================
//@V@:Note: This file generated by vgen V1.02 (23:23:26 06 Apr 1998).
//	jprojdlg.cpp:	Source for JavaProjectDialog class
//=======================================================================
#include<v/vapp.h>

#include "jprojdlg.h"
#include "videjava.h"
#include <v/vutil.h>

#include <v/vapp.h>

//************************************************************************
  enum 				// symbols for dialog items
    {
    frmTogBtns = 2000,
	    tbtMain, tbtFiles, tbtComp, tbtInterp, tbtDebug,

    frmTop,

    frmMain,
	lblTopFile, txiTopFile, lblHTML, txiHTML, lblCPath, txiCPath, 

    frmFiles,
	lblFiles, srcList, btnAddSrcFile, btnDelSrcFile,
	btnEditSrcFile, lblSrcDir, txiSrcDir,

    frmComp,
	lblCName, txiCName, lblCPool, lstCPool, btnCAddDef, btnCDelDef, btnCEditDef, 
	blkCBlank1, blkCBlank2, blkCBlank3, btnCAdd, lblCDef, lstCDef, btnCDel,

    frmInterp,
	lblIName, txiIName, lblIPool, lstIPool, btnIAddDef, btnIDelDef, 
	btnIEditDef, blkIBlank1, blkIBlank2, blkIBlank3, btnIAdd, 
	lblIDef, lstIDef, btnIDel,
 
    frmDebug,
	lblDName, txiDName, lblDPool, lstDPool, btnDAddDef, btnDDelDef, 
	btnDEditDef, blkDBlank1, blkDBlank2, blkDBlank3, btnDAdd, 
	lblDDef, lstDDef, btnDDel, 

    xyzzyLast

   };

//stub vector for listDialogs
 static char* vtmp[1] = { 0 };

//@V@:BeginDialogCmd PCmds
  static DialogCmd PCmds[] =
    {
      // This borderless frame makes the toggle buttons tightly spaced
	{C_Frame,frmTogBtns,0,"",NoList,CA_NoSpace | CA_NoBorder,isSens,NoFrame,0,0},
	{C_ToggleButton,tbtMain,1,  "    Main   ",NoList, CA_None, isSens, frmTogBtns, 0, 0,0,"Set main files, paths"},
	{C_ToggleButton,tbtFiles,0, "   Files   ",NoList, CA_None, isSens, frmTogBtns, tbtMain, 0, 0, "Set Source Files"},
	{C_ToggleButton,tbtComp,0,  "  Compiler ",NoList, CA_None, isSens, frmTogBtns, tbtFiles, 0,0, "Java Compiler and switches"},
	{C_ToggleButton,tbtInterp,0,"Interpreter",NoList, CA_None, isSens, frmTogBtns, tbtComp, 0,0, "Java Interpreter and switches"},
	{C_ToggleButton,tbtDebug,0, "  Debugger ",NoList, CA_None, isSens, frmTogBtns, tbtInterp, 0,0, "Java debugger"},


	// Main frame around all subframes
	{C_Frame,frmTop,0, "", NoList,CA_None,isSens,frmTogBtns,0,tbtFiles},

// Main
	// This is the default frame - on initially
	{C_ToggleFrame, frmMain, 1, "",NoList,CA_NoBorder,isSens, frmTop, 0, 0},

	{C_Label, lblTopFile, 0," Java App/Applet Name:   ", NoList, CA_None, isSens,frmMain,0, 0},
	{C_TextIn, txiTopFile, 0, " ", NoList, CA_Large, isSens,frmMain,lblTopFile, 0, 0,
        	"Name of top level Java source file"},

	{C_Label, lblHTML, 0, " Applet HTML source: ", NoList, CA_None, isSens,frmMain, 0, txiTopFile},
	{C_TextIn, txiHTML, 0, " ", NoList, CA_Large, isSens,frmMain,lblTopFile, txiTopFile, 0,"Applet HTML source"},

	{C_Label, lblCPath, 0,  " CLASSPATH: ", NoList, CA_Large, isSens,frmMain,0, txiHTML},
	{C_TextIn, txiCPath, 0, " ", NoList, CA_Large, isSens,frmMain,lblTopFile, txiHTML,0,"CLASSPATH"},

// Files
	{C_ToggleFrame, frmFiles, 0, "", NoList, CA_NoBorder | CA_Hidden, isSens, frmTop, 0, 0},
	{C_Label, lblSrcDir, 0, " Source Directory: ", NoList, CA_None, isSens,frmFiles,0, 0},
	{C_TextIn, txiSrcDir, 0, " ", NoList, CA_Large, isSens,frmFiles,lblSrcDir, 0,0,"Directory of Java Source Files"},

#ifdef USE_FILES
	{C_Label, lblFiles, 0," Source Files: (Optional, not needed with Sun JDK)", NoList, CA_None, isSens, frmFiles,0, txiSrcDir},
	{C_List, srcList, 160, " ", (void *) vtmp, 
		CA_ListWidth | CA_Size, isSens, frmFiles,0, lblFiles, 12, "List of source Files" },
	{C_Button, btnAddSrcFile, 0, "Add", NoList,CA_None,
	    isSens,frmFiles,0, srcList, 0, "Add source file with File Dialog"},
	{C_Button, btnDelSrcFile, 0, "Del", NoList,CA_None,
	    isSens,frmFiles, btnAddSrcFile, srcList,0,"Delete selected file"},
	{C_Button, btnEditSrcFile, 0, "Edit", NoList,CA_None,
	    isSens,frmFiles, btnDelSrcFile, srcList,0,"Edit selected file"},
#endif


// Compiler
	{C_ToggleFrame, frmComp, 0, "",NoList,CA_NoBorder | CA_Hidden,isSens,frmTop, 0, 0},
	  {C_Label, lblCName, 0, " Java Compiler: ", NoList, CA_None, isSens,frmComp,0, 0},
	  {C_TextIn, txiCName, 0, " ", NoList, CA_Large, isSens,frmComp,lblCName, 0,0,"Name of Java Compiler"},
	  {C_Label, lblCPool, 0, " Compiler Switch Pool", NoList, CA_None, isSens,frmComp,0, txiCName},
	  {C_List,  lstCPool, 124, " ",  (void *) vtmp, 
	    CA_ListWidth | CA_Size, isSens, frmComp, 0, lblCPool, 12,"Compiler switches available" },
	  {C_Button, btnCAddDef, 0, "Add", NoFrame,CA_None,
	    isSens,frmComp, 0, lstCPool,0,"Add new switch to pool"},
	  {C_Button, btnCDelDef, 0, "Del", NoFrame,CA_None,
	    isSens,frmComp, btnCAddDef, lstCPool,0,"Delete selected switch"},
	  {C_Button, btnCEditDef, 0, "Edit", NoList,CA_None,
	    isSens,frmComp, btnCDelDef, lstCPool,0,"Edit selected item"},

	  {C_Blank, blkCBlank1, 0, " ", NoList, CA_None, isSens,frmComp,lstCPool, txiCName},
	  {C_Blank, blkCBlank2, 0, " ", NoList, CA_None, isSens,frmComp,lstCPool, blkCBlank1},
	  {C_Blank, blkCBlank3, 0, " ", NoList, CA_None, isSens,frmComp,lstCPool, blkCBlank2},
	  {C_Button, btnCAdd, 0,   ">", NoFrame,CA_None,
	    isSens,frmComp, lstCPool, blkCBlank3,0,"Add to active switches"},

	  {C_Label, lblCDef, 0, " Use these switches ", NoList, CA_None,
	    isSens,frmComp, btnCAdd, txiCName},
	  {C_List,  lstCDef, 124, " ",  (void *)vtmp,
	    CA_ListWidth| CA_Size, isSens, frmComp,btnCAdd, lblCDef, 12,"Use these switches for compiler"},
	  {C_Button, btnCDel, 0,   "Del", NoFrame,CA_None,
	    isSens,frmComp, btnCAdd, lstCDef,0,"Delete from active switches"},


//Interpreter
	{C_ToggleFrame, frmInterp, 0, "",NoList,CA_NoBorder | CA_Hidden,isSens,frmTop, 0, 0},
	  {C_Label, lblIName, 0, " Java Interpreter: ", NoList, CA_None, isSens,frmInterp,0, 0},
	  {C_TextIn, txiIName, 0, " ", NoList, CA_Large, isSens,frmInterp,lblIName, 0,0,"Name of Java Interpreter"},
	  {C_Label, lblIPool, 0, " Interpreter Switch Pool", NoList, CA_None, isSens,frmInterp,0, txiIName},
	  {C_List,  lstIPool, 124, " ",  (void *) vtmp, 
	    CA_ListWidth | CA_Size, isSens, frmInterp, 0, lblIPool, 12,"Interpreter switches available" },
	  {C_Button, btnIAddDef, 0, "Add", NoFrame,CA_None,
	    isSens,frmInterp, 0, lstIPool,0,"Add new switch to pool"},
	  {C_Button, btnIDelDef, 0, "Del", NoFrame,CA_None,
	    isSens,frmInterp, btnIAddDef, lstIPool,0,"Delete selected switch"},
	  {C_Button, btnIEditDef, 0, "Edit", NoList,CA_None,
	    isSens,frmInterp, btnIDelDef, lstIPool,0,"Edit selected item"},

	  {C_Blank, blkIBlank1, 0, " ", NoList, CA_None, isSens,frmInterp,lstIPool, txiIName},
	  {C_Blank, blkIBlank2, 0, " ", NoList, CA_None, isSens,frmInterp,lstIPool, blkIBlank1},
	  {C_Blank, blkIBlank3, 0, " ", NoList, CA_None, isSens,frmInterp,lstIPool, blkIBlank2},
	  {C_Button, btnIAdd, 0,   ">", NoFrame,CA_None,
	    isSens,frmInterp, lstIPool, blkIBlank3,0,"Add to active switches"},

	  {C_Label, lblIDef, 0, " Use these switches ", NoList, CA_None,
	    isSens,frmInterp, btnIAdd, txiIName},
	  {C_List,  lstIDef, 124, " ",  (void *)vtmp,
	    CA_ListWidth| CA_Size, isSens, frmInterp,btnIAdd, lblIDef, 12,"Use these switches for intepreter"},
	  {C_Button, btnIDel, 0,   "Del", NoFrame,CA_None,
	    isSens,frmInterp, btnIAdd, lstIDef,0,"Delete from active switches"},


// Debugger
	{C_ToggleFrame, frmDebug, 0, "",NoList,CA_NoBorder | CA_Hidden,isSens,frmTop, 0, 0},
	  {C_Label, lblDName, 0, " Java Debugger: ", NoList, CA_None, isSens,frmDebug,0, 0},
	  {C_TextIn, txiDName, 0, " ", NoList, CA_Large, isSens,frmDebug,lblDName, 0,0,"Name of Java Debugger"},
	  {C_Label, lblDPool, 0, " Debugger Switch Pool", NoList, CA_None, isSens,frmDebug,0, txiDName},
	  {C_List,  lstDPool, 124, " ",  (void *) vtmp, 
	    CA_ListWidth | CA_Size, isSens, frmDebug, 0, lblDPool, 12,"Debugger switches available" },
	  {C_Button, btnDAddDef, 0, "Add", NoFrame,CA_None,
	    isSens,frmDebug, 0, lstDPool,0,"Add new switch to pool"},
	  {C_Button, btnDDelDef, 0, "Del", NoFrame,CA_None,
	    isSens,frmDebug, btnDAddDef, lstDPool,0,"Delete selected switch"},
	  {C_Button, btnDEditDef, 0, "Edit", NoList,CA_None,
	    isSens,frmDebug, btnDDelDef, lstDPool,0,"Edit selected item"},

	  {C_Blank, blkDBlank1, 0, " ", NoList, CA_None, isSens,frmDebug,lstDPool, txiDName},
	  {C_Blank, blkDBlank2, 0, " ", NoList, CA_None, isSens,frmDebug,lstDPool, blkDBlank1},
	  {C_Blank, blkDBlank3, 0, " ", NoList, CA_None, isSens,frmDebug,lstDPool, blkDBlank2},
	  {C_Button, btnDAdd, 0,   ">", NoFrame,CA_None,
	    isSens,frmDebug, lstDPool, blkDBlank3,0,"Add to active switches"},

	  {C_Label, lblDDef, 0, " Use these switches ", NoList, CA_None,
	    isSens,frmDebug, btnDAdd, txiDName},
	  {C_List,  lstDDef, 124, " ",  (void *)vtmp,
	    CA_ListWidth| CA_Size, isSens, frmDebug,btnDAdd, lblDDef, 12,"Use these switches for debugger"},
	  {C_Button, btnDDel, 0,   "Del", NoFrame,CA_None,
	    isSens,frmDebug, btnDAdd, lstDDef,0,"Delete from active switches"},

//@@ Add source directory

	{C_Button, M_OK, 0, "   OK   ", NoList, CA_DefaultButton,
	    isSens, NoFrame, 0, frmTogBtns,0,"Save project file"},

//	{C_Button, M_Cancel, 0, " Cancel ",NoList,CA_None,
//	    isSens,NoFrame, M_OK, frmTogBtns,0,"Abort Project Edit"},

	{C_EndOfList,0,0,0,0,CA_None,0,0,0}
      };
//@V@:EndDialogCmd

//===================>>> JavaProjectDialog::JavaProjectDialog <<<====================
  JavaProjectDialog::JavaProjectDialog(videJava* vjv, vBaseWindow* bw, char* title)
   	: vModalDialog(bw, title)
  {
    vj = vjv;			// save parent class
    cmdw = (videCmdWindow*) bw;
    ta = 0;
    AddDialogCmds(PCmds);
  }
  
//===================>>> JavaProjectDialog::~JavaProjectDialog <<<====================
  JavaProjectDialog::~JavaProjectDialog()
  {
    //IMPORTANT: set srcList back to original status!

    PCmds[vGetcmdIdIndex(srcList, PCmds)].itemList = (void * ) vtmp;
    SetValue(srcList,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstCPool, PCmds)].itemList = (void * ) vtmp;
    SetValue(lstCPool,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstCDef, PCmds)].itemList = (void * ) vtmp;
    SetValue(lstCDef,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstIPool, PCmds)].itemList = (void * ) vtmp;
    SetValue(lstIPool,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstIDef, PCmds)].itemList = (void * ) vtmp;
    SetValue(lstIDef,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstDPool, PCmds)].itemList = (void * ) vtmp;
    SetValue(lstDPool,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstDDef, PCmds)].itemList = (void * ) vtmp;
    SetValue(lstDDef,-1,ChangeListPtr);

  }

//====================>>> JavaProjectDialog::DialogDisplayed <<<====================
  void JavaProjectDialog::DialogDisplayed()
  {

    // Display only the top frame

    SetValue(tbtMain,1,Value);		SetValue(tbtFiles,0,Value);
    SetValue(tbtComp,0,Value);		SetValue(tbtInterp,0,Value);
    SetValue(tbtDebug,0,Value);

    SetValue(frmMain, 1, Value);	SetValue(frmFiles, 0, Value);
    SetValue(frmComp, 0, Value);	SetValue(frmInterp, 0, Value);
    SetValue(frmDebug, 0, Value);

    // set dialog values to the ones from the videJava object

    SetString(txiTopFile, vj->mainFile);
    SetString(txiHTML, vj->appletHTML);
    SetString(txiCPath, vj->classPath);

    SetString(txiCName, vj->compilerName);
    SetString(txiIName, vj->interpName);
    SetString(txiDName, vj->debugName);
    SetString(txiSrcDir, vj->srcDir);

    // set to current lists
    PCmds[vGetcmdIdIndex(srcList, PCmds)].itemList =
	(void * ) (vj->srcFiles.list);
    SetValue(srcList,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstCPool, PCmds)].itemList =
	(void * ) (vj->compOptsPool.list);
    SetValue(lstCPool,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstCDef, PCmds)].itemList =
	(void * ) (vj->compOpts.list);
    SetValue(lstCDef,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstIPool, PCmds)].itemList =
	(void * ) (vj->interpOptsPool.list);
    SetValue(lstIPool,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstIDef, PCmds)].itemList =
	(void * ) (vj->interpOpts.list);
    SetValue(lstIDef,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstDPool, PCmds)].itemList =
	(void * ) (vj->debugOptsPool.list);
    SetValue(lstDPool,-1,ChangeListPtr);

    PCmds[vGetcmdIdIndex(lstDDef, PCmds)].itemList =
	(void * ) (vj->debugOpts.list);
    SetValue(lstDDef,-1,ChangeListPtr);

  }

//====================>>> JavaProjectDialog::editProject <<<====================
  int JavaProjectDialog::editProject()
  {
    ItemVal dans, rval;

    dans = ShowModalDialog("Java Project Editor",rval);

    if (dans == M_Cancel)
	return Cancel;

    // have to retrieve values now...

    GetTextIn(txiTopFile, vj->mainFile, 255);
    GetTextIn(txiHTML, vj->appletHTML, 255);
    GetTextIn(txiCPath, vj->classPath, 255);

    GetTextIn(txiCName, vj->compilerName, 255);
    GetTextIn(txiIName, vj->interpName, 255);
    GetTextIn(txiDName, vj->debugName, 255);
    GetTextIn(txiSrcDir, vj->srcDir, 255);

    return NoBuild;
  }

//====================>>> JavaProjectDialog::DialogCommand <<<====================
  void JavaProjectDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType ctype)
  {
    UserDebug2(CmdEvents,"JavaProjectDialog::DialogCommand(id:%d, val:%d)\n",id, retval)

    switch (id)		// We will do some things depending on value
      {

	case tbtMain:
          {
	    SetValue(tbtMain,1,Value);		SetValue(tbtFiles,0,Value);
	    SetValue(tbtComp,0,Value);		SetValue(tbtInterp,0,Value);
	    SetValue(tbtDebug,0,Value);

	    SetValue(frmMain, 1, Value);	SetValue(frmFiles, 0, Value);
	    SetValue(frmComp, 0, Value);	SetValue(frmInterp, 0, Value);
	    SetValue(frmDebug, 0, Value);
	    break;
          }

	case tbtFiles:
          {
	    SetValue(tbtMain,0,Value);		SetValue(tbtFiles,1,Value);
	    SetValue(tbtComp,0,Value);		SetValue(tbtInterp,0,Value);
	    SetValue(tbtDebug,0,Value);

	    SetValue(frmMain, 0, Value);	SetValue(frmFiles, 1, Value);
	    SetValue(frmComp, 0, Value);	SetValue(frmInterp, 0, Value);
	    SetValue(frmDebug, 0, Value);
	    break;
          }

	case tbtComp:
          {
	    SetValue(tbtMain,0,Value);		SetValue(tbtFiles,0,Value);
	    SetValue(tbtComp,1,Value);		SetValue(tbtInterp,0,Value);
	    SetValue(tbtDebug,0,Value);

	    SetValue(frmMain, 0, Value);	SetValue(frmFiles, 0, Value);
	    SetValue(frmComp, 1, Value);	SetValue(frmInterp, 0, Value);
	    SetValue(frmDebug, 0, Value);
	    break;
          }

	case tbtInterp:
          {
	    SetValue(tbtMain,0,Value);		SetValue(tbtFiles,0,Value);
	    SetValue(tbtComp,0,Value);		SetValue(tbtInterp,1,Value);
	    SetValue(tbtDebug,0,Value);

	    SetValue(frmMain, 0, Value);	SetValue(frmFiles, 0, Value);
	    SetValue(frmComp, 0, Value);	SetValue(frmInterp, 1, Value);
	    SetValue(frmDebug, 0, Value);
	    break;
          }

	case tbtDebug:
          {
	    SetValue(tbtMain,0,Value);		SetValue(tbtFiles,0,Value);
	    SetValue(tbtComp,0,Value);		SetValue(tbtInterp,0,Value);
	    SetValue(tbtDebug,1,Value);

	    SetValue(frmMain, 0, Value);	SetValue(frmFiles, 0, Value);
	    SetValue(frmComp, 0, Value);	SetValue(frmInterp, 0, Value);
	    SetValue(frmDebug, 1, Value);
	    break;
          }



        case btnAddSrcFile:
	  {
	    char MSDOSpath[maxFileNameSize]= "";
	    int fi = 0;
	    static char* makeFilter[] = {"*.java", "*.*", 0};
	    vFileSelect fsel(this);

	    int oans = fsel.FileSelect("Add a Source File",
                                     MSDOSpath,99, makeFilter,fi);
	    if (oans && *MSDOSpath) //filename picked
	      {
		ta=1; // target file added!
		if (!vj->addFile(MSDOSpath))
		  {
		    vNoticeDialog note(this);
		    note.Notice("File already selected for this Project");
		  }
	      }
	    SetValue(srcList,-1,ChangeList); // update list & unselect!

	    break;
	  }	//@V@:EndCase

        case btnDelSrcFile:
	  {
            int lval = GetValue(srcList); 
            if (lval < 0)
		break;
	    vj->srcFiles.deleteItem(lval);
	    SetValue(srcList,-1,ChangeList); // update list & unselect!

	  }	//@V@:EndCase

	case btnEditSrcFile:
	  {
            vReplyDialog newDefDlg(this);
            int ans;
            char r[100];

            int lval = GetValue(srcList);
            if (lval < 0)
		break;

            ans=newDefDlg.Reply("Edit Source filename", r, 99,
		vj->srcFiles.list[lval]);
            if (ans==M_Cancel)
		 break;
            if (*r)
              {
		vj->srcFiles.replace(lval,r);
              }
            SetValue(srcList,-1,ChangeListPtr); //update list & unselect!
	    break;
	  }

	case btnCAddDef:	// Add Compiler switch
	  {
            vReplyDialog newDefDlg(this);
            int ans;
            char r[100];

            ans=newDefDlg.Reply("Enter new switch (description in parens):", r, 99);
            if (ans==M_Cancel)
		 break;
            if (*r)
              {
		vj->compOptsPool.insert(-1,r);
              }
            SetValue(lstCPool,-1,ChangeListPtr); //update list & unselect!
            break;
          }

	case btnIAddDef:	// Add interpreter switch
	  {
            vReplyDialog newDefDlg(this);
            int ans;
            char r[100];

            ans=newDefDlg.Reply("Enter new switch (description in parens):", r, 99);
            if (ans==M_Cancel)
		 break;
            if (*r)
              {
		vj->interpOptsPool.insert(-1,r);
              }
            SetValue(lstIPool,-1,ChangeListPtr); //update list & unselect!
            break;
          }

	case btnDAddDef:	// add debugger switch
	  {
            vReplyDialog newDefDlg(this);
            int ans;
            char r[100];

            ans=newDefDlg.Reply("Enter new switch (description in parens):", r, 99);
            if (ans==M_Cancel)
		 break;
            if (*r)
              {
		vj->debugOptsPool.insert(-1,r);
              }
            SetValue(lstDPool,-1,ChangeListPtr); //update list & unselect!
            break;
          }


        case btnCDelDef:		// delete compiler switch
          {
            int lval = GetValue(lstCPool); 
            if (lval < 0)
		break;
	    vj->compOptsPool.deleteItem(lval);
            SetValue(lstCPool,-1,ChangeListPtr); //update list & unselect!
            break;
          } //@V@:EndCase


        case btnIDelDef:		// delete interp switch
          {
            int lval = GetValue(lstIPool); 
            if (lval < 0)
		break;
	    vj->interpOptsPool.deleteItem(lval);
            SetValue(lstIPool,-1,ChangeListPtr); //update list & unselect!
            break;
          } //@V@:EndCase


        case btnDDelDef:		// delete debug switch
          {
            int lval = GetValue(lstDPool); 
            if (lval < 0)
		break;
	    vj->debugOptsPool.deleteItem(lval);
            SetValue(lstDPool,-1,ChangeListPtr); //update list & unselect!
            break;
          } //@V@:EndCase


	case btnCEditDef:		// Edit comp switch
	  {
            vReplyDialog newDefDlg(this);
            int ans;
            char r[100];

            int lval = GetValue(lstCPool);
            if (lval < 0)
		break;

            ans=newDefDlg.Reply("Edit switch", r, 99,
		vj->compOptsPool.list[lval]);
            if (ans==M_Cancel)
		 break;
            if (*r)
              {
		vj->compOptsPool.replace(lval,r);
              }
            SetValue(lstCPool,-1,ChangeListPtr); //update list & unselect!
	    break;
	  }

	case btnIEditDef:		// Edit interp switch
	  {
            vReplyDialog newDefDlg(this);
            int ans;
            char r[100];

            int lval = GetValue(lstIPool);
            if (lval < 0)
		break;

            ans=newDefDlg.Reply("Edit switch", r, 99,
		vj->interpOptsPool.list[lval]);
            if (ans==M_Cancel)
		 break;
            if (*r)
              {
		vj->interpOptsPool.replace(lval,r);
              }
            SetValue(lstIPool,-1,ChangeListPtr); //update list & unselect!
	    break;
	  }

	case btnDEditDef:		// Edit debug switch
	  {
            vReplyDialog newDefDlg(this);
            int ans;
            char r[100];

            int lval = GetValue(lstDPool);
            if (lval < 0)
		break;

            ans=newDefDlg.Reply("Edit switch", r, 99,
		vj->debugOptsPool.list[lval]);
            if (ans==M_Cancel)
		 break;
            if (*r)
              {
		vj->debugOptsPool.replace(lval,r);
              }
            SetValue(lstDPool,-1,ChangeListPtr); //update list & unselect!
	    break;
	  }

        case btnCAdd:		// add to compiler switch list
	  {
            int lval=GetValue(lstCPool); 
            if (lval < 0)
		break;
	    char r[100];
	    char *rp = r;
	    for (char *cp = vj->compOptsPool.list[lval] ; *cp ; )
	      {
		if (*cp == '(')	// delete the comment
		  {
		    if (*(rp-1) == ' ')
			*(rp-1) = 0;
		    else
			*rp = 0;
		    break;
		  }
		*rp++ = *cp++;
	      }
	    *rp = 0;

	    vj->compOpts.insert(-1,r);		// add to switch list
            SetValue(lstCDef,-1,ChangeListPtr); //update list & unselect!
            SetValue(lstCPool,-1,ChangeListPtr); // unselect!
            break;
	  }	//@V@:EndCase

        case btnIAdd:		// add to interp switch list
	  {
            int lval=GetValue(lstIPool); 
            if (lval < 0)
		break;
	    char r[100];
	    char *rp = r;
	    for (char *cp = vj->interpOptsPool.list[lval] ; *cp ; )
	      {
		if (*cp == '(')	// delete the comment
		  {
		    if (*(rp-1) == ' ')
			*(rp-1) = 0;
		    else
			*rp = 0;
		    break;
		  }
		*rp++ = *cp++;
	      }
	    *rp = 0;

	    vj->interpOpts.insert(-1,r);		// add to switch list
            SetValue(lstIDef,-1,ChangeListPtr); //update list & unselect!
            SetValue(lstIPool,-1,ChangeListPtr); // unselect!
            break;
	  }	//@V@:EndCase

        case btnDAdd:		// add to debug switch list
	  {
            int lval=GetValue(lstDPool); 
            if (lval < 0)
		break;
	    char r[100];
	    char *rp = r;
	    for (char *cp = vj->debugOptsPool.list[lval] ; *cp ; )
	      {
		if (*cp == '(')	// delete the comment
		  {
		    if (*(rp-1) == ' ')
			*(rp-1) = 0;
		    else
			*rp = 0;
		    break;
		  }
		*rp++ = *cp++;
	      }
	    *rp = 0;

	    vj->debugOpts.insert(-1,r);		// add to switch list
            SetValue(lstDDef,-1,ChangeListPtr); //update list & unselect!
            SetValue(lstDPool,-1,ChangeListPtr); // unselect!
            break;
	  }	//@V@:EndCase

        case btnCDel:		// delete from active comp switches
	    {
            int lval=GetValue(lstCDef); 
            if (lval < 0)
		break;
	    vj->compOpts.deleteItem(lval);	// add to def list
            SetValue(lstCDef, -1, ChangeListPtr); //update list & unselect!

            break;
	    }	//@V@:EndCase

        case btnIDel:		// delete from active interp switches
	    {
            int lval=GetValue(lstIDef); 
            if (lval < 0)
		break;
	    vj->interpOpts.deleteItem(lval);	// add to def list
            SetValue(lstIDef, -1, ChangeListPtr); //update list & unselect!

            break;
	    }	//@V@:EndCase

        case btnDDel:		// delete from active comp switches
	    {
            int lval=GetValue(lstDDef); 
            if (lval < 0)
		break;
	    vj->debugOpts.deleteItem(lval);	// add to def list
            SetValue(lstDDef, -1, ChangeListPtr); //update list & unselect!

            break;
	    }	//@V@:EndCase

#ifdef XXXXX
	case btnBrwSrcD:		// browse path
	  {
	    char MSDOSpath[100]= "";
	    int fi = 0;
	    static char* makeFilter[] = {"*.o", "*.*", 0};
	    vFileSelect fsel(this);

	    fsel.FileSelect("Select a file in the Src Directory",
                                     MSDOSpath,99, makeFilter,fi);
            char uxfn[100]="";
            Dos2UxFName(MSDOSpath, uxfn, 1);
            SetString(txiSrcPath, uxfn);
            break;
          }
#endif
      }//switch

    vModalDialog::DialogCommand(id,retval,ctype);
  }

//------------------------------------------------------------------------
