Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RetroBar/Controls/InputLanguage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:RetroBar.Converters"
MouseLeftButtonDown="UserControl_MouseLeftButtonDown"
Loaded="UserControl_Loaded"
Unloaded="UserControl_Unloaded">
<UserControl.Resources>
Expand All @@ -24,7 +25,7 @@
Style="{DynamicResource LanguageBar}">
<TextBlock x:Name="InputLanguageText"
Style="{DynamicResource InputLanguage}"
Text="{Binding Path=LocaleIdentifier, Converter={StaticResource cultureInfoToLocaleNameConverter}, ConverterParameter=TwoLetterIsoLanguageName, Mode=OneWay}">
Text="{Binding Path=LocaleIdentifier, Converter={StaticResource cultureInfoToLocaleNameConverter}, ConverterParameter=TwoLetterIsoLanguageName, Mode=OneWay}" HorizontalAlignment="Left">
</TextBlock>
</WrapPanel>
</DockPanel>
Expand Down
84 changes: 81 additions & 3 deletions RetroBar/Controls/InputLanguage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,31 @@
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using ManagedShell.Common.Helpers;
using ManagedShell.Common.Logging;
using RetroBar.Converters;
using RetroBar.Utilities;
using WinForms = System.Windows.Forms;

namespace RetroBar.Controls
{
public static class InputMethodSwitcher
{
public static void Toggle()
{
var list = WinForms.InputLanguage.InstalledInputLanguages.Cast<WinForms.InputLanguage>().ToList();
if (list.Count < 2)
return;

var current = WinForms.InputLanguage.CurrentInputLanguage;
int index = list.IndexOf(current);
int next = (index + 1) % list.Count;

WinForms.InputLanguage.CurrentInputLanguage = list[next];
}
}
public partial class InputLanguage : UserControl
{
public static DependencyProperty LocaleIdentifierProperty = DependencyProperty.Register(nameof(LocaleIdentifier), typeof(CultureInfo), typeof(InputLanguage));
Expand Down Expand Up @@ -64,7 +81,7 @@ private void SetLocaleIdentifier()
private void StartWatch()
{
SetLocaleIdentifier();

layoutWatch.Start();

Visibility = Visibility.Visible;
Expand All @@ -84,7 +101,7 @@ private void JapaneseImeAdd()
var NewControl = new JapaneseIme();
InputLanguageDockPanel.Children.Add(NewControl);
}

private void JapaneseImeRemove()
{
var DelControl = InputLanguageDockPanel.Children
Expand Down Expand Up @@ -171,10 +188,71 @@ private void UserControl_Loaded(object sender, RoutedEventArgs e)
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
{
StopWatch();

Settings.Instance.PropertyChanged -= Settings_PropertyChanged;

_isLoaded = false;
}

private void ShowLanguageMenu()
{
var menu = new ContextMenu();

foreach (WinForms.InputLanguage lang in WinForms.InputLanguage.InstalledInputLanguages)
{
string code = lang.Culture.TwoLetterISOLanguageName.ToUpperInvariant();

var panel = new StackPanel
{
Orientation = Orientation.Horizontal,
Margin = new Thickness(0, 0, 0, 0)
};

var badge = new Border
{
Background = (Brush)Application.Current.Resources["InputLanguageBackground"],
Padding = new Thickness(1, 1, 2, 3),
Margin = new Thickness(0, 0, 6, 0),
Child = new TextBlock
{
Text = code,
FontSize = 10,
FontWeight = FontWeights.UltraLight,
Foreground = (Brush)Application.Current.Resources["InputLanguageSelectorForeground"]
}
};

var text = new TextBlock
{
Text = lang.Culture.DisplayName
};

panel.Children.Add(badge);
panel.Children.Add(text);

var item = new MenuItem
{
Header = panel,
Tag = lang,
IsCheckable = true,
IsChecked = lang.Equals(WinForms.InputLanguage.CurrentInputLanguage)
};

item.Click += (s, e) =>
{
WinForms.InputLanguage.CurrentInputLanguage = (WinForms.InputLanguage)((MenuItem)s).Tag;
};

menu.Items.Add(item);
}

menu.PlacementTarget = this;
menu.IsOpen = true;
}

private void UserControl_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
ShowLanguageMenu();//InputMethodSwitcher.Toggle();
}
};
}
2 changes: 1 addition & 1 deletion RetroBar/Themes/System.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<SolidColorBrush x:Key="ClockForeground" Color="{x:Static SystemColors.ControlTextColor}" />
<SolidColorBrush x:Key="InputLanguageForeground" Color="{x:Static SystemColors.HighlightTextColor}" />
<SolidColorBrush x:Key="InputLanguageBackground" Color="{x:Static SystemColors.HighlightColor}" />
<SolidColorBrush x:Key="InputLanguageSelectorForeground" Color="{x:Static SystemColors.HighlightTextColor}" />

<SolidColorBrush x:Key="ToolTipBackground" Color="{x:Static SystemColors.InfoColor}" />
<SolidColorBrush x:Key="ToolTipForeground" Color="{x:Static SystemColors.InfoTextColor}" />
Expand Down Expand Up @@ -1060,7 +1061,6 @@
Width="3">
<Border BorderThickness="1,1,0,0"
BorderBrush="{DynamicResource ButtonHighlight}">

</Border>
</Border>
</Border>
Expand Down
1 change: 1 addition & 0 deletions RetroBar/Themes/Windows Longhorn Aero.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<SolidColorBrush x:Key="TaskbarTopInnerBorder1" Color="#d6ffffff" />
<SolidColorBrush x:Key="TaskbarTopInnerBorder2" Color="#7dffffff" />
<SolidColorBrush x:Key="TaskbarBottomBorder" Color="#c7ffffff" />
<SolidColorBrush x:Key="InputLanguageSelectorForeground" Color="#000000" />

<SolidColorBrush x:Key="TrayToggleBorder" Color="#99000000" />
<SolidColorBrush x:Key="TrayToggleInnerBorder" Color="#e6ffffff" />
Expand Down
1 change: 1 addition & 0 deletions RetroBar/Themes/Windows Vista Aero.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<SolidColorBrush x:Key="TaskbarVerticalTopInnerBorder" Color="#e59e9e9e" />
<SolidColorBrush x:Key="TaskbarVerticalBottomInnerBorder" Color="#c2000000" />
<SolidColorBrush x:Key="TaskbarVerticalBottomBorder" Color="#f7000000" />
<SolidColorBrush x:Key="InputLanguageSelectorForeground" Color="#000000" />

<SolidColorBrush x:Key="TrayToggleOuterBorder" Color="#20ffffff" />
<SolidColorBrush x:Key="TrayToggleBorder" Color="#99000000" />
Expand Down
1 change: 1 addition & 0 deletions RetroBar/Themes/Windows Vista Basic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<SolidColorBrush x:Key="TaskbarVerticalTopInnerBorder" Color="#B4B4B4" />
<SolidColorBrush x:Key="TaskbarVerticalBottomInnerBorder" Color="#1C1E1F" />
<SolidColorBrush x:Key="TaskbarVerticalBottomBorder" Color="#1B1D1F" />
<SolidColorBrush x:Key="InputLanguageSelectorForeground" Color="#000000" />

<LinearGradientBrush x:Key="TaskButtonThumbnailBackground"
StartPoint="0,0"
Expand Down
Loading