/* * ExitWithPrompt - try to exit, verifying for every file which has * been modified. */ bool ExitWithPrompt( bool do_quit, bool push_pop ) { info *cinfo; int i; int num = 0; bool rc = true; if( push_pop ) { PushMode(); } for( cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { num++; } BringUpFile( InfoHead, true ); for( i = 0; i < num; i++ ){ if( NextFile() > ERR_NO_ERR ) { // file modified ask if( FileExitOptionSaveChanges( CurrentFile ) ) { /* user hit cancel - always allow this! */ rc = false; break; } } } if( push_pop ) { PopMode(); } if( rc && do_quit ) { QuitEditor( ERR_NO_ERR ); } return( rc ); } /* ExitWithPrompt */
void CCameraHandler::ToggleOverviewCamera() { CameraTransition(1.0f); if (controllerStack.empty()) { PushMode(); SetCameraMode(CAMERA_MODE_OVERVIEW); } else { PopMode(); } }
/* * EditMain - main driver for editor (command mode) */ void EditMain( void ) { vi_rc rc; char *msg = NULL; bool doclear; /* * loop forever, or at least until all done */ for( ;; ) { #if 0 #ifdef __WIN__ PushMode(); UpdateFiles(); PopMode(); #endif #endif if( !EditFlags.InsertModeActive || EditFlags.Modeless ) { if( EditFlags.Modeless ) { UpdateEditStatus(); EditFlags.NoCapsLock = false; } else { UpdateCurrentStatus( CSTATUS_COMMAND ); EditFlags.NoCapsLock = true; } if( !EditFlags.Modeless && EditFlags.ReturnToInsertMode && !NonKeyboardEventsPending() ) { EditFlags.ReturnToInsertMode = false; if( EditFlags.WasOverstrike ) { LastEvent = 'R'; } else { LastEvent = 'i'; } } else { DCUpdateAll(); #ifdef __WIN__ SetWindowCursorForReal(); #endif LastEvent = GetNextEvent( true ); } EditFlags.NoCapsLock = false; doclear = true; if( LastEvent == VI_KEY( MOUSEEVENT ) ) { if( LastMouseEvent == MOUSE_MOVE ) { doclear = false; } } if( doclear ) { if( EditFlags.AutoMessageClear ) { ClearWindow( MessageWindow ); } #ifndef __WIN__ ResetDisplayLine(); #endif } } else { // Cannot do a RestoreInfo while we are in insert mode // because it will call ValidateCurrentColumn which will // do something stupid on us... PushMode/PopMode solution // not working yet... this needs a little work DCUpdate(); #ifdef __WIN__ SetWindowCursorForReal(); #endif LastEvent = GetNextEvent( true ); } rc = DoLastEvent(); if( EditFlags.ReadOnlyError && rc <= ERR_NO_ERR ) { EditFlags.ReadOnlyError = false; rc = ERR_READ_ONLY_FILE_MODIFIED; } if( rc > ERR_NO_ERR ) { msg = GetErrorMsg( rc ); } DoneLastEvent( rc, false ); if( rc > ERR_NO_ERR ) { Error( msg ); } } } /* EditMain */