void CPluginFrame2::SetActivePlugin(int iPlugin)
{
	if (m_iActivePlugin == iPlugin)
		return;

	if (iPlugin == _PluginMgr.GetPluginCount ())
	{
		_App.View_MoreTabs (m_bMoreTabs = FALSE);
		int cur = m_iActivePlugin;
		if (cur > 2)
			cur = 0;
		m_wndTabs.DeleteAllItems ();
		int i = 0;
		for (i = 0; i < 3; i++)
			m_wndTabs.InsertItem (i, _PluginMgr.Plugin (i).strName);
		m_wndTabs.InsertItem (i, ">>");
		m_wndTabs.SetCurSel (cur);
		SetActivePlugin (cur);
		return;
	}

	if (m_bMoreTabs == FALSE && iPlugin >= 3)
	{
		_App.View_MoreTabs (m_bMoreTabs = TRUE);
		m_wndTabs.DeleteItem (3);
		int i;
		for (i = 3; i < _PluginMgr.GetPluginCount (); i++)
			m_wndTabs.InsertItem (i, _PluginMgr.Plugin (i).strName);
		m_wndTabs.InsertItem (i, "<<");
		m_wndTabs.SetCurSel (m_iActivePlugin);
		return;
	}

	if (m_iActivePlugin != -1)
	{
		
		

		::ShowWindow (_PluginMgr.Plugin (m_iActivePlugin).hWnd, SW_HIDE);
		m_pMainFrame->RemovePluginMenu ();
		m_pMainFrame->RemovePluginMenuView ();
		_TBMgr.HideGroup (m_iActivePlugin + 1);
	}

	m_iActivePlugin = iPlugin;
	
	fsPluginInfo &plug = _PluginMgr.Plugin (iPlugin);
	m_pMainFrame->AddPluginMenu (plug.hMenuMain, plug.pMenuMainImages, plug.cMenuMainImages);
	m_pMainFrame->AddPluginMenuView (plug.hMenuView, plug.pMenuViewImages, plug.cMenuViewImages, plug.pMenuViewItems, plug.cMenuViewItems);
	::ShowWindow (plug.hWnd, SW_SHOW);
	::SetFocus (plug.hWnd);
	_TBMgr.ShowGroup (m_iActivePlugin + 1, 0);

	_PluginMgr.OnSetActivePlugin (iPlugin);
	
	m_wndTabs.SetCurSel (m_iActivePlugin);
}
Beispiel #2
0
void CPlugToolBar::SetActivePlugin(int iPlugin)
{
    if (m_iActivePlugin == iPlugin)
        return;

    if (m_iActivePlugin != -1)
    {



        ::ShowWindow (_PluginMgr.Plugin (m_iActivePlugin).hWnd, SW_HIDE);
        m_pMainFrame->RemovePluginMenu ();
        m_pMainFrame->RemovePluginMenuView ();
        _TBMgr.HideGroup (m_iActivePlugin + 1);
    }

    int iOld = m_iActivePlugin;
    m_iActivePlugin = iPlugin;

    CRect rc;

    GetItemRect (iOld, &rc);
    InvalidateRect (&rc, FALSE);
    GetItemRect (iPlugin, &rc);
    InvalidateRect (&rc, FALSE);

    fsPluginInfo &plug = _PluginMgr.Plugin (iPlugin);
    m_pMainFrame->AddPluginMenu (plug.hMenuMain, plug.pMenuMainImages, plug.cMenuMainImages);
    m_pMainFrame->AddPluginMenuView (plug.hMenuView, plug.pMenuViewImages, plug.cMenuViewImages, plug.pMenuViewItems, plug.cMenuViewItems);
    m_pPlugFrame->SetPluginWindow (plug.hWnd);
    m_pPlugFrame->SetFrameName (plug.strLongName);
    ::ShowWindow (plug.hWnd, SW_SHOW);
    ::SetFocus (plug.hWnd);
    _TBMgr.ShowGroup (m_iActivePlugin + 1, 6);

    _PluginMgr.OnSetActivePlugin (iPlugin);
}