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);
}
void CPluginFrame2::OnNewLng()
{
	m_wndTabs.DeleteAllItems ();

	int i = 0;
	for (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,  ">>");

		if (i == m_iActivePlugin)
		{
			m_pMainFrame->AddPluginMenu (plug->hMenuMain, plug->pMenuMainImages, plug->cMenuMainImages);
			m_pMainFrame->AddPluginMenuView (plug->hMenuView, plug->pMenuViewImages, plug->cMenuViewImages, plug->pMenuViewItems, plug->cMenuViewItems);
		}
	}

	if (m_bMoreTabs)
		m_wndTabs.InsertItem (i, "<<");

	m_wndTabs.SetCurSel (m_iActivePlugin);
}
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::OnSetFocus(CWnd* pOldWnd) 
{
	CWnd::OnSetFocus(pOldWnd);
	
	if (m_iActivePlugin != -1)
	{
		fsPluginInfo &plug = _PluginMgr.Plugin (m_iActivePlugin);
		::SetFocus (plug.hWnd);
	}
}
Exemple #5
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;
}
Exemple #6
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);
}
Exemple #7
0
void CPlugToolBar::OnNewLng()
{
    ResetContent ();

    for (int i = 0; i < _PluginMgr.GetPluginCount (); i++)
    {
        fsPluginInfo *plug = &_PluginMgr.Plugin (i);
        AddString (plug->strName);
        if (i == m_iActivePlugin)
        {
            m_pPlugFrame->SetFrameName (plug->strLongName);
            m_pMainFrame->AddPluginMenu (plug->hMenuMain, plug->pMenuMainImages, plug->cMenuMainImages);
            m_pMainFrame->AddPluginMenuView (plug->hMenuView, plug->pMenuViewImages, plug->cMenuViewImages, plug->pMenuViewItems, plug->cMenuViewItems);
        }
    }
}
void CPluginFrame2::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);

	if (cx && cy)
	{
		int tabcy = 23; 
		if (IsWindow (m_wndTabs.m_hWnd))
		{
			CRect rc;
			m_wndTabs.GetItemRect (0, &rc);
			tabcy = rc.bottom - rc.top;
			tabcy += 3;
			m_wndTabs.MoveWindow (0, 0, cx+10, tabcy);	
		}

		for (int i = 0; i < _PluginMgr.GetPluginCount (); i++)
			::MoveWindow (_PluginMgr.Plugin (i).hWnd, 0, tabcy, cx, cy - tabcy, TRUE);
	}
}
Exemple #9
0
void CPlugToolBar::SendPluginCommand(UINT uCmd)
{
    ::SendMessage (_PluginMgr.Plugin (m_iActivePlugin).hWnd, WM_COMMAND, uCmd, 0);
}