News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

The first plugin I written : "AutoReadonly"

Started by nanyu, November 19, 2008, 04:54:42 AM

Previous topic - Next topic

nanyu

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]

MortenMacFly

Quote from: nanyu on November 19, 2008, 04:54:42 AM
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:

bool IsActiveEdtiorReadonly()
{
    IsEditorReadonly(GetActiveEditor());
}

I believe what you meant was something like this:

bool IsActiveEdtiorReadonly()
{
    return IsEditorReadonly(GetActiveEditor());
}
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

nanyu

#2
QuoteFrom 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 .:))

mariocup

Hi nanyu,

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

Bye,

Mario

nanyu

#4
QuoteI 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 :[


mariocup

Hi nanyu,

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

Bye,

Mario

nanyu

Hi Mario, how about your  trade fair. Merry Christmas ! btw, how about your test for my plugin? :)

mariocup

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

nanyu

who would help me ?

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

nanyu

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?

XayC

#10
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

nanyu

Quote from: 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

thank you . the dll files what you mean is :

wxmsw28u_gcc_cb.dll
wxmsw28u_media_gcc_custom.dll

where in the CodeBlocks folder?

stahta01

Quote from: nanyu on February 05, 2009, 03:00:19 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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

dmoore

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.


Quote from: stahta01 on February 06, 2009, 03:34:05 AM
Quote from: nanyu on February 05, 2009, 03:00:19 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

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]
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

nanyu

to dmoore: thanks!
------------------------------
I got it!