Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: ptDev on March 07, 2011, 02:46:03 pm

Title: New plugin: CodePaste
Post by: ptDev on March 07, 2011, 02:46:03 pm
I made a simple plugin that adds the "Paste online" option to the edit menu. It allows to paste code online on pastebin.com, which is useful for people who exchange source code snippets frequently. I recently added a number of features that should make it useful. The source code (Windows only so far) is attached to this post. Extract the files to (your C::B source directory)\plugins\contrib\CodePaste before building.

UPDATE: Can now be checked out from http://codepaste-plugin-codeblocks.googlecode.com/svn/trunk/ (http://codepaste-plugin-codeblocks.googlecode.com/svn/trunk/).

A screenshot (attached) shows the configurable settings.

[attachment deleted by admin]
Title: Re: New plugin: CodePaste
Post by: tibsi on March 18, 2011, 02:43:23 pm
thanx could you post the *.cbplugin file too?
Title: Re: New plugin: CodePaste
Post by: ptDev on March 18, 2011, 03:42:23 pm
My configuration is not binary compatible with the configuration used by the C::B Team, hence my .cbplugin file will not even run with a nightly build... For this reason, I'm sorry I don't provide this file. If you can compile it, however, it's possible to export a .cbplugin archive from the plugins manager dialog.
Title: Re: New plugin: CodePaste
Post by: tibsi on March 21, 2011, 09:39:46 am
well i guessed so

than can you help me compile this i always get some errors

Quote
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp||In member function 'virtual void CodePaste::BuildMenu(wxMenuBar*)':|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|72|warning: 'wxString wxMenuItemBase::GetLabel() const' is deprecated (declared at C:\wxWidgets-2.9.1\include/wx/menuitem.h:177)|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp||In member function 'virtual void CodePaste::BuildModuleMenu(ModuleType, wxMenu*, const FileTreeData*)':|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|96|warning: 'wxString wxMenuItemBase::GetLabel() const' is deprecated (declared at C:\wxWidgets-2.9.1\include/wx/menuitem.h:177)|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtProjectManager' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtLogManager' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtOpenFilesList' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtUnknown' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp||In member function 'void CodePaste::OnPasteBin(wxCommandEvent&)':|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|180|warning: comparison between signed and unsigned integer expressions|
.objs\CodePasteConfig.o||In function `ZNK14wxCheckBoxBase9IsCheckedEv':|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|69|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|70|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|69|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|70|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|69|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|70|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|69|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\checkbox.h|70|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
.objs\CodePasteConfig.o:C:\Users\Tibsi_\Desktop\CodePaste\CodePasteConfig.cpp|27|undefined reference to `_imp___ZN15wxItemContainer5ClearEv'|
.objs\CodePasteConfig.o||In function `ZN15wxItemContainer11InsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType':|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|145|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|147|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|147|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|154|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|154|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
.objs\CodePasteConfig.o:C:\Users\Tibsi_\Desktop\CodePaste\CodePasteConfig.cpp|32|undefined reference to `_imp___ZN15wxItemContainer5ClearEv'|
.objs\CodePasteConfig.o||In function `ZN15wxItemContainer11InsertItemsERK21wxArrayStringsAdapterjPPv16wxClientDataType':|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|145|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|147|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|147|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|154|undefined reference to `_imp__wxTheAssertHandler'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|154|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
.objs\CodePasteConfig.o||In function `ZN15wxItemContainer6InsertERK8wxStringj':|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|145|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
C:\wxWidgets-2.9.1\include\wx\ctrlsub.h|145|undefined reference to `_imp___Z10wxOnAssertPKciS0_S0_PKw'|
.objs\CodePasteConfig.o||In function `wxPanel':|
C:\wxWidgets-2.9.1\include\wx\generic\panelg.h|33|undefined reference to `_imp___ZN18wxControlContainerC1Ev'|
.objs\CodePasteConfig.o||In function `~wxControlContainerBase':|
C:\wxWidgets-2.9.1\include\wx\containr.h|48|undefined reference to `_imp___ZTV22wxControlContainerBase'|
.objs\CodePasteConfig.o||In function `wxGet_wxConvLibc':|
C:\wxWidgets-2.9.1\include\wx\strconv.h|574|undefined reference to `_imp__wxConvLibcPtr'|
C:\wxWidgets-2.9.1\include\wx\strconv.h|574|undefined reference to `_imp___Z19wxGet_wxConvLibcPtrv'|
C:\wxWidgets-2.9.1\include\wx\strconv.h|574|undefined reference to `_imp__wxConvLibcPtr'|
.objs\CodePasteConfig.o||In function `ZN8wxString7ImplStrEPKcRK8wxMBConv':|
C:\wxWidgets-2.9.1\include\wx\string.h|536|undefined reference to `_imp__wxConvLibcPtr'|
C:\wxWidgets-2.9.1\include\wx\string.h|536|undefined reference to `_imp___ZN8wxString4nposE'|
C:\wxWidgets-2.9.1\include\wx\string.h|536|undefined reference to `_imp___ZN8wxString10ConvertStrEPKcjRK8wxMBConv'|
.objs\CodePasteConfig.o||In function `ZN22wxScopedCharTypeBufferIwE11GetNullDataEv':|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
.objs\CodePasteConfig.o||In function `wxPanel':|
C:\wxWidgets-2.9.1\include\wx\generic\panelg.h|33|undefined reference to `_imp___ZN18wxControlContainerC1Ev'|
.objs\CodePasteConfig.o||In function `~wxControlContainerBase':|
C:\wxWidgets-2.9.1\include\wx\containr.h|48|undefined reference to `_imp___ZTV22wxControlContainerBase'|
.objs\CodePasteConfig.o||In function `wxGet_wxConvLibc':|
C:\wxWidgets-2.9.1\include\wx\strconv.h|574|undefined reference to `_imp__wxConvLibcPtr'|
C:\wxWidgets-2.9.1\include\wx\strconv.h|574|undefined reference to `_imp___Z19wxGet_wxConvLibcPtrv'|
C:\wxWidgets-2.9.1\include\wx\strconv.h|574|undefined reference to `_imp__wxConvLibcPtr'|
.objs\CodePasteConfig.o||In function `ZN8wxString7ImplStrEPKcRK8wxMBConv':|
C:\wxWidgets-2.9.1\include\wx\string.h|536|undefined reference to `_imp__wxConvLibcPtr'|
C:\wxWidgets-2.9.1\include\wx\string.h|536|undefined reference to `_imp___ZN8wxString4nposE'|
C:\wxWidgets-2.9.1\include\wx\string.h|536|undefined reference to `_imp___ZN8wxString10ConvertStrEPKcjRK8wxMBConv'|
.objs\CodePasteConfig.o||In function `ZN22wxScopedCharTypeBufferIwE11GetNullDataEv':|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
C:\wxWidgets-2.9.1\include\wx\buffer.h|185|undefined reference to `_imp___ZN9wxPrivate18GetUntypedNullDataEv'|
.objs\CodePasteConfig.o||In function `~wxControlContainerBase':|
C:\wxWidgets-2.9.1\include\wx\containr.h|48|undefined reference to `_imp___ZTV22wxControlContainerBase'|
C:\wxWidgets-2.9.1\include\wx\containr.h|48|undefined reference to `_imp___ZTV22wxControlContainerBase'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 7 warnings ===|
Title: Re: New plugin: CodePaste
Post by: MortenMacFly on March 21, 2011, 10:15:59 am
than can you help me compile this i always get some errors
First you should start with using the right wxWidgets version. v2.9.1 is experimental! The proposed version for C::B development is either v2.8.10 or v2.8.11.
Title: Re: New plugin: CodePaste
Post by: tibsi on March 21, 2011, 11:24:20 am
ok thanx

Now i use the v2.8.11 but i still get one of those

Quote
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp||In member function 'virtual void CodePaste::BuildModuleMenu(ModuleType, wxMenu*, const FileTreeData*)':|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtProjectManager' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtLogManager' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtOpenFilesList' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|87|warning: enumeration value 'mtUnknown' not handled in switch|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp||In member function 'void CodePaste::OnPasteBin(wxCommandEvent&)':|
C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|180|warning: comparison between signed and unsigned integer expressions|
.objs\CodePaste.o:C:\Users\Tibsi_\Desktop\CodePaste\CodePaste.cpp|156|undefined reference to `_imp___ZN11wxScintilla15GetSelectedTextEv'|
||=== Build finished: 1 errors, 5 warnings ===|
Title: Re: New plugin: CodePaste
Post by: ptDev on March 21, 2011, 11:36:30 am
UPDATE: I just successfully rebuilt it here. It compiles and links fine. The problem seems to be that you're using an older version of the SDK. You should checkout the source code from the svn trunk and try again.



Title: Re: New plugin: CodePaste
Post by: killerbot on June 07, 2012, 07:46:22 am
HI, is the latest code for this available ?

I would like to try it out, bring it also to linux (if possible), and when it looks table enough, maybe make a contrib plug-in out of it ....
Title: Re: New plugin: CodePaste
Post by: ptDev on June 11, 2012, 11:29:18 pm
HI, is the latest code for this available ?

I would like to try it out, bring it also to linux (if possible), and when it looks table enough, maybe make a contrib plug-in out of it ....

Hi,

I just recently had a chance to look again at it.
I don't recall ever making a *-unix.cbp project for it, but I believe the code is perfectly portable.

I'll upload it to a server and provide you with an svn link to checkout from...

EDIT: I just changed the first post, the url for checking out is http://codepaste-plugin-codeblocks.googlecode.com/svn/trunk/.