Skip to content

Add some Localization, Language Switcher, Window Persistence, and UI Improvements (v1.0.1.0) - #71

Open
syahdafahreza wants to merge 15 commits into
voidtools:masterfrom
syahdafahreza:master
Open

Add some Localization, Language Switcher, Window Persistence, and UI Improvements (v1.0.1.0)#71
syahdafahreza wants to merge 15 commits into
voidtools:masterfrom
syahdafahreza:master

Conversation

@syahdafahreza

Copy link
Copy Markdown

This Pull Request introduces several features, improvements, and bug fixes to enhance the user experience and expand accessibility. I have also bumped the version to 1.0.1.0 across all components.

Key Changes:

1. Localization & Language Support

  • Indonesian Translation: Added full Indonesian (id-ID) localization support via src/localization_id_id.h.
  • Language Switcher: Added a manual language selection dropdown in Options > General, allowing users to override system defaults.
  • Unique Resource IDs: Assigned unique IDs to previously generic IDC_STATIC labels in the resource file. This enables dynamic localization of all UI elements without falling back to hardcoded English strings.

2. Window Management & Persistence

  • Remember Window State: The application now persists and restores the last window position (X/Y), dimensions (Width/Height), and maximized state.
  • Reset Window Button: Added a "Reset Window Size & Position" button in Options > View to quickly center the window on the current monitor with default dimensions.

3. UI/UX Refinements (Scroll Zoom & Layout)

  • Robust & Smooth Scroll Zoom: Implemented a resolution-aware zoom increment. Small images zoom in finer steps, while high-resolution images maintain fast zooming.
  • Widened Dialog Layout: Increased the width of the Options dialog (from 310 to 360 units) to prevent clipping of long localization strings in various languages.

Code Comparison (Before vs After):

A. Robust & Smooth Scroll Zoom
I refined the zoom logic to be resolution-aware, preventing jumpy zooming on small icons while maintaining speed on high-res photos.

  • Before:
    // src/viv.c (Simple fixed increment)
    if (delta > 0) _viv_zoom_pos++;
    else _viv_zoom_pos--;
  • After:
    // src/viv.c (Resolution-aware dynamic increment)
    int increment = 1;
    // Faster zoom for high-res images (>4MP and >12MP)
    if (_viv_image_wide * (__int64)_viv_image_high > 4000000) increment = 2;
    if (_viv_image_wide * (__int64)_viv_image_high > 12000000) increment = 4;
    
    _viv_zoom_pos += (delta / 120) * increment;

B. Options Dialog Layout (Widened)
Increased the width of the Options dialog to prevent clipping of long localization strings (common in Indonesian and Chinese).

  • Before:
    // res/voidImageViewer.rc
    IDD_OPTIONS DIALOGEX 0, 0, 310, 271
    ...
    CONTROL "",IDC_TAB1,"SysTabControl32",WS_TABSTOP,96,6,210,240
    
  • After:
    // res/voidImageViewer.rc (+50 units width)
    IDD_OPTIONS DIALOGEX 0, 0, 360, 271
    ...
    CONTROL "",IDC_TAB1,"SysTabControl32",WS_TABSTOP,96,6,260,240
    

C. Localizable Static Labels
Assigned unique IDs to static labels that were previously hardcoded as IDC_STATIC, allowing them to be dynamically updated via os_SetDlgItemText_localization_id.

  • Before:
    LTEXT "&Shrink blit mode:",IDC_STATIC,0,0,74,12
    
  • After:
    LTEXT "&Shrink blit mode:",IDC_SHRINK_BLIT_MODE_STATIC,0,0,100,12
    

D. Window Persistence (config.c):

  • Before: (No saving of coordinates)
  • After:
    _config_write_int(h,"x",config_x);
    _config_write_int(h,"language",config_language);
    _config_write_int(h,"y",config_y);
    _config_write_int(h,"wide",config_wide);
    _config_write_int(h,"high",config_high);
    _config_write_int(h,"maximized",config_maximized);

Note to Maintainer:

Please review the changes carefully, particularly the resource ID changes in voidImageViewer.rc and resource.h. I have bumped the version to 1.0.1.0 as these changes introduce new functional features and significant UI improvements. I have tested these changes on Windows 10/11 and they appear stable. However, if any part of this PR does not align with the project's vision, feel free to request changes or decline the PR. Thank you for your time and for maintaining this excellent tool!

syahdafahreza and others added 5 commits May 1, 2026 18:33
Add Indonesian (id_ID) localization and a selectable UI language option. Key changes:
- Add src/localization_id_id.h and register Indonesian in localization arrays; expose localization_get_language_name.
- Add config_language (default = auto) to config.c/.h and persist/load it from settings.
- Add language combobox and related UI strings/controls in resource.h and .rc; include a UTF-8 .rc copy (res/voidImageViewer_utf8.rc).
- Bump application version to 1.0.1.0 (nsis/version.nsh and resource version info) and add scratch_version.ps1 to help update versions.
- Adjust some default config values (store settings in %APPDATA% by default, change navigation sort to name ascending).
- Minor UI layout adjustments and new control IDs for reset window, commands, and keyboard shortcut labels.
- Add auxiliary files: comments.json, issues.json, test_math.c, and update project file (vs2026/voidImageViewer.vcxproj).

These changes add language support and UI elements to let users choose their preferred language and ensure the new strings/resources are included and versioned.
@voidtools

voidtools commented May 4, 2026

Copy link
Copy Markdown
Owner

Thank you for your work on VIV syahdafahreza,

There's a lot of changes here and I will need to go over them.
I will import your Indonesian localization.

I have already adjusted the zoom levels (0.01 - 0.2 curve) and will need more time to review.
The first zoom level always felt too small for 1080p-sized images, so it was skipped.
However, for massive images, this missing zoom level is noticeable.

The window state was already persistent, so I will have to check your changes.

I might move the options dialog size to the translation template.

Thanks again for your work.

@syahdafahreza

Copy link
Copy Markdown
Author

Hi,

Thank you for taking the time to review my PR and for the detailed feedback! I really appreciate it.
Please take all the time you need to go over the changes. I'm glad to hear that the Indonesian localization will be imported.

Just let me know if you need to make any further adjustments or revert any specific commits. Thanks again!

@AiurArtanis

Copy link
Copy Markdown

@syahdafahreza Quick tip: Keep a branch in your fork matching upstream main exactly. Build your PR branches on top of it, so you won’t accidentally include files like your repo README in the PR.

Introduce a new Zoom options tab (IDD_ZOOM) with localized UI (en/ID/zh-CN). Add config entries (zoom_calc_method, zoom_step, zoom_fixed_table) with defaults and INI persistence. Implement zoom calculation methods: Relative (% multiplier), Absolute (additive %), and Fixed table (custom list) including parser and _viv_calculate_next_zoom. Preserve pixel under cursor during zoom, add custom-zoom state, toolbar updates, and related UI handling. Bump version to 1.1.0.0 and add changelog to README.
Introduce a new Compare Images side-by-side comparison window with synchronized/individual zoom & pan, per-pane mini toolbars (browse, zoom, 1:1, fit, rotate, select), and a top control bar (tips, Auto-Fit, Smooth, Filename overlay, Close). Implement full UI, painting, input handling, image loading, mipmap usage and overlays; register new menu item and default hotkey Ctrl+Alt+C. Add multilingual strings (en-US, id-ID, zh-CN), bump product/version to 1.2.0.0 in resources and installer, and update README/Changes.txt.
Increase localization_id_t to unsigned short and set LOCALIZATION_ID_INVALID to 65535 to allow larger localization ID range (src/localization.h). In src/viv.c, correct several formatting and type issues in _viv_compare_format_filesize and _viv_compare_paint: switch format specifiers and casts for filesize and bytes output, render zoom percent as integer, obtain filename_part as a const wchar_t* from string_get_filename_part, and adjust overlay string formatting. These changes address type/overflow and incorrect printf format usage.
This change makes compare mode zoom all panes around their viewport centers so the zoom behavior stays consistent across panes. It also removes the automatic initial image pairing in compare view, leaving panes empty until the user selects images manually.
Introduce a 'Use Current Image' option in the image comparison pane. Adds a new localization id and strings (en,id,zh). Adds UI state (use_current) and rect, a new compare button id, layout and hit-test handling, and painting support via _viv_compare_draw_checkbox_ex. Enforces only one pane can use the current image at a time, toggles loading/clearing the current playlist image into a pane, and updates related event handling and drawing logic.
Add WebP decoding fallback and alpha/orientation handling for the compare pane. Introduces _viv_compare_webp_ctx_t, _viv_compare_webp_info_proc and _viv_compare_webp_frame_proc to decode WebP frames, convert RGBA->BGR, composite alpha against the configured window background, create an HBITMAP and set pane properties. Update GDI+ compositing to use SourceOver when images have alpha (based on image flags) and tighten the orientation check to >1. If GDI+ image loading fails, call webp_load(stream, ...) as a fallback.
Add drag-and-drop support for the compare window and a localized placeholder string. Introduce LOCALIZATION_ID_COMPARE_NO_IMAGE_DROP and provide English/Indonesian/Chinese translations. Use the localized text when no image is present. Enable file drops via WS_EX_ACCEPTFILES/DragAcceptFiles and implement WM_DROPFILES handling to accept one or two dropped files, load them into the appropriate compare panes, manage use_current/playlist state, and call DragFinish. Minor UI wiring in _viv_compare_proc and _viv_compare_show to accept and process dropped image files.
This commit expands the Compare Images window with drag-and-drop loading, per-pane "Use Current Image" toggles, synchronized zoom/pan controls, per-pane toolbars, and improved navigation options. It also adds WebP fallback decoding and proper alpha blending for transparent PNG/ICO/GIF images, and completes English, Indonesian, and Simplified Chinese localization for the new UI.
Bump product/version to 1.2.1.0 (nsis/version.nsh, res/voidImageViewer*.rc, src/version.h). Add a new LOCALIZATION_ID_SMOOTH and translations (src/localization.h, localization_en_us.h, localization_id_id.h, localization_zh_cn.h). Introduce VIV_ID_VIEW_SMOOTH and wire it into menus and context handling (src/viv.h, src/viv.c): menu entry, context menu id, toggle command that switches shrink blit mode and magnification filter, and menu check state. This provides a user-toggleable smoothing option for image scaling.
This release adds a Smooth (Halftone/Bilinear) toggle to the main viewer's View menu and context menu, with configuration persistence and compare-mode integration. It also introduces a side-by-side Compare Images mode with synchronized or independent zoom/pan, drag-and-drop support, and per-pane 'Use Current Image' toggles.
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.

3 participants