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) ...@@ -11,7 +11,7 @@ endif(WIN32)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
# Command line option to enable or disable building minizip. Minizip # 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. # building minizip.
option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON) option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////// /*
// Name: annotate_dialog.cpp * annotate_dialog.cpp
// Licence: License GNU */
///////////////////////////////////////////////////////////////////////////// /*
* 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" #include "fctsys.h"
...@@ -14,6 +41,7 @@ ...@@ -14,6 +41,7 @@
#include "annotate_dialog.h" #include "annotate_dialog.h"
#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption") #define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption")
#define KEY_ANNOTATE_ALGO_OPTION wxT("AnnotateAlgoOption")
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ) DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
...@@ -45,31 +73,36 @@ void DIALOG_ANNOTATE::InitValues() ...@@ -45,31 +73,36 @@ void DIALOG_ANNOTATE::InitValues()
break; break;
case 1: case 1:
m_rbSortBy_X_Position_and_useSheet->SetValue(1); m_rbSortBy_Y_Position->SetValue(1);
break; break;
case 2: case 2:
m_rbSortBy_Y_Position->SetValue(1); m_rbUseIncremental->SetValue(1);
break;
}
m_Config->Read(KEY_ANNOTATE_ALGO_OPTION, &option, 0l);
switch( option )
{
default:
case 0:
m_rbUseIncremental->SetValue(1);
break; break;
case 3: case 1:
m_rbSortBy_Y_Position_and_useSheet->SetValue(1); m_rbUseSheetNum->SetValue(1);
break; break;
case 4: case 2:
rbSortByValue->SetValue(1); m_rbStartSheetNumLarge->SetValue(1);
break; break;
} }
} }
wxBitmap bitmap0(annotate_down_right_xpm); wxBitmap bitmap0(annotate_down_right_xpm);
annotate_down_right_bitmap->SetBitmap(bitmap0); annotate_down_right_bitmap->SetBitmap(bitmap0);
annotate_down_right_bitmap1->SetBitmap(bitmap0);
wxBitmap bitmap1(annotate_right_down_xpm); wxBitmap bitmap1(annotate_right_down_xpm);
annotate_right_down_bitmap->SetBitmap(bitmap1); 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(); m_btnApply->SetDefault();
} }
...@@ -83,7 +116,10 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) ...@@ -83,7 +116,10 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
wxString message; wxString message;
if( m_Config ) if( m_Config )
{
m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder()); m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder());
m_Config->Write(KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo());
}
if( GetResetItems() ) if( GetResetItems() )
message = _( "Clear and annotate all of the components " ); message = _( "Clear and annotate all of the components " );
...@@ -98,7 +134,9 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) ...@@ -98,7 +134,9 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL) if (response == wxCANCEL)
return; return;
m_Parent->AnnotateComponents( GetLevel(), GetSortOrder(), GetResetItems() , true );
m_Parent->AnnotateComponents( GetLevel(), GetSortOrder(), GetAnnotateAlgo(),
GetResetItems() , true );
m_Parent->DrawPanel->Refresh(); m_Parent->DrawPanel->Refresh();
m_btnClear->Enable(); m_btnClear->Enable();
...@@ -157,25 +195,30 @@ bool DIALOG_ANNOTATE::GetResetItems( void ) ...@@ -157,25 +195,30 @@ bool DIALOG_ANNOTATE::GetResetItems( void )
return m_rbResetAnnotation->GetValue(); return m_rbResetAnnotation->GetValue();
} }
/****************************************/
int DIALOG_ANNOTATE::GetSortOrder( void ) int DIALOG_ANNOTATE::GetSortOrder( void )
/****************************************/
/** /**
* @return 0 if annotation by X position, * @return 0 if annotation by X position,
* 1 if annotation by X position and use sheet number, * 1 if annotation by Y position,
* 2 if annotation by Y position, * 2 if annotation by value
* 3 if annotation by Y position and use sheet number,
* 4 if annotation by value
*/ */
{ {
if ( m_rbSortBy_X_Position->GetValue() ) if ( m_rbSortBy_X_Position->GetValue() )
return 0; return 0;
if ( m_rbSortBy_X_Position_and_useSheet->GetValue() )
return 1;
if ( m_rbSortBy_Y_Position->GetValue() ) if ( m_rbSortBy_Y_Position->GetValue() )
return 2; return 1;
if ( m_rbSortBy_Y_Position_and_useSheet->GetValue() ) return 2;
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: ...@@ -55,7 +55,7 @@ public:
bool GetLevel( void ); bool GetLevel( void );
bool GetResetItems( void ); bool GetResetItems( void );
int GetSortOrder( void ); int GetSortOrder( void );
int GetAnnotateAlgo( void );
}; };
#endif #endif
......
...@@ -71,20 +71,6 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con ...@@ -71,20 +71,6 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 ); 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; wxBoxSizer* bSizerYpos;
bSizerYpos = new wxBoxSizer( wxHORIZONTAL ); bSizerYpos = new wxBoxSizer( wxHORIZONTAL );
...@@ -99,38 +85,62 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con ...@@ -99,38 +85,62 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 ); b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 );
wxBoxSizer* bSizerYpos_and_useSheet; bupperSizer->Add( b_orderOptSizer, 0, wxEXPAND|wxLEFT, 25 );
bSizerYpos_and_useSheet = new wxBoxSizer( wxHORIZONTAL );
m_rbSortBy_Y_Position_and_useSheet = new wxRadioButton( this, wxID_ANY, _("Sort components by Y position and use &sheet number"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerYpos_and_useSheet->Add( m_rbSortBy_Y_Position_and_useSheet, 0, wxALL, 3 ); 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 ); bSizerAnnotAlgo->Add( m_staticTextAnnotateAlgo, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerYpos_and_useSheet->Add( annotate_right_down_bitmap1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
b_orderOptSizer->Add( bSizerYpos_and_useSheet, 0, wxEXPAND|wxRIGHT, 5 ); wxBoxSizer* bSizer1AlgoChoice;
bSizer1AlgoChoice = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerValuepos; wxBoxSizer* bSizerChoiceInc;
bSizerValuepos = new wxBoxSizer( wxHORIZONTAL ); bSizerChoiceInc = new wxBoxSizer( wxHORIZONTAL );
rbSortByValue = new wxRadioButton( this, ID_SORT_BY_VALUE, _("Sort components by &value"), wxDefaultPosition, wxDefaultSize, 0 ); m_rbUseIncremental = new wxRadioButton( this, ID_SORT_BY_X_POSITION, _("Use first free number in schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizerValuepos->Add( rbSortByValue, 0, wxALL, 3 ); 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 ); bSizer1AlgoChoice->Add( bSizerChoiceInc, 0, wxEXPAND|wxRIGHT, 5 );
bSizerValuepos->Add( annotate_by_value_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 );
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; wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
......
This diff is collapsed.
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
#define ID_RESET_ANNOTATION 1003 #define ID_RESET_ANNOTATION 1003
#define ID_SORT_BY_X_POSITION 1004 #define ID_SORT_BY_X_POSITION 1004
#define ID_SORT_BY_Y_POSITION 1005 #define ID_SORT_BY_Y_POSITION 1005
#define ID_SORT_BY_VALUE 1006 #define ID_CLEAR_ANNOTATION_CMP 1006
#define ID_CLEAR_ANNOTATION_CMP 1007
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_ANNOTATE_BASE /// Class DIALOG_ANNOTATE_BASE
...@@ -56,19 +55,18 @@ class DIALOG_ANNOTATE_BASE : public wxDialog ...@@ -56,19 +55,18 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
wxRadioButton* m_rbSortBy_X_Position; wxRadioButton* m_rbSortBy_X_Position;
wxStaticBitmap* annotate_down_right_bitmap; wxStaticBitmap* annotate_down_right_bitmap;
wxRadioButton* m_rbSortBy_X_Position_and_useSheet;
wxStaticBitmap* annotate_down_right_bitmap1;
wxRadioButton* m_rbSortBy_Y_Position; wxRadioButton* m_rbSortBy_Y_Position;
wxStaticBitmap* annotate_right_down_bitmap; 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* m_rbUseSheetNum;
wxRadioButton* rbSortByValue;
wxStaticBitmap* annotate_by_value_bitmap; wxRadioButton* m_rbStartSheetNumLarge;
wxStaticLine* m_staticline5;
wxStaticLine* m_staticline4;
wxButton* m_btnClose; wxButton* m_btnClose;
wxButton* m_btnClear; wxButton* m_btnClear;
wxButton* m_btnApply; wxButton* m_btnApply;
...@@ -81,7 +79,7 @@ class DIALOG_ANNOTATE_BASE : public wxDialog ...@@ -81,7 +79,7 @@ class DIALOG_ANNOTATE_BASE : public wxDialog
public: 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(); ~DIALOG_ANNOTATE_BASE();
}; };
......
...@@ -283,18 +283,17 @@ public: ...@@ -283,18 +283,17 @@ public:
* Compute the annotation of the components for the whole project, or the * 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 * current sheet only. All the components or the new ones only will be
* annotated. * annotated.
* @param annotateSchematic : true = entire schematic annotation, * @param aAnnotateSchematic : true = entire schematic annotation,
* false = current sheet only * false = current sheet only
* @param sortOption : 0 = annotate by sorting X position, * @param aSortOption : 0 = annotate by sorting X position,
* 1 = annotate by sorting X position, * 1 = annotate by sorting Y position,
* and use sheet number to calculate annotation * 2 = annotate by sorting value
* 2 = annotate by sorting Y position, * @param aAlgoOption : 0 = annotate schematic using first free Id number
* 3 = annotate by sorting Y position, * 1 = annotate using first free Id number, starting to sheet number * 100
* and use sheet number to calculate annotation * 2 = annotate using first free Id number, starting to sheet number * 1000
* 4 = annotate by sorting value * @param aResetAnnotation : true = remove previous annotation
* @param resetAnnotation : true = remove previous annotation
* false = annotate new components only * 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 * replace duplicated
* Note: this option could change previous annotation, because time * Note: this option could change previous annotation, because time
* stamps are used to handle annotation mainly in complex * stamps are used to handle annotation mainly in complex
...@@ -303,8 +302,9 @@ public: ...@@ -303,8 +302,9 @@ public:
* for each sheet annotation starts from sheet number * 100 * for each sheet annotation starts from sheet number * 100
* ( the first sheet uses 100 to 199, the second 200 to 299 ... ) * ( the first sheet uses 100 to 199, the second 200 to 299 ... )
*/ */
void AnnotateComponents(bool annotateSchematic, int sortOption, void AnnotateComponents(bool aAnnotateSchematic, int aSortOption,
bool resetAnnotation, bool repairsTimestamps ); int aAlgoOption,
bool aResetAnnotation, bool aRepairsTimestamps );
// Functions used for hierarchy handling // Functions used for hierarchy handling
void InstallPreviousSheet(); void InstallPreviousSheet();
void InstallNextScreen( SCH_SHEET* Sheet ); 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