Skip to content

Commit

Permalink
Remove the Tools menu bar item for now.
Browse files Browse the repository at this point in the history
On the GTK platform,   there is no straightforward way to disable hot­
keys while editing text,  this means that the menu bar will always re­
ceive these keys before the text input does because AccelGroups always
receive keys before DrawArea. Furthermore,  because  menus are global,
there is nothing available to  menus::make_menu  to disable these menu
items when the focused window is not a glyph editor window,   and this
will be a problem again down the line, when there are non-numeric text
inputs  (e.g. a search box for selecting components to add to a glyph)
in the glyph editor window.

In the future, we can add hax to work around the GTK behavior, or may­
be we'll be onto bigger and better things re the X11 and Wayland plat­
forms by then.

In the mean time,   the hotkeys still work in the glyph editor window,
where they actually make sense;  maybe tooltips should be used to make
them discoverable, or maybe we just draw hotkeys on/in the tool icons.
  • Loading branch information
xorgy authored and cmyr committed Apr 3, 2021
1 parent a8fd88a commit dd96bda
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions runebender-lib/src/menus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub fn make_menu(data: &AppState) -> MenuDesc<AppState> {
.append(view_menu())
.append(glyph_menu(data))
.append(paths_menu())
.append(tools_menu())
.append(window_menu(data))
}

Expand Down Expand Up @@ -185,66 +184,6 @@ fn paths_menu<T: Data>() -> MenuDesc<T> {
)
}

fn tools_menu<T: Data>() -> MenuDesc<T> {
MenuDesc::new(LocalizedString::new("menu-tools-menu").with_placeholder("Tools"))
.append(
MenuItem::new(
LocalizedString::new("menu-item-select-tool").with_placeholder("Select"),
consts::cmd::SET_TOOL.with("Select"),
)
.hotkey(SysMods::None, "v"),
)
.append(
MenuItem::new(
LocalizedString::new("menu-item-pen-tool").with_placeholder("Pen"),
consts::cmd::SET_TOOL.with("Pen"),
)
.hotkey(SysMods::None, "p"),
)
.append(
MenuItem::new(
LocalizedString::new("menu-item-hyperpen-tool").with_placeholder("Pen"),
consts::cmd::SET_TOOL.with("HyperPen"),
)
.hotkey(SysMods::Shift, "P"),
)
.append(
MenuItem::new(
LocalizedString::new("menu-item-preview-tool").with_placeholder("Preview"),
consts::cmd::SET_TOOL.with("Preview"),
)
.hotkey(SysMods::None, "h"),
)
.append(
MenuItem::new(
LocalizedString::new("menu-item-rectangle-tool").with_placeholder("Rectangle"),
consts::cmd::SET_TOOL.with("Rectangle"),
)
.hotkey(SysMods::None, "u"),
)
.append(
MenuItem::new(
LocalizedString::new("menu-item-ellipse-tool").with_placeholder("Ellipse"),
consts::cmd::SET_TOOL.with("Ellipse"),
)
.hotkey(SysMods::Shift, "U"),
)
.append(
MenuItem::new(
LocalizedString::new("menu-item-knife-tool").with_placeholder("Knife"),
consts::cmd::SET_TOOL.with("Knife"),
)
.hotkey(SysMods::None, "e"),
)
.append(
MenuItem::new(
LocalizedString::new("menu-item-measure-tool").with_placeholder("Measure"),
consts::cmd::SET_TOOL.with("Measure"),
)
.hotkey(SysMods::None, "m"),
)
}

fn window_menu(_app_state: &AppState) -> MenuDesc<AppState> {
MenuDesc::new(LocalizedString::new("menu-window-menu").with_placeholder("Window")).append(
MenuItem::new(
Expand Down

0 comments on commit dd96bda

Please sign in to comment.