mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Added File Recovery editor setting
This commit is contained in:
parent
16cd9f7a77
commit
080a5483ae
4 changed files with 17 additions and 2 deletions
|
@ -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();
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue