// Sets the text label on this checkbox
//--------------------------------------------------------------------------------
void CPUTCheckbox::SetText(const cString String)
{
    // create the static text object if it doesn't exist
    if(NULL == mpCheckboxText)
    {
        mpCheckboxText = new CPUTText(mpFont);
    }

    // set the static control's text
    mpCheckboxText->SetText(String);

    // move the text to the right spot
    int x,y;
    GetTextPosition(x,y);
    mpCheckboxText->SetPosition(x, y);

    // position or size may move - force a recalculation of this control's location
    // if it is managed by the auto-arrange function
    if(this->IsAutoArranged())
    {
         mControlNeedsArrangmentResizing = true;
    }
    else
    {
        // control graphics have been updated
        mControlGraphicsDirty = true;
    }
}
Ejemplo n.º 2
0
// Sets the text label on this checkbox
//--------------------------------------------------------------------------------
void CPUTCheckbox::SetText(const cString String)
{
    // create the static text object if it doesn't exist
    if(NULL == mpCheckboxText)
    {
        mpCheckboxText = new CPUTText(mpFont);
    }

    // set the static control's text
    mpCheckboxText->SetText(String);

    // move the text to the right spot
    int x,y;
    GetTextPosition(x,y);
    mpCheckboxText->SetPosition(x, y);

    // position or size may move - force a recalculation of this control's location
    // if it is managed by the auto-arrange function
    if(this->IsAutoArranged())
    {
        CPUTGuiControllerDX11::GetController()->Resize();
    }
    else
    {
        CPUTGuiControllerDX11::GetController()->ControlIsDirty();
    }
}
Ejemplo n.º 3
0
//CPUTControl
// set the upper-left position of the checkbox control (screen space coords)
//-----------------------------------------------------------------------------
void CPUTCheckbox::SetPosition(int x, int y)
{
    // set the new position
    mControlDimensions.x = x;
    mControlDimensions.y = y;

    // recalculate the vertex buffer with new x/y coords
    Recalculate();

    // move the static text along with the bitmap graphic
    int textX, textY;
    GetTextPosition(textX, textY);
    mpCheckboxText->SetPosition(textX, textY);
}
Ejemplo n.º 4
0
/* Draws a line from the TEXTE_MODULE origin to parent MODULE origin.
*/
void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,
                                  wxDC*           aDC,
                                  GR_DRAWMODE     aDrawMode,
                                  const wxPoint&  aOffset )
{
    MODULE* parent = (MODULE*) GetParent();

    if( !parent )
        return;

    GRSetDrawMode( aDC, GR_XOR );
    GRLine( aPanel->GetClipBox(), aDC,
            parent->GetPosition(), GetTextPosition() + aOffset,
            0, UMBILICAL_COLOR);
}
Ejemplo n.º 5
0
void CAbstractTextEdit::OnButtonClick(int X, int Y, int Button, int Count)
{
	if(Button != KEY_MOUSE_1)
		return;
	
	if(m_DrawRect.IsInside(X, Y))
	{
		if(!m_Focus)
			OnFocusIn();
		
		m_TextCursor = TextRenderer()->GetTextCursorFromPosition(&m_TextCache, GetTextPosition(), ivec2(X, Y));
	}
	else if(m_Focus)
		OnFocusOut();
}
Ejemplo n.º 6
0
// Calculate the bounding rectangle for the control
// For the checkbox it includes the checkbox image and the text
//-----------------------------------------------------------------------------
void CPUTCheckbox::CalculateBounds()
{
    int textX, textY;
    int textWidth, textHeight;

    // get the text
    GetTextPosition(textX, textY);
    mpCheckboxText->GetDimensions(textWidth, textHeight);

    mControlDimensions.width = (textX - mControlDimensions.x ) + textWidth;
    mControlDimensions.height = textHeight;

    if(mpCheckboxTextureSizeList[0].height > textHeight)
    {
        mControlDimensions.height = mpCheckboxTextureSizeList[0].height;
    }
}
void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
                            SHAPE_POLY_SET& aCornerBuffer,
                            int                    aClearanceValue,
                            int                    aCircleToSegmentsCount,
                            double                 aCorrectionFactor ) const
{
    wxSize size = GetSize();

    if( IsMirrored() )
        size.x = -size.x;

    s_cornerBuffer = &aCornerBuffer;
    s_textWidth  = GetThickness() + ( 2 * aClearanceValue );
    s_textCircle2SegmentCount = aCircleToSegmentsCount;
    EDA_COLOR_T color = BLACK;  // not actually used, but needed by DrawGraphicText

    if( IsMultilineAllowed() )
    {
        wxArrayString strings_list;
        wxStringSplit( GetShownText(), strings_list, '\n' );
        std::vector<wxPoint> positions;
        positions.reserve( strings_list.Count() );
        GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );

        for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
        {
            wxString txt = strings_list.Item( ii );
            DrawGraphicText( NULL, NULL, positions[ii], color,
                             txt, GetOrientation(), size,
                             GetHorizJustify(), GetVertJustify(),
                             GetThickness(), IsItalic(),
                             true, addTextSegmToPoly );
        }
    }
    else
    {
        DrawGraphicText( NULL, NULL, GetTextPosition(), color,
                         GetShownText(), GetOrientation(), size,
                         GetHorizJustify(), GetVertJustify(),
                         GetThickness(), IsItalic(),
                         true, addTextSegmToPoly );
    }
}
Ejemplo n.º 8
0
void CAbstractTextEdit::OnInputEvent()
{
	m_Composing = false;
	if(m_Focus)
	{
		const char* m_pEditedText = Input()->GetEditedText();
		if(m_pEditedText && str_length(m_pEditedText))
		{
			m_ComposingTextCache.SetText(m_pEditedText);
			m_Composing = true;
		}
		
		if(Input()->KeyIsPressed(KEY_RETURN) || Input()->KeyIsPressed(KEY_KP_ENTER))
		{
			if(m_Changes)
			{
				SaveFromTextBuffer();
				m_Changes = false;
			}
		}
		else if(m_TextCursor.m_TextIter >= 0)
		{
			int TextIter = m_TextCursor.m_TextIter;
			bool Changes = false;
			for(int i = 0; i < Input()->NumEvents(); i++)
			{
				int Len = str_length(m_aText);
				int NumChars = Len;
				if(CLineInput::Manipulate(Input()->GetEvent(i), m_aText, sizeof(m_aText), sizeof(m_aText), &Len, &TextIter, &NumChars))
					Changes = true;
			}
			
			if(Changes)
			{
				OnTextUpdated();
				m_TextCursor = TextRenderer()->GetTextCursorFromTextIter(&m_TextCache, GetTextPosition(), TextIter);
				m_Changes = true;
			}
		}
	}
}
Ejemplo n.º 9
0
void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuffer ) const
{
    wxSize size = GetSize();

    if( IsMirrored() )
        NEGATE( size.x );

    s_cornerBuffer = &aCornerBuffer;
    EDA_COLOR_T color = BLACK;  // not actually used, but needed by DrawGraphicText

    if( IsMultilineAllowed() )
    {
        wxArrayString* list = wxStringSplit( GetText(), '\n' );
        std::vector<wxPoint> positions;
        positions.reserve( list->Count() );
        GetPositionsOfLinesOfMultilineText( positions, list->Count() );

        for( unsigned ii = 0; ii < list->Count(); ii++ )
        {
            wxString txt = list->Item( ii );
            DrawGraphicText( NULL, NULL, positions[ii], color,
                             txt, GetOrientation(), size,
                             GetHorizJustify(), GetVertJustify(),
                             GetThickness(), IsItalic(),
                             true, addTextSegmToBuffer );
        }

        delete list;
    }
    else
    {
        DrawGraphicText( NULL, NULL, GetTextPosition(), color,
                         GetText(), GetOrientation(), size,
                         GetHorizJustify(), GetVertJustify(),
                         GetThickness(), IsItalic(),
                         true, addTextSegmToBuffer );
    }
}