Author Topic: ThreadSearch plugin is born !  (Read 23508 times)

Offline dje

  • Lives here!
  • ****
  • Posts: 683
ThreadSearch plugin is born !
« on: March 13, 2007, 09:52:46 pm »
Hi all !!

The "ThreadSearch" plugin offers the following features:
  • multi-threaded "Search in files"
  • preview of the results (left single click on log window)
  • file open (left double click on log window)
  • check boxes instead of radio boxes to allow searches with both project and directories for example.
  • contextual menu "Find occurrences" to start a search in files with the word under cursor (can be activated or not)

Why ?
  • I am working on very big projects (700 Mo of cpp, h files) and text searches take up to 5 minutes. It is very frustrating being blocked because of the search. It is now possible to continue editing code during searches.
  • I do not like leaving the editor position to browse 'Search in files' resuts. There is now the 'Code preview' to do this with possibility to open the file at the right position.


Please note :
  • The provided dll is release unicode (windows only for now).
  • Even if beta version, it is stable (I've been using it for 2 months).
  • Tested only on 3 XP SP2 PCs, personal and professional editions.

Installation :
Now a few questions :
I would like to release the source code in the contrib plugins. Do I make a SVN patch?
How do I get rights to modify my code without SVN patching ?

Remarks :
  • I duplicated the cbFindReplaceData in my project because it is declared in cbeditor.cpp. Any problem moving it to cbeditor.h ?? Can send the patch ?
  • My search strategy is inspired from the find in files one (use of an hidden cbEditor) but is not a raw copy. What do I need to do to comply with GPL licence ?
  • You may have noticed there is only Windows XP version. I need help to translate Windows codeblocks project to other platforms and to build the dedicated binaries.

For sure, I am interesting in your opinions concerning this plugin !

Dje

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: ThreadSearch plugin is born !
« Reply #1 on: March 13, 2007, 10:05:42 pm »
Sorry, no success here:
Code: [Select]
[22:04:01.828]: ERROR: E:\Devel\CodeBlocks_Devel/share/codeblocks/plugins/ThreadSearch.dll: not loaded (missing symbols?)
[22:04:01.843]: Failed
Seems it's build against a non up-to-date SDK. But: Sounds interesting anyway. ;-)
With regards, Morten.
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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: ThreadSearch plugin is born !
« Reply #2 on: March 13, 2007, 10:20:50 pm »
Sorry again, forgotton to answer the second part (which I kind of overlooked):
I'd suggest first posting the plugin sources here for testing and maybe announcing it in the WiKi under plugins section. Once you believe that you have received enough feedback it *could* be added to contrib at C::B SVN (by mandrav). But: You could also create your own SVN repository as it is done with quite some other plugins. You could even use BerliOS as platform if you like. The advantage: You have full control over the sources and the repository itself yourself.
With regards, Morten.
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 dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #3 on: March 13, 2007, 10:23:56 pm »
I updated my environment to SVN 3672 and rebuilt my plugin.

I had problems with install and uninstall. All worked in my development environment but install/uninstall systematically failed when installing in the nightly build the exported plugin.

To solve this, I replaced the static libs (wxScintilla, wxWidgets and CodeBlocks) from my development environment by the corresponding nightly dlls (suggested by Mandrav).

I am using GCC 3.4.5.

I compiled the plugin with several different nightlies and tried it with several ones without rebuilding it. I had no problem.

Did you try with a nightly build or your SVN environment (I saw devel in your log) ?

Could you try with a recent nightly if you tested it on SVN environment ?

Dje

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2165
Re: ThreadSearch plugin is born !
« Reply #4 on: March 13, 2007, 10:41:18 pm »
You may have noticed there is only Windows XP version. I need help to translate Windows codeblocks project to other platforms and to build the dedicated binaries.

You have a good idea going here.

Suggestion:

Support Linux.

Download andLinux. Install it. Install CodeBlocks under andLinux, recompile CB and test your plugin.

When you support Linux,as all the other contribs do, you'll have a better chance of getting it added to the Contribs.

andLinux is a Linux distrubution using coLinux and ubuntu that runs under windows XP. You don't have to reboot or reserve a partition.

http://wiki.gp2x.org/wiki/AndLinux
http://forums.codeblocks.org/index.php/topic,4549.0.html

XP running CB under Linux under Windows with wxWidgets help file and WinExplorer. Linux is running from the E:\andLinux directory.


« Last Edit: March 13, 2007, 11:05:44 pm by Pecan »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: ThreadSearch plugin is born !
« Reply #5 on: March 13, 2007, 10:41:28 pm »
Did you try with a nightly build or your SVN environment (I saw devel in your log) ?
Could you try with a recent nightly if you tested it on SVN environment ?
Yes - I only use my own development version, usually. I'll try to install a nightly but have to save my config first that I can switch back afterwards. Will do that tomorrow... time to go for me for today... :mrgreen:
With regards, Morten.
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 dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #6 on: March 13, 2007, 10:49:34 pm »
Wiki annoucenments page has been updated.

I prefer join ThreadSearch plugin to the contrib plugins once the current problem is solved unless Mandrav doesn't want to.

My source code is in the ThreadSearch.zip zip.
Just extract it to the <...>\codeblocks\src\plugins\contrib directory.

Don't forget to change the linker settings, I use the nihtly dlls and paths are relative to my install.
I think I'll create a variable to make it portable for integration.

I created my panels with wxGlade and my pngs with PortableGIMP

Dje

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #7 on: March 13, 2007, 11:28:41 pm »
Quote
Suggestion:

Support Linux.

I installed Ubuntu 6.10, wxGTK, C::B nightly, SVN and updated a development environment.

As I am the perfect newbee and don't have a lot of time, I progress  :) but slowly  :?
I thought to the poor Linux users who can not use this wonderful plugin... That's why I asked for help.

Dje

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: ThreadSearch plugin is born !
« Reply #8 on: March 13, 2007, 11:43:21 pm »
Quote
I prefer join ThreadSearch plugin to the contrib plugins once the current problem is solved unless Mandrav doesn't want to.

Why wouldn't I want to? If it delivers what it promises ;).
Besides, as I told you in a PM, we were already considering of making it a core plugin but unfortunately we didn't have the time to test it. So putting it in as a contrib plugin would be the way to go for now.

I will build it in linux tomorrow and if all goes well (and after the mandatory testing ;)), we will consider adding it as a contrib plugin.
Be patient!
This bug will be fixed soon...

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5177
Re: ThreadSearch plugin is born !
« Reply #9 on: March 14, 2007, 07:29:48 am »
cool, gonna start (finally  :oops:) using it. Too bad all day meeting today :-( .
For me : if it is stable --> contrib fo sure.

@Yiannis : when somebody creates a plugin --> .cbplugin, it would be nice that we could somehow also put the png's in that package so they also get installed automatically. What do you think ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: ThreadSearch plugin is born !
« Reply #10 on: March 14, 2007, 07:50:04 am »
Sorry for being dumb, but where do I actually access the plugin? It did compile/load fine now, but I can't see any menu for this feature...?! What am I missing?!
With regards, Morten.
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 dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #11 on: March 14, 2007, 08:20:00 am »
Hi !

Quote
where do I actually access the plugin?

In the view menu, there is a 'Thread search' entry that makes a 'Thread search' panel appears in the Messages notebook.

Another solution is to open a file and right-click on it; by default, a 'Find occurrences of' entry is added below the 'Find implementation of' entry. This allows running a search of the word under cursor.

Searches history is stored in the combo box; it can also be used to run searches.

To configure it, you can go to the 'Settings/Environment' panel and go at the bottom or click on the 'Options' button of the panel.


Quote
would be nice that we could somehow also put the png's in that package so they also get installed automatically
I asked for this in another thread; the manifest file is should be used for this but it is not implemented for now.

Dje

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: ThreadSearch plugin is born !
« Reply #12 on: March 14, 2007, 09:07:32 am »
In the view menu, there is a 'Thread search' entry that makes a 'Thread search' panel appears in the Messages notebook.
Ah sorry - I have been blind. So I've tested it a little and I'm  quite impressed! Nicely done! :D
Hence there are a few points I'd like to state:
1.) The GUI looks pretty broken (as you can see on the first screenshot attached) if C::B isn't maximised
2.) (For the future) a menu entry in the "Search" menu would be nice - that's where I would have expected the functionality. I guess it's enough activating and switching to the panel when clicking on that menu entry.
3.) Displaying the found item in another editor next to the search results is nice in principle, but I believe with most layouts of C::B this won't be of much help as the editor window is just too small. Why not opening a "big" (usual) editor instead (I guess you have reasons for that)?
4.) If you enable the "dir items" things get worse for me. I usually keep the message panel quite small and then it looks like the other screenshot attached. I'm not sure how to handle this any better... But: If this goes to core all worries are gone because then it would replace the current find dialog.

In the end that's all I have to say. I think it's great... no, wait a second: it's GREAT! ;-) Very fast search, nicely presented / configurable... well done! My worries above maybe a point for discussion but I believe they are minor in the end.

With regards, Morten.

[attachment deleted by admin]
« Last Edit: March 14, 2007, 09:09:49 am by MortenMacFly »
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 dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #13 on: March 14, 2007, 10:35:07 am »
First, thanks for congratulations !

Quote
The GUI looks pretty broken
It's true I systematically use C::B in maximised mode; I'll try to find how to add scroll bars (does not seem too difficult) but more space will be wasted whereas they appear because of the few available space...
There no miracle but 50'' screen  :)

Quote
I guess it's enough activating and switching to the panel when clicking on that menu entry.
Yes, I'll add another menu entry in the Search menu with the same event ID as in the view menu.
Is this what you mean ?

Quote
Why not opening a "big" (usual) editor instead (I guess you have reasons for that)?
Yes, I have  :D
In fact, when I read code, I often search for items but leaving my current position to switch to another place in the same file bores me a lot : where was I in this wonderful 20000 lines file I got back :evil:
Another thing, I often need to browse method calls to see how it works and the use context. But I want to keep the editor I am working on in the same state. In this case, I either change Messages notebook size or I play (a lot) with F2 to switch Messages notebook visibility : far more efficient !
Note that single click on a result line previews the code whereas double click opens a "big" (usual) editor

Quote
If you enable the "dir items" things get worse for me. I usually keep the message panel quite small and then it looks like the other screenshot attached. I'm not sure how to handle this any better...
I was aware of this problem, that's why there is the 'Hid dir items' button. Data are managed but you spare one line of controls space. You do not need to display dirs items to perform search in directories.

Dje

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: ThreadSearch plugin is born !
« Reply #14 on: March 14, 2007, 10:48:13 am »
Yes, I'll add another menu entry in the Search menu with the same event ID as in the view menu.
Is this what you mean ?
Yes, exactly. ;-)

In fact, when I read code, I often search for items but leaving my current position to switch to another place in the same file bores me a lot : where was I in this wonderful 20000 lines file I got back :evil:
I understand - BTW: I'm using the bookmark feature for that purposes. But I agree this can be annoying.

with F2 to switch Messages notebook visibility : far more efficient !
Ok then. The only thing that worries me (haven't tried yet) are those "mini" editors writable? Because that would be evil! You would have to take care about syncing with any other open editor of the same file. If this is not already done: Please make the mini editors at least read-only.

Note that single click on a result line previews the code whereas double click opens a "big" (usual) editor
Oh great! I didn't try - and yes, it works! 8)

You do not need to display dirs items to perform search in directories.
That's right... maybe what you had said above with the scrollbars would be another option. But in the end I think when it comes down to replacing the "old" find dialog with this one you might not need all that control functionality in the panel and/or enable toggling visibility of certain settings even more options.

With regards, Morten.
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