Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
ThreadSearch 0.7 release
Pecan:
I notice when I try to paste a search string into the search window, it pastes it into the editor instead.
What's that all about?
Pecan:
Here are the diffs that allow the .zip to contain all the .png files.
Thank you dmoore
ThreadSearch.cpp
--- Code: ---c:\Usr\Proj\ThreadSearch>C:\Usr\bin\GnuWin32\bin\diff.exe -u --strip-trailing-cr E:\User\Downloads\_Pending\cbPlugins\temp\ThreadSearch\ThreadSearch.cpp ThreadSearch.cpp
--- E:\User\Downloads\_Pending\cbPlugins\temp\ThreadSearch\ThreadSearch.cpp 2007-06-28 21:12:28.000000000 -0500
+++ ThreadSearch.cpp 2007-06-29 18:08:03.953125000 -0500
@@ -250,8 +250,7 @@
{
// set log image
wxBitmap bmp;
- wxString prefix = ConfigManager::GetDataFolder() + _T("/images/16x16/");
- bmp = cbLoadBitmap(prefix + _T("filefind.png"), wxBITMAP_TYPE_PNG);
+ bmp = wxXmlResource::Get()->LoadBitmap(_T("findf"));
m_ThreadSearchId = pMsgMan->AddLog(m_pThreadSearchView, _T("Thread search"), bmp);
}
@@ -501,13 +500,12 @@
m_pToolbar = toolBar;
m_pThreadSearchView->SetToolBar(toolBar);
- wxString prefix = ConfigManager::GetDataFolder() + _T("/images/16x16/");
wxComboBox* pCboSearchExpr = new wxComboBox (toolBar, idCboSearchExpr, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN);
- wxBitmapButton* pBtnSearch = new wxBitmapButton(toolBar, idBtnSearch, wxBitmap(prefix + wxT("findf.png"), wxBITMAP_TYPE_PNG));
- wxBitmapButton* pBtnOptions = new wxBitmapButton(toolBar, idBtnOptions, wxBitmap(prefix + wxT("options.png"), wxBITMAP_TYPE_PNG));
+ wxBitmapButton* pBtnSearch = new wxBitmapButton(toolBar, idBtnSearch, wxXmlResource::Get()->LoadBitmap(_T("findf")));
+ wxBitmapButton* pBtnOptions = new wxBitmapButton(toolBar, idBtnOptions, wxXmlResource::Get()->LoadBitmap(_T("options")));
- pBtnSearch->SetBitmapDisabled(wxBitmap(prefix + wxT("findfdisabled.png"), wxBITMAP_TYPE_PNG));
- pBtnOptions->SetBitmapDisabled(wxBitmap(prefix + wxT("optionsdisabled.png"), wxBITMAP_TYPE_PNG));
+ pBtnSearch->SetBitmapDisabled(wxXmlResource::Get()->LoadBitmap(_T("findfdisabled")));
+ pBtnOptions->SetBitmapDisabled(wxXmlResource::Get()->LoadBitmap(_T("optionsdisabled")));
toolBar->AddControl(pCboSearchExpr);
toolBar->AddControl(pBtnSearch);
--- End code ---
ThreadSearchView.cpp
--- Code: ---c:\Usr\Proj\ThreadSearch>C:\Usr\bin\GnuWin32\bin\diff.exe -u --strip-trailing-cr E:\User\Downloads\_Pending\cbPlugins\temp\ThreadSearch\ThreadSearchView.cpp ThreadSearchView.cpp
--- E:\User\Downloads\_Pending\cbPlugins\temp\ThreadSearch\ThreadSearchView.cpp 2007-06-28 21:46:04.000000000 -0500
+++ ThreadSearchView.cpp 2007-06-29 18:47:14.171875000 -0500
@@ -8,6 +8,8 @@
* License: GPL
**************************************************************/
+#include <wx/xrc/xmlres.h>
+
#include "messagemanager.h"
#include "configmanager.h"
#include "configurationpanel.h"
@@ -924,13 +926,13 @@
wxString prefix = ConfigManager::GetDataFolder() + _T("/images/16x16/");
- wxString searchButtonPathsEnabled[] = {prefix + wxT("findf.png"),
- prefix + wxT("stop.png") ,
- wxEmptyString};
-
- wxString searchButtonPathsDisabled[] = {prefix + wxT("findfdisabled.png"),
- prefix + wxT("stopdisabled.png") ,
- wxEmptyString};
+ wxString searchButtonPathsEnabled[] = {wxT("findf"),
+ wxT("stop") ,
+ wxEmptyString};
+
+ wxString searchButtonPathsDisabled[] = {wxT("findfdisabled"),
+ wxT("stopdisabled") ,
+ wxEmptyString};
// Gets toolbar search button pointer
wxBitmapButton* pToolBarSearchBtn = static_cast<wxBitmapButton*>(m_pToolBar->FindControl(idBtnSearch));
@@ -939,8 +941,8 @@
if ( label != skip )
{
m_pBtnSearch->SetLabel(searchButtonLabels[label]);
- pToolBarSearchBtn->SetBitmapLabel (wxBitmap(searchButtonPathsEnabled [label], wxBITMAP_TYPE_PNG));
- pToolBarSearchBtn->SetBitmapDisabled(wxBitmap(searchButtonPathsDisabled[label], wxBITMAP_TYPE_PNG));
+ pToolBarSearchBtn->SetBitmapLabel (wxXmlResource::Get()->LoadBitmap(searchButtonPathsEnabled [label]));
+ pToolBarSearchBtn->SetBitmapDisabled(wxXmlResource::Get()->LoadBitmap(searchButtonPathsDisabled [label]));
}
// Sets enable state
--- End code ---
ThreadImages.xrc to be put in ThreadSearch.zip
--- Code: ---<?xml version="1.0" encoding="utf-8"?>
<resource>
<object class="wxBitmap" name="findf">findf.png</object>
<object class="wxBitmap" name="findfdisabled">findfdisabled.png</object>
<object class="wxBitmap" name="options">options.png</object>
<object class="wxBitmap" name="optionsdisabled">optionsdisabled.png</object>
<object class="wxBitmap" name="stop">stop.png</object>
<object class="wxBitmap" name="stopdisabled">stopdisabled.png</object>
<object class="wxBitmap" name="ThreadSearch">ThreadSearch.png</object>
<object class="wxBitmap" name="ThreadSearchoff">ThreadSearch-off.png</object>
</resource>
--- End code ---
Contents of ThreadSearch.zip
--- Code: ---findf.png
findfdisabled.png
options.png
optionsdisabled.png
stop.png
stopdisabled.png
ThreadSearch.png
ThreadSearch-off.png
manifest.xml
ThreadImages.xrc
--- End code ---
Post Build Step
--- Code: ---zip -j9 .\ThreadSearch.zip manifest.xml *.png ThreadImages.xrc
zip -j9 ThreadSearch.cbplugin .\bin\debug\ThreadSearch.dll .\ThreadSearch.zip
--- End code ---
dje:
Hi all !
--- Quote from: dje on June 30, 2007, 12:41:21 am ---So, now:
* Morten's bug fix (crash on plugin disable).
--- End quote ---
The naughty bug is FIXED :D :D :D :D :D
I had misunderstood a part of plugins management.
I tought that disable = uninstall without removing dll/zip but in fact, a plugin instance exists even it plugin is disabled.
The following OnRelease method solves the problem on XP. It see no reason why it could be different on Linux but it is not tested yet.
--- Code: ---void ThreadSearch::OnRelease(bool appShutDown)
{
// do de-initialization for your plugin
// if appShutDown is false, the plugin is unloaded because Code::Blocks is being shut down,
// which means you must not use any of the SDK Managers
// NOTE: after this function, the inherited member variable
// m_IsAttached will be FALSE...
// Removes Thread search menu item from the View menu
RemoveMenuItems();
m_pToolbar = NULL;
// Saves configuration to default.conf
SaveConfig(m_ThreadSearchId != -1);
wxASSERT(m_pThreadSearchView != NULL);
if ( m_ThreadSearchId != -1 )
{
// As id is != from -1, ThreadSearchView is managed by MessageManager
// We remove it from the notebook
MessageManager* pMsgMan = Manager::Get()->GetMessageManager();
wxASSERT(pMsgMan != NULL);
pMsgMan->RemoveLog(m_pThreadSearchView);
m_ThreadSearchId = -1;
}
m_pThreadSearchView->Destroy();
m_pThreadSearchView = NULL;
}
--- End code ---
Thanks to Pecan and Dmoore for pngs embedding code, i'll have a look at it.
I confirm the paste bug. The same happens with copy from the preview editor.
It does not work anymore with keyboard shortcuts but works with contextual menus.
EDIT: Paste works with default target (nightly build environment) but not with DevDebug target (debug development environment).
EDIT: Copy from preview editor does not works (whereas it did).
This is a regression but I don't see at first glance where it comes from.
Dje
Pecan:
--- Quote from: Pecan on June 30, 2007, 01:02:09 am ---I notice when I try to paste a search string into the search window, it pastes it into the editor instead.
What's that all about?
--- End quote ---
Found it. CodeBlocks main.cpp UpdateUI is enabling Edit/Paste for the editors only.
So when you paste into the search combo box, it ends up in the editor.
Pecan:
--- Quote from: dje on June 30, 2007, 03:34:42 pm ---
I confirm the paste bug. The same happens with copy from the preview editor.
It does not work anymore with keyboard shortcuts but works with contextual menus.
EDIT: Paste works with default target (nightly build environment) but not with DevDebug target (debug development environment).
EDIT: Copy from preview editor does not works (whereas it did).
This is a regression but I don't see at first glance where it comes from.
--- End quote ---
I've found the cause of the copy/paste bug. And am working up a fix for it now.
It's a bug in the way CB main.cpp handles the clipboard/copy/paste events. It always thinks the paste is for the current editor even when the editor DOES NOT have the focus.
Edit: I've tested the work-around and will paste a diff.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version