예제 #1
0
void gkToolBarPaneBase::RecalcLayout()
{
	////////////////////////////////////////////////////////////////////////
	// Place the toolbars and move the controls in the dialog to make space
	// for them
	////////////////////////////////////////////////////////////////////////

	CRect rcClientStart;
	CRect rcClientNow;
	CRect rcChild;					
	CRect rcWindow;
	CWnd *pwndChild = GetWindow(GW_CHILD);
	if (pwndChild == NULL)
		return;

	CRect clientRect;
	GetClientRect(clientRect);
	// We need to resize the dialog to make room for control bars.
	// First, figure out how big the control bars are.
	GetClientRect(rcClientStart);
	RepositionBarsInternal(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 
				   0, reposQuery, rcClientNow);

	// Now move all the controls so they are in the same relative
	// position within the remaining client area as they would be
	// with no control bars.
	CPoint ptOffset(rcClientNow.left - rcClientStart.left,
					rcClientNow.top - rcClientStart.top); 

	//CRect rcClient(0, 0, cx, cy);
	RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, 0, 0, &rcClientNow);

	// And position the control bars
	RepositionBarsInternal(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
}
예제 #2
0
void ScrollBar::OnHorzTrack(suic::Element* pSender, suic::MouseEventArg& e)
{
    if (!_rcTrack.Empty())
    {
        int iMin = 0;

        suic::Point ptWindow = e.MousePoint();
        suic::Point ptSelf = PointToScreen(suic::Point());

        suic::Rect rect(ptSelf.x, ptSelf.y, RenderSize().cx, RenderSize().cy);
 
        suic::Size szClamp(0, 0);
		int nThumbLength = 0;

        szClamp.cx = rect.left + (_decreaseBtn.IsVisible() ? (int)_decreaseBtn.GetWidth() : 0);
        szClamp.cy = rect.right - (_increaseBtn.IsVisible() ? (int)_increaseBtn.GetWidth() : 0);

        nThumbLength = _rcTrackStart.Width();

        szClamp.cy -= nThumbLength;

        suic::Point ptOffset(ptWindow.x - _ptTrackStart.x, ptWindow.y - _ptTrackStart.y);
        suic::Rect rectNew(_rcTrackStart);

        if (abs(ptOffset.y) < 150)
        {
            rectNew.Offset(ptOffset.x, 0);

            if (rectNew.left < szClamp.cx)
            {
                rectNew.left  = szClamp.cx;
                rectNew.right = rectNew.left + nThumbLength;
            }
            else if (szClamp.cy < rectNew.left)
            {
                rectNew.left  = szClamp.cy;
                rectNew.right = rectNew.left + nThumbLength;
            }
        }

        if (!rectNew.Equal(&_rcTrack))
		{
			_rcTrack = rectNew;
            int nPosNew = PosFromThumb(_rcTrack.left - szClamp.cx, szClamp);

			if (_scroInfo.iVisualPos != nPosNew)
            {
                _scroInfo.iVisualPos = nPosNew;

                DoScroll(true);
            }
        }
    }
}
예제 #3
0
void CTexViewer::OnMouseMove(UINT nFlags, CPoint point) 
{
	if (m_bDrag && (MK_LBUTTON & nFlags))
	{
		if (EDITMODE_SELECT == m_eEditMode)
		{
			// 화면 스크롤 체크
			CRect rcClient;
			GetClientRect(&rcClient);
			CPoint ptOffset(0,0);
			int iBorder = 20;	// 화면 가장자리 20 이내있으면 1씩 증감
			if (point.x < rcClient.left+iBorder) ptOffset.x = -1;
			else if (point.x > rcClient.right-iBorder) ptOffset.x = 1;
			if (point.y < rcClient.top+iBorder) ptOffset.y = -1;
			else if (point.y > rcClient.bottom-iBorder) ptOffset.y = 1;
			iBorder = 10;		// 10 이내있으면 5씩 증감
			if (point.x < rcClient.left+iBorder) ptOffset.x = -5;
			else if (point.x > rcClient.right-iBorder) ptOffset.x = 5;
			if (point.y < rcClient.top+iBorder) ptOffset.y = -5;
			else if (point.y > rcClient.bottom-iBorder) ptOffset.y = 5;
			iBorder = 5;		// 5 이내있으면 20씩 증감
			if (point.x < rcClient.left+iBorder) ptOffset.x = -20;
			else if (point.x > rcClient.right-iBorder) ptOffset.x = 20;
			if (point.y < rcClient.top+iBorder) ptOffset.y = -20;
			else if (point.y > rcClient.bottom-iBorder) ptOffset.y = 20;
			if (CPoint(0,0) != ptOffset) SetLeftTopInImage(m_ptLeftTopInImage+ptOffset);

			if (DRAGTYPE_SELECT == m_eDragType)
			{
				// 선택 영역 갱신
				CPoint pt = point;
				ScreenToImage(&pt);				// image 좌표로 변환
				m_rcSelectedRect.right = pt.x;
				m_rcSelectedRect.bottom = pt.y;
				m_bDeselect = FALSE;		// deselect 해제
			}
			else
			{	// 영역 변형일 경우 다음과 같이 처리
				ProcessDrag(point);
			}
			Invalidate();
		}
		else if (EDITMODE_HAND == m_eEditMode)
		{
			CPoint ptDiff = m_ptMouseOld - point;
			ptDiff.x = (int)(ptDiff.x / m_fScale);
			ptDiff.y = (int)(ptDiff.y / m_fScale);
			SetLeftTopInImage(m_ptLeftTopInImage+ptDiff);
		}
	}
	m_ptMouseOld = point;
	GetParent()->PostMessage(UM_UPDATE_INFO, TRUE, MAKELPARAM((short)point.y,(short)point.x));
	CWnd::OnMouseMove(nFlags, point);
}
예제 #4
0
void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
  CPWL_Wnd::GetThisAppearanceStream(sAppStream);

  CFX_ByteTextBuf sListItems;

  if (m_pList) {
    CFX_FloatRect rcPlate = m_pList->GetPlateRect();
    for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
      CFX_FloatRect rcItem = m_pList->GetItemRect(i);

      if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom)
        continue;

      CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
      if (m_pList->IsItemSelected(i)) {
        sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,
                                                       PWL_DEFAULT_SELBACKCOLOR)
                          .AsStringC();
        CFX_ByteString sItem =
            CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
        if (sItem.GetLength() > 0) {
          sListItems << "BT\n"
                     << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
                            .AsStringC()
                     << sItem.AsStringC() << "ET\n";
        }
      } else {
        CFX_ByteString sItem =
            CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
        if (sItem.GetLength() > 0) {
          sListItems << "BT\n"
                     << CPWL_Utils::GetColorAppStream(GetTextColor())
                            .AsStringC()
                     << sItem.AsStringC() << "ET\n";
        }
      }
    }
  }

  if (sListItems.GetLength() > 0) {
    CFX_ByteTextBuf sClip;
    CFX_FloatRect rcClient = GetClientRect();

    sClip << "q\n";
    sClip << rcClient.left << " " << rcClient.bottom << " "
          << rcClient.right - rcClient.left << " "
          << rcClient.top - rcClient.bottom << " re W n\n";

    sClip << sListItems << "Q\n";

    sAppStream << "/Tx BMC\n" << sClip << "EMC\n";
  }
}
BOOL CInfoShowDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_anchar.Init(GetSafeHwnd());

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |
		CBRS_TOOLTIPS | CBRS_ALIGN_TOP, CRect(4, 4, 0, 0)) ||
		!m_wndToolBar.LoadToolBar(IDR_TB_INFO_SHOW))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}
	
	m_wndToolBar.LoadTrueColorToolBar(16, 16, IDB_DEBUG_TOOLBAR, IDB_DEBUG_TOOLBAR);
	
	m_wndToolBar.SetButtonStyle(1, TBBS_CHECKBOX);
	//	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
	CRect rcClientStart;
	CRect rcClientNow;
	GetClientRect(rcClientStart);
	//取得对话框客户区的矩形区域大小存于rcClientStart当中
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow);
	//上面创建了工具栏所以调整一次工具栏的默认高度就是30(经测量得出的结论),前面已经创建了一个工具栏,
	// 并通过 RepositionBars进行了调整所以客户区rcClientNow矮了30
	
	CPoint ptOffset(rcClientNow.left-rcClientStart.left, rcClientNow.top-rcClientStart.top); 
	CRect rcChild;      //用来保存子窗口的矩形区域大小                          
	CWnd* pwndChild = GetWindow(GW_CHILD);//取得CWnd第一个子窗口的指针
	while (pwndChild)
	{ //循环将所有的子窗口重新调整其位置                             
		pwndChild->GetWindowRect(rcChild);//取得句柄所对应子窗口的矩形坐标(屏幕坐标)存入rcChild
		ScreenToClient(rcChild);//将屏幕坐标转化为窗客户坐标
		rcChild.OffsetRect(ptOffset);//将矩形rcChild按照ptOffset进行偏移计算
		pwndChild->MoveWindow(rcChild, FALSE);//将子窗口移动到rcChild处
		pwndChild = pwndChild->GetNextWindow();//取得下一个子窗口的指针
	}
	///////////////下面将对话框大小重整////////////////////////////////////////////////////////
	CRect rcWindow;
	GetWindowRect(rcWindow);//取得窗口的屏幕矩形坐标,包含标题栏与边框在内
	rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
	rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
	MoveWindow(rcWindow, FALSE);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);//将控件重排一次,改动了对话框的大小,再调整一次控件的位置,否则控件就不见啦
    CenterWindow();

	// 增加显示日志的控件的锚点,尺寸跟着父窗口的变化而变化
	m_anchar.Add(IDC_LIST_INFO_SHOW_LOG, ANCHOR_ALL);

	return TRUE; // return TRUE unless you set the focus to a control
                     // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #6
0
void COleServerItem::GetObjectDescriptorData(
	LPPOINT lpOffset, LPSIZE lpSize, LPSTGMEDIUM lpStgMedium)
{
	ASSERT_VALID(this);
	ASSERT(AfxIsValidAddress(lpStgMedium, sizeof(STGMEDIUM)));
	ASSERT(lpOffset == NULL ||
		AfxIsValidAddress(lpOffset, sizeof(POINT), FALSE));

	LPOLEOBJECT lpOleObject = GetOleObject();
	ASSERT(lpOleObject != NULL);

	// get the object descriptor for the IOleObject
	POINTL pointl = { 0, 0 };
	if (lpOffset != NULL)
	{
		CSize ptOffset(lpOffset->x, lpOffset->y);
#ifndef _MAC
		((CDC*)NULL)->DPtoHIMETRIC(&ptOffset);
#endif
		pointl.x = ptOffset.cx;
		pointl.y = ptOffset.cy;
	}
	SIZEL sizel;
	if (lpSize != NULL)
	{
		sizel.cx = lpSize->cx;
		sizel.cy = lpSize->cy;
#ifndef _MAC
		((CDC*)NULL)->DPtoHIMETRIC(&sizel);
#endif
	}
	else
	{
		sizel.cx = 0;
		sizel.cy = 0;
	}

	InterlockedIncrement(&m_dwRef);  // protect against destruction during this call
	HGLOBAL hGlobal = _AfxOleGetObjectDescriptorData(
		lpOleObject, NULL, DVASPECT_CONTENT, pointl, &sizel);
	InterlockedDecrement(&m_dwRef);

	if (hGlobal == NULL)
		AfxThrowMemoryException();

	// setup the STGMEDIUM
	lpStgMedium->tymed = TYMED_HGLOBAL;
	lpStgMedium->hGlobal = hGlobal;
	lpStgMedium->pUnkForRelease = NULL;
}
예제 #7
0
void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
                                      CFX_Matrix* pUser2Device) {
  CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);

  if (m_pList) {
    CFX_FloatRect rcPlate = m_pList->GetPlateRect();
    CFX_FloatRect rcList = GetListRect();
    CFX_FloatRect rcClient = GetClientRect();

    for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
      CFX_FloatRect rcItem = m_pList->GetItemRect(i);
      if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom)
        continue;

      CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
      if (IFX_Edit* pEdit = m_pList->GetItemEdit(i)) {
        CFX_FloatRect rcContent = pEdit->GetContentRect();
        if (rcContent.Width() > rcClient.Width())
          rcItem.Intersect(rcList);
        else
          rcItem.Intersect(rcClient);
      }

      if (m_pList->IsItemSelected(i)) {
        CFX_SystemHandler* pSysHandler = GetSystemHandler();
        if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
          IFX_Edit::DrawEdit(
              pDevice, pUser2Device, m_pList->GetItemEdit(i),
              CPWL_Utils::PWLColorToFXColor(GetTextColor()),
              CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList,
              ptOffset, nullptr, pSysHandler, m_pFormFiller);
          pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem);
        } else {
          CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
                                   ArgbEncode(255, 0, 51, 113));
          IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
                             ArgbEncode(255, 255, 255, 255), 0, rcList,
                             ptOffset, nullptr, pSysHandler, m_pFormFiller);
        }
      } else {
        CFX_SystemHandler* pSysHandler = GetSystemHandler();
        IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
                           CPWL_Utils::PWLColorToFXColor(GetTextColor()),
                           CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
                           rcList, ptOffset, nullptr, pSysHandler, nullptr);
      }
    }
  }
}
예제 #8
0
CRect CPrinterDC::PrintableArea(void) const
{
	ASSERT(m_hDC);

	CPoint	ptOffset(0, 0);
	CRect	rcPage = PageArea();

	// Get margin and adjust page.
	if (Escape(m_hDC, GETPRINTINGOFFSET, 0, NULL, &ptOffset) > 0)
	{
		rcPage.left    += ptOffset.x;
		rcPage.top     += ptOffset.y;
		rcPage.right   -= ptOffset.x;
		rcPage.bottom  -= ptOffset.y;
	}
	
	return rcPage;
}
예제 #9
0
CImageList* CLiveList::CreateDragImage(CListCtrl* pList, const CPoint& ptMouse)
{
	ASSERT_VALID( pList );

	CPoint ptOffset( 0, 0 );
	CBitmap bmDrag;
	bmDrag.Attach( CreateDragImage( pList, ptMouse, ptOffset) );
	BITMAP bmpInfo;
	bmDrag.GetBitmap( &bmpInfo );
	CImageList* pAll = new CImageList();
	pAll->Create( bmpInfo.bmWidth, bmpInfo.bmHeight, ILC_COLOR32|ILC_MASK, 1, 1 ) ||
	pAll->Create( bmpInfo.bmWidth, bmpInfo.bmHeight, ILC_COLOR24|ILC_MASK, 1, 1 ) ||
	pAll->Create( bmpInfo.bmWidth, bmpInfo.bmHeight, ILC_COLOR16|ILC_MASK, 1, 1 );
	pAll->Add( &bmDrag, DRAG_COLOR_KEY );
	bmDrag.DeleteObject();
	pAll->BeginDrag( 0, ptOffset );

	return pAll;
}
예제 #10
0
void CTrack::Delta(int dx, int dy)
{
	if (m_bDisabled)
		return;

	CPoint ptOffset(dx, dy);
	CAGMatrix CombinedMatrix = m_Matrix * m_ViewToDeviceMatrix;
	CombinedMatrix.Inverse().Transform(&ptOffset, 1, false);

	m_bMoved = true;
	Draw(false/*bOn*/);
	m_Matrix.Translate(ptOffset.x, ptOffset.y);

	if (m_pDrawProc && m_pAGDC)
	{
		HDC hDC = m_pAGDC->GetHDC();
		m_pDrawProc(hDC, false/*bOn*/, TOOLCODE_UPDATE, m_pData);
	}

	Draw(true/*bOn*/);
}
예제 #11
0
void GraphWidget::dragCtrlPt(const int iMouseX, const int iMouseY)
{
	if (m_ivActiveCurves.size() > 0) {
		Point ptMouse(iMouseX, iMouseY);
		ptMouse.x = max(0.0f, ptMouse.x); 
		ptMouse.x = min((float)(w() - 1), ptMouse.x);
		ptMouse.y = max(0.0f, ptMouse.y); 
		ptMouse.y = min((float)(h() - 1), ptMouse.y);
		for (int i = 0; i < m_ivActiveCurves.size(); ++i) {
			int iCurve = m_ivActiveCurves[i];

			Point ptMouseInCurveCoord = windowToCurve(iCurve, ptMouse);
			Point ptDragStartInCurveCoord = windowToCurve(iCurve, m_ptDragStart);
			Point ptOffset(ptMouseInCurveCoord.x - ptDragStartInCurveCoord.x,

			ptMouseInCurveCoord.y - ptDragStartInCurveCoord.y);

			m_pcrvvCurves[iCurve]->moveControlPoints(m_ivvCurrCtrlPts[iCurve], ptOffset,
				m_cdvCurveDomains[iCurve].minimum(), m_cdvCurveDomains[iCurve].maximum());
		}

		m_ptDragStart = ptMouse;
	}
}
예제 #12
0
파일: NavPane.cpp 프로젝트: ijprest/WinDjVu
void CNavPaneWnd::OnPaint() 
{
	CPaintDC dc(this); // device context for painting

	CRect rcClient = ::GetClientRect(this);

	COLORREF clrBtnface = ::GetSysColor(COLOR_BTNFACE);
	COLORREF clrTabBg = ChangeBrightness(clrBtnface, 0.85);
	COLORREF clrHilight = ::GetSysColor(COLOR_BTNHILIGHT);
	COLORREF clrShadow = ::GetSysColor(COLOR_BTNSHADOW);
	COLORREF clrFrame = ::GetSysColor(COLOR_WINDOWFRAME);

	if (m_tabs.empty())
	{
		dc.FillSolidRect(rcClient, clrBtnface);
		return;
	}

	// Draw tabs offscreen
	CSize szTabs(s_nTabsWidth + 1, rcClient.Height());
	m_offscreenDC.Create(&dc, szTabs);
	CDC* pDC = &m_offscreenDC;

	CRect rcTabs(rcClient);
	rcTabs.right = rcTabs.left + s_nTabsWidth;
	pDC->FillSolidRect(rcTabs, clrTabBg);

	// Vertical line
	CRect rcLine(rcTabs.right, rcClient.top, rcTabs.right + 1, rcClient.bottom);
	pDC->FillSolidRect(rcLine, clrShadow);

	for (int nDiff = (int)m_tabs.size(); nDiff > 0; --nDiff)
	{
		if (m_nActiveTab - nDiff >= 0)
			DrawTab(pDC, m_nActiveTab - nDiff, false);
		if (m_nActiveTab + nDiff < static_cast<int>(m_tabs.size()))
			DrawTab(pDC, m_nActiveTab + nDiff, false);
	}
	DrawTab(pDC, m_nActiveTab, true);

	// Flush bitmap to screen dc
	dc.BitBlt(0, 0, szTabs.cx, szTabs.cy, pDC, 0, 0, SRCCOPY);
	m_offscreenDC.Release();

	// Left space
	rcTabs.left = rcTabs.right + 1;
	rcTabs.right = rcTabs.left + s_nLeftMargin;
	dc.FillSolidRect(rcTabs, clrBtnface);

	if (m_tabs[m_nActiveTab].bHasBorder)
	{
		rcLine.OffsetRect(s_nLeftMargin + 1, 0);
		rcLine.top += s_nTopMargin;
		dc.FillSolidRect(rcLine, clrShadow);
	}

	// Top space
	rcTabs.right = rcClient.right;
	rcTabs.bottom = rcTabs.top + s_nTopMargin;
	dc.FillSolidRect(rcTabs, clrBtnface);

	if (m_tabs[m_nActiveTab].bHasBorder)
	{
		rcLine.right = rcClient.right;
		rcLine.bottom = rcLine.top + 1;
		dc.FillSolidRect(rcLine, clrShadow);
	}

	if (rcClient.Width() > 70)
	{
		// Close button
		if (m_hTheme != NULL)
		{
			if (m_bClosePressed)
				XPDrawThemeBackground(m_hTheme, dc.m_hDC, TP_BUTTON, TS_PRESSED, m_rcClose, NULL);
			else if (m_bCloseActive)
				XPDrawThemeBackground(m_hTheme, dc.m_hDC, TP_BUTTON, TS_HOT, m_rcClose, NULL);
		}
		else
		{
			if (m_bClosePressed)
				dc.Draw3dRect(m_rcClose, clrShadow, clrHilight);
			else if (m_bCloseActive)
				dc.Draw3dRect(m_rcClose, clrHilight, clrShadow);
		}

		CPoint ptOffset(m_rcClose.left + (m_rcClose.Width() - 10) / 2,
				m_rcClose.top + (m_rcClose.Height() - 10) / 2);
		if (m_bClosePressed)
			ptOffset.Offset(1, m_hTheme != NULL ? 0 : 1);

		m_imgClose.Draw(&dc, 0, ptOffset, ILD_NORMAL);

		// Settings button
		if (m_nActiveTab != -1 && m_tabs[m_nActiveTab].bHasSettings)
		{
			if (m_hTheme != NULL)
			{
				if (m_bSettingsPressed)
					XPDrawThemeBackground(m_hTheme, dc.m_hDC, TP_BUTTON, TS_PRESSED, m_rcSettings, NULL);
				else if (m_bSettingsActive)
					XPDrawThemeBackground(m_hTheme, dc.m_hDC, TP_BUTTON, TS_HOT, m_rcSettings, NULL);
			}
			else
			{
				if (m_bSettingsPressed)
					dc.Draw3dRect(m_rcSettings, clrShadow, clrHilight);
				else if (m_bSettingsActive)
					dc.Draw3dRect(m_rcSettings, clrHilight, clrShadow);
			}

			CPoint ptOffset2(m_rcSettings.left + (m_rcSettings.Width() - 10) / 2,
					m_rcSettings.top + (m_rcSettings.Height() - 10) / 2);
			if (m_bSettingsPressed)
				ptOffset2.Offset(1, m_hTheme != NULL ? 0 : 1);

			m_imgSettings.Draw(&dc, 0, ptOffset2, ILD_NORMAL);
		}
	}
}
예제 #13
0
BOOL CModelessMain::OnInitDialog()
{
	CModelessDialog::OnInitDialog();

	// Create status bar at the bottom of the dialog window
	if (m_statusBar.Create(this))
	{
		m_statusBar.SetIndicators(m_lpaIDStatusBar, m_cIDStatusBar);
		OnSetMessageString(AFX_IDS_IDLEMESSAGE);

		// Make a sunken or recessed border around the first pane
		m_statusBar.SetPaneInfo(0, m_statusBar.GetItemID(0),
			SBPS_STRETCH, NULL );
	}

	// Create toolbar at the top of the dialog window
	if (m_toolBar.Create(this))
	{
		m_toolBar.LoadBitmap(m_nIDBitmap);
		m_toolBar.SetButtons(m_lpaIDToolBar, m_cIDToolBar);
	}

	m_toolBar.SetBarStyle(m_toolBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	// We need to resize the dialog to make room for control bars.
	// First, figure out how big the control bars are.
	CRect rcClientStart;
	CRect rcClientNow;
	GetClientRect(rcClientStart);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
				   0, reposQuery, rcClientNow);

	// Now move all the controls so they are in the same relative
	// position within the remaining client area as they would be
	// with no control bars.
	CPoint ptOffset(rcClientNow.left - rcClientStart.left,
					rcClientNow.top - rcClientStart.top);

	CRect  rcChild;
	CWnd* pwndChild = GetWindow(GW_CHILD);
	while (pwndChild)
	{
		pwndChild->GetWindowRect(rcChild);
		ScreenToClient(rcChild);
		rcChild.OffsetRect(ptOffset);
		pwndChild->MoveWindow(rcChild, FALSE);
		pwndChild = pwndChild->GetNextWindow();
	}

	// Adjust the dialog window dimensions
	CRect rcWindow;
	GetWindowRect(rcWindow);
	rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
	rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
	MoveWindow(rcWindow, FALSE);

	// And position the control bars
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);         // Set big icon
	SetIcon(m_hIcon, FALSE);        // Set small icon

	// Finally, center the dialog on the screen
	CenterWindow();
	return TRUE;
}
예제 #14
0
파일: Dlg.cpp 프로젝트: 03bekjob/Strg
BOOL CDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	hInstResClnt = AfxGetResourceHandle();
	AfxSetResourceHandle(::GetModuleHandle(L"AddBank.dll"));

	CString s,strSql,strSql2;
	s.LoadString(IDS_STRING9014);
	this->SetWindowText(s);


	InitStaticText();

	int iTBCtrlID;
	short i;
	COleVariant vC;

	m_wndToolBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS |
	                        CBRS_FLYBY | CBRS_BORDER_BOTTOM);
	m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);
	iTBCtrlID = m_wndToolBar.CommandToIndex(ID_BUTTON32779);
	if(iTBCtrlID>=0){
		for(int j=iTBCtrlID;j<(iTBCtrlID + 6);j++){
			switch(j){
				case 0:
					m_wndToolBar.SetButtonStyle(j,TBBS_CHECKBOX);
					m_iBtSt =m_wndToolBar.GetToolBarCtrl().GetState(ID_BUTTON32779);
					break;
/*				case 1:
				case 2:
				case 3:
				case 4:
					break;
*/
				default:
					m_wndToolBar.SetButtonStyle(j,TBBS_BUTTON);
					break;
			}
		}
	}
	OnEnableButtonBar(m_iBtSt,&m_wndToolBar);
	m_wndToolBar.SetButtonInfo(5,ID_EDIT_TOOLBAR,TBBS_SEPARATOR,130);
	// определяем координаты области, занимаемой разделителем
	CRect rEdit; 
	m_wndToolBar.GetItemRect(5,&rEdit);
	rEdit.left+=6; rEdit.right-=6; // отступы
	if(!(m_EditTBCh.Create(WS_CHILD|
		ES_AUTOHSCROLL|WS_VISIBLE|WS_TABSTOP|
		WS_BORDER,rEdit,&m_wndToolBar,ID_EDIT_TOOLBAR))) return -1;
	
	CRect rcClientStart;
	CRect rcClientNow;
	GetClientRect(rcClientStart);
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
				   IDR_TOOLBAR1, reposQuery , rcClientNow);
	CPoint ptOffset(rcClientNow.left - rcClientStart.left,
										rcClientNow.top - rcClientStart.top);

/*	CRect rcChild;
	CWnd* pwndChild = GetWindow(GW_CHILD);
//	Это для смещения всех контрлов
	while (pwndChild)
	{
		pwndChild->GetWindowRect(rcChild);
		ScreenToClient(rcChild);
		rcChild.OffsetRect(ptOffset);
		pwndChild->MoveWindow(rcChild, FALSE);
		pwndChild = pwndChild->GetNextWindow();
	}

	CRect rcWindow;
	GetWindowRect(rcWindow);
	rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
	rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
	MoveWindow(rcWindow, FALSE);	
*/
	// Положение панелей
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
				 IDR_TOOLBAR1, reposDefault , rcClientNow);

/*	if(m_EditTB.GetSafeHwnd()!=NULL){
		AfxMessageBox("not NULL");
		if(m_EditTBSChar.SubclassWindow(m_EditTB.GetSafeHwnd())){
			AfxMessageBox("ok");
		}
	}
*/
	m_vNULL.vt = VT_ERROR;
	m_vNULL.scode = DISP_E_PARAMNOTFOUND;

	ptrCmd1 = NULL;
	ptrRs1 = NULL;

	ptrCmd1.CreateInstance(__uuidof(Command));
	ptrCmd1->ActiveConnection = ptrCnn;
	ptrCmd1->CommandType = adCmdText;

	ptrRs1.CreateInstance(__uuidof(Recordset));
	ptrRs1->CursorLocation = adUseClient;
	ptrRs1->PutRefSource(ptrCmd1);
	strSql = _T("QT48");
	OnShowGrid(strSql, ptrRs1,ptrCmd1,m_DataGrid1,InitDataGrid1);

	m_CurCol = m_DataGrid1.get_Col();
	if(m_CurCol==-1 || m_CurCol==0){
		m_CurCol=1;
	}
	m_iCurType = GetTypeCol(ptrRs1,m_CurCol);
	m_EditTBCh.SetTypeCol(m_iCurType);

	if(m_bFndC){
		short fCol=0;
		m_Flg = false;
		OnFindInGrid(m_strFndC,ptrRs1,fCol,m_Flg);
		m_Flg = true;
	}

	ptrCmd2 = NULL;
	ptrRs2 = NULL;

	ptrCmd2.CreateInstance(__uuidof(Command));
	ptrCmd2->ActiveConnection = ptrCnn;
	ptrCmd2->CommandType = adCmdText;

	ptrRs2.CreateInstance(__uuidof(Recordset));
	ptrRs2->CursorLocation = adUseClient;
	ptrRs2->PutRefSource(ptrCmd2);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
예제 #15
0
void
ESSimpleRenderView::OnPaintClient(_DC *pDC, _Rect* pRectDC, _Rect* pRectClient){
	ESChildScrollView::OnPaintClient(pDC, pRectDC, pRectClient);

	_Rect	rcControlDC, rcInvalid;
	_Rect	rRect		= GetClientRect();
	rcControlDC.left	= (rRect.left - pRectClient->left) + pRectDC->left; 
	rcControlDC.top		= (rRect.top - pRectClient->top) + pRectDC->top; 
	rcControlDC.right	= rcControlDC.left + rRect.Width(); 
	rcControlDC.bottom	= rcControlDC.top + rRect.Height();
	rcControlDC.DeflateRect(m_nBorderWidth, m_nBorderWidth, m_nBorderWidth, m_nBorderWidth);

	if( m_pVScroll && m_pVScroll->IsVisible() )
		rcControlDC.right -= m_pVScroll->GetClientWidth();

	_Point	ptOffset(rcControlDC.left, rcControlDC.top);
	_Rect	rcLineDC, rcDrawDC;

	int nScrollPos		= GetVScrollPos();
	m_pTopLine			= GetLineByOffset(nScrollPos);
	if( m_pTopLine )
		m_nTopOffsetY	= nScrollPos;
	else
		m_nTopOffsetY	= 0;

	RenderLine* pLine	= m_pTopLine;
	if( !pLine )
		pLine = m_pRootLine->m_pNextLine;

	int		nLineIndex	= 0;
//	CPen	penBorder(PS_SOLID, 1, m_crLineBorder);
//	CPen*	penOld		= pDC->SelectObject(&penBorder);
//	CBrush	brushClr1(m_crLine1);
//	CBrush	brushClr2(m_crLine2);

	while( pLine ){
		rcLineDC.left	= ptOffset.x;
		rcLineDC.top	= ptOffset.y - m_nTopOffsetY;
		rcLineDC.right	= rcControlDC.right;
		rcLineDC.bottom	= rcLineDC.top +  pLine->m_szLine.cy;

		rcDrawDC		= rcControlDC&rcLineDC;
		if( !rcDrawDC.IsRectEmpty() ){
			if( m_bLineColors ){
				_Rect rcFillLine = rcDrawDC;
				if( rcLineDC.top == rcDrawDC.top && nLineIndex ){
//					pDC->MoveTo(rcDrawDC.left, rcDrawDC.top);
//					pDC->LineTo(rcDrawDC.right, rcDrawDC.top);
					rcFillLine.top ++;
					}

				// Completely visible last line.
				if( !pLine->m_pNextLine && rcLineDC.bottom == rcDrawDC.bottom ){
//					pDC->MoveTo(rcDrawDC.left,	rcDrawDC.bottom-1);
//					pDC->LineTo(rcDrawDC.right, rcDrawDC.bottom-1);
					rcFillLine.bottom --;
					}

				pDC->FillSolidRect(rcFillLine, ((nLineIndex%2) ? m_crLine2 : m_crLine1));
				}
			pLine->Draw(pDC, rcLineDC, rcDrawDC, this);
			}

		pLine			= pLine->m_pNextLine;
		ptOffset.y		+= rcLineDC.Height();
		if( ptOffset.y >= (rcControlDC.bottom + m_nTopOffsetY) )
			break;

		nLineIndex ++;
		}

//	penBorder.DeleteObject();
//	brushClr1.DeleteObject();
//	brushClr2.DeleteObject();
	}
예제 #16
0
파일: geom.c 프로젝트: vnaybhat/emulab
// ptBlend - Blend between two points, 0.0 for first, 1.0 for the second.
// Result can be the same point as either of the two point arguments.b
void ptBlend(geomPt p1, geomPt p2, double t, geomPt result)
{
  geomVec offset;
  vecFrom2Pts(p1, p2, offset);
  ptOffset(p1, offset, t, result);
}
예제 #17
0
BOOL CEmoticonBase::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | /*CBRS_SIZE_DYNAMIC*/  CBRS_SIZE_FIXED  ) ||
		!m_wndToolBar.LoadToolBar(IDR_TOOLBAR_EMOTICON))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}	
	
	//À̸ðƼÄÜ	
	m_imgListFaces.Create(20, 20, ILC_COLOR24|ILC_MASK, 0, 1);
	//CBitmap bmpFaces;
	m_bmpFaces.LoadBitmap(IDB_BITMAP_EMOTICON);
	m_imgListFaces.Add(&m_bmpFaces, RGB(255, 255, 255));	
	
	m_wndToolBar.GetToolBarCtrl().SetImageList(& m_imgListFaces );
		
		
	//for (int i = 0; i < 39; i++)
	for (int i = 7; i < 39; i += 8)
	{
		UINT nStyle = m_wndToolBar.GetButtonStyle(i);
		nStyle |= TBBS_WRAPPED;
		m_wndToolBar.SetButtonStyle( i, nStyle );
	}	
	
	CRect rcClientStart;
	CRect rcClientNow;
	GetClientRect(rcClientStart);

	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,   0, reposQuery, rcClientNow);
	
	CPoint ptOffset(rcClientNow.left - rcClientStart.left,	rcClientNow.top - rcClientStart.top);

	CRect  rcChild;
	CWnd* pwndChild = GetWindow(GW_CHILD);

	while (pwndChild)
	{
		pwndChild->GetWindowRect(rcChild);
		ScreenToClient(rcChild);
		rcChild.OffsetRect(ptOffset);
		pwndChild->MoveWindow(rcChild, FALSE);
		pwndChild = pwndChild->GetNextWindow();
	}

	CRect rcWindow;
	GetWindowRect(rcWindow);

	rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
	rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();

	MoveWindow(rcWindow, FALSE);

	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}