mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-12 21:34:11 +02:00
Fix 'Dont Save' on Secondary Windows
When you select 'Dont Save' on the close dialog of secondary windows, the projectSource is left with changes and no SourceViewPanel, and then VerifyModifiedBuffers will fail. This fix uses refactored code from CloseDocument, 'RevertSourceViewPanel', to revert changes on close.
This commit is contained in:
parent
21f2edd8b0
commit
1f772f685e
1 changed files with 62 additions and 53 deletions
|
@ -1273,6 +1273,12 @@ namespace IDE
|
|||
});
|
||||
aDialog.AddButton("Don't Save", new (evt) =>
|
||||
{
|
||||
var _this = this;
|
||||
WithSourceViewPanelsOf(window, scope [&] (sourceViewPanel) =>
|
||||
{
|
||||
if (sourceViewPanel.HasUnsavedChanges())
|
||||
_this.RevertSourceViewPanel(sourceViewPanel);
|
||||
});
|
||||
mMainWindow.SetForeground();
|
||||
window.Close(true);
|
||||
});
|
||||
|
@ -6477,21 +6483,7 @@ namespace IDE
|
|||
aDialog.PopupWindow(mMainWindow);
|
||||
}
|
||||
|
||||
public void CloseDocument(Widget documentPanel)
|
||||
{
|
||||
bool hasFocus = false;
|
||||
var sourceViewPanel = documentPanel as SourceViewPanel;
|
||||
|
||||
if ((documentPanel.mWidgetWindow != null) && (documentPanel.mWidgetWindow.mFocusWidget != null))
|
||||
{
|
||||
if (documentPanel.mWidgetWindow.mFocusWidget.HasParent(documentPanel))
|
||||
hasFocus = true;
|
||||
}
|
||||
|
||||
/*if (sourceViewPanel != null)
|
||||
hasFocus = sourceViewPanel.mEditWidget.mHasFocus;*/
|
||||
|
||||
if ((sourceViewPanel != null) && (sourceViewPanel.HasUnsavedChanges()))
|
||||
void RevertSourceViewPanel(SourceViewPanel sourceViewPanel)
|
||||
{
|
||||
// When we close a Beef file that has modified text, we need to revert by
|
||||
// reparsing from the actual source file
|
||||
|
@ -6546,6 +6538,23 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
|
||||
public void CloseDocument(Widget documentPanel)
|
||||
{
|
||||
bool hasFocus = false;
|
||||
var sourceViewPanel = documentPanel as SourceViewPanel;
|
||||
|
||||
if ((documentPanel.mWidgetWindow != null) && (documentPanel.mWidgetWindow.mFocusWidget != null))
|
||||
{
|
||||
if (documentPanel.mWidgetWindow.mFocusWidget.HasParent(documentPanel))
|
||||
hasFocus = true;
|
||||
}
|
||||
|
||||
/*if (sourceViewPanel != null)
|
||||
hasFocus = sourceViewPanel.mEditWidget.mHasFocus;*/
|
||||
|
||||
if ((sourceViewPanel != null) && (sourceViewPanel.HasUnsavedChanges()))
|
||||
RevertSourceViewPanel(sourceViewPanel);
|
||||
|
||||
DarkTabbedView tabbedView = null;
|
||||
DarkTabbedView.DarkTabButton tabButton = null;
|
||||
WithTabs(scope [&] (tab) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue