MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / closeWindow

Method closeWindow

src/csvapplication.cpp:755–801  ·  view source on GitHub ↗

* Closes the window indicated by windowIndex; default is -1 and closes the top-most window */

Source from the content-addressed store, hash-verified

753 * Closes the window indicated by windowIndex; default is -1 and closes the top-most window
754 */
755void CsvApplication::closeWindow(int windowIndex, bool forceClose) {
756 int choice;
757 if( windowIndex == -1 ) {
758 windowIndex = app.topWindow;
759 }
760 if( windows[windowIndex].isUsed() && windows[windowIndex].isChanged() ) {
761 choice = myFlChoice("Confirmation", "File has been modified. Save?", {"Yes", "No", "Cancel"});
762 switch( choice ) {
763 case 0: // yes: call saveFile()
764 if( !saveFile() ) {
765 return;
766 }
767 break;
768 case 1: // no: do nothing and continue to close window
769 break;
770 case -1:
771 case 2: // cancel
772 return;
773 break;
774 default: // ESC: cancel
775 return;
776 }
777 }
778 if( nfcIsOpen )
779 return;
780 if( windows[windowIndex].getWindowSlotUsed() ) {
781 // This window has been in use and is showing
782 windows[windowIndex].storeWindowPreferences();
783 My_Fl_Double_Window *nextWinPtr = (My_Fl_Double_Window *) Fl::next_window(windows[windowIndex].win);
784 if( nextWinPtr == NULL && !forceClose ) {
785 #ifdef __APPLE__
786 remainOpenWin->show();
787 #endif
788 }
789 windows[windowIndex].setPath("");
790 windows[windowIndex].setWindowSlotUsed(false);
791 windows[windowIndex].createdWindowCount = 0;
792 windows[windowIndex].table->clearTable();
793 if( nextWinPtr ) {
794 nextWinPtr->take_focus();
795 }
796 windows[windowIndex].win->hide();
797 // delete undoList
798 windows[windowIndex].clearUndoList();
799 }
800
801}
802
803
804

Callers 2

MyMenuCallbackMethod · 0.80
windowGetsClosedCBMethod · 0.80

Calls 8

isUsedMethod · 0.80
isChangedMethod · 0.80
getWindowSlotUsedMethod · 0.80
setPathMethod · 0.80
setWindowSlotUsedMethod · 0.80
clearTableMethod · 0.80
clearUndoListMethod · 0.80

Tested by

no test coverage detected