Example #1
0
void COXTabViewContainer::CalcTabBtnRects()
{
	m_arrTabBtnRects.RemoveAll();

	CString sTitle;
	int nLeftSide=0;
	CRect rect;

	CClientDC dc(this);
	ASSERT((HFONT)m_fontActiveTabBtnText!=NULL);
	if((HFONT)m_fontActiveTabBtnText!=NULL)
		dc.SelectObject(&m_fontActiveTabBtnText);
	
	for(int nIndex=0; nIndex<GetPageCount(); nIndex++)
	{
		rect=m_rectTabBtnArea;
		rect-=rect.TopLeft();
		rect.right=0xffff;

		sTitle=GetPageTitle(nIndex);

		dc.DrawText(sTitle,rect,DT_CALCRECT|DT_LEFT|DT_SINGLELINE|DT_VCENTER);
		rect.OffsetRect(nLeftSide,0);
		rect.right+=2*ID_TABBTNOVERLAPSIZE+2*ID_TABBTNGAPSIZE;
		
		m_arrTabBtnRects.Add(rect);

		nLeftSide=rect.right-ID_TABBTNOVERLAPSIZE;
	}
}
Example #2
0
void COXTabViewContainer::DrawTabButton(CDC* pDC, int nIndex) const
{
	ASSERT(nIndex>=0 && nIndex<GetPageCount());

	CRect rect=m_arrTabBtnRects[nIndex];
	rect+=m_rectTabBtnArea.TopLeft();
	rect.OffsetRect(m_nTabBtnAreaOrigin,0);
	if(rect.right>m_rectTabBtnArea.left && rect.left<m_rectTabBtnArea.right)
	{
		rect.bottom=m_rectTabBtnArea.bottom;
		
		POINT arrPoints[4];
		arrPoints[0].x=rect.left;
		arrPoints[0].y=rect.top;
		arrPoints[1].x=rect.left+ID_TABBTNOVERLAPSIZE;
		arrPoints[1].y=rect.bottom;
		arrPoints[2].x=rect.right-ID_TABBTNOVERLAPSIZE;
		arrPoints[2].y=rect.bottom;
		arrPoints[3].x=rect.right;
		arrPoints[3].y=rect.top;

		CPen penTop(PS_SOLID,1,::GetSysColor(COLOR_BTNHILIGHT));
		CPen penBottom(PS_SOLID,1,::GetSysColor(COLOR_BTNSHADOW));
		CPen* pOldPen=NULL;
		if(nIndex==GetActivePageIndex())
		{
			pDC->Polygon(arrPoints,4);

			pOldPen=pDC->SelectObject(&penTop);
			arrPoints[0].x++;
			pDC->MoveTo(arrPoints[0]);
			pDC->LineTo(arrPoints[3]);

			pDC->SelectObject(&penBottom);
			arrPoints[1].y--;
			arrPoints[2].y--;
			pDC->MoveTo(arrPoints[1]);
			pDC->LineTo(arrPoints[2]);
		}
		else
		{
			pDC->Polygon(arrPoints,4);

			pOldPen=pDC->SelectObject(&penBottom);
			arrPoints[1].y--;
			arrPoints[2].y--;
			pDC->MoveTo(arrPoints[1]);
			pDC->LineTo(arrPoints[2]);
			arrPoints[2].x--;
			arrPoints[3].x--;
			pDC->MoveTo(arrPoints[2]);
			pDC->LineTo(arrPoints[3]);

			pDC->SelectObject(&penTop);
			arrPoints[0].x+=2;
			arrPoints[0].y++;
			arrPoints[1].x++;
			pDC->MoveTo(arrPoints[0]);
			pDC->LineTo(arrPoints[1]);
		}
		if(pOldPen!=NULL)
			pDC->SelectObject(pOldPen);

		CString sTitle=GetPageTitle(nIndex);
		if(!sTitle.IsEmpty())
		{
			COLORREF oldColor=pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
			int nOldBkMode=pDC->SetBkMode(TRANSPARENT);
			pDC->DrawText(sTitle,rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER);
			pDC->SetBkMode(nOldBkMode);
			pDC->SetTextColor(oldColor);
		}
	}
}
Example #3
0
Bool_t OnlineConfig::ParseConfig() 
{
  //  Goes through each line of the config [must have been ParseFile()'d]
  //   and interprets.

  if(!fFoundCfg) {
    return kFALSE;
  }

  UInt_t command_cnt=0;
  UInt_t j=0;
  // If statement for each high level command (cut, newpage, etc)
  for(UInt_t i=0;i<sConfFile.size();i++) {
    // "newpage" command
    if(sConfFile[i][0] == "newpage") {
      // sConfFile[i] is first of pair
      for(j=i+1;j<sConfFile.size();j++) {
	if(sConfFile[j][0] != "newpage") {
	  // Count how many commands within the page
	  command_cnt++;
	} else break;
      }
      pageInfo.push_back(make_pair(i,command_cnt));
      i += command_cnt;
      command_cnt=0;
    }
    if(sConfFile[i][0] == "watchfile") {
      fMonitor = kTRUE;
    }
    if(sConfFile[i][0] == "definecut") {
      if(sConfFile[i].size()>3) {
	cerr << "cut command has too many arguments" << endl;
	continue;
      }
      TCut tempCut(sConfFile[i][1],sConfFile[i][2]);
      //      cutList.push_back(make_pair(sConfFile[i][1],sConfFile[i][2]));
      cutList.push_back(tempCut);
    }
    if(sConfFile[i][0] == "rootfile") {
      if(sConfFile[i].size() != 2) {
	cerr << "WARNING: rootfile command does not have the "
	     << "correct number of arguments"
	     << endl;
	continue;
      }
      if(!rootfilename.IsNull()) {
	cerr << "WARNING: too many rootfile's defined. " 
	     << " Will only use the first one." 
	     << endl;
	continue;
      }
      rootfilename = sConfFile[i][1];
    }
    if(sConfFile[i][0] == "goldenrootfile") {
      if(sConfFile[i].size() != 2) {
	cerr << "WARNING: goldenfile command does not have the "
	     << "correct number of arguments"
	     << endl;
	continue;
      }
      if(!goldenrootfilename.IsNull()) {
	cerr << "WARNING: too many goldenrootfile's defined. " 
	     << " Will only use the first one." 
	     << endl;
	continue;
      }
      goldenrootfilename = sConfFile[i][1];
    }
    if(sConfFile[i][0] == "protorootfile") {
      if(sConfFile[i].size() != 2) {
	cerr << "WARNING: protorootfile command does not have the "
	     << "correct number of arguments"
	     << endl;
	continue;
      }
      if(!protorootfile.IsNull()) {
	cerr << "WARNING: too many protorootfile's defined. " 
	     << " Will only use the first one." 
	     << endl;
	continue;
      }
      protorootfile = sConfFile[i][1];
    }
    if(sConfFile[i][0] == "guicolor") {
      if(sConfFile[i].size() != 2) {
	cerr << "WARNING: guicolor command does not have the "
	     << "correct number of arguments (needs 1)"
	     << endl;
	continue;
      }
      if(!guicolor.IsNull()) {
	cerr << "WARNING: too many guicolor's defined. " 
	     << " Will only use the first one." 
	     << endl;
	continue;
      }
      guicolor = sConfFile[i][1];
    }
    if(sConfFile[i][0] == "plotsdir") {
      if(sConfFile[i].size() != 2) {
	cerr << "WARNING: plotsdir command does not have the "
	     << "correct number of arguments (needs 1)"
	     << endl;
	continue;
      }
      if(!plotsdir.IsNull()) {
	cerr << "WARNING: too many plotdir's defined. " 
	     << " Will only use the first one." 
	     << endl;
	continue;
      }
      plotsdir = sConfFile[i][1];
    }

  }

#ifdef NOISY
  cout << "OnlineConfig::ParseConfig()\n";
  for(UInt_t i=0; i<GetPageCount(); i++) {
    cout << "Page " << i << " (" << GetPageTitle(i) << ")"
	 << " will draw " << GetDrawCount(i) 
	 << " histograms." << endl;
  }
#endif

  cout << "Number of pages defined = " << GetPageCount() << endl;
  cout << "Number of cuts defined = " << cutList.size() << endl;

  if (fMonitor) 
    cout << "Will periodically update plots" << endl;
  if(!goldenrootfilename.IsNull()) {
    cout << "Will compare chosen histrograms with the golden rootfile: " 
	 << endl 
	 << goldenrootfilename << endl;
  }

  return kTRUE;

}