Commit 75777f4a authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Pcbnew: rotate footprint hot key fixes (fixes lp:1066182).

* Change general properties dialog to allow for entry of arbitrary rotation
  angles for greater than 0 to 90.
* Move global rotation angle variable into PCB_EDIT_FRAME object where it is
  used and add accessors.
* Change rotate footprint undo operation from UR_ROTATE_XXXX to UR_CHANGE.
* Create function to remove trailing zeros from floating point wxString
  objects.
parents bb8741c7 ca11fcb5
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@ LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {

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_ModuleTextCMPColor = LIGHTGRAY;
int    g_ModuleTextCUColor  = MAGENTA;
+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 );
+0 −2
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ extern DISPLAY_OPTIONS DisplayOpt;

extern int g_CurrentVersionPCB;

extern int g_RotationAngle;

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

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

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

    /**
     * Function loadFootprints
     * 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);

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

    // Configurations:
    void InstallConfigFrame();
    void Process_Config( wxCommandEvent& event );
Loading