* claim: #10223 * Quick-access bar: pin ribbon commands to the application bar (#10223) A command's menu (a ribbon button, a section drop-down row or a command search result) has Add to Quick Access: the command's own icon joins the application bar after Save, Undo and Redo. A click starts it as its ribbon button does, a drag along the bar reorders the buttons, and the button's menu has Remove from Quick Access. Empty, and so not drawn, by default; it holds up to 24 commands. The list is kept with the toolbar's customisations (`quick_access` in the toolbar's saved document), so it is saved, exported with the keyboard shortcuts and carried by settings profiles. * Quick access: a pinned family variant no longer replaces the ribbon choice A quick-access click now starts the pinned command with start_pinned, so it starts exactly that command and leaves the sketch family remembered choice (the main ribbon button) unchanged.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"en": {
|
||||
"ui.addToQuickAccess": "Add to Quick Access",
|
||||
"ui.quick_access_full": "The quick-access bar holds {count} commands; remove one to add another",
|
||||
"ui.removeFromQuickAccess": "Remove from Quick Access"
|
||||
},
|
||||
"ar": {
|
||||
"ui.addToQuickAccess": "إضافة إلى الوصول السريع",
|
||||
"ui.quick_access_full": "يتسع شريط الوصول السريع لـ {count} أمرًا؛ أزل أحدها لإضافة آخر",
|
||||
"ui.removeFromQuickAccess": "إزالة من الوصول السريع"
|
||||
},
|
||||
"he": {
|
||||
"ui.addToQuickAccess": "הוספה לגישה מהירה",
|
||||
"ui.quick_access_full": "סרגל הגישה המהירה מכיל {count} פקודות; יש להסיר אחת כדי להוסיף אחרת",
|
||||
"ui.removeFromQuickAccess": "הסרה מהגישה המהירה"
|
||||
},
|
||||
"ja": {
|
||||
"ui.addToQuickAccess": "クイックアクセスに追加",
|
||||
"ui.quick_access_full": "クイックアクセスバーに置けるコマンドは {count} 個までです。追加するには 1 つ削除してください",
|
||||
"ui.removeFromQuickAccess": "クイックアクセスから削除"
|
||||
},
|
||||
"vi": {
|
||||
"ui.addToQuickAccess": "Thêm vào Truy cập nhanh",
|
||||
"ui.quick_access_full": "Thanh truy cập nhanh chứa tối đa {count} lệnh; hãy gỡ một lệnh để thêm lệnh khác",
|
||||
"ui.removeFromQuickAccess": "Gỡ khỏi Truy cập nhanh"
|
||||
},
|
||||
"zh": {
|
||||
"ui.addToQuickAccess": "添加到快速访问",
|
||||
"ui.quick_access_full": "快速访问栏最多容纳 {count} 个命令;请先移除一个再添加",
|
||||
"ui.removeFromQuickAccess": "从快速访问中移除"
|
||||
}
|
||||
}
|
||||
@@ -1705,9 +1705,14 @@ pub fn run_item(app: &mut SolveApp, item: &Item, at: Pos2) {
|
||||
let _ = app.run("browser.visibility", json!({"visible": true, "paths": [p["path"]], "isolate": true}));
|
||||
}
|
||||
"ui.canvasVisible" => drop(app.run("canvas.edit", p)),
|
||||
"ui.toolbarPin" | "ui.toolbarRemove" | "ui.toolbarReset" | "ui.toolbarCustomize" | "ui.toolbarTab" | "ui.shortcutPin" => {
|
||||
crate::toolbar_custom::run(app, &item.id, &p)
|
||||
}
|
||||
"ui.toolbarPin"
|
||||
| "ui.toolbarRemove"
|
||||
| "ui.toolbarReset"
|
||||
| "ui.toolbarCustomize"
|
||||
| "ui.toolbarTab"
|
||||
| "ui.shortcutPin"
|
||||
| "ui.quickAccessAdd"
|
||||
| "ui.quickAccessRemove" => crate::toolbar_custom::run(app, &item.id, &p),
|
||||
"ui.navigatorStyle" => {
|
||||
if let Some(style) = p.get("style").and_then(|s| serde_json::from_value(s.clone()).ok()) {
|
||||
crate::view_gizmo::pick_style(app, style);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//! Settings profiles (#6237): the input and interface settings kept together under a name, such
|
||||
//! as "Laptop" and "Large monitor", and switched at once. A profile holds the original Interface,
|
||||
//! Navigation and Sketch preference keys and the language, keyboard shortcuts, toolbar,
|
||||
//! S box favourites, imported theme it uses, and the custom view navigator's texture, arrows and
|
||||
//! Home, and its body (when one is chosen; a profile without one leaves the current body alone). Page moves preserve that stored
|
||||
//! key set; device-specific 3D mouse keys, graphics, recent files and Assistant settings stay out.
|
||||
//! Navigation and Sketch preference keys and the language, keyboard shortcuts, toolbar (with its
|
||||
//! quick-access bar), S box favourites, imported theme it uses, and the custom view navigator's
|
||||
//! texture, arrows and Home, and its body (when one is chosen; a profile without one leaves the
|
||||
//! current body alone). Page moves preserve that stored key set; device-specific 3D mouse keys,
|
||||
//! graphics, recent files and Assistant settings stay out.
|
||||
//!
|
||||
//! A profile is kept, exported and imported as one `solidcraft-profile/1` document. Every
|
||||
//! document is checked by [`sanitize`] first: unknown keys are dropped, sizes are capped, and a
|
||||
|
||||
@@ -96,6 +96,30 @@ fn switching_profiles_applies_every_setting_at_once() {
|
||||
assert!(error(&mut h, "settings.profile.apply", json!({"name": "Desk"})).contains("no settings profile"));
|
||||
}
|
||||
|
||||
/// The quick-access bar (#10223) travels with the toolbar: a profile captures it, survives its
|
||||
/// checks, and switching profiles brings each one's bar back.
|
||||
#[test]
|
||||
fn a_profile_carries_the_quick_access_bar() {
|
||||
let mut h = Harness::new();
|
||||
run(&mut h, "settings.profile.save", json!({"name": "Plain"}));
|
||||
crate::toolbar_custom::quick_add(&mut h.app, "solid.fillet").unwrap();
|
||||
crate::toolbar_custom::quick_add(&mut h.app, "solid.extrude").unwrap();
|
||||
let doc = capture(&h.app, "Quick");
|
||||
assert_eq!(doc["toolbar"]["quick_access"], json!(["solid.fillet", "solid.extrude"]));
|
||||
assert_eq!(sanitize(&doc).unwrap(), doc);
|
||||
run(&mut h, "settings.profile.save", json!({"name": "Quick"}));
|
||||
|
||||
run(&mut h, "settings.profile.apply", json!({"name": "Plain"}));
|
||||
assert!(h.app.toolbar_custom.quick_access.is_empty());
|
||||
run(&mut h, "settings.profile.apply", json!({"name": "Quick"}));
|
||||
assert_eq!(h.app.toolbar_custom.quick_access, ["solid.fillet", "solid.extrude"]);
|
||||
|
||||
// A hostile list is cut down to what the bar holds.
|
||||
let hostile = json!({"format": FORMAT, "name": "Odd", "toolbar": {"version": 3, "quick_access": (0..500).map(|i| json!(format!("c{i}"))).chain([json!(3)]).collect::<Vec<_>>()}});
|
||||
let doc = sanitize(&hostile).unwrap();
|
||||
assert_eq!(doc["toolbar"]["quick_access"].as_array().map(Vec::len), Some(crate::toolbar_custom::MAX_QUICK_ACCESS));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rename_and_delete_follow_the_active_profile() {
|
||||
let mut h = Harness::new();
|
||||
|
||||
@@ -506,6 +506,7 @@ pub fn app_bar(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
FileAction::Redo.run(app);
|
||||
}
|
||||
x += step;
|
||||
x = quick_access_bar(app, ui, r, x, step, shown);
|
||||
}
|
||||
if file {
|
||||
app.ui.palette_open = false;
|
||||
@@ -2272,6 +2273,84 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
/// A quick-access button being dragged along the bar (#10223).
|
||||
#[derive(Clone)]
|
||||
struct QuickAccessDrag(String);
|
||||
|
||||
/// The quick-access bar (#10223): the commands added from a command's menu, after Save, Undo and
|
||||
/// Redo, each with its own icon. A click starts the command as its ribbon button does, a
|
||||
/// right-click opens the command's menu (Remove from Quick Access), and a drag along the bar
|
||||
/// reorders the buttons. Draws nothing while it is empty. Returns where the next control goes.
|
||||
fn quick_access_bar(app: &mut SolveApp, ui: &mut egui::Ui, bar: Rect, mut x: f32, step: f32, shown: bool) -> f32 {
|
||||
let t = Tokens::get();
|
||||
let ids: Vec<&'static solidcraft_engine::CommandSpec> =
|
||||
app.toolbar_custom.quick_access.iter().filter_map(|id| solidcraft_engine::find_command(id)).collect();
|
||||
if ids.is_empty() {
|
||||
return x;
|
||||
}
|
||||
app_bar_separator(ui, bar, x - step / 2.0 + 8.0, "quick_access");
|
||||
x += 8.0;
|
||||
let first = x;
|
||||
let mut buttons = Vec::with_capacity(ids.len());
|
||||
let mut start = None;
|
||||
let mut menu = None;
|
||||
for c in &ids {
|
||||
let br = Rect::from_center_size(pos2(x, bar.center().y), vec2(32.0, 32.0));
|
||||
x += step;
|
||||
let info = c.info(&app.session);
|
||||
let enabled = shown && info.enabled;
|
||||
let resp = ui.interact(br, ui.id().with(("quick_access", c.id)), Sense::click_and_drag());
|
||||
let label = app.tr_label(info.label).to_string();
|
||||
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, enabled, &label));
|
||||
crate::scenario::publish_target(&format!("appbar:quick:{}", c.id), br);
|
||||
if enabled && (resp.hovered() || resp.has_focus()) {
|
||||
ui.painter().rect_filled(br.shrink(3.0), t.radius_sm, t.app_bar_hover_button);
|
||||
}
|
||||
icons::paint_on(ui.painter(), Rect::from_center_size(br.center(), vec2(20.0, 20.0)), info.icon, Some(true), if enabled { 1.0 } else { 0.35 });
|
||||
if resp.drag_started() {
|
||||
egui::DragAndDrop::set_payload(ui.ctx(), QuickAccessDrag(c.id.to_string()));
|
||||
}
|
||||
if resp.secondary_clicked() {
|
||||
menu = Some((resp.interact_pointer_pos().unwrap_or(br.left_bottom()), c.id));
|
||||
}
|
||||
let tip = match crate::keymap::display_for(app, c.id) {
|
||||
Some(key) if !key.is_empty() => format!("{label} ({key})"),
|
||||
_ => label.clone(),
|
||||
};
|
||||
let tip = if shown { tip } else { crate::i18n::format("ui.needs_design", &[("command", &label)]) };
|
||||
if resp.on_hover_text(tip).clicked() && enabled {
|
||||
start = Some((c.id, br));
|
||||
}
|
||||
buttons.push((c.id, br));
|
||||
}
|
||||
let span = Rect::from_min_max(pos2(first - step / 2.0, bar.top()), pos2(x - step / 2.0, bar.bottom()));
|
||||
crate::scenario::publish_rect("appbar:quick_access", span);
|
||||
// Dragged along the bar: the line shows where it goes; let go and it moves there.
|
||||
if let Some(drag) = egui::DragAndDrop::payload::<QuickAccessDrag>(ui.ctx())
|
||||
&& let Some(p) = ui.input(|i| i.pointer.latest_pos())
|
||||
{
|
||||
let before = buttons.iter().find(|(_, br)| p.x < br.center().x).map(|(id, _)| *id);
|
||||
let line = before.and_then(|b| buttons.iter().find(|(id, _)| *id == b)).map_or(span.right(), |(_, br)| br.left());
|
||||
if span.expand2(vec2(step, 0.0)).contains(p) {
|
||||
ui_kit::insertion_marker(ui.painter(), line, bar.top() + 6.0, bar.bottom() - 6.0);
|
||||
}
|
||||
if ui.input(|i| i.pointer.any_released()) {
|
||||
egui::DragAndDrop::clear_payload(ui.ctx());
|
||||
if span.expand2(vec2(step, 0.0)).contains(p) {
|
||||
crate::toolbar_custom::quick_move(app, &drag.0, before);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some((id, br)) = start {
|
||||
// The exact pinned command, without replacing its family's remembered ribbon choice.
|
||||
app.start_pinned(id, Some(br));
|
||||
}
|
||||
if let Some((at, id)) = menu {
|
||||
crate::context_menu::open_for(app, at, crate::context_menu::Target::ToolbarCommand { id: id.to_string() });
|
||||
}
|
||||
x
|
||||
}
|
||||
|
||||
/// A short divider between the brand, file actions and document tabs.
|
||||
fn app_bar_separator(ui: &egui::Ui, bar: Rect, x: f32, group: &str) {
|
||||
let rect = Rect::from_center_size(pos2(x, bar.center().y), vec2(1.0, 20.0));
|
||||
@@ -6424,3 +6503,102 @@ mod persistent_ribbon_tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod quick_access_tests {
|
||||
use crate::scenario::{Harness, handle_at, rect_of};
|
||||
use serde_json::json;
|
||||
|
||||
fn pick(h: &mut Harness, handle: &str, item: &str) {
|
||||
h.frames(3);
|
||||
h.step(&json!({"click":{"handle": handle},"button":"right"})).unwrap();
|
||||
h.frames(3);
|
||||
assert!(h.app.viewport.context_menu.is_some(), "{handle}: the right-click opens the command's menu");
|
||||
h.step(&json!({"widget": item})).unwrap_or_else(|e| panic!("{handle}: {item}: {e}"));
|
||||
h.frames(3);
|
||||
}
|
||||
|
||||
/// The quick-access bar (#10223) is empty and not drawn by default; a ribbon button's menu
|
||||
/// adds its command after Save, Undo and Redo, a drag along the bar reorders the buttons, a
|
||||
/// click starts the command, and the button's own menu removes it. The list is kept with the
|
||||
/// toolbar's saved customisations.
|
||||
#[test]
|
||||
fn ribbon_commands_are_added_reordered_started_and_removed_from_the_quick_access_bar() {
|
||||
let mut h = Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.call("ui.resize", json!({"width":1600,"height":1000}));
|
||||
h.frames(3);
|
||||
assert!(h.app.toolbar_custom.quick_access.is_empty(), "empty by default");
|
||||
assert!(rect_of("appbar:quick_access").is_none(), "and not drawn");
|
||||
|
||||
pick(&mut h, "button:solid.extrude", "Add to Quick Access");
|
||||
pick(&mut h, "button:solid.fillet", "Add to Quick Access");
|
||||
assert_eq!(h.app.toolbar_custom.quick_access, ["solid.extrude", "solid.fillet"]);
|
||||
h.frames(2);
|
||||
let bar = rect_of("appbar:quick_access").unwrap();
|
||||
let redo = rect_of("appbar:redo").unwrap();
|
||||
assert!(bar.left() >= redo.right() && bar.center().y == redo.center().y, "after Redo: {bar:?} {redo:?}");
|
||||
let extrude = handle_at("appbar:quick:solid.extrude").unwrap();
|
||||
let fillet = handle_at("appbar:quick:solid.fillet").unwrap();
|
||||
assert!(extrude.x < fillet.x, "in the order they were added");
|
||||
|
||||
// Dragged before Extrude, Fillet comes first.
|
||||
h.step(&json!({"drag": [[fillet.x, fillet.y], [extrude.x - 10.0, extrude.y]]})).unwrap();
|
||||
h.frames(3);
|
||||
assert_eq!(h.app.toolbar_custom.quick_access, ["solid.fillet", "solid.extrude"]);
|
||||
|
||||
// Saved with the toolbar and read back.
|
||||
let saved = h.app.toolbar_custom.prefs();
|
||||
let mut reloaded = crate::toolbar_custom::ToolbarCustom::default();
|
||||
reloaded.load(&saved);
|
||||
assert_eq!(reloaded.quick_access, ["solid.fillet", "solid.extrude"]);
|
||||
reloaded.load(&json!({"version": 3, "quick_access": ["solid.extrude", "solid.extrude", 7, "", "no.such.command"]}));
|
||||
assert_eq!(reloaded.quick_access, ["solid.extrude", "no.such.command"], "each once; unknown ids kept but not drawn");
|
||||
|
||||
// A click starts the command as its ribbon button does.
|
||||
h.step(&json!({"click":{"handle":"appbar:quick:solid.extrude"}})).unwrap();
|
||||
h.frames(2);
|
||||
assert_eq!(
|
||||
h.app.tool.as_ref().map(|t| t.cmd.to_string()).or_else(|| h.app.last_command.as_ref().map(|(id, _)| id.clone())).as_deref(),
|
||||
Some("solid.extrude")
|
||||
);
|
||||
h.step(&json!({"key":"Escape"})).unwrap();
|
||||
h.frames(2);
|
||||
|
||||
// The button's own menu takes it off; the last one gone, the bar goes too.
|
||||
pick(&mut h, "appbar:quick:solid.extrude", "Remove from Quick Access");
|
||||
assert_eq!(h.app.toolbar_custom.quick_access, ["solid.fillet"]);
|
||||
pick(&mut h, "button:solid.fillet", "Remove from Quick Access");
|
||||
assert!(h.app.toolbar_custom.quick_access.is_empty());
|
||||
h.frames(2);
|
||||
assert!(rect_of("appbar:quick_access").is_none());
|
||||
assert!(h.app.session.doc.features.is_empty(), "nothing in the design changed");
|
||||
}
|
||||
|
||||
/// A quick-access click starts exactly the pinned variant and leaves the family's remembered
|
||||
/// ribbon choice alone.
|
||||
#[test]
|
||||
fn a_quick_access_click_on_a_family_variant_keeps_the_remembered_ribbon_choice() {
|
||||
let mut h = Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.call("ui.resize", json!({"width":1600,"height":1000}));
|
||||
h.app.run("sketch.create", json!({"plane": "XY"})).unwrap();
|
||||
h.settle();
|
||||
h.app.start("sketch.rectangle.three_point");
|
||||
h.settle();
|
||||
h.step(&json!({"key":"Escape"})).unwrap();
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.preferences.sketch_variants.resolve("sketch.rectangle.two_point"), "sketch.rectangle.three_point");
|
||||
|
||||
h.app.toolbar_custom.quick_access = vec!["sketch.rectangle.center".to_string()];
|
||||
h.frames(3);
|
||||
h.step(&json!({"click":{"handle":"appbar:quick:sketch.rectangle.center"}})).unwrap();
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.tool.as_ref().map(|t| t.cmd.to_string()).as_deref(), Some("sketch.rectangle.center"));
|
||||
assert_eq!(
|
||||
h.app.preferences.sketch_variants.resolve("sketch.rectangle.two_point"),
|
||||
"sketch.rectangle.three_point",
|
||||
"the ribbon's Rectangle button still starts its remembered choice"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
//! (a window listing every command of the tab with a check box) and Reset Toolbar; Reset Toolbar
|
||||
//! restores the tab. The buttons are kept with the preferences and exported or imported with the
|
||||
//! keyboard shortcuts; hidden tabs are kept in the `hidden_toolbar_tabs` preference.
|
||||
//!
|
||||
//! The quick-access bar (#10223) is kept here too: the commands a command's menu added to the
|
||||
//! application bar, after Save, Undo and Redo, in the order the user dragged them into. It is
|
||||
//! empty, and so not drawn, until a command is added.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
@@ -27,10 +31,15 @@ pub struct ToolbarCustom {
|
||||
pub panels: BTreeMap<String, Vec<String>>,
|
||||
/// `"<workspace>/<tab>"` → gallery commands moved to full-size buttons.
|
||||
pub gallery_buttons: BTreeMap<String, Vec<String>>,
|
||||
/// The quick-access bar's commands, in order (#10223). Empty by default: no bar.
|
||||
pub quick_access: Vec<String>,
|
||||
/// The Customize Toolbar window is open (not kept).
|
||||
pub customizing: bool,
|
||||
}
|
||||
|
||||
/// Most commands the quick-access bar holds.
|
||||
pub const MAX_QUICK_ACCESS: usize = 24;
|
||||
|
||||
impl ToolbarCustom {
|
||||
/// Whether a command still uses a compact gallery cell in this panel.
|
||||
pub fn in_gallery(&self, tab: &str, panel: &str, id: &str) -> bool {
|
||||
@@ -41,7 +50,7 @@ impl ToolbarCustom {
|
||||
}
|
||||
|
||||
pub fn prefs(&self) -> Value {
|
||||
json!({"version": 3, "panels": self.panels, "gallery_buttons": self.gallery_buttons})
|
||||
json!({"version": 3, "panels": self.panels, "gallery_buttons": self.gallery_buttons, "quick_access": self.quick_access})
|
||||
}
|
||||
pub fn load(&mut self, v: &Value) {
|
||||
let version = v.get("version").and_then(Value::as_u64).unwrap_or(0);
|
||||
@@ -72,6 +81,13 @@ impl ToolbarCustom {
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
// Saved ids are kept as they are, each once; one this version lacks is not drawn.
|
||||
self.quick_access.clear();
|
||||
for id in v.get("quick_access").and_then(Value::as_array).into_iter().flatten().filter_map(Value::as_str).take(100) {
|
||||
if !id.is_empty() && id.len() <= 200 && !self.quick_access.iter().any(|q| q == id) && self.quick_access.len() < MAX_QUICK_ACCESS {
|
||||
self.quick_access.push(id.to_string());
|
||||
}
|
||||
}
|
||||
if !current {
|
||||
self.migrate();
|
||||
}
|
||||
@@ -307,6 +323,36 @@ pub fn toggle(app: &mut SolveApp, tab: &str, id: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a command to the end of the quick-access bar (#10223); a command already there stays put.
|
||||
pub fn quick_add(app: &mut SolveApp, id: &str) -> Result<(), String> {
|
||||
let spec = solidcraft_engine::find_command(id).ok_or_else(|| format!("no command `{id}`"))?;
|
||||
let list = &mut app.toolbar_custom.quick_access;
|
||||
if list.iter().any(|q| q == spec.id) {
|
||||
return Ok(());
|
||||
}
|
||||
if list.len() >= MAX_QUICK_ACCESS {
|
||||
return Err(crate::i18n::format("ui.quick_access_full", &[("count", &MAX_QUICK_ACCESS.to_string())]));
|
||||
}
|
||||
list.push(spec.id.to_string());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Take a command off the quick-access bar.
|
||||
pub fn quick_remove(app: &mut SolveApp, id: &str) {
|
||||
app.toolbar_custom.quick_access.retain(|q| q != id);
|
||||
}
|
||||
|
||||
/// Move a quick-access button before another one (`before`: None puts it at the end).
|
||||
pub fn quick_move(app: &mut SolveApp, id: &str, before: Option<&str>) {
|
||||
let list = &mut app.toolbar_custom.quick_access;
|
||||
if !list.iter().any(|q| q == id) || before == Some(id) {
|
||||
return;
|
||||
}
|
||||
list.retain(|q| q != id);
|
||||
let at = before.and_then(|b| list.iter().position(|q| q == b)).unwrap_or(list.len());
|
||||
list.insert(at, id.to_string());
|
||||
}
|
||||
|
||||
/// Reset Toolbar: a tab's panels back to their defaults.
|
||||
pub fn reset(app: &mut SolveApp, tab: &str) {
|
||||
let prefix = format!("{WORKSPACE}/{tab}/");
|
||||
@@ -326,6 +372,12 @@ pub fn command_items(app: &SolveApp, id: &str) -> Vec<Item> {
|
||||
Item::action("ui.toolbarPin", "Pin to Toolbar", "plus").with(json!({ "command": id }))
|
||||
});
|
||||
v.push(Item::action("ui.shortcutPin", if fav { "Unpin from Shortcuts" } else { "Pin to Shortcuts" }, "star").with(json!({ "command": id })));
|
||||
// The application bar's quick-access buttons (#10223).
|
||||
v.push(if app.toolbar_custom.quick_access.iter().any(|q| q == id) {
|
||||
Item::action("ui.quickAccessRemove", "Remove from Quick Access", "close").with(json!({ "command": id }))
|
||||
} else {
|
||||
Item::action("ui.quickAccessAdd", "Add to Quick Access", "plus").with(json!({ "command": id }))
|
||||
});
|
||||
v.push(Item::sep());
|
||||
v.push(Item::action("ui.toolbarCustomize", "Customize Toolbar…", "settings"));
|
||||
v.push(Item::action("ui.toolbarReset", "Reset Toolbar", "restore").with(json!({ "tab": tab })));
|
||||
@@ -371,6 +423,12 @@ pub fn run(app: &mut SolveApp, action: &str, p: &Value) {
|
||||
"ui.toolbarCustomize" => app.toolbar_custom.customizing = true,
|
||||
"ui.toolbarTab" => crate::workspace::set_tab_shown(app, &tab, p.get("shown").and_then(Value::as_bool).unwrap_or(true)),
|
||||
"ui.shortcutPin" => app.sbox.toggle_pin(id),
|
||||
"ui.quickAccessAdd" => {
|
||||
if let Err(e) = quick_add(app, id) {
|
||||
app.set_status(e, true);
|
||||
}
|
||||
}
|
||||
"ui.quickAccessRemove" => quick_remove(app, id),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +206,14 @@ General › **Show text under ribbon icons** is a separate, saved option for eit
|
||||
layout. Turn it off for shorter icon-only command buttons; tooltips, section names
|
||||
and command menus remain available.
|
||||
|
||||
**Quick-access bar.** Right-click any ribbon button, a row of a section's drop-down or a command
|
||||
search result and choose **Add to Quick Access**: the command's icon joins the application bar,
|
||||
after Save, Undo and Redo. A click starts the command as its ribbon button does; drag a button
|
||||
along the bar to reorder it; right-click it and choose **Remove from Quick Access** to take it off.
|
||||
The bar is empty, and so not shown, until a command is added, and holds up to 24 commands. Narrow
|
||||
windows hide it with Undo and Redo. It is saved with the toolbar's customisations, so it is
|
||||
exported with the keyboard shortcuts and carried by settings profiles.
|
||||
|
||||
Interface › Layout › **Show origin and bodies at the top** (off by default) puts the active
|
||||
component's Bodies folder and the Origin (planes, axes and point) at the top of the History when
|
||||
it sits on the left or under the browser and is wide enough for names. They are the browser's own
|
||||
|
||||
Reference in New Issue
Block a user