forked from 1b-agent/opencadstudio-upstream
Merge pull request #1330 from mechpanos/feat/right-click-menus
feat(ui): right-click context menus with command keywords, PLINE/ARC keyword parity, grip menu
This commit is contained in:
58 files changed
+6437
-538
No files matched your search
@@ -1,6 +1,6 @@
|
||||
pub(crate) mod spacemouse;
|
||||
use crate::app::config::UiThemeConfig;
|
||||
use crate::app::settings::CursorType;
|
||||
use crate::app::settings::{CursorType, RightClickMode};
|
||||
use crate::app::Message;
|
||||
use iced::widget::{
|
||||
button, column, container, row, scrollable, slider, text, text_input, Space,
|
||||
@@ -73,6 +73,10 @@ pub struct AppPrefs {
|
||||
pub show_ucs_icon: bool,
|
||||
/// UCSICON ORigin: draw it at the origin rather than the corner.
|
||||
pub ucs_icon_at_origin: bool,
|
||||
/// SHORTCUTMENU: what a right-click in the drawing area does.
|
||||
pub right_click_mode: RightClickMode,
|
||||
/// SHORTCUTMENUDURATION: time-sensitive hold threshold, ms.
|
||||
pub right_click_hold_ms: i32,
|
||||
}
|
||||
|
||||
/// The fixed locations the Files page lists.
|
||||
@@ -218,6 +222,18 @@ pub fn view_window<'a>(
|
||||
.find(|choice| choice.value == cursor_type)
|
||||
.cloned();
|
||||
|
||||
let right_click_options = RightClickMode::ALL
|
||||
.into_iter()
|
||||
.map(|value: RightClickMode| Labelled {
|
||||
label: crate::t!(value.label()).into_owned(),
|
||||
value,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let selected_right_click = right_click_options
|
||||
.iter()
|
||||
.find(|choice| choice.value == prefs.right_click_mode)
|
||||
.cloned();
|
||||
|
||||
let palette = ui_theme.palette.to_iced();
|
||||
let colors = [
|
||||
(crate::tr!("options", "color-background"), palette.background),
|
||||
@@ -1221,6 +1237,43 @@ pub fn view_window<'a>(
|
||||
.size(11)
|
||||
.width(sizing.width),
|
||||
Space::new().height(24),
|
||||
text(crate::t!("Right-click Customization")).size(15),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
text(crate::t!("Right-click in drawing area")).size(12).width(150),
|
||||
iced::widget::pick_list(
|
||||
selected_right_click,
|
||||
right_click_options,
|
||||
|choice| choice.label.clone(),
|
||||
)
|
||||
.on_select(|choice| Message::RightClickModeChanged(choice.value))
|
||||
.width(Fill),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(12),
|
||||
row![
|
||||
text(crate::t!("Hold duration")).size(12).width(150),
|
||||
slider(
|
||||
100..=1000,
|
||||
prefs.right_click_hold_ms.clamp(100, 1000),
|
||||
Message::RightClickHoldMsChanged
|
||||
)
|
||||
.step(50)
|
||||
.width(Fill),
|
||||
text(format!("{} ms", prefs.right_click_hold_ms.clamp(100, 1000)))
|
||||
.size(11)
|
||||
.width(52),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(iced::Center),
|
||||
Space::new().height(6),
|
||||
text(crate::t!(
|
||||
"Shortcut menu: right-click always opens the menu. Time-sensitive: a quick click is Enter, holding longer opens the menu (SHORTCUTMENUDURATION)."
|
||||
))
|
||||
.size(11)
|
||||
.width(sizing.width),
|
||||
Space::new().height(24),
|
||||
text(crate::t!("Block Edit")).size(15),
|
||||
Space::new().height(10),
|
||||
row![
|
||||
|
||||
Reference in new issue
Block a user