fixed comment into code
This commit is contained in:
@@ -6,9 +6,9 @@ using System.Windows.Media;
|
||||
namespace CursorLang.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Показывает элемент, если значение совпадает с одним из перечисленных
|
||||
/// в параметре через запятую. Нужен, чтобы настройки точки привязки
|
||||
/// и настройки экрана не показывались одновременно.
|
||||
/// Shows an element when the value matches one of those listed in the parameter,
|
||||
/// separated by commas. Needed so that the anchor point settings and the screen
|
||||
/// settings are not shown at the same time.
|
||||
/// </summary>
|
||||
public sealed class EnumToVisibilityConverter : IValueConverter
|
||||
{
|
||||
@@ -27,8 +27,8 @@ public sealed class EnumToVisibilityConverter : IValueConverter
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Цвет в запись вида «#RRGGBB»: альфа не показывается, потому что
|
||||
/// за прозрачность отвечает отдельная настройка.
|
||||
/// A colour into a "#RRGGBB" notation: the alpha is not shown, because
|
||||
/// transparency is a separate setting.
|
||||
/// </summary>
|
||||
public sealed class ColorToHexConverter : IValueConverter
|
||||
{
|
||||
@@ -40,7 +40,7 @@ public sealed class ColorToHexConverter : IValueConverter
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Цвет в кисть — для образцов палитры в списке.
|
||||
/// A colour into a brush — for the palette swatches in the list.
|
||||
/// </summary>
|
||||
public sealed class ColorToBrushConverter : IValueConverter
|
||||
{
|
||||
|
||||
@@ -7,9 +7,9 @@ using CursorLang.ViewModels;
|
||||
namespace CursorLang.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Всплывающая подсказка с коротким именем раскладки.
|
||||
/// Отвечает только за показ, размер и место на экране: когда её убрать,
|
||||
/// решает <see cref="Services.LayoutPopupService"/>.
|
||||
/// The popup with the short name of the layout.
|
||||
/// Responsible only for showing it, its size and its place on screen: when to take it
|
||||
/// down is decided by <see cref="Services.LayoutPopupService"/>.
|
||||
/// </summary>
|
||||
public partial class LayoutPopupWindow : Window
|
||||
{
|
||||
@@ -23,25 +23,25 @@ public partial class LayoutPopupWindow : Window
|
||||
DataContext = viewModel;
|
||||
_settings = settings;
|
||||
|
||||
// Создаём окно заранее, чтобы задать его границы до первого показа:
|
||||
// иначе оно на мгновение появляется в размере по умолчанию
|
||||
// We create the window in advance to set its bounds before the first show:
|
||||
// otherwise it appears at the default size for a moment
|
||||
new WindowInteropHelper(this).EnsureHandle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Показывает подсказку в месте, заданном настройками.
|
||||
/// Shows the popup at the place set by the settings.
|
||||
/// </summary>
|
||||
public void ShowPopup()
|
||||
{
|
||||
MeasureContent();
|
||||
|
||||
// Уже созданное окно ставим на место до показа, чтобы оно не мелькнуло
|
||||
// на старой позиции; при самом первом вызове хэндла ещё нет
|
||||
// An already created window is put in place before the show so that it does
|
||||
// not flash in its old position; on the very first call there is no handle yet
|
||||
ApplyBounds();
|
||||
Show();
|
||||
|
||||
// Повторяем после показа: до него окно подчиняется системному минимальному
|
||||
// размеру окна и получается заметно крупнее текста
|
||||
// We repeat it after the show: before that the window is subject to the system
|
||||
// minimum window size and comes out noticeably larger than its text
|
||||
ApplyBounds();
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public partial class LayoutPopupWindow : Window
|
||||
PopupWindowNative.MakePassive(new WindowInteropHelper(this).Handle);
|
||||
}
|
||||
|
||||
// Размер содержимого нужен до показа: от него зависит и размер окна,
|
||||
// и позиция для углов. Рамок у окна нет, поэтому размер окна равен размеру
|
||||
// содержимого
|
||||
// The content size is needed before the show: both the window size and the corner
|
||||
// position depend on it. The window has no frame, so the window size equals the
|
||||
// content size
|
||||
private void MeasureContent()
|
||||
{
|
||||
var content = (FrameworkElement)Content;
|
||||
@@ -63,9 +63,9 @@ public partial class LayoutPopupWindow : Window
|
||||
_contentSize = content.DesiredSize;
|
||||
}
|
||||
|
||||
// Всё считается в физических пикселях: у мониторов разный масштаб, а
|
||||
// Window.Left/Top/Width/Height пересчитываются по DPI того монитора,
|
||||
// где окно сейчас, и на соседнем мониторе дают промах
|
||||
// Everything is computed in physical pixels: monitors have different scaling,
|
||||
// while Window.Left/Top/Width/Height are converted using the DPI of the monitor
|
||||
// the window is on right now, which misses the target on a neighbouring monitor
|
||||
private void ApplyBounds()
|
||||
{
|
||||
IntPtr handle = new WindowInteropHelper(this).Handle;
|
||||
@@ -84,8 +84,8 @@ public partial class LayoutPopupWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
// Точка привязки: каретка в поле ввода либо курсор мыши. Курсор — это
|
||||
// прямоугольник нулевого размера, поэтому расчёт углов у них общий
|
||||
// The anchor point: the caret in the input field or the mouse cursor. The cursor
|
||||
// is a rectangle of zero size, so the corner computation is shared by both
|
||||
private PopupWindowNative.Rect GetAnchor()
|
||||
{
|
||||
if (_settings.PlacementMode == PopupPlacementMode.AtCaret &&
|
||||
@@ -109,7 +109,7 @@ public partial class LayoutPopupWindow : Window
|
||||
var anchorPoint = new PopupWindowNative.Point { X = anchor.Left, Y = anchor.Top };
|
||||
double scale = PopupWindowNative.GetScaleAt(anchorPoint);
|
||||
|
||||
// У каждого режима привязки своя сторона и свой отступ
|
||||
// Every anchor mode has a side and an offset of its own
|
||||
bool atCaret = _settings.PlacementMode == PopupPlacementMode.AtCaret;
|
||||
AnchorSide side = atCaret ? _settings.CaretSide : _settings.CursorSide;
|
||||
int offset = ToPixels(atCaret ? _settings.CaretOffset : _settings.CursorOffset, scale);
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
<Style TargetType="TextBlock" x:Key="FieldLabel">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0,0,12,0" />
|
||||
<!-- The caption column is narrow, and a translation may not fit into it:
|
||||
such a caption is better wrapped onto a second line than cut off -->
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
<Style TargetType="TextBlock" x:Key="FieldValue">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
@@ -45,6 +48,9 @@
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<!-- The settings are laid out in two columns: this way the window fits on the
|
||||
screen entirely and does without scrolling. Scrolling is kept for the case of
|
||||
a large system font, with which the content is taller than the monitor after all -->
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Padding="16">
|
||||
<StackPanel>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using CursorLang.ViewModels;
|
||||
namespace CursorLang.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Окно настроек приложения.
|
||||
/// The settings window of the application.
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user