void MainWindow::SaveFile(){ if (filepath.isEmpty()){ SaveFileAs(); } else { WriteFile(); } }
void CVICALLBACK clbMenuSaveAsFile (int menuBar, int menuItem, void *callbackData, int panel) { int bLastSaveChanges = bSaveChanges; bSaveChanges = 1; SaveFileAs( 1 , 0 ); if ( bSaveChanges ) bSaveChanges = bLastSaveChanges; }
/****************************************************************************** Function Name : SaveFile Input(s) : Output : HRESULT Functionality : Member of : CTestSetupEntity Friend of : - Author(s) : Venkatanarayana Makam Date Created : 06/04/2011 Modifications : Codetag : CS005 ******************************************************************************/ HRESULT CTestSetupEntity::SaveFile(void) { if(m_omstrCurrentTSFile != def_EMPTYFILENAME) //We dont have a file path { SaveFileAs(m_omstrCurrentTSFile); } else { return S_FALSE; } return S_FALSE; }
int CVICALLBACK clbExit (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: SaveFileAs( 1 , 1 ); QuitUserInterface (0); break; } return 0; }
void CVICALLBACK clbMenuOpenFile (int menuBar, int menuItem, void *callbackData, int panel) { char szFilePath[STD_STRING] = {0}; SaveFileAs( 1 , 1 ); if ( FileSelectPopup ("", "*.icscnf", "*.icscnf", "Load", VAL_LOAD_BUTTON, 0, 1, 1, 1, szFilePath )) { bSaveChanges = 0; OpenConfigurationFile( szFilePath ); UpdateList( panel ); UpdateCurrentItem( panel ); } }
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); settings = new QSettings("lumina-desktop","lumina-textedit"); Custom_Syntax::SetupDefaultColors(settings); //pre-load any color settings as needed colorDLG = new ColorDialog(settings, this); this->setWindowTitle(tr("Text Editor")); ui->tabWidget->clear(); closeFindS = new QShortcut(QKeySequence(Qt::Key_Escape), this); connect(closeFindS, SIGNAL(activated()), this, SLOT(closeFindReplace()) ); ui->groupReplace->setVisible(false); //Update the menu of available syntax highlighting modes QStringList smodes = Custom_Syntax::availableRules(); for(int i=0; i<smodes.length(); i++){ ui->menuSyntax_Highlighting->addAction(smodes[i]); } ui->actionLine_Numbers->setChecked( settings->value("showLineNumbers",true).toBool() ); ui->actionWrap_Lines->setChecked( settings->value("wrapLines",true).toBool() ); //Setup any connections connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) ); connect(ui->actionNew_File, SIGNAL(triggered()), this, SLOT(NewFile()) ); connect(ui->actionOpen_File, SIGNAL(triggered()), this, SLOT(OpenFile()) ); connect(ui->actionClose_File, SIGNAL(triggered()), this, SLOT(CloseFile()) ); connect(ui->actionSave_File, SIGNAL(triggered()), this, SLOT(SaveFile()) ); connect(ui->actionSave_File_As, SIGNAL(triggered()), this, SLOT(SaveFileAs()) ); connect(ui->menuSyntax_Highlighting, SIGNAL(triggered(QAction*)), this, SLOT(UpdateHighlighting(QAction*)) ); connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged()) ); connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) ); connect(ui->actionLine_Numbers, SIGNAL(toggled(bool)), this, SLOT(showLineNumbers(bool)) ); connect(ui->actionWrap_Lines, SIGNAL(toggled(bool)), this, SLOT(wrapLines(bool)) ); connect(ui->actionCustomize_Colors, SIGNAL(triggered()), this, SLOT(ModifyColors()) ); connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(openFind()) ); connect(ui->actionReplace, SIGNAL(triggered()), this, SLOT(openReplace()) ); connect(ui->tool_find_next, SIGNAL(clicked()), this, SLOT(findNext()) ); connect(ui->tool_find_prev, SIGNAL(clicked()), this, SLOT(findPrev()) ); connect(ui->tool_replace, SIGNAL(clicked()), this, SLOT(replaceOne()) ); connect(ui->tool_replace_all, SIGNAL(clicked()), this, SLOT(replaceAll()) ); connect(ui->line_find, SIGNAL(returnPressed()), this, SLOT(findNext()) ); connect(ui->line_replace, SIGNAL(returnPressed()), this, SLOT(replaceOne()) ); connect(colorDLG, SIGNAL(colorsChanged()), this, SLOT(UpdateHighlighting()) ); updateIcons(); //Now load the initial size of the window QSize lastSize = settings->value("lastSize",QSize()).toSize(); if(lastSize.width() > this->sizeHint().width() && lastSize.height() > this->sizeHint().height() ){ this->resize(lastSize); } }
/* * DoKeyboardSave - handle the CTRL+S keyboard shortcut */ vi_rc DoKeyboardSave( void ) { #ifdef __WIN__ vi_rc rc; char fname[_MAX_FNAME]; if( CurrentFile != NULL ) { _splitpath( CurrentFile->name, NULL, NULL, fname, NULL ); } else { fname[0] = 0; } if( strcmp( fname, "untitled" ) == 0 ) { rc = SaveFileAs(); } else { rc = FancyFileSave(); } return( rc ); #else return( FancyFileSave() ); #endif } /* DoKeyboardSave */
bool CTwiBootProgDoc::SaveFile() { CString FilePath = GetPathName(); CString FileName = GetTitle(); if ((m_FileType == ftUnknown) || FileName.IsEmpty() || FileName.IsEmpty()) return SaveFileAs(); bool rVal = false; switch (m_FileType) { case ftBinary: rVal = SaveBinary(FilePath); break; case ftIntelHex: rVal = SaveIntelHex(FilePath); break; default: ASSERT(FALSE); rVal = false; break; } if (rVal) SetModifiedFlag(FALSE); return rVal; }
void CMainFrame::_connectWidgets() { connect(ui.actionOuvrir, SIGNAL(triggered()), this, SLOT(OpenFile())); connect(ui.actionFermer, SIGNAL(triggered()), this, SLOT(CloseFile())); connect(ui.actionFusionner, SIGNAL(triggered()), this, SLOT(MergeFile())); connect(ui.actionPlein_cran, SIGNAL(triggered(bool)), this, SLOT(SwitchFullscreen(bool))); connect(ui.actionStop, SIGNAL(triggered()), this, SLOT(Stop())); connect(ui.actionJouer, SIGNAL(triggered(bool)), this, SLOT(Play(bool))); connect(ui.action_propos, SIGNAL(triggered()), this, SLOT(About())); connect(ui.actionQt, SIGNAL(triggered()), this, SLOT(AboutQt())); connect(ui.actionGrille, SIGNAL(triggered(bool)), this, SLOT(ShowGrid(bool))); connect(ui.actionModel_3D, SIGNAL(triggered(bool)), m_modelViewer, SLOT(ShowModel3D(bool))); connect(ui.actionEnregistrer, SIGNAL(triggered()), this, SLOT(SaveFile())); connect(ui.actionEnregistrer_sous, SIGNAL(triggered()), this, SLOT(SaveFileAs())); connect(ui.actionCouleur_du_fond, SIGNAL(triggered()), this, SLOT(SetBackgroundColor())); connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(SetLanguage(QAction*))); connect(m_timeline, SIGNAL(CurrentFrameChanged(int)), m_modelViewer, SLOT(SetFrame(int))); connect(m_timeline, SIGNAL(SelectionChanged(int, int)), this, SLOT(EditKey(int, int))); connect(m_timeline, SIGNAL(KeyModified(int, int, bool)), this, SLOT(EditKeyModified(int, int, bool))); connect(ui.listParts, SIGNAL(currentRowChanged(int)), this, SLOT(ListPartChanged(int))); connect(ui.actionAjouter_une_partie, SIGNAL(triggered()), this, SLOT(AddPart())); connect(ui.actionSupprimer_la_partie, SIGNAL(triggered()), this, SLOT(RemovePart())); connect(ui.btnRemovePart, SIGNAL(clicked()), this, SLOT(RemovePart())); connect(ui.btnAddPart, SIGNAL(clicked()), this, SLOT(AddPart())); connect(ui.editKeyPosX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosX(double))); connect(ui.editKeyPosY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosY(double))); connect(ui.editKeyPosZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosZ(double))); connect(ui.editKeyPosRotX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosRotX(double))); connect(ui.editKeyPosRotY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosRotY(double))); connect(ui.editKeyPosRotZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyPosRotZ(double))); connect(ui.editKeyRotX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyRotX(double))); connect(ui.editKeyRotY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyRotY(double))); connect(ui.editKeyRotZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyRotZ(double))); connect(ui.editKeyScaleX, SIGNAL(valueChanged(double)), this, SLOT(EditKeyScaleX(double))); connect(ui.editKeyScaleY, SIGNAL(valueChanged(double)), this, SLOT(EditKeyScaleY(double))); connect(ui.editKeyScaleZ, SIGNAL(valueChanged(double)), this, SLOT(EditKeyScaleZ(double))); connect(ui.editKeyAlpha, SIGNAL(valueChanged(int)), this, SLOT(EditKeyAlpha(int))); connect(ui.editPartName, SIGNAL(textEdited(const QString&)), this, SLOT(EditPartName(const QString&))); connect(ui.editPartVisible, SIGNAL(toggled(bool)), this, SLOT(EditPartVisible(bool))); connect(ui.editPartBill, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(EditPartBill(const QString&))); connect(ui.editPartBlend, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(EditPartAlpha(const QString&))); connect(ui.editPartTexture, SIGNAL(editingFinished()), this, SLOT(EditPartTextureName())); connect(ui.btnSetPartTexture, SIGNAL(clicked()), this, SLOT(EditPartTexture())); connect(ui.editPartTexFrame, SIGNAL(valueChanged(int)), this, SLOT(EditPartTexFrame(int))); connect(ui.editPartTexLoop, SIGNAL(valueChanged(int)), this, SLOT(EditPartTexLoop(int))); connect(ui.editCustomMeshPointCount, SIGNAL(valueChanged(int)), this, SLOT(EditPartPointCount(int))); connect(ui.editParticleCreate, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleCreate(int))); connect(ui.editParticleCreateNum, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleCreateNum(int))); connect(ui.editParticleFrameAppear, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleFrameAppear(int))); connect(ui.editParticleFrameKeep, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleFrameKeep(int))); connect(ui.editParticleFrameDisappear, SIGNAL(valueChanged(int)), this, SLOT(EditPartParticleFrameDisappear(int))); connect(ui.editParticleStartPosVar, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleStartPosVar(double))); connect(ui.editParticleStartPosVarY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleStartPosVarY(double))); connect(ui.editParticleYLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleYLow(double))); connect(ui.editParticleYHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleYHigh(double))); connect(ui.editParticleXZLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleXZLow(double))); connect(ui.editParticleXZHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleXZHigh(double))); connect(ui.editParticleAccelX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleAccelX(double))); connect(ui.editParticleAccelY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleAccelY(double))); connect(ui.editParticleAccelZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleAccelZ(double))); connect(ui.editParticleScaleX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleX(double))); connect(ui.editParticleScaleY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleY(double))); connect(ui.editParticleScaleZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleZ(double))); connect(ui.editParticleRotationLowX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationLowX(double))); connect(ui.editParticleRotationLowY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationLowY(double))); connect(ui.editParticleRotationLowZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationLowZ(double))); connect(ui.editParticleRotationHighX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationHighX(double))); connect(ui.editParticleRotationHighY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationHighY(double))); connect(ui.editParticleRotationHighZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleRotationHighZ(double))); connect(ui.editParticleScalSpeedXLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedXLow(double))); connect(ui.editParticleScalSpeedYLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedYLow(double))); connect(ui.editParticleScalSpeedZLow, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedZLow(double))); connect(ui.editParticleScalSpeedXHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedXHigh(double))); connect(ui.editParticleScalSpeedYHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedYHigh(double))); connect(ui.editParticleScalSpeedZHigh, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScalSpeedZHigh(double))); connect(ui.editParticleRepeatScale, SIGNAL(toggled(bool)), this, SLOT(EditPartParticleRepeatScale(bool))); connect(ui.editParticleRepeat, SIGNAL(toggled(bool)), this, SLOT(EditPartParticleRepeat(bool))); connect(ui.editParticleScaleEndX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleEndX(double))); connect(ui.editParticleScaleEndY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleEndY(double))); connect(ui.editParticleScaleEndZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleEndZ(double))); connect(ui.editParticleScaleSpeedX, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleSpeedX(double))); connect(ui.editParticleScaleSpeedY, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleSpeedY(double))); connect(ui.editParticleScaleSpeedZ, SIGNAL(valueChanged(double)), this, SLOT(EditPartParticleScaleSpeedZ(double))); }
void CVICALLBACK clbMenuExit (int menuBar, int menuItem, void *callbackData, int panel) { SaveFileAs( 1 , 1 ); QuitUserInterface (0); }
void CVICALLBACK clbMenuSaveFile (int menuBar, int menuItem, void *callbackData, int panel) { SaveFileAs( 0 , 0 ); }
/* * RunCommandLine - run a command line command */ vi_rc RunCommandLine( const char *cmdl ) { int i, x, y, x2, y2; bool n1f, n2f; int tkn, flag; bool test1; linenum n1, n2; char st[FILENAME_MAX]; info *cinfo; long val; jmp_buf jmpaddr; vi_rc rc; const char *data; /* * parse command string */ tkn = TOK_INVALID; rc = ParseCommandLine( cmdl, &n1, &n1f, &n2, &n2f, &tkn, &data ); if( rc != ERR_NO_ERR ) { return( rc ); } if( !n2f ) { if( !n1f ) { n1 = n2 = CurrentPos.line; } else { n2 = n1; } } /* * process tokens */ rc = ERR_INVALID_COMMAND; test1 = n1f || n2f; switch( tkn ) { case PCL_T_ABOUT: rc = DoAboutBox(); break; case PCL_T_PUSH: rc = PushFileStackAndMsg(); break; case PCL_T_POP: rc = PopFileStack(); break; case PCL_T_EXECUTE: data = SkipLeadingSpaces( data ); if( *data != '\0' ) { key_map scr; rc = AddKeyMap( &scr, data ); if( rc != ERR_NO_ERR ) { break; } rc = RunKeyMap( &scr, 1L ); MemFree( scr.data ); } break; case PCL_T_DELETEMENU: rc = DoMenuDelete( data ); break; case PCL_T_DELETEMENUITEM: rc = DoItemDelete( data ); break; case PCL_T_ADDMENUITEM: rc = AddMenuItem( data ); break; case PCL_T_MAXIMIZE: rc = MaximizeCurrentWindow(); break; case PCL_T_MINIMIZE: rc = MinimizeCurrentWindow(); break; case PCL_T_EXITFILESONLY: if( !ExitWithPrompt( false, false ) ) { rc = ERR_EXIT_ABORTED; } else { rc = ERR_NO_ERR; } break; case PCL_T_EXITALL: if( !ExitWithPrompt( true, false ) ) { rc = ERR_EXIT_ABORTED; } else { rc = ERR_NO_ERR; } break; case PCL_T_QUITALL: ExitWithVerify(); rc = ERR_NO_ERR; break; case PCL_T_KEYADD: data = SkipLeadingSpaces( data ); KeyAddString( data ); rc = ERR_NO_ERR; break; case PCL_T_UNALIAS: rc = UnAlias( data ); break; case PCL_T_UNABBREV: rc = UnAbbrev( data ); break; case PCL_T_UNMAP: case PCL_T_UNMAP_DMT: flag = MAPFLAG_MESSAGE + MAPFLAG_UNMAP; if( tkn == PCL_T_UNMAP_DMT ) { flag |= MAPFLAG_DAMMIT; } rc = MapKey( flag, data ); break; case PCL_T_EVAL: data = Expand( dataBuff, data, NULL ); i = setjmp( jmpaddr ); if( i != 0 ) { rc = (vi_rc)i; } else { StartExprParse( data, jmpaddr ); val = GetConstExpr(); ltoa( val, st, EditVars.Radix ); Message1( "%s", st ); rc = ERR_NO_ERR; } break; case PCL_T_COMPILE: case PCL_T_SOURCE: case PCL_T_LOAD: { char *tstr; srcline sline; data = GetNextWord1( data, st ); if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; break; } if( tkn == PCL_T_COMPILE ) { EditFlags.CompileScript = true; if( st[0] == '-' ) { if( st[1] == 'a' || st[1] == 'A' ) { EditFlags.CompileAssignments = true; if( st[1] == 'A' ) { EditFlags.CompileAssignmentsDammit = true; } data = GetNextWord1( data, st); if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; break; } } } } if( tkn == PCL_T_LOAD ) { EditFlags.LoadResidentScript = true; } sline = 0; rc = Source( st, data, &sline ); EditFlags.LoadResidentScript = false; EditFlags.CompileScript = false; EditFlags.CompileAssignments = false; EditFlags.CompileAssignmentsDammit = false; if( EditFlags.SourceScriptActive ) { LastError = rc; } if( rc > ERR_NO_ERR ) { Error( "%s on line %u of \"%s\"", GetErrorMsg( rc ), sline, st ); } else { if( rc != DO_NOT_CLEAR_MESSAGE_WINDOW ) { if( tkn != PCL_T_SOURCE ) { if( tkn == PCL_T_LOAD ) { tstr = strLoad; } else { tstr = strCompile; } Message1( "Script \"%s\" %s, %u lines generated, %d errors", st, tstr, sline, SourceErrCount ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } } } break; } case PCL_T_GENCONFIG: #ifndef __WIN__ data = GetNextWord1( data,st ); if( *st != '\0' ) { rc = GenerateConfiguration( st, true ); } else { rc = GenerateConfiguration( NULL, true ); } #else { bool temp = EditFlags.SaveConfig; EditFlags.SaveConfig = true; WriteProfile(); EditFlags.SaveConfig = temp; rc = ERR_NO_ERR; } #endif break; case PCL_T_COMPRESS: rc = CompressWhiteSpace(); break; case PCL_T_EXPAND: rc = ExpandWhiteSpace(); break; case PCL_T_SHOVE: rc = Shift( n1, n2, '>', true ); break; case PCL_T_SUCK: rc = Shift( n1, n2, '<', true ); break; case PCL_T_FILES: if( EditFlags.LineDisplay ) { rc = DisplayFileStatus(); } else { rc = EditFileFromList(); } break; case PCL_T_NEXT: rc = RotateFileForward(); break; case PCL_T_PREV: rc = RotateFileBackwards(); break; case PCL_T_HELP: rc = DoHelp( data ); break; case PCL_T_VIEW: case PCL_T_VIEW_DMT: EditFlags.ViewOnly = true; case PCL_T_EDIT: case PCL_T_EDIT_DMT: rc = EditFile( data, ( tkn == PCL_T_VIEW_DMT || tkn == PCL_T_EDIT_DMT ) ); EditFlags.ViewOnly = false; break; case PCL_T_OPEN: rc = OpenWindowOnFile( data ); break; case PCL_T_HIDE: case PCL_T_HIDE_DMT: rc = HideLineRange( n1, n2, ( tkn == PCL_T_HIDE_DMT ) ); break; case PCL_T_DELETE: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } if( SelRgn.selected && !EditFlags.LineBased ) { AddSelRgnToSavebufAndDelete(); rc = ERR_NO_ERR; // @ may have turned this on - it is now definitely off SelRgn.selected = false; } else { rc = DeleteLineRange( n1, n2, SAVEBUF_FLAG ); } if( rc == ERR_NO_ERR ) { DCDisplayAllLines(); LineDeleteMessage( n1, n2 ); } break; case PCL_T_SAVEANDEXIT: data = GetNextWord1( data, st ); if( *st == '\0' ) { rc = SaveAndExit( st ); } else { rc = SaveAndExit( NULL ); } break; case PCL_T_PUT: case PCL_T_PUT_DMT: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } rc = SaveAndResetFilePos( n1 ); if( rc == ERR_NO_ERR ) { if( tkn == PCL_T_PUT ) { rc = InsertSavebufAfter(); } else { rc = InsertSavebufBefore(); } RestoreCurrentFilePos(); } break; case PCL_T_YANK: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } if( SelRgn.selected && !EditFlags.LineBased ) { rc = YankSelectedRegion(); // @ may have turned this on - it is now definitely off SelRgn.selected = false; } else { rc = YankLineRange( n1, n2 ); } break; case PCL_T_SUBSTITUTE: rc = Substitute( n1, n2, data ); break; case PCL_T_GLOBAL: case PCL_T_GLOBAL_DMT: if( !test1 ) { n1 = 1; rc = CFindLastLine( &n2 ); if( rc != ERR_NO_ERR ) { break; } } rc = Global( n1,n2, data, ( tkn == PCL_T_GLOBAL_DMT ) ); break; case PCL_T_WRITEQUIT: if( CurrentFile == NULL ) { rc = NextFile(); } else { CurrentFile->modified = true; data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = SaveAndExit( st ); } else { rc = SaveAndExit( NULL ); } } break; case PCL_T_WRITE: case PCL_T_WRITE_DMT: data = GetNextWord1( data, st ); if( test1 ) { if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; } else { rc = SaveFile( st, n1, n2, ( tkn == PCL_T_WRITE_DMT ) ); } } else { if( st[0] != '\0' ) { #ifdef __WIN__ if( st[0] == '?' && st[1] == '\0' ) { rc = SaveFileAs(); break; } else { rc = SaveFile( st, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); } #else rc = SaveFile( st, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); #endif } else { rc = SaveFile( NULL, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); if( rc == ERR_NO_ERR ) { Modified( false ); } } } break; case PCL_T_READ: rc = ReadAFile( n1, data ); break; case PCL_T_QUIT: #ifdef __WIN__ rc = CurFileExitOptionSaveChanges(); #else rc = NextFile(); #endif break; case PCL_T_QUIT_DMT: rc = NextFileDammit(); break; case PCL_T_DATE: GetDateTimeString( st ); Message1( st ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; break; case PCL_T_CD: data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = SetCWD( st ); } else { rc = ERR_NO_ERR; } if( rc == ERR_NO_ERR ) { Message1( "Current directory is %s",CurrentDirectory ); } break; case PCL_T_SHELL: EVIL_SHELL: { #if defined( __NT__ ) && !defined( __WIN__ ) ExecCmd( NULL, NULL, NULL ); #else char foo[FILENAME_MAX]; strcpy( foo, Comspec ); ExecCmd( NULL, NULL, foo ); #endif DoVersion(); rc = ERR_NO_ERR; } break; case PCL_T_SYSTEM: if( n1f && n2f ) { rc = DoGenericFilter( n1, n2, data ); } else { data = SkipLeadingSpaces( data ); if( *data == '\0' ) { goto EVIL_SHELL; } ExecCmd( NULL, NULL, data ); rc = ERR_NO_ERR; } break; case PCL_T_RESIZE: rc = ResizeCurrentWindowWithKeys(); break; case PCL_T_TILE: data = GetNextWord1( data, st ); if( st[0] != '\0' ) { if( st[0] == 'v' ) { y = 1; for( x = 0, cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { x++; } } else if( st[0] == 'h' ) { x = 1; for( y = 0, cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { y++; } } else { x = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } else { y = atoi( st ); } } } else { x = EditVars.MaxWindowTileX; y = EditVars.MaxWindowTileY; } if( x > 0 && y > 0) { rc = WindowTile( x, y ); } break; case PCL_T_CASCADE: rc = WindowCascade(); break; case PCL_T_MOVEWIN: rc = MoveCurrentWindowWithKeys(); break; case PCL_T_TAG: data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = TagHunt( st ); } break; case PCL_T_FGREP: { bool ci; data = SkipLeadingSpaces( data ); ci = EditFlags.CaseIgnore; if( data[0] == '-' ) { if( data[1] == 'c' ) { ci = false; data += 2; data = SkipLeadingSpaces( data ); rc = GetStringWithPossibleQuote( &data, st ); } else if( data[1] == 'i' ) { ci = true; data += 2; data = SkipLeadingSpaces( data ); rc = GetStringWithPossibleQuote( &data, st ); } else if( data[1] == 'f' ) { data += 2; data = SkipLeadingSpaces( data ); #ifdef __WIN__ // call fancy grep window { fancy_find *ff; /* ff will be set to point at a static fancy find struct * in the snoop module */ char snoopbuf[FILENAME_MAX]; if( !GetSnoopStringDialog( &ff ) ) { return( ERR_NO_ERR ); } strcpy( snoopbuf, ff->path ); /* assume no string means current directory */ if( strlen( snoopbuf ) && snoopbuf[strlen( snoopbuf ) - 1] != '\\' ){ strcat( snoopbuf, "\\" ); } MySprintf( st, "%s", ff->find ); strcat( snoopbuf, ff->ext ); ci = ff->case_ignore; if( !ff->use_regexp ) { //MakeExpressionNonRegular( st ); rc = DoFGREP( snoopbuf, st, ci ); } else { rc = DoEGREP( snoopbuf, st ); } break; } #endif } } else { rc = GetStringWithPossibleQuote( &data, st ); } if( rc != ERR_NO_STRING ) { rc = DoFGREP( data, st, ci ); } } break; case PCL_T_EGREP: rc = GetStringWithPossibleQuote( &data, st ); if( rc != ERR_NO_STRING ) { rc = DoEGREP( data, st ); } break; case PCL_T_SIZE: data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } x = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } y = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } x2 = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } y2 = atoi( st ); rc = CurrentWindowResize( x, y, x2, y2 ); break; case PCL_T_ECHO: data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } rc = ERR_NO_ERR; if( !stricmp( st, "on" ) ) { EditFlags.EchoOn = true; break; } else if( !stricmp( st, "off" ) ) { EditFlags.EchoOn = false; break; } x = atoi( st ); data = SkipLeadingSpaces( data ); /* * FIXME: This is not good - I will definately have to * fix this code up. But right now I have to get the * editor ready for tomorrow. Brad. */ if( data[0] == '"' || data[0] == '/' ) { GetStringWithPossibleQuote( &data, st ); if( x > 2 ) { /* this is obviously a sick individual */ Error( "Invalid Echo" ); } else if( x == 1 ) { Message1( st ); } else if( x == 2 ) { Message2( st ); } // DisplayLineInWindow( MessageWindow, x, st ); } else { if( x > 2 ) { /* this is obviously a sick individual */ Error( "Invalid Echo" ); } else if( x == 1 ) { Message1( data ); } else if( x == 2 ) { Message2( data ); } // DisplayLineInWindow( MessageWindow, x, data ); } break; #ifdef VI_RCS case PCL_T_CHECKOUT: rc = ERR_NO_ERR; #ifdef __WINDOWS__ if( isOS2() ) break; // OS/2 shell returns before checkout finishes #endif if( CurrentFile != NULL ) { rc = ViRCSCheckout( rc ); } break; case PCL_T_CHECKIN: if( CurrentFile != NULL ) { rc = ViRCSCheckin( rc ); } break; #endif default: if( tkn >= 1000 ) { rc = ProcessEx( n1, n2, n2f, tkn - 1000, data ); break; } rc = TryCompileableToken( tkn, data, true ); if( rc != NOT_COMPILEABLE_TOKEN ) { break; } rc = ProcessWindow( tkn, data ); if( rc >= ERR_NO_ERR ) { break; } case TOK_INVALID: if( n1f && !n2f ) { if( !n1 ) { n1 = 1; } MemorizeCurrentContext(); rc = GoToLineNoRelCurs( n1 ); if( rc == ERR_NO_ERR ) { GoToColumnOnCurrentLine( 1 ); if( EditFlags.LineDisplay ) { MyPrintf( "%s\n", CurrentLine->data ); } } return( rc ); } rc = ERR_INVALID_COMMAND; break; } if( rc == ERR_NO_ERR ) { rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } return( rc ); } /* RunCommandLine */
void CTwiBootProgDoc::OnFileSaveAs() { // TODO: Add your command handler code here SaveFileAs(); }