Author Topic: ColorCoder plugin v1.0.1 (updated 2010/10/17)  (Read 25190 times)

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
ColorCoder plugin v1.0.1 (updated 2010/10/17)
« 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):



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 from Cryo for a modified version, looking for its integration into the svn sources as contrib-plugin.

« Last Edit: February 14, 2011, 09:26:02 am by Deschamps »
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: ColorCoder plugin
« Reply #1 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.
Be patient!
This bug will be fixed soon...

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: ColorCoder plugin
« Reply #2 on: June 08, 2008, 09:47:01 pm »
Really cool, it will make codeblocks a more complete IDE to work on :wink:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: ColorCoder plugin
« Reply #3 on: June 09, 2008, 10:03:37 am »
It's not only cool, it has a cool icon too :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: ColorCoder plugin
« Reply #4 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):





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
« Last Edit: June 18, 2008, 11:15:43 am by Deschamps »
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: ColorCoder plugin
« Reply #5 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)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5519
Re: ColorCoder plugin
« Reply #6 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 ;-)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: ColorCoder plugin
« Reply #7 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:
  • 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.
Be patient!
This bug will be fixed soon...

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: ColorCoder plugin
« Reply #8 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.
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: ColorCoder plugin
« Reply #9 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...
Be patient!
This bug will be fixed soon...

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: ColorCoder plugin
« Reply #10 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.
« Last Edit: June 17, 2008, 11:08:28 pm by Deschamps »
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: ColorCoder plugin (v.0.9)
« Reply #11 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.
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
« Reply #12 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.
« Last Edit: February 14, 2011, 09:55:49 am by Deschamps »
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline seb_seb0

  • Almost regular
  • **
  • Posts: 166
Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
« Reply #13 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

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: ColorCoder plugin v1.0.1 (updated 2010/05/19)
« Reply #14 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.

Those who were seen dancing were thought to be insane by those who could not hear the music