Пример #1
0
/*創建分頁-頁面增加*/
void CHM_MachineView::CreatePages()
{
    CDialog* dlg;
    dlg = new CMain;
    m_DlgArray.Add(dlg);
    dlg->Create(IDD_MAIN, m_TabCtrl);
    m_TabCtrl->InsertItem(0, _T("主頁面"));
    if (((CHM_MachineApp*)AfxGetApp())->Post == _T("工程師"))
    {
        dlg = new CCompiler;
        m_DlgArray.Add(dlg);
        dlg->Create(IDD_COMPILER, m_TabCtrl);
        m_TabCtrl->InsertItem(1, _T("編輯頁面"));
        dlg = new CParameter;
        m_DlgArray.Add(dlg);
        dlg->Create(IDD_PARAMETER, m_TabCtrl);
        m_TabCtrl->InsertItem(2, _T("參數設定"));
        dlg = new CIOState;
        m_DlgArray.Add(dlg);
        dlg->Create(IDD_IOSTATE, m_TabCtrl);
        m_TabCtrl->InsertItem(3, _T("I/O狀態"));
    } 
    OnTabSelChange(NULL, NULL);
    Invalidate();      
}
Пример #2
0
void CConfigWizard::AddBoard(LPRECT lpRect, LPCTSTR desc)
{
	CDialog *pDlg = new T;
	pDlg->Create(T::IDD, &m_bnBoardPlace);
	pDlg->MoveWindow(lpRect);
	pDlg->SetWindowText(desc);
	m_wizards.push_back(pDlg);
	m_lbStep.AddItem(0, desc);
}
Пример #3
0
VSTPluginLib *CSelectPluginDlg::ScanPlugins(const mpt::PathString &path, CWnd *parent)
//------------------------------------------------------------------------------------
{
	CVstPluginManager *pManager = theApp.GetPluginManager();
	VSTPluginLib *plugLib = nullptr;
	bool update = false;

	CDialog pluginScanDlg;
	pluginScanDlg.Create(IDD_SCANPLUGINS, parent);
	pluginScanDlg.CenterWindow(parent);
	pluginScanDlg.ModifyStyle(0, WS_SYSMENU, WS_SYSMENU);
	pluginScanDlg.ShowWindow(SW_SHOW);

	FolderScanner scan(path, true);
	mpt::PathString fileName;
	int files = 0;
	while(scan.NextFile(fileName) && pluginScanDlg.IsWindowVisible())
	{
		if(!mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".dll")))
		{
			CWnd *text = pluginScanDlg.GetDlgItem(IDC_SCANTEXT);
			std::wstring scanStr = L"Scanning Plugin...\n" + fileName.ToWide();
			::SetWindowTextW(text->m_hWnd, scanStr.c_str());
			MSG msg;
			while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
			{
				::TranslateMessage(&msg);
				::DispatchMessage(&msg);
			}

			VSTPluginLib *lib = pManager->AddPlugin(fileName, mpt::ustring(), false);
			if(lib)
			{
				update = true;
				if(!VerifyPlug(lib, parent))
				{
					pManager->RemovePlugin(lib);
				} else
				{
					plugLib = lib;
					files++;
				}
			}
		}
	}

	if(update)
	{
		// Force selection to last added plug.
		Reporting::Information(mpt::String::Print("Found %1 plugin%2.", files, files == 1 ? "" : "s").c_str(), parent);
		return plugLib;
	} else
	{
		Reporting::Error("Could not find any valid VST plugins.");
		return nullptr;
	}
}
Пример #4
0
//---------------------------------------------------------------------------
// Function name	: InsertPage
// Description	  : return -1 if an error occurs
//---------------------------------------------------------------------------
int	CRollupCtrl::InsertPage(const TCHAR* caption, UINT nIDTemplate, int idx)
{
	if (idx>0 && idx>=m_PageList.GetSize())		idx=-1;

	//Create Template
	CDialog* wndtemplate = new CDialog(nIDTemplate, this);
	BOOL b = wndtemplate->Create(nIDTemplate, this);
	if (!b)	{ delete wndtemplate; return -1; }

	//Insert Page
	return _InsertPage(caption, wndtemplate, idx, TRUE);
}
void CEle_Power_DecomposeView::CreatePages()
{
	CDialog*    dlg;

	dlg = new CTab1;
	m_DlgArray.Add(dlg);
	dlg->Create(IDD_DIALOG4, m_TabCtrl);
	m_TabCtrl->InsertItem(0, "    总表信息    ");

	dlg = new CTab2;
	m_DlgArray.Add(dlg);
	dlg->Create(IDD_DIALOG5, m_TabCtrl);
	m_TabCtrl->InsertItem(1, "    电器信息    ");

	dlg = new CTab3;
	m_DlgArray.Add(dlg);
	dlg->Create(IDD_DIALOG6, m_TabCtrl);
	m_TabCtrl->InsertItem(2, "    分析结果    ");
	
	
}
Пример #6
0
BOOL CMarkersPropertyPage::OnInitDialog() 
{
	CDialog     *pConfigDlg;
	CFileMarker *pMarker;
 int          Index;

	CResizablePage::OnInitDialog();
	
	// preset resize layout
	AddAnchor(IDC_SELECTION_CHECKLIST, TOP_LEFT,BOTTOM_LEFT);
	AddAnchor(IDC_SELECTION_FRAME,  TOP_LEFT,BOTTOM_LEFT);
	AddAnchor(IDC_SELECTION_INFO_FRAME,  TOP_LEFT,TOP_RIGHT);
	AddAnchor(IDC_SELECTION_DESCRIPTION,  TOP_LEFT,TOP_RIGHT);
	AddAnchor(IDC_SELECTION_CONFIG_FRAME, TOP_LEFT, BOTTOM_RIGHT);
	AddAnchor(IDC_PROPERTYSHEET,  TOP_LEFT, BOTTOM_RIGHT);
	AddAnchor(IDC_SELECTIONS_MAKE,  BOTTOM_LEFT);
 //

 // subclass checklistbox
 m_SelectionCheckList.SubclassDlgItem(IDC_SELECTION_CHECKLIST,this);
 //


	for (Index = 0; Index < g_DupeFileFind.GetFileSelectionArray()->GetSize(); Index++)
	{
		pMarker = g_DupeFileFind.GetFileSelectionArray()->GetAt(Index);
		pConfigDlg = pMarker->GetForm();
				
	 if (pConfigDlg)
		{
 		CRect rcSheet;
			pConfigDlg->Create(pMarker->GetFormID(), this);
			GetDlgItem( IDC_PROPERTYSHEET )->GetWindowRect( &rcSheet );
			ScreenToClient( &rcSheet );
			pConfigDlg->SetWindowPos( NULL, rcSheet.left-7, rcSheet.top-7, 0, 0, 	SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );
			pConfigDlg->UpdateData();
 	}
	 m_SelectionCheckList.AddString ( pMarker->GetName() );
  m_SelectionCheckList.SetItemData ( Index, (DWORD)pMarker );
	}

	if ( m_SelectionCheckList.GetCount() != 0 )
	{
		m_SelectionCheckList.SetCurSel(0);
  UpdateForm();	
	}


// CANNOT LOG HERE

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #7
0
//---------------------------------------------------------------------------
// Function name	: InsertPage
// Description	  : return -1 if an error occurs
//---------------------------------------------------------------------------
int CRollupCtrl::InsertPage(const TCHAR* caption, UINT nIDTemplate, CRuntimeClass* rtc, int idx)
{
	if (idx>0 && idx>=m_PageList.GetSize())		idx=-1;

	//Create Template
	ASSERT(rtc!=NULL);
	CDialog* wndtemplate = (CDialog*)rtc->CreateObject();
	BOOL b = wndtemplate->Create(nIDTemplate, this);
	if (!b)	{ delete wndtemplate; return -1; }

	//Insert Page
	return _InsertPage(caption, wndtemplate, idx, TRUE);
}
Пример #8
0
int CRollupCtrl::InsertPage(LPCTSTR caption, UINT nIDTemplate, CRuntimeClass* rtc, int idx)
{
	if (idx>0 && idx>=(int)m_PageList.size())		idx=-1;

	//Create Template
	ASSERT(rtc!=NULL);
	CDialog* pwndTemplate = (CDialog*)rtc->CreateObject();
	BOOL b = pwndTemplate->Create(nIDTemplate, this);
	if (!b)	{ delete pwndTemplate; return -1; }

	//Insert Page
	return _InsertPage(caption, pwndTemplate, idx, TRUE);
}
Пример #9
0
static CDialog* CreateChildDlg( int flag, long id, CWnd* pParent )
{
    // 创建对话框对象
    CDialog* pDlg = 0;
    switch( flag )
    {
    case 1:
        pDlg = new ChildDlg1();
        break;
    case 2:
        pDlg = new ChildDlg2();
        break;
    case 3:
        pDlg = new ChildDlg3();
        break;
    }

    pDlg->Create( id, pParent );

    return pDlg;
}
Пример #10
0
/////////////////////////////////////////////////////////////////////////////
// CSettingsDialog::CreatePage(const PAGE_INFO *pInfo)
// Description: Create the Window of the page specified by the page info.
// Return value: TRUE if successful, or FALSE if failed
// 
BOOL CSettingsDialog::CreatePage(const PAGE_INFO *pInfo)
{
	BOOL bCode = FALSE;

	if (!pInfo || !pInfo->pWnd) return(FALSE);	// If no page is specified, return NULL
	if (!::IsWindow(pInfo->pWnd->m_hWnd))		// If the window has not yet been created,
	{
		if (pInfo->pWnd->IsKindOf(RUNTIME_CLASS(CDialog)))	// If the page indow is kind of dialog window
		{
			CDialog *pDlg = (CDialog*)pInfo->pWnd;
			bCode = pDlg->Create(pInfo->nID, this);
			pDlg->ModifyStyle(WS_CAPTION, 0);
		}
		else if (pInfo->pWnd->IsKindOf(RUNTIME_CLASS(CWnd)))	// generic CWnd derived Window
		{
			CWnd *pWnd = (CWnd*)pInfo->pWnd;
			bCode = CreateWnd(pInfo->pWnd);						// Create Window 
			pWnd->ModifyStyle(WS_BORDER|WS_THICKFRAME, 0);		// Remoce border and thick frame styles
		}
	}
	return(bCode);
}
Пример #11
0
BOOL CTraceTabBaseDlg::CreateAndPlaceDialogs()
{
    m_TabCtrl.ModifyStyle(m_TabStyleRemove, m_TabStyleAdd);

    size_t NumDlg = m_TabDlgVec.size();
    LONG Width = 0, Height = 0;
    for(size_t i = 0 ; i < NumDlg; ++i)
    {
        m_TabCtrl.InsertItem(m_TabDlgVec[i].DialogId , m_TabDlgVec[i].TabName);

        CDialog* pChild = m_TabDlgVec[i].Child;
        int DialogId = m_TabDlgVec[i].DialogId;
        if (!pChild->Create(DialogId, this))
        {
            LogEvent(LE_ERROR, "CTraceTabBaseDlg::CreateAndPlaceDialogs: Failed to build dialog. IDD = %d", DialogId);
            Assert(false);
            return FALSE;
        }
        CRect ChildRect;
        pChild->GetWindowRect(&ChildRect);
        Width = max(Width, ChildRect.right - ChildRect.left);
        Height = max(Height, ChildRect.bottom - ChildRect.top);
    }

    CRect TabWindowRect;
    m_TabCtrl.GetWindowRect(&TabWindowRect);
    LONG TabWidth = TabWindowRect.right - TabWindowRect.left;
    LONG TabHeight = TabWindowRect.bottom - TabWindowRect.top;
    Width = max(Width+10, TabWidth);
    Height = max(Height, TabHeight);
    TabWindowRect.right = TabWindowRect.left + Width;
    TabWindowRect.bottom = TabWindowRect.top + Height;
    LONG TabWindowLeft = TabWindowRect.left;
    LONG TabWindowTop = TabWindowRect.top;
    ScreenToClient(&TabWindowRect);
    m_TabCtrl.MoveWindow(TabWindowRect);
    //SetListBoxTopLeft(TabWindowRect.top + 5, 10+Width);
    //SetListBoxTopLeft(-1, 10+Width);
    SetListBoxTopLeft(-1, Width);

    LONG Left = MAXLONG, Top = 0;
    for(size_t i = 0 ; i < NumDlg; ++i)
	{
        CRect ItemRect;
        m_TabCtrl.GetItemRect(i, &ItemRect);
        Left = min(Left, ItemRect.left);
        Top = max(Top, ItemRect.bottom);
	}
    //Left += TabWindowLeft + 5;
    //Top += TabWindowTop + 5;
    Left += TabWindowLeft;
    Top += TabWindowTop + 2;
    for(size_t i = 0 ; i < NumDlg; ++i)
    {
        CDialog* pChild = m_TabDlgVec[i].Child;
        CRect ChildRect;
        pChild->GetWindowRect(&ChildRect);
        ChildRect.OffsetRect(Left - ChildRect.left, Top - ChildRect.top);
        ScreenToClient(ChildRect);
        pChild->MoveWindow(ChildRect);
    }

    if(!m_TabDlgVec.empty())
    {
        m_TabCtrl.SetCurSel(m_TabItem);
    }
    else
    {
        //no dialogs
        LogEvent(LE_INFO, "CTraceTabBaseDlg::CreateAndPlaceDialogs() No Dialogs so hide the Tab Control");
        m_TabCtrl.ShowWindow(SW_HIDE);
        SetListBoxTopLeft(-1, 8);
    }

    return TRUE;
}