-
-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resizable Window + Customize #2699
Resizable Window + Customize #2699
Conversation
- Add Subtitle font style combobox
- Fix Conflict
@@ -189,9 +187,25 @@ public ResourceDictionary GetResourceDictionary(string theme) | |||
|
|||
Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch }; | |||
Array.ForEach( | |||
new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o | |||
new[] { resultItemStyle, resultItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separating / And adding Subtitle Styles.
@@ -56,6 +56,13 @@ public string Theme | |||
} | |||
} | |||
public bool UseDropShadowEffect { get; set; } = false; | |||
|
|||
/* Appearance Settings. It should be separated from the setting later.*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Settings for Customize
{ | ||
|
||
} | ||
private void OnResizeEnd() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusts the total number of items based on the height at the time the window is resized.
Flow.Launcher/MainWindow.xaml.cs
Outdated
|
||
if (System.Convert.ToInt32((Height - (_settings.WindowHeightSize + 14) - shadowMargin) / _settings.ItemHeightSize) < 1) | ||
{ | ||
_settings.MaxResultsToShow = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the window height is too low, it will rescale the height based on 2 criteria.
Adjust Item Position
private void Reset_Click(object sender, System.Windows.RoutedEventArgs e) | ||
{ | ||
/*The FamilyTypeface should initialize all of its various properties.*/ | ||
FamilyTypeface targetTypeface = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal }; | ||
|
||
QueryBoxFontSize.Value = 20; | ||
QueryBoxFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", QueryBoxFontComboBox); | ||
QueryBoxFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, QueryBoxFontStyleComboBox); | ||
|
||
ResultItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultItemFontComboBox); | ||
ResultItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultItemFontStyleComboBox); | ||
ResultItemFontSize.Value = 16; | ||
|
||
ResultSubItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultSubItemFontComboBox); | ||
ResultSubItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultSubItemFontStyleComboBox); | ||
ResultSubItemFontSize.Value = 13; | ||
|
||
WindowHeightValue.Value = 42; | ||
ItemHeightValue.Value = 58; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, we worked by changing the settings value, but there was an issue with the control not reflecting the change. After a few tries, we settled on just changing the value of the control.
+) This initial value has been matched to the initial value in settings.cs and should be matched in the future. No problem if it's different. Should we replace it with a contant value and align them both to constant?
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; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function to find a specific value when initializing a combobox to its default value.
Flow.Launcher/Languages/en.xaml
Outdated
<system:String x:Key="KeepMaxResults">Keeping Window Max Height</system:String> | ||
<system:String x:Key="KeepMaxResultsToolTip">Window height will keep to fit the maximum number of results</system:String> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrasing is not very clear, but I can't think of anything better. My version doesn't look much better:
<system:String x:Key="KeepMaxResults">Keeping Window Max Height</system:String> | |
<system:String x:Key="KeepMaxResultsToolTip">Window height will keep to fit the maximum number of results</system:String> | |
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String> | |
<system:String x:Key="KeepMaxResultsToolTip">The window height will be fixed to show up to the maximum number of results</system:String> |
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
Outdated
Show resolved
Hide resolved
Flow.Launcher/Languages/en.xaml
Outdated
<system:String x:Key="KeepMaxResults">Keeping Window Max Height</system:String> | ||
<system:String x:Key="KeepMaxResultsToolTip">Window height will keep to fit the maximum number of results</system:String> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrasing is not very clear, but I can't think of anything better. My version doesn't look much better:
<system:String x:Key="KeepMaxResults">Keeping Window Max Height</system:String> | |
<system:String x:Key="KeepMaxResultsToolTip">Window height will keep to fit the maximum number of results</system:String> | |
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String> | |
<system:String x:Key="KeepMaxResultsToolTip">The window height will be fixed to show up to the maximum number of results</system:String> |
ResultSubItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultSubItemFontStyleComboBox); | ||
ResultSubItemFontSize.Value = 13; | ||
|
||
WindowHeightValue.Value = 42; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why there's a .Value
? shouldn't it be an int? just took a quick glance and don't have time to further review it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This item changes the value of a specific control (slider) rather than a setting.
This was implemented because there was an issue with changing the value of a set value not being reflected in the control.
Maximum="60" | ||
Minimum="20" | ||
TickFrequency="2" | ||
Value="{Binding WindowHeightSize, Mode=TwoWay}" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's here. but why not just set WindowHeightSize and separate the UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get what are you mean. pardon~?
What's the PR
Resizable Window
Customize
Todo
- [ ] Get Preset from ThemeETC
Test Cases