Commit ff9cdca9 authored by jean-pierre charras's avatar jean-pierre charras

Dialog annotate changes to use new annotation algorithm.

parent 58d98beb
......@@ -11,7 +11,7 @@ endif(WIN32)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
# Command line option to enable or disable building minizip. Minizip
# building is enabled by default. Use -DKICAD_MINZIP=OFF to disable
# building is enabled by default. Use -DKICAD_MINIZIP=OFF to disable
# building minizip.
option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)
......
......@@ -21,7 +21,38 @@
//#define USE_OLD_ALGO
static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList, bool aUseSheetNum );
/**
* Function ComputeReferenceNumber
* Compute the reference number for components without reference number
* i.e. .m_NumRef member of each SCH_REFERENCE_LIST item not yet annotated
* in aComponentsList.
* if aUseSheetNum is false, this number starts from 1
* if aUseSheetNum is false, this number starts from from SheetNumber * aSheetIntervalId
* @param aComponentsList = the SCH_REFERENCE_LIST to fill
* @param aUseSheetNum = false to start Ids from 0,
* true to start each sheet annotation from SheetNumber * aSheetIntervalId
* @param aSheetIntervalId = number of allowed Id by sheet and by reference prefix
* if There are more than aSheetIntervalId of reference prefix in a given sheet
* number overlap next sheet inveral, but there is no annotation problem.
* Useful values are only 100 or 1000
* For instance for a sheet number = 2, and aSheetIntervalId = 100, the first Id = 101
* and the last Id is 199 when no overlap occurs with sheet number 2.
* Rf there are 150 items in sheet number 2, items are referenced U201 to U351,
* and items in sheet 3 start from U352
*/
static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList,
bool aUseSheetNum, int aSheetIntervalId );
/**
* Search in the sorted list of components, for a given component an other
* component with the same reference and a given part unit. Mainly used to
* manage multiple parts per package components in aComponentsList.
* @param aObjet = index in aComponentsList for the given SCH_REFERENCE
* item to test
* @param Unit = the given unit number to search
* @param aComponentsList = list of items to examine
* @return index in aComponentsList if found or -1 if not found
*/
static int ExistUnit( int aObjet, int aUnit, SCH_REFERENCE_LIST& aComponentList );
/**
......@@ -50,30 +81,36 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly )
/**
* AnnotateComponents:
* Function AnnotateComponents:
*
* Compute the annotation of the components for the whole project, or the
* current sheet only. All the components or the new ones only will be
* annotated.
* @param parent = Schematic frame
* @param annotateSchematic : true = entire schematic annotation,
* @param aAnnotateSchematic : true = entire schematic annotation,
* false = current sheet only
* @param sortOption : 0 = annotate by sorting X position,
* @param aSortOption : 0 = annotate by sorting X position,
* 1 = annotate by sorting Y position,
* 2 = annotate by sorting value
* @param resetAnnotation : true = remove previous annotation
* @param aAlgoOption : 0 = annotate schematic using first free Id number
* 1 = annotate using first free Id number, starting to sheet number * 100
* 2 = annotate using first free Id number, starting to sheet number * 1000
* @param aResetAnnotation : true = remove previous annotation
* false = annotate new components only
* @param repairsTimestamps : true = test for duplicate times stamps and
* @param aRepairsTimestamps : true = test for duplicate times stamps and
* replace duplicated
* Note: this option could change previous annotation, because time
* stamps are used to handle annotation mainly in complex
* hierarchies.
* When the sheet number is used in annotation,
* for each sheet annotation starts from sheet number * 100
* ( the first sheet uses 100 to 199, the second 200 to 299 ... )
*/
void SCH_EDIT_FRAME::AnnotateComponents(
bool annotateSchematic,
int sortOption,
bool resetAnnotation,
bool repairsTimestamps )
bool aAnnotateSchematic,
int aSortOption,
int aAlgoOption,
bool aResetAnnotation,
bool aRepairsTimestamps )
{
SCH_REFERENCE_LIST references;
......@@ -87,7 +124,7 @@ void SCH_EDIT_FRAME::AnnotateComponents(
// Test for and replace duplicate time stamps in components and sheets. Duplicate
// time stamps can happen with old schematics, schematic conversions, or manual
// editing of files.
if( repairsTimestamps )
if( aRepairsTimestamps )
{
int count = screens.ReplaceDuplicateTimeStamps();
......@@ -100,8 +137,8 @@ void SCH_EDIT_FRAME::AnnotateComponents(
}
// If it is an annotation for all the components, reset previous annotation.
if( resetAnnotation )
DeleteAnnotation( !annotateSchematic );
if( aResetAnnotation )
DeleteAnnotation( !aAnnotateSchematic );
// Update the screen date.
screens.SetDate( GenDate() );
......@@ -110,7 +147,7 @@ void SCH_EDIT_FRAME::AnnotateComponents(
SetSheetNumberAndCount();
/* Build component list */
if( annotateSchematic )
if( aAnnotateSchematic )
{
sheets.GetComponents( references );
}
......@@ -123,38 +160,42 @@ void SCH_EDIT_FRAME::AnnotateComponents(
* example: IC1 become IC, and 1 */
references.SplitReferences( );
bool useSheetNum = false;
switch( sortOption )
switch( aSortOption )
{
default:
case 0:
references.SortCmpByXCoordinate();
break;
case 1:
useSheetNum = true;
references.SortCmpByXCoordinate();
references.SortCmpByYCoordinate();
break;
}
case 2:
references.SortCmpByYCoordinate();
bool useSheetNum = false;
int idStep = 100;
switch( aAlgoOption )
{
default:
case 0:
break;
case 3:
case 1:
useSheetNum = true;
references.SortCmpByYCoordinate();
break;
case 4:
references.SortComponentsByRefAndValue();
case 2:
useSheetNum = true;
idStep = 1000;
break;
}
// Recalculate and update reference numbers in schematic
ComputeReferenceNumber( references, useSheetNum );
ComputeReferenceNumber( references, useSheetNum, idStep );
references.UpdateAnnotation();
/* Final control (just in case ... )*/
CheckAnnotate( NULL, !annotateSchematic );
CheckAnnotate( NULL, !aAnnotateSchematic );
OnModify();
// Update on screen refences, that can be modified by previous calculations:
......@@ -198,6 +239,8 @@ static int GetLastNumberInReference( int aObjet,SCH_REFERENCE_LIST& aComponentsL
/**
* helper function BuildRefIdInUseList
* creates the list of reference numbers in use for a given reference prefix.
* This list is read by CreateFirstFreeRefId to fing not yet used reference Id.
* @see CreateFirstFreeRefId
* @param aObjet = the current component index to use for reference prefix filtering.
* @param aComponentsList = the full list of components
* @param aIdList = the buffer to fill
......@@ -218,19 +261,18 @@ static void BuildRefIdInUseList( int aObjet,SCH_REFERENCE_LIST& aComponentsList
// Ensure each reference Id appears only once
// If there are multiple parts per package the same Id will be stored for each part.
for( unsigned ii = 1; ii < aIdList.size(); ii++ )
{
if( aIdList[ii] != aIdList[ii-1] )
continue;
aIdList.erase(aIdList.begin() + ii );
ii--;
}
std::vector<int>::iterator new_end = unique( aIdList.begin(), aIdList.end() );
if( new_end != aIdList.end() )
aIdList.erase(new_end, aIdList.end() );
}
/**
* helper function CreateFirstFreeRefId
* Search for a free ref Id inside a list of reference numbers in use.
* This list is expected sorted by increasing values, and each value stored only once
* Because this function just search for a hole in a list of incremented numbers,
* this list must be:
* sorted by increasing values.
* and each value stored only once
* @see BuildRefIdInUseList to prepare this list
* @param aIdList = the buffer that contains Ids in use
* @param aFirstValue = the first expected free value
......@@ -271,10 +313,15 @@ static int CreateFirstFreeRefId( std::vector<int>& aIdList, int aFirstValue )
#endif
/*
* Function ComputeReferenceNumber
* Compute the reference number for components without reference number
* Compute .m_NumRef member
* i.e. .m_NumRef member of each SCH_REFERENCE_LIST item not yet annotated
* in aComponentsList.
* if aUseSheetNum is false, this number starts from 1
* if aUseSheetNum is false, this number starts from from SheetNumber * aSheetIntervalId
*/
static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList, bool aUseSheetNum )
static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList,
bool aUseSheetNum, int aSheetIntervalId )
{
if ( aComponentsList.GetCount() == 0 )
return;
......@@ -304,15 +351,15 @@ static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList, bool aU
/* calculate the last used number for this reference prefix: */
#ifdef USE_OLD_ALGO
int minRefId = 0;
// when using sheet number, ensure ref number >= sheet number* 100
// when using sheet number, ensure ref number >= sheet number* aSheetIntervalId
if( aUseSheetNum )
minRefId = aComponentsList[first].m_SheetNum * 100;
minRefId = aComponentsList[first].m_SheetNum * aSheetIntervalId;
LastReferenceNumber = GetLastNumberInReference( first, aComponentsList, minRefId );
#else
int minRefId = 1;
// when using sheet number, ensure ref number >= sheet number* 100
// when using sheet number, ensure ref number >= sheet number* aSheetIntervalId
if( aUseSheetNum )
minRefId = aComponentsList[first].m_SheetNum * 100 + 1;
minRefId = aComponentsList[first].m_SheetNum * aSheetIntervalId + 1;
// This is the list of all Id already in use for a given reference prefix.
// Will be refilled for each new reference prefix.
std::vector<int>idList;
......@@ -331,15 +378,15 @@ static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList, bool aU
first = ii;
#ifdef USE_OLD_ALGO
minRefId = 0;
// when using sheet number, ensure ref number >= sheet number* 100
// when using sheet number, ensure ref number >= sheet number* aSheetIntervalId
if( aUseSheetNum )
minRefId = aComponentsList[ii].m_SheetNum * 100;
minRefId = aComponentsList[ii].m_SheetNum * aSheetIntervalId;
LastReferenceNumber = GetLastNumberInReference( ii, aComponentsList, minRefId);
#else
minRefId = 1;
// when using sheet number, ensure ref number >= sheet number* 100
// when using sheet number, ensure ref number >= sheet number* aSheetIntervalId
if( aUseSheetNum )
minRefId = aComponentsList[ii].m_SheetNum * 100 + 1;
minRefId = aComponentsList[ii].m_SheetNum * aSheetIntervalId + 1;
BuildRefIdInUseList( first, aComponentsList, idList, minRefId );
#endif
}
......@@ -428,15 +475,10 @@ static void ComputeReferenceNumber( SCH_REFERENCE_LIST& aComponentsList, bool aU
}
/**
/*
* Search in the sorted list of components, for a given component an other
* component with the same reference and a given part unit. Mainly used to
* manage multiple parts per package components.
* @param aObjet = index in aComponentsList for the given SCH_REFERENCE
* item to test
* @param Unit = the given unit number to search
* @param aComponentsList = list of items to examine
* @return index in aComponentsList if found or -1 if not found
* manage multiple parts per package components in aComponentsList.
*/
static int ExistUnit( int aObjet, int Unit, SCH_REFERENCE_LIST& aComponentsList )
{
......
/////////////////////////////////////////////////////////////////////////////
// Name: annotate_dialog.cpp
// Licence: License GNU
/////////////////////////////////////////////////////////////////////////////
/*
* annotate_dialog.cpp
*/
/*
* annotate_dialog.cpp
* Annotation dialog functions.
*/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "fctsys.h"
......@@ -14,6 +41,7 @@
#include "annotate_dialog.h"
#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption")
#define KEY_ANNOTATE_ALGO_OPTION wxT("AnnotateAlgoOption")
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
......@@ -45,31 +73,36 @@ void DIALOG_ANNOTATE::InitValues()
break;
case 1:
m_rbSortBy_X_Position_and_useSheet->SetValue(1);
m_rbSortBy_Y_Position->SetValue(1);
break;
case 2:
m_rbSortBy_Y_Position->SetValue(1);
m_rbUseIncremental->SetValue(1);
break;
}
case 3:
m_rbSortBy_Y_Position_and_useSheet->SetValue(1);
m_Config->Read(KEY_ANNOTATE_ALGO_OPTION, &option, 0l);
switch( option )
{
default:
case 0:
m_rbUseIncremental->SetValue(1);
break;
case 1:
m_rbUseSheetNum->SetValue(1);
break;
case 4:
rbSortByValue->SetValue(1);
case 2:
m_rbStartSheetNumLarge->SetValue(1);
break;
}
}
wxBitmap bitmap0(annotate_down_right_xpm);
annotate_down_right_bitmap->SetBitmap(bitmap0);
annotate_down_right_bitmap1->SetBitmap(bitmap0);
wxBitmap bitmap1(annotate_right_down_xpm);
annotate_right_down_bitmap->SetBitmap(bitmap1);
annotate_right_down_bitmap1->SetBitmap(bitmap1);
wxBitmap bitmap2(add_text_xpm);
annotate_by_value_bitmap->SetBitmap(bitmap2);
m_btnApply->SetDefault();
}
......@@ -83,7 +116,10 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
wxString message;
if( m_Config )
{
m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder());
m_Config->Write(KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo());
}
if( GetResetItems() )
message = _( "Clear and annotate all of the components " );
......@@ -98,7 +134,9 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL)
return;
m_Parent->AnnotateComponents( GetLevel(), GetSortOrder(), GetResetItems() , true );
m_Parent->AnnotateComponents( GetLevel(), GetSortOrder(), GetAnnotateAlgo(),
GetResetItems() , true );
m_Parent->DrawPanel->Refresh();
m_btnClear->Enable();
......@@ -157,25 +195,30 @@ bool DIALOG_ANNOTATE::GetResetItems( void )
return m_rbResetAnnotation->GetValue();
}
/****************************************/
int DIALOG_ANNOTATE::GetSortOrder( void )
/****************************************/
/**
* @return 0 if annotation by X position,
* 1 if annotation by X position and use sheet number,
* 2 if annotation by Y position,
* 3 if annotation by Y position and use sheet number,
* 4 if annotation by value
* 1 if annotation by Y position,
* 2 if annotation by value
*/
{
if ( m_rbSortBy_X_Position->GetValue() )
return 0;
if ( m_rbSortBy_X_Position_and_useSheet->GetValue() )
return 1;
if ( m_rbSortBy_Y_Position->GetValue() )
return 1;
return 2;
if ( m_rbSortBy_Y_Position_and_useSheet->GetValue() )
return 3;
return 4;
}
int DIALOG_ANNOTATE::GetAnnotateAlgo( void )
/**
* @return 0 if annotation using first not used Id value
* 1 if annotation using first not used Id value inside sheet num * 100 to sheet num * 100 + 99
* 2 if annotation using first nhot used Id value inside sheet num * 1000 to sheet num * 1000 + 999
*/
{
if ( m_rbUseIncremental->GetValue() )
return 0;
if ( m_rbUseSheetNum->GetValue() )
return 1;
return 2;
}
......@@ -55,7 +55,7 @@ public:
bool GetLevel( void );
bool GetResetItems( void );
int GetSortOrder( void );
int GetAnnotateAlgo( void );
};
#endif
......
......@@ -71,20 +71,6 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerXpos_and_use_sheet;
bSizerXpos_and_use_sheet = new wxBoxSizer( wxHORIZONTAL );
m_rbSortBy_X_Position_and_useSheet = new wxRadioButton( this, wxID_ANY, _("Sort components by X position and use sheet &number"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerXpos_and_use_sheet->Add( m_rbSortBy_X_Position_and_useSheet, 0, wxALL, 3 );
bSizerXpos_and_use_sheet->Add( 0, 0, 1, wxEXPAND, 5 );
annotate_down_right_bitmap1 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizerXpos_and_use_sheet->Add( annotate_down_right_bitmap1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 12 );
b_orderOptSizer->Add( bSizerXpos_and_use_sheet, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerYpos;
bSizerYpos = new wxBoxSizer( wxHORIZONTAL );
......@@ -99,38 +85,62 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerYpos_and_useSheet;
bSizerYpos_and_useSheet = new wxBoxSizer( wxHORIZONTAL );
bupperSizer->Add( b_orderOptSizer, 0, wxEXPAND|wxLEFT, 25 );
m_rbSortBy_Y_Position_and_useSheet = new wxRadioButton( this, wxID_ANY, _("Sort components by Y position and use &sheet number"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerYpos_and_useSheet->Add( m_rbSortBy_Y_Position_and_useSheet, 0, wxALL, 3 );
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bupperSizer->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerAnnotAlgo;
bSizerAnnotAlgo = new wxBoxSizer( wxVERTICAL );
bSizerYpos_and_useSheet->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextAnnotateAlgo = new wxStaticText( this, wxID_ANY, _("Annotation Choice"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextAnnotateAlgo->Wrap( -1 );
m_staticTextAnnotateAlgo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
annotate_right_down_bitmap1 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizerYpos_and_useSheet->Add( annotate_right_down_bitmap1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
bSizerAnnotAlgo->Add( m_staticTextAnnotateAlgo, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
b_orderOptSizer->Add( bSizerYpos_and_useSheet, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizer1AlgoChoice;
bSizer1AlgoChoice = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerValuepos;
bSizerValuepos = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerChoiceInc;
bSizerChoiceInc = new wxBoxSizer( wxHORIZONTAL );
rbSortByValue = new wxRadioButton( this, ID_SORT_BY_VALUE, _("Sort components by &value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerValuepos->Add( rbSortByValue, 0, wxALL, 3 );
m_rbUseIncremental = new wxRadioButton( this, ID_SORT_BY_X_POSITION, _("Use first free number in schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizerChoiceInc->Add( m_rbUseIncremental, 0, wxALL, 3 );
bSizerValuepos->Add( 0, 0, 1, wxEXPAND, 5 );
bSizerChoiceInc->Add( 0, 0, 1, wxEXPAND, 5 );
annotate_by_value_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizerValuepos->Add( annotate_by_value_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
bSizer1AlgoChoice->Add( bSizerChoiceInc, 0, wxEXPAND|wxRIGHT, 5 );
b_orderOptSizer->Add( bSizerValuepos, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerChoiceIncBySheet;
bSizerChoiceIncBySheet = new wxBoxSizer( wxHORIZONTAL );
bupperSizer->Add( b_orderOptSizer, 1, wxEXPAND|wxLEFT, 25 );
m_rbUseSheetNum = new wxRadioButton( this, wxID_ANY, _("Start to sheet number*100 and use first free number"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerChoiceIncBySheet->Add( m_rbUseSheetNum, 0, wxALL, 3 );
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bupperSizer->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 );
bSizerChoiceIncBySheet->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceIncBySheet, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerChoiceIncBySheetLarge;
bSizerChoiceIncBySheetLarge = new wxBoxSizer( wxHORIZONTAL );
m_rbStartSheetNumLarge = new wxRadioButton( this, wxID_ANY, _("Start to sheet number*1000 and use first free number"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerChoiceIncBySheetLarge->Add( m_rbStartSheetNumLarge, 0, wxALL, 3 );
bSizerChoiceIncBySheetLarge->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer1AlgoChoice->Add( bSizerChoiceIncBySheetLarge, 1, wxEXPAND, 5 );
bSizerAnnotAlgo->Add( bSizer1AlgoChoice, 1, wxEXPAND|wxLEFT, 25 );
bupperSizer->Add( bSizerAnnotAlgo, 0, wxEXPAND|wxRIGHT, 5 );
m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bupperSizer->Add( m_staticline4, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
......
......@@ -37,7 +37,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_ANNOTATE_BASE</property>
<property name="pos"></property>
<property name="size">432,376</property>
<property name="size">432,382</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Annotate Schematic</property>
......@@ -555,7 +555,7 @@
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">b_orderOptSizer</property>
......@@ -699,7 +699,7 @@
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerXpos_and_use_sheet</property>
<property name="name">bSizerYpos</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
......@@ -714,11 +714,11 @@
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sort components by X position and use sheet &amp;number</property>
<property name="id">ID_SORT_BY_Y_POSITION</property>
<property name="label">Sort components by &amp;Y position</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_rbSortBy_X_Position_and_useSheet</property>
<property name="name">m_rbSortBy_Y_Position</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
......@@ -771,7 +771,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<property name="bg"></property>
......@@ -785,7 +785,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">annotate_down_right_bitmap1</property>
<property name="name">annotate_right_down_bitmap</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
......@@ -825,20 +825,13 @@
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerYpos</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="1">
<object class="wxStaticLine" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......@@ -846,22 +839,20 @@
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_SORT_BY_Y_POSITION</property>
<property name="label">Sort components by &amp;Y position</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_rbSortBy_Y_Position</property>
<property name="name">m_staticline5</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -882,7 +873,6 @@
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioButton"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
......@@ -893,34 +883,34 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerAnnotAlgo</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="bitmap">; Load From Resource</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="font">,90,92,-1,70,0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Annotation Choice</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">annotate_right_down_bitmap</property>
<property name="name">m_staticTextAnnotateAlgo</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
......@@ -930,6 +920,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......@@ -955,15 +946,22 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">25</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer1AlgoChoice</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerYpos_and_useSheet</property>
<property name="name">bSizerChoiceInc</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
......@@ -978,15 +976,15 @@
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sort components by Y position and use &amp;sheet number</property>
<property name="id">ID_SORT_BY_X_POSITION</property>
<property name="label">Use first free number in schematic</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_rbSortBy_Y_Position_and_useSheet</property>
<property name="name">m_rbUseIncremental</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxRB_GROUP</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
......@@ -1033,13 +1031,23 @@
<property name="width">0</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerChoiceIncBySheet</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<object class="wxRadioButton" expanded="1">
<property name="bg"></property>
<property name="bitmap">; Load From Resource</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
......@@ -1047,18 +1055,21 @@
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Start to sheet number*100 and use first free number</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">annotate_right_down_bitmap1</property>
<property name="name">m_rbUseSheetNum</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -1079,6 +1090,7 @@
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioButton"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
......@@ -1087,15 +1099,25 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">0</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerValuepos</property>
<property name="name">bSizerChoiceIncBySheetLarge</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
......@@ -1110,11 +1132,11 @@
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_SORT_BY_VALUE</property>
<property name="label">Sort components by &amp;value</property>
<property name="id">wxID_ANY</property>
<property name="label">Start to sheet number*1000 and use first free number</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">rbSortByValue</property>
<property name="name">m_rbStartSheetNumLarge</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
......@@ -1165,58 +1187,6 @@
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<property name="bg"></property>
<property name="bitmap">; Load From Resource</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">annotate_by_value_bitmap</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
......@@ -1238,7 +1208,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticline5</property>
<property name="name">m_staticline4</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
......
......@@ -34,8 +34,7 @@
#define ID_RESET_ANNOTATION 1003
#define ID_SORT_BY_X_POSITION 1004
#define ID_SORT_BY_Y_POSITION 1005
#define ID_SORT_BY_VALUE 1006
#define ID_CLEAR_ANNOTATION_CMP 1007
#define ID_CLEAR_ANNOTATION_CMP 1006
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_ANNOTATE_BASE
......@@ -56,19 +55,18 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
wxRadioButton* m_rbSortBy_X_Position;
wxStaticBitmap* annotate_down_right_bitmap;
wxRadioButton* m_rbSortBy_X_Position_and_useSheet;
wxStaticBitmap* annotate_down_right_bitmap1;
wxRadioButton* m_rbSortBy_Y_Position;
wxStaticBitmap* annotate_right_down_bitmap;
wxRadioButton* m_rbSortBy_Y_Position_and_useSheet;
wxStaticLine* m_staticline5;
wxStaticText* m_staticTextAnnotateAlgo;
wxRadioButton* m_rbUseIncremental;
wxStaticBitmap* annotate_right_down_bitmap1;
wxRadioButton* rbSortByValue;
wxRadioButton* m_rbUseSheetNum;
wxStaticBitmap* annotate_by_value_bitmap;
wxStaticLine* m_staticline5;
wxRadioButton* m_rbStartSheetNumLarge;
wxStaticLine* m_staticline4;
wxButton* m_btnClose;
wxButton* m_btnClear;
wxButton* m_btnApply;
......@@ -81,7 +79,7 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
public:
DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 432,376 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 432,382 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_ANNOTATE_BASE();
};
......
......@@ -283,18 +283,17 @@ public:
* Compute the annotation of the components for the whole project, or the
* current sheet only. All the components or the new ones only will be
* annotated.
* @param annotateSchematic : true = entire schematic annotation,
* @param aAnnotateSchematic : true = entire schematic annotation,
* false = current sheet only
* @param sortOption : 0 = annotate by sorting X position,
* 1 = annotate by sorting X position,
* and use sheet number to calculate annotation
* 2 = annotate by sorting Y position,
* 3 = annotate by sorting Y position,
* and use sheet number to calculate annotation
* 4 = annotate by sorting value
* @param resetAnnotation : true = remove previous annotation
* @param aSortOption : 0 = annotate by sorting X position,
* 1 = annotate by sorting Y position,
* 2 = annotate by sorting value
* @param aAlgoOption : 0 = annotate schematic using first free Id number
* 1 = annotate using first free Id number, starting to sheet number * 100
* 2 = annotate using first free Id number, starting to sheet number * 1000
* @param aResetAnnotation : true = remove previous annotation
* false = annotate new components only
* @param repairsTimestamps : true = test for duplicate times stamps and
* @param aRepairsTimestamps : true = test for duplicate times stamps and
* replace duplicated
* Note: this option could change previous annotation, because time
* stamps are used to handle annotation mainly in complex
......@@ -303,8 +302,9 @@ public:
* for each sheet annotation starts from sheet number * 100
* ( the first sheet uses 100 to 199, the second 200 to 299 ... )
*/
void AnnotateComponents(bool annotateSchematic, int sortOption,
bool resetAnnotation, bool repairsTimestamps );
void AnnotateComponents(bool aAnnotateSchematic, int aSortOption,
int aAlgoOption,
bool aResetAnnotation, bool aRepairsTimestamps );
// Functions used for hierarchy handling
void InstallPreviousSheet();
void InstallNextScreen( SCH_SHEET* Sheet );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment