BOOL CPluginFrame2::Initialize()
{
	m_pMainFrame = (CMainFrame*) AfxGetApp ()->m_pMainWnd;
	m_bMoreTabs = _App.View_MoreTabs ();

	
	if (FALSE == _PluginMgr.LoadPlugins (this))
		return FALSE;

	int cMenuImages;

	for (int i = 0; i < _PluginMgr.GetPluginCount (); i++)
	{
		fsPluginInfo &plug = _PluginMgr.Plugin (i);
		if (i < 3 || m_bMoreTabs)
			m_wndTabs.InsertItem (i, plug.strName);
		else if (i == 3)
			m_wndTabs.InsertItem (i, ">>");

		::ShowWindow (plug.hWnd, SW_HIDE);
		
		if (plug.pbmpMenuImages)
		{
			
			cMenuImages = m_pMainFrame->m_imgsTool.GetImageCount ();
			m_pMainFrame->m_imgsTool.Add (plug.pbmpMenuImages, RGB (255, 0, 255));
			m_pMainFrame->m_dimgsTool.Add (plug.pbmpMenuDImages, RGB (255, 0, 255));
			delete plug.pbmpMenuImages;
			delete plug.pbmpMenuDImages;
			plug.pbmpMenuImages = plug.pbmpMenuDImages = NULL;
			
			

			int j = 0;
			for (j = 0; j < plug.cMenuMainImages; j++)
			{
				plug.pMenuMainImages [j].iCheckImage += cMenuImages;
				plug.pMenuMainImages [j].iImage += cMenuImages;
			}

			for (j = 0; j < plug.cMenuViewImages; j++)
			{
				plug.pMenuViewImages [j].iCheckImage += cMenuImages;
				plug.pMenuViewImages [j].iImage += cMenuImages;
			}
		}
	}

	int iPlug = _App.ActivePlugin ();
	if (iPlug >= _PluginMgr.GetPluginCount () || iPlug < 0)
		iPlug = 0;
	if (m_bMoreTabs == FALSE && iPlug > 2)
		iPlug = 0;

	SetActivePlugin (iPlug);

	return TRUE;
}
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);
}
예제 #3
0
BOOL CPlugToolBar::Initialize()
{
    m_pMainFrame = (CMainFrame*) AfxGetApp ()->m_pMainWnd;


    if (FALSE == _PluginMgr.LoadPlugins (m_pPlugFrame))
        return FALSE;

    int cMenuImages;

    for (int i = 0; i < _PluginMgr.GetPluginCount (); i++)
    {
        fsPluginInfo &plug = _PluginMgr.Plugin (i);
        AddString (plug.strName);
        ::ShowWindow (plug.hWnd, SW_HIDE);

        if (plug.pbmpMenuImages)
        {

            cMenuImages = m_pMainFrame->m_imgsTool.GetImageCount ();
            m_pMainFrame->m_imgsTool.Add (plug.pbmpMenuImages, RGB (255, 0, 255));
            m_pMainFrame->m_dimgsTool.Add (plug.pbmpMenuDImages, RGB (255, 0, 255));
            delete plug.pbmpMenuImages;
            delete plug.pbmpMenuDImages;
            plug.pbmpMenuImages = plug.pbmpMenuDImages = NULL;



            for (int j = 0; j < plug.cMenuMainImages; j++)
            {
                plug.pMenuMainImages [j].iCheckImage += cMenuImages;
                plug.pMenuMainImages [j].iImage += cMenuImages;
            }

            for (int j = 0; j < plug.cMenuViewImages; j++)
            {
                plug.pMenuViewImages [j].iCheckImage += cMenuImages;
                plug.pMenuViewImages [j].iImage += cMenuImages;
            }
        }
    }

    int iPlug = _App.ActivePlugin ();
    if (iPlug >= _PluginMgr.GetPluginCount () || iPlug < 0)
        iPlug = 0;

    SetActivePlugin (iPlug);

    return TRUE;
}
예제 #4
0
void CPlugToolBar::OnClickItem(int iItem)
{
    SetActivePlugin (iItem);
}