/************* * DESCRIPTION: destructor * INPUT: - * OUTPUT: - *************/ CTheApp::~CTheApp() { FreeUndo(); FreeObjects(); FreePrefs(); rsiExit(); }
/* Delete all UNDO structs after the NextUndo position If the array is full, shift it left (delete the first entry). Add the UNDO struct at the current NextUndo position. */ void AddUndo(UndoData *p_undo) { assert_bound (NbUndo, 0, MaxUndo); assert_bound (NextUndo, -1, NbUndo - 1); // Notify ("MaxUndo = %d, NbUndo = %d, NextUndo = %d", MaxUndo, NbUndo, NextUndo); // Delete UNDO structs standing after NextUndo position for (SHORT i = NbUndo - 1 ; i > NextUndo ; i--) { FreeUndo(&UndoArray[i]); NbUndo--; } assert(NbUndo == NextUndo + 1); // If UNDO array full, shift it left if ( NbUndo == MaxUndo ) { FreeUndo(&UndoArray[0]); for (SHORT i = 0 ; i < NbUndo - 1 ; i++) UndoArray[i] = UndoArray[i+1]; NbUndo--; NextUndo--; } assert(NbUndo == NextUndo + 1); // Copy level data to undo struct assert_bound(NbUndo, 0, MaxUndo - 1); UndoArray[NbUndo] = *p_undo; // We start a new undo cycle NextUndo = NbUndo; NbUndo++; // Notify ("MaxUndo = %d, NbUndo = %d, NextUndo = %d", MaxUndo, NbUndo, NextUndo); }
/* Free all UNDO/REDO structures */ void CleanupUndo() { // Free UNDO entries for (int i = 0 ; i < NbUndo ; i++) FreeUndo(&UndoArray[i]); // Free UNDO array ptr if ( UndoArray != NULL ) { FreeMemory (UndoArray); UndoArray = NULL; } NbUndo = 0; NextUndo = -1; }
/* Add an UNDO entry only if the level data were modified after the prvious call to StartUndoRecording() */ void StopUndoRecording() { assert_bound (NbUndo, 0, MaxUndo); assert_bound (NextUndo, -1, NbUndo - 1); assert(RecordingUndo); if ( !RecordingUndo ) { Notify ("Progam bug in UNDO recording (stop)"); return; } // Add UNDO struct or forget it if no changes since last // call to StartUndoRecord if ( CompareUndo (&UndoRecord) != 0 ) AddUndo (&UndoRecord); else FreeUndo (&UndoRecord); RecordingUndo = FALSE; }
int EBuffer::ToggleUndo() { FreeUndo(); TOGGLE(Undo); }
/**************************************************************************** * Эту функцию FAR вызывает перед выгрузкой плагина ****************************************************************************/ void WINAPI _export ExitFARW() { //Освободим память в случае выгрузки плагина FreeUndo(); }