Removing / Hiding tools in the tool pallete

Discussion about writing code for Inkscape.
kansas123
Posts: 4
Joined: Sun Nov 17, 2019 9:10 am

Removing / Hiding tools in the tool pallete

Postby kansas123 » Sun Nov 17, 2019 9:29 am

Hello all. First post here. I looked, but did not see anything in this forum on this topic:

Is there a way to hide/remove/disable certain tool icons in the toolbox on the left? I am trying to make a very simplified version of Inkscape (0.92) which removes some, or preferably all, of the following tool icons (on behalf of some users who get confused easily, and do not want to have to use the dropdown tool list to get to the tool they need frequently): nodes,tweak, spray, measure, rect, 3dbox, arc, star, spiral, lpetool, paintbucket, connector, gradient, mesh, dropper. I would like the pallete to just contain these: selection, text, pencil, pen, calligraphy.

Short of removing / hiding them, is there a way to rearrange the order of the tool icons in the toolbox?

I saw the following in toolbox.cpp which gives me hope that they can be removed at compile time: "tools that have been disabled by compile time options":

Code: Select all

if ( va && ! skip_this) {
                mainActions->add(va);
                if ( i == 0 ) {
                    va->set_active(true);
                }
            } else {
                // This creates a blank action using the data_name, [b]this can replace
                // tools that have been disabled by compile time options[/b].
                Glib::RefPtr<Gtk::Action> act = Gtk::Action::create(Glib::ustring(tools[i].data_name));
                act->set_sensitive(false);
                mainActions->add(act); 
             }
}


Thank you!

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Removing / Hiding tools in the tool pallete

Postby Moini » Thu Nov 21, 2019 2:16 am

There is a way to do this via the UI file that is in Inkscape's share/ui directory. It's simple xml, easy to edit.
If you then also disable the keyboard shortcuts by editing the keys.xml file in the share/keys directory, they will not even be reachable by accidentally pressing random keys.

Make sure to publish your derivative as open source under the GNU Public License.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

kansas123
Posts: 4
Joined: Sun Nov 17, 2019 9:10 am

Re: Removing / Hiding tools in the tool pallete

Postby kansas123 » Thu Nov 21, 2019 8:53 am

Thank you, that worked great. I was able to remove the tools I do not need. Will heed what you say about publishing it. I have a problem however, now. I have not yet done anything with the keyboard shortcuts, and yet for some reason all of a sudden CTRL-Z to undo does not work, and when I select an object I have created, and press the delete key, nothing happens. To delete stuff I've added, I need to right-click and select cut. Strange...

Thank you again!

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Removing / Hiding tools in the tool pallete

Postby Moini » Fri Nov 22, 2019 7:33 am

That is, indeed, strange. I haven't heard of the issue you are describing before. It's not a temporary thing, right? I.e. after a restart of the system, it's still broken?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

kansas123
Posts: 4
Joined: Sun Nov 17, 2019 9:10 am

Re: Removing / Hiding tools in the tool pallete

Postby kansas123 » Tue Nov 26, 2019 8:17 am

Sorry, my mistake. I had somehow removed the default.xml file in the AppData\Roaming\inkscape\keys folder (Windows). I restored it from an old copy, and all is working again. Thank you!


Return to “Programming”