Commit 8f6d69e5 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Pcbnew: fix 45 degree rotation angle undo and global variable elimination.

parents 2d9385b4 efd99637
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -55,9 +55,6 @@ LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {


DISPLAY_OPTIONS DisplayOpt;      // Display options for board items
DISPLAY_OPTIONS DisplayOpt;      // Display options for board items


// This will be always be 450 or 900 (by UI design) at the moment
int    g_RotationAngle;

int    g_AnchorColor        = BLUE;
int    g_AnchorColor        = BLUE;
int    g_ModuleTextCMPColor = LIGHTGRAY;
int    g_ModuleTextCMPColor = LIGHTGRAY;
int    g_ModuleTextCUColor  = MAGENTA;
int    g_ModuleTextCUColor  = MAGENTA;
+0 −2
Original line number Original line Diff line number Diff line
@@ -25,8 +25,6 @@ extern DISPLAY_OPTIONS DisplayOpt;


extern int g_CurrentVersionPCB;
extern int g_CurrentVersionPCB;


extern int g_RotationAngle;

/// List of segments of the trace currently being drawn.
/// List of segments of the trace currently being drawn.
extern DLIST<TRACK> g_CurrentTrackList;
extern DLIST<TRACK> g_CurrentTrackList;


+6 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,9 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
    /// The global footprint library table.
    /// The global footprint library table.
    FP_LIB_TABLE* m_globalFootprintTable;
    FP_LIB_TABLE* m_globalFootprintTable;


    /// User defined rotation angle (in tenths of a degree).
    int             m_rotationAngle;

    /**
    /**
     * Function loadFootprints
     * Function loadFootprints
     * loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
     * loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
@@ -330,6 +333,9 @@ public:
     */
     */
    virtual void SetGridColor(EDA_COLOR_T aColor);
    virtual void SetGridColor(EDA_COLOR_T aColor);


    int GetRotationAngle() const { return m_rotationAngle; }
    void SetRotationAngle( int aRotationAngle );

    // Configurations:
    // Configurations:
    void InstallConfigFrame();
    void InstallConfigFrame();
    void Process_Config( wxCommandEvent& event );
    void Process_Config( wxCommandEvent& event );
+4 −2
Original line number Original line Diff line number Diff line
@@ -504,11 +504,13 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
            break;
            break;


        case UR_ROTATED:
        case UR_ROTATED:
            item->Rotate( aList->m_TransformPoint, aRedoCommand ? 900 : -900 );
            item->Rotate( aList->m_TransformPoint,
                          aRedoCommand ? m_rotationAngle : -m_rotationAngle );
            break;
            break;


        case UR_ROTATED_CLOCKWISE:
        case UR_ROTATED_CLOCKWISE:
            item->Rotate( aList->m_TransformPoint, aRedoCommand ? -900 : 900 );
            item->Rotate( aList->m_TransformPoint,
                          aRedoCommand ? -m_rotationAngle : m_rotationAngle );
            break;
            break;


        case UR_FLIPPED:
        case UR_FLIPPED:
+2 −3
Original line number Original line Diff line number Diff line
@@ -69,7 +69,7 @@ void DIALOG_GENERALOPTIONS::init()
    m_CursorShape->SetSelection( GetParent()->GetCursorShape() ? 1 : 0 );
    m_CursorShape->SetSelection( GetParent()->GetCursorShape() ? 1 : 0 );




    switch( g_RotationAngle )
    switch( GetParent()->GetRotationAngle() )
    {
    {
    case 450:
    case 450:
        m_RotationAngle->SetSelection( 0 );
        m_RotationAngle->SetSelection( 0 );
@@ -121,8 +121,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )


    GetParent()->SetCursorShape( m_CursorShape->GetSelection() );
    GetParent()->SetCursorShape( m_CursorShape->GetSelection() );
    GetParent()->SetAutoSaveInterval( m_SaveTime->GetValue() * 60 );
    GetParent()->SetAutoSaveInterval( m_SaveTime->GetValue() * 60 );

    GetParent()->SetRotationAngle( 10 * wxAtoi( m_RotationAngle->GetStringSelection() ) );
    g_RotationAngle = 10 * wxAtoi( m_RotationAngle->GetStringSelection() );


    /* Updating the combobox to display the active layer. */
    /* Updating the combobox to display the active layer. */
    g_MaxLinksShowed = m_MaxShowLinks->GetValue();
    g_MaxLinksShowed = m_MaxShowLinks->GetValue();
Loading