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
+115
-3
@@ -15,6 +15,24 @@ pub enum OptionsTab {
|
||||
Selection,
|
||||
}
|
||||
|
||||
/// The Selection-card settings that live on `UserSettings` rather than on the
|
||||
/// model-space theme.
|
||||
///
|
||||
/// Gathered into one value instead of four more positional parameters: the
|
||||
/// function already takes seventeen, and `pick_add` / `pick_drag_rect` are two
|
||||
/// adjacent `bool`s that would swap silently at the call site.
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct SelectionPrefs {
|
||||
/// PICKBOX, 0..=50.
|
||||
pub pick_box: i32,
|
||||
/// PICKADD: true = a click adds to the selection.
|
||||
pub pick_add: bool,
|
||||
/// PICKDRAG: true = press-drag draws a rectangle instead of a lasso.
|
||||
pub pick_drag_rect: bool,
|
||||
/// GRIPOBJLIMIT, 0..=32767; 0 = no limit.
|
||||
pub grip_object_limit: i32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
struct Labelled<T> {
|
||||
value: T,
|
||||
@@ -36,7 +54,7 @@ pub fn view_window<'a>(
|
||||
language: crate::i18n::Language,
|
||||
active_tab: OptionsTab,
|
||||
cursor_size: i32,
|
||||
pick_box: i32,
|
||||
selection: SelectionPrefs,
|
||||
cursor_type: CursorType,
|
||||
crosshair_color: Option<[u8; 3]>,
|
||||
crosshair_color_input: &'a str,
|
||||
@@ -544,10 +562,12 @@ pub fn view_window<'a>(
|
||||
Space::new().height(10),
|
||||
row![
|
||||
text(crate::t!("Pick box size")).size(12).width(140),
|
||||
slider(0..=50, pick_box.clamp(0, 50), Message::PickBoxChanged)
|
||||
slider(0..=50, selection.pick_box.clamp(0, 50), Message::PickBoxChanged)
|
||||
.step(1)
|
||||
.width(Fill),
|
||||
text(pick_box.clamp(0, 50).to_string()).size(11).width(44),
|
||||
text(selection.pick_box.clamp(0, 50).to_string())
|
||||
.size(11)
|
||||
.width(44),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
@@ -558,6 +578,31 @@ pub fn view_window<'a>(
|
||||
.size(11)
|
||||
.width(sizing.width),
|
||||
Space::new().height(24),
|
||||
text(crate::t!("Selection Modes")).size(15),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
// Worded the way AutoCAD words it, which is the inverse of PICKADD:
|
||||
// ticked means a plain click replaces the selection and Shift adds.
|
||||
iced::widget::checkbox(!selection.pick_add)
|
||||
.on_toggle(Message::ShiftToAddToggled)
|
||||
.size(15),
|
||||
text(crate::t!("Use Shift to add to selection (PICKADD)")).size(12),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
iced::widget::checkbox(selection.pick_drag_rect)
|
||||
.on_toggle(Message::PickDragRectToggled)
|
||||
.size(15),
|
||||
text(crate::t!(
|
||||
"Press and drag draws a rectangle instead of a lasso (PICKDRAG)"
|
||||
))
|
||||
.size(12),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(24),
|
||||
row![
|
||||
text(crate::t!("Visual Effect Settings")).size(15),
|
||||
Space::new().width(Fill),
|
||||
@@ -626,6 +671,15 @@ pub fn view_window<'a>(
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
iced::widget::checkbox(model_space.selection_effect)
|
||||
.on_toggle(Message::SelectionEffectToggled)
|
||||
.size(15),
|
||||
text(crate::t!("Show selection effect (SELECTIONEFFECT)")).size(12),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
text(crate::t!("Selection highlight color")).size(12).width(140),
|
||||
iced::widget::pick_list(
|
||||
@@ -639,6 +693,34 @@ pub fn view_window<'a>(
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(24),
|
||||
text(crate::t!("Preview")).size(15),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
// SELECTIONPREVIEW is a bitmask; bit 1 is the idle rollover and
|
||||
// bit 2 the one that runs while a command is gathering objects.
|
||||
iced::widget::checkbox(model_space.selection_preview & 1 != 0)
|
||||
.on_toggle(Message::SelectionPreviewIdleToggled)
|
||||
.size(15),
|
||||
text(crate::t!("Preview selection when no command is active")).size(12),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
iced::widget::checkbox(model_space.selection_preview & 2 != 0)
|
||||
.on_toggle(Message::SelectionPreviewCommandToggled)
|
||||
.size(15),
|
||||
text(crate::t!("Preview selection during a command")).size(12),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(6),
|
||||
text(crate::t!(
|
||||
"Highlights the object under the cursor before it is picked (SELECTIONPREVIEW)."
|
||||
))
|
||||
.size(11)
|
||||
.width(sizing.width),
|
||||
Space::new().height(24),
|
||||
text(crate::t!("Grip Settings")).size(15),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
@@ -657,6 +739,36 @@ pub fn view_window<'a>(
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
text(crate::t!("Object limit for grips")).size(12).width(140),
|
||||
// The slider covers the range where the setting is worth changing;
|
||||
// the sysvar accepts AutoCAD's full 0..=32767, so a larger value
|
||||
// set from the command line parks the handle at the end while the
|
||||
// read-out keeps showing the real number.
|
||||
slider(
|
||||
0..=1000,
|
||||
selection.grip_object_limit.clamp(0, 1000),
|
||||
Message::GripObjectLimitChanged,
|
||||
)
|
||||
.step(1)
|
||||
.width(Fill),
|
||||
text(if selection.grip_object_limit == 0 {
|
||||
crate::t!("Unlimited").into_owned()
|
||||
} else {
|
||||
selection.grip_object_limit.to_string()
|
||||
})
|
||||
.size(11)
|
||||
.width(44),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(6),
|
||||
text(crate::t!(
|
||||
"Past this many selected objects no grips are drawn; 0 removes the limit (GRIPOBJLIMIT)."
|
||||
))
|
||||
.size(11)
|
||||
.width(sizing.width),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
text(crate::t!("Unselected grip color")).size(12).width(140),
|
||||
iced::widget::pick_list(
|
||||
|
||||
Reference in new issue
Block a user