void SCH_TEXT::Rotate( wxPoint aPosition ) { int dy; wxPoint pt = GetTextPos(); RotatePoint( &pt, aPosition, 900 ); SetTextPos( pt ); int spin = GetLabelSpinStyle(); // Global and hierarchical labels spin backwards. Fix here because // changing SetLabelSpinStyle would break existing designs. if( this->Type() == SCH_GLOBAL_LABEL_T || this->Type() == SCH_HIERARCHICAL_LABEL_T ) SetLabelSpinStyle( ( spin - 1 >= 0 ? ( spin - 1 ) : 3 ) ); else SetLabelSpinStyle( ( spin + 1 ) % 4 ); if( this->Type() == SCH_TEXT_T ) { switch( GetLabelSpinStyle() ) { case 0: dy = GetTextHeight(); break; // horizontal text case 1: dy = 0; break; // Vert Orientation UP case 2: dy = GetTextHeight(); break; // invert horizontal text case 3: dy = 0; break; // Vert Orientation BOTTOM default: dy = 0; break; } SetTextY( GetTextPos().y + dy ); } }
int LIB_TEXT::compare( const LIB_ITEM& other ) const { wxASSERT( other.Type() == LIB_TEXT_T ); const LIB_TEXT* tmp = ( LIB_TEXT* ) &other; int result = m_Text.CmpNoCase( tmp->m_Text ); if( result != 0 ) return result; if( GetTextPos().x != tmp->GetTextPos().x ) return GetTextPos().x - tmp->GetTextPos().x; if( GetTextPos().y != tmp->GetTextPos().y ) return GetTextPos().y - tmp->GetTextPos().y; if( GetTextWidth() != tmp->GetTextWidth() ) return GetTextWidth() - tmp->GetTextWidth(); if( GetTextHeight() != tmp->GetTextHeight() ) return GetTextHeight() - tmp->GetTextHeight(); return 0; }
/***************************************************************************** * void LoadFontScreen(void) *****************************************************************************/ void LoadForeignFontScreen(void) { SHORT width, height; height = 50; SetColor(GRAY002); SetFont((void *) &fireflysung_22); width = GetTextWidth((XCHAR *)ChineseStr, (void *) &fireflysung_22); OutTextXY((GetMaxX() - width) >> 1, height, (XCHAR *)ChineseStr); height += GetTextHeight((void *) &fireflysung_22) + 5; width = GetTextWidth((XCHAR *)JapaneseStr, (void *) &fireflysung_22); OutTextXY((GetMaxX() - width) >> 1, height, (XCHAR *)JapaneseStr); height += GetTextHeight((void *) &fireflysung_22) + 5; SetFont((void *) &UnBatang_0613_22); width = GetTextWidth((XCHAR *)KoreanStr, (void *) &UnBatang_0613_22); OutTextXY((GetMaxX() - width) >> 1, height, (XCHAR *)KoreanStr); height += GetTextHeight((void *) &UnBatang_0613_22) + 5; width = GetTextWidth((XCHAR *)RussianStr, (void *) &UnBatang_0613_22); OutTextXY((GetMaxX() - width) >> 1, height, (XCHAR *)RussianStr); height += GetTextHeight((void *) &UnBatang_0613_22) + 5; SetFont((void *) &DroidSans_24); width = GetTextWidth("Hello World!", (void *) &DroidSans_24); OutTextXY((GetMaxX() - width) >> 1, height, "Hello World!"); }
//////////////////// // Adjusts the size of the column header according to the current style void CListviewColumn::ReadjustSize() { CColumnStyle *style = getCurrentStyle(); cParent->setColumnHeight(MAX(cParent->getColumnHeight(), GetTextHeight(getCurrentStyle()->cFont, sText) + style->cBorder.getTopW() + style->cBorder.getBottomW())); cParent->ReadjustScrollbar(); }
void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) ); if( m_Parent->Type() == PCB_DIMENSION_T ) aList.push_back( MSG_PANEL_ITEM( _( "Dimension" ), GetShownText(), DARKGREEN ) ); else aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), GetShownText(), DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BLUE ) ); if( !IsMirrored() ) aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "No" ), DARKGREEN ) ); else aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) ); msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) ); msg = MessageTextFromValue( aUnits, GetThickness() ); aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) ); msg = MessageTextFromValue( aUnits, GetTextWidth() ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) ); msg = MessageTextFromValue( aUnits, GetTextHeight() ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) ); }
void cFont::RenderFontShadow(WORD wFontIdx, int nShadowDistance, char* text, int size, RECT* pRect, DWORD dwColor) { if(FALSE == IsCreateFont(wFontIdx)) { return; } if( wFontIdx == 5 ) { pRect->right = pRect->left + GetTextExtentWidth( wFontIdx, text, size ) + GetTextWidth( wFontIdx ) ; } else { pRect->right = pRect->left + GetTextExtent( wFontIdx, text, size ) + GetTextWidth( wFontIdx ); } pRect->bottom = pRect->top + GetTextHeight( wFontIdx ) + 5; if(*text) { // render shadow text. DWORD dwShadowColor = 0xff000000 | RGB(10, 10, 10) ; RECT shadowRect = { pRect->left + nShadowDistance, pRect->top + nShadowDistance, pRect->right, pRect->bottom } ; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,&shadowRect,dwShadowColor,CHAR_CODE_TYPE_ASCII,0,0); // render front text. DWORD dwFrontColor = 0xff000000 | dwColor ; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,dwFrontColor,CHAR_CODE_TYPE_ASCII,0,0); } }
void cFont::RenderNoticeMsg(WORD wFontIdx, char * text, int size, RECT * pRect, DWORD frontColor, DWORD backColor) { if( FALSE == IsCreateFont(wFontIdx) ) { return; } pRect->right = pRect->left + GetTextExtent( wFontIdx, text, size ) + GetTextWidth( wFontIdx ); pRect->bottom = pRect->top + GetTextHeight( wFontIdx ) + 5; if(*text) { pRect->left -= 1 ; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,backColor,CHAR_CODE_TYPE_ASCII,0,0); pRect->left += 2 ; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,backColor,CHAR_CODE_TYPE_ASCII,0,0); pRect->left -= 1 ; pRect->top -= 1 ; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,backColor,CHAR_CODE_TYPE_ASCII,0,0); pRect->top += 2 ; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,backColor,CHAR_CODE_TYPE_ASCII,0,0); pRect->top -= 1 ; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,frontColor,CHAR_CODE_TYPE_ASCII,0,0); } }
CBaseDialog::CBaseDialog( _In_ CParentWnd* pParentWnd, _In_ CMapiObjects* lpMapiObjects, // Pass NULL to create a new m_lpMapiObjects, ULONG ulAddInContext ) : CMyDialog() { TRACE_CONSTRUCTOR(CLASS); HRESULT hRes = S_OK; EC_B(m_szTitle.LoadString(IDS_BASEDIALOG)); m_bDisplayingMenuText = false; m_lpBaseAdviseSink = NULL; m_ulBaseAdviseConnection = NULL; m_ulBaseAdviseObjectType = NULL; m_bIsAB = false; // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 EC_D(m_hIcon, AfxGetApp()->LoadIcon(IDR_MAINFRAME)); m_cRef = 1; m_lpPropDisplay = NULL; m_lpFakeSplitter = NULL; // Let the parent know we have a status bar so we can draw our border correctly SetStatusHeight(GetSystemMetrics(SM_CXSIZEFRAME) + GetTextHeight(::GetDesktopWindow())); m_lpParent = pParentWnd; if (m_lpParent) m_lpParent->AddRef(); m_lpContainer = NULL; m_ulAddInContext = ulAddInContext; m_ulAddInMenuItems = NULL; m_lpMapiObjects = new CMapiObjects(lpMapiObjects); } // CBaseDialog::CBaseDialog
void EditBox::Render(){ if(!Visible() || !mText) return; gUiRender->PushTranslate(mPosition.x, mPosition.y); gUiRender->DrawText(mText); if(UiState::mFocus == this){ if(mSelectStart != mSelectEnd){ int x1, x2, h = GetTextHeight(); x1 = GetXFromCaret(mSelectStart); x2 = GetXFromCaret(mSelectEnd); gUiRender->SetDrawColour(0, 150, 255, 128); gUiRender->DrawRect(x1, 0, x2, h); gUiRender->ResetDrawColour(); } if(clock() - mCaretTimer > 600){ mCaretVisible = !mCaretVisible; mCaretTimer = clock(); } if(mCaretVisible){ int y = mText->GetCharHeight('y') - 1; int x1 = GetXFromCaret(mCaret); gUiRender->DrawLine(x1, 0, x1, y); } } gUiRender->PopTranslate(mPosition.x, mPosition.y); }
/********************************************************************* * Function: CHECKBOX *CbCreate(WORD ID, SHORT left, SHORT top, SHORT right, * SHORT bottom, WORD state, XCHAR *pText, * GOL_SCHEME *pScheme) * * Overview: Creates the check box. * ********************************************************************/ CHECKBOX *CbCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, XCHAR *pText, GOL_SCHEME *pScheme) { CHECKBOX *pCb = NULL; pCb = malloc(sizeof(CHECKBOX)); if (pCb == NULL) return pCb; pCb->hdr.ID = ID; pCb->hdr.pNxtObj = NULL; pCb->hdr.type = OBJ_CHECKBOX; pCb->hdr.left = left; pCb->hdr.top = top; pCb->hdr.right = right; pCb->hdr.bottom = bottom; pCb->pText = pText; pCb->hdr.state = state; // Set the style scheme if (pScheme == NULL) pCb->hdr.pGolScheme = _pDefaultGolScheme; else pCb->hdr.pGolScheme = (GOL_SCHEME *)pScheme; // Set the text height pCb->textHeight = 0; if(pText != NULL) { pCb->textHeight = GetTextHeight(pCb->hdr.pGolScheme->pFont); } GOLAddObject((OBJ_HEADER*) pCb); return pCb; }
void OpLabel::GetPreferedSize(INT32* w, INT32* h, INT32 cols, INT32 rows) { m_edit->UpdateSkinPadding(); //julienp: Otherwise, we mightg have the wrong padding here // if this is called before a relayout *w = GetTextWidth(); *h = GetTextHeight(); }
void RideSelectGui::UpdateWidgetSize(WidgetNumber wid_num, BaseWidget *wid) { switch (wid_num) { case RSEL_LIST: wid->resize_y = GetTextHeight(); wid->min_y = 5 * wid->resize_y; for (int i = 0; i < MAX_NUMBER_OF_RIDE_TYPES; i++) { const RideType *ride_type = _rides_manager.GetRideType(i); if (ride_type == nullptr) continue; int width, height; GetTextSize(ride_type->GetString(ride_type->GetTypeName()), &width, &height); if (width > wid->min_x) wid->min_x = width; } break; case RSEL_DESC: { int max_height = 0; for (int i = 0; i < MAX_NUMBER_OF_RIDE_TYPES; i++) { const RideType *ride_type = _rides_manager.GetRideType(i); if (ride_type == nullptr) continue; int width, height; GetMultilineTextSize(ride_type->GetString(ride_type->GetTypeDescription()), wid->min_x, &width, &height); if (height > max_height) max_height = height; } wid->min_y = max_height; break; } } }
/********************************************************************* * Function: STATICTEXT *StCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, * WORD state , XCHAR *pText, GOL_SCHEME *pScheme) * * Notes: Creates a STATICTEXT object and adds it to the current active list. * If the creation is successful, the pointer to the created Object * is returned. If not successful, NULL is returned. * ********************************************************************/ STATICTEXT *StCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, XCHAR *pText, GOL_SCHEME *pScheme) { STATICTEXT *pSt = NULL; pSt = (STATICTEXT*)malloc(sizeof(STATICTEXT)); if (pSt == NULL) return pSt; pSt->hdr.ID = ID; // unique id assigned for referencing pSt->hdr.pNxtObj = NULL; // initialize pointer to NULL pSt->hdr.type = OBJ_STATICTEXT; // set object type pSt->hdr.left = left; // left,top corner pSt->hdr.top = top; pSt->hdr.right = right; // right buttom corner pSt->hdr.bottom = bottom; pSt->pText = pText; // location of the text pSt->hdr.state = state; // Set the color scheme to be used if (pScheme == NULL) pSt->hdr.pGolScheme = _pDefaultGolScheme; else pSt->hdr.pGolScheme = (GOL_SCHEME *)pScheme; pSt->textHeight = 0; if (pSt->pText != NULL) { // Set the text height pSt->textHeight = GetTextHeight(pSt->hdr.pGolScheme->pFont); } GOLAddObject((OBJ_HEADER*) pSt); return pSt; }
void cFont::RenderFont(WORD wFontIdx, char * text, int size, RECT * pRect, DWORD color) { if(FALSE == IsCreateFont(wFontIdx)) { return; } //KES가 수정했음 040722 if( wFontIdx == 5 ) { pRect->right = pRect->left + GetTextExtentWidth( wFontIdx, text, size ) + GetTextWidth( wFontIdx ) ; } else { pRect->right = pRect->left + GetTextExtent( wFontIdx, text, size ) + GetTextWidth( wFontIdx ); } pRect->bottom = pRect->top + GetTextHeight( wFontIdx ) + 5; //+1안하면 밑줄이 안나온다. if(*text) { DWORD dwColor = 0xff000000 | color; g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,dwColor,CHAR_CODE_TYPE_ASCII,0,0); } }
void Driver::RenderText(const string& text,TextStyle& style,int x0,int y0,int width,int height) { string src=text; list<string> lines; int texth=0; int w,h; do { lines.push_back(GetNextTextLine(src,style,w,h,width)); if(texth) texth+=TextLineSkip(style.font,style.pointsize); texth+=GetTextHeight(lines.back(),style); } while(src != ""); if(style.valign==1) y0+=height/2-texth/2; else if(style.valign==2) y0+=height-texth; for(list<string>::iterator i=lines.begin(); i!=lines.end(); i++) RenderTextLine(*i,style,x0,y0,width); }
/********************************************************************* * Function: void TouchGetCalPoints(WORD* ax, WORD* ay) * * PreCondition: InitGraph() must be called before * * Input: ax - pointer to array receiving 3 X touch positions * ay - pointer to array receiving 3 Y touch positions * * Output: none * * Side Effects: none * * Overview: gets values for 3 touches * * Note: none * ********************************************************************/ void TouchGetCalPoints(WORD* ax, WORD* ay){ static const XCHAR calStr[] = {'C','A','L','I','B','R','A','T','I','O','N',0}; XCHAR calTouchLeft[] = {'3',' ','t','o','u','c','h','e','s',' ','l','e','f','t',0}; SHORT counter; SHORT x,y; SetFont((void*)&GOLFontDefault); SetColor(BRIGHTRED); OutTextXY((GetMaxX()-GetTextWidth((XCHAR*)calStr,(void*)&GOLFontDefault))>>1, (GetMaxY()-GetTextHeight((void*)&GOLFontDefault))>>1, (XCHAR*)calStr); for(counter=0; counter<3; counter++){ SetColor(BRIGHTRED); calTouchLeft[0] = '3' - counter; OutTextXY((GetMaxX()-GetTextWidth(calTouchLeft,(void*)&GOLFontDefault))>>1, (GetMaxY()+GetTextHeight((void*)&GOLFontDefault))>>1, calTouchLeft); // Wait for press do{ x=ADCGetX(); y=ADCGetY(); }while((y==-1)||(x==-1)); Beep(); *(ax+counter) = x; *(ay+counter) = y; // Wait for release do{ x=ADCGetX(); y=ADCGetY(); }while((y!=-1)&&(x!=-1)); SetColor(WHITE); OutTextXY((GetMaxX()-GetTextWidth(calTouchLeft,(void*)&GOLFontDefault))>>1, (GetMaxY()+GetTextHeight((void*)&GOLFontDefault))>>1, calTouchLeft); DelayMs(500); } }
INT_PTR StatsDialog::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { ResizeProc(hwnd, uMsg, wParam, lParam); switch (uMsg) { case WM_CTLCOLORSTATIC: { win::Dc dc = reinterpret_cast<HDC>(wParam); dc.SetBkMode(TRANSPARENT); dc.DetachDc(); return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW)); } case WM_DRAWITEM: { // Draw score bars if (wParam == IDC_STATIC_ANIME_STAT2) { LPDRAWITEMSTRUCT dis = reinterpret_cast<LPDRAWITEMSTRUCT>(lParam); win::Rect rect = dis->rcItem; win::Dc dc = dis->hDC; dc.FillRect(dis->rcItem, ::GetSysColor(COLOR_WINDOW)); int bar_height = GetTextHeight(dc.Get()); int bar_max = rect.Width() * 3 / 4; for (int i = 10; i > 0; i--) { if (i < 10) rect.top += bar_height; if (Stats.score_distribution[i] > 0.0f) { int bar_width = static_cast<int>(bar_max * Stats.score_distribution[i]); rect.bottom = rect.top + bar_height - 2; rect.right = rect.left + bar_width; dc.FillRect(rect, ui::kColorDarkBlue); } if (Stats.score_count[i] > 0.0f) { std::wstring text = ToWstr(Stats.score_count[i]); win::Rect rect_text = rect; rect_text.left = rect_text.right += 8; rect_text.right = dis->rcItem.right; dc.EditFont(nullptr, 7); dc.SetBkMode(TRANSPARENT); dc.SetTextColor(::GetSysColor(COLOR_GRAYTEXT)); dc.DrawText(text.c_str(), text.length(), rect_text, DT_SINGLELINE | DT_VCENTER); } } dc.DetachDc(); return TRUE; } break; } case WM_ERASEBKGND: return TRUE; } return DialogProcDefault(hwnd, uMsg, wParam, lParam); }
/***************************************************************************** * void LoadPipScreen(void) *****************************************************************************/ void LoadPipScreen(void) { SHORT x = 45, y = 100; SetFont((void *) &DroidSans_24); OutTextXY(x, y, (XCHAR *)" No image redraw"); y += GetTextHeight((void *)&DroidSans_24) + 10; OutTextXY(x, y, (XCHAR *)"under PIP is required!"); }
/********************************************************************* * Function: DmSetValue(DIGITALMETER *pDm, DWORD Value) * * Notes: Sets the value to be displayed. * ********************************************************************/ void DmSetValue(DIGITALMETER *pDm, DWORD Value) { // store the previous and current value to be displayed pDm->Pvalue = pDm->Cvalue; pDm->Cvalue = Value; pDm->textHeight = GetTextHeight(pDm->hdr.pGolScheme->pFont); }
void CXTPShortcutListBox::MeasureItem(LPMEASUREITEMSTRUCT lpMIS) { // get the text height. int iTextHeight = GetTextHeight((LPCTSTR)lpMIS->itemData); // calculate the total height of the item. lpMIS->itemHeight = GetTheme()->m_cyEdge + GetTheme()->m_cyIcon + GetTheme()->m_cyEdge + iTextHeight + GetTheme()->m_cyEdge; }
void TextWidget::Draw(double x, double y) const { if (pFont == NULL) { return; } Vector2 drawingPoint(x, y); if (vAlignment == VAlignmentTop) { } else if (vAlignment == VAlignmentCenter) { drawingPoint.SetY(y + (height - GetTextHeight()) / 2); } else if (vAlignment == VAlignmentBottom) { drawingPoint.SetY(y + (height - GetTextHeight())); } double lineHeight = pFont->GetLineHeight(); for (vector<pair<string::const_iterator, string::const_iterator> >::const_iterator it = lines.begin(); it != lines.end(); it++) { // TODO: add to MLIFont functions working with iterators to avoid string copying here string line(it->first, it->second); if (hAlignment == HAlignmentLeft) { drawingPoint.SetX(x); } else if (hAlignment == HAlignmentCenter) { drawingPoint.SetX(x + (width - pFont->GetWidth(line)) / 2); } else if (hAlignment == HAlignmentRight) { drawingPoint.SetX(x + (width - pFont->GetWidth(line))); } pFont->Draw(line, drawingPoint, textColor); drawingPoint.SetY(drawingPoint.GetY() + lineHeight); } }
/***************************************************************************** * void UpdateListBox() *****************************************************************************/ void UpdateListBox( BOOL up, BOOL down ) { LISTBOX * pLb = (LISTBOX *)GOLFindObject(ID_LBS_LISTBOX1); SHORT count = LbGetCount(pLb); SHORT CurItem = LbGetFocusedItem(pLb); SLIDER * pSld = (SLIDER *)GOLFindObject(ID_LBS_SLIDER1); SHORT pos = SldGetPos(pSld); WORD y; if( up ) { LbSetFocusedItem(pLb, CurItem - 1); SetState(pLb, LB_DRAW_ITEMS); if ( CurItem - 1 < count ) SldSetPos(pSld, pos + 1); SetState(pSld, SLD_DRAW_THUMB); if ( CurItem ) { y = ( CurItem - 1 ) * GetTextHeight((void *) altScheme->pFont); y += GetTextHeight((void *) altScheme->pFont)/2; GFX_DRIVER_MoveLayer( GFX_CURSOR_LAYER, LB_ORIGIN_START_X + 180, LB_ORIGIN_START_Y + y ); } } if( down ) { LbSetFocusedItem(pLb, CurItem + 1); SetState(pLb, LB_DRAW_ITEMS); if ( count - CurItem - 1 > 0 ) SldSetPos(pSld, pos - 1); SetState(pSld, SLD_DRAW_THUMB); if ( CurItem + 1 < count ) { y = ( CurItem + 1 ) * GetTextHeight((void *) altScheme->pFont); y += GetTextHeight((void *) altScheme->pFont)/2; GFX_DRIVER_MoveLayer( GFX_CURSOR_LAYER, LB_ORIGIN_START_X + 180, LB_ORIGIN_START_Y + y ); } } }
hsMatrix44 plTextGenerator::GetLayerTransform( void ) { hsMatrix44 xform; hsVector3 scale; scale.Set( (float)GetWidth() / (float)GetTextWidth(), (float)GetHeight() / (float)GetTextHeight(), 1.f ); xform.MakeScaleMat( &scale ); return xform; }
/********************************************************************************************************* * Function: DIGITALMETER *DmCreate(WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, * DWORD Value, BYTE NoOfDigits, BYTE DotPos, GOL_SCHEME *pScheme) * * Notes: Creates a DIGITALMETER object and adds it to the current active list. * If the creation is successful, the pointer to the created Object * is returned. If not successful, NULL is returned. * **********************************************************************************************************/ DIGITALMETER *DmCreate ( WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, DWORD Value, BYTE NoOfDigits, BYTE DotPos, GOL_SCHEME *pScheme ) { DIGITALMETER *pDm = NULL; pDm = GFX_malloc(sizeof(DIGITALMETER)); if(pDm == NULL) return (pDm); pDm->hdr.ID = ID; // unique id assigned for referencing pDm->hdr.pNxtObj = NULL; // initialize pointer to NULL pDm->hdr.type = OBJ_DIGITALMETER; // set object type pDm->hdr.left = left; // left,top corner pDm->hdr.top = top; pDm->hdr.right = right; // right buttom corner pDm->hdr.bottom = bottom; pDm->Cvalue = Value; // initial value to be displayed pDm->hdr.state = state; pDm->NoOfDigits = NoOfDigits; // number of digits to be displayed pDm->DotPos = DotPos; // position of decimal point pDm->hdr.DrawObj = DmDraw; // draw function pDm->hdr.MsgObj = DmTranslateMsg; // message function pDm->hdr.MsgDefaultObj = NULL; // default message function pDm->hdr.FreeObj = NULL; // free function // Set the color scheme to be used if(pScheme == NULL) pDm->hdr.pGolScheme = _pDefaultGolScheme; else pDm->hdr.pGolScheme = (GOL_SCHEME *)pScheme; pDm->textHeight = 0; if(pDm->Cvalue != 0) { // Set the text height pDm->textHeight = GetTextHeight(pDm->hdr.pGolScheme->pFont); } GOLAddObject((OBJ_HEADER *)pDm); return (pDm); }
// see class_text_mod.h void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { MODULE* module = (MODULE*) m_Parent; if( module == NULL ) // Happens in modedit, and for new texts return; wxString msg, Line; static const wxString text_type_msg[3] = { _( "Ref." ), _( "Value" ), _( "Text" ) }; Line = module->GetReference(); aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), Line, DARKCYAN ) ); Line = GetShownText(); aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) ); wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS ); aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) ); if( !IsVisible() ) msg = _( "No" ); else msg = _( "Yes" ); aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) ); // Display text layer aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) ); if( IsMirrored() ) msg = _( "Yes" ); else msg = _( "No" ); aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) ); msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) ); msg = ::CoordinateToString( GetThickness() ); aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) ); msg = ::CoordinateToString( GetTextWidth() ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) ); msg = ::CoordinateToString( GetTextHeight() ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) ); }
const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const { int x, y, dx, dy, length, height; x = GetTextPos().x; y = GetTextPos().y; dx = dy = 0; int width = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness(); height = ( (GetTextHeight() * 15) / 10 ) + width + 2 * TXT_MARGIN; // text X size add height for triangular shapes(bidirectional) length = LenSize( GetShownText(), width ) + height + DANGLING_SYMBOL_SIZE; switch( GetLabelSpinStyle() ) // respect orientation { default: case 0: // Horiz Normal Orientation (left justified) dx = -length; dy = height; x += DANGLING_SYMBOL_SIZE; y -= height / 2; break; case 1: // Vert Orientation UP dx = height; dy = -length; x -= height / 2; y += DANGLING_SYMBOL_SIZE; break; case 2: // Horiz Orientation - Right justified dx = length; dy = height; x -= DANGLING_SYMBOL_SIZE; y -= height / 2; break; case 3: // Vert Orientation BOTTOM dx = height; dy = length; x -= height / 2; y -= DANGLING_SYMBOL_SIZE; break; } EDA_RECT box( wxPoint( x, y ), wxSize( dx, dy ) ); box.Normalize(); return box; }
/***************************************************************************** * static BOOL MoveCursor( void ) *****************************************************************************/ static BOOL MoveCursor( void ) { static WORD rad; WORD OriginY = LB_ORIGIN_START_Y + 1 * GetTextHeight((void *)altScheme->pFont) + GetTextHeight((void *)altScheme->pFont)/2; WORD OriginX = LB_ORIGIN_START_X + 180; WORD x, y; BOOL IsRun = TRUE; if ( tick > 1000 ) { if ( rad <= 628 ) { x = OriginX - 64 + cos((double)rad/100) * 64; y = OriginY + sin((double)rad/100) * 64; rad += 20; GFX_DRIVER_MoveLayer( GFX_CURSOR_LAYER, x, y ); if ( rad <= 628 ) g_UPDATE_FLAGS = GFX_UPDATE_AS_IT_DRAWS | GFX_WAIT_IMAGE_UPDATED; } else { rad = 0; x = OriginX; y = OriginY; IsRun = FALSE; // stop running GFX_DRIVER_MoveLayer( GFX_CURSOR_LAYER, x, y ); } tick = 0; } return IsRun; }
void cFont::RenderFontAlpha(WORD wFontIdx, char * text, int size, RECT * pRect, DWORD color) { if(FALSE == IsCreateFont(wFontIdx)) { return; } pRect->right = pRect->left + GetTextExtent( wFontIdx, text, size ) + GetTextWidth( wFontIdx ) / 4; pRect->bottom = pRect->top + GetTextHeight( wFontIdx ) + 1; //+1안하면 밑줄이 안나온다. if(*text) { g_pExecutive->GetGeometry()->RenderFont(m_pFont[wFontIdx],text,size,pRect,color,CHAR_CODE_TYPE_ASCII,0,0); } }
Function: void ShowScreenGeneric( void ) Description: This function erases the currently displayed screen and replaces it with a screen of a generic format. The screen consists of: * the Microchip icon * a one line title * four buttons * one line of instructions The information for the screen contents is obtained from the global pageInformation structure. Precondition: None Parameters: None Returns: None Remarks: The global list of graphics objects is destroyed and replaced. Therefore, this function cannot be called during the message processing of GOLMsgCallback(). It must be called during GOLDrawCallback() processing. ***************************************************************************/ void ShowScreenGeneric( void ) { InitializeScreen(); BtnCreate( ID_TOP_LEFT, // ID 0,LOCATION_MIN_Y,62,30,2, // dimension and radius BTN_DRAW|BTN_PRESSED, // will be displayed after creation pageInformation.buttonBitmapTopLeft, // bitmap pageInformation.buttonTextTopLeft, // text NULL ); // Default scheme BtnCreate( ID_BOTTOM_LEFT, // ID 0,32,62,46,2, // dimension and radius BTN_DRAW, // will be displayed after creation pageInformation.buttonBitmapBottomLeft, // bitmap pageInformation.buttonTextBottomLeft, // text NULL ); // Default scheme BtnCreate( ID_TOP_RIGHT, // ID 64,LOCATION_MIN_Y,125,30,2, // dimension and radius BTN_DRAW, // will be displayed after creation pageInformation.buttonBitmapTopRight, // bitmap pageInformation.buttonTextTopRight, // text NULL ); // Default scheme BtnCreate( ID_BOTTOM_RIGHT, // ID 64,32,125,46,2, // dimension and radius BTN_DRAW, // will be displayed after creation pageInformation.buttonBitmapBottomRight, pageInformation.buttonTextBottomRight, NULL ); // Default scheme if(!strcmp(pageInformation.buttonTextThirdrow,"Cap Touch")) BtnCreate( ID_THIRDROW, 0,48,62,62,2, BTN_DRAW, pageInformation.buttonBitmapThirdrow, pageInformation.buttonTextThirdrow, NULL ); else StCreate( ID_INSTRUCTIONS, 0, 47, 127, 47+GetTextHeight( (void *)&FONTDEFAULT )-1, ST_DRAW, pageInformation.instructions, NULL ); }
void FenceGui::UpdateWidgetSize(WidgetNumber wid_num, BaseWidget *wid) { switch (wid_num) { case FENCE_GUI_LIST: wid->resize_y = GetTextHeight(); wid->min_y = 5 * wid->resize_y; for (uint8 i = (uint8)FENCE_TYPE_BUILDABLE_BEGIN; i < (uint8)FENCE_TYPE_COUNT; i++) { const Fence *fence = _sprite_manager.GetFence((FenceType)i); if (fence == nullptr) continue; int width = fence->sprites[FENCE_NE_FLAT]->width; if (width > wid->min_x) wid->min_x = width; } break; } }