Commit b4d1813d authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema: Remove usage of tabs in dialog_choose_component.cpp strings, because...

Eeschema: Remove usage of tabs in dialog_choose_component.cpp strings, because they do not work very well on Linux, and do not work on Windows.
Fix incorrect rotation of components (CCW instaed of CW)
parent d475c544
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -141,8 +141,6 @@ void COMPONENT_TREE_SEARCH_CONTAINER::AddAliasList( const wxString& aNodeName,
                                                    const wxArrayString& aAliasNameList,
                                                    CMP_LIBRARY* aOptionalLib )
{
    static const wxChar unitLetter[] = wxT( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" );

    TREE_NODE* const lib_node = new TREE_NODE( TREE_NODE::TYPE_LIB,  NULL, NULL,
                                               aNodeName, wxEmptyString, wxEmptyString );
    nodes.push_back( lib_node );
@@ -168,8 +166,16 @@ void COMPONENT_TREE_SEARCH_CONTAINER::AddAliasList( const wxString& aNodeName,
        if( !a->GetDescription().empty() )
        {
            // Preformatting. Unfortunately, the tree widget doesn't have columns
            display_info.Printf( wxT(" %s[ %s ]"),
                                 ( a->GetName().length() <= 8 ) ? wxT("\t\t") : wxT("\t"),
            // and using tabs does not work very well or does not work at all
            // (depending on OS versions).
            #define COLUMN_DESCR_POS 24
            int len = a->GetName().length();
            display_info.Clear();

            if( len <= COLUMN_DESCR_POS )
                display_info.Append( ' ', COLUMN_DESCR_POS - len );

            display_info += wxString::Format( wxT( " [ %s ]" ),
                                 GetChars( a->GetDescription() ) );
        }

@@ -178,17 +184,22 @@ void COMPONENT_TREE_SEARCH_CONTAINER::AddAliasList( const wxString& aNodeName,
        nodes.push_back( alias_node );

        if( a->GetComponent()->IsMulti() )    // Add all units as sub-nodes.
            for ( int u = 0; u < a->GetComponent()->GetPartCount(); ++u )
        {
                const wxString unitName = unitLetter[u];
                TREE_NODE* unit_node = new TREE_NODE(TREE_NODE::TYPE_UNIT, alias_node, a,
                                                     _("Unit ") + unitName,
            wxString unitName;

            for( int u = 1; u <= a->GetComponent()->GetPartCount(); ++u )
            {
                unitName = LIB_COMPONENT::ReturnSubReference( u, false );
                TREE_NODE* unit_node = new TREE_NODE( TREE_NODE::TYPE_UNIT,
                                                      alias_node, a,
                                                      _("Unit") + wxT( " " ) + unitName,
                                                      wxEmptyString, wxEmptyString );
                unit_node->Unit = u + 1;
                unit_node->Unit = u;
                nodes.push_back( unit_node );
            }
        }
    }
}


LIB_ALIAS* COMPONENT_TREE_SEARCH_CONTAINER::GetSelectedAlias( int* aUnit )
+7 −0
Original line number Diff line number Diff line
@@ -47,6 +47,13 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( wxWindow* aParent, const wxStr
    m_search_container->SetTree( m_libraryComponentTree );
    m_searchBox->SetFocus();
    m_componentDetails->SetEditable( false );

    // The tree showing libs and component uses a fixed font,
    // because we want controle the position of some info when drawing the
    // tree. Using tabs does not work very well (does not work on Windows)
    wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
    m_libraryComponentTree->SetFont( wxFont( font.GetPointSize(),
             wxFONTFAMILY_MODERN,  wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
}


+2 −2
Original line number Diff line number Diff line
@@ -399,8 +399,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
    // Library
    AddMenuItem( preferencesMenu,
                 ID_CONFIG_REQ,
                 _( "Set &Library Path" ),
                 _( "Set library preferences" ),
                 _( "Set Active &Libraries" ),
                 _( "Set active library list and library paths" ),
                 KiBitmap( library_xpm ) );

    // Colors
+3 −4
Original line number Diff line number Diff line
@@ -764,14 +764,14 @@ void SCH_COMPONENT::SetOrientation( int aOrientation )
        m_transform.x2 = m_transform.y1 = 0;
        break;

    case CMP_ROTATE_CLOCKWISE:            // Rotate + (incremental rotation)
    case CMP_ROTATE_COUNTERCLOCKWISE:  // Rotate + (incremental rotation)
        temp.x1   = temp.y2 = 0;
        temp.y1   = 1;
        temp.x2   = -1;
        transform = true;
        break;

    case CMP_ROTATE_COUNTERCLOCKWISE:    // Rotate - (incremental rotation)
    case CMP_ROTATE_CLOCKWISE:          // Rotate - (incremental rotation)
        temp.x1   = temp.y2 = 0;
        temp.y1   = -1;
        temp.x2   = 1;
@@ -1534,8 +1534,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition )

    RotatePoint( &m_Pos, aPosition, 900 );

    //SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
    SetOrientation( CMP_ROTATE_CLOCKWISE );
    SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );

    for( int ii = 0; ii < GetFieldCount(); ii++ )
    {