Author Topic: The first plugin I written : "AutoReadonly"  (Read 7871 times)

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
The first plugin I written : "AutoReadonly"
« 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
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]
« Last Edit: November 20, 2008, 07:22:13 pm by nanyu »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9594
Re: The first plugin I written : "AutoReadonly"
« Reply #1 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: [Select]
bool IsActiveEdtiorReadonly()
{
    IsEditorReadonly(GetActiveEditor());
}
I believe what you meant was something like this:
Code: [Select]
bool IsActiveEdtiorReadonly()
{
    return IsEditorReadonly(GetActiveEditor());
}
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: The first plugin I written : "AutoReadonly"
« Reply #2 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 .:))
« Last Edit: November 20, 2008, 07:21:04 pm by nanyu »

Offline mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 586
Re: The first plugin I written : "AutoReadonly"
« Reply #3 on: November 20, 2008, 12:56:44 pm »
Hi nanyu,

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

Bye,

Mario

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: The first plugin I written : "AutoReadonly"
« Reply #4 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 :[

« Last Edit: November 24, 2008, 03:11:01 am by nanyu »

Offline mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 586
Re: The first plugin I written : "AutoReadonly"
« Reply #5 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

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: The first plugin I written : "AutoReadonly"
« Reply #6 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? :)

Offline mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 586
Re: The first plugin I written : "AutoReadonly"
« Reply #7 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

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: The first plugin I written : "AutoReadonly"
« Reply #8 on: January 10, 2009, 07:22:31 am »
who would help me ?

pls complie this plugin  in code::blocks with gcc 4.2.1 ?

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: The first plugin I written : "AutoReadonly"
« Reply #9 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?

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Re: The first plugin I written : "AutoReadonly"
« Reply #10 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
« Last Edit: February 04, 2009, 09:24:04 pm by XayC »

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: The first plugin I written : "AutoReadonly"
« Reply #11 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?

Online stahta01

  • Lives here!
  • ****
  • Posts: 6899
    • My Best Post
Re: The first plugin I written : "AutoReadonly"
« Reply #12 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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: The first plugin I written : "AutoReadonly"
« Reply #13 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]

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: The first plugin I written : "AutoReadonly"
« Reply #14 on: February 23, 2009, 03:53:04 pm »
to dmoore: thanks!
------------------------------
I got it!