fixed comment into code

This commit is contained in:
2026-08-09 20:02:23 +05:00
parent 778fc1034b
commit 7e4e569d53
34 changed files with 332 additions and 306 deletions
+16 -15
View File
@@ -5,67 +5,68 @@ using CommunityToolkit.Mvvm.ComponentModel;
namespace CursorLang.Models;
/// <summary>
/// Настройки приложения. Все изменения применяются на лету: подсказка и окно
/// настроек привязаны к этим свойствам, а <c>SettingsService</c> сохраняет их на диск.
/// The application settings. Every change applies on the fly: the popup and the
/// settings window are bound to these properties, and <c>SettingsService</c> saves
/// them to disk.
/// </summary>
public sealed partial class AppSettings : ObservableObject
{
/// <summary>Язык интерфейса в виде кода культуры: «ru», «en».</summary>
/// <summary>The interface language as a culture code: "ru", "en".</summary>
[ObservableProperty]
private string _language = "en";
/// <summary>Оформление окна настроек.</summary>
/// <summary>The look of the settings window.</summary>
[ObservableProperty]
private AppTheme _theme = AppTheme.System;
[ObservableProperty]
private PopupPlacementMode _placementMode = PopupPlacementMode.AtCursor;
// Сторона и отступ хранятся отдельно для каждого режима: у курсора и у
// каретки удобны разные настройки, и переключение режима их не сбрасывает
// The side and the offset are stored per mode: the cursor and the caret call for
// different settings, and switching the mode does not reset them
[ObservableProperty]
private AnchorSide _cursorSide = AnchorSide.BottomRight;
/// <summary>Отступ от курсора в единицах WPF.</summary>
/// <summary>The offset from the cursor in WPF units.</summary>
[ObservableProperty]
private double _cursorOffset = 16;
[ObservableProperty]
private AnchorSide _caretSide = AnchorSide.BottomRight;
/// <summary>Отступ от каретки в единицах WPF.</summary>
/// <summary>The offset from the caret in WPF units.</summary>
[ObservableProperty]
private double _caretOffset = 16;
[ObservableProperty]
private ScreenPosition _screenPosition = ScreenPosition.BottomRight;
/// <summary>Отступ от края монитора в единицах WPF.</summary>
/// <summary>The offset from the monitor edge in WPF units.</summary>
[ObservableProperty]
private double _screenMargin = 24;
[ObservableProperty]
private double _fontSize = 20;
/// <summary>Непрозрачность подсказки: 1.0 — полностью непрозрачная.</summary>
/// <summary>The popup opacity: 1.0 is fully opaque.</summary>
[ObservableProperty]
private double _opacity = 0.9;
/// <summary>Сколько подсказка держится на экране, в миллисекундах.</summary>
/// <summary>How long the popup stays on screen, in milliseconds.</summary>
[ObservableProperty]
private double _durationMilliseconds = 500;
/// <summary>
/// Перехватывать Caps Lock и переключать по ней раскладку вместо смены регистра.
/// По умолчанию выключено: приложение не должно менять поведение системы,
/// пока его об этом не попросили.
/// Intercept Caps Lock and switch the layout with it instead of changing the case.
/// Off by default: the application must not change the behaviour of the system
/// until it is asked to.
/// </summary>
[ObservableProperty]
private bool _useCapsLockHotkey;
/// <summary>
/// С какого времени удержания Caps Lock переключение отменяется, в миллисекундах.
/// After how long a Caps Lock hold cancels the switch, in milliseconds.
/// </summary>
[ObservableProperty]
private double _capsLockHoldMilliseconds = 300;
+2 -2
View File
@@ -1,8 +1,8 @@
namespace CursorLang.Models;
/// <summary>
/// Оформление окна настроек. По умолчанию приложение следует теме Windows,
/// но пользователь может закрепить светлую или тёмную.
/// The look of the settings window. By default the application follows the Windows
/// theme, but the user can pin the light or the dark one.
/// </summary>
public enum AppTheme
{
+6 -6
View File
@@ -3,16 +3,16 @@ using System.Globalization;
namespace CursorLang.Models;
/// <summary>
/// Раскладка клавиатуры в удобном для отображения виде.
/// A keyboard layout in a form convenient for display.
/// </summary>
/// <param name="LocaleId">Идентификатор локали (младшее слово HKL).</param>
/// <param name="ShortName">Короткое имя для подсказки у курсора, например «RU».</param>
/// <param name="DisplayName">Полное имя, например «RU — русский (Россия)».</param>
/// <param name="LocaleId">The locale identifier (the low word of HKL).</param>
/// <param name="ShortName">A short name for the popup at the cursor, "RU" for instance.</param>
/// <param name="DisplayName">The full name, "RU — русский (Россия)" for instance.</param>
public sealed record KeyboardLayout(int LocaleId, string ShortName, string DisplayName)
{
/// <summary>
/// Строит модель по идентификатору локали. Неизвестные локали не являются
/// ошибкой: для них показываем сам идентификатор.
/// Builds the model from a locale identifier. Unknown locales are not an
/// error: for them we show the identifier itself.
/// </summary>
public static KeyboardLayout FromLocaleId(int localeId)
{
+4 -4
View File
@@ -1,19 +1,19 @@
namespace CursorLang.Models;
/// <summary>
/// Почему изменилась текущая раскладка.
/// Why the current layout has changed.
/// </summary>
public enum LayoutChangeReason
{
/// <summary>Пользователь переключил раскладку в активном приложении.</summary>
/// <summary>The user switched the layout in the active application.</summary>
UserSwitched,
/// <summary>Пользователь перешёл в другое приложение, где своя раскладка.</summary>
/// <summary>The user moved to another application that has a layout of its own.</summary>
ApplicationSwitched,
}
/// <summary>
/// Данные события смены раскладки.
/// The data of a layout change event.
/// </summary>
public sealed class LayoutChangedEventArgs(KeyboardLayout layout, LayoutChangeReason reason) : EventArgs
{
+7 -7
View File
@@ -1,25 +1,25 @@
namespace CursorLang.Models;
/// <summary>
/// Способ выбора места для подсказки.
/// How the place for the popup is chosen.
/// </summary>
public enum PopupPlacementMode
{
/// <summary>Рядом с курсором мыши.</summary>
/// <summary>Next to the mouse cursor.</summary>
AtCursor,
/// <summary>
/// Рядом с кареткой в активном поле ввода. Если приложение не сообщает
/// её положение, подсказка показывается у курсора мыши.
/// Next to the caret in the active input field. When the application does not
/// report its position, the popup is shown at the mouse cursor.
/// </summary>
AtCaret,
/// <summary>В заданной точке монитора с активным окном.</summary>
/// <summary>At a fixed point of the monitor holding the active window.</summary>
FixedPoint,
}
/// <summary>
/// С какой стороны от курсора или каретки показывать подсказку.
/// Which side of the cursor or the caret to show the popup on.
/// </summary>
public enum AnchorSide
{
@@ -32,7 +32,7 @@ public enum AnchorSide
}
/// <summary>
/// Место на мониторе для режима <see cref="PopupPlacementMode.FixedPoint"/>.
/// The place on the monitor for the <see cref="PopupPlacementMode.FixedPoint"/> mode.
/// </summary>
public enum ScreenPosition
{