コード例 #1
0
ファイル: StartupView.cpp プロジェクト: identity0815/os45
void CStartupView::OnSize(UINT nType, int cx, int cy)
{
   BOOL bHBar, bVBar;
   CheckScrollBars(bHBar, bVBar);
   CScrollView::OnSize(nType, cx, cy);

   int iNewWidth = cx < VIEW_DEFAULT_WIDTH ? VIEW_DEFAULT_WIDTH : cx;
   int iNewHeight = cy < VIEW_DEFAULT_HEIGHT ? VIEW_DEFAULT_HEIGHT : cy;
   
   int nVOffset = 0;
   int nHOffset = 0;
   DWORD dwStyle = AfxGetApp()->GetMainWnd()->GetStyle();
   CRect rcMainWnd;
   AfxGetApp()->GetMainWnd()->GetWindowRect(&rcMainWnd);
   if((dwStyle & WS_MAXIMIZE) != 0 || m_bIsRetFromEditMode)
   {
      nVOffset =  bVBar? 17: 0;
      nHOffset =  bHBar? 17: 0;
   }
   CSize siTotal = GetTotalSize();
   CRect rcClient(0, 0, siTotal.cx, siTotal.cy);

   if (!m_bIsRetFromEditMode || ! m_rcLastMainWndRect.EqualRect(&rcMainWnd)) {
       SetScrollSizes(MM_TEXT, CSize(iNewWidth + nHOffset, iNewHeight + nVOffset));
   } else {
       SetScrollSizes(MM_TEXT, m_szLastSize);
   }

   RepositionButtons();
   UpdateBars();
}
コード例 #2
0
void CUIDesignerView::Notify(TNotifyUI& msg)
{
	CControlUI* pControl=msg.pSender;

	if(msg.sType == _T("PropertyBeginChanged"))
	{
		UIAttribute* pAttrib = (UIAttribute*)msg.lParam;
		m_UICommandHistory.Begin(pControl, pAttrib->pstrName, pAttrib->pstrValue);
	}
	else if(msg.sType == _T("PropertyEndChanged"))
	{
		UIAttribute* pAttrib = (UIAttribute*)msg.lParam;
		m_UICommandHistory.End(pControl, pAttrib->pstrName, pAttrib->pstrValue);
	}
	else if(msg.sType == _T("PosBeginChanged"))
		m_UICommandHistory.Begin(*(CArray<CControlUI*,CControlUI*>*)msg.lParam, actionModify);
	else if(msg.sType == _T("PosEndChanged"))
		m_UICommandHistory.End();
	else if(msg.sType==_T("setpos"))
	{
		if(GetControlType(pControl)==typeForm)
		{
			CWindowUI* pForm=m_LayoutManager.GetForm();
			SIZE size;
			size.cx=pForm->GetFixedWidth();
			size.cy=pForm->GetFixedHeight();
			pForm->SetInitSize(size.cx,size.cy);

			g_pPropertiesWnd->SetPropValue(pControl,tagWindowSize);
			SetScrollSizes(MM_TEXT,CSize(size.cx+FORM_OFFSET_X+80,
				size.cy+FORM_OFFSET_Y+80));
			m_MultiTracker.SetFormSize(size);
		}
		else
		{
			CControlUI* pParent=pControl->GetParent();
			if(pParent)
				pParent->SetPos(pParent->GetPos());

			g_pPropertiesWnd->SetPropValue(pControl,tagPos);
			g_pPropertiesWnd->SetPropValue(pControl,tagSize);
		}
	}
	else if(msg.sType==_T("formsize"))
	{
		if(GetControlType(pControl)!=typeForm)
			return;
		CWindowUI* pForm=m_LayoutManager.GetForm();
		SIZE size=pForm->GetInitSize();

		pForm->SetFixedWidth(size.cx);
		pForm->SetFixedHeight(size.cy);

		SetScrollSizes(MM_TEXT,CSize(size.cx+FORM_OFFSET_X+80,
			size.cy+FORM_OFFSET_Y+80));
		m_MultiTracker.SetFormSize(size);
	}

	this->GetDocument()->SetModifiedFlag();
}
コード例 #3
0
ファイル: BigView.cpp プロジェクト: cmosher01/OpenGRO
void CBigScrollView::SetScaleToFitSize(SIZE sizeTotal)
{
	// do not use CScrollView::SetScaleToFit();
	// this function change the size of the view !
	wxSize sizeClient, sizeSb;
	GetTrueClientSize(sizeClient, sizeSb);
	if (m_nMapMode != MM_TEXT)
	{
		wxASSERT(m_nMapMode > 0); // must be set
		CWindowDC dc(NULL);
		dc.SetMapMode(m_nMapMode);
		dc.DPtoLP(&sizeClient);
	}
	if (sizeClient.cy < MulDiv(sizeTotal.cy, sizeClient.cx, sizeTotal.cx))
	{
		// add 1% to eliminate scroll bars
		sizeTotal.cy = MulDiv(sizeTotal.cy, 101, 100);
		sizeTotal.cx = MulDiv(sizeTotal.cx, sizeClient.cy, sizeTotal.cy);
		sizeTotal.cy = sizeClient.cy;
	}
	else
	{
		// add 1% to eliminate scroll bars
		sizeTotal.cx = MulDiv(sizeTotal.cx, 101, 100);
		sizeTotal.cx = sizeClient.cx;
		sizeTotal.cy = MulDiv(sizeTotal.cy, sizeClient.cx, sizeTotal.cx);
	}
	SetScrollSizes(m_nMapMode, sizeTotal);
}
コード例 #4
0
ファイル: MaterialView.cpp プロジェクト: privatosan/RayStorm
/*************
 * DESCRIPTION:	constructor
 * INPUT:			-
 * OUTPUT:			-
 *************/
CMatView::CMatView()
{
    SetScrollSizes(MM_TEXT, CSize(0, 0), CSize(MATWIDTH, MATTOTALHEIGHT), CSize(MATWIDTH, MATTOTALHEIGHT));
    nSelectedMaterial = -1;
    m_nIDDrag = RegisterClipboardFormat(_T("MatView"));
    pMatWnd = this;
}
コード例 #5
0
ファイル: MaterialView.cpp プロジェクト: privatosan/RayStorm
/*************
 * DESCRIPTION:	handler for refreshing of screen, called from Windows
 * INPUT:			pDC	pointer to device context
 * OUTPUT:			-
 *************/
void CMatView::OnDraw(CDC *pDC)
{
    CPalette *pOldPalette;
    CRect rect;
    int i, x, y;

    pOldPalette = pDC->SelectPalette(m_pPalette, TRUE);
    pDC->RealizePalette();

    GetClientRect(rect);

    i = 0;
    x = y = 0;

    for (i = 0; i < aMaterials.GetSize(); i++)
    {
        ((CMaterial*)aMaterials[i])->Show(pDC, x, y);

        x += MATWIDTH;
        if (x + MATWIDTH > rect.right && i < aMaterials.GetSize() - 1)
        {
            x = 0;
            y += MATTOTALHEIGHT;
        }
    }
    SetScrollSizes(MM_TEXT, CSize(rect.Width() - MATWIDTH, y + MATTOTALHEIGHT), CSize(MATWIDTH/2, MATTOTALHEIGHT/2), CSize(MATWIDTH/2, MATTOTALHEIGHT/2));

    pDC->SelectPalette(pOldPalette, TRUE);
}
コード例 #6
0
void CUIDesignerView::OnInitialUpdate()
{
	__super::OnInitialUpdate();

	// TODO: 在此添加专用代码和/或调用基类
	CUIDesignerDoc* pDoc=GetDocument();

	m_LayoutManager.Init(this->GetSafeHwnd(),pDoc->GetPathName());
	CFormUI* pForm=m_LayoutManager.GetForm();

	g_pClassView->InsertUITreeItem(pForm,pDoc->GetTitle());
	if(pForm->GetRowCount()>0)
	{
		InitUI(pForm->GetItemAt(0), 1);
		m_LayoutManager.GetManager()->InitControls(pForm->GetItemAt(0));
	}
	g_pClassView->SelectUITreeItem(pForm);
	m_bInit=true;

	m_MultiTracker.SetHandleSize(TRACKER_HANDLE_SIZE);
	m_MultiTracker.SetStyle(dottedLine|resizeOutside);
	m_MultiTracker.SetFormSize(pForm->GetInitSize());
	m_MultiTracker.Add(CreateTracker(pForm));

	SetScrollSizes(MM_TEXT,CSize(FORM_INIT_WIDTH+80,FORM_INIT_HEIGHT+80));
}
コード例 #7
0
void CVistaView::OnInitialUpdate()
{
    CScrollView::OnInitialUpdate ();

    CString string;
    CSize sizeTotal;
    CBitmap* pBitmap = GetDocument ()->GetBitmap ();

	//
	// If a bitmap is loaded, set the view size equal to the bitmap size.
	// Otherwise, set the view's width and height to 0.
	//
    if (pBitmap != NULL) {
        DIBSECTION ds;
        pBitmap->GetObject (sizeof (DIBSECTION), &ds);
        sizeTotal.cx = ds.dsBm.bmWidth;
        sizeTotal.cy = ds.dsBm.bmHeight;
        string.Format (_T ("\t%d x %d, %d bpp"), ds.dsBm.bmWidth,
            ds.dsBm.bmHeight, ds.dsBmih.biBitCount);
    }
    else {
        sizeTotal.cx = sizeTotal.cy = 0;
        string.Empty ();
    }

    AfxGetMainWnd ()->SendMessage (WM_USER_UPDATE_STATS, 0,
        (LPARAM) (LPCTSTR) string);
    SetScrollSizes (MM_TEXT, sizeTotal);
}
コード例 #8
0
ファイル: DlgView.cpp プロジェクト: SoyPay/DacrsUI
void CDlgView::OnDraw(CDC* pDC)
{
    CDocument* pDoc = GetDocument();

    CBitmap BK;
    BK.LoadBitmap(IDB_BITMAP_ADDAPP_BJ);
    CDC MemDC;
    MemDC.CreateCompatibleDC(pDC);
    MemDC.SelectObject(&BK);
    BITMAP bm;
    BK.GetBitmap(&bm);

    //pDC->BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &MemDC, 0, 0, SRCCOPY);

    CRect m_Rect;
    GetClientRect(&m_Rect);
    m_Rect.bottom += 100;
    CSize sizeTotal;
    // TODO: calculate the total size of this view
    sizeTotal.cx = 262;
    //if (m_pDisplayDlg != NULL)
    //{
    sizeTotal.cy = GetAllCtrlHeight();
    //}
    SetScrollSizes(MM_TEXT, sizeTotal);
    //updateListCtrlPos();
    // TODO: add draw code here
}
コード例 #9
0
void CGDIPlusDBBView::OnInitialUpdate()
{
	CGDIPlusDBBDoc* pDoc = GetDocument();

	GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL);

	// 显示默认中国地图
	USES_CONVERSION;
	pDoc->m_pStrMapName = "china.jpg";
	CString pStrFullPath = pDoc->m_pStrMapPath + pDoc->m_pStrMapName;
	LPWSTR wStrFullPath = A2W(pStrFullPath);
	Image imgDefault(wStrFullPath);
	// 滚动条大小
	CSize sizeTotal;
	sizeTotal.cx = imgDefault.GetWidth();
	sizeTotal.cy = imgDefault.GetHeight();
	SetScrollSizes(MM_TEXT, sizeTotal);

	// 准备画布
	CDC * pDC = this->GetDC();
	m_memDC.CreateCompatibleDC(NULL);
	m_memBitmap.CreateCompatibleBitmap(pDC,2000,2000);
	ReleaseDC(pDC);

	CScrollView::OnInitialUpdate();
}
コード例 #10
0
ファイル: View2.cpp プロジェクト: Randy090807/Github
void CView2::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	// TODO: Add your specialized code here and/or call the base class
	SetScrollSizes(MM_TEXT, CSize(1, 1));
}
コード例 #11
0
ファイル: dibview.cpp プロジェクト: dani102/Tema-2
void CDibView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();
	ASSERT(GetDocument() != NULL);

	SetScrollSizes(MM_TEXT, GetDocument()->GetDocSize());
}
コード例 #12
0
void CImageThumbToolView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();

	// TODO: Add your specialized code here and/or call the base class
	SetScrollSizes(MM_TEXT, CSize(1000, 500));
}
コード例 #13
0
ファイル: DComView.cpp プロジェクト: cdesjardins/DCom
LRESULT CDComView::OnDocUpdate(WPARAM nNumNewLinesCleared, LPARAM)
{
    CRect rcClient;
    CPoint ptScroll;
    CDComDoc *pDoc;
    CMainFrame *pMainFrm = (CMainFrame *)AfxGetMainWnd();
    if (pMainFrm)
    {
        m_sizeCharDimensions = pMainFrm->GetLineDimentions("a", 1);
    }

    pDoc = GetDocument();
    if (pDoc)
    {
        pDoc->m_cLineBuffer.Enter();
        ptScroll = GetDeviceScrollPosition();

        if ((nNumNewLinesCleared) && (IsScrollBarAtBottom() == false))
        {
            ptScroll.y -= m_sizeCharDimensions.cy * nNumNewLinesCleared;
            ScrollToPosition(ptScroll);
        }
        GetClientRect(&rcClient);

        SetCaretPos(ptScroll, rcClient);
        SetScrollSizes();
        pDoc->m_cLineBuffer.Exit();
    }
    return 0;
}
コード例 #14
0
ファイル: Prime95View.cpp プロジェクト: irukasti/mprime
void CPrime95View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
	CFrameWnd *parent;
	CSize	sz;
	CPoint	pos;
	int	new_scroll_height, new_scroll_width;

	parent = GetParentFrame();

	if (parent != NULL) {

		if (charHeight == 0) getCharSize ();

		sz = GetTotalSize ();

		new_scroll_height = NumLines * charHeight;
		new_scroll_width = MaxLineSize * charWidth;

		pos = GetScrollPosition ();
		pos.y += (new_scroll_height - sz.cy);
		if (pos.y < 0) pos.y = 0;
		sz.cx = new_scroll_width;
		sz.cy = new_scroll_height;
		SetScrollSizes (MM_TEXT, sz);
		ScrollToPosition (pos);
		parent->RecalcLayout ();
	}

	CScrollView::OnUpdate (pSender, lHint, pHint);
}
コード例 #15
0
ファイル: SpermView.cpp プロジェクト: niepp/sperm-x
void CSpermView::OnSize(UINT nType, int cx, int cy) 
{
	CSize sz(100,100);
	SetScrollSizes(MM_TEXT,sz);

	CScrollView::OnSize(nType, cx, cy);	
}
コード例 #16
0
void CObjectRightView::OnSize(UINT nType, int cx, int cy) 
{
	SetScrollSizes( MM_TEXT, CSize(cx, cy) );

	CFormView::OnSize(nType, cx, cy);

	if	(initialized) {
		CRect rc;

		m_iWidth = cx;
		m_iHeight = cy;

		// Save static reference to the render window
		CWnd* pGroup = GetDlgItem(IDC_RENDERWINDOW);
		pGroup->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER);
		pGroup->GetClientRect(&rc);
		pGroup->MapWindowPoints(this, &rc);

		m_hwndRenderWindow = GetDlgItem(IDC_RENDERWINDOW)->GetSafeHwnd();
		
		InitializeDevice();
		InitializeDeviceBuffer();

		Render();
	}
}
コード例 #17
0
void campaign_tree_view::OnDeleteRow() 
{
	int i, z;

	if (!Context_mission) {
		MessageBox("Can't delete the top level");
		return;
	}

	for (i=z=0; i<Campaign.num_missions; i++)
		if (Campaign.missions[i].level == Context_mission)
			z++;

	if (z) {
		z = MessageBox("Deleting row will remove all missions on this row", "Notice", MB_ICONEXCLAMATION | MB_OKCANCEL);
		if (z == IDCANCEL)
			return;
	}

	while (i--)
		if (Campaign.missions[i].level == Context_mission)
			remove_mission(i);

	for (i=0; i<Campaign.num_missions; i++)
		if (Campaign.missions[i].level > Context_mission)
			Campaign.missions[i].level--;

	total_levels--;
	SetScrollSizes(MM_TEXT, CSize(total_width * CELL_WIDTH, total_levels * LEVEL_HEIGHT));
	Invalidate();
	UpdateWindow();
	Campaign_modified = 1;
}
コード例 #18
0
ファイル: FileView.cpp プロジェクト: BlackVodka/busmaster
/******************************************************************************
  Function Name    :  OnUpdate

  Input(s)         :  CView* pSender, LPARAM lHint, CObject* pHint
  Output           :  -
  Functionality    :  Called by the frame work to update the view.
                      Scrolls to the position, for any changes in the
                      view.
  Member of        :  CFileView
  Friend of        :      -

  Author(s)        :  Amarnath Shastry
  Date Created     :  05.03.2002
******************************************************************************/
void CFileView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/)
{
    CSize omDocSize;

    // Set SCROLL Sizes
    CFunctionEditorDoc* pomDoc = omGetDocument();

    // Get Character Height & Width
    CClientDC omDeviceContext(this);

    m_nCharHeight = GET_FILE_VIEW_CHAR_HEIGHT();
    m_nCharWidth  = GET_FILE_VIEW_CHAR_WIDTH();


    if(pomDoc != nullptr)
    {
        omDocSize.cx  =  ((pomDoc -> nGetMaxLineLength() + 1) * m_nCharWidth);
        omDocSize.cy  =  m_nCharHeight * ((pomDoc -> dwGetLineCount() + 1) +
                                          SPACE_BET_LINE_IN_FILE_VIEW);
        if( GetTotalSize() != omDocSize)
        {
            SetScrollSizes(MM_TEXT, omDocSize);
        }
    }

    // refresh the view
    Invalidate(TRUE);
}
コード例 #19
0
ファイル: dibview.cpp プロジェクト: dani102/Tema-2
void CDibView::OnEditPaste()
{
	HDIB hNewDIB = NULL;

	if (OpenClipboard())
	{
		BeginWaitCursor();

		hNewDIB = (HDIB) CopyHandle(::GetClipboardData(CF_DIB));

		CloseClipboard();

		if (hNewDIB != NULL)
		{
			CDibDoc* pDoc = GetDocument();
			pDoc->ReplaceHDIB(hNewDIB); // and free the old DIB
			pDoc->InitDIBData();    // set up new size & palette
			pDoc->SetModifiedFlag(TRUE);

			SetScrollSizes(MM_TEXT, pDoc->GetDocSize());
			OnDoRealize((WPARAM)m_hWnd,0);  // realize the new palette
			pDoc->UpdateAllViews(NULL);
		}
		EndWaitCursor();
	}
}
コード例 #20
0
ファイル: spiroView.cpp プロジェクト: Jinjiego/VCSamples
void CSpiroView::OnInitialUpdate() 
{
	CScrollView::OnInitialUpdate();

	if (m_pAnchor != NULL)
	{
		delete m_pAnchor;
		m_pAnchor = NULL;
	}

	if (m_pWheel != NULL)
	{
		delete m_pWheel;
        m_pWheel = NULL;
	}

	m_bDrawingActive = false;
	m_bStartDrag = false;
	m_bDrawingDone = false;
	m_bDroppingAnchor = false;
	m_bDroppingWheel = false;
	m_bMovingPencil = false;
	m_dDataAnchorFirst = 0;
	m_dDataWheelFirst = 0;

	CSpiroDoc* pDoc = GetDocument();
	ENSURE(pDoc != NULL);
	SetScrollSizes(MM_SPIRO, pDoc->m_sizeExtent);
}
コード例 #21
0
///===加载图片================================================///
// 参数: 文件实例
// add by xuyz 2011-09-17
void CPicScrollView::LoadPic(CFile& file)
{	
	CArchive ar(&file, CArchive::load | CArchive::bNoFlushOnDelete);
	
	CArchiveStream arcstream(&ar);
	
	ReleasePic();
	
	if (FAILED(OleLoadPicture(&arcstream, 0, FALSE, IID_IPicture, (void**)&m_pPic)))
	{
		return;
	}
	
	m_pPic->get_Width(&m_hmWidth);     
	m_pPic->get_Height(&m_hmHeight); 
    
	CClientDC dc(this);
	
	CSize sz(m_hmWidth,m_hmHeight);
	dc.HIMETRICtoDP(&sz);
	m_cxPic = sz.cx;
	m_cyPic = sz.cy;
	
	SetScrollSizes(MM_TEXT, sz);
	
	Invalidate();
}
コード例 #22
0
// scrolling aid
void DisplayView::UpdateScrolling()
{
    CSize	size = graph.GetGraphSize();

    SetScrollSizes(MM_TEXT, size);

}
コード例 #23
0
ファイル: SpermView.cpp プロジェクト: niepp/sperm-x
void CSpermView::FileOpenDiskVideoFile()
{
	CMainFrame* pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CFileDialog dlg(TRUE,NULL,NULL,NULL,"AVI文件(*.avi)|*.avi|Mpeg文件(*.mpg)|*.mpg|Mp3文件(*.mp3)|*.mp3|Wave文件(*.wav)|*.wav|All Files (*.*)|*.*||");
	dlg.m_ofn.lpstrTitle="打开多媒体文件";
	if(dlg.DoModal()==IDOK)
	{
		theView3->GetDlgItem(IDC_BUTTON_MORPHADETECT)->EnableWindow(FALSE);
		theView3->GetDlgItem(IDC_BTN_LIVEDETECTED)->EnableWindow(TRUE);

		if(theView3->m_pwndLiveDetectDlg->m_pVideoPlay)
		{
			theView3->m_pwndLiveDetectDlg->m_pVideoPlay->OnVideoStop();
			delete theView3->m_pwndLiveDetectDlg->m_pVideoPlay;
			theView3->m_pwndLiveDetectDlg->m_pVideoPlay = NULL;
		}

		theView3->m_pwndLiveDetectDlg->m_pVideoPlay = new CMyVideoPlay;
		theView3->m_pwndLiveDetectDlg->m_pVideoPlay->Init(this->GetSafeHwnd(), 
													  this->GetSafeHwnd(), 
													  dlg.GetPathName() );
		theView3->m_pwndLiveDetectDlg->m_pVideoPlay->OnVideoPlay();

		theView3->m_pwndLiveDetectDlg->m_dFrequency 
			= theView3->m_pwndLiveDetectDlg->m_pVideoPlay->GetVideoInfo().mFramePerSecond;
		m_eViewShowMode = VIDEO_PLAY;
		SetScrollSizes(MM_TEXT, CSize(100,100));
	}
}
コード例 #24
0
ファイル: QTTDemoView.cpp プロジェクト: seancyw/dev-center
void CQTTDemoView::OnInitialUpdate()
{
	// Called at application start, and at the File=>Reset command.

	CScrollView::OnInitialUpdate();
	CSize sizeTotal;
	sizeTotal.cx = sizeTotal.cy = 100;

	// QTransformTracker works in all mapping modes. If you want to check,
	// change MM_TEXT to f.i. MM_LOENGLISH. Note: in that case all
	// objects will be mirrored across the horizontal axis.
	SetScrollSizes(MM_TEXT /* MM_LOENGLISH */, sizeTotal);

	m_Tracker.Clear(NULL);

	// Restore QTransformTracker's defaults. No member function for this in
	// QTransformTracker, because I figured it would only make sense in this demo program.
	m_Tracker.m_Options = QTransformTracker::OptionDefault;
	m_Tracker.m_colorMark = RGB(192, 192, 192);
	m_Tracker.m_colorHandles = RGB(0, 0, 0);
	m_Tracker.m_colorCenter = RGB(0, 0, 0);
	m_Tracker.m_colorTrack = RGB(0, 0, 0);
	m_Tracker.m_colorPath = RGB(0, 0, 0);
	m_Tracker.SetMetrics(4, 4, 2);

	InitSillyObjects();
}
コード例 #25
0
ファイル: DXAppView.cpp プロジェクト: B12040331/handvu
void CDXAppView::SetVideoWindowSize(int width, int height) 
{
  CDXAppDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

  int source_width, source_height;
  pDoc->GetDXManager()->GetVideoSourceSize(&source_width, &source_height);
  if (source_height<0) {
    source_height = -source_height;
  }

  CRect rc;
  GetClientRect( &rc );
  if (width==0 && height==0) {
    width = source_width;
    height = source_height;
//      MoveWindow(&rc);
  } else {
    width = max(width, source_width);
    height = max(height, source_height);
    double ratio = (double)source_width/(double)source_height;
    width = min(width, (int)((double)height*ratio));
    height = min(height, (int)((double)width/ratio));
  }
  pDoc->GetDXManager()->SetVideoWindowPosition( rc.left, rc.top, width, height );
  m_video_scale = (double)(rc.right-rc.left)/(double)source_width;
  m_local_fixed_mouse.x = m_virtual_mouse.x = (rc.right-rc.left)/2;
  m_local_fixed_mouse.y = m_virtual_mouse.y = (rc.bottom-rc.top)/2;

  SetScrollSizes(MM_TEXT, CSize(source_width, source_height));

  VERBOSE2(4, "ApV: scroll size %d %d", source_width, source_height);
}
コード例 #26
0
ファイル: WeekView.cpp プロジェクト: johanericsson/schedule
void WeekView::Draw(const Period& period,
							int weekNumber,CDC* pDC)
{
	CString strWeekNumber;
	strWeekNumber.Format(_T("Week Number: %d"),m_weekNumber+1);
	CRect rcNames(40,10,40,10);
	CRect rcHeight(rcNames);
	pDC->DrawText(strWeekNumber,&rcHeight,DT_NOCLIP | DT_CALCRECT);
	int height = rcHeight.Height()+2;
	pDC->DrawText(strWeekNumber,rcNames,DT_NOCLIP);
	rcNames.OffsetRect(0,height);

	vector<vector<Slot> > cached(7);
	CString names(_T("Names"));
	pDC->DrawText(names,rcNames,DT_NOCLIP);
	


	CRect rcHoursNeeded(rcNames);
	rcHoursNeeded.OffsetRect(200,0);
	pDC->DrawText(_T("Hours Needed"),rcHoursNeeded,DT_NOCLIP);
	CRect rcHoursUsed(rcHoursNeeded);
	rcHoursUsed.OffsetRect(200,0);
	pDC->DrawText(_T("Hours Used"),rcHoursUsed,DT_NOCLIP);
	
	for(int i=0;i<period.m_data.m_nurses.Size();i++)
	{
		rcNames.OffsetRect(0,height);
		rcHoursNeeded.OffsetRect(0,height);
		rcHoursUsed.OffsetRect(0,height);

		const Nurse& nurse = period.m_data.m_nurses[i];
		

		int weeklyHours = nurse.GetWeeklyHours();
		CString strWeeklyHours;
		strWeeklyHours.Format(_T("%d\n"),weeklyHours);
		
		int numberOfHours = GetNumberOfHoursPerWeek(period,nurse,weekNumber,cached);
		CString strHoursUsed;
		strHoursUsed.Format(_T("%d\n"),numberOfHours);
		
		if (weeklyHours > 0)
		{
			if (weeklyHours < numberOfHours)
				pDC->SetTextColor(RGB(0,0,255));
			else
			if (weeklyHours > numberOfHours)
				pDC->SetTextColor(RGB(255,0,0));
		}

		pDC->DrawText(nurse.GetName().FullName(),rcNames,DT_NOCLIP);
		pDC->DrawText(strWeeklyHours,rcHoursNeeded,DT_NOCLIP);
		pDC->DrawText(strHoursUsed,rcHoursUsed,DT_NOCLIP);
		pDC->SetTextColor(RGB(0,0,0));
	}

	SetScrollSizes(MM_TEXT,CSize(rcHoursUsed.right,rcHoursUsed.bottom));
}
コード例 #27
0
ファイル: ZarplataView.cpp プロジェクト: SergeyVorobiev/ZP
void CZarplataView::ResetScrollSizes(void)
{
	CClientDC aDC(this);
	OnPrepareDC(&aDC);
	CSize DocSize = GetDocument()->GetDocSize();
	aDC.LPtoDP(&DocSize);
	SetScrollSizes(MM_TEXT, DocSize, CSize(300, 300));	
}
コード例 #28
0
void CScribbleView::ResyncScrollSizes()
{
	CClientDC dc(NULL);
	OnPrepareDC(&dc);
	CSize sizeDoc = GetDocument()->GetDocSize();
	dc.LPtoDP(&sizeDoc);
	SetScrollSizes(MM_TEXT, sizeDoc);
}
コード例 #29
0
ファイル: VisualSynanView.cpp プロジェクト: deNULL/seman
void CVisualSynanView::ResizeScroll()
{
	CClientDC dc(NULL);
	OnPrepareDC(&dc);
	CSize sizeDoc = GetDocument()->GetSentencesSize();
	dc.LPtoDP(&sizeDoc);
	SetScrollSizes(MM_TEXT, sizeDoc);
}
コード例 #30
0
void CPaintView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();

	CSize sizeTotal;
	sizeTotal.cx = sizeTotal.cy = 800;
	SetScrollSizes(MM_TEXT, sizeTotal); 
}