MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / canClose

Method canClose

Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp:1005–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003
1004
1005bool CtrlrPanel::canClose(const bool closePanel)
1006{
1007 bool result = true;
1008 // Check for modified Lua Code
1009 CtrlrPanelWindowManager &manager = getWindowManager();
1010 if (manager.isCreated(CtrlrPanelWindowManager::LuaMethodEditor))
1011 {
1012 CtrlrChildWindowContent *content = manager.getContent(CtrlrPanelWindowManager::LuaMethodEditor);
1013 if (content != nullptr)
1014 { // Move the editor to front
1015 content->toFront(true);
1016 if (!content->canCloseWindow())
1017 {
1018 result = false;
1019 }
1020 }
1021 }
1022 // Check for panel modifications
1023 if(closePanel && (hasChangedSinceSavePoint() || isPanelDirty()))
1024 {
1025 int ret = AlertWindow::showYesNoCancelBox(AlertWindow::QuestionIcon, "Save panel (" + getName() + ")", "There are unsaved changes in this panel. Do you want to save them berfore closing ?", "Save", "Discard", "Cancel");
1026 if (ret == 0)
1027 { // Cancel
1028 result = false;
1029 }
1030 else if (ret == 1)
1031 { // Save
1032 savePanel();
1033 result = true;
1034 }
1035 else
1036 { // Discard
1037 result = true;
1038 }
1039 }
1040 return result;
1041}

Callers 2

performMethod · 0.80
canCloseWindowMethod · 0.80

Calls 5

getNameFunction · 0.50
isCreatedMethod · 0.45
getContentMethod · 0.45
toFrontMethod · 0.45
canCloseWindowMethod · 0.45

Tested by

no test coverage detected