diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 97399deb45..c9a2c8cade 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -35,17 +35,13 @@ #include #include - -#define CURSOR_SIZE 12 /// size of the cross cursor. - - BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType ) { m_UndoRedoCountMax = 10; // undo/Redo command Max depth, 10 is a reasonable value m_FirstRedraw = true; m_ScreenNumber = 1; - m_NumberOfScreen = 1; // Hierarchy: Root: ScreenNumber = 1 + m_NumberOfScreens = 1; // Hierarchy: Root: ScreenNumber = 1 m_Zoom = 32.0; m_Grid.m_Size = wxRealPoint( 50, 50 ); // Default grid size m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50; @@ -289,31 +285,8 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex ) } -GRID_TYPE BASE_SCREEN::GetGrid() -{ - return m_Grid; -} - - -const wxPoint& BASE_SCREEN::GetGridOrigin() -{ - return m_GridOrigin; -} - - -wxRealPoint BASE_SCREEN::GetGridSize() -{ - return m_Grid.m_Size; -} - - -int BASE_SCREEN::GetGridId() -{ - return m_Grid.m_Id; -} - - -wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize ) +wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, + wxRealPoint* aGridSize ) const { wxPoint pt; wxRealPoint gridSize; @@ -337,7 +310,7 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoi } -wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) +wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const { if( aOnGrid ) return GetNearestGridPosition( m_crossHairPosition, aGridSize ); diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index 250cf4a61b..aa8be550de 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -299,7 +299,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) case WS_IDENTSHEET: if( WsItem->m_Legende ) msg = WsItem->m_Legende; - if( screen->m_NumberOfScreen > 1 ) + if( screen->m_NumberOfScreens > 1 ) msg << screen->m_ScreenNumber; plotter->Text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size, @@ -310,7 +310,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) case WS_SHEETS: if( WsItem->m_Legende ) msg = WsItem->m_Legende; - msg << screen->m_NumberOfScreen; + msg << screen->m_NumberOfScreens; plotter->Text( pos, color, msg, TEXT_ORIENT_HORIZ, text_size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, @@ -497,7 +497,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) case WS_IDENTSHEET: msg << screen->m_ScreenNumber << wxT( "/" ) << - screen->m_NumberOfScreen; + screen->m_NumberOfScreens; break; case WS_FILENAME: diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index c8c32d5523..1fdd63845c 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -132,7 +132,7 @@ void DIALOG_PAGES_SETTINGS::initDialog() #ifdef EESCHEMA // Init display value for sheet User size wxString format = m_TextSheetCount->GetLabel(); - msg.Printf( format, m_Screen->m_NumberOfScreen ); + msg.Printf( format, m_Screen->m_NumberOfScreens ); m_TextSheetCount->SetLabel( msg ); format = m_TextSheetNumber->GetLabel(); @@ -644,7 +644,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() GRResetPenAndBrush( ( wxDC* ) &memDC ); m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom, - emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreen, + emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreens, m_Screen->m_ScreenNumber, 1, appScale, LIGHTGRAY, RED ); memDC.SelectObject( wxNullBitmap ); diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp index 0d36fad4e5..85a8ed3cf4 100644 --- a/common/drawpanel.cpp +++ b/common/drawpanel.cpp @@ -39,7 +39,7 @@ #include -#define CURSOR_SIZE 12 // Cursor size in pixels +static const int CURSOR_SIZE = 12; ///< Cursor size in pixels #define CLIP_BOX_PADDING 2 diff --git a/common/worksheet.cpp b/common/worksheet.cpp index 5a6ff6f28d..6d44ef801c 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -1026,7 +1026,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineW wxString paper = pageInfo.GetType(); wxString file = aScreen->GetFileName(); TITLE_BLOCK t_block = GetTitleBlock(); - int number_of_screens = aScreen->m_NumberOfScreen; + int number_of_screens = aScreen->m_NumberOfScreens; int screen_to_draw = aScreen->m_ScreenNumber; TraceWorkSheet( aDC, pageSize, margin_left_top, margin_right_bottom, @@ -1657,7 +1657,7 @@ wxString EDA_DRAW_FRAME::GetScreenDesc() wxString msg; msg << GetScreen()->m_ScreenNumber << wxT( "/" ) - << GetScreen()->m_NumberOfScreen; + << GetScreen()->m_NumberOfScreens; return msg; } diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index adb0857483..8a0305e94b 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -347,7 +347,7 @@ line %d,\nAbort reading file.\n" ), if( strnicmp( line, "Sheet", 2 ) == 0 ) sscanf( line + 5, " %d %d", - &aScreen->m_ScreenNumber, &aScreen->m_NumberOfScreen ); + &aScreen->m_ScreenNumber, &aScreen->m_NumberOfScreens ); if( strnicmp( line, "Title", 2 ) == 0 ) { diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 299b975e0c..70687437d7 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -146,8 +146,8 @@ void SCH_SCREEN::Clear() { FreeDrawList(); - /* Clear the project settings. */ - m_ScreenNumber = m_NumberOfScreen = 1; + // Clear the project settings + m_ScreenNumber = m_NumberOfScreens = 1; m_titles.Clear(); m_titles.SetDate(); @@ -507,7 +507,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const " portrait" : "" ) < 0 || fprintf( aFile, "encoding utf-8\n") < 0 - || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0 + || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreens ) < 0 || fprintf( aFile, "Title %s\n", EscapedUTF8( tb.GetTitle() ).c_str() ) < 0 || fprintf( aFile, "Date %s\n", EscapedUTF8( tb.GetDate() ).c_str() ) < 0 || fprintf( aFile, "Rev %s\n", EscapedUTF8( tb.GetRevision() ).c_str() ) < 0 diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 9f9f6478ed..3ba1e35892 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -313,7 +313,7 @@ void SCH_EDIT_FRAME::SetSheetNumberAndCount() for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() ) { - screen->m_NumberOfScreen = sheet_count; + screen->m_NumberOfScreens = sheet_count; } GetScreen()->m_ScreenNumber = SheetNumber; diff --git a/include/class_base_screen.h b/include/class_base_screen.h index 88c96f27a3..2de82a5813 100644 --- a/include/class_base_screen.h +++ b/include/class_base_screen.h @@ -74,9 +74,9 @@ typedef std::vector< GRID_TYPE > GRIDS; */ class BASE_SCREEN : public EDA_ITEM { +private: GRIDS m_grids; ///< List of valid grid sizes. wxString m_fileName; ///< File used to load the screen. - char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn. bool m_FlagModified; ///< Indicates current drawing has been modified. bool m_FlagSave; ///< Indicates automatic file save. EDA_ITEM* m_CurrentItem; ///< Currently selected object @@ -131,9 +131,9 @@ public: BLOCK_SELECTOR m_BlockLocate; ///< Block description for block commands int m_ScreenNumber; - int m_NumberOfScreen; + int m_NumberOfScreens; - wxPoint m_GridOrigin; + wxPoint m_GridOrigin; std::vector m_ZoomList; ///< standard zoom (i.e. scale) coefficients. bool m_IsPrinting; @@ -245,13 +245,13 @@ public: */ virtual PICKED_ITEMS_LIST* PopCommandFromRedoList(); - int GetUndoCommandCount() + int GetUndoCommandCount() const { return m_UndoList.m_CommandsList.size(); } - int GetRedoCommandCount() + int GetRedoCommandCount() const { return m_RedoList.m_CommandsList.size(); } @@ -261,8 +261,8 @@ public: void ClrModify() { m_FlagModified = false;; } void SetSave() { m_FlagSave = true; } void ClrSave() { m_FlagSave = false; } - int IsModify() { return m_FlagModified; } - int IsSave() { return m_FlagSave; } + bool IsModify() const { return m_FlagModified; } + bool IsSave() const { return m_FlagSave; } //------------------------------------------------------------- @@ -336,23 +336,24 @@ public: * * @return int - Currently selected grid command ID. */ - int GetGridId(); + int GetGridId() const { return m_Grid.m_Id; } /** * Return the grid size of the currently selected grid. * * @return wxRealPoint - The currently selected grid size. */ - wxRealPoint GetGridSize(); + const wxRealPoint& GetGridSize() const { return m_Grid.m_Size; } /** * Return the grid object of the currently selected grid. * * @return GRID_TYPE - The currently selected grid. */ - GRID_TYPE GetGrid(); + const GRID_TYPE& GetGrid() const { return m_Grid; } + + const wxPoint& GetGridOrigin() const { return m_GridOrigin; } - const wxPoint& GetGridOrigin(); void SetGrid( const wxRealPoint& size ); /** @@ -402,7 +403,7 @@ public: * @return wxPoint - The reference point, either the mouse position or * the cursor position. */ - wxPoint RefPos( bool useMouse ) + wxPoint RefPos( bool useMouse ) const { return useMouse ? m_MousePosition : m_crossHairPosition; } @@ -415,7 +416,7 @@ public: * if \a aOnGrid is true. * @return The current cursor position. */ - wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ); + wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const; /** * Function GetCursorScreenPosition @@ -432,7 +433,8 @@ public: * grid size is used. * @return The nearst grid position. */ - wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ); + wxPoint GetNearestGridPosition( const wxPoint& aPosition, + wxRealPoint* aGridSize = NULL ) const; /** * Function GetClass diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 2297ec52f6..b129a97b57 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -560,7 +560,7 @@ public: /** * Function SetSheetNumberAndCount - * Set the m_ScreenNumber and m_NumberOfScreen members for screens + * Set the m_ScreenNumber and m_NumberOfScreens members for screens * must be called after a delete or add sheet command, and when entering * a sheet */