Author Topic: Incremental Search  (Read 40232 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Incremental Search
« Reply #15 on: October 07, 2008, 06:39:19 pm »
Looks good, though highlighting didn't work for me at all.
Might be the same problem taht Mario has (and me with XP on my Laptop as I just found out).

The hint for "Select only" should be changed to "Selected text" to be consistent with the search dialogue. The highlight colour is very decent, so it is not easy to see the highlighting on a laptop screen, perhaps it should be customizable.

It's no problem to make it customizable, the only problem is the method for highlighting (scintillas indicators).
It's never really colourful.
That also happens to Highlight occurences.
If anybody knows a better method to highlight text in (wx)Scintilla, please post it.

I have to sleep in a hotel this night (because of work), so I have (hopefully) time enough to do the changes.

I can commit it as contrib-plugin later, if no errors or problems with other parts of C::B come up.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Incremental Search
« Reply #16 on: October 08, 2008, 02:55:07 pm »
... I splitted the topic about wxScintilla in an own thread, available via:
http://forums.codeblocks.org/index.php/topic,9335.0.html
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Incremental Search
« Reply #17 on: October 10, 2008, 06:36:19 pm »
I commited Incremental search this afternoon.
I also patched (wx)scintilla, to add a new more colourful indicator.
Highlight occurences also uses it now.

In "Settings -> Editor" there is a configuration panel for IncSearch, where you can change the used colours and chose, whether the found text should be centered on screen (if possible) or not.

Offline rhf

  • Multiple posting newcomer
  • *
  • Posts: 123
Re: Incremental Search
« Reply #18 on: October 10, 2008, 06:50:09 pm »
rhf : the thread is splitted, please post here: http://forums.codeblocks.org/index.php/topic,9289.0.html.
OK. Repeat of previous post: I just updated with SVN 5253 and experimented with Incremental Search. It appears to work properly; however, the toolbar buttons for Prev, Next, etc do not appear. There is just a single large button with no icons.  This is on Windows XP.
Thanks for adding a nice feature.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Incremental Search
« Reply #19 on: October 10, 2008, 08:39:28 pm »
rhf : the thread is splitted, please post here: http://forums.codeblocks.org/index.php/topic,9289.0.html.
OK. Repeat of previous post: I just updated with SVN 5253 and experimented with Incremental Search. It appears to work properly; however, the toolbar buttons for Prev, Next, etc do not appear. There is just a single large button with no icons.  This is on Windows XP.
Thanks for adding a nice feature.
I tested it on Linux, w2k and winxp sp2, and it works on all platforms.

How did you compile it.
Did you use clean svn-version or did you patch the code manually before.

Maybe a screenshot would be helpful.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Incremental Search
« Reply #20 on: October 10, 2008, 09:32:41 pm »
well it seems it doesn't even build :-(

Quote
IncrementalSearch.cpp: In member function 'virtual void IncrementalSearch::BuildMenu(wxMenuBar*)':
IncrementalSearch.cpp:115: error: 'class wxMenuItem' has no member named 'GetLabelText'
IncrementalSearch.cpp:115: error: 'class wxMenuItem' has no member named 'GetItemLabelText'
make[4]: *** [IncrementalSearch.lo] Error 1
make[4]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib/IncrementalSearch'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src'
make: *** [all-recursive] Error 1
Though I haven't find the cause yet, I committed already a first part of a fix wrt includes. Don't include pch's in header files. There's more to follow ...

EDIT : on one linux box I got it already working (did make clean and brand new ./configure), trying that recipe on the failing linux box ...

EDIT2 : this issue remains, the only difference between my 2 linux boxes is :32 bit versus 64 bit. On the 64 bit it does NOT build.

Anyone else who is able to  build it on linux 64 bit ??
« Last Edit: October 11, 2008, 11:07:40 am by killerbot »

Offline rhf

  • Multiple posting newcomer
  • *
  • Posts: 123
Re: Incremental Search
« Reply #21 on: October 10, 2008, 11:05:01 pm »
How did you compile it.
Did you use clean svn-version or did you patch the code manually before.
I just updated to SVN 5258 and built CodeBlocks.cbp and ContribPlugins.workspace and ran update.bat.
The icons still do not show in the IncrementalSearch toolbar.
I am using tdm-mingw-1.808.3 which uses gcc 4.3.2. (There could of course be a bug with this compiler.)

Maybe a screenshot would be helpful.
Well I tried but couldn't figure out how to insert a screenshot. I have attached (I hope) the file ScnShot.jpg which shows the effect.
Even though the toolbar buttons do not show, when I move the mouse over the toolbar the various hints do appear.



[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Incremental Search
« Reply #22 on: October 11, 2008, 12:53:15 pm »
@killerbot:

I build on 64-bit linux without problems, in any versions (mine, the one changed by you and the versions I just committed).

Before I commited the plugin I tested it on linux (64-bit and 32-bit), w2k and winxp with clean svn-versions from inside a clean svn-tree.
What I did not test is compiling without precompiled-headers.
That, and maybe the use of "wxprec.h" in a header, are in my opinion the only real mistakes I made.

Inspite of not changing the debian-files and the .spec-file. (I use a patched debian version for my nightlies, so I just forgot it, and I don't know anything about rpm-building, because I did not use rpm-based linuxes since more then five years now).

Leaving the virtual declaration in the header-files is not an error, even if it is unneded. But if you don't like it, why didn't you remove it from both header-files ?

I did it and removed some comments from the headers, I also removed includes that are not needed, neither for compiled with, nor without precompiled headers (tested on linux and winxp).

I wonder why you cannot compile on 64-bit.
I compiled it with wxWidgets 2.8.7  and 2.8.9 on win, and 2.8.9 on linux.

EDIT:
I use gcc 4.2 on linux and win.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Incremental Search
« Reply #23 on: October 11, 2008, 01:00:21 pm »
How did you compile it.
Did you use clean svn-version or did you patch the code manually before.
I just updated to SVN 5258 and built CodeBlocks.cbp and ContribPlugins.workspace and ran update.bat.
The icons still do not show in the IncrementalSearch toolbar.
I am using tdm-mingw-1.808.3 which uses gcc 4.3.2. (There could of course be a bug with this compiler.)

Maybe a screenshot would be helpful.
Well I tried but couldn't figure out how to insert a screenshot. I have attached (I hope) the file ScnShot.jpg which shows the effect.
Even though the toolbar buttons do not show, when I move the mouse over the toolbar the various hints do appear.



Are the images inside "IncrementalSearch.zip" (it should be in "share/CodeBlocks").
The images are in the subfolder "images" and "images/16x16" inside the zip-file.

Do you have an image in the "Search -> Incremental Search" MenuItem ? It is in the same zip-file.
Have you tried to remove the zip from "src/devel/share/CodeBlocks"  and "src/output/share/CodeBlocks" before building ?

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Incremental Search
« Reply #24 on: October 11, 2008, 02:51:24 pm »
Quote
Leaving the virtual declaration in the header-files is not an error, even if it is unneded. But if you don't like it, why didn't you remove it from both header-files ?
No that's not an error. But I think it is preferred to have people no longer derive from this class, since it is a concrete class. The fact I didn't remove them all, sloppy me  :oops:

As a last resort I will try with a clean svn checkout, because I still does not build :-(

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Incremental Search
« Reply #25 on: October 11, 2008, 04:25:37 pm »
no luck :fresh checkout from svn repo

Quote
g++ -DHAVE_CONFIG_H -I. -I. -I../../../../src/include -I/usr/lib64/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../../../src/include -I../../../../src/include/wxscintilla/include -Ulinux -Uunix -O2 -ffast-math -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT IncrementalSearch.lo -MD -MP -MF .deps/IncrementalSearch.Tpo -c IncrementalSearch.cpp  -fPIC -DPIC -o .libs/IncrementalSearch.o
IncrementalSearch.cpp: In member function 'virtual void IncrementalSearch::BuildMenu(wxMenuBar*)':
IncrementalSearch.cpp:127: error: 'class wxMenuItem' has no member named 'GetLabelText'
IncrementalSearch.cpp:127: error: 'class wxMenuItem' has no member named 'GetItemLabelText'
make[4]: *** [IncrementalSearch.lo] Error 1
make[4]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib/IncrementalSearch'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src'
make: *** [all-recursive] Error 1

g++ (GCC) 4.1.2
wx : 2.8.4

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Incremental Search
« Reply #26 on: October 11, 2008, 04:35:16 pm »
wx : 2.8.4

That's the problem "GetLabelText" and "GetItemLabelText" are in wxWidgets since 2.8.5.

I can add a version-guard and use the older functions if wxGtk is too old.

EDIT:
That means you have a more recent version on 32-bit linux, right?

EDIT2:
It would be nice if you could test the following code instead the original one:
Code
#if wxCHECK_VERSION(2,8,5)
if (items[i]->GetLabelText(items[i]->GetItemLabelText()) == _("Find previous"))
#else
if (items[i]->GetLabelFromText(items[i]->GetLabel()) == _("Find previous"))
#endif

I can't test it, because I do not have wxWidgets 2.8.4 anymore.
I it works I will commit it.
« Last Edit: October 11, 2008, 04:50:53 pm by jens »

Offline rhf

  • Multiple posting newcomer
  • *
  • Posts: 123
Re: Incremental Search
« Reply #27 on: October 11, 2008, 05:08:31 pm »
Are the images inside "IncrementalSearch.zip" (it should be in "share/CodeBlocks").
The images are in the subfolder "images" and "images/16x16" inside the zip-file.
No, the images are not there.

Do you have an image in the "Search -> Incremental Search" MenuItem ? It is in the same zip-file.
No. The icon does not show up in the Menu either.

Have you tried to remove the zip from "src/devel/share/CodeBlocks"  and "src/output/share/CodeBlocks" before building ?
Well I use the standard update.bat file obtained via SVN. The images appear to be unzipped in the two dirs
C:\CodeBlocks_SVN\src\plugins\contrib\IncrementalSearch\images  and
C:\CodeBlocks_SVN\src\plugins\contrib\IncrementalSearch\images\16x16,
but apparently they are not getting copied to the appropriate devel\share\CodeBlocks\... and output\share\CodeBlocks\... sub-directories.
The update.bat file in C:\CodeBlocks_SVN\src\plugins\contrib\IncrementalSearch does copy two .png files to the \share\CodeBlocks\settings directories. I don't know if the other image .png files are copied somewhere else.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Incremental Search
« Reply #28 on: October 11, 2008, 05:31:06 pm »
Are the images inside "IncrementalSearch.zip" (it should be in "share/CodeBlocks").
The images are in the subfolder "images" and "images/16x16" inside the zip-file.
No, the images are not there.

Compile IncrementalSearch with the attached project file. I suspect recursive addition of image file is not working here (this was affecting Linux builds, too).  :)

[attachment deleted by admin]
Be a part of the solution, not a part of the problem.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Incremental Search
« Reply #29 on: October 11, 2008, 05:44:42 pm »
wx : 2.8.4

That's the problem "GetLabelText" and "GetItemLabelText" are in wxWidgets since 2.8.5.

I can add a version-guard and use the older functions if wxGtk is too old.

EDIT:
That means you have a more recent version on 32-bit linux, right?

EDIT2:
It would be nice if you could test the following code instead the original one:
Code
#if wxCHECK_VERSION(2,8,5)
if (items[i]->GetLabelText(items[i]->GetItemLabelText()) == _("Find previous"))
#else
if (items[i]->GetLabelFromText(items[i]->GetLabel()) == _("Find previous"))
#endif

I can't test it, because I do not have wxWidgets 2.8.4 anymore.
I it works I will commit it.

I can test it either, since I have upgraded my wx to 2.8.9 on my 64-bit linux box. And now it builds correctly :-)