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

Code snippet plugin

<< < (9/12) > >>

artoj:

--- Quote from: Pecan on September 22, 2006, 07:32:12 pm ---You might implement that properties box I sent you, but make the textCtrl a wxTE_MULTILINE editor. That'd take the pressure off implementing an editor for awhile.

--- End quote ---

I've started implementing it a bit other way, through Code::Blocks' internal editor. It works similar to your implementation of the external editor:

- Hook to EVT_EDITOR_SAVE and EVT_EDITOR_CLOSE events
- When user clicks Edit, create a temporary file and put the snippet to it, record the file name
- Use C::B API to open the file
- On EVT_EDITOR_SAVE check if the file name is recorded, if it is, transfer the text from the file to the snippet
- On EVT_EDITOR_CLOSE check if the file name is recorded, if it is, remove it

This is how it works in general, although I need EVT_EDITOR_OPEN to check if the current tree item id has already a file open etc.

Pecan:

--- Quote from: artoj on September 22, 2006, 09:00:24 pm ---I've started implementing it a bit other way, through Code::Blocks' internal editor. It works similar to your implementation of the external editor:

--- End quote ---

Wonderful !!

Speaking of implementations...

Please find attached the Catagory/snippet dragging code. It allows the user to drag snippets into and out of another Catagory or drag Catagories into and out of other Catagories.

I implemented it as an xml document that simply extracts and inserts the tree items using your Load/Save snippet xml routines.

I believe that finishes my promised code.



[attachment deleted by admin]

artoj:

--- Quote from: Pecan on September 22, 2006, 10:16:23 pm ---Wonderful !!

Speaking of implementations...

Please find attached the Catagory/snippet dragging code. It allows the user to drag snippets into and out of another Catagory or drag Catagories into and out of other Catagories.

I implemented it as an xml document that simply extracts and inserts the tree items using your Load/Save snippet xml routines.

I believe that finishes my promised code.

--- End quote ---

Thanks! :)

Pecan:
Arto,

I've just discovered something great about CodeSnippets.

I can drag a forum url out of Firefox to a snippets category and it will create a snippet containing that url.

With the dragndrop additions I sent you, I can then drag the snippet back to Firefox, returning to that forum thread.

I was shocked!

I always wanted something like this. It's better than a bookmark because I can put the url along with/under the associated working code snippet category. Later, when I look back at the code snippet/file, the url discussion is right there.

Not only that, I can drag a bugReport/patch url to the relavent snippet category.
It's great!

I've made come changes to the dragndrop, specifically, 1) ability to automatically create an enclosing category when dragging a snippet to a snippet, 2) use of ctrl key to "copy" a snippet when dragging.

Have a look at the bottom of app.h to see the change log.
Maybe there's something there that you will find useful.
http://savefile.com/files/114566
Thanks
pecan

ps, Your code taught me to correctly spell category.

Edit: 2006/09/28 9:35
I've just discovered that a snippet catagory will *always* be created when dragging a snippet out of the tree. I'll fix this today. Just a heads up in case you find this problem in my code.

Pecan:

--- Quote from: Pecan on September 28, 2006, 03:29:32 pm ---I've just discovered that a snippet catagory will *always* be created when dragging a snippet out of the tree. I'll fix this today. Just a heads up in case you find this problem in my code.

--- End quote ---

Arto,

The problem was in CodeSnippetsWindow::OnEndDrag(). The very code I've hoped you'd check out. I'm embarrased.
 
Below is a corrected version.

http://savefile.com/files/115267
Direct link:
http://dl1u.savefile.com/59d423f987ffe01b56b777f3145577f5/cbSnipList3.zip

FileFactory:http://www.filefactory.com/file/957265/

Thanks
pecan

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version