mirror of https://github.com/2dust/v2rayN
Font size custom
parent
7989d5180b
commit
b9acd0ec28
|
@ -1,5 +1,4 @@
|
||||||
using System.IO;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media;
|
|
||||||
using v2rayN.Handler;
|
using v2rayN.Handler;
|
||||||
|
|
||||||
namespace v2rayN.Converters
|
namespace v2rayN.Converters
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
public const string CommandClearMsg = "CommandClearMsg";
|
public const string CommandClearMsg = "CommandClearMsg";
|
||||||
public const string DelayUnit = "";
|
public const string DelayUnit = "";
|
||||||
public const string SpeedUnit = "";
|
public const string SpeedUnit = "";
|
||||||
|
public const int MinFontSize = 10;
|
||||||
|
|
||||||
public static readonly List<string> IEProxyProtocols = new List<string> {
|
public static readonly List<string> IEProxyProtocols = new List<string> {
|
||||||
"{ip}:{http_port}",
|
"{ip}:{http_port}",
|
||||||
|
|
|
@ -63,6 +63,7 @@ namespace v2rayN.Mode
|
||||||
public string? colorPrimaryName { get; set; }
|
public string? colorPrimaryName { get; set; }
|
||||||
public string currentLanguage { get; set; }
|
public string currentLanguage { get; set; }
|
||||||
public string currentFontFamily { get; set; }
|
public string currentFontFamily { get; set; }
|
||||||
|
public int currentFontSize { get; set; }
|
||||||
public bool enableDragDropSort { get; set; }
|
public bool enableDragDropSort { get; set; }
|
||||||
public bool doubleClick2Activate { get; set; }
|
public bool doubleClick2Activate { get; set; }
|
||||||
public bool autoHideStartup { get; set; } = true;
|
public bool autoHideStartup { get; set; } = true;
|
||||||
|
|
|
@ -2509,6 +2509,15 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 FontSize 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSettingsFontSize {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSettingsFontSize", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Http Port 的本地化字符串。
|
/// 查找类似 Http Port 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2546,7 +2555,7 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Language 的本地化字符串。
|
/// 查找类似 Language(Restart) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string TbSettingsLanguage {
|
public static string TbSettingsLanguage {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -548,7 +548,7 @@
|
||||||
<value>Dark Mode</value>
|
<value>Dark Mode</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsLanguage" xml:space="preserve">
|
<data name="TbSettingsLanguage" xml:space="preserve">
|
||||||
<value>Language</value>
|
<value>Language(Restart)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
||||||
<value>Import bulk URL from clipboard (Ctrl+V)</value>
|
<value>Import bulk URL from clipboard (Ctrl+V)</value>
|
||||||
|
@ -1105,4 +1105,7 @@
|
||||||
<data name="TbSettingsStartBootTip" xml:space="preserve">
|
<data name="TbSettingsStartBootTip" xml:space="preserve">
|
||||||
<value>Set this with admin privileges, get admin privileges after startup</value>
|
<value>Set this with admin privileges, get admin privileges after startup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbSettingsFontSize" xml:space="preserve">
|
||||||
|
<value>FontSize</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -548,7 +548,7 @@
|
||||||
<value>暗黑模式</value>
|
<value>暗黑模式</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsLanguage" xml:space="preserve">
|
<data name="TbSettingsLanguage" xml:space="preserve">
|
||||||
<value>语言</value>
|
<value>语言(重启)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
<data name="menuAddServerViaClipboard" xml:space="preserve">
|
||||||
<value>从剪贴板导入批量URL (Ctrl+V)</value>
|
<value>从剪贴板导入批量URL (Ctrl+V)</value>
|
||||||
|
@ -1105,4 +1105,7 @@
|
||||||
<data name="TbSettingsStartBootTip" xml:space="preserve">
|
<data name="TbSettingsStartBootTip" xml:space="preserve">
|
||||||
<value>以管理员权限设置此项,在启动后获得管理员权限</value>
|
<value>以管理员权限设置此项,在启动后获得管理员权限</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbSettingsFontSize" xml:space="preserve">
|
||||||
|
<value>字体大小</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -189,6 +189,8 @@ namespace v2rayN.ViewModels
|
||||||
public IObservableCollection<Swatch> Swatches => _swatches;
|
public IObservableCollection<Swatch> Swatches => _swatches;
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public Swatch SelectedSwatch { get; set; }
|
public Swatch SelectedSwatch { get; set; }
|
||||||
|
[Reactive]
|
||||||
|
public int CurrentFontSize { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string CurrentLanguage { get; set; }
|
public string CurrentLanguage { get; set; }
|
||||||
|
@ -1576,6 +1578,7 @@ namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
SelectedSwatch = _swatches.FirstOrDefault(t => t.Name == _config.uiItem.colorPrimaryName);
|
SelectedSwatch = _swatches.FirstOrDefault(t => t.Name == _config.uiItem.colorPrimaryName);
|
||||||
}
|
}
|
||||||
|
CurrentFontSize = _config.uiItem.currentFontSize;
|
||||||
CurrentLanguage = _config.uiItem.currentLanguage;
|
CurrentLanguage = _config.uiItem.currentLanguage;
|
||||||
|
|
||||||
this.WhenAnyValue(
|
this.WhenAnyValue(
|
||||||
|
@ -1611,6 +1614,23 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.WhenAnyValue(
|
||||||
|
x => x.CurrentFontSize,
|
||||||
|
y => y > 0)
|
||||||
|
.Subscribe(c =>
|
||||||
|
{
|
||||||
|
if (CurrentFontSize >= Global.MinFontSize)
|
||||||
|
{
|
||||||
|
_config.uiItem.currentFontSize = CurrentFontSize;
|
||||||
|
double size = (long)CurrentFontSize;
|
||||||
|
Application.Current.Resources["StdFontSize"] = size;
|
||||||
|
Application.Current.Resources["StdFontSize1"] = size + 2;
|
||||||
|
Application.Current.Resources["StdFontSize2"] = size + 4;
|
||||||
|
|
||||||
|
ConfigHandler.SaveConfig(ref _config);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.WhenAnyValue(
|
this.WhenAnyValue(
|
||||||
x => x.CurrentLanguage,
|
x => x.CurrentLanguage,
|
||||||
y => y != null && !y.IsNullOrEmpty())
|
y => y != null && !y.IsNullOrEmpty())
|
||||||
|
|
|
@ -261,37 +261,74 @@
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
|
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
|
||||||
<StackPanel Margin="8">
|
<StackPanel Margin="8">
|
||||||
<StackPanel Orientation="Horizontal">
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
|
Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
|
||||||
<ToggleButton x:Name="togDarkMode" Margin="8" />
|
<ToggleButton
|
||||||
</StackPanel>
|
x:Name="togDarkMode"
|
||||||
<StackPanel Orientation="Horizontal">
|
Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="8" />
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsColor}" />
|
Text="{x:Static resx:ResUI.TbSettingsColor}" />
|
||||||
<ComboBox
|
<ComboBox
|
||||||
x:Name="cmbSwatches"
|
x:Name="cmbSwatches"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
Width="100"
|
Width="100"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
DisplayMemberPath="Name"
|
DisplayMemberPath="Name"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbSettingsFontSize}" />
|
||||||
|
<ComboBox
|
||||||
|
x:Name="cmbCurrentFontSize"
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="100"
|
||||||
|
Margin="8"
|
||||||
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsLanguage}" />
|
Text="{x:Static resx:ResUI.TbSettingsLanguage}" />
|
||||||
<ComboBox
|
<ComboBox
|
||||||
x:Name="cmbCurrentLanguage"
|
x:Name="cmbCurrentLanguage"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
Width="100"
|
Width="100"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
materialDesign:HintAssist.Hint="Language"
|
materialDesign:HintAssist.Hint="Language"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
</StackPanel>
|
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:PopupBox>
|
</materialDesign:PopupBox>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
|
|
|
@ -45,6 +45,11 @@ namespace v2rayN.Views
|
||||||
ViewModel = new MainWindowViewModel(MainSnackbar.MessageQueue!, UpdateViewHandler);
|
ViewModel = new MainWindowViewModel(MainSnackbar.MessageQueue!, UpdateViewHandler);
|
||||||
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
|
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
|
||||||
|
|
||||||
|
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 8; i++)
|
||||||
|
{
|
||||||
|
cmbCurrentFontSize.Items.Add(i.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
Global.Languages.ForEach(it =>
|
Global.Languages.ForEach(it =>
|
||||||
{
|
{
|
||||||
cmbCurrentLanguage.Items.Add(it);
|
cmbCurrentLanguage.Items.Add(it);
|
||||||
|
@ -173,6 +178,7 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.ColorModeDark, v => v.togDarkMode.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.ColorModeDark, v => v.togDarkMode.IsChecked).DisposeWith(disposables);
|
||||||
this.OneWayBind(ViewModel, vm => vm.Swatches, v => v.cmbSwatches.ItemsSource).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.Swatches, v => v.cmbSwatches.ItemsSource).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSwatch, v => v.cmbSwatches.SelectedItem).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSwatch, v => v.cmbSwatches.SelectedItem).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.Text).DisposeWith(disposables);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue