From 43458c5ab71500cc26f418d1522efd408faafb4b Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Tue, 20 Oct 2026 19:43:58 +0300 Subject: [PATCH] ChessPenguin 0.8.1: the side panel fits small screens The reference tab no longer slides under the board on a laptop screen with 200 % scaling: the games table narrows its player columns to the panel, the moves table shows a column only while it fits, its heading lines wrap, and the board gives way in a tall narrow window so the reference keeps 320 px. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 7 +++ Cargo.lock | 8 +-- Cargo.toml | 2 +- apps/desktop/src/game_view.rs | 10 +++- apps/desktop/src/reference.rs | 52 ++++++++++++++----- docs/dev/desktop.md | 2 +- ...thub.vrubelroman.chessPenguin.metainfo.xml | 5 ++ 7 files changed, 66 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8128635..ef31ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes are listed here. Versions follow [Semantic Versioning](https://semver.org/). +## [0.8.1] — 2026-10-20 + +- The side panel fits small screens (a laptop with 200 % scaling): the reference tab no longer + slides under the board and is no longer cut off on the left. Its tables narrow their columns + and drop the less important ones to fit, their headings wrap, and in a tall narrow window the + board gives way so the reference keeps enough width. + ## [0.8.0] — 2026-10-20 - Games from Lichess and Chess.com: anyone's games by nickname — yours, a pupil's, an diff --git a/Cargo.lock b/Cargo.lock index d603e90..391541c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -661,7 +661,7 @@ dependencies = [ [[package]] name = "chess-core" -version = "0.8.0" +version = "0.8.1" dependencies = [ "encoding_rs", "pgn-reader", @@ -671,7 +671,7 @@ dependencies = [ [[package]] name = "chess-import" -version = "0.8.0" +version = "0.8.1" dependencies = [ "chess-core", "encoding_rs", @@ -684,7 +684,7 @@ dependencies = [ [[package]] name = "chesspenguin" -version = "0.8.0" +version = "0.8.1" dependencies = [ "arboard", "chess-core", @@ -4284,7 +4284,7 @@ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" [[package]] name = "uci" -version = "0.8.0" +version = "0.8.1" dependencies = [ "thiserror 2.0.21", ] diff --git a/Cargo.toml b/Cargo.toml index e75728c..f06d349 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/chess-core", "crates/chess-import", "crates/uci", "apps/desktop"] [workspace.package] -version = "0.8.0" +version = "0.8.1" edition = "2024" rust-version = "1.97" license = "GPL-3.0-or-later" diff --git a/apps/desktop/src/game_view.rs b/apps/desktop/src/game_view.rs index 9c6dbfd..25f390f 100644 --- a/apps/desktop/src/game_view.rs +++ b/apps/desktop/src/game_view.rs @@ -263,7 +263,13 @@ impl GameView { } else { height } - 16.0; - let room = (width - board - 24.0).max(240.0); + // In a tall narrow window the board gives way: the reference tables need 320 px. + let least: f32 = if self.side_tab == SideTab::Reference { + 320.0 + } else { + 240.0 + }; + let room = (width - board - 24.0).max(least.min(width * 0.5)); let (side_id, side_width) = if self.side_tab == SideTab::Reference { ("game_side_ref", room.min(1100.0)) } else { @@ -273,7 +279,7 @@ impl GameView { egui::Panel::right(side_id) .resizable(true) .default_size(side_width) - .size_range(240.0_f32.min(width * 0.5).min(max)..=max) + .size_range(least.min(width * 0.5).min(max)..=max) .show(ui, |ui| { self.side_panel(ui, settings, analysis, reference, &mut actions) }); diff --git a/apps/desktop/src/reference.rs b/apps/desktop/src/reference.rs index af35c3d..06f8ac8 100644 --- a/apps/desktop/src/reference.rs +++ b/apps/desktop/src/reference.rs @@ -972,7 +972,7 @@ impl Reference { } let Some(db) = db else { ui.add_space(8.0); - ui.horizontal(|ui| { + ui.horizontal_wrapped(|ui| { ui.add(egui::Spinner::new().size(14.0)); ui.label(RichText::new(tr("Opening the database…")).weak()); }); @@ -987,7 +987,7 @@ impl Reference { { let work = db.as_chessbase().map_or(1, |b| b.prepare_work()).max(1); let pct = 100.0 * job.progress() as f32 / work as f32; - ui.horizontal(|ui| { + ui.horizontal_wrapped(|ui| { ui.add(egui::Spinner::new().size(12.0)); ui.label( RichText::new(trf( @@ -1055,7 +1055,7 @@ impl Reference { if ui.input(|i| i.time) - started > 0.3 { let total = db.len().max(1); let p = self.job.as_ref().map_or(0, |(_, j)| j.progress()); - ui.horizontal(|ui| { + ui.horizontal_wrapped(|ui| { ui.add(egui::Spinner::new().size(14.0)); let text = if p > 0 { trf( @@ -1123,12 +1123,25 @@ impl Reference { let natural = 26.0 * (rows as f32 + 1.0) + 8.0; let height = natural.min((ui.available_height() * 0.4).max(120.0)); // Columns that give way in a narrow panel: players, year, White's score, rating. + // Each is shown only while the table still fits the panel (in this order). let width = ui.available_width(); - let show_players = width > 600.0 && !books; - let show_year = width > 470.0; - let show_score = width > 400.0 && !books; - let show_elo = width > 330.0 && !books; + let gap = ui.spacing().item_spacing.x; let show_bar = !books; + let mut used = 86.0 + 64.0 + 44.0 + 3.0 * gap; + if show_bar { + used += 86.0 + gap; + } + let mut fits = |w: f32, wanted: bool| { + let ok = wanted && used + w + gap <= width; + if ok { + used += w + gap; + } + ok + }; + let show_elo = fits(56.0, !books); + let show_score = fits(48.0, !books); + let show_year = fits(44.0, true); + let show_players = fits(80.0, !books); // Text in the rows must not take the clicks meant for the row. ui.style_mut().interaction.selectable_labels = false; let mut table = TableBuilder::new(ui) @@ -1368,7 +1381,7 @@ impl Reference { }; let rows: Vec<&GameRow> = list.into_iter().filter(|g| !is_copy(g.index)).collect(); let mut action = None; - ui.horizontal(|ui| { + ui.horizontal_wrapped(|ui| { match selected.and_then(|m| m.to_move(pos).ok()) { Some(m) => { ui.label( @@ -1415,6 +1428,19 @@ impl Reference { let show_event = width > 720.0; let show_then = width > 520.0; let show_year = width > 380.0; + // The table never gets wider than the panel: wider content pushes the whole side + // panel out to the left, under the board (a 1440-point-wide laptop screen). + let columns = 5 + usize::from(show_year) + usize::from(show_then) + usize::from(show_event); + let fixed = 3.0 * 44.0 + + if show_year { 52.0 } else { 0.0 } + + match (show_then, show_event) { + (true, true) => 150.0, + (true, false) => 80.0, + _ => 0.0, + } + + if show_event { 80.0 } else { 0.0 } + + ui.spacing().item_spacing.x * columns as f32; + let player = ((width - fixed) / 2.0).clamp(60.0, 150.0); ui.style_mut().interaction.selectable_labels = false; let mut table = TableBuilder::new(ui) .id_salt("reference_games") @@ -1422,16 +1448,18 @@ impl Reference { .sense(Sense::click()) .auto_shrink([false, false]) .cell_layout(egui::Layout::left_to_right(egui::Align::Center)) - .column(Column::initial(150.0).at_least(60.0).clip(true)) + .column(Column::exact(player).clip(true)) .column(Column::exact(44.0)) - .column(Column::initial(150.0).at_least(60.0).clip(true)) + .column(Column::exact(player).clip(true)) .column(Column::exact(44.0)) .column(Column::exact(44.0)); if show_year { table = table.column(Column::exact(52.0)); } - if show_then { - table = table.column(Column::initial(150.0).at_least(80.0).clip(true)); + if show_then && show_event { + table = table.column(Column::exact(150.0).clip(true)); + } else if show_then { + table = table.column(Column::remainder().at_least(80.0).clip(true)); } if show_event { table = table.column(Column::remainder().at_least(80.0).clip(true)); diff --git a/docs/dev/desktop.md b/docs/dev/desktop.md index c0b45ab..8e64a7c 100644 --- a/docs/dev/desktop.md +++ b/docs/dev/desktop.md @@ -46,7 +46,7 @@ XDG_CONFIG_HOME=/tmp/cfg CP_OPEN=11 CP_PLY=3 CP_ANALYZE=1 ./target/debug/chesspe ``` `CP_OPEN` — индекс партии (с 0) в первой базе списка, `CP_PLY` — шагов по основной линии, -`CP_ONLINE=<ник>` — открыть окно онлайн-партий и найти ник (`CP_ONLINE_DOWNLOAD=1` — сразу скачать). `CP_UPDATE_SOURCE=<папка>` — брать «последний выпуск» из `latest.json` и файлов этой папки вместо GitHub, `CP_UPDATE_KIND=deb|rpm|arch|aur|flatpak|appimage|tarball|windows|mac` — считать установку такой, `CP_UPDATE_OPEN=1` — открыть окно обновления (`=start` — сразу начать), `CP_TAB=reference` — открыть у партии вкладку «Справочник», `CP_ANALYZE` — запустить активный движок, `CP_SETTINGS` — открыть настройки (`=board`, `=about` — сразу эту вкладку), `CP_ENGINE_PANEL` — раскрыть панель настроек движка, `CP_VAR` — перейти в первый вариант после `CP_PLY`, `CP_REVIEW=1` — запустить анализ партии (`=dialog` — только открыть окно), `CP_REPORT=1` — открыть вкладку «Отчёт» (нужен готовый анализ), `CP_BEST=k` — показать на доске k-й ход лучшей линии у первой отметки движка (нужен готовый анализ), `CP_ENGINE_OFFER=1` — окно предложения скачать Stockfish (`=download` — сразу начать загрузку), `CP_BOARD="e4 c5 Nf3"` — доска поиска большой базы с этими ходами (SAN), `CP_SORT=date` — большая база по дате (новые сверху), `CP_PANE=hidden` — большая база без правой панели, `CP_FILTER="player=carlsen;years=2015-2026;elo=2600"` — несколько фильтров большой базы, `CP_FILTER_PLAYER=имя` — фильтр «Игрок» большой базы ChessBase при запуске, `CP_SCREENSHOT=file.png` (+ `CP_SCREENSHOT_DELAY=сек`) — полноэкранный снимок окна и выход; так сделаны `docs/screenshots/`. `CP_ONLINE=<ник>` — открыть окно онлайн-партий и найти ник (`CP_ONLINE_DOWNLOAD=1` — сразу загрузить). Ключ `--bench <база> [отчёт.txt]` печатает замеры базы вместо окна (`docs/dev/import.md`, «Замер на другой машине»). `CP_MEMORY_LIMIT=<МБ>` — считать доступной памятью не больше этого (пути без дебютного индекса и без таблицы позиций PGN). +`CP_ONLINE=<ник>` — открыть окно онлайн-партий и найти ник (`CP_ONLINE_DOWNLOAD=1` — сразу скачать). `CP_UPDATE_SOURCE=<папка>` — брать «последний выпуск» из `latest.json` и файлов этой папки вместо GitHub, `CP_UPDATE_KIND=deb|rpm|arch|aur|flatpak|appimage|tarball|windows|mac` — считать установку такой, `CP_UPDATE_OPEN=1` — открыть окно обновления (`=start` — сразу начать), `CP_TAB=reference` — открыть у партии вкладку «Справочник», `CP_ANALYZE` — запустить активный движок, `CP_SETTINGS` — открыть настройки (`=board`, `=about` — сразу эту вкладку), `CP_ENGINE_PANEL` — раскрыть панель настроек движка, `CP_VAR` — перейти в первый вариант после `CP_PLY`, `CP_REVIEW=1` — запустить анализ партии (`=dialog` — только открыть окно), `CP_REPORT=1` — открыть вкладку «Отчёт» (нужен готовый анализ), `CP_BEST=k` — показать на доске k-й ход лучшей линии у первой отметки движка (нужен готовый анализ), `CP_ENGINE_OFFER=1` — окно предложения скачать Stockfish (`=download` — сразу начать загрузку), `CP_BOARD="e4 c5 Nf3"` — доска поиска большой базы с этими ходами (SAN), `CP_SORT=date` — большая база по дате (новые сверху), `CP_PANE=hidden` — большая база без правой панели, `CP_FILTER="player=carlsen;years=2015-2026;elo=2600"` — несколько фильтров большой базы, `CP_FILTER_PLAYER=имя` — фильтр «Игрок» большой базы ChessBase при запуске, `CP_SCREENSHOT=file.png` (+ `CP_SCREENSHOT_DELAY=сек`) — полноэкранный снимок окна и выход; так сделаны `docs/screenshots/`. Ключ `--bench <база> [отчёт.txt]` печатает замеры базы вместо окна (`docs/dev/import.md`, «Замер на другой машине»). `CP_MEMORY_LIMIT=<МБ>` — считать доступной памятью не больше этого (пути без дебютного индекса и без таблицы позиций PGN). ## Языки diff --git a/packaging/io.github.vrubelroman.chessPenguin.metainfo.xml b/packaging/io.github.vrubelroman.chessPenguin.metainfo.xml index 5dfdb1d..6be6c1d 100644 --- a/packaging/io.github.vrubelroman.chessPenguin.metainfo.xml +++ b/packaging/io.github.vrubelroman.chessPenguin.metainfo.xml @@ -43,6 +43,11 @@ BoardGame + + +

The side panel fits small screens: on a laptop screen the reference tab no longer slides under the board.

+
+

Games from Lichess and Chess.com: download anyone's games by nickname — yours, a pupil's, an opponent's — into a database, both sites merged or one per site, and fetch the new ones with one click. Interrupted downloads continue without duplicates.