1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
|
//=======================================================================
//@V@:Note: This file generated by vappgen V 1.00.
// vgmdlg.cpp: Source for vgModalDialog class
//=======================================================================
#include "vgmdlg.h"
#include <v/vnotice.h>
#include <v/vfilesel.h>
//@V@:BeginIDs
enum {
lblMainMsg = 1000,
frmNames,
lblAppName, // App name
txiAppName,
lblFileName, // file base name
txiFileName,
lblTitle, // app title
txiTitle,
frmCmdWin, // frame for cmdwin stuff
lblCmdWin,
blkCmdWin,
chkGenTool, // if generate toolbar
chkWinSDI, // if Windows SDI
chkGenStatus, // if generate status bar
chkGenDate,
frmCanvas, // frame for canvas stuff
lblCanvas,
blkCanvas,
chkVScroll, // for vert scroll
chkHScroll, // for horiz scroll
rdbStdCnv, // Standard Canvas
rdbTextCnv, // Text Canvas
frmOther, // frame for other options
lblOther,
blkOther,
chkGenDialog, // if generate a dialog
chkGenModal, // if generate a modal dialog
chkGenMake, // if generate make file
lblHOMEV,
txiHOMEV,
btnSetPath, // to set save path
blkLast
};
//@V@:EndIds
//@V@:BeginDialogCmd DefaultCmds
static DialogCmd DefaultCmds[] =
{
{C_Label, lblMainMsg, 0,"X",NoList,CA_MainMsg,isSens,NoFrame, 0, 0},
{C_Frame, frmNames, 0, "",NoList,CA_NoBorder,isSens,NoFrame, 0,lblMainMsg},
{C_Label, lblAppName, 0,"Application Base Name:",
NoList, CA_None, isSens,frmNames,0, 0},
{C_TextIn, txiAppName, 0,"x",
NoList, CA_None, isSens,frmNames,lblAppName, 0},
{C_Label, lblFileName, 0," File Base Name:",
NoList, CA_None, isSens,frmNames,0, txiAppName},
{C_TextIn, txiFileName, 0,"x",
NoList, CA_None, isSens,frmNames,lblFileName, txiAppName},
{C_Label, lblTitle, 0, " Application Title:",
NoList, CA_None, isSens,frmNames,0, txiFileName},
{C_TextIn, txiTitle, 0,"x",
NoList, CA_None, isSens,frmNames,lblTitle, txiFileName},
{C_Frame, frmCmdWin, 0, "",NoList,CA_NoBorder,isSens,NoFrame, 0,frmNames},
{C_Label, lblCmdWin, 0, "Command Window Options",
NoList, CA_None, isSens,frmCmdWin,0, 0},
{C_Blank, blkCmdWin, 0, " ",
NoList, CA_None, isSens,frmCmdWin,0, lblCmdWin},
{C_CheckBox, chkGenTool, 1, "Include Tool Bar ",
NoList, CA_None, isSens,frmCmdWin,blkCmdWin, lblCmdWin},
{C_CheckBox, chkGenStatus, 1, "Include Status Bar",
NoList, CA_None, isSens,frmCmdWin,chkGenTool, lblCmdWin},
{C_CheckBox, chkWinSDI, 0, "Windows SDI (MDI Default)",
NoList, CA_None, isSens,frmCmdWin,blkCmdWin, chkGenTool},
{C_CheckBox, chkGenDate, 0, "Time/Date on Status Bar",
NoList, CA_None, isSens,frmCmdWin,chkWinSDI, chkGenStatus},
{C_Frame, frmCanvas, 0, "",NoList,CA_NoBorder,isSens,NoFrame, 0,frmCmdWin},
{C_Label, lblCanvas, 0, "Canvas Options",
NoList, CA_None, isSens,frmCanvas,0, 0},
{C_Blank, blkCanvas, 0, " ",
NoList, CA_None, isSens,frmCanvas,0, lblCanvas},
{C_CheckBox, chkVScroll, 1, "Vertical Scroll Bar ",
NoList, CA_None, isSens,frmCanvas,blkCanvas, lblCanvas},
{C_CheckBox, chkHScroll, 1, "Horizontal Scroll Bar",
NoList, CA_None, isSens,frmCanvas,chkVScroll, lblCanvas},
{C_RadioButton, rdbStdCnv, 1, "vCanvasPane ",
NoList, CA_None, isSens,frmCanvas,blkCanvas, chkVScroll},
{C_RadioButton, rdbTextCnv, 0, "vTextCanvasPane",
NoList, CA_None, isSens,frmCanvas,rdbStdCnv, chkVScroll},
{C_Frame, frmOther, 0, "",NoList,CA_NoBorder,isSens,NoFrame, 0,frmCanvas},
{C_Label, lblOther, 0, "Other Options",
NoList, CA_None, isSens,frmOther,0, 0},
{C_Blank, blkOther, 0, " ",
NoList, CA_None, isSens,frmOther,0, lblOther},
{C_CheckBox, chkGenDialog, 1, "Generate Modeless Dialog ",
NoList, CA_None, isSens,frmOther,blkOther, lblOther},
{C_CheckBox, chkGenModal, 0, "Generate Modal Dialog",
NoList, CA_None, isSens,frmOther,chkGenDialog, lblOther},
#ifdef V_VersionX // X version
{C_CheckBox, chkGenMake, 1, "Generate GNU makefile",
NoList, CA_None, isSens,frmOther,blkOther, chkGenModal},
#else // Windows Version
{C_CheckBox, chkGenMake, 0, "Generate GNU makefile",
NoList, CA_None, isSens,frmOther,blkOther, chkGenModal},
#endif
{C_Label, lblHOMEV, 0," HOMEV:",
NoList, CA_None, isSens,frmOther,chkGenMake, chkGenModal},
{C_TextIn, txiHOMEV, 0,"x",
NoList, CA_Small, isSens,frmOther,lblHOMEV, chkGenModal,20},
{C_Button, btnSetPath, 0, " Set Save Path ",NoList,CA_None,
isSens,NoFrame,0, frmOther},
{C_Blank, blkLast, 0, " ",
NoList,CA_None, isSens,NoFrame,btnSetPath, frmOther},
{C_Button, M_Cancel, 0, " Cancel ",NoList,CA_None,
isSens,NoFrame,blkLast, frmOther},
{C_Button, M_OK, 0, " Generate ", NoList, CA_DefaultButton,
isSens, NoFrame, M_Cancel, frmOther},
{C_EndOfList,0,0,0,0,CA_None,0,0,0}
};
//@V@:EndDialogCmd
//==========================>>> SetCmdObjAttr <<<==============================
void SetCmdObjTitle(CommandObject* cList, ItemVal id, char* newtitle)
{
// This is called to change the attrs field of the item with given id
// scan the entire list
int ix;
for (ix = 0 ; cList && (cList[ix].cmdType != C_EndOfList) ; ++ix)
{
if (cList[ix].cmdId == id) // the one we want!
{
cList[ix].title = newtitle; // change
break;
}
}
}
//======================>>> vgModalDialog::vgModalDialog <<<==================
vgModalDialog::vgModalDialog(vBaseWindow* bw, char* title) :
vModalDialog(bw,title)
{
UserDebug(Constructor,"vgModalDialog::vgModalDialog()\n")
}
//===================>>> vgModalDialog::~vgModalDialog <<<====================
vgModalDialog::~vgModalDialog()
{
UserDebug(Destructor,"vgModalDialog::~vgModalDialog() destructor\n")
}
//====================>>> vgModalDialog::vgAction <<<====================
int vgModalDialog::vgAction(char* msg, vgOptions& op)
{
ItemVal ans,rval;
SetCmdObjTitle(DefaultCmds,txiAppName,op.appName);
SetCmdObjTitle(DefaultCmds,txiFileName,op.fileName);
SetCmdObjTitle(DefaultCmds,txiTitle,op.title);
SetCmdObjTitle(DefaultCmds,txiHOMEV,op.home);
AddDialogCmds(DefaultCmds); // add the predefined commands
ans = ShowModalDialog(msg,rval);
if (ans == M_Cancel)
return 0;
// Retrieve values from fields of the dialog
(void) GetTextIn(txiAppName,op.appName,99);
(void) GetTextIn(txiFileName,op.fileName,99);
(void) GetTextIn(txiTitle,op.title,99);
(void) GetTextIn(txiHOMEV,op.home,99);
op.addDialog = GetValue(chkGenDialog);
op.addModal = GetValue(chkGenModal);
op.addMake = GetValue(chkGenMake);
op.addToolBar = GetValue(chkGenTool);
op.addStatus = GetValue(chkGenStatus);
if (op.addStatus)
op.addDate = GetValue(chkGenDate);
else
op.addDate = 0;
op.vScroll = GetValue(chkVScroll);
op.hScroll = GetValue(chkHScroll);
op.fullMenu = 1;
if (GetValue(rdbStdCnv) == 1)
op.canvasType = 0;
else
op.canvasType = 1;
op.winSDI = GetValue(chkWinSDI);
// *** Add code to process dialog values here
return ans == M_OK;
}
//====================>>> vgModalDialog::DialogCommand <<<====================
void vgModalDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType ctype)
{
UserDebug2(CmdEvents,"vgModalDialog::DialogCommand(id:%d, val:%d)\n",id, retval)
switch (id) // We will do some things depending on value
{
case chkGenStatus: // Need to toggle sensitivity of Date
{
if (retval == 1)
{
SetValue(chkGenDate,1,Sensitive);
}
else
{
SetValue(chkGenDate,0,Value);
SetValue(chkGenDate,0,Sensitive);
}
break;
}
case btnSetPath: // set path to save in
{
char path[100];
int tmp = 0;
(void) GetTextIn(txiFileName,path,99);
strcat(path,"app.cpp"); // use xxapp.cpp as default name
vFileSelect fsel(this);
int oans = fsel.FileSelectSave("Save code in directory",
path,99,NULL,tmp);
break;
}
}
vModalDialog::DialogCommand(id,retval,ctype);
}
|