Commit ca11fcb5 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Pcbnew: change general properties dialog rotation angle to text edit control.

parent 8fe06e12
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -477,3 +477,18 @@ bool ReplaceIllegalFileNameChars( std::string* aName )

    return changed;
}


wxString RemoveTrailingZeros( const wxString& aString )
{
    wxString retv = aString;
    int      i = retv.Length();

    while( --i > 0 && retv[i] == wxChar( '0' ) )
        retv.RemoveLast();

    if( retv[i] == wxChar( '.' ) )
        retv.RemoveLast();

    return retv;
}
+12 −0
Original line number Diff line number Diff line
@@ -164,6 +164,18 @@ wxString GetIllegalFileNameWxChars();
 */
bool ReplaceIllegalFileNameChars( std::string* aName );

/**
 * Function RemoveTrailingZeros
 * removes the trailing zeros from \a aString.
 *
 * All trailing zeros and the '.' character from floating point numbers are removed from
 * \a aString.
 *
 * @param aString is a wxString object to remove the trailing zeros from.
 * @return a wxString with the trailing zeros removed.
 */
wxString RemoveTrailingZeros( const wxString& aString );

#ifndef HAVE_STRTOKR
// common/strtok_r.c optionally:
extern "C" char* strtok_r( char* str, const char* delim, char** nextp );
+5 −11
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <pcbcommon.h>

#include <kicad_string.h>
#include <pcbnew_id.h>
#include <class_board.h>

@@ -69,15 +69,9 @@ void DIALOG_GENERALOPTIONS::init()
    m_CursorShape->SetSelection( GetParent()->GetCursorShape() ? 1 : 0 );


    switch( GetParent()->GetRotationAngle() )
    {
    case 450:
        m_RotationAngle->SetSelection( 0 );
        break;

    default:
        m_RotationAngle->SetSelection( 1 );
    }
    wxString rotationAngle;
    rotationAngle.Printf( wxT( "%.1f" ), ((double)GetParent()->GetRotationAngle()) / 10.0 );
    m_RotationAngle->SetValue( RemoveTrailingZeros( rotationAngle ) );

    wxString timevalue;
    timevalue << GetParent()->GetAutoSaveInterval() / 60;
@@ -121,7 +115,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )

    GetParent()->SetCursorShape( m_CursorShape->GetSelection() );
    GetParent()->SetAutoSaveInterval( m_SaveTime->GetValue() * 60 );
    GetParent()->SetRotationAngle( 10 * wxAtoi( m_RotationAngle->GetStringSelection() ) );
    GetParent()->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );

    /* Updating the combobox to display the active layer. */
    g_MaxLinksShowed = m_MaxShowLinks->GetValue();
+3 −6
Original line number Diff line number Diff line
@@ -79,13 +79,10 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE(
	m_staticTextRotationAngle->Wrap( -1 );
	fgSizer1->Add( m_staticTextRotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	wxString m_RotationAngleChoices[] = { _("45"), _("90") };
	int m_RotationAngleNChoices = sizeof( m_RotationAngleChoices ) / sizeof( wxString );
	m_RotationAngle = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_RotationAngleNChoices, m_RotationAngleChoices, 0 );
	m_RotationAngle->SetSelection( 0 );
	m_RotationAngle->SetToolTip( _("Footprints rotation increment, for rotate menu or hot key.") );
	m_RotationAngle = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_RotationAngle->SetToolTip( _("Context menu and hot key footprint rotation increment.") );
	
	fgSizer1->Add( m_RotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	fgSizer1->Add( m_RotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
	
	
	bMiddleLeftSizer->Add( fgSizer1, 0, wxEXPAND, 5 );
+9 −6
Original line number Diff line number Diff line
@@ -831,9 +831,9 @@
                                        </object>
                                        <object class="sizeritem" expanded="1">
                                            <property name="border">5</property>
                                            <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
                                            <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
                                            <property name="proportion">0</property>
                                            <object class="wxChoice" expanded="1">
                                            <object class="wxTextCtrl" expanded="1">
                                                <property name="BottomDockable">1</property>
                                                <property name="LeftDockable">1</property>
                                                <property name="RightDockable">1</property>
@@ -847,7 +847,6 @@
                                                <property name="caption"></property>
                                                <property name="caption_visible">1</property>
                                                <property name="center_pane">0</property>
                                                <property name="choices">&quot;45&quot; &quot;90&quot;</property>
                                                <property name="close_button">1</property>
                                                <property name="context_help"></property>
                                                <property name="context_menu">1</property>
@@ -865,6 +864,7 @@
                                                <property name="max_size"></property>
                                                <property name="maximize_button">0</property>
                                                <property name="maximum_size"></property>
                                                <property name="maxlength"></property>
                                                <property name="min_size"></property>
                                                <property name="minimize_button">0</property>
                                                <property name="minimum_size"></property>
@@ -877,22 +877,21 @@
                                                <property name="pin_button">1</property>
                                                <property name="pos"></property>
                                                <property name="resize">Resizable</property>
                                                <property name="selection">0</property>
                                                <property name="show">1</property>
                                                <property name="size"></property>
                                                <property name="style"></property>
                                                <property name="subclass"></property>
                                                <property name="toolbar_pane">0</property>
                                                <property name="tooltip">Footprints rotation increment, for rotate menu or hot key.</property>
                                                <property name="tooltip">Context menu and hot key footprint rotation increment.</property>
                                                <property name="validator_data_type"></property>
                                                <property name="validator_style">wxFILTER_NONE</property>
                                                <property name="validator_type">wxDefaultValidator</property>
                                                <property name="validator_variable"></property>
                                                <property name="value"></property>
                                                <property name="window_extra_style"></property>
                                                <property name="window_name"></property>
                                                <property name="window_style"></property>
                                                <event name="OnChar"></event>
                                                <event name="OnChoice"></event>
                                                <event name="OnEnterWindow"></event>
                                                <event name="OnEraseBackground"></event>
                                                <event name="OnKeyDown"></event>
@@ -914,6 +913,10 @@
                                                <event name="OnRightUp"></event>
                                                <event name="OnSetFocus"></event>
                                                <event name="OnSize"></event>
                                                <event name="OnText"></event>
                                                <event name="OnTextEnter"></event>
                                                <event name="OnTextMaxLen"></event>
                                                <event name="OnTextURL"></event>
                                                <event name="OnUpdateUI"></event>
                                            </object>
                                        </object>
Loading