Skip to content

Commit 81095c1

Browse files
committed
[UI] Enable DPI awareness fix #783
1 parent c807f06 commit 81095c1

9 files changed

+268
-220
lines changed

Analogy/CommonChangeLog.cs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public static IEnumerable<AnalogyChangeLog> GetChangeLog()
1111
{
1212
return new List<AnalogyChangeLog>
1313
{
14+
new AnalogyChangeLog("V4.4.1 - [UI] Enable DPI awareness #783",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,12,20)),
1415
new AnalogyChangeLog("V4.4.1 - [Plotting] add option to split charts to different panes #776",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,12,16)),
1516
new AnalogyChangeLog("V4.4.1 - [Plotting] Enable toggle on/off series #775",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,12,16)),
1617
new AnalogyChangeLog("V4.4.0 - [Real time] add option to change refresh rate [default 1 second] #768",AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2020,12,12)),

Analogy/DataTypes/DataTypes.cs

+17-18
Original file line numberDiff line numberDiff line change
@@ -102,53 +102,52 @@ public class FontSettings
102102
[JsonIgnore] public Font MenuFont => new Font(MenuFontName, MenuFontSize, FontStyle.Regular, GraphicsUnit.Point);
103103
public FontSettings()
104104
{
105-
FontSelectionType = FontSelectionType.Normal;
106-
MenuFontSelectionType = FontSelectionType.Normal;
107-
GridFontSize = 8.5f;
108-
FontName = "Tahoma";
109-
FontSize = 8.25f;
110-
MenuFontName = "Segoe UI";
111-
MenuFontSize = 12f;
105+
SetFontSelectionType(FontSelectionType.Default);
106+
SetMenuFontSelectionType(FontSelectionType.Default);
112107
}
113108

114109
public void SetFontSelectionType(FontSelectionType mode)
115110
{
116111
FontSelectionType = mode;
112+
FontName = "Tahoma";
117113
switch (mode)
118114
{
119-
case FontSelectionType.Large:
120-
FontName = "Tahoma";
115+
case FontSelectionType.Default:
116+
FontSize = 8.25f;
117+
break;
118+
case FontSelectionType.Normal:
121119
FontSize = 10f;
122120
break;
121+
case FontSelectionType.Large:
122+
FontSize = 12f;
123+
break;
123124
case FontSelectionType.VeryLarge:
124-
FontName = "Tahoma";
125125
FontSize = 14f;
126126
break;
127-
case FontSelectionType.Normal:
128-
case FontSelectionType.Manual:
129127
default:
130-
FontName = "Tahoma";
131128
FontSize = 8.25f;
132129
break;
133130
}
134131
}
135132
public void SetMenuFontSelectionType(FontSelectionType mode)
136133
{
137134
MenuFontSelectionType = mode;
135+
MenuFontName = "Segoe UI";
138136
switch (mode)
139137
{
138+
case FontSelectionType.Default:
139+
MenuFontSize = 12f;
140+
break;
141+
case FontSelectionType.Normal:
142+
MenuFontSize = 10f;
143+
break;
140144
case FontSelectionType.Large:
141-
MenuFontName = "Segoe UI";
142145
MenuFontSize = 14f;
143146
break;
144147
case FontSelectionType.VeryLarge:
145-
MenuFontName = "Segoe UI";
146148
MenuFontSize = 16f;
147149
break;
148-
case FontSelectionType.Normal:
149-
case FontSelectionType.Manual:
150150
default:
151-
MenuFontName = "Segoe UI";
152151
MenuFontSize = 12f;
153152
break;
154153
}

Analogy/DataTypes/Enums.cs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace Analogy.DataTypes
77
{
88
public enum FontSelectionType
99
{
10+
Default,
1011
Normal,
1112
Large,
1213
VeryLarge,

Analogy/Forms/UserSettingsForm.Designer.cs

+132-102
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Analogy/Forms/UserSettingsForm.cs

+21-8
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ private void LoadSettings()
233233

234234
switch (Settings.FontSettings.FontSelectionType)
235235
{
236+
case FontSelectionType.Default:
237+
rbFontSizeDefault.Checked = true;
238+
break;
236239
case FontSelectionType.Normal:
237240
rbFontSizeNormal.Checked = true;
238241
break;
@@ -249,6 +252,9 @@ private void LoadSettings()
249252
}
250253
switch (Settings.FontSettings.MenuFontSelectionType)
251254
{
255+
case FontSelectionType.Default:
256+
rbMenuFontSizeDefault.Checked = true;
257+
break;
252258
case FontSelectionType.Normal:
253259
rbMenuFontSizeNormal.Checked = true;
254260
break;
@@ -333,33 +339,40 @@ private void SaveSetting()
333339
Settings.CheckAdditionalInformation = tsCheckAdditionalInformation.IsOn;
334340
Settings.AnalogyPosition.RememberLastPosition = tsRememberLastPositionAndState.IsOn;
335341
Settings.EnableCompressedArchives = tsEnableCompressedArchive.IsOn;
336-
337-
if (rbFontSizeNormal.Checked)
342+
if (rbFontSizeDefault.Checked)
343+
{
344+
Settings.FontSettings.SetFontSelectionType(FontSelectionType.Default);
345+
}
346+
else if (rbFontSizeNormal.Checked)
338347
{
339348
Settings.FontSettings.SetFontSelectionType(FontSelectionType.Normal);
340349
}
341350

342-
if (rbFontSizeLarge.Checked)
351+
else if (rbFontSizeLarge.Checked)
343352
{
344353
Settings.FontSettings.SetFontSelectionType(FontSelectionType.Large);
345354
}
346355

347-
if (rbFontSizeVeryLarge.Checked)
356+
else if (rbFontSizeVeryLarge.Checked)
348357
{
349358
Settings.FontSettings.SetFontSelectionType(FontSelectionType.VeryLarge);
350359
}
351-
352-
if (rbMenuFontSizeNormal.Checked)
360+
361+
if (rbMenuFontSizeDefault.Checked)
362+
{
363+
Settings.FontSettings.SetMenuFontSelectionType(FontSelectionType.Default);
364+
}
365+
else if (rbMenuFontSizeNormal.Checked)
353366
{
354367
Settings.FontSettings.SetMenuFontSelectionType(FontSelectionType.Normal);
355368
}
356369

357-
if (rbMenuFontSizeLarge.Checked)
370+
else if (rbMenuFontSizeLarge.Checked)
358371
{
359372
Settings.FontSettings.SetMenuFontSelectionType(FontSelectionType.Large);
360373
}
361374

362-
if (rbMenuFontSizeVeryLarge.Checked)
375+
else if (rbMenuFontSizeVeryLarge.Checked)
363376
{
364377
Settings.FontSettings.SetMenuFontSelectionType(FontSelectionType.VeryLarge);
365378
}

0 commit comments

Comments
 (0)