Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Deschamps on June 08, 2008, 05:42:40 pm

Title: ColorCoder plugin v1.0.1 (updated 2010/10/17)
Post by: Deschamps on June 08, 2008, 05:42:40 pm
Hello, all.

This is not an state of art plugin. It's really simple, so I don't know if anyone will find it useful. At least for me it does his job, because I often need to code colors in my sources (wxWigets and OpenGL apps in C++). So I missed a kind of colorpicker integrated with the C::B editor that I could use for pasting new colors coded in different formats knowing exactly what color I'll use instead of imagine how will look the values I use.

I've studied how the internals of C::B and its plugin structure works. I wanted to do that time ago, and have learnt some things, but still there are lots that I must read. In any case, I got working my colorpicker plugin (I name it ColorCoder) integrated inside C::B, compiled from svn sources under ArchLinux i686.

Here you have its user interface dialogs (both, the extended and tiny views under Gnome):

(http://img28.imageshack.us/img28/2301/colorcodersmall.png)

(http://img291.imageshack.us/img291/3867/colorcoderlarge.png)

As you can see, you can select a color from the standard picker (pressing the upper button) or from a list of html names (according to the WC3 standards), and then apply the delimiters, prefix, datatypes or options you desire for the output. Clicking the insert button, you'll paste the output at the current cursor position in your document. Don't expect magic. It's only a color picker applying format to the output, that's all.


The compressed file includes all the sources, the C::B projects (GNU/Linux and Windows) and the .png icons. There is also a .fbp file. It's a wxFormBuilder project (I've defined the dialogs using this tool):

http://www.primi.net/deschamps/codeblocks/ColorCoder-1.0.1.tar.gz

I'll be pleased reading your comments, suggestions and corrections. I'm not an experienced programmer, though (rather learner). So don't be harsh with me.

Regards.

Edit: (2010/05/19) Updated screenshots and link to version 1.0.1

Edit: (2010/10/17) Please, see this post (http://forums.codeblocks.org/index.php/topic,8568.msg89290.html#msg89290) from Cryo for a modified version, looking for its integration into the svn sources as contrib-plugin.

Title: Re: ColorCoder plugin
Post by: mandrav on June 08, 2008, 08:38:03 pm
This looks very nice and handy :).

As for the sources, if for some reason you can't use a fee-hosting site for posting the sources for review, you can send it to me and I will provide a link for it.
Title: Re: ColorCoder plugin
Post by: JGM on June 08, 2008, 09:47:01 pm
Really cool, it will make codeblocks a more complete IDE to work on :wink:
Title: Re: ColorCoder plugin
Post by: thomas on June 09, 2008, 10:03:37 am
It's not only cool, it has a cool icon too :)
Title: Re: ColorCoder plugin
Post by: Deschamps on June 10, 2008, 02:03:59 am
Thanks for your comments :)

I've modified the configuration panel, adding a new "tiny dialog" option. The dialog used with that option will be an smaller one so the screen won't be occupied with the other big one, and the user could leave the dialog opened without being an inconvenience. At this moment, changing between tiny and extended views is only possible through the configuration panel, but the next step will be to let this change in "real time".

Here are the screenshots for these dialogs (wxMSW version with Windows Vista look'n'feel):

(http://img84.imageshack.us/img84/1024/cc01hq0.png)

(http://img65.imageshack.us/img65/3462/cc02dq5.png)

(http://img65.imageshack.us/img65/8286/cc03vm5.png)


Quote from: thomas
It's not only cool, it has a cool icon too

With regard to that... Is it possible for the plugin installer to add these icons to the ~/.codeblocks/share/codeblocks/images/settings/ folder (or its equivalent path in other platforms) during the installation process? ATM I'm adding them "by hand", and each time I uninstall the plugin (installing a new version) I need to copy them again.

Regards.

Edit: Updated screenshots with 0.9 version
Title: Re: ColorCoder plugin
Post by: dmoore on June 10, 2008, 02:51:23 am
very nice! I recommend you add the option to switch between tiny and regular dialogs to the dialog itself (an expander control like you see in the gnome file picker)
Title: Re: ColorCoder plugin
Post by: killerbot on June 10, 2008, 07:30:45 am
I would say, once you got the code cleaned up (if needed) and ready, we could add it to the contrib plug-ins, if you like that.

Then you images will automatically get into the correct dir ;-)
Title: Re: ColorCoder plugin
Post by: mandrav on June 10, 2008, 08:28:22 am
Quote
With regard to that... Is it possible for the plugin installer to add these icons to the ~/.codeblocks/share/codeblocks/images/settings/ folder (or its equivalent path in other platforms) during the installation process? ATM I'm adding them "by hand", and each time I uninstall the plugin (installing a new version) I need to copy them again.

Although it's mentioned elsewhere, you need to do two things:
Title: Re: ColorCoder plugin
Post by: Deschamps on June 10, 2008, 11:14:25 am
Quote from: mandrav
Although it's mentioned elsewhere, you need to do two things:
  • Inside the .cbplugin archive you must put the two icon files (.png, on/off versions), in the root of the archive (aka not in any folders)
  • Those two icons must follow a strict naming rule (case-sensitive!): if your plugin is named ColorCoder then those two files must be named as ColorCoder.png and ColorCoder-off.png.
Yes. I had read elsewhere (I think that was the wiki) that this was the procedure. But I've done in that manner and it's not working for me, neither in Vista nor openSUSE 10.3. Finally, what I've done is to copy these two images to the /usr/local/share/codeblocks/images/settigs/ folder, so they are always available (copy them each time to my home path was annoying and adding them to the proper folder in the svn sources and recompiling the whole C::B also works, but this is a disproportionate work around :D)

I had also read about the naming rules, and I have assured that all the involved files (including the return string in the GetBitmapBaseName() method for the setup class) are observing strictly the case-sensitive aspect.


Quote from: killerbot
I would say, once you got the code cleaned up (if needed) and ready, we could add it to the contrib plug-ins, if you like that.

It would be really nice seeing this poor tool integrated with the contrib plugins in C::B :) But.. yes. I need to clean up a lot the code. By now, lots of comments are needed and the coding style should be also adapted to the look you use in most of the sources. I would feel ashamed showing you the current sources :D


Quote from: dmoore
very nice! I recommend you add the option to switch between tiny and regular dialogs to the dialog itself (an expander control like you see in the gnome file picker)

Thanks. I'll add that feature today or tomorrow, so it will be implemented for the first "public" release.

Regards.
Title: Re: ColorCoder plugin
Post by: mandrav on June 10, 2008, 01:27:49 pm
Quote from: mandrav
Although it's mentioned elsewhere, you need to do two things:
  • Inside the .cbplugin archive you must put the two icon files (.png, on/off versions), in the root of the archive (aka not in any folders)
  • Those two icons must follow a strict naming rule (case-sensitive!): if your plugin is named ColorCoder then those two files must be named as ColorCoder.png and ColorCoder-off.png.
Yes. I had read elsewhere (I think that was the wiki) that this was the procedure. But I've done in that manner and it's not working for me, neither in Vista nor openSUSE 10.3. Finally, what I've done is to copy these two images to the /usr/local/share/codeblocks/images/settigs/ folder, so they are always available (copy them each time to my home path was annoying and adding them to the proper folder in the svn sources and recompiling the whole C::B also works, but this is a disproportionate work around :D)

I had also read about the naming rules, and I have assured that all the involved files (including the return string in the GetBitmapBaseName() method for the setup class) are observing strictly the case-sensitive aspect.

Keep in mind that we 're talking about the plugin's base name here, not its filename. So, on linux for example, if your plugin is bundled as libColorCoder.cbplugin the icons should still be named ColorCoder.png and ColorCoder-off.png (no 'lib').
Finally, I insist that it works because I have a small plugin here that proves the procedure works :). If you still can't make it work, when you release the source, I 'll try to find the time and fix this for you. Maybe it's another step going wrong (or not done at all) that makes this fail...
Title: Re: ColorCoder plugin
Post by: Deschamps on June 17, 2008, 10:22:48 pm
Hello again :)

I've been trying to improve the plugin modifying lots of its sources, but I've done something wrong because I've arrived to a non-exit way :( So, I have rescued a copy from a week ago and updated it with the last features I wanted to add (tiny view, and so). I've decided to release this version because it has been already delayed for a long time.

EDIT: I've updated the first message in this thread, with the new screenshots and the .Zip file with the source code.

Regards.
Title: Re: ColorCoder plugin (v.0.9)
Post by: Deschamps on June 18, 2008, 10:59:10 am
Hello,

I've just noticed a problem with the wxMSW (in my Windows Vista, at least) version. When the plugin is compiled and installed, the dialogs aren't showing the default setup the first times the tool is launched, and "insert" button in the tiny view doesn't do anything. If you go to Settings -> Editor -> ColorCoder defaults, applying the selected options, then the default.conf file is updated properly and the next time you open Code::Blocks all is going fine. I suppose that is a problem "reading" the values used by default for the controls under Windows.

However, the wxGTK version runs perfect with the current sources, as far as I've seen (at least in my box, with openSUSE 10.3 x86_64).
I'll try to correct that wrong behavior as soon as possible.

Regards.
Title: Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
Post by: Deschamps on May 19, 2010, 07:09:04 pm
Hello,

A very long time ago since my last post here.

I think it would be nice having this old ColorCoder pluging revised and working, so I've updated the first post in this thread and compiled ColorCoder against an up-to-date svn sources (rev.6261, btw nice to see that new splash) in my ArchLinux box (GCC 4.5.0 and wxGTK 2.8.11), installed the plugin, and all seems to go fine.

But I can't compile and install the pluging in a Windows environment. I've no access to any box with Microsoft OS, atm. So I would appreciate that someone was so kind to try to compile it under Windows.

Here you'll find the sources: http://www.primi.net/deschamps/codeblocks/ColorCoder-1.0.1.tar.gz

Kindest regards.
Title: Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
Post by: seb_seb0 on May 19, 2010, 10:19:22 pm
It worked fine for me (compilation of the plugin without any changes: decompress the archive you posted, compile, install plugin, use the plugin)

My configuration: Windows Vista
                        CodeBlocks SVN 6181 (last official NIghtly - 27/02/2010)

Regards,

Sebastien
Title: Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
Post by: Deschamps on May 20, 2010, 12:03:25 am
Thank you for compiling and trying the plugin under Windows Vista.

Nice to read that all worked fine! :)
I greatly appreciate your collaboration.

Title: Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
Post by: Cryogen on September 10, 2010, 07:24:35 pm

 Hi Deschamps,

Thanks for a nice little plug-in. I've updated it to build as a contrib plug-in, i.e. changed output paths,  removed references to $(cb), added makefiles, added post-build steps etc. It will now build along with the other contrib plug-ins if you add the project to the contrib plug-in workspace. I've also provided a patch for the system build files outside contrib\ColorCoder. Files are attached.

I've tested it on Win7 and Ubuntu Karmic both building in CB and via make.

Hopefully it can become a contrib plug-in with minimal effort, now.

If you would still like to build the .cbplugin, the same command will work but you will just need to change the paths to reflect the new output locations. Let me know if you need assistance.

Cheers,

 Cryo.

Title: Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
Post by: Deschamps on October 17, 2010, 06:17:28 pm
Hi there. I read this message time ago, but forgot to answer it :( I'm sorry.

Hi Deschamps,

Thanks for a nice little plug-in. (..)

You're welcome :)
Thanks to you for trying it.


Quote
(..) I've updated it to build as a contrib plug-in, i.e. changed output paths,  removed references to $(cb), added makefiles, added post-build steps etc. It will now build along with the other contrib plug-ins if you add the project to the contrib plug-in workspace. I've also provided a patch for the system build files outside contrib\ColorCoder. Files are attached.

I've tested it on Win7 and Ubuntu Karmic both building in CB and via make.

Hopefully it can become a contrib plug-in with minimal effort, now (..)

Thank you very much for this job. I've tested it on Archlinux and it's also working fine.
It would be nice seen integrated this little utility as plugin in the svn C::B sources.

Kindest regards.