feat(background): persist viewport background across sessions (#188)
The BACKGROUND command set a per-tab colour that was lost on restart and didn't apply to new drawings, so there was no way to make a non-black background stick. Persist the chosen model/paper background in UserSettings (settings.txt) and re-apply it on launch and to every drawing tab created afterward. - settings.rs: persist `bg_color` / `paper_bg_color` as 0–255 RGB triplets. - App gains `default_bg_color` / `default_paper_bg_color`; current_settings / apply_settings round-trip them, and apply_settings pushes the restored colour onto existing tabs. New/opened/replaced tabs call `apply_bg_default`. - BACKGROUND updates the persisted default, saved centrally via persist_settings_if_changed; RESET clears it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f40144deac
commit
66fc30429c
4 changed files with 110 additions and 5 deletions
|
|
@ -245,6 +245,12 @@ pub(super) struct OpenCADStudio {
|
|||
dyn_input: bool,
|
||||
/// Controls whether the TEXTEDIT command repeats automatically (0 = Multiple, 1 = Single).
|
||||
pub texteditmode: bool,
|
||||
/// Persisted default viewport background, restored from settings and applied
|
||||
/// to every drawing tab (new and opened) so a chosen background survives
|
||||
/// restarts (#188). `None` = the built-in dark-grey / off-white defaults.
|
||||
/// The `a` channel is always 1.0.
|
||||
default_bg_color: Option<[f32; 4]>,
|
||||
default_paper_bg_color: Option<[f32; 4]>,
|
||||
/// `true` after a bare `VPORTS` in model space — the next command-line
|
||||
/// entry is treated as the tiled-config option (SIngle/2H/2V/4).
|
||||
awaiting_vports: bool,
|
||||
|
|
@ -1770,6 +1776,8 @@ impl OpenCADStudio {
|
|||
show_grid: false,
|
||||
dyn_input: true,
|
||||
texteditmode: false,
|
||||
default_bg_color: None,
|
||||
default_paper_bg_color: None,
|
||||
awaiting_vports: false,
|
||||
tile_drag: None,
|
||||
dyn_user_reshaped: false,
|
||||
|
|
|
|||
Loading…
Reference in a new issue