Add initial UI elements for "Size and location" tab of Settings window

This commit is contained in:
Peter Kirmeier 2022-10-26 22:30:01 +02:00
parent 9ed9ca635e
commit 41a8b90477
2 changed files with 96 additions and 67 deletions

View file

@ -63,7 +63,61 @@
</TabItem>
<TabItem Header="{u:Translate 'Size and location'}">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Label Content="fill me 2" Background="Red"/>
<StackPanel>
<GroupBox Header="{u:Translate 'Sizes in percent'}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- TODO WPF NumericUpDown.. -->
<TextBox Grid.Row="0" Grid.Column="0" x:Name="numericUpDownSizeInPercent" VerticalContentAlignment="Center" />
<Label Grid.Row="0" Grid.Column="1" Content="UpDown" Background="Red" Padding="0" VerticalAlignment="Center"/>
<Label Grid.Row="0" Grid.Column="2" Content="{u:Translate 'Application size'}" Padding="5,0,0,0" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="0" x:Name="numericUpDownIconSizeInPercent" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="1" Content="UpDown" Background="Red" Padding="0" VerticalAlignment="Center"/>
<Label Grid.Row="1" Grid.Column="2" Content="{u:Translate 'Icon size'}" Padding="5,0,0,0" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="0" x:Name="numericUpDownRowHeighteInPercentage" VerticalContentAlignment="Center" />
<Label Grid.Row="2" Grid.Column="1" Content="UpDown" Background="Red" Padding="0" VerticalAlignment="Center"/>
<Label Grid.Row="2" Grid.Column="2" Content="{u:Translate 'Row height'}" Padding="5,0,0,0" VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="0" x:Name="numericUpDownMenuWidth" VerticalContentAlignment="Center" />
<Label Grid.Row="3" Grid.Column="1" Content="UpDown" Background="Red" Padding="0" VerticalAlignment="Center"/>
<Label Grid.Row="3" Grid.Column="2" Content="{u:Translate 'Maximum menu width'}" Padding="5,0,0,0" VerticalAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="0" x:Name="numericUpDownMenuHeight" VerticalContentAlignment="Center" />
<Label Grid.Row="4" Grid.Column="1" Content="UpDown" Background="Red" Padding="0" VerticalAlignment="Center"/>
<Label Grid.Row="4" Grid.Column="2" Content="{u:Translate 'Maximum menu height'}" Padding="5,0,0,0" VerticalAlignment="Center"/>
</Grid>
</GroupBox>
<GroupBox Header="{u:Translate 'Main menu appears'}">
<StackPanel>
<RadioButton x:Name="radioButtonAppearAtTheBottomRight" GroupName="MainMenuAppearsAt" Content="{u:Translate 'Bottom right'}" />
<RadioButton x:Name="radioButtonAppearAtTheBottomLeft" GroupName="MainMenuAppearsAt" Content="{u:Translate 'Bottom left'}" />
<RadioButton x:Name="radioButtonUseCustomLocation" GroupName="MainMenuAppearsAt" Content="{u:Translate 'Custom (drag it to the appropriate position)'}" />
<RadioButton x:Name="radioButtonAppearAtMouseLocation" GroupName="MainMenuAppearsAt" Content="{u:Translate 'At mouse location'}" />
</StackPanel>
</GroupBox>
<GroupBox Header="{u:Translate 'Sub menu appears'}">
<StackPanel>
<RadioButton x:Name="radioButtonNextToPreviousMenu" GroupName="SubMenuAppearsAt" Content="{u:Translate 'Next to the previous one'}" />
<StackPanel Orientation="Horizontal">
<RadioButton x:Name="radioButtonOverlapping" GroupName="SubMenuAppearsAt" Content="{u:Translate 'Overlapping'}" Checked="RadioButtonOverlapping_Checked" Unchecked="RadioButtonOverlapping_Unchecked" />
<!-- TODO WPF NumericUpDown -->
<TextBox x:Name="numericUpDownOverlappingOffsetPixels" Width="50" VerticalContentAlignment="Center" Margin="15,0,0,0" />
<Label Content="UpDown" Background="Red" Padding="0" VerticalAlignment="Center"/>
<Label Content="{u:Translate 'Offset by pixels'}" Padding="5,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
</GroupBox>
<Button Content="{u:Translate 'Default'}" Margin="3" MinWidth="76" Click="ButtonSizeAndLocationDefault_Click" HorizontalAlignment="Left"/>
</StackPanel>
</ScrollViewer>
</TabItem>
<TabItem Header="{u:Translate 'Advanced'}">

View file

@ -123,23 +123,6 @@ namespace SystemTrayMenu.UserInterface
}
#if TODO
groupBoxSize.Text = Translator.GetText("Sizes in percent");
labelSizeInPercent.Text = Translator.GetText("Application size");
labelIconSizeInPercent.Text = Translator.GetText("Icon size");
labelRowHeightInPercentage.Text = Translator.GetText("Row height");
labelMaxMenuWidth.Text = Translator.GetText("Maximum menu width");
labelMaxMenuHeight.Text = Translator.GetText("Maximum menu height");
groupBoxMenuAppearAt.Text = Translator.GetText("Main menu appears");
radioButtonAppearAtTheBottomLeft.Text = Translator.GetText("Bottom left");
radioButtonAppearAtTheBottomRight.Text = Translator.GetText("Bottom right");
radioButtonUseCustomLocation.Text = Translator.GetText("Custom (drag it to the appropriate position)");
radioButtonAppearAtMouseLocation.Text = Translator.GetText("At mouse location");
groupBoxSubMenuAppearAt.Text = Translator.GetText("Sub menu appears");
radioButtonNextToPreviousMenu.Text = Translator.GetText("Next to the previous one");
radioButtonOverlapping.Text = Translator.GetText("Overlapping");
labelOverlappingByPixelsOffset.Text = Translator.GetText("Offset by pixels");
buttonSizeAndLocationDefault.Text = Translator.GetText("Default");
groupBoxOptionalFeatures.Text = Translator.GetText("Optional Features");
checkBoxResolveLinksToFolders.Text = Translator.GetText("Resolve links to folders and show content");
checkBoxShowInTaskbar.Text = Translator.GetText("Show in Taskbar");
@ -379,67 +362,74 @@ namespace SystemTrayMenu.UserInterface
numericUpDown.Value = newValue;
((HandledMouseEventArgs)e).Handled = true;
}
numericUpDownSizeInPercent.Value = Settings.Default.SizeInPercent;
#endif
numericUpDownSizeInPercent.Text = Settings.Default.SizeInPercent.ToString();
#if TODO
numericUpDownIconSizeInPercent.Minimum = 50;
numericUpDownIconSizeInPercent.Maximum = 200;
numericUpDownIconSizeInPercent.Increment = 5;
numericUpDownIconSizeInPercent.MouseWheel += NumericUpDown_MouseWheel;
numericUpDownIconSizeInPercent.Value = Settings.Default.IconSizeInPercent;
#endif
numericUpDownIconSizeInPercent.Text = Settings.Default.IconSizeInPercent.ToString();
#if TODO
numericUpDownRowHeighteInPercentage.Minimum = 50;
numericUpDownRowHeighteInPercentage.Maximum = 200;
numericUpDownRowHeighteInPercentage.Increment = 5;
numericUpDownRowHeighteInPercentage.MouseWheel += NumericUpDown_MouseWheel;
#endif
if (DllImports.NativeMethods.IsTouchEnabled())
{
numericUpDownRowHeighteInPercentage.Value = Settings.Default.RowHeighteInPercentageTouch;
numericUpDownRowHeighteInPercentage.Text = Settings.Default.RowHeighteInPercentageTouch.ToString();
}
else
{
numericUpDownRowHeighteInPercentage.Value = Settings.Default.RowHeighteInPercentage;
numericUpDownRowHeighteInPercentage.Text = Settings.Default.RowHeighteInPercentage.ToString();
}
#if TODO
numericUpDownMenuWidth.Minimum = 25;
numericUpDownMenuWidth.Maximum = 400;
numericUpDownMenuWidth.Increment = 5;
numericUpDownMenuWidth.Value = Settings.Default.WidthMaxInPercent;
#endif
numericUpDownMenuWidth.Text = Settings.Default.WidthMaxInPercent.ToString();
#if TODO
numericUpDownMenuHeight.Minimum = 25;
numericUpDownMenuHeight.Maximum = 400;
numericUpDownMenuHeight.Increment = 5;
numericUpDownMenuHeight.Value = Settings.Default.HeightMaxInPercent;
#endif
numericUpDownMenuHeight.Text = Settings.Default.HeightMaxInPercent.ToString();
if (Settings.Default.UseCustomLocation)
{
radioButtonUseCustomLocation.Checked = true;
radioButtonUseCustomLocation.IsChecked = true;
}
else if (Settings.Default.AppearAtMouseLocation)
{
radioButtonAppearAtMouseLocation.Checked = true;
radioButtonAppearAtMouseLocation.IsChecked = true;
}
else if (Settings.Default.AppearAtTheBottomLeft)
{
radioButtonAppearAtTheBottomLeft.Checked = true;
radioButtonAppearAtTheBottomLeft.IsChecked = true;
}
else
{
radioButtonAppearAtTheBottomRight.Checked = true;
radioButtonAppearAtTheBottomRight.IsChecked = true;
}
numericUpDownOverlappingOffsetPixels.Value = Settings.Default.OverlappingOffsetPixels;
numericUpDownOverlappingOffsetPixels.Text = Settings.Default.OverlappingOffsetPixels.ToString();
if (Settings.Default.AppearNextToPreviousMenu)
{
radioButtonNextToPreviousMenu.Checked = true;
numericUpDownOverlappingOffsetPixels.Enabled = false;
radioButtonNextToPreviousMenu.IsChecked = true;
numericUpDownOverlappingOffsetPixels.IsEnabled = false;
}
else
{
radioButtonOverlapping.Checked = true;
numericUpDownOverlappingOffsetPixels.Enabled = true;
radioButtonOverlapping.IsChecked = true;
numericUpDownOverlappingOffsetPixels.IsEnabled = true;
}
#if TODO
checkBoxResolveLinksToFolders.Checked = Settings.Default.ResolveLinksToFolders;
checkBoxShowInTaskbar.Checked = Settings.Default.ShowInTaskbar;
checkBoxSendHotkeyInsteadKillOtherInstances.Checked = Settings.Default.SendHotkeyInsteadKillOtherInstances;
@ -1247,24 +1237,22 @@ namespace SystemTrayMenu.UserInterface
buttonAddSampleStartMenuFolder.Enabled = !doesStartMenuFolderExist;
}
private void ButtonSizeAndLocationDefault_Click(object sender, EventArgs e)
#endif
private void ButtonSizeAndLocationDefault_Click(object sender, RoutedEventArgs e)
{
numericUpDownSizeInPercent.Value = 100;
numericUpDownIconSizeInPercent.Value = 100;
numericUpDownRowHeighteInPercentage.Value = 100;
numericUpDownMenuWidth.Value = 100;
numericUpDownMenuHeight.Value = 100;
numericUpDownSizeInPercent.Text = 100.ToString();
numericUpDownIconSizeInPercent.Text = 100.ToString();
numericUpDownRowHeighteInPercentage.Text = 100.ToString();
numericUpDownMenuWidth.Text = 100.ToString();
numericUpDownMenuHeight.Text = 100.ToString();
radioButtonAppearAtTheBottomRight.Checked = false;
radioButtonAppearAtTheBottomLeft.Checked = true;
radioButtonUseCustomLocation.Checked = false;
radioButtonAppearAtMouseLocation.Checked = false;
radioButtonAppearAtTheBottomLeft.IsChecked = true;
radioButtonNextToPreviousMenu.Checked = true;
numericUpDownOverlappingOffsetPixels.Value = 150;
radioButtonNextToPreviousMenu.IsChecked = true;
numericUpDownOverlappingOffsetPixels.Text = 150.ToString();
}
#if TODO
private void ButtonAdvancedDefault_Click(object sender, EventArgs e)
{
checkBoxResolveLinksToFolders.Checked = true;
@ -1491,28 +1479,15 @@ namespace SystemTrayMenu.UserInterface
#endif
Close();
}
#if TODO
private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
private void RadioButtonOverlapping_Checked(object sender, RoutedEventArgs e)
{
settingsForm?.Dispose();
settingsForm = null;
numericUpDownOverlappingOffsetPixels.IsEnabled = true;
}
private void RadioButtonNextToPreviousMenu_CheckedChanged(object sender, EventArgs e)
private void RadioButtonOverlapping_Unchecked(object sender, RoutedEventArgs e)
{
radioButtonOverlapping.CheckedChanged -= RadioButtonOverlapping_CheckedChanged;
radioButtonOverlapping.Checked = false;
radioButtonOverlapping.CheckedChanged += RadioButtonOverlapping_CheckedChanged;
numericUpDownOverlappingOffsetPixels.Enabled = false;
numericUpDownOverlappingOffsetPixels.IsEnabled = false;
}
private void RadioButtonOverlapping_CheckedChanged(object sender, EventArgs e)
{
radioButtonNextToPreviousMenu.CheckedChanged -= RadioButtonNextToPreviousMenu_CheckedChanged;
radioButtonNextToPreviousMenu.Checked = false;
radioButtonNextToPreviousMenu.CheckedChanged += RadioButtonNextToPreviousMenu_CheckedChanged;
numericUpDownOverlappingOffsetPixels.Enabled = true;
}
#endif
}
}