Commit b49c2d2b authored by charras's avatar charras
Browse files

code cleanup, remove multiline text option in eeschema (multiline text is a...

code cleanup, remove multiline text option in eeschema (multiline text is a work in progress) and minor enhancements
parent f28062ac
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)

# Russian GOST and CYRILLIC patch
option(KICAD_CYRILLIC "enable/disable building unicode (default OFF)")
option(KICAD_CYRILLIC "enable/disable building using cyrillic (needs unicode) (default OFF)")
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")

# Comment this out if you don't want to build with Python support.
# OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)")
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"


#define BUILD_VERSION wxT("(20090421-unstable)")
#define BUILD_VERSION wxT("(20090504-unstable)")

wxString g_BuildVersion

+34 −20
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text )
    m_VJustify  = GR_TEXT_VJUSTIFY_CENTER;          /* Justifications Horiz et Vert du texte */
    m_Width     = 0;                                /* thickness */
    m_Italic    = false;                            /* true = italic shape */
    m_MultilineAllowed = false;                     // Set to true only for texts that can use multiline.
    m_Text = text;
}

@@ -245,9 +246,9 @@ bool EDA_TextStruct::HitTest( EDA_Rect& refArea )
}


/*******************************/
/*********************************************/
int EDA_TextStruct::Pitch( int aMinTickness )
/*******************************/
/*********************************************/

/**
 * Function Pitch
@@ -277,6 +278,9 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
 *  @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
 */

{

    if ( m_MultilineAllowed )
    {
        wxPoint        pos  = m_Pos;
        wxArrayString* list = wxStringSplit( m_Text, '\n' );
@@ -287,7 +291,6 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
        RotatePoint( &offset, m_Orient );
        if( m_Mirror )
            offset.x = -offset.x;

        for( unsigned i = 0; i<list->Count(); i++ )
        {
            wxString txt  = list->Item( i );
@@ -306,6 +309,18 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
        delete (list);
    }

    else
        DrawOneLineOfText( aPanel,
                                     aDC,
                                     aOffset,
                                     aColor,
                                     aDrawMode,
                                     aDisplayMode,
                                     aAnchor_color,
                                     m_Text,
                                     m_Pos );
}


/** Function DrawOneLineOfText
 * Draw a single text line.
@@ -358,11 +373,10 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
    if( m_Mirror )
        size.x = -size.x;


    DrawGraphicText( aPanel, aDC,
                     aOffset + aPos, aColor, aText,
                     m_Orient, size,
                     m_HJustify, m_VJustify, width, m_Italic );
                     m_HJustify, m_VJustify, width, m_Italic, true );
}


+30 −51
Original line number Diff line number Diff line
@@ -189,51 +189,30 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
    dx = (pitch * char_count) / 2;
    dy = size_v / 2;                            /* dx, dy = draw offset between first letter and text center */

    ux0 = uy0 = 0;                              /* Decalage du centre du texte / coord de ref */
    ux0 = uy0 = 0;                              /* for ux0 = uy0 = 0, the text is centered */

    if( (aOrient == 0) || (aOrient == 1800) )   /* Horizontal Text */
    {
        switch( aH_justify )
        {
        case GR_TEXT_HJUSTIFY_CENTER:
            break;
    wxPoint offset_org( dx, dy );
    int     irot = aOrient;
    while( irot >= 1800 )
        irot -= 1800;

        case GR_TEXT_HJUSTIFY_RIGHT:
            ux0 = -dx;
            break;
    while( irot < 0 )
        irot += 1800;

        case GR_TEXT_HJUSTIFY_LEFT:
            ux0 = dx;
            break;
        }
    if( irot != 0 )
        EXCHG( offset_org.x, offset_org.y );

        switch( aV_justify )
        {
        case GR_TEXT_VJUSTIFY_CENTER:
            break;

        case GR_TEXT_VJUSTIFY_TOP:
            uy0 = dy;
            break;

        case GR_TEXT_VJUSTIFY_BOTTOM:
            uy0 = -dy;
            break;
        }
    }
    else    /* Vertical Text */
    {
    switch( aH_justify )
    {
    case GR_TEXT_HJUSTIFY_CENTER:
        break;

    case GR_TEXT_HJUSTIFY_RIGHT:
            ux0 = -dy;
        ux0 = -offset_org.x;
        break;

    case GR_TEXT_HJUSTIFY_LEFT:
            ux0 = dy;
        ux0 = offset_org.x;
        break;
    }

@@ -243,14 +222,14 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
        break;

    case GR_TEXT_VJUSTIFY_TOP:
            uy0 = dx;
        uy0 = offset_org.y;
        break;

    case GR_TEXT_VJUSTIFY_BOTTOM:
            uy0 = -dx;
        uy0 = -offset_org.y;
        break;
    }
    }


    cX += ux0;
    cY += uy0;
+0 −8
Original line number Diff line number Diff line
@@ -440,14 +440,6 @@ bool WinEDA_App::SetBinDir()
    while( m_BinDir.Last() != '/' && !m_BinDir.IsEmpty() )
        m_BinDir.RemoveLast();

    wxFileName pfn( wxT( "/posix/path/specification" ), wxT( "filename" ) );
    wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) );
    wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() );
    wxLogDebug( wxT( "Windows path: " ) + wfn.GetFullPath() );
    wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir );
    wxLogDebug( wxT( "Executable path the wxWidgets way: " ) +
               GetTraits()->GetStandardPaths().GetExecutablePath() );

    return TRUE;
}

Loading