From 4a5151969dc5c7d577d86b2f41eb420f3d761d83 Mon Sep 17 00:00:00 2001 From: charras Date: Tue, 27 Oct 2009 19:30:32 +0000 Subject: [PATCH] eeschema: annotate dialog converted from DialogBlocks to wxFormBuilder --- common/about_kicad.cpp | 2 +- eeschema/CMakeLists.txt | 2 +- eeschema/annotate_dialog.cpp | 335 ++---- eeschema/annotate_dialog.h | 138 +-- eeschema/class_sch_component.cpp | 7 + eeschema/dialog_annotate_base.cpp | 129 +++ eeschema/dialog_annotate_base.fbp | 1074 ++++++++++++++++++++ eeschema/dialog_annotate_base.h | 79 ++ eeschema/eeschema_config.cpp | 2 +- eeschema/{eeconfig.h => eeschema_config.h} | 0 eeschema/schframe.cpp | 2 +- pcbnew/pcbnew_config.cpp | 2 +- pcbnew/{pcbcfg.h => pcbnew_config.h} | 0 13 files changed, 1391 insertions(+), 381 deletions(-) create mode 100644 eeschema/dialog_annotate_base.cpp create mode 100644 eeschema/dialog_annotate_base.fbp create mode 100644 eeschema/dialog_annotate_base.h rename eeschema/{eeconfig.h => eeschema_config.h} (100%) rename pcbnew/{pcbcfg.h => pcbnew_config.h} (100%) diff --git a/common/about_kicad.cpp b/common/about_kicad.cpp index def6666570..d6495451e5 100644 --- a/common/about_kicad.cpp +++ b/common/about_kicad.cpp @@ -8,7 +8,7 @@ #include "appl_wxstruct.h" -#define BUILD_VERSION "(20091024-unstable)" +#define BUILD_VERSION "(20091027-unstable)" #ifdef HAVE_SVN_VERSION diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index cd6a18f1a3..6212ebf6cf 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -38,7 +38,7 @@ set(EESCHEMA_SRCS database.cpp delete.cpp delsheet.cpp -# dialog_backanno.cpp + dialog_annotate_base.cpp dialog_bodygraphictext_properties_base.cpp dialog_build_BOM.cpp dialog_build_BOM_base.cpp diff --git a/eeschema/annotate_dialog.cpp b/eeschema/annotate_dialog.cpp index 05739bac36..9cf43da6b1 100644 --- a/eeschema/annotate_dialog.cpp +++ b/eeschema/annotate_dialog.cpp @@ -1,244 +1,87 @@ ///////////////////////////////////////////////////////////////////////////// // Name: annotate_dialog.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 16/04/2008 17:50:59 -// RCS-ID: -// Copyright: License GNU -// Licence: +// Licence: License GNU ///////////////////////////////////////////////////////////////////////////// -// Generated by DialogBlocks (unregistered), 16/04/2008 17:50:59 - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "annotate_dialog.h" -#endif - -////@begin includes -////@end includes #include "fctsys.h" +#include "appl_wxstruct.h" #include "bitmaps.h" #include "common.h" #include "program.h" #include "annotate_dialog.h" +#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption") + extern void AnnotateComponents( WinEDA_SchematicFrame* parent, bool annotateSchematic, int sortOption, bool resetAnnotation, bool repairsTimestamps ); -////@begin XPM images -////@end XPM images - -/*! - * WinEDA_AnnotateFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_AnnotateFrame, wxDialog ) - - -/*! - * WinEDA_AnnotateFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_AnnotateFrame, wxDialog ) - -////@begin WinEDA_AnnotateFrame event table entries - EVT_BUTTON( wxID_CANCEL, WinEDA_AnnotateFrame::OnCancelClick ) - - EVT_BUTTON( ID_CLEAR_ANNOTATION_CMP, WinEDA_AnnotateFrame::OnClearAnnotationCmpClick ) - - EVT_BUTTON( wxID_APPLY, WinEDA_AnnotateFrame::OnApplyClick ) - -////@end WinEDA_AnnotateFrame event table entries - -END_EVENT_TABLE() - - -/*! - * WinEDA_AnnotateFrame constructors - */ - -WinEDA_AnnotateFrame::WinEDA_AnnotateFrame() -{ - Init(); -} - -WinEDA_AnnotateFrame::WinEDA_AnnotateFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) +DIALOG_ANNOTATE::DIALOG_ANNOTATE( WinEDA_SchematicFrame* parent ) + : DIALOG_ANNOTATE_BASE( parent ) { m_Parent = parent; - Init(); - Create(parent, id, caption, pos, size, style); -} - - -/*! - * WinEDA_AnnotateFrame creator - */ - -bool WinEDA_AnnotateFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin WinEDA_AnnotateFrame creation - SetExtraStyle(wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - if (GetSizer()) - { - GetSizer()->SetSizeHints(this); - } + InitValues(); + Layout(); + GetSizer()->SetSizeHints(this); Centre(); -////@end WinEDA_AnnotateFrame creation - return true; } -/*! - * WinEDA_AnnotateFrame destructor - */ - -WinEDA_AnnotateFrame::~WinEDA_AnnotateFrame() +/*********************************/ +void DIALOG_ANNOTATE::InitValues() +/*********************************/ { -////@begin WinEDA_AnnotateFrame destruction -////@end WinEDA_AnnotateFrame destruction + m_Config = wxGetApp().m_EDA_Config; + SetFocus(); // needed to close dialog by escape key + if( m_Config ) + { + long option; + m_Config->Read(KEY_ANNOTATE_SORT_OPTION, &option, 0l); + switch( option ) + { + case 0: + m_rbSortBy_X_Position->SetValue(1); + break; + + + case 1: + m_rbSortBy_Y_Position->SetValue(1); + break; + + + case 2: + rbSortByValue->SetValue(1); + break; + + default: + break; + } + } + + wxBitmap bitmap0(annotate_down_right_xpm); + annotate_down_right_bitmap->SetBitmap(bitmap0); + wxBitmap bitmap1(annotate_right_down_xpm); + annotate_right_down_bitmap->SetBitmap(bitmap1); + wxBitmap bitmap2(add_text_xpm); + annotate_by_value_bitmap->SetBitmap(bitmap2); } -/*! - * Member initialisation - */ - -void WinEDA_AnnotateFrame::Init() -{ -////@begin WinEDA_AnnotateFrame member initialisation - m_rbEntireSchematic = NULL; - m_rbKeepAnnotation = NULL; - m_rbResetAnnotation = NULL; - m_rbSortBy_X_Position = NULL; - m_rbSortBy_Y_Position = NULL; - rbSortByValue = NULL; - sizerDialogButtons = NULL; - m_btnClose = NULL; - m_btnClear = NULL; - m_btnApply = NULL; -////@end WinEDA_AnnotateFrame member initialisation -} - - -/*! - * Control creation for WinEDA_AnnotateFrame - */ - -void WinEDA_AnnotateFrame::CreateControls() -{ -////@begin WinEDA_AnnotateFrame content construction - // Generated by DialogBlocks, 29/04/2009 13:38:10 (unregistered) - - WinEDA_AnnotateFrame* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); - itemDialog1->SetSizer(itemBoxSizer2); - - wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5); - - wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Scope"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText4->SetFont(wxFont(int(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize()*1.2), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFaceName())); - itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxALL, 5); - - wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer5, 0, wxGROW|wxLEFT, 25); - - m_rbEntireSchematic = new wxRadioButton( itemDialog1, ID_ENTIRE_SCHEMATIC, _("Use the &entire schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_rbEntireSchematic->SetValue(true); - itemBoxSizer5->Add(m_rbEntireSchematic, 0, wxGROW|wxALL, 5); - - wxRadioButton* itemRadioButton7 = new wxRadioButton( itemDialog1, ID_CURRENT_PAGE, _("Use the current &page only"), wxDefaultPosition, wxDefaultSize, 0 ); - itemRadioButton7->SetValue(false); - itemBoxSizer5->Add(itemRadioButton7, 0, wxGROW|wxALL, 5); - - wxStaticLine* itemStaticLine8 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - itemBoxSizer5->Add(itemStaticLine8, 0, wxGROW|wxALL, 5); - - m_rbKeepAnnotation = new wxRadioButton( itemDialog1, ID_KEEP_ANNOTATION, _("&Keep existing annotation"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_rbKeepAnnotation->SetValue(true); - itemBoxSizer5->Add(m_rbKeepAnnotation, 0, wxGROW|wxALL, 5); - - m_rbResetAnnotation = new wxRadioButton( itemDialog1, ID_RESET_ANNOTATION, _("&Reset existing annotation"), wxDefaultPosition, wxDefaultSize, 0 ); - m_rbResetAnnotation->SetValue(false); - itemBoxSizer5->Add(m_rbResetAnnotation, 0, wxGROW|wxALL, 5); - - wxStaticText* itemStaticText11 = new wxStaticText( itemDialog1, wxID_STATIC, _("Order"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText11->SetFont(wxFont(int(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetPointSize()*1.2), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFamily(), wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetStyle(), wxBOLD, false, wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).GetFaceName())); - itemBoxSizer3->Add(itemStaticText11, 0, wxALIGN_LEFT|wxALL, 5); - - wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer12, 0, wxGROW|wxLEFT, 25); - - wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer12->Add(itemBoxSizer13, 0, wxGROW, 5); - - wxStaticBitmap* itemStaticBitmap14 = new wxStaticBitmap( itemDialog1, wxID_STATIC, itemDialog1->GetBitmapResource(wxT("annotate_down_right_xpm")), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer13->Add(itemStaticBitmap14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - m_rbSortBy_X_Position = new wxRadioButton( itemDialog1, ID_SORT_BY_X_POSITION, _("Sort components by &X position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_rbSortBy_X_Position->SetValue(true); - itemBoxSizer13->Add(m_rbSortBy_X_Position, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer12->Add(itemBoxSizer16, 0, wxGROW, 5); - - wxStaticBitmap* itemStaticBitmap17 = new wxStaticBitmap( itemDialog1, wxID_STATIC, itemDialog1->GetBitmapResource(wxT("annotate_right_down_xpm")), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer16->Add(itemStaticBitmap17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - m_rbSortBy_Y_Position = new wxRadioButton( itemDialog1, ID_SORT_BY_Y_POSITION, _("Sort components by &Y position"), wxDefaultPosition, wxDefaultSize, 0 ); - m_rbSortBy_Y_Position->SetValue(false); - itemBoxSizer16->Add(m_rbSortBy_Y_Position, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer12->Add(itemBoxSizer19, 0, wxGROW, 5); - - wxStaticBitmap* itemStaticBitmap20 = new wxStaticBitmap( itemDialog1, wxID_STATIC, itemDialog1->GetBitmapResource(wxT("add_text_xpm")), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer19->Add(itemStaticBitmap20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - rbSortByValue = new wxRadioButton( itemDialog1, ID_SORT_BY_VALUE, _("Sort components by &value"), wxDefaultPosition, wxDefaultSize, 0 ); - rbSortByValue->SetValue(false); - itemBoxSizer19->Add(rbSortByValue, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - sizerDialogButtons = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer2->Add(sizerDialogButtons, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - m_btnClose = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - m_btnClose->SetDefault(); - sizerDialogButtons->Add(m_btnClose, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - m_btnClear = new wxButton( itemDialog1, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 ); - sizerDialogButtons->Add(m_btnClear, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - m_btnApply = new wxButton( itemDialog1, wxID_APPLY, _("Annotation"), wxDefaultPosition, wxDefaultSize, 0 ); - m_btnApply->SetDefault(); - sizerDialogButtons->Add(m_btnApply, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - -////@end WinEDA_AnnotateFrame content construction - - m_btnClose->SetFocus(); // needed to closes dialog by escape key -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY - */ - -void WinEDA_AnnotateFrame::OnApplyClick( wxCommandEvent& event ) +/*********************************************************/ +void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) +/*********************************************************/ { int response; wxString message; + if( m_Config ) + m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder()); + if( GetResetItems() ) message = _( "Clear and annotate all of the components " ); else @@ -259,11 +102,9 @@ void WinEDA_AnnotateFrame::OnApplyClick( wxCommandEvent& event ) } -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DEANNOTATE_CMP - */ - -void WinEDA_AnnotateFrame::OnClearAnnotationCmpClick( wxCommandEvent& event ) +/************************************************************************/ +void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event ) +/************************************************************************/ { int response; @@ -283,11 +124,9 @@ void WinEDA_AnnotateFrame::OnClearAnnotationCmpClick( wxCommandEvent& event ) } -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - */ - -void WinEDA_AnnotateFrame::OnCancelClick( wxCommandEvent& event ) +/************************************************************/ +void DIALOG_ANNOTATE::OnCancelClick( wxCommandEvent& event ) +/************************************************************/ { if( IsModal() ) EndModal( wxID_CANCEL ); @@ -299,17 +138,23 @@ void WinEDA_AnnotateFrame::OnCancelClick( wxCommandEvent& event ) } -bool WinEDA_AnnotateFrame::GetLevel( void ) +/**************************************/ +bool DIALOG_ANNOTATE::GetLevel( void ) +/**************************************/ { return m_rbEntireSchematic->GetValue(); } -bool WinEDA_AnnotateFrame::GetResetItems( void ) +/******************************************/ +bool DIALOG_ANNOTATE::GetResetItems( void ) +/******************************************/ { return m_rbResetAnnotation->GetValue(); } -int WinEDA_AnnotateFrame::GetSortOrder( void ) +/****************************************/ +int DIALOG_ANNOTATE::GetSortOrder( void ) +/****************************************/ /** * @return 0 if annotation by X position, * 1 if annotation by Y position @@ -323,51 +168,3 @@ int WinEDA_AnnotateFrame::GetSortOrder( void ) return 2; } - - -/*! - * Should we show tooltips? - */ - -bool WinEDA_AnnotateFrame::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_AnnotateFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval - if (name == wxT("annotate_down_right_xpm")) - { - wxBitmap bitmap(annotate_down_right_xpm); - return bitmap; - } - else if (name == wxT("annotate_right_down_xpm")) - { - wxBitmap bitmap(annotate_right_down_xpm); - return bitmap; - } - else if (name == wxT("add_text_xpm")) - { - wxBitmap bitmap(add_text_xpm); - return bitmap; - } - return wxNullBitmap; -} - -/*! - * Get icon resources - */ - -wxIcon WinEDA_AnnotateFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_AnnotateFrame icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end WinEDA_AnnotateFrame icon retrieval -} diff --git a/eeschema/annotate_dialog.h b/eeschema/annotate_dialog.h index f1c1299e88..e25c24b8d8 100644 --- a/eeschema/annotate_dialog.h +++ b/eeschema/annotate_dialog.h @@ -1,132 +1,56 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: annotate_dialog.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 16/04/2008 17:50:59 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 16/04/2008 17:50:59 +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2009 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 + */ #ifndef _ANNOTATE_DIALOG_H_ #define _ANNOTATE_DIALOG_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "annotate_dialog.h" -#endif +#include "dialog_annotate_base.h" /*! - * Includes + * DIALOG_ANNOTATE class declaration */ -////@begin includes -#include "wx/statline.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxBoxSizer; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define ID_ENTIRE_SCHEMATIC 10002 -#define ID_CURRENT_PAGE 10003 -#define ID_KEEP_ANNOTATION 10009 -#define ID_RESET_ANNOTATION 10009 -#define ID_SORT_BY_X_POSITION 10001 -#define ID_SORT_BY_Y_POSITION 10001 -#define ID_SORT_BY_VALUE 10011 -#define ID_CLEAR_ANNOTATION_CMP 10004 -#define SYMBOL_WINEDA_ANNOTATEFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER -#define SYMBOL_WINEDA_ANNOTATEFRAME_TITLE _("EESchema Annotation") -#define SYMBOL_WINEDA_ANNOTATEFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_ANNOTATEFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_ANNOTATEFRAME_POSITION wxDefaultPosition -////@end control identifiers - - -/*! - * WinEDA_AnnotateFrame class declaration - */ - -class WinEDA_AnnotateFrame: public wxDialog +class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE { - DECLARE_DYNAMIC_CLASS( WinEDA_AnnotateFrame ) - DECLARE_EVENT_TABLE() +private: + WinEDA_SchematicFrame * m_Parent; + wxConfig* m_Config; public: - /// Constructors - WinEDA_AnnotateFrame(); - WinEDA_AnnotateFrame( WinEDA_SchematicFrame* parent, wxWindowID id = SYMBOL_WINEDA_ANNOTATEFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_ANNOTATEFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_ANNOTATEFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_ANNOTATEFRAME_SIZE, long style = SYMBOL_WINEDA_ANNOTATEFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_ANNOTATEFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_ANNOTATEFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_ANNOTATEFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_ANNOTATEFRAME_SIZE, long style = SYMBOL_WINEDA_ANNOTATEFRAME_STYLE ); - - /// Destructor - ~WinEDA_AnnotateFrame(); + DIALOG_ANNOTATE( WinEDA_SchematicFrame* parent ); + ~DIALOG_ANNOTATE(){}; /// Initialises member variables - void Init(); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_AnnotateFrame event handler declarations - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL + void InitValues(); void OnCancelClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR_ANNOTATION_CMP void OnClearAnnotationCmpClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY void OnApplyClick( wxCommandEvent& event ); -////@end WinEDA_AnnotateFrame event handler declarations - -////@begin WinEDA_AnnotateFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_AnnotateFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - // User functions: bool GetLevel( void ); bool GetResetItems( void ); int GetSortOrder( void ); -////@begin WinEDA_AnnotateFrame member variables - wxRadioButton* m_rbEntireSchematic; - wxRadioButton* m_rbKeepAnnotation; - wxRadioButton* m_rbResetAnnotation; - wxRadioButton* m_rbSortBy_X_Position; - wxRadioButton* m_rbSortBy_Y_Position; - wxRadioButton* rbSortByValue; - wxBoxSizer* sizerDialogButtons; - wxButton* m_btnClose; - wxButton* m_btnClear; - wxButton* m_btnApply; -////@end WinEDA_AnnotateFrame member variables - - WinEDA_SchematicFrame * m_Parent; - }; #endif diff --git a/eeschema/class_sch_component.cpp b/eeschema/class_sch_component.cpp index a0ccd9ab69..8c0b95fa5a 100644 --- a/eeschema/class_sch_component.cpp +++ b/eeschema/class_sch_component.cpp @@ -408,6 +408,13 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) } rf->m_Text = ref; // for drawing. + + // Reinit the m_PrefixString member if needed + wxString prefix = ref; + while( prefix.Last() == '?' or isdigit(prefix.Last()) ) + prefix.RemoveLast(); + if( m_PrefixString != prefix ) + m_PrefixString = prefix; } /** function SetTimeStamp diff --git a/eeschema/dialog_annotate_base.cpp b/eeschema/dialog_annotate_base.cpp new file mode 100644 index 0000000000..7828efd2f0 --- /dev/null +++ b/eeschema/dialog_annotate_base.cpp @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_annotate_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bmainSizer; + bmainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bupperSizer; + bupperSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextScope = new wxStaticText( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextScope->Wrap( -1 ); + m_staticTextScope->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bupperSizer->Add( m_staticTextScope, 0, wxALL, 5 ); + + wxBoxSizer* bscopeOptSizer; + bscopeOptSizer = new wxBoxSizer( wxVERTICAL ); + + m_rbEntireSchematic = new wxRadioButton( this, ID_ENTIRE_SCHEMATIC, _("Use the &entire schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + bscopeOptSizer->Add( m_rbEntireSchematic, 0, wxALL, 5 ); + + m_rbCurrPage = new wxRadioButton( this, ID_CURRENT_PAGE, _("Use the current &page only"), wxDefaultPosition, wxDefaultSize, 0 ); + bscopeOptSizer->Add( m_rbCurrPage, 0, wxALL, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bscopeOptSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_rbKeepAnnotation = new wxRadioButton( this, ID_KEEP_ANNOTATION, _("&Keep existing annotation"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + bscopeOptSizer->Add( m_rbKeepAnnotation, 0, wxALL, 5 ); + + m_rbResetAnnotation = new wxRadioButton( this, ID_RESET_ANNOTATION, _("&Reset existing annotation"), wxDefaultPosition, wxDefaultSize, 0 ); + bscopeOptSizer->Add( m_rbResetAnnotation, 0, wxALL, 5 ); + + bupperSizer->Add( bscopeOptSizer, 0, wxEXPAND|wxLEFT|wxALIGN_RIGHT, 25 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bupperSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + + m_staticTextOrder = new wxStaticText( this, wxID_ANY, _("Annotation Order"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextOrder->Wrap( -1 ); + m_staticTextOrder->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bupperSizer->Add( m_staticTextOrder, 0, wxALL, 5 ); + + wxBoxSizer* b_orderOptSizer; + b_orderOptSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerXpos; + bSizerXpos = new wxBoxSizer( wxHORIZONTAL ); + + annotate_down_right_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerXpos->Add( annotate_down_right_bitmap, 0, wxRIGHT|wxLEFT, 5 ); + + m_rbSortBy_X_Position = new wxRadioButton( this, ID_SORT_BY_X_POSITION, _("Sort Components by &X Position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxALL, 5 ); + + b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerYpos; + bSizerYpos = new wxBoxSizer( wxHORIZONTAL ); + + annotate_right_down_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerYpos->Add( annotate_right_down_bitmap, 0, wxRIGHT|wxLEFT, 5 ); + + m_rbSortBy_Y_Position = new wxRadioButton( this, ID_SORT_BY_Y_POSITION, _("Sort Components by &Y Position"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerYpos->Add( m_rbSortBy_Y_Position, 0, wxALL, 5 ); + + b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerValuepos; + bSizerValuepos = new wxBoxSizer( wxHORIZONTAL ); + + annotate_by_value_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerValuepos->Add( annotate_by_value_bitmap, 0, wxRIGHT|wxLEFT, 5 ); + + rbSortByValue = new wxRadioButton( this, ID_SORT_BY_VALUE, _("Sort Components by &Value"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerValuepos->Add( rbSortByValue, 0, wxALL, 5 ); + + b_orderOptSizer->Add( bSizerValuepos, 0, wxEXPAND, 5 ); + + bupperSizer->Add( b_orderOptSizer, 1, wxEXPAND|wxLEFT, 25 ); + + bmainSizer->Add( bupperSizer, 1, wxEXPAND|wxLEFT, 5 ); + + m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bmainSizer->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* bButtonsSizer; + bButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_btnClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 ); + + m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 ); + bButtonsSizer->Add( m_btnClear, 0, wxALL|wxEXPAND, 5 ); + + m_btnApply = new wxButton( this, wxID_APPLY, _("Annotation"), wxDefaultPosition, wxDefaultSize, 0 ); + bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 ); + + bmainSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bmainSizer ); + this->Layout(); + + // Connect Events + m_btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this ); + m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); + m_btnApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); +} + +DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE() +{ + // Disconnect Events + m_btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this ); + m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); + m_btnApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); +} diff --git a/eeschema/dialog_annotate_base.fbp b/eeschema/dialog_annotate_base.fbp new file mode 100644 index 0000000000..92df6deeeb --- /dev/null +++ b/eeschema/dialog_annotate_base.fbp @@ -0,0 +1,1074 @@ + + + + + + C++ + 1 + UTF-8 + connect + dialog_annotate_base + 1000 + none + 1 + dialog_annotate_base + + . + + 1 + 0 + 0 + + + + + 1 + + + + 0 + wxID_ANY + + + DIALOG_ANNOTATE_BASE + + 331,338 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bmainSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxLEFT + 1 + + + bupperSizer + wxVERTICAL + none + + 5 + wxALL + 0 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + Scope + + + m_staticTextScope + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 25 + wxEXPAND|wxLEFT|wxALIGN_RIGHT + 0 + + + bscopeOptSizer + wxVERTICAL + none + + 5 + wxALL + 0 + + + + 1 + + + 0 + ID_ENTIRE_SCHEMATIC + Use the &entire schematic + + + m_rbEntireSchematic + protected + + + wxRB_GROUP + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + ID_CURRENT_PAGE + Use the current &page only + + + m_rbCurrPage + protected + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline1 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + ID_KEEP_ANNOTATION + &Keep existing annotation + + + m_rbKeepAnnotation + protected + + + wxRB_GROUP + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + ID_RESET_ANNOTATION + &Reset existing annotation + + + m_rbResetAnnotation + protected + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline2 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + Annotation Order + + + m_staticTextOrder + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 25 + wxEXPAND|wxLEFT + 1 + + + b_orderOptSizer + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizerXpos + wxHORIZONTAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + + ; Load From Resource + + 1 + + + 0 + wxID_ANY + + + annotate_down_right_bitmap + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + ID_SORT_BY_X_POSITION + Sort Components by &X Position + + + m_rbSortBy_X_Position + protected + + + wxRB_GROUP + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerYpos + wxHORIZONTAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + + ; Load From Resource + + 1 + + + 0 + wxID_ANY + + + annotate_right_down_bitmap + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + ID_SORT_BY_Y_POSITION + Sort Components by &Y Position + + + m_rbSortBy_Y_Position + protected + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerValuepos + wxHORIZONTAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + + ; Load From Resource + + 1 + + + 0 + wxID_ANY + + + annotate_by_value_bitmap + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + ID_SORT_BY_VALUE + Sort Components by &Value + + + rbSortByValue + protected + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline5 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + + bButtonsSizer + wxHORIZONTAL + none + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Close + + + m_btnClose + protected + + + + + + + + + OnCancelClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + ID_CLEAR_ANNOTATION_CMP + Clear Annotation + + + m_btnClear + protected + + + + + + + + + OnClearAnnotationCmpClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_APPLY + Annotation + + + m_btnApply + protected + + + + + + + + + OnApplyClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eeschema/dialog_annotate_base.h b/eeschema/dialog_annotate_base.h new file mode 100644 index 0000000000..fc902b65c1 --- /dev/null +++ b/eeschema/dialog_annotate_base.h @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_annotate_base__ +#define __dialog_annotate_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#define ID_ENTIRE_SCHEMATIC 1000 +#define ID_CURRENT_PAGE 1001 +#define ID_KEEP_ANNOTATION 1002 +#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 + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_ANNOTATE_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_ANNOTATE_BASE : public wxDialog +{ + private: + + protected: + wxStaticText* m_staticTextScope; + wxRadioButton* m_rbEntireSchematic; + wxRadioButton* m_rbCurrPage; + wxStaticLine* m_staticline1; + wxRadioButton* m_rbKeepAnnotation; + wxRadioButton* m_rbResetAnnotation; + wxStaticLine* m_staticline2; + wxStaticText* m_staticTextOrder; + wxStaticBitmap* annotate_down_right_bitmap; + wxRadioButton* m_rbSortBy_X_Position; + wxStaticBitmap* annotate_right_down_bitmap; + wxRadioButton* m_rbSortBy_Y_Position; + wxStaticBitmap* annotate_by_value_bitmap; + wxRadioButton* rbSortByValue; + wxStaticLine* m_staticline5; + wxButton* m_btnClose; + wxButton* m_btnClear; + wxButton* m_btnApply; + + // Virtual event handlers, overide them in your derived class + virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnClearAnnotationCmpClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnApplyClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 331,338 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_ANNOTATE_BASE(); + +}; + +#endif //__dialog_annotate_base__ diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 7aaead1513..3fd57f419a 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -14,7 +14,7 @@ #include "program.h" #include "general.h" #include "protos.h" -#include "eeconfig.h" +#include "eeschema_config.h" #include "worksheet.h" #include "hotkeys.h" diff --git a/eeschema/eeconfig.h b/eeschema/eeschema_config.h similarity index 100% rename from eeschema/eeconfig.h rename to eeschema/eeschema_config.h diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 03eeb54e62..1653e0af33 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -488,7 +488,7 @@ void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event ) void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event ) /**************************************************************/ { - WinEDA_AnnotateFrame* dlg = new WinEDA_AnnotateFrame( this ); + DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this ); dlg->ShowModal(); dlg->Destroy(); diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 2d340a8c33..8ef76dc938 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -13,7 +13,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "pcbplot.h" -#include "pcbcfg.h" +#include "pcbnew_config.h" #include "worksheet.h" #include "pcbnew_id.h" #include "hotkeys.h" diff --git a/pcbnew/pcbcfg.h b/pcbnew/pcbnew_config.h similarity index 100% rename from pcbnew/pcbcfg.h rename to pcbnew/pcbnew_config.h