diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index b2fe7eb93e..e6a4902f4b 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -96,7 +96,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool* aAppendUndo void SCH_EDIT_FRAME::AnnotateSymbols( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, - ANNOTATE_OPTION_T aAlgoOption, + ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 789f225933..6185496927 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -59,18 +59,9 @@ private: bool GetResetItems(); bool GetLockUnits(); - /** - * @return 0 if annotation by X position, - * 1 if annotation by Y position, - */ - int GetSortOrder(); + ANNOTATE_ORDER_T GetSortOrder(); - /** - * @return 0 if annotation using first free Id value - * 1 for first free Id value inside sheet num * 100 to sheet num * 100 + 99 - * 2 for first free Id value inside sheet num * 1000 to sheet num * 1000 + 999 - */ - int GetAnnotateAlgo(); + ANNOTATE_ALGO_T GetAnnotateAlgo(); int GetStartNumber(); @@ -117,6 +108,8 @@ DIALOG_ANNOTATE::~DIALOG_ANNOTATE() cfg->m_AnnotatePanel.sort_order = GetSortOrder(); cfg->m_AnnotatePanel.method = GetAnnotateAlgo(); + cfg->m_AnnotatePanel.options = m_rbOptions->GetSelection(); + cfg->m_AnnotatePanel.scope = m_rbScope->GetSelection(); cfg->m_AnnotatePanel.messages_filter = m_MessageWindow->GetVisibleSeverities(); } @@ -127,8 +120,8 @@ void DIALOG_ANNOTATE::InitValues() int option; // These are always reset to attempt to keep the user out of trouble... - m_rbScope->SetSelection( 0 ); - m_rbOptions->SetSelection( 0 ); + m_rbScope->SetSelection( cfg->m_AnnotatePanel.scope ); + m_rbOptions->SetSelection( cfg->m_AnnotatePanel.options ); option = cfg->m_AnnotatePanel.sort_order; @@ -179,8 +172,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) REPORTER& reporter = m_MessageWindow->Reporter(); m_MessageWindow->SetLazyUpdate( true ); // Don't update after each message - m_Parent->AnnotateSymbols( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(), - (ANNOTATE_OPTION_T) GetAnnotateAlgo(), GetStartNumber(), + m_Parent->AnnotateSymbols( GetLevel(), GetSortOrder(), GetAnnotateAlgo(), GetStartNumber(), GetResetItems(), true, GetLockUnits(), reporter ); m_MessageWindow->Flush( true ); // Now update to show all messages @@ -237,23 +229,23 @@ bool DIALOG_ANNOTATE::GetLockUnits() } -int DIALOG_ANNOTATE::GetSortOrder() +ANNOTATE_ORDER_T DIALOG_ANNOTATE::GetSortOrder() { if( m_rbSortBy_Y_Position->GetValue() ) - return 1; + return SORT_BY_Y_POSITION; else - return 0; + return SORT_BY_X_POSITION; } -int DIALOG_ANNOTATE::GetAnnotateAlgo() +ANNOTATE_ALGO_T DIALOG_ANNOTATE::GetAnnotateAlgo() { if( m_rbSheetX100->GetValue() ) - return 1; + return SHEET_NUMBER_X_100; else if( m_rbSheetX1000->GetValue() ) - return 2; + return SHEET_NUMBER_X_1000; else - return 0; + return INCREMENTAL_BY_REF; } diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index db604b27c3..d6cdf20d5e 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -193,6 +193,12 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : m_params.emplace_back( new PARAM( "annotation.method", &m_AnnotatePanel.method, 0, 0, 2 ) ); + m_params.emplace_back( new PARAM( "annotation.scope", + &m_AnnotatePanel.scope, 0, 0, 2 ) ); + + m_params.emplace_back( new PARAM( "annotation.options", + &m_AnnotatePanel.options, 0, 0, 2 ) ); + m_params.emplace_back( new PARAM( "annotation.messages_filter", &m_AnnotatePanel.messages_filter, -1 ) ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index 2a1f2452f4..6ac36d6a3b 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -132,6 +132,8 @@ public: struct PANEL_ANNOTATE { + int scope; + int options; int method; int messages_filter; int sort_order; diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 4e00150102..b96ff74f79 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -65,7 +65,8 @@ class HIERARCHY_NAVIG_DLG; // @todo Move this to transform alone with all of the transform manipulation code. /// enum used in RotationMiroir() -enum COMPONENT_ORIENTATION_T { +enum COMPONENT_ORIENTATION_T +{ CMP_NORMAL, // Normal orientation, no rotation or mirror CMP_ROTATE_CLOCKWISE, // Rotate -90 CMP_ROTATE_COUNTERCLOCKWISE, // Rotate +90 @@ -79,7 +80,8 @@ enum COMPONENT_ORIENTATION_T { /** Schematic annotation order options. */ -enum ANNOTATE_ORDER_T { +enum ANNOTATE_ORDER_T +{ SORT_BY_X_POSITION, ///< Annotate by X position from left to right. SORT_BY_Y_POSITION, ///< Annotate by Y position from top to bottom. UNSORTED, ///< Annotate by position of component in the schematic sheet @@ -88,7 +90,8 @@ enum ANNOTATE_ORDER_T { /** Schematic annotation type options. */ -enum ANNOTATE_OPTION_T { +enum ANNOTATE_ALGO_T +{ INCREMENTAL_BY_REF, ///< Annotate incrementally using the first free reference number. SHEET_NUMBER_X_100, ///< Annotate using the first free reference number starting at ///< the sheet number * 100. @@ -98,13 +101,15 @@ enum ANNOTATE_OPTION_T { /// Schematic search type used by the socket link with Pcbnew -enum SCH_SEARCH_T { +enum SCH_SEARCH_T +{ HIGHLIGHT_PIN, HIGHLIGHT_COMPONENT }; -enum SCH_CLEANUP_FLAGS { +enum SCH_CLEANUP_FLAGS +{ NO_CLEANUP, LOCAL_CLEANUP, GLOBAL_CLEANUP @@ -369,7 +374,7 @@ public: * @param aAnnotateSchematic Annotate the entire schematic if true. Otherwise annotate * the current sheet only. * @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T. - * @param aAlgoOption Define the annotation style. See #ANNOTATE_OPTION_T. + * @param aAlgoOption Define the annotation style. See #ANNOTATE_ALGO_T. * @param aStartNumber The start number for non-sheet-based annotation styles. * @param aResetAnnotation Clear any previous annotation if true. Otherwise, keep the * existing component annotation. @@ -391,7 +396,7 @@ public: * 200 to 299, and so on. */ void AnnotateSymbols( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, - ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, bool aResetAnnotation, + ANNOTATE_ALGO_T aAlgoOption, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits, REPORTER& aReporter ); /**