Exemplo n.º 1
0
void CEditFrameView::OnInitialUpdate()
{
	CRichEditView::OnInitialUpdate();

	// Set the printing margins (720 twips = 1/2 inch).
	SetMargins(CRect(720, 720, 720, 720));

	OnFontName ();
	OnFontSize ();

	CCharFormat cf;
	cf.dwMask    = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR;
	cf.dwEffects = CFE_AUTOCOLOR;
	SetCharFormat (cf);
}
Exemplo n.º 2
0
  /// Constructor
  PdfLabel (const PdfLabelFormat& format, const wxString& unit = wxT("mm"), int posX = 1, int  posY = 1)
    : wxPdfDocument(wxPORTRAIT, format.metric, format.paperSize)
  {
    m_charSize   = 10;
    m_lineHeight = 10;
    m_xCount     = 1;
    m_yCount     = 1;
    
    SetFormat(format);
    SetFontName(wxT("Helvetica"));
    SetMargins(0,0); 
    SetAutoPageBreak(false); 

    m_metricDoc = unit;
    // Start at the given label position
    m_xCount = (posX >= m_xNumber) ? m_xNumber-1 : ((posX > 1) ? posX-1 : 0);
    m_yCount = (posY >= m_yNumber) ? m_yNumber-1 : ((posY > 1) ? posY-1 : 0);
  }
void StylesUiControl::setupUi()
{
    vboxLayout = new QVBoxLayout(layoutWidget);
    SetMargins(vboxLayout);

    llvmStyleRButton = new QRadioButton(tr("LLVM coding standard"),
                                        layoutWidget);
    googleStyleRButton = new QRadioButton(tr("Google's C++ style guide"),
                                          layoutWidget);
    chromiumStyleRButton = new QRadioButton(tr("Chromium's style guide"),
                                            layoutWidget);
    mozillaStyleRButton = new QRadioButton(tr("Mozilla's style guide"),
                                           layoutWidget);
    webkitStyleRButton = new QRadioButton(tr("Webkit's style guide"),
                                          layoutWidget);
    vboxLayout->addWidget(llvmStyleRButton);
    vboxLayout->addWidget(googleStyleRButton);
    vboxLayout->addWidget(chromiumStyleRButton);
    vboxLayout->addWidget(mozillaStyleRButton);
    vboxLayout->addWidget(webkitStyleRButton);
}
CGridRFULimits::CGridRFULimits(wxWindow *parent, wxWindowID id) :
  nwxGrid(parent,id), m_pData(NULL)
{
  int i;
  int j;
  CreateGrid(ROW_COUNT,COL_COUNT);
  SetDefaultCellValidator(
    new nwxGridCellUIntRangeValidator(
      mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,true));
  EnableDragColSize(false);
  EnableDragRowSize(false);
  SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE);
  for(i = 0; i < ROW_COUNT; i++)
  {
    for(j = 0; j < COL_COUNT; j++)
    {
      SetCellValue(i,j,_T("00000000")); // used for size
      if(_DisabledCell(i,j))
      {
        SetCellBackgroundColour(i,j,GetGridLineColour());
      }
    }
  }
  SetDefaultEditor(new wxGridCellFloatEditor(1,0));
  SetColLabelValue(COL_SAMPLE,_T("Sample"));
  SetColLabelValue(COL_LADDER,_T("Ladder"));
  SetColLabelValue(COL_ILS,_T("   ILS   "));
  SetRowLabelValue(ROW_RFU_MIN,_T("Analysis Threshold (RFU)"));
  SetRowLabelValue(ROW_RFU_INTERLOCUS,_T("Min. Interlocus RFU"));
  SetRowLabelValue(ROW_RFU_MAX,_T("Max. RFU"));
  SetRowLabelValue(ROW_DETECTION,_T("Detection Threshold (RFU)"));
  SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE);
  SetMargins(0,0);
  nwxGrid::UpdateLabelSizes(this);
  AutoSize();
  _DisableUnused();
}
Exemplo n.º 5
0
wxRichTextPrintout::wxRichTextPrintout(const wxString& title) : wxPrintout(title)
{
    m_numPages = wxRICHTEXT_PRINT_MAX_PAGES;

    SetMargins(); // to default values
}
void
FormWindow::Init(const FormDef& def)
{
	if (def.GetRect().w > 0 && def.GetRect().h > 0) {
		// if form size is specified in def, and it is 
		// smaller than the current screen size,
		// center the form on the display:

		Rect r = def.GetRect();

		if (r.w < screen->Width()) {
			r.x = (screen->Width()  - r.w) / 2;
		}
		else {
			r.x = 0;
			r.w = screen->Width();
		}

		if (r.h < screen->Height()) {
			r.y = (screen->Height() - r.h) / 2;
		}
		else {
			r.y = 0;
			r.h = screen->Height();
		}

		MoveTo(r);
	}

	SetMargins(def.GetMargins());
	SetTextInsets(def.GetTextInsets());
	SetCellInsets(def.GetCellInsets());
	SetCells(def.GetCells());
	SetFixedWidth(def.GetFixedWidth());
	SetFixedHeight(def.GetFixedHeight());

	UseLayout(def.GetLayout().x_mins,
	def.GetLayout().y_mins,
	def.GetLayout().x_weights,
	def.GetLayout().y_weights);

	if (def.GetTexture().length() > 0) {
		DataLoader* loader = DataLoader::GetLoader();
		loader->SetDataPath("Screens/");
		loader->LoadTexture(def.GetTexture(), texture);
		loader->SetDataPath("");
	}

	SetBackColor(def.GetBackColor());
	SetForeColor(def.GetForeColor());

	Font* f = FontMgr::Find(def.GetFont());
	if (f) SetFont(f);

	SetTransparent(def.GetTransparent());

	ListIter<CtrlDef> ctrl = def.GetControls();
	while (++ctrl) {
		switch (ctrl->GetType()) {
		case WIN_DEF_FORM:
		case WIN_DEF_LABEL:
		default:
			CreateDefLabel(*ctrl);
			break;

		case WIN_DEF_BUTTON:
			CreateDefButton(*ctrl);
			break;

		case WIN_DEF_COMBO:
			CreateDefCombo(*ctrl);
			break;

		case WIN_DEF_IMAGE:
			CreateDefImage(*ctrl);
			break;

		case WIN_DEF_EDIT:
			CreateDefEdit(*ctrl);
			break;

		case WIN_DEF_LIST:
			CreateDefList(*ctrl);
			break;

		case WIN_DEF_SLIDER:
			CreateDefSlider(*ctrl);
			break;

		case WIN_DEF_RICH:
			CreateDefRichText(*ctrl);
			break;
		}
	}

	RegisterControls();
	DoLayout();
	CalcGrid();
}
Exemplo n.º 7
0
void CExtEdit::SetIndent(int margin)
{
	SetMargins(margin, 1);
}
Exemplo n.º 8
0
/*----------------------------------------------------------------------------------------------
	This processes Windows messages on the window. In general, it normally calls the
	appropriate method on the edit class.
----------------------------------------------------------------------------------------------*/
bool TssEdit::FWndProc(uint wm, WPARAM wp, LPARAM lp, long & lnRet)
{
	bool fRet;

	switch (wm)
	{
	case WM_GETDLGCODE:
		// This is essential when embedded in a dialog to tell the dialog manager that it
		// wants to get key strokes. (We could try DLGC_WANTALLKEYS but I think we would then
		// get the Tab and Return keys...we may get them anyway with this combination...)
		// The last value tells Windows that when tabbing to this control we should use
		// EM_SETSEL to select all the text.
		lnRet = DLGC_WANTCHARS | DLGC_WANTARROWS | DLGC_HASSETSEL;
		return true;
	case EM_GETLINE:	// Use FW_EM_GETLINE.
	case EM_REPLACESEL:	// Use FW_EM_REPLACESEL.
		// We don't support these methods. Use the replacement TsString versions instead.
		Assert(false);
		lnRet = LB_ERR;
		return true;

	// NOTE: DO NOT send this message to a TssEdit if you want the actual text. Send the
	// FW_EM_GETTEXT message instead. This method is required for TssEdit controls on a
	// dialog because Windows will send the message to the control anytime the user hits a
	// key.
	case WM_GETTEXT:
		{
			ITsStringPtr qtss;
			GetText(&qtss);
			const wchar * pwrgch;
			int cch;
			HRESULT hr;
			IgnoreHr(hr = qtss->LockText(&pwrgch, &cch));
			if (FAILED(hr))
				return true;
			StrApp str(pwrgch, cch);
			qtss->UnlockText(pwrgch);
			lnRet = Min(cch + 1, (int)wp);
			achar * psz = reinterpret_cast<achar *>(lp);
			StrCpyN(psz, str.Chars(), lnRet);
		}
		return true;

	// NOTE: You should be sending an FW_EM_SETTEXT message instead of this.
	case WM_SETTEXT:
		{
			achar * psz = reinterpret_cast<achar *>(lp);
			StrUni stu(psz);
			ITsStrFactoryPtr qtsf;
			qtsf.CreateInstance(CLSID_TsStrFactory);
			ITsStringPtr qtss;
			CheckHr(qtsf->MakeStringRgch(stu.Chars(), stu.Length(), m_wsBase, &qtss));
			SetText(qtss);
		}
		return true;

	case EM_CANUNDO:
	case EM_CHARFROMPOS:
	case EM_EMPTYUNDOBUFFER:
	case EM_FMTLINES:
	case EM_GETFIRSTVISIBLELINE:
	case EM_GETHANDLE:
	case EM_GETMODIFY:
	case EM_GETPASSWORDCHAR:
	case EM_GETRECT:
	case EM_GETTHUMB:
	case EM_GETWORDBREAKPROC:
	case EM_POSFROMCHAR:
	case EM_SETHANDLE:
	case EM_SETMODIFY:
	case EM_SETPASSWORDCHAR:
	case EM_SETRECT:
	case EM_SETRECTNP:
	case EM_SETTABSTOPS:
	case EM_SETWORDBREAKPROC:
	case EM_UNDO:
	case WM_GETFONT:
	case WM_SETFONT:
		// We don't support these methods.
		Assert(false);
		lnRet = LB_ERR;
		return true;

	case EM_GETLIMITTEXT:
		lnRet = GetLimitText();
		return true;

	case FW_EM_GETLINE:
		lnRet = GetLine(wp, (ITsString **)lp);
		return true;

	case EM_GETLINECOUNT:
		lnRet = GetLineCount();
		return true;

	case EM_GETMARGINS:
		lnRet = GetMargins();
		return true;

	case FW_EM_GETSTYLE:
		GetStyle((StrUni *)lp, (COLORREF *)wp);
		return true;

	case EM_GETSEL:
		lnRet = GetSel((int *)wp, (int *)lp);
		return true;

	case EM_LINEFROMCHAR:
		lnRet = LineFromChar(wp);
		return true;

	case EM_LINEINDEX:
		lnRet = LineIndex(wp);
		return true;

	case EM_LINELENGTH:
		lnRet = LineLength(wp);
		return true;

	case EM_LINESCROLL:
		LineScroll(lp, wp);
		return true;

	case FW_EM_REPLACESEL:
		ReplaceSel((ITsString *)lp);
		return true;

	case EM_SCROLL:
		lnRet = ::SendMessage(m_hwnd, WM_VSCROLL, LOWORD(wp), 0);
		return true;

	case EM_SCROLLCARET:
		ScrollCaret();
		return true;

	case EM_SETLIMITTEXT:
		SetLimitText(wp);
		return true;

	case EM_SETMARGINS:
		SetMargins(wp, LOWORD(lp), HIWORD(lp));
		return true;

	case EM_SETREADONLY:
		SetReadOnly(wp);
		return true;

	case EM_SETSEL:
		SetSel(wp, lp);
		return true;

	case FW_EM_SETSTYLE:
		SetStyle((StrUni *)lp, (COLORREF)wp);
		return true;

	case WM_GETTEXTLENGTH:
		lnRet = GetTextLength();
		return true;

	case FW_EM_GETTEXT:
		GetText((ITsString **)lp);
		return true;

	case FW_EM_SETTEXT:
		SetText((ITsString *)lp);
		return true;

	case WM_COPY:
		Copy();
		return true;

	case WM_CUT:
		Cut();
		return true;

	case WM_PASTE:
		Paste();
		return true;

	case WM_HSCROLL:
		if (!OnHScroll(LOWORD(wp), HIWORD(wp), (HWND)lp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_HSCROLL), (LPARAM)m_hwnd);
		}
		return true;

	case WM_VSCROLL:
		if (!OnVScroll(LOWORD(wp), HIWORD(wp), (HWND)lp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_VSCROLL), (LPARAM)m_hwnd);
		}
		return true;

	case WM_KILLFOCUS:
		if (!OnKillFocus((HWND)wp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_KILLFOCUS), (LPARAM)m_hwnd);
		}
		return true;

	case WM_SETFOCUS:
		if (!OnSetFocus((HWND)wp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_SETFOCUS), (LPARAM)m_hwnd);
		}
		return true;
		// Calling SuperClass here causes two OnSetFocus calls for each OnKillFocus.
		//return SuperClass::FWndProc(wm, wp, lp, lnRet);

	case WM_CHAR:
		fRet = false;
		if (wp == VK_TAB)  // '\t'
		{
			fRet = OnCharTab();
		}
		else if (wp == VK_RETURN) // '\r'
		{
			fRet = OnCharEnter();
		}
		else if (wp == VK_ESCAPE) // '\33'
		{
			fRet = OnCharEscape();
		}
		if (fRet)
			return fRet;
		else
			return SuperClass::FWndProc(wm, wp, lp, lnRet);

	case WM_LBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_MBUTTONDOWN:
	case WM_MBUTTONUP:
	case WM_RBUTTONDOWN:
	case WM_RBUTTONUP:
	case WM_MOUSEMOVE:
		if (HasToolTip())
		{
			// Notify the tooltip belonging to the parent toolbar of the mouse message.
			Assert(m_hwndToolTip);
			MSG msg;
			msg.hwnd = m_hwnd; // ::GetParent(m_hwnd);
			msg.message = wm;
			msg.wParam = wp;
			msg.lParam = lp;
			::SendMessage(m_hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
		}
		break;

	default:
		break;
	}
	return SuperClass::FWndProc(wm, wp, lp, lnRet);
}
BOOL CELibrarianApp::PrintPOUHeader(LPCTSTR pouName, CDC *pDCPrint, 
                      CPrintInfo * pPrintInfo, CDialog* pDlgPrintStatus)
{
	BOOL bError = FALSE;
	CFont Font;
	CFont * pOldFont;

	//
	// get active document and library
	//
	CELibrarianDoc* pDoc = (CELibrarianDoc*) GetDocument();
	//CELibrary* pCeLibrary = pDoc->GetCELibrary();

	//
	// create invisible view to print with
	//
	CEHeaderView* pView = new CEHeaderView();
	CRect rectDefault(0,0,0,0);
	BOOL bb=pView->Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,rectDefault,
		m_pMainWnd,AFX_IDW_PANE_FIRST+1,NULL);
	pDoc->AddView(pView);

 
	pPrintInfo->m_bContinuePrinting = TRUE;
	//TO_DEBUGPRINT1(_T("CE> Printing %s\n"), pszProjectFile);
	pView->OnBeginPrinting(pDCPrint, pPrintInfo);

	// Guarantee values are in the valid range
	UINT nEndPage = pPrintInfo->GetToPage();
	UINT nStartPage = pPrintInfo->GetFromPage();

	if (nEndPage < pPrintInfo->GetMinPage())
		nEndPage = pPrintInfo->GetMinPage();
	if (nEndPage > pPrintInfo->GetMaxPage())
		nEndPage = pPrintInfo->GetMaxPage();

	if (nStartPage < pPrintInfo->GetMinPage())
		nStartPage = pPrintInfo->GetMinPage();
	if (nStartPage > pPrintInfo->GetMaxPage())
		nStartPage = pPrintInfo->GetMaxPage();

	int nStep = (nEndPage >= nStartPage) ? 1 : -1;
	nEndPage = (nEndPage == 0xffff) ? 0xffff : nEndPage + nStep;

	CString strTemp;
	VERIFY(strTemp.LoadString(AFX_IDS_PRINTPAGENUM));


	//
	// create font
	//
	pOldFont = SelectPrintFont(pDCPrint, &Font);

	for (pPrintInfo->m_nCurPage = nStartPage;
		pPrintInfo->m_nCurPage != nEndPage; pPrintInfo->m_nCurPage += nStep)
	{
		pView->OnPrepareDC(pDCPrint, pPrintInfo);

		// check for end of print
		if (!pPrintInfo->m_bContinuePrinting)
			break;

		TCHAR szBuf[80];
		((CPrintUserData *)(pPrintInfo->m_lpUserData))->IncrementPageNum();
		wsprintf(szBuf, strTemp, 
		  ((CPrintUserData *)(pPrintInfo->m_lpUserData))->GetPageNum());
		pDlgPrintStatus->SetDlgItemText(AFX_IDC_PRINT_PAGENUM, szBuf);

		// set up drawing rect to entire page (in logical coordinates)
		pPrintInfo->m_rectDraw.SetRect(0, 0,
			pDCPrint->GetDeviceCaps(HORZRES),
			pDCPrint->GetDeviceCaps(VERTRES));
		pDCPrint->DPtoLP(&pPrintInfo->m_rectDraw);

		// attempt to start the current page
		if (pDCPrint->StartPage() < 0)
		{
			bError = TRUE;
			break;
		}

		//
		// must call OnPrepareDC on newer versions of Windows because
		// StartPage now resets the device attributes.
		pView->OnPrepareDC(pDCPrint, pPrintInfo);

		ASSERT(pPrintInfo->m_bContinuePrinting);

		//
		// page successfully started, so now render the page
		//
		SetMargins(pDCPrint, pPrintInfo);
		PrintStdHeader(pDCPrint, pPrintInfo);
		PrintStdFooter(pDCPrint, pPrintInfo);

		pOldFont = pDCPrint->SelectObject(&Font);
		pView->OnPrintHeader(pouName, pDCPrint, pPrintInfo);
		pView->OnPrint(pDCPrint, pPrintInfo);
		pDCPrint->SelectObject(pOldFont);

		if (pDCPrint->EndPage() < 0  || !PrjPrintAbortProc(pDCPrint->m_hDC, 0))
		{
			bError = TRUE;
			break;
		}
	}

	pView->OnEndPrinting(pDCPrint, pPrintInfo);
	pDoc->RemoveView(pView);
	pView->DestroyWindow();
	//delete pView;

    return bError;
}
Exemplo n.º 10
0
void CGridRFULimits::_Build()
{
  wxFont fontChannel = GetDefaultCellFont();
  wxFont fontDefault = fontChannel;
  fontChannel.SetWeight(wxFONTWEIGHT_BOLD);
  const CChannelColors *pChannelColors = NULL;
  int nCurrentColCount = GetNumberCols();
  int i;
  int j;
  if(nCurrentColCount < m_nCOL_COUNT)
  {
    InsertCols(m_nCOL_CHANNEL_START, m_nCOL_COUNT - nCurrentColCount);
    _UpdateReadOnly();
  }
  else if(nCurrentColCount > m_nCOL_COUNT)
  {
    DeleteCols(m_nCOL_CHANNEL_START,nCurrentColCount - m_nCOL_COUNT);
  }
  InitValidators();
  SetDefaultCellValidator(
    new nwxGridCellUIntRangeValidator(
      mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,true));
  nwxGridCellUIntRangeValidator *pVreqd =
    new nwxGridCellUIntRangeValidator(
      mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,false); // does not allow empty
  SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_SAMPLE);
  SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_ILS);
  SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_LADDER);

  EnableDragColSize(false);
  EnableDragRowSize(false);
  SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE);
  for(i = 0; i < ROW_COUNT; i++)
  {
    for(j = 0; j < m_nCOL_COUNT; j++)
    {
      SetCellValue(i,j,"00000000"); // used for size
      if(_DisabledCell(i,j))
      {
        SetCellBackgroundColour(i,j,GetGridLineColour());
      }
    }
  }
  SetDefaultEditor(new wxGridCellFloatEditor(1,0));
  SetColLabelValue(m_nCOL_SAMPLE,"Sample");
  SetColLabelValue(m_nCOL_LADDER,"Ladder");
  SetColLabelValue(m_nCOL_ILS,"   ILS   ");
  SetRowLabelValue(ROW_RFU_MIN,"Analysis Threshold (RFU)");
  SetRowLabelValue(ROW_RFU_INTERLOCUS,"Min. Interlocus RFU");
  SetRowLabelValue(ROW_RFU_MAX,"Max. RFU");
  SetRowLabelValue(ROW_DETECTION,"Detection Threshold (RFU)");
  SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE);
  SetMargins(0,0);
  ChannelNumberIterator itrChannelCol;
  int nCol;
  const wxChar *psDye = NULL;
  wxString sLabel;
  for(itrChannelCol = m_vnChannelNumbers.begin(), 
          nCol = m_nCOL_CHANNEL_START;
    itrChannelCol != m_vnChannelNumbers.end();
    ++itrChannelCol, ++nCol)
  {
    if(m_pKitColors != NULL)
    {
      pChannelColors = m_pKitColors->GetColorChannel(*itrChannelCol);
      psDye = (pChannelColors == NULL) ? NULL : (const wxChar *) pChannelColors->GetDyeName();
    }
    CGridLocusColumns::FORMAT_CHANNEL_DYE(&sLabel,*itrChannelCol,psDye);
    SetColLabelValue(nCol,sLabel);
    if(pChannelColors != NULL)
    {
      _SetupChannelColumn(nCol,pChannelColors->GetColorAnalyzed(),fontChannel);
    }
    else
    {
      _SetupDefaultChannelColumn(nCol);
    }
  }
  nwxGrid::UpdateLabelSizes(this);
  AutoSize();
  _DisableUnused();
}
void CGridSampleLimits::SetData(
  CLabThresholds *pData, const CXMLmessageBook *pMessageBook)
{
  m_pData = pData;
  m_pMessageBook = pMessageBook;
  typedef map<wxString,size_t> MSG_THRESHOLDS;
  set<wxString> setMsgThresholds; // message names for thresholds already used
  size_t nCount = 
    ((m_pMessageBook != NULL) && m_pMessageBook->IsOK())
    ? m_pMessageBook->GetMessageCount()
    : 0;
  if(nCount)
  {
    const wxString sEmpty;
    const wxString sUnitPCT(_T("%"));
    const CXMLmessageBookSM *pmsgSM;
    size_t nCountKeep = 0;
    bool bPct;

    // the following 5 will not use the message book
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfPullUpsInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfStuttersInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfAdenylationsInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfOffLadderAllelesInSample);
    setMsgThresholds.insert(CLabThresholds::g_psmNumberOfExcessiveResidualsInSample);

    m_vpMsgBookSM.clear();
    m_vpMsgBookSM.reserve(nCount);
    for(size_t i = 0; i < nCount; i++)
    {
      pmsgSM = m_pMessageBook->GetMessage(i);
      if(setMsgThresholds.find(pmsgSM->GetName()) == setMsgThresholds.end())
      {
        m_vpMsgBookSM.push_back(pmsgSM);
        setMsgThresholds.insert(pmsgSM->GetName());
        if(!pmsgSM->EmptyDescriptor())
        {
          nCountKeep++;
        }
      }
    }
    SetMessageBookRows((int)nCountKeep);
    if(nCountKeep)
    {
      wxFont fn = GetLabelFont();
      vector<const CXMLmessageBookSM *>::iterator itrSM;
      int nRow = ROW_MESSAGE_BOOK_OFFSET;
      for(itrSM = m_vpMsgBookSM.begin();
        itrSM != m_vpMsgBookSM.end();
        ++itrSM)
      {
        pmsgSM = *itrSM;
        if(!pmsgSM->EmptyDescriptor())
        {
          bPct = pmsgSM->IsPercent();
          if(bPct)
          {
            SetCellValidator(GetPctValidator(),nRow,0);
          }
          SetRowLabelValue(nRow,pmsgSM->GetDescriptor());
          SetCellBackgroundColour(nRow,1,m_clrBackground);
          SetCellFont(nRow,1,fn);
          SetCellValue(nRow,1,bPct ? sUnitPCT : sEmpty);
          SetReadOnly(nRow,1,true);
          if(pmsgSM->IsPreset())
          {
            SetCellAlignment(nRow,0,wxALIGN_RIGHT,wxALIGN_CENTRE);
          }
          nRow++;
        }
      }
    }
  }
  SetCellValue(0,0,"00000000");
  SetMargins(0,0);
  nwxGrid::UpdateLabelSizes(this);
  AutoSize();
}
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
                       const PAGE_INFO& aPageInfo,
                       const TITLE_BLOCK& aTitleBlock,
                       COLOR4D aColor, COLOR4D aAltColor )
{
    WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();

    #define milsTomm (25.4/1000)

    m_titleBlock = &aTitleBlock;
    m_paperFormat = &aPageInfo.GetType();

    wxPoint LTmargin( Mm2mils( pglayout.GetLeftMargin() ),
                      Mm2mils( pglayout.GetTopMargin() ) );
    wxPoint RBmargin( Mm2mils( pglayout.GetRightMargin() ),
                      Mm2mils( pglayout.GetBottomMargin() ) );

    SetMargins( LTmargin, RBmargin );
    SetPageSize( aPageInfo.GetSizeMils() );

    // Build the basic layout shape, if the layout list is empty
    if( pglayout.GetCount() == 0 && !pglayout.VoidListAllowed() )
        pglayout.SetPageLayout();

    WORKSHEET_DATAITEM::m_WSunits2Iu = m_milsToIu / milsTomm;
    WORKSHEET_DATAITEM::m_Color = aColor;       // the default color to draw items
    WORKSHEET_DATAITEM::m_AltColor = aAltColor; // an alternate color to draw items

    // Left top corner position
    DPOINT lt_corner;
    lt_corner.x = pglayout.GetLeftMargin();
    lt_corner.y = pglayout.GetTopMargin();
    WORKSHEET_DATAITEM::m_LT_Corner = lt_corner;

    // Right bottom corner position
    DPOINT rb_corner;
    rb_corner.x = (m_pageSize.x*milsTomm) - pglayout.GetRightMargin();
    rb_corner.y = (m_pageSize.y*milsTomm) - pglayout.GetBottomMargin();
    WORKSHEET_DATAITEM::m_RB_Corner = rb_corner;

    WS_DRAW_ITEM_TEXT* gtext;
    int pensize;

    for( unsigned ii = 0; ; ii++ )
    {
        WORKSHEET_DATAITEM*  wsItem = pglayout.GetItem( ii );

        if( wsItem == NULL )
            break;

        // Generate it only if the page option allows this
        if( wsItem->GetPage1Option() < 0    // Not on page 1
            && m_sheetNumber <= 1 )
            continue;

        if( wsItem->GetPage1Option() > 0    // Only on page 1
            && m_sheetNumber > 1 )
            continue;

        COLOR4D color = wsItem->GetItemColor();

        pensize = wsItem->GetPenSizeUi();

        switch( wsItem->GetType() )
        {
        case WORKSHEET_DATAITEM::WS_TEXT:
        {
            WORKSHEET_DATAITEM_TEXT * wsText = (WORKSHEET_DATAITEM_TEXT*)wsItem;
            bool multilines = false;

            if( wsText->m_SpecialMode )
                wsText->m_FullText = wsText->m_TextBase;
            else
            {
                wsText->m_FullText = BuildFullText( wsText->m_TextBase );
                multilines = wsText->ReplaceAntiSlashSequence();
            }

            if( wsText->m_FullText.IsEmpty() )
                break;

            if( pensize == 0 )
                pensize = m_penSize;

            wsText->SetConstrainedTextSize();
            wxSize textsize;

            textsize.x = KiROUND( wsText->m_ConstrainedTextSize.x
                                  * WORKSHEET_DATAITEM::m_WSunits2Iu );
            textsize.y = KiROUND( wsText->m_ConstrainedTextSize.y
                                  * WORKSHEET_DATAITEM::m_WSunits2Iu );

            if( wsText->IsBold())
                pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );

            for( int jj = 0; jj < wsText->m_RepeatCount; jj++)
            {
                if( jj && ! wsText->IsInsidePage( jj ) )
                    continue;

                gtext = new WS_DRAW_ITEM_TEXT( wsText, wsText->m_FullText,
                                               wsText->GetStartPosUi( jj ),
                                               textsize, pensize, color,
                                               wsText->IsItalic(),
                                               wsText->IsBold() );
                Append( gtext );
                gtext->SetMultilineAllowed( multilines );
                wsText->TransfertSetupToGraphicText( gtext );

                // Increment label for the next text
                // (has no meaning for multiline texts)
                if( wsText->m_RepeatCount > 1 && !multilines )
                    wsText->IncrementLabel( (jj+1)*wsText->m_IncrementLabel);
            }
        }
            break;

        case WORKSHEET_DATAITEM::WS_SEGMENT:
            if( pensize == 0 )
                pensize = m_penSize;

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    continue;
                Append( new WS_DRAW_ITEM_LINE( wsItem, wsItem->GetStartPosUi( jj ),
                                               wsItem->GetEndPosUi( jj ),
                                               pensize, color ) );
            }
            break;

        case WORKSHEET_DATAITEM::WS_RECT:
            if( pensize == 0 )
                pensize = m_penSize;

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    break;

                Append( new WS_DRAW_ITEM_RECT( wsItem, wsItem->GetStartPosUi( jj ),
                                               wsItem->GetEndPosUi( jj ),
                                               pensize, color ) );
            }
            break;

        case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
        {
            WORKSHEET_DATAITEM_POLYPOLYGON * wspoly =
                (WORKSHEET_DATAITEM_POLYPOLYGON*) wsItem;
            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    continue;

                for( int kk = 0; kk < wspoly->GetPolyCount(); kk++ )
                {
                    const bool fill = true;
                    WS_DRAW_ITEM_POLYGON* poly = new WS_DRAW_ITEM_POLYGON( wspoly,
                                                wspoly->GetStartPosUi( jj ),
                                                fill, pensize, color );
                    Append( poly );

                    // Create polygon outline
                    unsigned ist = wspoly->GetPolyIndexStart( kk );
                    unsigned iend = wspoly->GetPolyIndexEnd( kk );
                    while( ist <= iend )
                        poly->m_Corners.push_back(
                            wspoly->GetCornerPositionUi( ist++, jj ) );

                }
            }
        }
            break;

        case WORKSHEET_DATAITEM::WS_BITMAP:

            ((WORKSHEET_DATAITEM_BITMAP*)wsItem)->SetPixelScaleFactor();

            for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
            {
                if( jj && ! wsItem->IsInsidePage( jj ) )
                    continue;

                Append( new WS_DRAW_ITEM_BITMAP( wsItem,
                    wsItem->GetStartPosUi( jj ) ) );
            }
            break;

        }
    }
}
Exemplo n.º 13
0
void CBCGPTextStyleRef::SetMargins (const CRect& rect)
{
    SetMargins (rect.left, rect.top, rect.right, rect.bottom);
}
void CXTPReportInplaceEdit::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs)
{
	SetItemArgs(pItemArgs);
	m_pSelectedConstraint = NULL;

	XTP_REPORTRECORDITEM_METRICS* pMetrics = new XTP_REPORTRECORDITEM_METRICS;

	CXTPReportRecordItemText* pTextItem = DYNAMIC_DOWNCAST(CXTPReportRecordItemText, pItem);

	pItemArgs->pRow->FillMetrics(pColumn, pItem, pMetrics);

	if (pTextItem != NULL)
	{
		pMetrics->strText = pTextItem->GetValue();
	}
	else //not CXTPReportRecordItemText case!
	{
		pMetrics->strText = pItem->GetCaption(pColumn);
	}

	CXTPReportRecordItemEditOptions* pEditOptions = pItem->GetEditOptions(pColumn);
	ASSERT(pEditOptions);
	if (!pEditOptions)
		return;
	CRect rect = pItemArgs->rcItem;
	rect.DeflateRect(2, 1, 2, 2);

	m_clrText = pMetrics->clrForeground;
	m_strValue = pMetrics->strText;
	m_strText_prev = pMetrics->strText;

	DWORD dwEditStyle = WS_CHILD | pEditOptions->m_dwEditStyle;

	dwEditStyle &= ~(ES_LEFT | ES_RIGHT | ES_CENTER);

	if (pControl->GetPaintManager()->m_bUseEditTextAlignment)
	{
		if (pMetrics->nColumnAlignment & DT_RIGHT)
			dwEditStyle |= ES_RIGHT;
		else if (pMetrics->nColumnAlignment & DT_CENTER)
			dwEditStyle |= ES_CENTER;
	}

	if (m_hWnd)
	{
		DWORD dwStyle = WS_CHILD | WS_VISIBLE | ES_READONLY;

		if ((GetStyle() & dwStyle) != (dwEditStyle & dwStyle))
			DestroyWindow();
	}

	if (!m_hWnd)
		CEdit::Create(dwEditStyle, rect, pControl, 0);

	if (pControl->GetExStyle() & WS_EX_RTLREADING)
		ModifyStyleEx(0, WS_EX_RTLREADING);


	SetLimitText(pEditOptions->m_nMaxLength);

	//SetFocus();
	SetFont(pMetrics->pFont);
	SetWindowText(m_strValue);

	pMetrics->InternalRelease();

	if (rect.right > rect.left)
	{
		SetWindowPos(0, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_SHOWWINDOW);
		SetFocus();
	}
	else
	{
		HideWindow();
	}

	SetMargins(0, 0);
}
Exemplo n.º 15
0
SIM_PLOT_PANEL::SIM_PLOT_PANEL( SIM_TYPE aType, wxWindow* parent, wxWindowID id, const wxPoint& pos,
                const wxSize& size, long style, const wxString& name )
    : mpWindow( parent, id, pos, size, style ), m_colorIdx( 0 ),
        m_axis_x( nullptr ), m_axis_y1( nullptr ), m_axis_y2( nullptr ), m_type( aType )
{
    LimitView( true );
    SetMargins( 50, 80, 50, 80 );

    wxColour grey( 96, 96, 96 );
    SetColourTheme( *wxBLACK, *wxWHITE, grey );
    EnableDoubleBuffer( true );
    UpdateAll();

    switch( m_type )
    {
        case ST_AC:
            m_axis_x = new FREQUENCY_LOG_SCALE( wxT( "Frequency" ), mpALIGN_BOTTOM );
            m_axis_y1 = new GAIN_SCALE( wxT( "Gain" ), mpALIGN_LEFT );
            m_axis_y2 = new PHASE_SCALE( wxT( "Phase" ), mpALIGN_RIGHT );
            m_axis_y2->SetMasterScale( m_axis_y1 );
            break;

        case ST_DC:
            m_axis_x = new VOLTAGE_SCALE_X( wxT( "Voltage (sweeped)" ), mpALIGN_BOTTOM );
            m_axis_y1 = new VOLTAGE_SCALE_Y( wxT( "Voltage (measured)" ), mpALIGN_LEFT );
            break;

        case ST_NOISE:
            m_axis_x = new FREQUENCY_LOG_SCALE( wxT( "Frequency" ), mpALIGN_BOTTOM );
            m_axis_y1 = new mpScaleY( wxT( "noise [(V or A)^2/Hz]" ), mpALIGN_LEFT );
            break;

        case ST_TRANSIENT:
            m_axis_x = new TIME_SCALE( wxT( "Time" ), mpALIGN_BOTTOM );
            m_axis_y1 = new VOLTAGE_SCALE_Y( wxT( "Voltage" ), mpALIGN_LEFT );
            m_axis_y2 = new CURRENT_SCALE( wxT( "Current" ), mpALIGN_RIGHT );
            m_axis_y2->SetMasterScale( m_axis_y1 );
            break;

        default:
            // suppress warnings
            break;
    }

    if( m_axis_x )
    {
        m_axis_x->SetTicks( false );
        m_axis_x->SetNameAlign ( mpALIGN_BOTTOM );

        AddLayer( m_axis_x );
    }

    if( m_axis_y1 )
    {
        m_axis_y1->SetTicks( false );
        m_axis_y1->SetNameAlign ( mpALIGN_LEFT );
        AddLayer( m_axis_y1 );
    }

    if( m_axis_y2 )
    {
        m_axis_y2->SetTicks( false );
        m_axis_y2->SetNameAlign ( mpALIGN_RIGHT );
        AddLayer( m_axis_y2 );
    }

    m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH );
    m_legend->SetVisible( false );
    AddLayer( m_legend );
    m_topLevel.push_back( m_legend );
    SetColourTheme( *wxBLACK, *wxWHITE, grey );

    EnableDoubleBuffer( true );
    UpdateAll();
}
Exemplo n.º 16
0
void CGridRFURunBase::_Build()  // called from _SetupKit();
{
  nwxLabelGridBatch x(this);
  ClearAll();  // nwxGrid.h nwxLabelGrid::ClearAll();
  wxFont fontChannel = GetDefaultCellFont();
  wxFont fontLabel = fontChannel;
  fontChannel.SetWeight(wxFONTWEIGHT_BOLD);
  fontLabel.SetStyle(wxFONTSTYLE_ITALIC);
  SetDefaultLabelFont(fontLabel);
  SetDefaultLabelTextColour(wxColour(192, 192, 192));
  const CChannelColors *pChannelColors = NULL;
  int nCurrentRowCount = GetNumberRows();
  int i;
  int j;
  if(nCurrentRowCount < m_nROW_COUNT)
  {
    InsertRows(m_nROW_CHANNEL_START, m_nROW_COUNT - nCurrentRowCount);
    _UpdateReadOnly();
  }
  else if(nCurrentRowCount > m_nROW_COUNT)
  {
    DeleteRows(m_nROW_CHANNEL_START,nCurrentRowCount - m_nROW_COUNT);
  }
  SetDefaultCellValidator(
    new nwxGridCellUIntRangeValidator(
      mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,true));
  EnableDragColSize(false);
  EnableDragRowSize(false);
  SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE);
  for(i = 0; i < m_nROW_COUNT; i++)
  {
    for(j = 0; j < COL_COUNT; j++)
    {
      SetCellValue(i,j,"00000000"); // used for size
      if(_DisabledCell(i,j))
      {
        SetCellBackgroundColour(i,j,GetGridLineColour());
      }
    }
  }
  SetDefaultEditor(new wxGridCellFloatEditor(1,0));
  SetRowLabelValue(m_nROW_SAMPLE,"Sample");
  SetRowLabelValue(m_nROW_LADDER,"Ladder");
  SetRowLabelValue(m_nROW_ILS,"   ILS   ");

  SetColLabelValue(COL_ANALYSIS,"Analysis");
  SetColLabelValue(COL_DETECTION,"Detection");
  SetColLabelValue(COL_INTERLOCUS,"Interlocus");
  SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE);
  SetMargins(0,0);
  ChannelNumberIterator itrChannelCol;
  int nRow;
  const wxChar *psDye = NULL;
  wxString sLabel;
  for(itrChannelCol = m_vnChannelNumbers.begin(), 
          nRow = m_nROW_CHANNEL_START;
    itrChannelCol != m_vnChannelNumbers.end();
    ++itrChannelCol, ++nRow)
  {
    if(m_pKitColors != NULL)
    {
      pChannelColors = m_pKitColors->GetColorChannel(*itrChannelCol);
      psDye = (pChannelColors == NULL) ? NULL : (const wxChar *) pChannelColors->GetDyeName();
    }
    CGridLocusColumns::FORMAT_CHANNEL_DYE(&sLabel,*itrChannelCol,psDye);
    SetRowLabelValue(nRow,sLabel);
    if(pChannelColors != NULL)
    {
      _SetupChannelRow(nRow,pChannelColors->GetColorAnalyzed(),fontChannel);
    }
    else
    {
      _SetupDefaultChannelRow(nRow);
    }
  }
  nwxGrid::UpdateLabelSizes(this);
  AutoSize();
  _DisableUnused();
}