mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Adjust Reset Logic
This commit is contained in:
parent
4fd05f59f1
commit
188c409eb4
2 changed files with 69 additions and 22 deletions
|
|
@ -166,7 +166,7 @@
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Style="{StaticResource SettingSeparatorStyle}" />
|
Style="{StaticResource SettingSeparatorStyle}" />
|
||||||
<Slider
|
<Slider
|
||||||
Name="resultItemFontSize"
|
Name="ResultItemFontSize"
|
||||||
Width="140"
|
Width="140"
|
||||||
Margin="8 8 8 0"
|
Margin="8 8 8 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
@ -212,7 +212,7 @@
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Style="{StaticResource SettingSeparatorStyle}" />
|
Style="{StaticResource SettingSeparatorStyle}" />
|
||||||
<Slider
|
<Slider
|
||||||
Name="resultSubItemFontSize"
|
Name="ResultSubItemFontSize"
|
||||||
Width="140"
|
Width="140"
|
||||||
Margin="8 8 8 0"
|
Margin="8 8 8 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using Flow.Launcher.SettingPages.ViewModels;
|
using Flow.Launcher.SettingPages.ViewModels;
|
||||||
using Page = ModernWpf.Controls.Page;
|
using Page = ModernWpf.Controls.Page;
|
||||||
|
|
@ -31,30 +34,74 @@ public partial class SettingsPaneTheme : Page
|
||||||
|
|
||||||
private void Reset_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void Reset_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
//QueryBoxFont = "Segoe UI";
|
/*The FamilyTypeface should initialize all of its various properties.*/
|
||||||
//QueryBoxFontStyle = "Normal";
|
FamilyTypeface targetTypeface = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
|
||||||
//QueryBoxFontWeight = "Normal";
|
|
||||||
//QueryBoxFontStretch = "Normal";
|
|
||||||
//QueryBoxFontSize = 20;
|
|
||||||
QueryBoxFontSize.Value = 20;
|
QueryBoxFontSize.Value = 20;
|
||||||
|
QueryBoxFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", QueryBoxFontComboBox);
|
||||||
|
QueryBoxFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, QueryBoxFontStyleComboBox);
|
||||||
|
|
||||||
//ResultFont = "Segoe UI";
|
ResultItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultItemFontComboBox);
|
||||||
//ResultFontStyle = "Normal";
|
ResultItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultItemFontStyleComboBox);
|
||||||
//ResultFontWeight = "Normal";
|
ResultItemFontSize.Value = 16;
|
||||||
//ResultFontStretch = "Normal";
|
|
||||||
//ResultItemFontSize = 16;
|
ResultSubItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultSubItemFontComboBox);
|
||||||
resultItemFontSize.Value = 16;
|
ResultSubItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultSubItemFontStyleComboBox);
|
||||||
|
ResultSubItemFontSize.Value = 13;
|
||||||
|
|
||||||
//ResultSubFont = "Segoe UI";
|
|
||||||
//ResultSubFontStyle = "Normal";
|
|
||||||
//ResultSubFontWeight = "Normal";
|
|
||||||
//ResultSubFontStretch = "Normal";
|
|
||||||
//ResultSubItemFontSize = 13;
|
|
||||||
resultSubItemFontSize.Value = 13;
|
|
||||||
//ItemHeightSize = 58;
|
|
||||||
//WindowHeightSize = 42;
|
|
||||||
WindowHeightValue.Value = 42;
|
WindowHeightValue.Value = 42;
|
||||||
ItemHeightValue.Value = 58;
|
ItemHeightValue.Value = 58;
|
||||||
//_viewModel.ResetCustomize();
|
}
|
||||||
|
public int SearchFontIndex(string str, ComboBox combo)
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
string targetFont = str;
|
||||||
|
|
||||||
|
for (int i = 0; i < combo.Items.Count; i++)
|
||||||
|
{
|
||||||
|
if (combo.Items[i].ToString() == targetFont)
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If there no Default Value.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int SearchFontStyleIndex(FamilyTypeface targetTypeface, ComboBox combo)
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < combo.Items.Count; i++)
|
||||||
|
{
|
||||||
|
if (combo.Items[i] is FamilyTypeface)
|
||||||
|
{
|
||||||
|
FamilyTypeface typefaceItem = (FamilyTypeface)combo.Items[i];
|
||||||
|
if (typefaceItem.Stretch == targetTypeface.Stretch &&
|
||||||
|
typefaceItem.Weight == targetTypeface.Weight &&
|
||||||
|
typefaceItem.Style == targetTypeface.Style)
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue