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

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #30 on: March 14, 2007, 11:48:27 pm »
Thanks for the improvement.

What about this point :
Quote
To use it in my SVN environment, I use the generated static libs.
To use it with a nightly, I link directly with the corresponding dlls.

I need to link with *.a to work with my development environment.
I need to link with nightly *.dll to work with the nightly.

As I said :
Quote
I suspect the link because I didn't apply C::B team wxWidgets patch for menu alignement in my development environment.

It seems to be the development project version, which may not be appropriate for nightly builds production.
Do you think the use of virtual targets is recommended in this case ?

Dje

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: ThreadSearch plugin is born !
« Reply #31 on: March 14, 2007, 11:55:40 pm »
I need to link with *.a to work with my development environment.
I need to link with nightly *.dll to work with the nightly.
[...]
Do you think the use of virtual targets is recommended in this case ?
I wouldn't make things too complicated. I'd say just provide the sources (which will ensure enough tester I believe) and (maybe) ask killerbot to include this plugin in the nightlys if you want a wider spectrum of testers. Everything else is simply too error-prone.
Once the next C::B version comes out there will also be a SDK released. At that point one can think about shipping *.cbplugin files build against this "static" SDK. For now this isn't much useful... IMHO.
with regards, Morten.
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

mariocup

  • Guest
Re: ThreadSearch plugin is born !
« Reply #32 on: March 15, 2007, 01:38:50 pm »
Hi dje,

I have tried the new Plugin (under windows) and it is really nice. I am using UTF-8 character encoding for my files and if I search with ThreadSearch plugin the preview of special characters (e.g. ü in german) is not correct. What default character encoding is used for this Plugin (CP1252)?

Thanks.

Bye

Mario

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2775
Re: ThreadSearch plugin is born !
« Reply #33 on: March 15, 2007, 02:02:16 pm »
I ran the .04 source on Linux this morning after adding to ThreadSearch.cpp :

#include "messagemanager.h"
#include "configmanager.h"
#include "sdk_events.h"

It compiles just fine. But the search doesn't work. It takes the search string, starts a thread, then goes zombie. So I'm guessing the thread ends, but no attention is paid to it. It's hung.

Also, after the thread starts, any resize of any window in CB causes refreshes to freeze. The main menu or task bars even disappear. This might be evidence that an event is stuck in the event queue, not allowing other events to get through.

« Last Edit: March 15, 2007, 06:45:49 pm by Pecan »

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #34 on: March 15, 2007, 06:33:09 pm »
Quote
What default character encoding is used for this Plugin (CP1252)?
I don't know... :oops:
In fact, I use the same search strategy as in 'Search in files', ie using a hidden cbStyledTextControl to search in file for me.
I keep the point and I'll have a look on how it is managed in C::B.
Do you have the same problem with Code::Blocks editors ?

Pecan, I am working on setting up a working environment on Ubuntu 6.10.
I am blocked for now with the problem discussed in another thread
I read your remarks with big interest.

Dje

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2775
Re: ThreadSearch plugin is born !
« Reply #35 on: March 15, 2007, 06:40:47 pm »
If you're going to compile on ubuntu, you're going to need this:

ThreadSearch-Lunix.cbp

Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="ThreadSearch-Lunix" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="debug">
<Option output="bin/debug/ThreadSearch.so" prefix_auto="1" extension_auto="1" />
<Option type="3" />
<Option compiler="gcc" />
<Option host_application="codeblocks" />
<Compiler>
<Add option="`pkg-config --cflags codeblocks`" />
<Add option="`wx-config --cflags`" />
<Add option="-g" />
</Compiler>
<Linker>
<Add option="`pkg-config --libs codeblocks`" />
<Add option="`wx-config --libs`" />
</Linker>
<ExtraCommands>
<Add after="zip -j9 ThreadSearch.zip manifest.xml" />
<Add after="zip -j9 ThreadSearch.cbplugin ThreadSearch.so ThreadSearch.zip" />
</ExtraCommands>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add directory="$(#cb)/include" />
<Add directory="$(#cb)/include/wxFlatNotebook/include" />
<Add directory="$(#cb)/include/wxscintilla/include" />
<Add directory="$(#wx)/include" />
</Compiler>
<Unit filename="DirectoryParamsPanel.cpp" />
<Unit filename="DirectoryParamsPanel.h" />
<Unit filename="FindDataUtils.cpp" />
<Unit filename="FindDataUtils.h" />
<Unit filename="SearchInPanel.cpp" />
<Unit filename="SearchInPanel.h" />
<Unit filename="ThreadSearch.cbp" />
<Unit filename="ThreadSearch.cpp" />
<Unit filename="ThreadSearch.h" />
<Unit filename="ThreadSearchConfPanel.cpp" />
<Unit filename="ThreadSearchConfPanel.h" />
<Unit filename="ThreadSearchControlIds.h" />
<Unit filename="ThreadSearchEvent.cpp" />
<Unit filename="ThreadSearchEvent.h" />
<Unit filename="ThreadSearchThread.cpp" />
<Unit filename="ThreadSearchThread.h" />
<Unit filename="ThreadSearchView.cpp" />
<Unit filename="ThreadSearchView.h" />
<Unit filename="manifest.xml" />
<Extensions>
<code_completion />
</Extensions>
</Project>
</CodeBlocks_project_file>


I call it "-Lunix" because the .so file is output only to the local directory. I install and test the .so after the code compiles cleanly.

You can make a production ThreadSearch-unix.cbp later.

I'll do some debugging soon, to see why the thread hangs/or never notifies the plugin.
« Last Edit: March 15, 2007, 06:44:17 pm by Pecan »

mariocup

  • Guest
Re: ThreadSearch plugin is born !
« Reply #36 on: March 15, 2007, 10:24:20 pm »
Hi dje,

you are right the same problem occurs with find in files within the Code::Blocks editor?
Under linux utf-8 is the default encoding, so I will try the same with Code::Blocks under linux to see what happens.

Bye

Mario



Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #37 on: March 15, 2007, 11:03:56 pm »
Mario, did you try to play with the "Edit\File encoding" sub menu (at least for editors) ?
You may have a look at the "Settings\Editor" then "General settings" to set default encoding for file open.

Dje
« Last Edit: March 15, 2007, 11:06:03 pm by dje »

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #38 on: March 16, 2007, 12:35:21 am »
Merging Pecan's and Killerbot's remarks I added the magical lines
Code
#include <sdk.h> // Code::Blocks SDK
#ifndef CB_PRECOMP
#include "messagemanager.h"
#include "configmanager.h"
#include "sdk_events.h"
#endif

And I have finally a complete running environment on Linux.

Quote
But the search doesn't work. It takes the search string, starts a thread, then goes zombie. So I'm guessing the thread ends, but no attention is paid to it. It's hung.

Also, after the thread starts, any resize of any window in CB causes refreshes to freeze. The main menu or task bars even disappear. This might be evidence that an event is stuck in the event queue, not allowing other events to get through.

I had the problem but it is strange... Some widgets are no more refreshed whereas other still continue to behave correctly.

Let's test C::B debugger ! :)

mariocup

  • Guest
Re: ThreadSearch plugin is born !
« Reply #39 on: March 16, 2007, 10:35:28 am »
Hi dje,

I tried the same file with UTF-8 under linux. The Search in files show the correct character encoding. Code:Blocks does not use the character encoding of the file or the settings of the editor, but the system default encoding.
Under linux it is UTF-8 so the find in files or threadsearch plugin will show the correct content (also for special characters like ü), but windows has a different system default encoding.


Bye,

Mario

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #40 on: March 16, 2007, 11:03:31 am »
Hi Mario, did you try this on Windows ?
Quote
Mario, did you try to play with the "Edit\File encoding" sub menu (at least for editors) ?
You may have a look at the "Settings\Editor" then "General settings" to set default encoding for file open.

Dje

mariocup

  • Guest
Re: ThreadSearch plugin is born !
« Reply #41 on: March 16, 2007, 12:12:20 pm »
Hi dje,

I use the same settings in Code::Blocks under windows and linux. I have selected Edit\File encoding UTF-8 for the file and UTF-8 for file open in Settings\Editor.
The find in files show the correct content under linux, but not under windows, because the system default encoding under linux is UTF-8 and under windows ISO-8859-1.

Just try to wirte a text under windows with the content like:
Dies ist ein üä Test.
and save it with UTF-8 character encoding. Now open the file with codeblocks and search for "ist" with find in files.

Bye

Mario


Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch plugin is born !
« Reply #42 on: March 16, 2007, 07:03:37 pm »
For me it works.
Did you apply UTF-8 as default encoding as suggested in
Quote
You may have a look at the "Settings\Editor" then "General settings" to set default encoding for file open.
or as on the picture Encoding.gif ?

Dje

[attachment deleted by admin]

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2775
Re: ThreadSearch plugin is born !
« Reply #43 on: March 17, 2007, 06:01:45 pm »
It took me two hours to figure out that as long as Jerome is spelled with the little backward quote and the little "house top", the ususal CB Find-in-files will not work under linux.

I tried utf-8 and a bunch of 8859 setting and nothing worked until I change "J`er^ome"  to "Jerome" under windows, then copied the files back to Linux.

Anybody got any idea why this happens?


Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2775
Re: ThreadSearch plugin is born !
« Reply #44 on: March 17, 2007, 06:20:10 pm »
I have a fundamental, maybe stupid, question.

ThreadSearch does the searches using a hidden cbStyledTextCtrl.

Threads are not allowed to do GUI calls without carefull critical sections.

Even though the cbSTC is hidden, aren't GUI calls being made from this background thread?



« Last Edit: March 17, 2007, 11:05:28 pm by Pecan »