Exemple #1
0
DatabaseExplorer::DatabaseExplorer(IManager* manager)
    : IPlugin(manager)
{

    // create tab (possibly detached)
    Notebook* book = m_mgr->GetWorkspacePaneNotebook();
    wxWindow* editorBook = m_mgr->GetEditorPaneNotebook();

    EventNotifier::Get()->Connect(wxEVT_TREE_ITEM_FILE_ACTIVATED,
                                  clCommandEventHandler(DatabaseExplorer::OnOpenWithDBE), NULL, this);
    EventNotifier::Get()->Bind(wxEVT_SHOW_WORKSPACE_TAB, &DatabaseExplorer::OnToggleTab, this);

    if(IsDbViewDetached()) {
        DockablePane* cp = new DockablePane(book->GetParent()->GetParent(), book, _("DbExplorer"), false, wxNullBitmap,
                                            wxSize(200, 200));
        m_dbViewerPanel = new DbViewerPanel(cp, editorBook, m_mgr);
        cp->SetChildNoReparent(m_dbViewerPanel);

    } else {

        m_dbViewerPanel = new DbViewerPanel(book, editorBook, m_mgr);
        // size_t index = GetSettings().GetSvnTabIndex();
        // if(index == Notebook::npos)
        book->AddPage(m_dbViewerPanel, _("DbExplorer"), false);
        // else
        //	book->InsertPage(index, m_dbViewerPanel, svnCONSOLE_TEXT, false);
    }
    m_mgr->AddWorkspaceTab(_("DbExplorer"));

    // configure autolayout algorithns
    wxSFAutoLayout layout;

    wxSFLayoutHorizontalTree* pHTreeAlg =
        wxDynamicCast(layout.GetAlgorithm(wxT("Horizontal Tree")), wxSFLayoutHorizontalTree);
    if(pHTreeAlg) pHTreeAlg->SetHSpace(200);

    wxSFLayoutVerticalTree* pVTreeAlg =
        wxDynamicCast(layout.GetAlgorithm(wxT("Vertical Tree")), wxSFLayoutVerticalTree);
    if(pVTreeAlg) pVTreeAlg->SetVSpace(75);

    m_longName = _("DatabaseExplorer for CodeLite");
    m_shortName = wxT("DatabaseExplorer");

    clKeyboardManager::Get()->AddGlobalAccelerator("wxEVT_EXECUTE_SQL", "Ctrl-J", _("Execute SQL"));
    wxTheApp->Bind(wxEVT_MENU, &DatabaseExplorer::OnExecuteSQL, this, XRCID("wxEVT_EXECUTE_SQL"));
}
DatabaseExplorer::DatabaseExplorer(IManager *manager)
	: IPlugin(manager)
	, m_addFileMenu(true) {

	// create tab (possibly detached)
	Notebook *book = m_mgr->GetWorkspacePaneNotebook();
	wxWindow *editorBook = m_mgr->GetEditorPaneNotebook();

	m_mgr->GetTheApp()->Connect(XRCID("erd_open"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(DatabaseExplorer::OnOpenWithDBE), NULL, this);
	m_mgr->GetTheApp()->Connect(XRCID("erd_open"), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(DatabaseExplorer::OnUpdateOpenWithDBE), NULL, this);
	EventNotifier::Get()->Connect(wxEVT_TREE_ITEM_FILE_ACTIVATED, wxCommandEventHandler(DatabaseExplorer::OnOpenWithDBE), NULL, this);

	if( IsDbViewDetached() ) {
		DockablePane *cp = new DockablePane(book->GetParent()->GetParent(), book, wxT("DbExplorer"), wxNullBitmap, wxSize(200, 200));
		m_dbViewerPanel = new DbViewerPanel(cp, editorBook, m_mgr  );
		cp->SetChildNoReparent(m_dbViewerPanel);

	} else {

		m_dbViewerPanel = new DbViewerPanel(book, editorBook, m_mgr );
		//size_t index = GetSettings().GetSvnTabIndex();
		//if(index == Notebook::npos)
		book->AddPage(m_dbViewerPanel,  wxT("DbExplorer"), false);
		//else
		//	book->InsertPage(index, m_dbViewerPanel, svnCONSOLE_TEXT, false);
	}

	// configure autolayout algorithns
	wxSFAutoLayout layout;

	wxSFLayoutHorizontalTree *pHTreeAlg = wxDynamicCast( layout.GetAlgorithm( wxT("Horizontal Tree") ), wxSFLayoutHorizontalTree );
	if( pHTreeAlg ) pHTreeAlg->SetHSpace( 200 );

	wxSFLayoutVerticalTree *pVTreeAlg = wxDynamicCast( layout.GetAlgorithm( wxT("Vertical Tree") ), wxSFLayoutVerticalTree );
	if( pVTreeAlg ) pVTreeAlg->SetVSpace( 75 );


	m_longName = _("DatabaseExplorer for CodeLite");
	m_shortName = wxT("DatabaseExplorer");
}