Schematic: move annotation options parsing into common function
This commit is contained in:
parent
81d9524e03
commit
7c979e6375
|
@ -305,34 +305,9 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
// example: IC1 become IC, and 1
|
||||
references.SplitReferences();
|
||||
|
||||
switch( aSortOption )
|
||||
{
|
||||
default:
|
||||
case SORT_BY_X_POSITION: references.SortByXCoordinate(); break;
|
||||
case SORT_BY_Y_POSITION: references.SortByYCoordinate(); break;
|
||||
}
|
||||
|
||||
bool useSheetNum = false;
|
||||
int idStep = 100;
|
||||
|
||||
switch( aAlgoOption )
|
||||
{
|
||||
default:
|
||||
case INCREMENTAL_BY_REF:
|
||||
break;
|
||||
|
||||
case SHEET_NUMBER_X_100:
|
||||
useSheetNum = true;
|
||||
break;
|
||||
|
||||
case SHEET_NUMBER_X_1000:
|
||||
useSheetNum = true;
|
||||
idStep = 1000;
|
||||
break;
|
||||
}
|
||||
|
||||
// Recalculate and update reference numbers in schematic
|
||||
references.Annotate( useSheetNum, idStep, aStartNumber, lockedSymbols, additionalRefs );
|
||||
// Annotate all of the references we've collected by our options
|
||||
references.AnnotateByOptions( aSortOption, aAlgoOption, aStartNumber, lockedSymbols,
|
||||
additionalRefs, false );
|
||||
|
||||
for( size_t i = 0; i < references.GetCount(); i++ )
|
||||
{
|
||||
|
|
|
@ -401,6 +401,40 @@ void SCH_REFERENCE_LIST::ReannotateDuplicates( const SCH_REFERENCE_LIST& aAdditi
|
|||
}
|
||||
|
||||
|
||||
void SCH_REFERENCE_LIST::AnnotateByOptions( ANNOTATE_ORDER_T aSortOption,
|
||||
ANNOTATE_ALGO_T aAlgoOption,
|
||||
int aStartNumber,
|
||||
SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap,
|
||||
const SCH_REFERENCE_LIST& aAdditionalRefs,
|
||||
bool aStartAtCurrent )
|
||||
{
|
||||
switch( aSortOption )
|
||||
{
|
||||
default:
|
||||
case SORT_BY_X_POSITION: SortByXCoordinate(); break;
|
||||
case SORT_BY_Y_POSITION: SortByYCoordinate(); break;
|
||||
}
|
||||
|
||||
bool useSheetNum = false;
|
||||
int idStep = 100;
|
||||
|
||||
switch( aAlgoOption )
|
||||
{
|
||||
default:
|
||||
case INCREMENTAL_BY_REF: break;
|
||||
|
||||
case SHEET_NUMBER_X_100: useSheetNum = true; break;
|
||||
|
||||
case SHEET_NUMBER_X_1000:
|
||||
useSheetNum = true;
|
||||
idStep = 1000;
|
||||
break;
|
||||
}
|
||||
|
||||
Annotate( useSheetNum, idStep, aStartNumber, aLockedUnitMap, aAdditionalRefs, aStartAtCurrent );
|
||||
}
|
||||
|
||||
|
||||
void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int aStartNumber,
|
||||
SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap,
|
||||
const SCH_REFERENCE_LIST& aAdditionalRefs, bool aStartAtCurrent )
|
||||
|
|
|
@ -77,36 +77,6 @@ enum SYMBOL_ORIENTATION_T
|
|||
};
|
||||
|
||||
|
||||
/** Schematic annotation scope options. */
|
||||
enum ANNOTATE_SCOPE_T
|
||||
{
|
||||
ANNOTATE_ALL, ///< Annotate the full schematic
|
||||
ANNOTATE_CURRENT_SHEET, ///< Annotate the current sheet
|
||||
ANNOTATE_SELECTION ///< Annotate the selection
|
||||
};
|
||||
|
||||
|
||||
/** Schematic annotation order options. */
|
||||
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 symbol in the schematic sheet
|
||||
///< object list.
|
||||
};
|
||||
|
||||
|
||||
/** Schematic annotation type options. */
|
||||
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.
|
||||
SHEET_NUMBER_X_1000, ///< Annotate using the first free reference number starting at
|
||||
///< the sheet number * 1000.
|
||||
};
|
||||
|
||||
|
||||
/// Schematic search type used by the socket link with Pcbnew
|
||||
enum SCH_SEARCH_T
|
||||
{
|
||||
|
|
|
@ -35,6 +35,37 @@
|
|||
#include <sch_text.h>
|
||||
#include <erc_settings.h>
|
||||
|
||||
|
||||
/** Schematic annotation scope options. */
|
||||
enum ANNOTATE_SCOPE_T
|
||||
{
|
||||
ANNOTATE_ALL, ///< Annotate the full schematic
|
||||
ANNOTATE_CURRENT_SHEET, ///< Annotate the current sheet
|
||||
ANNOTATE_SELECTION ///< Annotate the selection
|
||||
};
|
||||
|
||||
|
||||
/** Schematic annotation order options. */
|
||||
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 symbol in the schematic sheet
|
||||
///< object list.
|
||||
};
|
||||
|
||||
|
||||
/** Schematic annotation type options. */
|
||||
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.
|
||||
SHEET_NUMBER_X_1000, ///< Annotate using the first free reference number starting at
|
||||
///< the sheet number * 1000.
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A helper to define a symbol's reference designator in a schematic.
|
||||
*
|
||||
|
@ -313,6 +344,29 @@ public:
|
|||
*/
|
||||
void ReannotateDuplicates( const SCH_REFERENCE_LIST& aAdditionalReferences );
|
||||
|
||||
|
||||
/**
|
||||
* Annotate the references by the provided options.
|
||||
*
|
||||
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
|
||||
* @param aAlgoOption Define the annotation style. See #ANNOTATE_ALGO_T.
|
||||
* @param aStartNumber The start number for non-sheet-based annotation styles.
|
||||
* @param appendUndo True if the annotation operation should be added to an existing undo,
|
||||
* false if it should be separately undo-able.
|
||||
* @param aLockedUnitMap A SCH_MULTI_UNIT_REFERENCE_MAP of reference designator wxStrings
|
||||
* to SCH_REFERENCE_LISTs. May be an empty map. If not empty, any multi-unit parts
|
||||
* found in this map will be annotated as a group rather than individually.
|
||||
* @param aAdditionalReferences Additional references to check for duplicates
|
||||
* @param aStartAtCurrent Use m_numRef for each reference as the start number (overrides
|
||||
* aStartNumber)
|
||||
*/
|
||||
void AnnotateByOptions( enum ANNOTATE_ORDER_T aSortOption,
|
||||
enum ANNOTATE_ALGO_T aAlgoOption,
|
||||
int aStartNumber,
|
||||
SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap,
|
||||
const SCH_REFERENCE_LIST& aAdditionalRefs,
|
||||
bool aStartAtCurrent );
|
||||
|
||||
/**
|
||||
* Set the reference designators in the list that have not been annotated.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue