Example #1
0
BOOL LimitMappingScripwise::OnInitDialog()
{
	CDialogEx::OnInitDialog();		
// use the initial dialog size as the default minimum
    if ((m_szMinimum.cx == 0) && (m_szMinimum.cy == 0))
    {
        CRect rcWindow;
        GetWindowRect(rcWindow);
        m_szMinimum = rcWindow.Size();
    }
    // keep the initial size of the client area as a baseline for moving/sizing controls
    CRect rcClient;
    GetClientRect(rcClient);
    m_szInitial = rcClient.Size();
    // create a gripper in the bottom-right corner    	
	CRect rectDummy;
	rectDummy.SetRectEmpty();	
	e_grid.AttachGrid(this ,IDC_STATIC_GRID_LIMTMAPPING);
	e_grid.SetNumberCols(3);
	e_grid.SetColWidth(0,150);
	e_grid.SetColWidth(1,50);
	e_grid.SetColWidth(2,50);
	e_grid.QuickSetText(0,-1,L"SYMBOL");
	e_grid.QuickSetText(1,-1,L"LimitBuy");
	e_grid.QuickSetText(2,-1,L"LimitSell");

	getSymbolData();
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
void GcSequenceCollisionDlg::OnSize(UINT nType, int cx, int cy)
{
	CDialogEx::OnSize(nType, cx, cy);
	if (GetSafeHwnd() == NULL)
		return;	

	CRect rect;
	if( mAnchorProp.GetSafeHwnd() )
	{
		mAnchorProp.GetWindowRect( rect );
		ScreenToClient( rect );
		mAnchorProp.SetWindowPos(NULL, rect.left,  rect.top, rect.Size().cx, cy
			, SWP_NOACTIVATE | SWP_NOZORDER);
	}
	
	if( mCollisionProp.GetSafeHwnd() )
	{
		mCollisionProp.GetWindowRect( rect );
		ScreenToClient( rect );
		mCollisionProp.SetWindowPos(NULL, rect.left,  rect.top, rect.Size().cx, cy
			, SWP_NOACTIVATE | SWP_NOZORDER);
	}
	
	if( mCollisionList.GetSafeHwnd() )
	{
		mCollisionList.GetWindowRect( rect );
		ScreenToClient( rect );
		mCollisionList.SetWindowPos(NULL, rect.left,  rect.top, rect.Size().cx, cy
			, SWP_NOACTIVATE | SWP_NOZORDER);
	}
}
Example #3
0
void CFrameWnd::OnResize(int iFlag, const CSize& rNewSize)
{
	// Only when our window is changed.
	if ( (iFlag == SIZE_RESTORED) || (iFlag == SIZE_MAXIMIZED) )
	{
		// Resize toolbar.
		if (m_pToolBar)
		{
			// Get current pos.
			CRect rcToolBar = m_pToolBar->ClientRect();
			
			// Calc new pos and move.
			CRect rcNewPos(0, 0, rNewSize.cx, rcToolBar.Size().cy);
			m_pToolBar->Move(rcNewPos);
		}
		
		// Resize Status bar.
		if (m_pStatusBar)
		{
			// Get current pos.
			CRect rcStatusBar = m_pStatusBar->ClientRect();

			// Calc new pos and move.
			CRect rcNewPos(0, rNewSize.cy - rcStatusBar.Size().cy, 
								rNewSize.cx, rNewSize.cy);
			m_pStatusBar->Move(rcNewPos);
		}
	}
}
Example #4
0
void GPCreateFlashFrame( Bitmap& bmpSrc, CRect& rcBegin, CRect& rcEnd, Bitmap& bmpDes, CRect& rcDes, double dPercent )
{
	int  nWidth = bmpSrc.GetWidth();
	int  nHeight = bmpSrc.GetHeight();
	double dPercent2 = 1.0 - dPercent;
	int  nWidthDes = bmpDes.GetWidth();
	int  nHeightDes = bmpDes.GetHeight();
	CRect rcBmpSrc(0,0, nWidth, nHeight);
	CRect rcBmpDes(0,0, nWidthDes, nHeightDes);

	ASSERT(IsInRect(rcBegin, rcBmpSrc));
	ASSERT(IsInRect(rcEnd, rcBmpSrc));
	ASSERT(IsInRect(rcDes, rcBmpDes));
	ASSERT(rcBegin.Size() == rcEnd.Size());
	ASSERT(rcEnd.Size() == rcDes.Size());
	int nLoopWidth = rcBegin.Width();
	int nLoopHeight = rcBegin.Height();
	for (int i = 0; i <nLoopWidth; i++)
	{
		for (int j = 0; j < nLoopHeight; j++)
		{
			Color clrBegin;
			bmpSrc.GetPixel(i+ rcBegin.left, j+ rcBegin.top, &clrBegin);
			Color clrEnd;
			bmpSrc.GetPixel(i+ rcEnd.left, j+ rcEnd.top, &clrEnd);
			Color clrDes = Color::MakeARGB(clrBegin.GetA()*dPercent + clrEnd.GetA()* dPercent2, 
				clrBegin.GetR()*dPercent + clrEnd.GetR()* dPercent2,
				clrBegin.GetG()*dPercent + clrEnd.GetG()* dPercent2,
				clrBegin.GetB()*dPercent + clrEnd.GetB()* dPercent2);
			bmpDes.SetPixel(rcDes.left + i, rcDes.top+j, clrDes);
		}
	}
	

}
Example #5
0
bool CExtAviLabel::AviSizeFromContent(
	CSize & sizeBefore,
	CSize & sizeAfter,
	bool bMoveWindow // = true
	)
{
	ASSERT_VALID( this );
	if( GetSafeHwnd() == NULL )
		return false;
	if( AviIsEmpty() )
		return false;
CWnd * pWndParent = GetParent();
	if( pWndParent == NULL )
		return false;
bool bChildMode = ( ( GetStyle() & WS_CHILD ) != 0 ) ? true : false;
CRect rcWnd;
	GetWindowRect( &rcWnd );
	if( bChildMode )
		pWndParent->ScreenToClient( &rcWnd );
CRect rcClient;
	GetClientRect( &rcClient );
CSize sizePrevious = rcWnd.Size();
CSize sizeClient = rcClient.Size();
CSize sizeNonClient = sizePrevious - sizeClient;
CSize sizeAviFrame = AviFrameGetSize();
CRect rcDst( rcWnd.left, rcWnd.top, rcWnd.left + sizeNonClient.cx + sizeAviFrame.cx, rcWnd.top + sizeNonClient.cy + sizeAviFrame.cy );
CSize sizeDst = rcDst.Size();
	sizeBefore = sizePrevious;
	sizeAfter  = sizeDst;
	if( sizeDst == sizePrevious )
		return false;
	if( bMoveWindow )
		MoveWindow( &rcDst );
	return true;
}
BOOL CScheduleTableCfgDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // use the initial dialog size as the default minimum
    if ((m_AllowedSize.cx == 0) && (m_AllowedSize.cy == 0))
    {
        CRect rcWindow;
        GetWindowRect(rcWindow);
        m_AllowedSize = rcWindow.Size();
    }

    //AutoMove(IDCANCEL, 100.0, 100.0, 0.0, 0.0);
    // keep the initial size of the client area as a baseline for moving/sizing controls

    CRect rcTreeWnd;
    CWnd* pPlaceholderWnd = GetDlgItem(IDC_TREE_LIN_SCHEDULE);
    pPlaceholderWnd->GetWindowRect(&rcTreeWnd);
    ScreenToClient(&rcTreeWnd);

    pPlaceholderWnd->DestroyWindow();
    // create the multi-column tree window
    m_TreeWnd.CreateEx(WS_EX_CLIENTEDGE, NULL, NULL, WS_CHILD | WS_VISIBLE,
                       rcTreeWnd, this, IDC_TREE_LIN_SCHEDULE);
    CRect rect;
    m_TreeWnd.GetTreeCtrl().GetWindowRect(&rect);
    m_ouCheckTreeCtrl.Create(WS_CHILD | WS_VISIBLE | TVS_NOHSCROLL | TVS_NOTOOLTIPS,  rect, this, 1);
    m_ouCheckTreeCtrl.SubclassWindow(m_TreeWnd.GetTreeCtrl().GetSafeHwnd());

    DWORD dwStyle = GetWindowLong(m_ouCheckTreeCtrl, GWL_STYLE);
    dwStyle |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_FULLROWSELECT | TVS_DISABLEDRAGDROP;
    SetWindowLong(m_ouCheckTreeCtrl, GWL_STYLE, dwStyle);
    /* Remove the style */
    m_ouCheckTreeCtrl.ModifyStyle( TVS_CHECKBOXES, 0 );
    /* Now explicitly set it */
    m_ouCheckTreeCtrl.ModifyStyle( 0, TVS_CHECKBOXES );

    if( NULL == m_ouCheckTreeCtrl )
    {
        return FALSE;
    }

    // 1. Set tree column headers
    vSetColumnHeaders();

    m_ouCheckTreeCtrl.nUpdateScheduleView();
    m_ouCheckTreeCtrl.Expand(m_ouCheckTreeCtrl.GetRootItem(), TVM_EXPAND);

    // keep the initial size of the client area as a baseline for moving/sizing controls
    CRect rcClient;
    GetClientRect(rcClient);
    m_DefaultSize = rcClient.Size();
    vMoveWindowPos(IDC_TREE_LIN_SCHEDULE, 0, 0, 100.0, 100.0);
    vMoveWindowPos(IDCLOSE, 100.0, 100.0, 0.0, 0.0);
    return TRUE;
}
// A simple post-process (NMS, non-maximal suppression)
// "result" -- rectangles before merging
//          -- after this function it contains rectangles after NMS
// "combine_min" -- threshold of how many detection are needed to survive
void PostProcess(std::vector<CRect>& result,const int combine_min)
{
    std::vector<CRect> res1;
    std::vector<CRect> resmax;
    std::vector<int> res2;
    bool yet;
    CRect rectInter;

    for(unsigned int i=0,size_i=result.size(); i<size_i; i++)
    {
        yet = false;
        CRect& result_i = result[i];
        for(unsigned int j=0,size_r=res1.size(); j<size_r; j++)
        {
            CRect& resmax_j = resmax[j];
            if(result_i.Intersect(rectInter,resmax_j))
            {
                if(  rectInter.Size()>0.6*result_i.Size()
                        && rectInter.Size()>0.6*resmax_j.Size()
                  )
                {
                    CRect& res1_j = res1[j];
                    resmax_j.Union(resmax_j,result_i);
                    res1_j.bottom += result_i.bottom;
                    res1_j.top += result_i.top;
                    res1_j.left += result_i.left;
                    res1_j.right += result_i.right;
                    res2[j]++;
                    yet = true;
                    break;
                }
            }
        }
        if(yet==false)
        {
            res1.push_back(result_i);
            resmax.push_back(result_i);
            res2.push_back(1);
        }
    }

    for(unsigned int i=0,size=res1.size(); i<size; i++)
    {
        const int count = res2[i];
        CRect& res1_i = res1[i];
        res1_i.top /= count;
        res1_i.bottom /= count;
        res1_i.left /= count;
        res1_i.right /= count;
    }

    result.clear();
    for(unsigned int i=0,size=res1.size(); i<size; i++)
        if(res2[i]>combine_min)
            result.push_back(res1[i]);
}
void ResizingDialogStrategy::OnInitDialog()
{
    ASSERT(m_hWnd != NULL);
    ::EnumChildWindows(m_hWnd, InitializeEnumChildProc, (LPARAM) this);

    CRect r;
    ::GetClientRect(m_hWnd, &r);
    m_FirstClientSize = r.Size();
    m_OldClientSize = r.Size();
    m_bInitialized = true;
}
Example #9
0
BOOL CCompareListDlg::Create(CWnd *pParentWnd)
{
	if (!CDialog::Create(MAKEINTRESOURCE(IDD), pParentWnd)) // IDD_COMPARE_LIST
	{
		TRACE0("Failed to create calculator history window\n");
		return FALSE; // failed to create
	}

	// Set up the grid control
	ASSERT(GetDlgItem(IDC_GRID_DIFFS) != NULL);
	if (!grid_.SubclassWindow(GetDlgItem(IDC_GRID_DIFFS)->m_hWnd))
	{
		TRACE0("Failed to subclass compare list grid control\n");
		return FALSE;
	}

	grid_.SetDoubleBuffering();
	grid_.SetAutoFit();
	grid_.SetGridLines(GVL_BOTH); // GVL_HORZ | GVL_VERT
	grid_.SetTrackFocusCell(FALSE);
	grid_.SetFrameFocusCell(FALSE);
	grid_.SetListMode(TRUE);
	grid_.SetSingleRowSelection(TRUE);
	grid_.SetFixedRowCount(1);

	grid_.SetColumnResize();

	grid_.EnableRowHide(FALSE);
	grid_.EnableColumnHide(FALSE);
	grid_.EnableHiddenRowUnhide(FALSE);
	grid_.EnableHiddenColUnhide(FALSE);

	grid_.SetEditable(FALSE);
	grid_.SetFixedColumnSelection(FALSE);
	grid_.SetFixedRowSelection(FALSE);
	//grid_.ExpandColsNice(FALSE);

	// Set up resizer control
	// We must set the 4th parameter true else we get a resize border
	// added to the dialog and this really stuffs things up inside a pane.
	m_resizer.Create(GetSafeHwnd(), TRUE, 100, TRUE);

	// It needs an initial size for it's calcs
	CRect rct;
	GetWindowRect(&rct);
	m_resizer.SetInitialSize(rct.Size());
	m_resizer.SetMinimumTrackingSize(rct.Size());

	// This can cause problems if done too early (OnCreate or OnInitDialog)
	m_resizer.Add(IDC_GRID_DIFFS, 0, 0, 100, 100);

	return TRUE;
}
Example #10
0
	std::vector<CElement*> CSimPetriDoc::ElementsInRect(CRect& rect) const
	{
		rect.NormalizeRect();
		std::vector<CElement*> selection;
		Point point(rect.TopLeft().x, rect.TopLeft().y);
		Size size(rect.Size().cx, rect.Size().cy);
		Rect rectangle(point, size);
		for(auto it=drawingElements.begin(); it!=drawingElements.end(); ++it)
			if((*it)->IntersectsWithRect(rectangle))
				selection.push_back(*it);
		return selection;
	}
Example #11
0
BOOL SQrCtrl::OnRelayout(const CRect & rcWnd)
{
	CRect rcOld = GetClientRect();
	BOOL bRet = __super::OnRelayout(rcWnd);
	if(!bRet) return FALSE;
	CRect rcNew = GetClientRect();
	if(rcOld.Size() == rcNew.Size())
		return TRUE;

	CreateQrImg(GetWindowText());
	return TRUE;
}
Example #12
0
void CLayout::OnInitDialog(bool centerWindow)
{
    m_dialog->SetIcon(GetWDSApp()->LoadIcon(IDR_MAINFRAME), false);

    CRect rcDialog;
    int i = 0;
    m_dialog->GetWindowRect(rcDialog);
    m_originalDialogSize = rcDialog.Size();

    for(i = 0; i < m_control.GetSize(); i++)
    {
        CRect rc;
        m_control[i].control->GetWindowRect(rc);
        m_dialog->ScreenToClient(rc);
        m_control[i].originalRectangle = rc;
    }

    CRect sg;
    m_dialog->GetClientRect(sg);
    sg.left = sg.right - m_sizeGripper._width;
    sg.top = sg.bottom - m_sizeGripper._width;
    m_sizeGripper.Create(m_dialog, sg);

    i = AddControl(&m_sizeGripper, 1, 1, 0, 0);
    m_control[i].originalRectangle = sg;

    CPersistence::GetDialogRectangle(m_name, rcDialog);
    m_dialog->MoveWindow(rcDialog);
    if(centerWindow)
    {
        m_dialog->CenterWindow();
    }
}
// If one detection (after NMS) is inside another, remove the inside one
void RemoveCoveredRectangles(std::vector<CRect>& result)
{
    std::vector<bool> covered;
    covered.resize(result.size());
    std::fill(covered.begin(),covered.end(),false);
    CRect inter;
    for(unsigned int i=0; i<result.size(); i++)
    {
        for(unsigned int j=i+1; j<result.size(); j++)
        {
            result[i].Intersect(inter,result[j]);
            double isize = inter.Size();
            if(isize>result[i].Size()*0.65)
                covered[i] = true;
            if(isize>result[j].Size()*0.65)
                covered[j] = true;
        }
    }
    std::vector<CRect> newresult;
    for(unsigned int i=0; i<result.size(); i++)
        if(covered[i]==false)
            newresult.push_back(result[i]);
    result.clear();
    result.insert(result.begin(),newresult.begin(),newresult.end());
    newresult.clear();
}
Example #14
0
int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;

	// child dialogs don't want resizable border or size grip,
	// nor they can handle the min/max size constraints
	BOOL bChild = GetStyle() & WS_CHILD;

	if (!bChild)
	{
		// keep client area
		CRect rect;
		GetClientRect(&rect);
		// set resizable style
		ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
		// adjust size to reflect new style
		::AdjustWindowRectEx(&rect, GetStyle(),
			::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
		SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED|
			SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);

		// set the initial size as the min track size
		SetMinTrackSize(rect.Size());
	}

	// create and init the size-grip
	if (!CreateSizeGrip(!bChild))
		return -1;

	return 0;
}
Example #15
0
void CCodJobListView::OnSize(UINT nType, int cx, int cy) 
{
	CCodView::OnSize(nType, cx, cy);

	CRect rect;
	int r, p;

	if (m_bPropertySheetCreated) {
		GetClientRect(rect);
		m_PropertySheet.Resize(rect.Size());

		r = m_JobListPage.m_RunningBtn.GetCheck();  
		p = m_JobListPage.m_PendingBtn.GetCheck();  
		m_JobListPage.GetClientRect(&rect);

		if (1 == r && 1 == p) {
			m_JobListPage.m_RunningJobList.MoveWindow(10, 60, rect.Width() - 20, rect.Height() / 2 - 35);
			m_JobListPage.m_PendingJobList.MoveWindow(10, rect.Height() / 2 + 35, rect.Width() - 20, rect.Height() / 2 - 35);
		} 
		else if (1 == r && 0 == p)
			m_JobListPage.m_RunningJobList.MoveWindow(10, 60, rect.Width() - 20, rect.Height() - 60);
		else if (0 == r && 1 == p)
			m_JobListPage.m_PendingJobList.MoveWindow(10, 60, rect.Width() - 20, rect.Height() - 60);
	}
}
void CLibraryHeaderPanel::OnPaint()
{
	CPaintDC dc( this );
	CRect rcClient;

	GetClientRect( &rcClient );
	if ( rcClient.IsRectEmpty() ) return;

	if ( rcClient.Width() > m_szBuffer.cx || rcClient.Height() > m_szBuffer.cy )
	{
		if ( m_bmBuffer.m_hObject != NULL )
		{
			m_dcBuffer.SelectObject( m_hBuffer );
			m_dcBuffer.DeleteDC();
			m_bmBuffer.DeleteObject();
		}

		m_szBuffer = rcClient.Size();
		m_bmBuffer.CreateCompatibleBitmap( &dc, m_szBuffer.cx, m_szBuffer.cy );
		m_dcBuffer.CreateCompatibleDC( &dc );
		m_hBuffer = (HBITMAP)m_dcBuffer.SelectObject( &m_bmBuffer )->m_hObject;
	}

	if ( ! CoolInterface.DrawWatermark( &m_dcBuffer, &rcClient, &m_bmWatermark, 0, 0 ) )
	{
		m_dcBuffer.FillSolidRect( &rcClient, Skin.m_crBannerBack );
	}

	DoPaint( &m_dcBuffer, rcClient );

	dc.BitBlt( rcClient.left, rcClient.top, rcClient.Width(),
		rcClient.Height(), &m_dcBuffer, 0, 0, SRCCOPY );
}
void CMServerManagerView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

	CRect rcClient;
	GetClientRect(&rcClient);
	GetParentFrame()->RecalcLayout();
	// 스크롤 크기를 뷰의 크기로 맞추어 줌.
	SetScaleToFitSize(rcClient.Size());

	m_Brush.CreateSolidBrush(RGB(64, 64, 64)); 

	CRect rtTab;

	m_stcTab.GetWindowRect(&rtTab);
	ScreenToClient(&rtTab);

	m_mfcTab.Create(CMFCTabCtrl::STYLE_3D_VS2005, rtTab, this, 1, CMFCTabCtrl::LOCATION_BOTTOM);

	g_sToolMgr.InitToolMgr(m_hWnd);
	g_sToolMgr.GetDialogMgr()->InitDialogMgr(&m_mfcTab);

	m_mfcTab.AddTab(&g_sToolMgr.GetDialogMgr()->m_StatusDlg, "Status", 0, FALSE);
	m_mfcTab.AddTab(&g_sToolMgr.GetDialogMgr()->m_LogDlg, "Logs", 1, FALSE);
	m_mfcTab.AddTab(&g_sToolMgr.GetDialogMgr()->m_UserDlg, "Users", 2, FALSE);

	OnTabColor();

	// 계정 관리 창을 최초로 띄워 접속 및 계정 추가를 할 수 있도록 한다
	g_sToolMgr.GetDialogMgr()->m_AccountDlg.DoModal();
}
Example #18
0
void COXMonthCalPopup::AdjustDisplayRectangle(CRect &rect, CRect rectParent)
{
	// Get the rectangle of the monitor closest to the menu rectangle
	HMONITOR hMonitor = ::MonitorFromRect(rect, MONITOR_DEFAULTTONEAREST);
	MONITORINFO mi;
	mi.cbSize = sizeof(MONITORINFO);
	::GetMonitorInfo(hMonitor, &mi);

	const int iMixScreenX = mi.rcMonitor.left;
	const int iMaxScreenX = mi.rcMonitor.right;
	const int iMaxScreenY = mi.rcMonitor.bottom;

	CSize sizeParent(rectParent.Width(), rectParent.Height());
	CPoint ptTopLeft(rect.left, rect.top);

	if (ptTopLeft.x < iMixScreenX)
		ptTopLeft.x = iMixScreenX;
	if (ptTopLeft.x + rect.Width() > iMaxScreenX)
		ptTopLeft.x = iMaxScreenX - rect.Width();

	// Make sure the popup is not clipped at the bottom
	if (rect.bottom > iMaxScreenY)
	{
		// The popup should be above the item
		ptTopLeft.y = rectParent.top - rect.Height();
	}

	CSize sizeTemp = rect.Size();
	rect.SetRect(ptTopLeft.x, ptTopLeft.y,
		ptTopLeft.x + sizeTemp.cx, ptTopLeft.y + sizeTemp.cy);
}
Example #19
0
BOOL CCoolDialogBar::Create(CWnd* pParentWnd, CDialog *pDialog, CString &pTitle, UINT nID, DWORD dwStyle) 
{
    ASSERT_VALID(pParentWnd);   // must have a parent
    ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));
	
    // save the style -- AMENDED by Holger Thiele - Thankyou
    m_dwStyle = dwStyle & CBRS_ALL;

	// create the base window
    CString wndclass = AfxRegisterWndClass(CS_DBLCLKS, LoadCursor(NULL, IDC_ARROW),
        m_brushBkgd, 0);
	// JC: changed the nId from 0 to 1234, to fix some problems
    if (!CWnd::Create(wndclass, pTitle, dwStyle, CRect(0,0,0,0), pParentWnd, 1234/*0*/))
        return FALSE;


	// create the child dialog
	m_cDialog = pDialog;
	m_cDialog->Create(nID, this);

	// JC: added patch to fix the problem with LoadBarState
	SetDlgCtrlID(nID);
	
	// use the dialog dimensions as default base dimensions
	CRect rc;
    m_cDialog->GetWindowRect(rc);
    m_sizeHorz = m_sizeVert = m_sizeFloat = rc.Size();
	m_sizeHorz.cy += m_cxEdge + m_cxBorder;
	m_sizeVert.cx += m_cxEdge + m_cxBorder;
    return TRUE;
}
Example #20
0
void CMainFrame::SetupMemoryBitmapSize (const CSize& sz)
{
	CMSMVisualManager* pManager = DYNAMIC_DOWNCAST (CMSMVisualManager,
		CMFCVisualManager::GetInstance ());

	if (pManager != NULL)
	{
		CRect rtRes (0, 0, sz.cx, 0);

		CRect rt;

		CPane* bars[4] = 
			{&m_wndCaptionBar, &m_wndMenuBar, &m_wndToolBar, &m_wndCategoryBar};

		for (long i = 0; i < 4; i++)
		{
			CPane* pBar = bars [i];

			if (pBar != NULL && pBar->GetSafeHwnd () != NULL)
			{
				pBar->GetWindowRect (rt);
				rtRes.bottom += rt.Height ();
			}
		}

		CDC* pDC = GetDC ();

		pManager->SetupMemoryBitmapSize (pDC, rtRes.Size ());

		ReleaseDC (pDC);
	}
}
Example #21
0
void CMsgBoxDlg::InitWindow()
{
	if (!m_strCaption.IsEmpty())
	{
		SetWindowText(m_strCaption);
	}

	CRect rect;

	CPaintDC dc(GetDlgItem(IDC_STATIC_INFO));
	
	CFont* pOldFont = (CFont*)dc.SelectStockObject(DEFAULT_GUI_FONT);

	dc.DrawText(m_strText, rect, DT_CALCRECT);
	m_TextSize = rect.Size();

	dc.SelectObject(pOldFont);

	if (m_TextSize.cx < 160)
	{
		m_TextSize.cx = 160;
	}
	
	GetDlgItem(IDC_STATIC_INFO)->SetWindowPos(NULL, 0, 0, 
		m_TextSize.cx + 15, m_TextSize.cy + 15, SWP_NOMOVE);

	SetWindowPos(NULL, 0, 0, 100 + m_TextSize.cx, 120 + m_TextSize.cy, SWP_NOMOVE);
}
Example #22
0
inline void CPianoCtrl::UpdateKeyLabelFont()
{
	CRect	rc;
	GetClientRect(rc);
	UpdateKeyLabelFont(rc.Size(), GetStyle());
	Invalidate();
}
Example #23
0
CSize CPlayerInfoBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
{
	CRect r;
	GetParent()->GetClientRect(&r);
	r.bottom = r.top + m_label.GetCount() * 17 + (m_label.GetCount() ? 4 : 0);
	return r.Size();
}
Example #24
0
void CScrollWnd::SetScaleToFitSize(SIZE sizeTotal)
{
	// Note: It is possible to set sizeTotal members to negative values to
	//  effectively invert either the X or Y axis.
	
	ASSERT(m_hWnd != NULL);
	m_nMapMode = MM_SCALETOFIT;     // special internal value
	m_totalLog = sizeTotal;
	
	// reset and turn any scroll bars off
	if (m_hWnd != NULL && (GetStyle() & (WS_HSCROLL|WS_VSCROLL)))
	{
		SetScrollPos(SB_HORZ, 0);
		SetScrollPos(SB_VERT, 0);
		EnableScrollBarCtrl(SB_BOTH, FALSE);
		ASSERT((GetStyle() & (WS_HSCROLL|WS_VSCROLL)) == 0);
	}
	
	CRect rectT;
	GetClientRect(rectT);
	m_totalDev = rectT.Size();
	
	if (m_hWnd != NULL)
	{
		// window has been created, invalidate
		UpdateBars();
		Invalidate(TRUE);
	}
}
bool CDEditor::AdjustRect(CRect& rect)
{
	CRect rcOld=rect;

	CPoint point = rect.TopLeft();
	CSize size = rect.Size();
	CSize sizeVt = GetVirtualSize();
	int restraint = GetRestraints();	

	if (RESTRAINT_NONE != restraint) {
		int left=0,top=0,right=sizeVt.cx,bottom=sizeVt.cy; // m_restraint == RESTRAINT_VIRTUAL
		if (restraint == RESTRAINT_MARGIN) {
			GetMargins(left,top,right,bottom);
			right = sizeVt.cx - right;
			bottom = sizeVt.cy - bottom;
		}
		point.x = min(max(left,point.x),right-size.cx);
		point.y = min(max(top,point.y),bottom-size.cy);
	}

	if (GetSnapToGrid()) {
		point.x = SnapX(point.x);
		point.y = SnapY(point.y);
	}

	rect.SetRect(point,point+size);

	return rcOld==rect;
}
BOOL CRecordPlayerDlg::OnInitDialog() 
{
	CPersistDlg::OnInitDialog();
	
	SetIcon(theApp.LoadIcon(IDR_MAINFRAME), 0);
	m_Resize.AddControlList(this, m_CtrlList);
	CRect	rWnd;
	GetWindowRect(rWnd);
	m_InitSize = rWnd.Size();
	m_TrackList.CreateColumns(m_ColInfo, COLUMNS);
	m_TrackList.SetExtendedStyle(LVS_EX_CHECKBOXES);
	m_PlayBtn.SetIcons(IDI_REC_PLAY_PLAY, IDI_REC_PLAY_PAUSE);
	m_StopBtn.SetIcons(IDI_REC_PLAY_STOP, IDI_REC_PLAY_STOP);
	m_PositionText.SetFont(GetFont());	// pass in our font
	// open most recent recording if available
	CPathStr	sRecPath = theApp.GetMain()->GetRecordFilePath();
	if (!sRecPath.IsEmpty()) {	// if recording path is available
		sRecPath.RenameExtension(MIDI_RECORD_EXT);	// override extension
		if (PathFileExists(sRecPath))	// if recording exists
			Open(sRecPath);	// open most recent recording
	}
	EnableToolTips();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Example #27
0
// Resizes all the gadgets in an array to match the new size.
// Generally called from an OnSize routine (or the like)
void ResizeGadgetsOnWindow(GADGETRESIZEHANDLE Handle, int cx, int cy)
	{
	CPtrArray* pArray = (CPtrArray*)Handle;		
	
	if (pArray == NULL || cx == 0 || cy == 0)
		return;
	
	ASSERT(pArray->GetSize() > 0);	// must be at least one element in the array
	
	// if auto-sizing, go thru and reposition all the controls.
	CSize sizeWndOrig = ((RECT_AND_HWND*)pArray->GetAt(0))->m_rect.Size();
	for (int i = 1; i < pArray->GetSize(); i++)
		{
		RECT_AND_HWND* pRectWnd = (RECT_AND_HWND*)pArray->GetAt(i);
		CRect newRect = pRectWnd->m_rect;
		CSize sizeCtlOrig = newRect.Size();
		newRect.top    = newRect.top    * cy / sizeWndOrig.cy;
		newRect.left   = newRect.left   * cx / sizeWndOrig.cx;
		newRect.right  = newRect.right  * cx / sizeWndOrig.cx;
		// if bottom is < 0, then kepp it fixed height - used for combo boxes
		// where we don't really want to resize most of them...
		if (newRect.bottom < 0)
			newRect.bottom = newRect.top - newRect.bottom;
		else 
			newRect.bottom = newRect.bottom * cy / sizeWndOrig.cy;

		::SetWindowPos(pRectWnd->m_hWnd, NULL,
			newRect.left, newRect.top, newRect.Width(), newRect.Height(),
			SWP_NOZORDER);
		}
	}
Example #28
0
void CPianoCtrl::Update()
{
	CRect	rc;
	GetClientRect(rc);
	Update(rc.Size());
	Invalidate();
}
Example #29
0
void CDBFrame::DrawTitle(CDC *pDC, CRect rect)
{
//	m_imageTitleBk.Render(pDC, rect.TopLeft(), rect.Size());
	CRect rcLeftCapture = rect;
	rcLeftCapture.left  = 5;

	rcLeftCapture.right = rcLeftCapture.left + m_imageLeftHeader.Width();
		


	m_imageLeftHeader.Render(pDC,rcLeftCapture.TopLeft(),rcLeftCapture.Size());


	CString strText;
	GetWindowText(strText);
	CFont *pOldFont=pDC->SelectObject(&g_fontBase);
	int iModeOld = pDC->SetBkMode(TRANSPARENT);
	
	//字体绘制位置垂直方向位于标题栏中间
	rect.top += 12;
//	pDC->DrawText(strText, &rect, DT_CENTER);
	
	pDC->SetBkMode(iModeOld);
	pDC->SelectObject(pOldFont);
}
void CXTPMarkupUIElement::Arrange(CRect rcFinalRect)
{
	if (GetVisibility() == xtpMarkupVisibilityCollapsed)
	{
		m_rcFinalRect = rcFinalRect;
		m_bArrangeDirty = FALSE;
		m_bNeverArranged = FALSE;
		return;
	}

	if (m_bNeverMeasured)
	{
		CXTPMarkupDrawingContext dc(GetMarkupContext());
		Measure(&dc, rcFinalRect.Size());
	}

	if ((m_bArrangeDirty || m_bNeverArranged) || (rcFinalRect != m_rcFinalRect))
	{
		m_bNeverArranged = FALSE;
		m_bArrangeInProgress = TRUE;
		ArrangeCore(rcFinalRect);
		m_bArrangeInProgress = FALSE;

		UpdateBoundRect();
	}

	m_rcFinalRect = rcFinalRect;
	m_bArrangeDirty = FALSE;
}