Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: nanyu on November 19, 2008, 04:54:42 am

Title: The first plugin I written : "AutoReadonly"
Post by: nanyu on November 19, 2008, 04:54:42 am
We often open a file which under a library directories when we are browsing  in source code, or debug into. 
etc : <string> , <wx/wxString>..<boost/bind.hpp>
Under these circumstances, we care about "read code", rather than to modify them. Modify the library's  code and save it, is a very troublesome thing.

There for, I written a plugin named "Auto Readonly". When a file without a  opened project was opened in C::B, the plugin will try to change it to read-only mode (just in IDE, no on disk) automatic. OR, you can  change it's read-only status manual by a new menu item (Edit->Readonly Ctrl + Alt + R);

A setting panel was provided. you can set those options:

   # whether the non-project file ( file without project) change to read-only automatically.
   # white list / black list (for directories)
   # alert ...
   # case sensitive...
-------------------------------------------------------------------
  (Updated for png)CBPlug_AutoReadonly(081119-2).7z (http://www.d2school.com/codeblocks/download/CBPlug_AutoReadonly(081119-2).7z)
Hi, I have update the  "autoreadonly.png" and "autoreadonly-off.png".

now I only compile it under windows...(who would test it under linux?)






[attachment deleted by admin]
Title: Re: The first plugin I written : "AutoReadonly"
Post by: MortenMacFly on November 19, 2008, 12:10:11 pm
There for, I written a plugin named "Auto Readonly".
I am testing it currently... Nice idea! :-)
From a quick-look I saw that you probably missed a "return" statement in ReadonlyAbleTool.cpp here:
Code
bool IsActiveEdtiorReadonly()
{
    IsEditorReadonly(GetActiveEditor());
}
I believe what you meant was something like this:
Code
bool IsActiveEdtiorReadonly()
{
    return IsEditorReadonly(GetActiveEditor());
}
Title: Re: The first plugin I written : "AutoReadonly"
Post by: nanyu on November 19, 2008, 03:07:14 pm
Quote
From a quick-look I saw that you probably missed a "return" statement in ReadonlyAbleTool.cpp ...

Thank you!

Do you test it under Linux?  I am worry about the code can't work with unix style path. (//.//...)  (pls see the TODO-list)

As you see, my English is bad....include the string in my code, I hope they didn't make you confused .:))
Title: Re: The first plugin I written : "AutoReadonly"
Post by: mariocup on November 20, 2008, 12:56:44 pm
Hi nanyu,

I like the idea. I will try it under Linux.

Bye,

Mario
Title: Re: The first plugin I written : "AutoReadonly"
Post by: nanyu on November 24, 2008, 03:05:12 am
Quote
I will try it under Linux.
to Mario: Thank you for your help, Can it work well under Linux ? (If it can't , I guess you have make it can now ) :P 
If it work well,  can you add it to the next nightly build? (sorry, i don't know how to post a plugin..)
---------------------
I build a svn version Code::Blocks, and i build the "auto readonly" plugin. but the plugin can run only well with the c::b which I build,
but can't be install with the svn5309 build :[

Title: Re: The first plugin I written : "AutoReadonly"
Post by: mariocup on November 24, 2008, 08:53:40 am
Hi nanyu,

I will try it under Linux this week. I am quite busy since a trade fair starts tomorrow.

Bye,

Mario
Title: Re: The first plugin I written : "AutoReadonly"
Post by: nanyu on December 22, 2008, 05:02:03 am
Hi Mario, how about your  trade fair. Merry Christmas ! btw, how about your test for my plugin? :)
Title: Re: The first plugin I written : "AutoReadonly"
Post by: mariocup on December 22, 2008, 09:00:50 am
Hi nanyu,

sorry, until now I had no time for testing and now at home I have only windows :(. But it is on my todo list for testing :D

I wish you merry christmas.


Mario
Title: Re: The first plugin I written : "AutoReadonly"
Post by: nanyu on January 10, 2009, 07:22:31 am
who would help me ?

pls complie this plugin  in code::blocks with gcc 4.2.1 ?
Title: Re: The first plugin I written : "AutoReadonly"
Post by: nanyu on February 04, 2009, 06:26:34 pm
Anyone can help me? thanks.

I download the Code::blocks' source files  (svn 5394).

I compile the c::b with:  code::blocks(svn 5328) + mingw-gcc (4.2.1) + wx2.8.9 (unicode)

   then I got a new c::b  "svn build rev 5394 (2009-01-10T09:46:57.150401Z) gcc 4.2.1 Windows/unicode"

I write this plugin (Auto Readonly) In c:b (svn 5394) which  downloaded from  "Nightly builds" link.

NOW  I run the "new" c::b (svn 5394) which compiled by me. and install the plugin AutoReadonly, everything OK.
 but I  run the c::b (svn 5328) and install the AutoReadonly plugin... I got a message :

"One or more plugins were not installed succesfully:
C:\Documents and Settings\XXXX\My Documents\CodeBlocks Projects\CBPlug_AutoReadonly\AutoReadonly.cbplugin
"

what can I do now?
Title: Re: The first plugin I written : "AutoReadonly"
Post by: XayC on February 04, 2009, 09:19:51 pm
This is probably because you linked the plug-in with a wxWidgets DLL built by yourself. When you install the plug-in with a nightly build or an official release of C:B it won't work.

If this is the case just link the plug-in with the wxWidgets DLL provided with the nightly (or the release). You can do that adding the DLL in the list of libraries for LD linker.
Also check that you are building the plug-in with the same SDK version used by the C:B you are then testing it with.

Regards, XayC
Title: Re: The first plugin I written : "AutoReadonly"
Post by: nanyu on February 05, 2009, 03:00:19 am
This is probably because you linked the plug-in with a wxWidgets DLL built by yourself. When you install the plug-in with a nightly build or an official release of C:B it won't work.

If this is the case just link the plug-in with the wxWidgets DLL provided with the nightly (or the release). You can do that adding the DLL in the list of libraries for LD linker.
Also check that you are building the plug-in with the same SDK version used by the C:B you are then testing it with.

Regards, XayC

thank you . the dll files what you mean is :

wxmsw28u_gcc_cb.dll
wxmsw28u_media_gcc_custom.dll

where in the CodeBlocks folder?
Title: Re: The first plugin I written : "AutoReadonly"
Post by: stahta01 on February 06, 2009, 03:34:05 am
thank you . the dll files what you mean is :

wxmsw28u_gcc_cb.dll
wxmsw28u_media_gcc_custom.dll

where in the CodeBlocks folder?

for wxmsw28u_gcc_cb.dll see
http://wiki.codeblocks.org/index.php?title=Linking_the_plugin_to_a_Nightly_Build
Title: Re: The first plugin I written : "AutoReadonly"
Post by: dmoore on February 06, 2009, 05:30:45 am
Nanyu: attached is a linux project file. your code compiles and loads fine on my ubuntu machine. Setting an open file to read-only seemed to do the right thing. I haven't really had time to test it beyond that.


thank you . the dll files what you mean is :

wxmsw28u_gcc_cb.dll
wxmsw28u_media_gcc_custom.dll

where in the CodeBlocks folder?

for wxmsw28u_gcc_cb.dll see
http://wiki.codeblocks.org/index.php?title=Linking_the_plugin_to_a_Nightly_Build

I recommend setting up a new target, say "nightly", the uses a global variable pointing to the location of the dll's. that'll save some messing around when you want to create different builds.

[attachment deleted by admin]
Title: Re: The first plugin I written : "AutoReadonly"
Post by: nanyu on February 23, 2009, 03:53:04 pm
to dmoore: thanks!
------------------------------
I got it!