forked from 1b-agent/opencadstudio-upstream
Put the rest of the selection settings on the Options card
Options → Selection already carried the pick box, the selection-area effect and the grip visuals. Four settings behind it were finished, persisted and reachable only by typing a system variable, and one more was a constant. **Four that only needed a widget.** `SELECTIONEFFECT`, `SELECTIONPREVIEW`, `PICKADD` and `PICKDRAG` are all wired end to end already. `SELECTIONEFFECT` was the odd one: the card's own "Restore Defaults" button resets it, so it could be turned off by a button and only turned back on from the command line. `SELECTIONPREVIEW` is a bitmask and gets one checkbox per bit, which is why `set_preview_bit` exists rather than two inline expressions — the bits are the thing this change is most able to get backwards. The `PICKADD` checkbox is worded as AutoCAD words it, "use Shift to add to selection", which is the *inverse* of the stored flag. That inversion is commented at both ends; it reads as a bug otherwise. **`GRIPOBJLIMIT`.** The limit past which a selection gets no grips arrived with the selection work as a hardcoded 100, matching AutoCAD's default. It is now a setting, a slider and a system variable, following `PICKBOX`'s path exactly. AutoCAD's 0 means "no limit", which the old `>` comparison could not express, so the read now guards on it — with a test, because zero is the one value that would otherwise suppress every grip instead of allowing all of them. The slider covers 0..=1000, where every useful value lives; the sysvar takes AutoCAD's full 0..=32767, and a larger value set from the command line parks the handle at the end while the read-out keeps showing the real number. **`SelectionPrefs`** replaces the `pick_box` parameter rather than adding three more. `view_window` already took seventeen positional arguments, and `pick_add` / `pick_drag_rect` are two adjacent `bool`s that would swap silently at the call site. **Two fixes found on the way.** `OPTIONS` and `OP` were registered for autocomplete but never dispatched, so typing either answered "Unknown command" and the dialog could only be opened from the start page. And the `SELECTIONPREVIEW` doc comment had its bits the wrong way round — the code reads `& 1` for the idle rollover and `& 2` for the in-command one, as AutoCAD does — which would have put the two new checkboxes' labels backwards. **Not done, deliberately.** `PICKFIRST` and `PICKAUTO` exist but are always on, with no variable. `PICKSTYLE` is stored in the header and read by nobody — group expansion decides from the group's own `selectable` flag — so an "object grouping" checkbox would control nothing. Associative-hatch selection does not exist as a selection behaviour. Each needs a behaviour change rather than an exposure. Of the ten new strings, en-US and el-GR are translated; the other nineteen locales carry the English text. Composing them from existing keys, the way el-GR composes the neighbouring labels, only works for one of the ten — there is no existing key for "limit", "unlimited", "shift", "rectangle" or "lasso", and "Grips: Objects" as the label of a numeric limit would be worse than an untranslated string. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
f9cacaec2b
commit
cabb20db45
33 files changed
+585
-37
No files matched your search
@@ -294,6 +294,10 @@ pub fn start_allowed(cmd: &str) -> bool {
|
||||
| "ALIASEDIT"
|
||||
| "CUILOAD"
|
||||
| "CUIIMPORT"
|
||||
// The start page already offers Options as a button, so the
|
||||
// command that opens the same dialog belongs here too.
|
||||
| "OPTIONS"
|
||||
| "OP"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -548,6 +552,7 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
"GRIPCOLOR",
|
||||
"GRIPHOT",
|
||||
"GRIPHOVER",
|
||||
"GRIPOBJLIMIT",
|
||||
// Reset selected entities' overrides to follow their layer.
|
||||
"SETBYLAYER",
|
||||
// Remove duplicate objects; set drawing base point; audit integrity;
|
||||
|
||||
@@ -918,6 +918,7 @@ impl OpenCADStudio {
|
||||
| "GRIPCOLOR"
|
||||
| "GRIPHOT"
|
||||
| "GRIPHOVER"
|
||||
| "GRIPOBJLIMIT"
|
||||
) =>
|
||||
{
|
||||
return self.dispatch_styleprops(&format!("SETVAR {cmd}"), i);
|
||||
@@ -940,7 +941,7 @@ impl OpenCADStudio {
|
||||
let value = it.next().map(|s| s.trim().to_string());
|
||||
if name.is_empty() || name == "?" {
|
||||
self.command_line.push_info(
|
||||
crate::t!("SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG TEXTFILL CLIPROMPTLINES COMMANDLINEFADETIME ATTREQ ATTDIA DIMASSOC DIMCONTINUEMODE ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE DONUTID DONUTOD CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE CENTERCROSSSIZE CENTERCROSSGAP CENTERMARKEXE COLORTHEME SELECTIONAREA SELECTIONAREAOPACITY SELECTIONEFFECT SELECTIONEFFECTCOLOR WINDOWSAREACOLOR CROSSINGAREACOLOR SELECTIONPREVIEW GRIPSIZE GRIPCOLOR GRIPHOT GRIPHOVER | CLAYER CELTYPE TEXTSTYLE (read-only)").as_ref(),
|
||||
crate::t!("SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG TEXTFILL CLIPROMPTLINES COMMANDLINEFADETIME ATTREQ ATTDIA DIMASSOC DIMCONTINUEMODE ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE DONUTID DONUTOD CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE CENTERCROSSSIZE CENTERCROSSGAP CENTERMARKEXE COLORTHEME SELECTIONAREA SELECTIONAREAOPACITY SELECTIONEFFECT SELECTIONEFFECTCOLOR WINDOWSAREACOLOR CROSSINGAREACOLOR SELECTIONPREVIEW GRIPSIZE GRIPCOLOR GRIPHOT GRIPHOVER GRIPOBJLIMIT | CLAYER CELTYPE TEXTSTYLE (read-only)").as_ref(),
|
||||
);
|
||||
} else {
|
||||
if matches!(name.as_str(), "SHOWHIST" | "SOLIDHIST") {
|
||||
@@ -1444,6 +1445,22 @@ impl OpenCADStudio {
|
||||
},
|
||||
None => Ok((format!("GRIPSIZE = {}", self.model_space.grip_size), false)),
|
||||
},
|
||||
"GRIPOBJLIMIT" => match &value {
|
||||
Some(v) => match v.parse::<i32>() {
|
||||
Ok(limit @ 0..=32767) => {
|
||||
self.grip_object_limit = limit;
|
||||
Ok((format!("GRIPOBJLIMIT = {limit}"), true))
|
||||
}
|
||||
_ => Err(
|
||||
"SETVAR: integer from 0 to 32767 required (0 = no limit)."
|
||||
.into(),
|
||||
),
|
||||
},
|
||||
None => Ok((
|
||||
format!("GRIPOBJLIMIT = {}", self.grip_object_limit),
|
||||
false,
|
||||
)),
|
||||
},
|
||||
"GRIPCOLOR" => match &value {
|
||||
Some(v) => match v.parse::<u8>() {
|
||||
Ok(color) => {
|
||||
@@ -2126,6 +2143,7 @@ impl OpenCADStudio {
|
||||
| "GRIPCOLOR"
|
||||
| "GRIPHOT"
|
||||
| "GRIPHOVER"
|
||||
| "GRIPOBJLIMIT"
|
||||
) {
|
||||
self.persist_settings_if_changed();
|
||||
} else {
|
||||
|
||||
@@ -245,6 +245,14 @@ impl OpenCADStudio {
|
||||
return Some(Task::done(Message::ShortcutsPanelOpen));
|
||||
}
|
||||
|
||||
// ── OPTIONS / OP — the preferences dialog ──────────────────────
|
||||
// Both names were registered for autocomplete but never dispatched,
|
||||
// so typing either one answered "Unknown command" and the dialog
|
||||
// could only be reached from the button on the start page.
|
||||
"OPTIONS" | "OP" => {
|
||||
return Some(Task::done(Message::OptionsOpen));
|
||||
}
|
||||
|
||||
// CUIEXPORT <path> — write the keyboard-shortcut customizations
|
||||
// (the drawing-independent CUI data) to a plain "KEY COMMAND" file.
|
||||
"CUIEXPORT" => {
|
||||
|
||||
Reference in new issue
Block a user