Skip to content

Commit 81ed043

Browse files
author
Savas Ziplies
committed
Added: Default Options setup
1 parent 3893ff7 commit 81ed043

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public override void LoadOptions(Options options)
2323
this.cmbPDFOrientation.SelectedItem = PageOrientation.Portrait.ToString();
2424
//Now load
2525
this.cmbPDFOrientation.SelectedItem = options.pdfOrientation.ToString();
26-
2726
//
2827
this.cmbPDFPageSize.Items.AddRange(Enum.GetNames(typeof(PageSize)));
28+
this.cmbPDFPageSize.Items.Remove(PageSize.Undefined.ToString());
2929
this.cmbPDFPageSize.SelectedItem = PageSize.A4.ToString();
3030
this.cmbPDFPageSize.SelectedItem = options.pdfPageSize.ToString();
3131
}

MarkdownViewerPlusPlus/MarkdownViewerConfiguration.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void Init()
109109
public void Load()
110110
{
111111
//Grab ini file settings based on struct members
112-
this.options = new Options();
112+
this.options = GetDefaultOptions();
113113
//Unbox/Box magic to set structs
114114
object options = this.options;
115115
foreach (FieldInfo field in this.options.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
@@ -175,5 +175,19 @@ public bool ValidateFileExtension(string fileExtension, string fileName = "")
175175
//Otherwise check
176176
return this.options.fileExtensions.Contains(fileExtension);
177177
}
178+
179+
/// <summary>
180+
///
181+
/// </summary>
182+
/// <returns>An Options object containing some pre-set default options</returns>
183+
protected Options GetDefaultOptions()
184+
{
185+
Options options = new Options();
186+
options.inclNewFiles = true;
187+
options.pdfOrientation = PageOrientation.Portrait;
188+
options.pdfPageSize = PageSize.A4;
189+
options.synchronizeScrolling = false;
190+
return options;
191+
}
178192
}
179193
}

0 commit comments

Comments
 (0)