示例#1
0
void CAbstractTextEdit::Render()
{
	CAbstractLabel::Render();
	
	if(m_Composing)
	{
		int FontSize = GetFontSize();
		vec4 FontColor = 1.0f;
		
		CRect ComposingRect = CRect(
			GetTextRect().x + GetTextRect().w,
			GetTextRect().y,
			TextRenderer()->GetTextWidth(&m_ComposingTextCache),
			GetTextRect().h
		);
		
		const CAsset_GuiLabelStyle* pLabelStyle = AssetsManager()->GetAsset<CAsset_GuiLabelStyle>(CAssetPath::GuiLabelStyleSystem(GUILABELSTYLE_COMPOSING));
		if(pLabelStyle)
		{
			FontSize = Context()->ApplyGuiScale(pLabelStyle->GetFontSize());
			FontColor = pLabelStyle->m_TextColor;
			
			CRect Rect = ComposingRect;
			int Padding = Context()->ApplyGuiScale(pLabelStyle->GetPadding());
			Rect.AddMargin(Padding);
			ComposingRect.x += Padding;
			
			AssetsRenderer()->DrawGuiRect(&ComposingRect, pLabelStyle->GetRectPath());
		}
		m_ComposingTextCache.SetFontSize(GetFontSize());
		m_ComposingTextCache.SetBoxSize(ivec2(-1, ComposingRect.h));
		TextRenderer()->DrawText(&m_ComposingTextCache, ivec2(ComposingRect.x, ComposingRect.y), FontColor);
	}
	
	// render the cursor
			// cursor position
	if(m_TextCursor.m_TextIter >= 0)
	{
		if((2*time_get()/time_freq()) % 2)
		{
			Graphics()->TextureClear();
			Graphics()->LinesBegin();
			Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
			
			float x = m_TextCursor.m_Position.x + 0.5f;
			float y0 = GetTextRect().y;
			float y1 = GetTextRect().y + GetTextRect().h;
			IGraphics::CLineItem Line(x, y0, x, y1);
			Graphics()->LinesDraw(&Line, 1);
			
			Graphics()->LinesEnd();
		}
	}
}
示例#2
0
nsFontSizeTextAttr::nsFontSizeTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
  nsTextAttr<nscoord>(aFrame == nsnull)
{
  mDC = aRootFrame->PresContext()->DeviceContext();

  mRootNativeValue = GetFontSize(aRootFrame);
  mIsRootDefined = true;

  if (aFrame) {
    mNativeValue = GetFontSize(aFrame);
    mIsDefined = true;
  }
}
示例#3
0
void CButton::ConstructL()
    {
    #ifdef __DEBUG
    __LOGSTR("Construct");
    #endif
    CActiveScheduler::Add(this);
    iColor = KRgbRed;
    iWs = RWsSession();
    iFs.Connect();
    iWs.Connect(iFs);
    iWg = RWindowGroup(iWs);
    iWg.Construct((TUint32)&iWg,EFalse);
    iWg.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
    iWg.EnableReceiptOfFocus(ETrue);

    iWindow = RWindow(iWs);
    iWindow.Construct(iWg,(TUint32)&iWg+1);
    iWindow.Activate();
    iWindow.SetNonFading(ETrue);
    //
    iWindow.SetBackgroundColor(KRgbBlack);

    iScreen=new (ELeave) CWsScreenDevice(iWs);
    User::LeaveIfError(iScreen->Construct());
    User::LeaveIfError(iScreen->CreateContext(iGc));
    GetFontSize();
    iScreenSize.iY = iScreen->GetCurrentScreenModeAttributes().iScreenSize.iHeight;
    iScreenSize.iX = iScreen->GetCurrentScreenModeAttributes().iScreenSize.iWidth;
    iWindow.SetExtent(TPoint(0,iScreenSize.iY-60),TSize(iScreenSize.iX,60));
    iWs.Flush();
    Draw();
    iWs.Flush();
    }
示例#4
0
//======================================================================
// valid combinations for now are:
// title: left, value: left   == [TITLE VALUE         ]
// title: left, value: right  == [TITLE          VALUE]
// title: right, value: right == [         VALUE TITLE]
//======================================================================
void NvUIValueText::PositionOutput()
{
    const float enSpace = GetFontSize() * 0.25f; // !!!!TBD TODO look up real en space size?
    NvUIRect tr;
    GetScreenRect(tr);
    // reset.
    m_valueText->SetDimensions(tr.width, tr.height);
    m_valueText->SetOrigin(tr.left, tr.top);

    const float tw = INHERITED::GetStringPixelWidth();

    if (m_valueAlign == NvUITextAlign::RIGHT)
    {
        // if both alignments are right, then put number on the LEFT
        if (m_titleAlign == NvUITextAlign::RIGHT)
        {   // reset WIDTH of valuetext to base width minus title width minus padding
            if (tw>0) // then we need to offset, else we're fine.
                m_valueText->SetOrigin(tr.left - tw - enSpace, tr.top);
        }
        else // put number far right of rect
        {
            m_valueText->SetOrigin(tr.left + tr.width, tr.top);
        }
    }
    else // else value must be left-aligned, base off title
    {
        if (tw>0) // then we need to offset, else we're fine.
            m_valueText->SetOrigin(tr.left + tw + enSpace, tr.top);
    }
}
  void UpdateFontSize()
  {
    int font_size = GetFontSize();

    for (auto const& em : em_converters_)
      em->SetFontSize(font_size);
  }
示例#6
0
MultiLineText *MultiLineText::SetText(const std::string &text)
{
	m_text = text;
	m_layout.Reset(new TextLayout(GetContext()->GetFont(GetFontSize()), m_text));
	GetContext()->RequestLayout();
	return this;
}
// we don't use CreateFormatterArgsDoc() to not introduce dependency
// on gGlobalPrefs in EngineDump
HtmlFormatterArgs *CreateFormatterArgsDoc2(Doc doc, int dx, int dy, PoolAllocator *textAllocator)
{
    HtmlFormatterArgs *args = CreateFormatterArgsDoc(doc, dx, dy, textAllocator);
    args->SetFontName(GetFontName());
    args->fontSize = GetFontSize();
    return args;
}
示例#8
0
int GuiTextEdit::CalcCursorPos(float mousex)
{
  float startX = GetCombinedPos().x;
  float sizeX = GetSize().x;

  if (mousex < startX)
  {
    return m_first;
  }
  else if (mousex > startX + sizeX)
  {
    return m_last;
  }

  int pos = m_caret;
  for (int i = m_first; i < m_last; i++)
  {
    float x = (GetFont()->GetTextWidth(m_text.substr(m_first, i - m_first)) * 
      GetFontSize() * m_scaleX) + startX;

    if (x > mousex)
    {
      pos = std::max(0, i - 1);
      // DON'T recalc m_first and m_last!
      break;
    }
  }
  return pos;
}
示例#9
0
void   LineEdit::Layout() {
	Size sz = sb.GetReducedViewSize();
	if(nohbar || isdrag)
		sz.cy = GetSize().cy;
	sb.SetPage(sz / GetFontSize());
	SetHBar();
}
示例#10
0
////////////////////////////////////////////////////////////////////
// Public functions
//
void CDrawField::Draw( int page, CDC* dc )
/* ============================================================
	Function :		CDrawField::Draw
	Description :	Draws this object.
	Access :		Public
					
	Return :		void
	Parameters :	int page	-	Current page
					CDC* dc		-	CDC to draw to

	Usage :			Called by the generator to draw the object.

   ============================================================*/
{

	CString title = GetTitle();
	CDoubleRect rect = GetPosition();
	CUnitConversion::InchesToPixels( rect );

	CRect r( static_cast< int >( rect.left ), static_cast< int >( rect.top ), static_cast< int >( rect.right ), static_cast< int >( rect.bottom ) );
	CUnitConversion::AdjustPixelsToPaper( dc, r );

	LOGFONT	lf;
	ZeroMemory( &lf, sizeof( lf ) );

	lstrcpy( lf.lfFaceName, GetFontName() );
	lf.lfHeight = CUnitConversion::PointsToPixels( static_cast< double >( GetFontSize() ) / 10.0 );
	lf.lfItalic = static_cast< BYTE >( GetFontItalic() );
	lf.lfUnderline = static_cast< BYTE >( GetFontUnderline() );
	lf.lfStrikeOut = static_cast< BYTE >( GetFontStrikeout() );
	lf.lfCharSet = static_cast< BYTE >( GetFontCharset() );

	if( GetFontBold() )
		lf.lfWeight = FW_BOLD;
	else
		lf.lfWeight = FW_NORMAL;

	if( IsBold( title ) )
		lf.lfWeight = FW_BOLD;

	if( IsItalic( title ) )
		lf.lfItalic = TRUE;

	CFont	font;
	font.CreateFontIndirect( &lf );

	dc->SelectObject( &font );
	int color = dc->SetTextColor( GetFontColor() );
	int mode = dc->SetBkMode( TRANSPARENT );
	int justification = GetJustification();

	ReplaceFields( page, title );

	dc->DrawText( title, r, DT_NOPREFIX | DT_WORDBREAK | justification );

	dc->SetBkMode( mode );
	dc->SetTextColor( color );
	dc->SelectStockObject( ANSI_VAR_FONT );

}
示例#11
0
文件: depict.cpp 项目: RitaDo/pgchem
  bool OBDepict::AddAtomLabels(AtomLabelType type)
  {
    d->painter->SetPenColor(OBColor("red"));
    d->painter->SetFillColor(OBColor("red"));
    d->painter->SetFontSize((int)(GetFontSize() * 0.8));// smaller text
    OBAtomIterator i;
    for (OBAtom *atom = d->mol->BeginAtom(i); atom; atom = d->mol->NextAtom(i)) {
      vector3 pos(atom->GetVector());
      std::stringstream ss;
      switch (type) {
        case AtomId:
          ss << atom->GetId();
          d->painter->DrawText(pos.x(), pos.y(), ss.str());
          break;
        case AtomSymmetryClass:
          ss << GetAtomSymClass(atom);
          d->painter->DrawText(pos.x(), pos.y(), ss.str());
          break;
        case AtomIndex:
          ss << atom->GetIdx();
          d->painter->DrawText(pos.x(), pos.y(), ss.str());
          break;

        default:
          break;
      }
    }

    return true;    
  }
示例#12
0
void kGUIText::InsertRichInfo(int index,int num)
{
	int i;
	RICHINFO_DEF rid;

	assert(index<=m_richinfosize,"Cannot insert past end of string");

	/* if at beginning or end of string then use "current" info */
	if(index==m_richinfosize || !index)
	{
		rid.fontid=GetFontID();
		rid.fontsize=GetFontSize();
		rid.bgcolor=m_bgcolor;
		rid.fcolor=GetColor();
	}
	else
		rid=*(GetRichInfoPtr(index-1));

	m_richinfo.Alloc(m_richinfosize+num);
	m_richinfo.InsertEntry(m_richinfosize,index,num);

	for(i=0;i<num;++i)
		m_richinfo.SetEntry(index+i,rid);

	m_richinfosize+=num;
	StringChanged();
}
示例#13
0
CFont* InformApp::GetFont(Fonts font)
{
  CFont& theFont = m_fonts[font];
  if ((HFONT)theFont == 0)
    theFont.CreatePointFont(10*GetFontSize(font),GetFontName(font));
  return &theFont;
}
示例#14
0
void LineEdit::RefreshChars(bool (*chars)(int c))
{
	RefreshDraw rw;
	rw.ctrl = this;
	rw.fsz = GetFontSize();
	rw.chars = chars;
	Paint(rw);
}
示例#15
0
void CPDF_VariableText::Initialize() {
  if (!m_bInitial) {
    CPVT_SectionInfo secinfo;
    CPVT_WordPlace place;
    place.nSecIndex = 0;
    AddSection(place, secinfo);
    CPVT_LineInfo lineinfo;
    lineinfo.fLineAscent = GetFontAscent(GetDefaultFontIndex(), GetFontSize());
    lineinfo.fLineDescent =
        GetFontDescent(GetDefaultFontIndex(), GetFontSize());
    AddLine(place, lineinfo);
    if (CSection* pSection = m_SectionArray.GetAt(0))
      pSection->ResetLinePlace();

    m_bInitial = TRUE;
  }
}
示例#16
0
void CMain::Opening(){
	int oldfontsize = GetFontSize();
	
	mrt::Opening();

	SetFontSize(oldfontsize);
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
};
示例#17
0
HtmlFormatterArgs *CreateFormatterArgsDoc(Doc doc, int dx, int dy, Allocator *textAllocator)
{
    HtmlFormatterArgs *args = CreateFormatterDefaultArgs(dx, dy, textAllocator);
    args->htmlStr = doc.GetHtmlData(args->htmlStrLen);
    args->SetFontName(GetFontName());
    args->fontSize = GetFontSize();
    return args;
}
示例#18
0
void CMyServer::ConstructL()
    {
    __LOGSTR("Construct");
    CActiveScheduler::Add(this);
    iWs = RWsSession();
    iFs.Connect();

    iTextPlain = CPlainText::NewL();

    ReadConf();
    __LOGSTR("ReadConfComplete");
	iOldName = _L("ClipboardChanged");

    iWs.Connect(iFs);
    iTaskList = new(ELeave) TApaTaskList(iWs);

    iScreen = new(ELeave) CWsScreenDevice(iWs);
    CleanupStack::PushL(iScreen);
    iScreen->Construct();
    CleanupStack::Pop(iScreen);

    iChangeTrap = CChangeTrap::NewL();
    iChangeTrap->SetObserver(this);
    iTimer = CPTimer::NewL();
    iTimer->SetObserver(this);
    iCaller = CCaller::NewL();

    iWg = RWindowGroup(iWs);
    iWg.Construct((TUint32)&iWg,EFalse);
    iWg.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
    iWg.EnableReceiptOfFocus(EFalse);
    iScreen->CreateContext(iGc);
    iWindow = RWindow(iWs);
    iWindow.Construct(iWg,(TUint32)&iWg+1);

    iWindow.Activate();
    iWindow.SetExtent(TPoint(0,0),TSize(1,1));
    iWindow.SetRequiredDisplayMode(EColor16MA);
	iWindow.SetOrdinalPosition(5555,ECoeWinPriorityAlwaysAtFront);
    TRgb backgroundColour = KRgbBlack;
    //if(KErrNone == iWindow.SetTransparencyAlphaChannel())
   // 	{
    //	backgroundColour.SetAlpha(0);
    //	}
    iWindow.SetBackgroundColor(backgroundColour);


    GetFontSize();

    iWindow.SetSize(iSize);
    __LOGSTR2("iSize1: %d,iSize2: %d",iSize.iWidth,iSize.iHeight);
    iPos=TPoint(iConfig.iX,iConfig.iY);
	iWindow.SetVisible(EFalse);


    iWs.Flush();
    //Draw(iOldName);
    }
示例#19
0
FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta,
                                const CPDF_Point& point,
                                FX_DWORD nFlag) {
  if (HasFlag(PES_MULTILINE)) {
    CPDF_Point ptScroll = GetScrollPos();

    if (zDelta > 0) {
      ptScroll.y += GetFontSize();
    } else {
      ptScroll.y -= GetFontSize();
    }
    SetScrollPos(ptScroll);

    return TRUE;
  }

  return FALSE;
}
示例#20
0
void SQRWndOffSet::SetStep(INT32 time, FLOAT mStep)
{
	this->mStep = mStep;
	mSteptimer  = time;
	mStepResult = static_cast<FLOAT>(-this->GetWndWidth());
	mBeginTimer = static_cast<DWORD>(GetProcessTime());
	mStepOver = strlen(this->GetWndText()) * GetFontSize()/2 * GetWndZoom(); 

}
FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo,
                                            FX_BOOL bFactFontSize) {
  return m_bRichText && WordInfo.pWordProps
             ? (WordInfo.pWordProps->nScriptType == ScriptType::Normal ||
                        bFactFontSize
                    ? WordInfo.pWordProps->fFontSize
                    : WordInfo.pWordProps->fFontSize * VARIABLETEXT_HALF)
             : GetFontSize();
}
示例#22
0
Rect LineEdit::DropCaret()
{
	if(IsNull(dropcaret))
		return Rect(0, 0, 0, 0);
	Size fsz = GetFontSize();
	Point p = dropcaret - sb;
	p = Point(p.x * fsz.cx, p.y * fsz.cy);
	return RectC(p.x, p.y, 1, fsz.cy);
}
示例#23
0
bool CPWL_Edit::OnMouseWheel(short zDelta,
                             const CFX_PointF& point,
                             uint32_t nFlag) {
  if (HasFlag(PES_MULTILINE)) {
    CFX_PointF ptScroll = GetScrollPos();

    if (zDelta > 0) {
      ptScroll.y += GetFontSize();
    } else {
      ptScroll.y -= GetFontSize();
    }
    SetScrollPos(ptScroll);

    return true;
  }

  return false;
}
示例#24
0
void CMain::Setting(){
	int oldfontsize = GetFontSize();
	
	while(mrt::Setting()){
		//設定処理
	}

	SetFontSize(oldfontsize);
}
示例#25
0
void LineEdit::PlaceCaret0(Point p) {
	Size fsz = GetFontSize();
	p -= sb;
	caretpos = Point(p.x * fsz.cx, p.y * fsz.cy);
	if(overwrite)
		SetCaret(caretpos.x, caretpos.y + fsz.cy - 2, fsz.cx, 2);
	else
		SetCaret(caretpos.x, caretpos.y, 2, fsz.cy);
}
示例#26
0
PRBool
nsFontSizeTextAttr::GetValueFor(nsIDOMElement *aElm, nscoord *aValue)
{
  nsIFrame *frame = nsCoreUtils::GetFrameFor(aElm);
  if (!frame)
    return PR_FALSE;
  
  *aValue = GetFontSize(frame);
  return PR_TRUE;
}
PRBool
nsFontSizeTextAttr::GetValueFor(nsIContent *aContent, nscoord *aValue)
{
  nsIFrame *frame = aContent->GetPrimaryFrame();
  if (!frame)
    return PR_FALSE;
  
  *aValue = GetFontSize(frame);
  return PR_TRUE;
}
示例#28
0
FX_FLOAT CXFA_Font::GetLetterSpacing() {
  CFX_WideStringC wsValue;
  if (!m_pNode->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue))
    return 0;

  CXFA_Measurement ms(wsValue);
  if (ms.GetUnit() == XFA_UNIT_Em)
    return ms.GetValue() * GetFontSize();
  return ms.ToUnit(XFA_UNIT_Pt);
}
示例#29
0
bool
nsFontSizeTextAttr::GetValueFor(nsIContent *aContent, nscoord *aValue)
{
  nsIFrame *frame = aContent->GetPrimaryFrame();
  if (!frame)
    return false;
  
  *aValue = GetFontSize(frame);
  return true;
}
示例#30
0
void GuiTextEdit::GetFirstLast(int line, int* first, int* last)
{
  *first = 0;
  *last = m_text.size();
  int caret = m_caret;
  if (m_drawCaret)
  {
    caret++;
  }

  Vec2f size = GetSize();  

  switch (m_just)
  {
  case AMJU_JUST_LEFT:
    while ((GetFont()->GetTextWidth(m_text.substr(*first, *last - *first)) * 
      GetFontSize() * m_scaleX) > size.x)
    {
      if (caret > *last)
      {
        (*last)++;
      }
      else if (caret == *last)
      {
        (*first)++;
      }
      else if (caret < *first)
      {
        (*first)--;
      }
      else
      {
        (*last)--;
      }
    }

    if (*last > (int)m_text.size())
    {
      *last = m_text.size();
    }
    Assert(*last <= (int)m_text.size());
    Assert(*first >= 0);
    Assert(m_caret >= *first);
    Assert(m_caret <= *last);

    m_first = *first;
    m_last = *last;

    return;

  default:
    Assert(0);
  }
}