Changed some 'magic numbers' into constants. Added const modifier in appropriate spots.

This commit is contained in:
Maciej Suminski 2013-09-11 11:34:10 +02:00
parent cd56848326
commit c5d3376c26
8 changed files with 14 additions and 9 deletions

View File

@ -29,7 +29,6 @@
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <gal/definitions.h> #include <gal/definitions.h>
using namespace KiGfx; using namespace KiGfx;
GAL::GAL() : GAL::GAL() :
@ -41,7 +40,7 @@ GAL::GAL() :
SetFillColor( COLOR4D( 0.0, 0.0, 0.0, 0.0 ) ); SetFillColor( COLOR4D( 0.0, 0.0, 0.0, 0.0 ) );
SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) ); SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
SetZoomFactor( 1.0 ); SetZoomFactor( 1.0 );
SetDepthRange( VECTOR2D( -2048, 2047 ) ); SetDepthRange( VECTOR2D( GAL::MIN_DEPTH, GAL::MAX_DEPTH ) );
SetFlip( false, false ); SetFlip( false, false );
SetLineWidth( 1.0 ); SetLineWidth( 1.0 );
@ -114,7 +113,7 @@ void GAL::DrawGrid()
// Draw the origin marker // Draw the origin marker
double origSize = static_cast<double>( gridOriginMarkerSize ) / worldScale; double origSize = static_cast<double>( gridOriginMarkerSize ) / worldScale;
SetLayerDepth( 0.0 ); SetLayerDepth( GAL::GRID_DEPTH );
SetIsFill( false ); SetIsFill( false );
SetIsStroke( true ); SetIsStroke( true );
SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) ); SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );

View File

@ -101,7 +101,7 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
} }
wxString EDA_DRAW_FRAME::GetScreenDesc() wxString EDA_DRAW_FRAME::GetScreenDesc() const
{ {
// Virtual function. In basic class, returns // Virtual function. In basic class, returns
// an empty string. // an empty string.

View File

@ -324,7 +324,7 @@ SCH_SCREEN* SCH_EDIT_FRAME::GetScreen() const
} }
wxString SCH_EDIT_FRAME::GetScreenDesc() wxString SCH_EDIT_FRAME::GetScreenDesc() const
{ {
wxString s = m_CurrentSheet->PathHumanReadable(); wxString s = m_CurrentSheet->PathHumanReadable();

View File

@ -818,6 +818,9 @@ public:
depthStack.pop(); depthStack.pop();
} }
/// Depth level on which the grid is drawn
static const int GRID_DEPTH = 1024;
protected: protected:
std::stack<double> depthStack; ///< Stored depth values std::stack<double> depthStack; ///< Stored depth values
VECTOR2D screenSize; ///< Screen size in screen coordinates VECTOR2D screenSize; ///< Screen size in screen coordinates
@ -884,6 +887,9 @@ protected:
* @param aCursorSize is the size of the cursor. * @param aCursorSize is the size of the cursor.
*/ */
virtual void initCursor( int aCursorSize ) = 0; virtual void initCursor( int aCursorSize ) = 0;
static const int MIN_DEPTH = -2048;
static const int MAX_DEPTH = 2047;
}; };
} // namespace KiGfx } // namespace KiGfx

View File

@ -195,7 +195,7 @@ public:
* Returns pointer to current settings that are going to be used when drawing items. * Returns pointer to current settings that are going to be used when drawing items.
* @return Current rendering settings. * @return Current rendering settings.
*/ */
virtual RENDER_SETTINGS* GetSettings() virtual RENDER_SETTINGS* GetSettings() const
{ {
return m_settings; return m_settings;
} }

View File

@ -356,7 +356,7 @@ public:
*/ */
void OnModify(); void OnModify();
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc() const;
void InstallConfigFrame( wxCommandEvent& event ); void InstallConfigFrame( wxCommandEvent& event );

View File

@ -499,7 +499,7 @@ public:
EDA_DRAW_PANEL* GetCanvas() { return m_canvas; } EDA_DRAW_PANEL* GetCanvas() { return m_canvas; }
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc() const;
/** /**
* Function GetScreen * Function GetScreen