1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 12:02:21 +02:00

Added File Recovery editor setting

This commit is contained in:
Brian Fiete 2020-10-08 06:45:22 -07:00
parent 16cd9f7a77
commit 080a5483ae
4 changed files with 17 additions and 2 deletions

View file

@ -175,6 +175,9 @@ namespace IDE
public void CheckWorkspace() public void CheckWorkspace()
{ {
if (gApp.mSettings.mEditorSettings.mEnableFileRecovery != .Yes)
return;
mWantWorkspaceCleanup = true; mWantWorkspaceCleanup = true;
String recoverPath = scope String(); String recoverPath = scope String();

View file

@ -548,6 +548,13 @@ namespace IDE
None None
} }
public enum FileRecoveryKind
{
No,
Yes,
BackupOnly
}
public List<String> mFonts = new .() ~ DeleteContainerAndItems!(_); public List<String> mFonts = new .() ~ DeleteContainerAndItems!(_);
public float mFontSize = 12; public float mFontSize = 12;
public AutoCompleteShowKind mAutoCompleteShowKind = .PanelIfVisible; public AutoCompleteShowKind mAutoCompleteShowKind = .PanelIfVisible;
@ -564,6 +571,7 @@ namespace IDE
public bool mSpellCheckEnabled = true; public bool mSpellCheckEnabled = true;
public bool mShowLineNumbers = true; public bool mShowLineNumbers = true;
public bool mFreeCursorMovement; public bool mFreeCursorMovement;
public FileRecoveryKind mEnableFileRecovery = .Yes;
public void Serialize(StructuredData sd) public void Serialize(StructuredData sd)
{ {
@ -586,6 +594,7 @@ namespace IDE
sd.Add("SpellCheckEnabled", mSpellCheckEnabled); sd.Add("SpellCheckEnabled", mSpellCheckEnabled);
sd.Add("ShowLineNumbers", mShowLineNumbers); sd.Add("ShowLineNumbers", mShowLineNumbers);
sd.Add("FreeCursorMovement", mFreeCursorMovement); sd.Add("FreeCursorMovement", mFreeCursorMovement);
sd.Add("EnableFileRecovery", mEnableFileRecovery);
} }
public void Deserialize(StructuredData sd) public void Deserialize(StructuredData sd)
@ -612,6 +621,7 @@ namespace IDE
sd.Get("SpellCheckEnabled", ref mSpellCheckEnabled); sd.Get("SpellCheckEnabled", ref mSpellCheckEnabled);
sd.Get("ShowLineNumbers", ref mShowLineNumbers); sd.Get("ShowLineNumbers", ref mShowLineNumbers);
sd.Get("FreeCursorMovement", ref mFreeCursorMovement); sd.Get("FreeCursorMovement", ref mFreeCursorMovement);
sd.GetEnum<FileRecoveryKind>("EnableFileRecovery", ref mEnableFileRecovery);
} }
public void SetDefaults() public void SetDefaults()

View file

@ -122,6 +122,7 @@ namespace IDE.ui
AddPropertiesItem(category, "Show Line Numbers", "mShowLineNumbers"); AddPropertiesItem(category, "Show Line Numbers", "mShowLineNumbers");
AddPropertiesItem(category, "Free Cursor Movement", "mFreeCursorMovement"); AddPropertiesItem(category, "Free Cursor Movement", "mFreeCursorMovement");
AddPropertiesItem(category, "Enable File Recovery", "mEnableFileRecovery");
category.Open(true, true); category.Open(true, true);
} }

View file

@ -862,7 +862,8 @@ namespace IDE.ui
public void CheckSavedContents() public void CheckSavedContents()
{ {
if (((mEditData != null)) && (mEditData.mLastFileTextVersion == mEditWidget.Content.mData.mCurTextVersionId) && (mEditData.mRecoveryHash.IsZero)) if (((mEditData != null)) && (mEditData.mLastFileTextVersion == mEditWidget.Content.mData.mCurTextVersionId) && (mEditData.mRecoveryHash.IsZero) &&
(gApp.mSettings.mEditorSettings.mEnableFileRecovery != .No))
{ {
String text = scope .(); String text = scope .();
mEditWidget.GetText(text); mEditWidget.GetText(text);
@ -6170,7 +6171,7 @@ namespace IDE.ui
{ {
#if !CLI #if !CLI
DeleteAndNullify!(mFileRecoveryEntry); DeleteAndNullify!(mFileRecoveryEntry);
if ((mFilePath != null) && (mEditData != null) && (!mEditData.mRecoveryHash.IsZero)) if ((mFilePath != null) && (mEditData != null) && (!mEditData.mRecoveryHash.IsZero) && (gApp.mSettings.mEditorSettings.mEnableFileRecovery != .No))
{ {
String contents = scope .(); String contents = scope .();
mEditWidget.GetText(contents); mEditWidget.GetText(contents);