Author Topic: Plugin Settings Icons  (Read 20371 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Plugin Settings Icons
« on: July 02, 2007, 01:45:39 pm »
Quote
4203     /     mandrav     0 minutes     * Binary .cbplugin files can now contain icons for the "Settings" dialogs. The two supported icon files should be named <plugin_name>.png and <plugin_name>-off.png.
* Updated all settings dialogs to locate icons through configmanager.
* If a settings icon for a plugin cannot be located, the generic-plugin icon will be used.

Beautiful!

thank you

Should the <plugin>.png's be loose in the .cbplugin file or zipped together in the <plugin>.zip along with the <plugin>.manifest.
« Last Edit: July 02, 2007, 01:54:13 pm by Pecan »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plugin Settings Icons
« Reply #1 on: July 02, 2007, 02:09:40 pm »
Sample plugin (named TestPlugin) contents:


TestPlugin.cbplugin:
    TestPlugin.dll  <-- the plugin
    TestPlugin.zip  <-- its resources
    TestPlugin.png  <-- the highlighted settings icon
    TestPlugin-off.png  <-- the non-highlighted settings icon


These are the "easy" stuff to support, since they share a common base name (the plugin's name). To add support for, e.g. toolbar images, will take a little longer...

EDIT: for those wondering, the problem is not how to define additional files to be installed but rather how to know what files each plugin needs when exporting (saving).
« Last Edit: July 02, 2007, 02:39:23 pm by mandrav »
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plugin Settings Icons
« Reply #2 on: July 02, 2007, 03:49:40 pm »
OK, done with it.
Now binary plugins (.cbplugin) can also contain extra files to be installed/uninstalled/exported. Just define them inside the plugin's manifest XML.
E.g.:


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
    <SdkVersion major="1" minor="10" release="0" />
    <Plugin name="Autosave">
        <Value title="Autosave" />
        <Value version="0.1" />
        <Value description="Saves your work in regular intervals" />
        <Value author="Thomas Denk" />
        <Value authorEmail="" />
        <Value authorWebsite="http://www.codeblocks.org" />
        <Value thanksTo="" />
        <Value license="GPL" />
    </Plugin>
   
    <Extra file="images/16x16/bookmark_add.png" />
    <Extra file="images/16x16/editcopy.png" />

</CodeBlocks_plugin_manifest_file>



Just make sure you define only your plugin's extra files as there is no check if they're needed by other plugins when deleting them...
Be patient!
This bug will be fixed soon...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Plugin Settings Icons
« Reply #3 on: July 02, 2007, 03:54:05 pm »
until now, I've been keeping bitmaps in <Plugin-name>.zip
so long as they have an XRC associated with them, they are easy to load and manage.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plugin Settings Icons
« Reply #4 on: July 02, 2007, 06:48:27 pm »
until now, I've been keeping bitmaps in <Plugin-name>.zip
so long as they have an XRC associated with them, they are easy to load and manage.

Yes, most plugins are like that.
Be patient!
This bug will be fixed soon...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Plugin Settings Icons
« Reply #5 on: July 02, 2007, 08:50:14 pm »
well my only concern is that plugin writers will use <extra file> to unnecessarily pollute the shared folders because of the effort required to understand XRC.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plugin Settings Icons
« Reply #6 on: July 02, 2007, 08:59:12 pm »
well my only concern is that plugin writers will use <extra file> to unnecessarily pollute the shared folders because of the effort required to understand XRC.

Do you have any hints for people to understand XRC?
Be patient!
This bug will be fixed soon...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Plugin Settings Icons
« Reply #7 on: July 02, 2007, 09:16:07 pm »
sure (i walked into this one didn't I  :lol: ). I'll put a page up on the wiki...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plugin Settings Icons
« Reply #8 on: July 02, 2007, 09:22:07 pm »
sure (i walked into this one didn't I  :lol: ). I'll put a page up on the wiki...

That'd be perfect, thanks :)
Be patient!
This bug will be fixed soon...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Plugin Settings Icons
« Reply #9 on: July 05, 2007, 02:50:31 pm »
I've made a start: http://wiki.codeblocks.org/index.php?title=Managing_Plug-in_Resources
(it will probably take a couple of weeks to complete because I have other pressing demands on my time :) )

Anyone reading this should feel free to contribute - I'm certain there are many mistakes

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plugin Settings Icons
« Reply #10 on: July 05, 2007, 03:07:10 pm »
I've made a start: http://wiki.codeblocks.org/index.php?title=Managing_Plug-in_Resources
(it will probably take a couple of weeks to complete because I have other pressing demands on my time :) )

Anyone reading this should feel free to contribute - I'm certain there are many mistakes

Thanks :)
Be patient!
This bug will be fixed soon...

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Plugin Settings Icons
« Reply #11 on: July 05, 2007, 04:48:07 pm »
we once made the suggestion in a sticky post, to use CamelCase, could you adopt your wiki page to use that too please.

MyPlugIn ;-)

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Plugin Settings Icons
« Reply #12 on: July 06, 2007, 12:48:07 am »
Hi !

After many tests, I don't succeed in installing my plugin pngs  :oops:

My manifest.xml
Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
    <SdkVersion major="1" minor="11"  release="10" />
    <Plugin name="ThreadSearch">
        <Value title="ThreadSearch" />
        <Value version="0.7" />
        <Value description="Multi-threaded 'Search in files' with preview window." />
        <Value author="Jerome ANTOINE" />
        <Value authorEmail="" />
        <Value authorWebsite="" />
        <Value thanksTo="wxWidgets team
Code::Blocks team
wxGlade team" />
        <Value license="GPL" />
    </Plugin>

    <Extra file="images/findf.png" />
    <Extra file="images/findfdisabled.png" />
    <Extra file="images/options.png" />
    <Extra file="images/optionsdisabled.png" />
    <Extra file="images/stop.png" />
    <Extra file="images/stopdisabled.png" />
</CodeBlocks_plugin_manifest_file>

My structure :
ThreadSearch.cbplugin
   findf.png
   findfdisabled.png
   options.png
   optionsdisabled.png
   stop.png
   stopdisabled.png
   ThreadSearch.dll
   ThreadSearch.png
   ThreadSearch-off.png
   ThreadSearch.zip
      manifest.xml

I also tried to put pngs (all except ThreadSearch.png and ThreadSearch-off.png) in ThreadSearch.zip but only settings pngs are copied.

Is there anything wrong ?

XP SP2, SVN 4229.

Dje

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Plugin Settings Icons
« Reply #13 on: July 06, 2007, 01:10:34 am »
show your image loading code...

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Plugin Settings Icons
« Reply #14 on: July 06, 2007, 01:28:58 am »
In fact, I just checked the tree.
extra pngs are not copied at the right (expected) place.

i first tried to copy them with
Code
<Extra file="images/ThreadSearch/findf.png" />
As it didn't work, I tried with
Code
<Extra file="images/findf.png" />
I also tried with
Code
<Extra file="images\ThreadSearch\findf.png" />

Shouldn't they be copied at install whatever my code is ?

It is
Code
wxString prefix = ConfigManager::GetDataFolder() + _T("/images/ThreadSearch/");
...
pBtnSearch->SetBitmapDisabled(wxBitmap(prefix + wxT("findfdisabled.png"), wxBITMAP_TYPE_PNG));
@dmoore You already saw it isn't it ?

Dje