giuspen / cherrytree

cherrytree
https://www.giuspen.net/cherrytree/
Other
3.43k stars 468 forks source link

adding custom icons #1840

Open urbandecay opened 3 years ago

urbandecay commented 3 years ago

Is your feature request related to a problem? Please describe. Sometimes the most appropriate icon to use is not available. Having the ability to add custom icons would solve that.
There is the option to enter a custom image but there is no default setting to point to an icon folder and the insert image process takes too many steps. Having the ability to add custom icons in the tree view would be also be really helpful

Describe the solution you'd like Add an 'insert custom icon' option or have the ability to store icons where the legacy icons are stored.

mm47 commented 3 years ago

Which OS are you using? If it's linux, is it compiled from source or flatpak?

I'm still using version 39 installed from a debian package and I was able to add more icons, I just had to edit a cons.py file and copy and paste the icons to the system folder.

urbandecay commented 3 years ago

I use Mint and I got it off the software manager app. I got in a flatpak. I am using v99.42. There doesn't seem to be a cons.py file for that version.

mm47 commented 3 years ago

Check this issue and see if giuspen's reply helps you #1733

For adding, there's probably a file that needs to be modified. You'll have to look for it in the mentioned folders.

urbandecay commented 3 years ago

The folder that was used in previous versions doesn't exit in this one and the .svg file that I found looks like it belongs to the toolbar but I don't recognize the style of those icons anywhere in the program. It looks like this new version is done differently. Just going to have to wait for that feature sometime in the future.

giuspen commented 3 years ago

@urbandecay the cons.py is old python2. Cherrytree is C++ now. You can do the same on https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_const.h and NODE_CUSTOM_ICONS.

urbandecay commented 3 years ago

const inline static gchar* NODE_ICON_TYPE_CUSTOM {"b"}; I am not entirely sure what this means or how to use this. Is this a custom declaration of type gchar that is pointing to some folder that I can throw icons in? Is there a .cc file somewhere that uses this declaration that I have to modify? Does it mean I can create a new folder with my custom icons in it and call on it somehow by the letter 'b'?

Inside /usr/share/cherrytree/icons there is folders with .svg files in it. Is this piece of code related to what is going on in that folder? Can I just create a custom folder and start putting things in it? And if so, can I put in image files instead of .svg?

giuspen commented 3 years ago

In this commit https://github.com/giuspen/cherrytree/commit/08530bcc594e13c5fda5ea23c46980c738271a19 I added a new icon to the custom icons, you can see it as example. You can use also non svg