Author Topic: Code snippet plugin  (Read 32825 times)

Offline artoj

  • Almost regular
  • **
  • Posts: 206
  • Location: Supporting my team
    • http://ajonsson.kapsi.fi/
Re: Code snippet plugin
« Reply #45 on: November 02, 2006, 04:37:25 pm »
I've commited some small changes to SVN. The editing of the snippets is written, but I'm very unhappy how it turned out; it's very complex and hacky (over 300 lines of new code). I have an alternative solution in mind and I'm going to investigate it further.

    Arto

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: Code snippet plugin
« Reply #46 on: April 03, 2007, 11:17:35 pm »
    CodeSnippets Version 1.1.53 2007/04/3


    Modifications:

      • Ability to save Snippets as external files
      • Ability to edit externally saved Snippet file
      • New Text vs File Link icons
      • Ability to Rearrange tree with Drag and Drop
      • Drag Snippet to Category
      • Drag Category to Category
      • Drag Snippet to Snippet creates new Category with old Snippet
      • Drag Snippets/Categories outward and inward.
      • Convert To Category context menu facility
      • Added drag snippet item outward (MSW) w/ both text/file drag formats
      • Dragging snippet File Link to CB opens the file.
      • Changed text editor to Scintilla
      • Added DragScrolling to Editor
      • Allow Editor/Properties DragNDrop in both directions
      • Expand first level Snippets on Startup
      • Check for externally modified XML file
      • Free resources & save index when Snippet window closes
      • Portability
      • User specified window placement
      • User specified XML placement
      • User specified external editor
      • Save XML index file menu entry
      • About info and context menu entry
      • Snippet Properties Dialog

      Note: Killerbot believes this commit has broken the Linux build.
      Until we can figure this out, Linux users using "make" should wait to update.

Offline mike__t

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code snippet plugin
« Reply #47 on: April 10, 2007, 02:46:30 am »
It didn't break my build on Linux, but the debugger hangs on startup when this plug-in is enabled.  Disabling it allows me to debug again.

-Mike

Offline Wahooney

  • Multiple posting newcomer
  • *
  • Posts: 34
  • Demon Onion Slayer
    • wahooney.net
Re: Code snippet plugin
« Reply #48 on: April 10, 2007, 03:50:01 pm »
There are three features that will make Code Snippets (which are damn handy already) even better, namely:

  • Pipe caret positioning, ie. /** | **/
  • Macro replacement, ie. $(classname)
  • Bind snippet to keyboard shortcut

The first two features are the same as those found in the abbreviation tool. It will make writing things like class definitions that much more practical in code snippets.

Thanks :)
Fabricati Diem, Celerata!

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: Code snippet plugin
« Reply #49 on: April 10, 2007, 07:47:18 pm »
It didn't break my build on Linux, but the debugger hangs on startup when this plug-in is enabled.  Disabling it allows me to debug again.

-Mike


Fixed: SVN 3823

Thanks for the report

Offline Wahooney

  • Multiple posting newcomer
  • *
  • Posts: 34
  • Demon Onion Slayer
    • wahooney.net
Re: Code snippet plugin
« Reply #50 on: May 04, 2007, 01:59:26 am »
I don't know if the pipe and macro functionality were there before or if you added it after, either way, thanks!!! It's such a kick ass tool now!
Fabricati Diem, Celerata!

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Code snippet plugin
« Reply #51 on: July 17, 2007, 11:14:04 pm »
Can the positioning of the tool be saved in a layout? I have a "Debug view" and a "Code view" and I save the "Code view" with the Snippets window docked where I want it to be. When I start a debugging session the "Debug view" is automatically started and when the debug session ends and the "Code view" is up again the Code Snippets window disappears. Such a beautiful little tool shouldn't be that shy ;-)
Life would be so much easier if we could just look at the source code.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: Code snippet plugin
« Reply #52 on: July 17, 2007, 11:37:42 pm »
Can the positioning of the tool be saved in a layout? I have a "Debug view" and a "Code view" and I save the "Code view" with the Snippets window docked where I want it to be. When I start a debugging session the "Debug view" is automatically started and when the debug session ends and the "Code view" is up again the Code Snippets window disappears. Such a beautiful little tool shouldn't be that shy ;-)

I'm have trouble picturing what you're describing.
Could you give me a "step-by-step" to recreate the problem so I can  test it myself?
« Last Edit: July 17, 2007, 11:39:44 pm by Pecan »

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Code snippet plugin
« Reply #53 on: July 17, 2007, 11:44:40 pm »
Gladly:

1. Make sure that Code Snippets dialog is visible
2. View->Layouts->Save Current->test (or whatever)
3. View->Layouts->Code::Blocks default
4. View->Layouts->test

In step 4. I would expect that the Code Snippets dialog would come up again but it doesn't. My main problem is what I described that I have registered a different layout for my debugging sessions that falls back to another one when the debugger finishes and I would like to have the Code Snippets dialog in my "default" layout.
Life would be so much easier if we could just look at the source code.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Code snippet plugin
« Reply #54 on: July 20, 2007, 03:48:50 pm »
PS: All you need to do to implement yop's request is to create the dockable in the plugin's OnAttach and remove it in OnRelease. Layout manager will automatically record its state. Don't add/remove the dockable outside of these places or you will just confuse the layout manager. To control display of Codesnippets, just use show/hide events in CodeBlocksDockEvents.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: Code snippet plugin
« Reply #55 on: July 20, 2007, 09:08:24 pm »
PS: All you need to do to implement yop's request is to create the dockable in the plugin's OnAttach and remove it in OnRelease. Layout manager will automatically record its state. Don't add/remove the dockable outside of these places or you will just confuse the layout manager. To control display of Codesnippets, just use show/hide events in CodeBlocksDockEvents.

Unfortunately, that's what it looks like I have to do.

It also means that all that data (the whole xml file) will be kept in memory when the window is hidden, even tho it isn't being referenced or used.

I'm getting more and more disappointed in wxAUI. It provides very little info (events) for the window owner, and forces awful inefficient use of resources by the programmer.


« Last Edit: July 20, 2007, 09:12:21 pm by Pecan »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Code snippet plugin
« Reply #56 on: July 20, 2007, 09:35:02 pm »
i think the version of AUI in wx2.8 offers more events. (I was under the impression you could at least receive close button notification for the dockables even under wx2.6)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: Code snippet plugin
« Reply #57 on: July 22, 2007, 06:22:43 am »
Can the positioning of the tool be saved in a layout? I have a "Debug view" and a "Code view" and I save the "Code view" with the Snippets window docked where I want it to be. When I start a debugging session the "Debug view" is automatically started and when the debug session ends and the "Code view" is up again the Code Snippets window disappears. Such a beautiful little tool shouldn't be that shy ;-)

fixed SVN 4288

Thanks for the report.

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Code snippet plugin
« Reply #58 on: July 22, 2007, 10:22:18 am »
Just updated, it's perfect.
Life would be so much easier if we could just look at the source code.

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re:
« Reply #59 on: June 06, 2010, 12:39:06 pm »
Sorry for bumping a really old thread, but I suppose that this is the correct place to post it.

I'm not sure if this issue is related to installing Code::Blocks in my box after building it, or (I bet for this last) launching C::B as a privileged user (yes, I started X as root, I know it's stupid), but the fact is that after that I've noted the existence of a /codeblocks folder in my root directory, only containing the standard codesnippets.ini. I suppose that this behavior is related to this plugin, and should be corrected.

My environment: Archlinux i686, gcc 4.5.0, wxGTK 2.8.11, C::B from svn repository (currently rev.6332).

Thanks.
Misquotations are the only quotations that are never misquoted