Skip to content

feat: add view mode buttons to the studio toolbar - #7

Open
bero wants to merge 1 commit into
GDKsoftware:mainfrom
bero:feature/view-mode-toolbar-buttons
Open

bero wants to merge 1 commit into
GDKsoftware:mainfrom
bero:feature/view-mode-toolbar-buttons

Conversation

@bero

@bero bero commented Sep 16, 2026

Copy link
Copy Markdown

I found this repository and decided to try it as I searched for a Delphi implementation of Markdown editor.
Generally it looks good but found some things I want to change. These a separated in PR's.

What

Adds three toolbar buttons to the VCL studio example for switching the view mode: Editor only, Split view and Preview only.

The modes themselves already existed, reachable through Ctrl+1 / Ctrl+2 / Ctrl+3 and the command palette. This only puts them on the toolbar, between the formatting group and the theme button.

How

The three buttons share a GroupIndex and leave AllowAllUp at False, so the VCL keeps exactly one of them pressed: clicking one releases the other two, and clicking the active one leaves it down.

ApplyViewMode calls the new UpdateViewModeButtons, so the pressed button stays correct no matter how the mode was changed. That covers the toolbar, the keyboard shortcuts, the command palette, session restore on startup and leaving zen mode.

Glyph and hint constants live in Examples/Shared/Markdown4DStudio.Defines.pas next to the existing toolbar glyphs. The chosen code points (E70F pencil, E89A two page, E890 eye) are present in both Segoe Fluent Icons and the Segoe MDL2 Assets fallback, which matters because ResolveIconFontName falls back to MDL2 on machines without the Fluent font.

Scope

VCL example only. The shared defines change is additive, so the FMX studio is unaffected; it could adopt the same buttons in a follow-up.

Testing

  • Both Markdown4DStudioVCL and Markdown4DStudioFMX build clean on Win32 Debug with Delphi 12 Athens.
  • Ran the VCL studio and confirmed all three glyphs render and that exactly one button is pressed across Ctrl+1 / Ctrl+2 / Ctrl+3 and across toolbar clicks.
  • Cycled the modes through 18 consecutive transitions covering every ordered pair, checking the pane layout after each one.

Add Editor only, Split view and Preview only buttons to the VCL studio
toolbar. The three buttons share a GroupIndex and leave AllowAllUp false,
so the VCL keeps exactly one of them pressed.

ApplyViewMode now syncs the pressed button, so it also follows the other
ways the mode can change: Ctrl+1/2/3, the command palette, session restore
and leaving zen mode.

Glyph and hint constants go in the shared defines unit next to the existing
toolbar glyphs. The code points are present in both Segoe Fluent Icons and
the Segoe MDL2 Assets fallback.
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