Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

ThreadSearch plugin is born !

<< < (11/12) > >>

dje:
Hi all !

The 0.5 version of the ThreadSearch plugin is available.
What's new ??

* All Jérôme replaced by Jerome
* Added code to center line in preview editor on list single click.
* Added wxMutexGuiEnter() and wxMutexGuiLeave()
* Hard coded background color replaced by wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
Files:

* source code
* plugin

Remarks:

* BIG THANKS TO PECAN FOR MAKING ME KNOW ABOUT wxMutexGui... CALLS. That way, the plugin became far more stable on my Ubuntu. No crashes appended since I used those mutexes. Next Linux problem : it seems that wxGlade generated code does not behave the same way : the height of the editor/list is not managed correctly (scrollbars scale).
* line centering code is taken from cbEditor::GotoLine. Jamie, I thank you for the solution you proposed but I think this one is better.
* Thanks to Jamie, I use wxSYS_COLOUR_BTNFACE instead of wxSYS_COLOUR_WINDOW. I found that wxSYS_COLOUR_WINDOW was more appropriate in wxWidgets 2.6.3 documentation but it is nicer with wxSYS_COLOUR_BTNFACE

--- Quote ---text is pasted to my last position in the editor
--- End quote ---
Well... On XP, I have no problem but different problems appended on Ubuntu.
I'll have to dive into keyboard shortcuts management and event skipping...


--- Quote ---I guessed that was the case, on win32 I have used 'WaitForSingleObject' with 1ms time-out to work around this
--- End quote ---
I had thought about this solution. I'll implement it but I give it a low priority, as I think people do not often search for 'if' or 'wxString'.

Dje

jamieo:
Good work dje, I agree that your solution is better for the preview as it automatically centres regardless of control height (plus mine was a bit of a hack just to show an idea ;)).

I hope you don't mind but I have attached a patch which implements some ideas wrt maximising the use of space available, the results of which can be seen in the attached png.  It would be nice if you'd consider adding these ideas - possibly as a few optional settings tucked away in the config dialog?

Also, I've noted a couple of minor issues below - if I get time I'll look into them if you like?


* Searching a file that has been modified (and saved) since previously previewed produces correct search results but the preview is not re-loaded to show the changes.  To recreate search a file and preview the result so the file is loaded.  Then, type some text into the same file, save, and then search for that text.  The result for the new text will be listed but when clicked upon it will be missing from the preview.   I've over complicated the explanation a bit but basically the preview needs to be reloaded if the file has been saved since last previewed.


* Some items are not sorted as expected.  For an example, please see the attached png - it seems the the results are mostly sorted except for the odd result from another file that interrupts the series.

--- Quote ---I think people do not often search for 'if' or 'wxString'.
--- End quote ---
I think so too but it's damn annoying when you do and you can't cancel!!   :lol:

Jamie

[attachment deleted by admin]

dje:
Hi !


--- Quote ---possibly as a few optional settings tucked away in the config dialog?

--- End quote ---
OK, that's what I'll do. I'll keep current settings as default because they match the 'Search results' panel ones.


--- Quote ---Some items are not sorted as expected.
--- End quote ---
I had already noticed that point.
It happens only if you checked both 'Open files' and 'Project files' (as it seems to be on your picture).
For now, a wxSortedArrayString gathers all files from the different search scopes then the search is performed on each file.
All found items are appended to list control. I don't see for now why it behaves that why (but I didn't have time to debug it).
It could help me if you could have a look !


--- Quote ---I think so too but it's damn annoying when you do and you can't cancel!!
--- End quote ---
I'll improve it !


--- Quote ---Searching a file that has been modified (and saved) since previously previewed produces correct search results but the preview is not re-loaded to show the changes.
--- End quote ---

I noticed the 'not reloading' problem.
It can be a little tricky to look for file change, reload file and perform a list and preview refresh. How can you be sure to get the good line, I mean suppose you get current selected list item, you are not sure the same text won't be inserted, the text preview may not be focused on the selected item. In fact, I think it is a very hard thing to synchronize preview with file change and to be sure to do it well !
I chose this strategy because of the previous difficulty and because this strategy is the same as C::B 'Search in files'.

I know I often say 'I already saw that point', but it is true I developped this on a long time and tested it so that I thought and found lots of things (either minor problems or evolutions) I didn't write to avoid beginning the post with 200 pages  :D

Dje

jamieo:

--- Quote from: dje on March 20, 2007, 08:39:56 am ---OK, that's what I'll do. I'll keep current settings as default because they match the 'Search results' panel ones.
--- End quote ---
Cool, I look forward to your next build!  :)


--- Quote ---It happens only if you checked both 'Open files' and 'Project files'.
--- End quote ---
Ah...  I had not investigated it but can confirm unticking 'Open files' does the trick for now, cheers...  I will try to look into it.


--- Quote ---I think it is a very hard thing to synchronize preview with file change and to be sure to do it well !
--- End quote ---
I didn't explain it very well so I think we misunderstand each other.  I'm not referring to unsaved changes made to a file, I mean if a change is made and then saved but the older version is already in the preview it won't get updated until you first preview a different file because of the following code which is there for good reason.


--- Code: ---// Loads file if different from current loaded
if ( m_PreviewFilePath != sFile )

--- End code ---

I have two suggestions to improve this (neither I know how to do in wxWidgets  - I'll look into it, but you may be able to do it more easily)...

Either save the file modified time with the file name and then compare them as well, ex:


--- Code: ---// Loads file if different from current loaded
if ( (m_PreviewFilePath != sFile) || ( newFiletime != oldFiletime ) )

--- End code ---

Or, hook into codeblocks somewhere so whenever a file is saved you reload your preview if it's the same file.  I'm sure there are other ways..


--- Quote ---I know I often say 'I already saw that point', but it is true.
--- End quote ---
Hey, I don't mind - the points I've raised are of the more obvious, usability type so that's why I started my first post saying 'it's possible they are already on your todo list...'   :)

jamieo:
Here's a patch that'll hopefully explain the file preview thing better (and fix it too!) ;)

To test:

* Perform a search so the preview is loaded with a file
* In the same file that is currently previewed, type some obscure text
* Save the file!
* Right click the new text and 'find occurrences...'
The new text should be listed as a search result but won't be previewed as the file isn't reloaded, the purpose of this patch is to fix that.  :)

Jamie

[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version