Skip to content

Commit

Permalink
Merge pull request #757 from dremin/layout-improvements
Browse files Browse the repository at this point in the history
Layout improvements
  • Loading branch information
dremin authored Feb 21, 2024
2 parents 9bde787 + fd65a55 commit cddaa2c
Show file tree
Hide file tree
Showing 30 changed files with 174 additions and 161 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="RetroBar.Controls.KeyboardLayout"
<UserControl x:Class="RetroBar.Controls.InputLanguage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:RetroBar.Converters"
Expand All @@ -7,17 +7,24 @@
<UserControl.Resources>
<ResourceDictionary>
<converters:CultureInfoToLocaleNameConverter x:Key="cultureInfoToLocaleNameConverter" />
<converters:DockOrientationConverter x:Key="dockOrientationConverter" />
</ResourceDictionary>
</UserControl.Resources>

<Viewbox Width="24"
Stretch="Fill" StretchDirection="DownOnly"
Style="{DynamicResource KeyboardLayoutViewBox}">
<TextBlock Style="{DynamicResource KeyboardLayout}"

<DockPanel>
<Thumb Style="{DynamicResource ToolbarThumb}">
<DockPanel.Dock>
<Binding Converter="{StaticResource dockOrientationConverter}"
ConverterParameter="leading"
Path="Orientation"
RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Window}" />
</DockPanel.Dock>
</Thumb>
<TextBlock Style="{DynamicResource InputLanguage}"
Text="{Binding Path=LocaleIdentifierProperty, Converter={StaticResource cultureInfoToLocaleNameConverter}, ConverterParameter=TwoLetterIsoLanguageName, Mode=OneWay}">
</TextBlock>
</Viewbox>
</DockPanel>

<UserControl.ToolTip>
<TextBlock Text="{Binding Path=LocaleIdentifierProperty, Converter={StaticResource cultureInfoToLocaleNameConverter}, ConverterParameter=EnglishName, Mode=OneWay}" />
</UserControl.ToolTip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

namespace RetroBar.Controls
{
public partial class KeyboardLayout : UserControl
public partial class InputLanguage : UserControl
{
public static DependencyProperty LocaleIdentifierProperty = DependencyProperty.Register("LocaleIdentifierProperty", typeof(CultureInfo), typeof(KeyboardLayout));
public static DependencyProperty LocaleIdentifierProperty = DependencyProperty.Register("LocaleIdentifierProperty", typeof(CultureInfo), typeof(InputLanguage));

public CultureInfo LocaleIdentifier
{
Expand All @@ -22,7 +22,7 @@ public CultureInfo LocaleIdentifier

private bool _isLoaded;

public KeyboardLayout()
public InputLanguage()
{
InitializeComponent();
DataContext = this;
Expand All @@ -33,7 +33,7 @@ public KeyboardLayout()

private void Initialize()
{
if (Settings.Instance.ShowKeyboardLayout)
if (Settings.Instance.ShowInputLanguage)
{
StartWatch();
}
Expand Down Expand Up @@ -74,9 +74,9 @@ private void StopWatch()

private void Settings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "ShowKeyboardLayout")
if (e.PropertyName == "ShowInputLanguage")
{
if (Settings.Instance.ShowKeyboardLayout)
if (Settings.Instance.ShowInputLanguage)
{
StartWatch();
}
Expand Down
2 changes: 1 addition & 1 deletion RetroBar/Languages/English.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<s:String x:Key="allow_font_smoothing">_Allow font smoothing</s:String>
<s:String x:Key="collapse_tray_icons">Collapse _notification area icons</s:String>
<s:String x:Key="customize">_Customize...</s:String>
<s:String x:Key="show_keyboard_layout">Show the keyboard _layout</s:String>
<s:String x:Key="show_input_language">Show the input _language</s:String>
<s:String x:Key="show_clock">Show the cloc_k</s:String>
<s:String x:Key="show_multi_mon">Show on _multiple displays</s:String>
<s:String x:Key="show_quick_launch">Show _Quick Launch</s:String>
Expand Down
2 changes: 1 addition & 1 deletion RetroBar/Languages/Türkçe.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<s:String x:Key="allow_font_smoothing">_Yazı tipi yumuşatmaya izin ver</s:String>
<s:String x:Key="collapse_tray_icons">Bildirim _alanı simgelerini daralt</s:String>
<s:String x:Key="customize">Ö_zelleştir...</s:String>
<s:String x:Key="show_keyboard_layout">_Klavye düzenini göster</s:String>
<s:String x:Key="show_input_language">_Klavye düzenini göster</s:String>
<s:String x:Key="show_clock">_Saati göster</s:String>
<s:String x:Key="show_multi_mon">Birden çok _ekranda göster</s:String>
<s:String x:Key="show_quick_launch">_Hızlı Başlat'ı Göster</s:String>
Expand Down
2 changes: 1 addition & 1 deletion RetroBar/Languages/hrvatski.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<s:String x:Key="allow_font_smoothing">_Dopusti izglađivanje fonta</s:String>
<s:String x:Key="collapse_tray_icons">Sakriji neaktivne ikone</s:String>
<s:String x:Key="customize">Prilagod_i...</s:String>
<s:String x:Key="show_keyboard_layout">Prikaži raspored _tipkovnice</s:String>
<s:String x:Key="show_input_language">Prikaži raspored _tipkovnice</s:String>
<s:String x:Key="show_clock">Prikaži _sat</s:String>
<s:String x:Key="show_multi_mon">Prikaži _na više zaslona</s:String>
<s:String x:Key="show_quick_launch">Prika_ži brzo pokretanje</s:String>
Expand Down
2 changes: 1 addition & 1 deletion RetroBar/Languages/srpski.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<s:String x:Key="allow_font_smoothing">Dozvoli izglađivanje _fontova</s:String>
<s:String x:Key="collapse_tray_icons">Skupi _ikonice u sistemskoj paleti</s:String>
<s:String x:Key="customize">Prilago_di...</s:String>
<s:String x:Key="show_keyboard_layout">Prikaži raspored _tastature</s:String>
<s:String x:Key="show_input_language">Prikaži raspored _tastature</s:String>
<s:String x:Key="show_clock">Prikaži _sat</s:String>
<s:String x:Key="show_multi_mon">Prikaži na _više ekrana</s:String>
<s:String x:Key="show_quick_launch">Prikaži _brzo pokretanje</s:String>
Expand Down
4 changes: 2 additions & 2 deletions RetroBar/Languages/русский.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<s:String x:Key="advanced_tab">Дополнительно</s:String>
<s:String x:Key="taskbar_appearance">Оформление панели задач</s:String>
<s:String x:Key="notification_area">Область уведомлений</s:String>
<s:String x:Key="autostart">Запускать при при в_ходе в систему</s:String>
<s:String x:Key="autostart">Запускать при в_ходе в систему</s:String>
<s:String x:Key="language_text">_Язык:</s:String>
<s:String x:Key="language_tip">Выберите язык, который хотите использовать.</s:String>
<s:String x:Key="theme_text">_Тема оформления:</s:String>
Expand All @@ -23,7 +23,7 @@
<s:String x:Key="allow_font_smoothing">Пр_именять сглаживание шрифтов</s:String>
<s:String x:Key="collapse_tray_icons">Скр_ывать неиспользуемые значки</s:String>
<s:String x:Key="customize">_Настроить...</s:String>
<s:String x:Key="show_keyboard_layout">Отображать раскладку _клавиатуры</s:String>
<s:String x:Key="show_input_language">Отображать раскладку _клавиатуры</s:String>
<s:String x:Key="show_clock">Отображать _часы</s:String>
<s:String x:Key="show_multi_mon">Показывать на н_ескольких дисплеях</s:String>
<s:String x:Key="show_quick_launch">Отображать панель _быстого запуска</s:String>
Expand Down
2 changes: 1 addition & 1 deletion RetroBar/Languages/српски.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<s:String x:Key="allow_font_smoothing">Дозволи изглађивање _фонтова</s:String>
<s:String x:Key="collapse_tray_icons">Скупи _иконице у системској палети</s:String>
<s:String x:Key="customize">Прилаго_ди...</s:String>
<s:String x:Key="show_keyboard_layout">Прикажи распоред _тастатуре</s:String>
<s:String x:Key="show_input_language">Прикажи распоред _тастатуре</s:String>
<s:String x:Key="show_clock">Прикажи _сат</s:String>
<s:String x:Key="show_multi_mon">Прикажи на _више екрана</s:String>
<s:String x:Key="show_quick_launch">Прикажи _брзо покретање</s:String>
Expand Down
2 changes: 1 addition & 1 deletion RetroBar/Languages/українська.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<s:String x:Key="allow_font_smoothing">Згладжування шрифту</s:String>
<s:String x:Key="collapse_tray_icons">Згорнути іконки панелі сповіщень</s:String>
<s:String x:Key="customize">Змінити...</s:String>
<s:String x:Key="show_keyboard_layout">Показати розкладку _клавіатури</s:String>
<s:String x:Key="show_input_language">Показати розкладку _клавіатури</s:String>
<s:String x:Key="show_clock">Показати годинник</s:String>
<s:String x:Key="show_multi_mon">Показати на усіх дисплеях</s:String>
<s:String x:Key="show_quick_launch">Показати ікони швидкого запуску</s:String>
Expand Down
16 changes: 8 additions & 8 deletions RetroBar/PropertiesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<GroupBox Header="{DynamicResource taskbar_appearance}">
<StackPanel Orientation="Vertical">
<Border Style="{StaticResource PreviewBorder}">
<ContentControl Height="{DynamicResource TaskbarHeight}"
<ContentControl x:Name="TaskbarAppearancePreviewControl"
IsHitTestVisible="False"
Focusable="False"
ClipToBounds="True"
Expand Down Expand Up @@ -230,7 +230,7 @@
<GroupBox Header="{DynamicResource notification_area}">
<StackPanel Orientation="Vertical">
<Border Style="{StaticResource PreviewBorder}">
<ContentControl Height="{DynamicResource TaskbarHeight}"
<ContentControl x:Name="NotificationAreaPreviewControl"
IsHitTestVisible="False"
Focusable="False"
ClipToBounds="True"
Expand All @@ -241,7 +241,7 @@
Converter="{StaticResource textRenderingModeConverter}" />
</TextOptions.TextRenderingMode>
<DockPanel>
<controls:ShowDesktopButton DockPanel.Dock="Right" HorizontalAlignment="Center" Visibility="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowDesktopButton, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource boolToVisibilityConverter}}" />
<controls:ShowDesktopButton DockPanel.Dock="Right" Visibility="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowDesktopButton, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource boolToVisibilityConverter}}" />
<GroupBox Style="{DynamicResource Tray}"
DockPanel.Dock="Right">
<StackPanel Orientation="Horizontal">
Expand All @@ -267,19 +267,19 @@
<controls:Clock VerticalAlignment="Center" />
</StackPanel>
</GroupBox>
<controls:InputLanguage VerticalAlignment="Stretch" DockPanel.Dock="Right" />
<StackPanel></StackPanel>
<controls:KeyboardLayout VerticalAlignment="Center" HorizontalAlignment="Right"/>
</DockPanel>
</ContentControl>
</Border>
<CheckBox x:Name="cbShowKeyboardLayout"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowKeyboardLayout, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource show_keyboard_layout}" />
</CheckBox>
<CheckBox x:Name="cbShowClock"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowClock, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource show_clock}" />
</CheckBox>
<CheckBox x:Name="cbShowInputLanguage"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowInputLanguage, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource show_input_language}" />
</CheckBox>
<CheckBox x:Name="cbShowDesktopButton"
IsChecked="{Binding Source={x:Static Settings:Settings.Instance}, Path=ShowDesktopButton, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{DynamicResource add_show_desktop_button}" />
Expand Down
45 changes: 44 additions & 1 deletion RetroBar/PropertiesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
using ManagedShell.AppBar;
using System.Windows.Forms;
using ManagedShell.WindowsTray;
using System.Runtime.CompilerServices;

namespace RetroBar
{
/// <summary>
/// Interaction logic for PropertiesWindow.xaml
/// </summary>
public partial class PropertiesWindow : Window
public partial class PropertiesWindow : Window, INotifyPropertyChanged
{
private static PropertiesWindow _instance;

Expand All @@ -26,6 +27,8 @@ public partial class PropertiesWindow : Window
private readonly NotificationArea _notificationArea;
private readonly AppBarScreen _screen;

public event PropertyChangedEventHandler PropertyChanged;

// Previews should always assume bottom edge
public AppBarEdge AppBarEdge
{
Expand All @@ -38,6 +41,12 @@ public Orientation Orientation
get => Orientation.Horizontal;
}

// Previews should reflect the locked setting
public bool IsLocked
{
get => Settings.Instance.LockTaskbar;
}

private PropertiesWindow(NotificationArea notificationArea, DictionaryManager dictionaryManager, AppBarScreen screen, double dpiScale, double barSize)
{
_barSize = barSize;
Expand All @@ -48,10 +57,26 @@ private PropertiesWindow(NotificationArea notificationArea, DictionaryManager di

InitializeComponent();

LoadPreviewHeight();
LoadAutoStart();
LoadLanguages();
LoadThemes();
LoadVersion();

Settings.Instance.PropertyChanged += Settings_PropertyChanged;
}

private void Settings_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "LockTaskbar")
{
OnPropertyChanged("IsLocked");
LoadPreviewHeight();
}
else if (e.PropertyName == "Theme")
{
LoadPreviewHeight();
}
}

public static PropertiesWindow Open(NotificationArea notificationArea, DictionaryManager dictionaryManager, AppBarScreen screen, double dpiScale, double barSize)
Expand All @@ -69,6 +94,24 @@ public static PropertiesWindow Open(NotificationArea notificationArea, Dictionar
return _instance;
}

private void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

private void LoadPreviewHeight()
{
double size = System.Windows.Application.Current.FindResource("TaskbarHeight") as double? ?? 0;

if (!IsLocked)
{
size += System.Windows.Application.Current.FindResource("TaskbarUnlockedSize") as double? ?? 0;
}

TaskbarAppearancePreviewControl.Height = size;
NotificationAreaPreviewControl.Height = size;
}

private void LoadAutoStart()
{
try
Expand Down
5 changes: 3 additions & 2 deletions RetroBar/Taskbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@
PreviewMouseRightButtonUp="Clock_PreviewMouseRightButtonUp" />
</StackPanel>
</GroupBox>
<controls:KeyboardLayout VerticalAlignment="Center">
<controls:InputLanguage VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<DockPanel.Dock>
<Binding Converter="{StaticResource dockOrientationConverter}"
ConverterParameter="trailing"
Path="Orientation"
RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Window}" />
</DockPanel.Dock>
</controls:KeyboardLayout>
</controls:InputLanguage>
<controls:TaskList VerticalAlignment="Stretch"
Host="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
Tasks="{Binding Tasks}"></controls:TaskList>
Expand Down
7 changes: 0 additions & 7 deletions RetroBar/Themes/System XP.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
Value="{DynamicResource show_taskman}" />
</Style>

<Style TargetType="TextBlock"
x:Key="KeyboardLayout"
BasedOn="{StaticResource KeyboardLayout}">
<Setter Property="Padding"
Value="0" />
</Style>

<Style TargetType="TextBlock"
x:Key="Clock"
BasedOn="{StaticResource Clock}">
Expand Down
Loading

0 comments on commit cddaa2c

Please sign in to comment.