Skip to content

photoview: sharp downscaling, R to turn, zoom in the caption - #156

Open
Tkyoxx wants to merge 7 commits into
Lemxy:mainfrom
Tkyoxx:pr/11-photoview
Open

Tkyoxx wants to merge 7 commits into
Lemxy:mainfrom
Tkyoxx:pr/11-photoview

Conversation

@Tkyoxx

@Tkyoxx Tkyoxx commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Stacked on #144, #149. Until those are merged this branch also carries their commits, so the diff below is bigger than this PR. Its own change is 1 commit; I will rebase it as soon as #149 is in.

What

Pictures shown smaller than they are go through WIC's high-quality cubic filter (Fant where missing) once per size instead of GDI halftone; R / Shift+R turn a quarter; the caption shows the zoom.

Screenshot (Windows' own wallpaper at 64 %, Windows 10 21H2)

photoview showing a 1920x1200 picture at 64 %

Test

Open a big photo, resize the window; R, Shift+R.

- winrust-common: Lang::Es and Lang::ALL; t!/tf! take an optional es: arm
  after zh: (or after pt: in calls without zh:), and any language left out
  shows the English text, so nothing is ever blank or a raw key.
- No lang.txt: the Windows UI language when WinRust has it, else English.
- lang() re-reads lang.txt at most once a second and set_lang broadcasts
  style::msg(), so open windows switch without a restart: topbar now listens
  for the broadcast, rust-settings rebuilds its pages and rust-explorer its
  column headers and navigation pane when the language moved. The "restart
  the programs" notes say the switch is immediate now.
- The installer list, rust-settings and the bar's language page take their
  languages from Lang::ALL (Spanish included); --lang accepts es.
- Spanish for every t!/tf! call (1,246), the installer table, the Run box
  commands and the Start button menu, plus the few strings still English-only
  in rust-explorer.
- rs-launcher's counts gave "2 registry entrys" and Portuguese had no plural
  at all: every language now spells out its singular and plural.
The WinRust windows paint everything themselves except the caption, so on
Windows 10 each one wore the old system title bar on top of a modern page.

caption.rs takes the standard caption away (WM_NCCALCSIZE: the whole window
is client area) and lets the window paint flat minimize / maximize / close
buttons in its own colours, with Windows 11's hover shades and the red close.
The hit test answers with the real HT* codes, so dragging, double-click to
maximize, Aero Snap and Shake, the window menu (right click, Alt+Space),
resizing from every edge and Windows 11's snap layouts keep working. Clicks
on the buttons are handled here, not by DefWindowProc, which would paint the
classic buttons over ours while tracking them. A maximized window keeps its
frame off-screen out of the client area; one pixel of DWM frame keeps the
shadow on Windows 10. A child window lying over the caption can paint the
buttons and pass the free parts through with HTTRANSPARENT.

The installer's dark header is the title bar now: it drags the window, the
language list moved left to clear the buttons.
The buttons sit at the top right and the page title's band drags the window, as in Windows 11 Settings; the sidebar's page list stays clickable where it reaches into that band. The caption colour attributes are gone with the caption.
Like a browser: the tabs sit in the caption, its free space drags the window and the buttons sit at its right end. The chrome child answers HTTRANSPARENT there, so the top-level window does the caption's work, and it paints the buttons itself. Tabs leave room for them. The desktop window (--desktop) is left alone.
WinRust Disk's path line is the caption. The photo viewer gets a thin strip with the file's name, position and size over the picture area; zoom and panning count from under it.
The band drags the window except over the menu button and the page buttons, which move left to clear the caption buttons. The search box is a window of its own and keeps working as before.
- Shown smaller than it is, a picture is scaled by WIC's high-quality cubic
  filter (Fant where that is missing), once per size, instead of GDI's
  halftone, which left big photos soft and jagged.
- R / Shift+R turn the picture a quarter right / left, for photos saved the
  wrong way up.
- The caption shows the zoom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant