コード例 #1
0
ファイル: LogGraph.cpp プロジェクト: tlogger/TMon
bool CLogGraph::attach(UINT id, CWnd* pParent)
{
	CStatic  wndStatic;		
	CRect    r;

	if (pParent == NULL || !wndStatic.SubclassDlgItem(id, pParent))
		return false;

	wndStatic.GetWindowRect(&r);
	pParent->ScreenToClient(&r);
		
	if ( !CreateEx( wndStatic.GetExStyle(), 
		            NULL, NULL, WS_CHILD | WS_VISIBLE | wndStatic.GetStyle(),
		            r, pParent, id, NULL))
	{		
		wndStatic.DestroyWindow();
		return false;
	}
	
	wndStatic.DestroyWindow();

	EnableScrollBarCtrl(SB_HORZ, TRUE);
	GetClientRect(&m_rectWnd);
	calcRect();
	SetTimer(11839, 1000, NULL);

	m_bCreated = true;
	return true;
}
コード例 #2
0
ファイル: LogGraph.cpp プロジェクト: tlogger/TMon
void CLogGraph::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);
	GetClientRect(&m_rectWnd);
	calcRect();
	Invalidate(FALSE);
}
コード例 #3
0
ファイル: MedianFlow.cpp プロジェクト: Orthocenter/MedianFlow
TYPE_MF_BB MedianFlow::trackBox(const TYPE_MF_BB &inputBox, int &status)
{
    if(!isBoxUsable(inputBox))
    {
        status = MF_TRACK_F_BOX;
        return BB_ERROR;
    }
    
    vector<TYPE_MF_PT> pts;
    generatePts(inputBox, pts);
    
    vector<TYPE_MF_PT> retF, retFB;
    vector<uchar> statusF, statusFB;
    
    opticalFlow->trackPts(pts, retF, statusF);
    opticalFlowSwap->trackPts(retF, retFB, statusFB);

    vector<int> rejected(MF_NPTS * MF_NPTS);
    
    filterOFError(retF, statusF, rejected);
    filterOFError(retFB, statusFB, rejected);
    
    filterFB(pts, retFB, rejected);
    filterNCC(pts, retF, rejected);
    
    TYPE_MF_BB ret;
    
    ret = calcRect(inputBox, pts, retF, rejected, status);
    
    ///// show result
    if(viewController)
    {
        vector<TYPE_MF_PT> rPts, rPts2, rPts3;
        
        for(int i = 0; i < pts.size(); i++)
        {
            if(rejected[i]) continue;
            rPts.push_back(pts[i]);
            rPts2.push_back(retF[i]);
            rPts3.push_back(retFB[i]);
        }
        viewController->drawCircles(rPts, COLOR_BLUE);
        viewController->drawCircles(rPts2);
        //viewController->drawCircles(rPts3, Scalar(23, 45, 214));
        viewController->drawLines(rPts, rPts2);
        
        cout << "number of points after filtering:" << rPts.size() << endl;
        cout << ret << endl;
    }
    /////
    
    if(status != MF_TRACK_SUCCESS)
    {
        return BB_ERROR;
    }
    
    return ret;
}
コード例 #4
0
ファイル: LogGraph.cpp プロジェクト: tlogger/TMon
bool CLogGraph::openGraph(const char* fn, int len, int maxLog, bool bCreate)
{
	//m_hQue = lib->mque_create(fn, len, maxLog, bCreate);
	bool ret = setFile();
	if (ret) {
		// 처음 오픈했을 때는 m_nCurrentPos를 마지막으로 이동한다.
		goLast();
	}
	if (m_aTmp) 
		calcRect();

	return ret;
}
コード例 #5
0
ファイル: tdefileividesktop.cpp プロジェクト: Fat-Zer/tdebase
KFileIVIDesktop::KFileIVIDesktop(KonqIconViewWidget *iconview, KFileItem* fileitem,
				 int size, KShadowEngine *shadow) :
  KFileIVI(iconview, fileitem, size),
  m_selectedImage(0L),
  m_normalImage(0L),
  _selectedUID(0),
  _normalUID(0)
{
  m_shadow = shadow;
  oldText = "";

  calcRect( text() ); // recalculate rect including shadow
}
コード例 #6
0
ファイル: LogGraph.cpp プロジェクト: tlogger/TMon
void CLogGraph::OnSizing(UINT fwSide, LPRECT pRect) 
{
	if (GetParent()->GetStyle() & ~WS_CLIPCHILDREN)
	{
		// Eliminate flickering 
		m_bStylesModified = true;
		GetParent()->ModifyStyle(0, WS_CLIPCHILDREN);		
	}

	ModifyStyle(0, WS_CLIPSIBLINGS);

	CWnd::OnSizing(fwSide, pRect);		
	GetClientRect(&m_rectWnd);
	calcRect();
	Invalidate(FALSE);	
}
コード例 #7
0
ファイル: LogGraph.cpp プロジェクト: tlogger/TMon
bool CLogGraph::create(UINT id, CWnd* pParent)
{
	Create("LogGraph", "LogGraph", WS_CHILD | WS_VISIBLE ,
		CRect(0,0,0,0) , pParent, 0);
// 	if ( !CreateEx(0, NULL, NULL, WS_CHILD | WS_VISIBLE ,
// 		CRect(0,0,0,0) , pParent, id, NULL))
// 	{		
// 		
// 		return false;
// 	}
	m_nID = id;
	EnableScrollBarCtrl(SB_HORZ, TRUE);
	GetClientRect(&m_rectWnd);
	calcRect();
	SetTimer(11839, 1000, NULL);

	m_ctrTooltip.Create(this, TTS_ALWAYSTIP|TTS_NOPREFIX);
	m_ctrTooltip.SetDelayTime(50);
	m_ctrTooltip.Activate(TRUE);


	m_bCreated = true;
	return true;
}
コード例 #8
0
void QtFileIconViewItem::viewModeChanged( QtFileIconView::ViewMode m )
{
    vm = m;
    setDropEnabled( itemType == Dir && QDir( itemFileName ).isReadable() );
    calcRect();
}
コード例 #9
0
void CvSqlQueryLowerView::MultilineTextOut(CDC* pDC, int x, int& y, CString& rString, int pageDataHeight)
{
#define MULTILINE_CALCRECT
	// This Code takes advantage of DrawText() using DT_CALCRECT, ...
	// ...but does not wrap correctly if end of page reached.
#ifdef MULTILINE_CALCRECT
	ASSERT (x==0);
	CRect calcRect(x, y, m_nPageWidth, y + m_nLineHeight);
	pDC->DrawText(rString, calcRect, DT_EXTERNALLEADING | DT_WORDBREAK | DT_CALCRECT);
	int heightNeeded = calcRect.Height();
	ASSERT (heightNeeded % m_nLineHeight == 0);

	// Specific adjustment if would overlap to next page

	// Check line to be printed does not overlap 2 pages, and adjust if necessary
	int curLinePage = y / pageDataHeight;
	int nextLinePage = (y + heightNeeded) / pageDataHeight;
	ASSERT (nextLinePage >= curLinePage);
	if (nextLinePage > curLinePage) {
		int margin = (pageDataHeight - y) % m_nLineHeight;
		if (margin > 0) {
			y += margin;
			calcRect.OffsetRect(0, margin );
		}
		ASSERT ((pageDataHeight - y) % m_nLineHeight == 0);
	}
	pDC->DrawText(rString, calcRect, DT_EXTERNALLEADING | DT_WORDBREAK);
	y += heightNeeded;
#endif  // MULTILINE_CALCRECT

	// Alternate: this code wraps correctly when end of page reached,...
	// ...but truncates lines if too much characters between crlf
	// break line into pieces
#ifdef MULTILINE_CRLF
	TCHAR crlf[3];
	crlf[0] = 0x0d;
	crlf[1] = 0x0a;
	crlf[2] = 0;

	// Duplicate received string - Mandatory
	CString csMultilineTxt = rString;

	do {
		// search for 0d0a
		int index = csMultilineTxt.Find(crlf);
		if (index != -1) {
			ASSERT (index >= 0);

			// Check line to be printed does not overlap 2 pages, and adjust if necessary
			int curLinePage = y / pageDataHeight;
			int nextLinePage = (y + m_nLineHeight) / pageDataHeight;
			ASSERT (nextLinePage >= curLinePage);
			if (nextLinePage > curLinePage)
				y = nextLinePage * pageDataHeight;

			pDC->TextOut(x, y, csMultilineTxt, index);
			y += m_nLineHeight;
			int len = csMultilineTxt.GetLength();
			ASSERT (len - index - 2 >= 0 );
			csMultilineTxt = csMultilineTxt.Right(len - index - 2);
		}
		else {
			// last line

			// Check line to be printed does not overlap 2 pages, and adjust if necessary
			int curLinePage = y / pageDataHeight;
			int nextLinePage = (y + m_nLineHeight) / pageDataHeight;
			ASSERT (nextLinePage >= curLinePage);
			if (nextLinePage > curLinePage)
				y = nextLinePage * pageDataHeight;

			pDC->TextOut(x, y, csMultilineTxt);
			y += m_nLineHeight;
			break;  // break the do while
		}
	} while (!csMultilineTxt.IsEmpty());
#endif  // MULTILINE_CRLF
}
コード例 #10
0
ファイル: ImagedButton.cpp プロジェクト: newmind/tvnc_rds
void ImagedButton::drawItem(LPDRAWITEMSTRUCT dis)
{
  HDC dc = dis->hDC;

  BOOL isPressed = (dis->itemState & ODS_SELECTED);
  BOOL isFocused = (dis->itemState & ODS_FOCUS);
  BOOL isDisabled = (dis->itemState & ODS_DISABLED);
  BOOL drawFocusRect = !(dis->itemState & ODS_NOFOCUSRECT);

  RECT itemRect = dis->rcItem;
  SetBkMode(dc, TRANSPARENT);

  if (m_isUsingTheme) {
    DWORD state = (isPressed) ? PBS_PRESSED : PBS_NORMAL;
    if (state == PBS_NORMAL) {
      if (isFocused) {
        state = PBS_DEFAULTED;
      } 
      if (m_mouseOver) {
        state = PBS_HOT;
      } 
      if (isDisabled) {
        state = PBS_DISABLED;
      }
    } 
    ThemeLib::DrawThemeBackground(m_theme, dc, BP_PUSHBUTTON, state, &itemRect, NULL);
  } else {
    if (isFocused) {
      HBRUSH br = CreateSolidBrush(RGB(0,0,0));
      FrameRect(dc, &itemRect, br);
      InflateRect(&itemRect, -1, -1);
      DeleteObject(br);
    } 

    HBRUSH background = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
    FillRect(dc, &itemRect, background);
    DeleteObject(background);

    if (isPressed) {
      HBRUSH shadow = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
      FrameRect(dc, &itemRect, shadow);
      DeleteObject(shadow);
    } else {
      UINT uState = DFCS_BUTTONPUSH |
                    ((m_mouseOver) ? DFCS_HOT : 0) |
                    ((isPressed) ? DFCS_PUSHED : 0);

      DrawFrameControl(dc, &itemRect, DFC_BUTTON, uState);
    } 
  } 

  StringStorage title;
  getText(&title);

  RECT captionRect = dis->rcItem;

  TEXTMETRIC metric;
  GetTextMetrics(dc, &metric);

  RECT imageRect;

  calcRect(&itemRect, isPressed == TRUE, 0, metric.tmHeight,
           m_iconWidth, m_iconHeight, &captionRect, &imageRect);

  if (m_icon != NULL) {
    drawIcon(&dc, &imageRect, isPressed == TRUE, isDisabled == TRUE);
  }

  if (!title.isEmpty()) {
    if (isPressed && !m_isUsingTheme) {
      OffsetRect(&captionRect, 1, 1);
    }

    if (m_isUsingTheme) {
      WCHAR *unicodeString = new WCHAR[title.getLength() + 1];
      size_t len = title.getLength();
      title.toUnicodeString(unicodeString, &len);

      DWORD state = PBS_NORMAL;

      if (isDisabled) {
        state = PBS_DISABLED;
      }

      ThemeLib::DrawThemeText(m_theme, dc, BP_PUSHBUTTON, state,
                              unicodeString, len,
                              DT_CENTER | DT_VCENTER | DT_SINGLELINE,
                              0, &captionRect);
      delete[] unicodeString;
    } else {
      SetBkMode(dc, TRANSPARENT);

      if (isDisabled) {
        OffsetRect(&captionRect, 1, 1);
        SetTextColor(dc, ::GetSysColor(COLOR_3DHILIGHT));
        DrawText(dc, title.getString(), -1, &captionRect, DT_WORDBREAK | DT_CENTER);
        OffsetRect(&captionRect, -1, -1);
        SetTextColor(dc, ::GetSysColor(COLOR_3DSHADOW));
        DrawText(dc, title.getString(), -1, &captionRect, DT_WORDBREAK | DT_CENTER);
      } else {
        SetTextColor(dc, ::GetSysColor(COLOR_BTNTEXT));
        SetBkColor(dc, ::GetSysColor(COLOR_BTNFACE));
        DrawText(dc, title.getString(), -1, &captionRect, DT_WORDBREAK | DT_CENTER);
      } 
    } 
  } 

  if (isFocused && drawFocusRect) {
    RECT focusRect = itemRect;
    InflateRect(&focusRect, -3, -3);
    DrawFocusRect(dc, &focusRect);
  } 
}