Writing plugins -- Standard features for custom panels
Posted: Tue Aug 30, 2011 12:17 am
I'm writing a plugin that involves opening an editor window that is graphical instead of text-based. Because of this, it does not implement the IEditor interface. I suspect that this is the reason that several otherwise normal features aren't working.
Here are some problems I'm having:
svPanel.h:
svPanel.cpp:
swarmvis.cpp (main plugin file):
Am I correct in thinking that I'm having these problems because I'm not implementing IEditor? If so, is there a way for me to fix any of these issues without implementing it?
Here are some problems I'm having:
- When opening a file with one of these windows, the MainBook does not switch to it, even though m_mgr->SelectPage() returns true.
- Saving is not enabled when an svPanel is selected
- Undo/redo are not enabled when an svPanel is selected.
svPanel.h:
Code: Select all
class svPanel : public wxScrolledWindow
{
private:
svDocument *m_document; // created in svPanel constructor
...
public:
svPanel(wxWindow* parent, wxFileName file);
...
};
Code: Select all
svPanel::svPanel(wxWindow* parent, wxFileName file) : wxScrolledWindow(parent)
{
m_document = new svDocument(this, file);
...
}
Code: Select all
// Open bool SwarmVis::DoOpenWithSwarmVis(wxFileName& file)
{
if (file.GetExt() == wxT(SV_EXTENSION)) // SV_EXTENSION is a #define
{
svPanel *svp = new svPanel(m_mgr->GetTheApp()->GetTopWindow(), file);
m_mgr->AddEditorPage(svp, file.GetFullName());
m_mgr->SelectPage(svp); // This returns true, but doesn't actually select the page. Shouldn't AddEditorPage() select it anyway?
return true;
}
return false;
}