forked from 1b-agent/opencadstudio-upstream
Put text fill and the command-line preferences on the Display page
Three settings that work, persist, and could only be reached by typing their name: TEXTFILL, CLIPROMPTLINES and COMMANDLINEFADETIME. The last two govern how much of the command window is prompt and how long its history lingers — the kind of thing people fiddle with once and then leave, which is exactly what a settings dialog is for. One fix rides along. TEXTFILL is a process-global, so changing it invalidates the text in every open drawing; the SETVAR path rebuilt only the active tab, leaving the others rendering the previous setting until an unrelated edit happened to rebuild them. Both paths now go through `invalidate_text_everywhere`, so the checkbox and the command cannot disagree. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
ec8d733857
commit
a0027a8977
6 files changed
+119
-3
No files matched your search
@@ -2184,9 +2184,7 @@ impl OpenCADStudio {
|
||||
// TEXTFILL reset the glyph atlas; re-tessellate so text picks
|
||||
// up the re-baked filled / hollow tiles.
|
||||
if name == "TEXTFILL" {
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.invalidate_text_geometry_dependencies();
|
||||
self.invalidate_text_everywhere();
|
||||
}
|
||||
// LTSCALE scales the dash pattern baked into every wire, and
|
||||
// PDMODE / PDSIZE decide the point glyph built at tessellation
|
||||
|
||||
@@ -2011,6 +2011,12 @@ pub enum Message {
|
||||
SaveTimeChanged(i32),
|
||||
/// Toggle keeping a `.bak` copy when overwriting a drawing (ISAVEBAK).
|
||||
BackupOnSaveChanged(bool),
|
||||
/// Toggle filled TrueType glyphs (TEXTFILL).
|
||||
TextFillChanged(bool),
|
||||
/// Change how many prompt lines sit above the command window (CLIPROMPTLINES).
|
||||
ClipromptLinesChanged(i32),
|
||||
/// Change how long command-line history lines stay visible (COMMANDLINEFADETIME).
|
||||
CommandLineFadeChanged(i32),
|
||||
/// Restore Model Space display/canvas appearance to defaults.
|
||||
RestoreModelSpaceDisplayDefaults,
|
||||
/// Restore Selection visual effect settings to defaults.
|
||||
|
||||
@@ -355,6 +355,17 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
/// Rebuild text geometry in every open drawing.
|
||||
///
|
||||
/// `TEXTFILL` is a process-global, so a change to it invalidates the text
|
||||
/// in every tab. Doing only the active one leaves the others rendering the
|
||||
/// previous setting until some unrelated edit happens to rebuild them.
|
||||
pub(in crate::app) fn invalidate_text_everywhere(&mut self) {
|
||||
for tab in &mut self.tabs {
|
||||
tab.scene.invalidate_text_geometry_dependencies();
|
||||
}
|
||||
}
|
||||
|
||||
/// Snapshot the persisted UI preferences from live state.
|
||||
pub(in crate::app) fn current_settings(&self) -> crate::app::settings::UserSettings {
|
||||
crate::app::settings::UserSettings {
|
||||
|
||||
@@ -6200,6 +6200,29 @@ impl OpenCADStudio {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::TextFillChanged(filled) => {
|
||||
crate::scene::text::sdf_atlas::set_textfill(filled);
|
||||
self.invalidate_text_everywhere();
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::ClipromptLinesChanged(lines) => {
|
||||
let lines = crate::app::settings::clamp_clipromptlines(lines);
|
||||
self.cliprompt_lines = lines;
|
||||
self.command_line.set_cliprompt_lines(lines.clamp(0, 50) as u8);
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::CommandLineFadeChanged(ms) => {
|
||||
let ms = crate::app::settings::clamp_commandline_fade_ms(ms);
|
||||
self.commandline_fade_ms = ms;
|
||||
self.command_line.set_commandline_fade_ms(ms.max(0) as u32);
|
||||
self.persist_settings_if_changed();
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::PickDragRectToggled(rectangle) => {
|
||||
self.pick_drag_rect = rectangle;
|
||||
self.persist_settings_if_changed();
|
||||
|
||||
@@ -195,6 +195,9 @@ impl OpenCADStudio {
|
||||
crate::ui::window::options::AppPrefs {
|
||||
savetime_min: self.savetime_min,
|
||||
backup_on_save: self.backup_on_save,
|
||||
textfill: crate::scene::text::sdf_atlas::textfill(),
|
||||
cliprompt_lines: self.cliprompt_lines,
|
||||
commandline_fade_ms: self.commandline_fade_ms,
|
||||
},
|
||||
self.double_click_block_refedit,
|
||||
self.double_click_block_attedit,
|
||||
|
||||
Reference in new issue
Block a user