From 803ebdf3c4694d06b29636d4203997bc682131b2 Mon Sep 17 00:00:00 2001 From: stambaughw Date: Wed, 27 Feb 2008 19:38:16 +0000 Subject: [PATCH] Fix escape key handling in annotate dialog and some eeschema code refactoring. --- CMakeLists.txt | 25 ++- change_log.txt | 13 ++ eeschema/affiche.cpp | 2 + eeschema/annotate.cpp | 5 +- eeschema/annotate_dialog.cpp | 34 +++- eeschema/annotate_dialog.h | 3 + eeschema/block.cpp | 2 + eeschema/bus-wire-junction.cpp | 2 + eeschema/busentry.cpp | 1 + eeschema/class_drawsheet.cpp | 1 + eeschema/class_screen.cpp | 2 + eeschema/class_text-label.cpp | 1 + eeschema/cleanup.cpp | 1 + eeschema/component_class.cpp | 3 + eeschema/controle.cpp | 2 + eeschema/cross-probing.cpp | 2 + eeschema/dangling_ends.cpp | 3 + eeschema/delete.cpp | 2 + eeschema/delsheet.cpp | 1 + eeschema/dialog_build_BOM.cpp | 8 - eeschema/dialog_eeschema_config.cpp | 2 + eeschema/dialog_erc.cpp | 1 + eeschema/edit_component_in_schematic.cpp | 2 + eeschema/edit_label.cpp | 2 + eeschema/eeconfig.cpp | 2 + eeschema/eecreate.cpp | 4 + eeschema/eeredraw.cpp | 2 + eeschema/eeschema.cpp | 2 + eeschema/erc.cpp | 13 +- eeschema/files-io.cpp | 2 + eeschema/find.cpp | 13 +- eeschema/getpart.cpp | 2 + eeschema/hierarch.cpp | 2 + eeschema/hotkeys.cpp | 2 + eeschema/load_one_schematic_file.cpp | 2 + eeschema/menubar.cpp | 2 + eeschema/netform.cpp | 1 + eeschema/netlist.cpp | 2 + eeschema/netlist_control.cpp | 119 +---------- eeschema/netlist_control.h | 92 +++++++++ eeschema/onleftclick.cpp | 2 + eeschema/onrightclick.cpp | 2 + eeschema/plothpgl.cpp | 2 + eeschema/plotps.cpp | 2 + eeschema/protos.h | 15 -- eeschema/save_schemas.cpp | 2 + eeschema/schedit.cpp | 205 +------------------ eeschema/schematic_undo_redo.cpp | 2 + eeschema/schframe.cpp | 193 +++++++++++++++--- eeschema/schframe.h | 244 +++++++++++++++++++++++ eeschema/sheet.cpp | 2 + eeschema/sheetlab.cpp | 3 + eeschema/tool_sch.cpp | 2 + include/wxstruct.h | 214 -------------------- share/svg_print.cpp | 1 + 55 files changed, 652 insertions(+), 621 deletions(-) create mode 100644 eeschema/netlist_control.h create mode 100644 eeschema/schframe.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 2342e4ad04..7ac9e1b8ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,20 +7,20 @@ # Should be set to ON only when CMAKE_BUILD_TYPE=Debug. # # wxWidgets_USE_STATIC ON/OFF (OPTIONAL) -# +# # # CMAKE_VERBOSE_MAKEFILE ON/OFF (OPTIONAL) # Turns ON/OFF verbose build messages. # You can also pass VERBOSE=1 to make for the same effect. # # CMAKE_INSTALL_PREFIX (OPTIONAL) -# +# # # KICAD_MINIZIP ON/OFF -# +# # # KICAD_PYTHON ON/OFF -# +# # # Our project is called 'kicad'. This is what it will be called in @@ -40,14 +40,17 @@ OPTION(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON) # Comment this out if you don't want to build with Python support. # OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)") -# Set default flags for Release build. -SET(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG") -SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG") -SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s") +# Set debugging flags for GCC only. +IF( CMAKE_COMPILER_IS_GCC ) + # Set default flags for Release build. + SET(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG") + SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG") + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s") -# Set default flags for Debug build. -SET(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG") -SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG") + # Set default flags for Debug build. + SET(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG") + SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG") +ENDIF( CMAKE_COMPILER_IS_GCC ) # Locations for install targets. IF(UNIX) diff --git a/change_log.txt b/change_log.txt index d2ae2fca73..494d0e47d1 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,19 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Feb-27 UPDATE Wayne Stambaugh +================================================================================ ++ eeschema + * fixed escape key handling and add accelerate keys in annotate dialog. + * factored out eeschema frame class to prevent rebuild of entire project + when making changes to eeschema frames. + * refactor main eeschema event loop by factoring out most of the non-drawing + events. ++ cmake + * small fix to root CMakeList file to prevent GCC flags being used with + other compilers. + + 2008-Feb-26 UPDATE Jean-Pierre Charras ================================================================================ +eeschema diff --git a/eeschema/affiche.cpp b/eeschema/affiche.cpp index 46039cee73..06e3daa84f 100644 --- a/eeschema/affiche.cpp +++ b/eeschema/affiche.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + /***********************************************************/ void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame ) diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index 9264026b11..3e096c2a88 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -9,8 +9,11 @@ #include "netlist.h" #include "protos.h" +#include "schframe.h" + /* Local Functions*/ -static int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet ); +static int ListeComposants( CmpListStruct* BaseListeCmp, + DrawSheetList* sheet ); static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ); diff --git a/eeschema/annotate_dialog.cpp b/eeschema/annotate_dialog.cpp index e327ff9f4f..9d7dc1ae92 100644 --- a/eeschema/annotate_dialog.cpp +++ b/eeschema/annotate_dialog.cpp @@ -28,6 +28,8 @@ #include "wx/wx.h" #endif +#include "../include/wxstruct.h" +#include "schframe.h" #include "annotate_dialog.h" extern void DeleteAnnotation( WinEDA_SchematicFrame* parent, @@ -51,6 +53,7 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_AnnotateFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_AnnotateFrame, wxDialog ) EVT_BUTTON( wxID_CLEAR, WinEDA_AnnotateFrame::OnClear ) EVT_BUTTON( wxID_APPLY, WinEDA_AnnotateFrame::OnApply ) + EVT_BUTTON( wxID_CANCEL, WinEDA_AnnotateFrame::OnCancel ) END_EVENT_TABLE() /*! @@ -156,20 +159,27 @@ void WinEDA_AnnotateFrame::CreateControls() wxBoxSizer* sizerAnnotateItems = new wxBoxSizer( wxVERTICAL ); m_rbEntireSchematic = new wxRadioButton( this, ID_ENTIRE_SCHEMATIC, - _( "Annotate the entire schematic" ), + _( "Annotate the &entire schematic" ), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); wxRadioButton* rbCurrentPage = new wxRadioButton( this, ID_CURRENT_PAGE, - _( "Annotate the current page only" ) ); + _( "Annotate the current &page only" ) ); m_rbEntireSchematic->SetValue( true ); m_cbResetAnnotation = new wxCheckBox( this, ID_RESET_ANNOTATION, - _( "Reset existing annotation" ) ); + _( "&Reset existing annotation" ) ); sizerAnnotateItems->Add( m_rbEntireSchematic, flagsRadioButtonSpacing ); sizerAnnotateItems->Add( rbCurrentPage, flagsRadioButtonSpacing ); sizerAnnotateItems->Add( m_cbResetAnnotation, flagsRadioButtonSpacing ); sizerAnnotate->Add( sizerAnnotateItems, flagsRadioButtonSizerSpacing ); sizerTop->Add( sizerAnnotate, flagsGroupSizerSpacing ); + /* This is an ugly hack to make sure the focus is set correctly so the + * escape key closes the dialog without requiring one of the controls + * to be activated by the user first. This problem only occurs on the + * GTK version of wxWidgets */ +#ifdef __WXGTK__ + m_rbEntireSchematic->SetFocus( ); +#endif /* Annotation sort order sizers, label, and radio buttons. */ wxBoxSizer* sizerSort = new wxBoxSizer( wxVERTICAL ); @@ -180,13 +190,13 @@ void WinEDA_AnnotateFrame::CreateControls() wxBoxSizer* sizerSortItems = new wxBoxSizer( wxVERTICAL ); m_rbSortByPosition = new wxRadioButton( this, ID_SORT_BY_POSITION, - _( "Sort components by position" ), + _( "Sort components by p&osition" ), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); wxRadioButton* rbSortByValue = new wxRadioButton( this, ID_SORT_BY_VALUE, - _( "Sort components by value" ) ); + _( "Sort components by &value" ) ); sizerSortItems->Add( m_rbSortByPosition, flagsRadioButtonSpacing ); sizerSortItems->Add( rbSortByValue, flagsRadioButtonSpacing ); sizerSort->Add( sizerSortItems, flagsRadioButtonSizerSpacing ); @@ -194,7 +204,7 @@ void WinEDA_AnnotateFrame::CreateControls() /* Standard dialog buttons and sizer. */ wxBoxSizer* sizerDialogButtons = new wxBoxSizer( wxHORIZONTAL ); - wxButton* btnClose = new wxButton( this, wxID_CANCEL, _( "Close" ) ); + wxButton* btnClose = new wxButton( this, wxID_CANCEL ); /* TODO: Check if there is any existing annotation and enable/disable * the clear button accordingly. Probably should also enable/ * disable new components radio button if all of the components @@ -269,7 +279,6 @@ void WinEDA_AnnotateFrame::OnClear( wxCommandEvent& event ) void WinEDA_AnnotateFrame::OnApply( wxCommandEvent& event ) { int response; - wxButton* btn; wxString message; if( GetResetItems() ) @@ -292,6 +301,17 @@ void WinEDA_AnnotateFrame::OnApply( wxCommandEvent& event ) m_btnClear->Enable(); } +void WinEDA_AnnotateFrame::OnCancel( wxCommandEvent& event ) +{ + if( IsModal() ) + EndModal( wxID_CANCEL ); + else + { + SetReturnCode( wxID_CANCEL ); + this->Show( false ); + } +} + bool WinEDA_AnnotateFrame::GetLevel( void ) { wxASSERT_MSG( ((m_rbEntireSchematic != NULL) && diff --git a/eeschema/annotate_dialog.h b/eeschema/annotate_dialog.h index 6119904879..bfb491852b 100644 --- a/eeschema/annotate_dialog.h +++ b/eeschema/annotate_dialog.h @@ -99,8 +99,11 @@ public: WinEDA_SchematicFrame* m_Parent; private: + void CloseDialog( void ); + void OnClear( wxCommandEvent& event ); void OnApply( wxCommandEvent& event ); + void OnCancel( wxCommandEvent& event ); wxRadioButton* m_rbEntireSchematic; wxRadioButton* m_rbSortByPosition; diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 6cc74c74f6..f57946c8ca 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + /* Variables Locales */ /* Fonctions exportees */ diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 39e77cfd26..e7e6d86474 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -12,6 +12,8 @@ #include "protos.h" +#include "schframe.h" + /* Routines Locales */ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index bd0e2b5042..17335a68b8 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -13,6 +13,7 @@ #include "protos.h" +#include "schframe.h" /* Routines Locales */ diff --git a/eeschema/class_drawsheet.cpp b/eeschema/class_drawsheet.cpp index 9036e68424..f5fbdba88b 100644 --- a/eeschema/class_drawsheet.cpp +++ b/eeschema/class_drawsheet.cpp @@ -31,6 +31,7 @@ #include "general.h" #include "protos.h" +#include "schframe.h" /***********************************************************/ diff --git a/eeschema/class_screen.cpp b/eeschema/class_screen.cpp index 14233bfb08..1d3d313b55 100644 --- a/eeschema/class_screen.cpp +++ b/eeschema/class_screen.cpp @@ -8,6 +8,8 @@ #include "general.h" #include "protos.h" +#include "schframe.h" + /******************************************************************/ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) diff --git a/eeschema/class_text-label.cpp b/eeschema/class_text-label.cpp index 5235e77e0b..1aef87e297 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/class_text-label.cpp @@ -14,6 +14,7 @@ #include "id.h" #include "protos.h" +#include "schframe.h" /************************/ diff --git a/eeschema/cleanup.cpp b/eeschema/cleanup.cpp index 8a639a0779..29569b6bdb 100644 --- a/eeschema/cleanup.cpp +++ b/eeschema/cleanup.cpp @@ -12,6 +12,7 @@ #include "netlist.h" #include "macros.h" #include "protos.h" +#include "schframe.h" /* Routines locales */ diff --git a/eeschema/component_class.cpp b/eeschema/component_class.cpp index 0d708a693e..afcec247d7 100644 --- a/eeschema/component_class.cpp +++ b/eeschema/component_class.cpp @@ -15,9 +15,12 @@ #include "protos.h" #include "macros.h" +#include "schframe.h" #include + WX_DEFINE_OBJARRAY( ArrayOfSheetLists ); + /***************************/ /* class DrawPartStruct */ /* class EDA_SchComponentStruct */ diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 39eb93c259..45ede70dc8 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -17,6 +17,8 @@ #include "protos.h" +#include "schframe.h" + /**************************************************************/ EDA_BaseStruct* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin ) diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index 00c2391825..4fcaf8443f 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -15,6 +15,8 @@ #include "protos.h" +#include "schframe.h" + /***************************************************************/ void RemoteCommand( const char* cmdline ) diff --git a/eeschema/dangling_ends.cpp b/eeschema/dangling_ends.cpp index b8b536144d..aa8401d7eb 100644 --- a/eeschema/dangling_ends.cpp +++ b/eeschema/dangling_ends.cpp @@ -12,6 +12,9 @@ #include "netlist.h" /* Definitions generales liees au calcul de netliste */ #include "protos.h" +#include "schframe.h" + + enum End_Type { UNKNOWN = 0, WIRE_START_END, diff --git a/eeschema/delete.cpp b/eeschema/delete.cpp index 78f66c96b7..cd49c8e602 100644 --- a/eeschema/delete.cpp +++ b/eeschema/delete.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + /********************************************************************************/ static int CountConnectedItems(WinEDA_SchematicFrame * frame, diff --git a/eeschema/delsheet.cpp b/eeschema/delsheet.cpp index 338c5d1a48..89d212a60f 100644 --- a/eeschema/delsheet.cpp +++ b/eeschema/delsheet.cpp @@ -11,6 +11,7 @@ #include "general.h" #include "protos.h" +#include "schframe.h" /**************************************************************************/ diff --git a/eeschema/dialog_build_BOM.cpp b/eeschema/dialog_build_BOM.cpp index ec642ef6df..ba8957725d 100644 --- a/eeschema/dialog_build_BOM.cpp +++ b/eeschema/dialog_build_BOM.cpp @@ -127,14 +127,6 @@ BEGIN_EVENT_TABLE( WinEDA_Build_BOM_Frame, wxDialog ) END_EVENT_TABLE() -/***************************************************************/ -void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint & pos) -/***************************************************************/ -{ - WinEDA_Build_BOM_Frame * frame = new WinEDA_Build_BOM_Frame(parent); - frame->ShowModal(); - frame->Destroy(); -} /*! * WinEDA_Build_BOM_Frame constructors diff --git a/eeschema/dialog_eeschema_config.cpp b/eeschema/dialog_eeschema_config.cpp index 47eb1ece0f..abcc51382a 100644 --- a/eeschema/dialog_eeschema_config.cpp +++ b/eeschema/dialog_eeschema_config.cpp @@ -40,6 +40,8 @@ #include "id.h" +#include "schframe.h" + #include "dialog_eeschema_config.h" ////@begin XPM images diff --git a/eeschema/dialog_erc.cpp b/eeschema/dialog_erc.cpp index 4ecd2e8568..4e28f2f24c 100644 --- a/eeschema/dialog_erc.cpp +++ b/eeschema/dialog_erc.cpp @@ -37,6 +37,7 @@ #include "netlist.h" #include "protos.h" +#include "schframe.h" #include "dialog_erc.h" diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index ec695ad944..d543f5d014 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -14,6 +14,8 @@ #include "protos.h" +#include "schframe.h" + /* Fonctions exportees */ diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index eb8ef9fa28..9903bd2c3e 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + /* Fonctions locales */ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC ); diff --git a/eeschema/eeconfig.cpp b/eeschema/eeconfig.cpp index f4b0f6ed21..ea4aa93de7 100644 --- a/eeschema/eeconfig.cpp +++ b/eeschema/eeconfig.cpp @@ -15,6 +15,8 @@ #include "id.h" +#include "schframe.h" + /* Variables locales */ diff --git a/eeschema/eecreate.cpp b/eeschema/eecreate.cpp index d955aa94c3..788265de24 100644 --- a/eeschema/eecreate.cpp +++ b/eeschema/eecreate.cpp @@ -12,6 +12,10 @@ #include "protos.h" +#include "schframe.h" + +#include "schframe.h" + /* Routines Locales */ static void Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 2c58ec083a..19107948c7 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + char marq_bitmap[]= { diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 8ed3c35cdb..4373795257 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -23,6 +23,8 @@ #include "protos.h" #include "bitmaps.h" #include "eda_dde.h" +#include "schframe.h" + // Global variables wxString g_Main_Title( wxT( "EESchema" ) ); diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 09f56ad287..21cc3fb235 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -12,6 +12,7 @@ #include "protos.h" +#include "schframe.h" #include "../bitmaps/ercgreen.xpm" #include "../bitmaps/ercwarn.xpm" @@ -145,18 +146,6 @@ static int MinimalReq[PIN_NMAX][PIN_NMAX] = }; -/*************************************************************/ -void InstallErcFrame( WinEDA_SchematicFrame* parent, wxPoint& pos ) -/*************************************************************/ - -/* Install function for the ERC dialog frame - */ -{ - WinEDA_ErcFrame* frame = new WinEDA_ErcFrame( parent ); - - frame->ShowModal(); frame->Destroy(); -} - /*********************************************/ void WinEDA_ErcFrame::ReBuildMatrixPanel() diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 461561944f..a6ff810fce 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -13,6 +13,8 @@ #include "protos.h" #include "id.h" +#include "schframe.h" + /* Fonctions locales */ diff --git a/eeschema/find.cpp b/eeschema/find.cpp index eee30927f0..e70b2db46e 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -15,6 +15,8 @@ #include "libcmp.h" #include "general.h" +#include "schframe.h" + /* Variables Locales */ static int s_ItemsCount, s_MarkerCount; static wxString s_OldStringFound; @@ -25,17 +27,6 @@ static wxString s_OldStringFound; #include "protos.h" -/**************************************************************/ -void InstallFindFrame( WinEDA_SchematicFrame* parent, wxPoint& pos ) -/**************************************************************/ -{ - parent->DrawPanel->m_IgnoreMouseEvents = TRUE; - WinEDA_FindFrame* frame = new WinEDA_FindFrame( parent ); - frame->ShowModal(); frame->Destroy(); - parent->DrawPanel->m_IgnoreMouseEvents = FALSE; -} - - /**************************************************************/ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event ) /**************************************************************/ diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 369baf4de0..5292c48de0 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + /* Routines Locales */ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index d05c925930..5457182b23 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -12,6 +12,8 @@ #include "protos.h" +#include "schframe.h" + #include "wx/image.h" #include "wx/imaglist.h" #include "wx/treectrl.h" diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index c99621aed0..bf5f91f0ba 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -17,6 +17,8 @@ #include "protos.h" +#include "schframe.h" + /* How to add a new hotkey: * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see hotkeys.h). * add a new Ki_HotkeyInfo entry like: diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index 4792a74119..bc3ae0a4b9 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -14,6 +14,8 @@ #include "id.h" +#include "schframe.h" + /* Format des fichiers: * - entete: * EESchema Schematic File Version n diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 26bafb93bd..914f124fc8 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -18,6 +18,8 @@ #include "id.h" #include "hotkeys.h" +#include "schframe.h" + /************************************************/ void WinEDA_SchematicFrame::ReCreateMenuBar() diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index aa1b8f7968..32b9464313 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -13,6 +13,7 @@ #include "protos.h" +#include "schframe.h" /* Routines locales */ static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, const wxString& FullFileName ); diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 33139d22ba..b72cabdf9f 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -12,6 +12,8 @@ #include "netlist.h" /* Definitions generales liees au calcul de netliste */ #include "protos.h" +#include "schframe.h" + //#define NETLIST_DEBUG /* Routines locales */ diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index bbb3420756..a751c3d27e 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -22,41 +22,15 @@ #include "netlist.h" #include "protos.h" +#include "schframe.h" +#include "netlist_control.h" + // ID for configuration: #define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" ) #define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" ) /* Loacl variable */ -/* Event id for notebook page buttons: */ -enum id_netlist { - ID_CREATE_NETLIST = 1550, - ID_CURRENT_FORMAT_IS_DEFAULT, - ID_RUN_SIMULATOR, - ID_SETUP_PLUGIN, - ID_VALIDATE_PLUGIN, - ID_DELETE_PLUGIN, - ID_NETLIST_NOTEBOOK -}; - -/* panel (notebook page) identifiers */ -enum panel_netlist_index { - PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */ - PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */ - PANELCADSTAR, /* Handle Netlist format CadStar */ - PANELSPICE, /* Handle Netlist format Pspice */ - PANELCUSTOMBASE /* First auxiliary panel (custom netlists). - * others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */ -}; - -/* Values returned when the netlist dialog is demiss */ -enum gen_netlist_diag { - NET_OK, - NET_ABORT, - NET_PLUGIN_CHANGE -}; - - /****************************************************/ wxString ReturnUserNetlistTypeName( bool first_item ) /****************************************************/ @@ -87,63 +61,6 @@ wxString ReturnUserNetlistTypeName( bool first_item ) } -/************************/ -/* Class declarations : */ -/************************/ - -/* wxPanels for creating the NoteBook pages for each netlist format: - */ -class EDA_NoteBookPage : public wxPanel -{ -public: - int m_IdNetType; - wxCheckBox* m_IsCurrentFormat; - WinEDA_EnterText* m_CommandStringCtrl; - WinEDA_EnterText* m_TitleStringCtrl; - wxButton* m_ButtonCancel; - wxBoxSizer* m_LeftBoxSizer; - wxBoxSizer* m_RightBoxSizer; - wxBoxSizer* m_RightOptionsBoxSizer; - wxBoxSizer* m_LowBoxSizer; - - EDA_NoteBookPage( wxNotebook* parent, const wxString& title, - int id_NetType, int idCheckBox, int idCreateFile ); - ~EDA_NoteBookPage() { }; -}; - - -/* Dialog frame for creating netlists */ -class WinEDA_NetlistFrame : public wxDialog -{ -public: - WinEDA_SchematicFrame* m_Parent; - wxNotebook* m_NoteBook; - EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; - - wxRadioBox* m_UseNetNamesInNetlist; - -public: - - // Constructor and destructor - WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent, wxPoint& pos ); - ~WinEDA_NetlistFrame() { }; - -private: - void InstallCustomPages(); - void InstallPageSpice(); - void GenNetlist( wxCommandEvent& event ); - void RunSimulator( wxCommandEvent& event ); - void NetlistUpdateOpt(); - void OnCancelClick( wxCommandEvent& event ); - void SelectNetlistType( wxCommandEvent& event ); - void SetupPluginData( wxCommandEvent& event ); - void DeletePluginPanel( wxCommandEvent& event ); - void ValidatePluginPanel( wxCommandEvent& event ); - - void WriteCurrentNetlistSetup( void ); - - DECLARE_EVENT_TABLE() -}; BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog ) EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick ) @@ -156,29 +73,6 @@ EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator ) END_EVENT_TABLE() -/*********************************************************************/ -void InstallNetlistFrame( WinEDA_SchematicFrame* parent, wxPoint& pos ) -/*********************************************************************/ - -/* Installator for the netlist generation dialog box - */ -{ - int ii; - - if ( g_NetFormat < NET_TYPE_PCBNEW ) - g_NetFormat = NET_TYPE_PCBNEW; - - do - { - WinEDA_NetlistFrame* frame = new WinEDA_NetlistFrame( parent, pos ); - - ii = frame->ShowModal(); - frame->Destroy(); - } while( ii == NET_PLUGIN_CHANGE ); - - // If a plugin is removed or added, rebuild and reopen the new dialog -} - /*******************************/ /* Functions for these classes */ @@ -271,8 +165,8 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title, /*************************************************************************************/ -WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent, wxPoint& framepos ) : - wxDialog( parent, -1, _( "Netlist" ), framepos, +WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) : + wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition, wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER ) /*************************************************************************************/ @@ -289,8 +183,7 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent, wxPoint m_PanelNetType[ii] = NULL; } - if( framepos == wxDefaultPosition ) - Centre(); + Centre(); wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL ); SetSizer( GeneralBoxSizer ); diff --git a/eeschema/netlist_control.h b/eeschema/netlist_control.h new file mode 100644 index 0000000000..1a96375bb7 --- /dev/null +++ b/eeschema/netlist_control.h @@ -0,0 +1,92 @@ +/***************************************************************************** + * + * netlist_control.h + * + *****************************************************************************/ + +#ifndef _NETLIST_CONTROL_H_ +#define _NETLIST_CONTROL_H_ + +/* Event id for notebook page buttons: */ +enum id_netlist { + ID_CREATE_NETLIST = 1550, + ID_CURRENT_FORMAT_IS_DEFAULT, + ID_RUN_SIMULATOR, + ID_SETUP_PLUGIN, + ID_VALIDATE_PLUGIN, + ID_DELETE_PLUGIN, + ID_NETLIST_NOTEBOOK +}; + +/* panel (notebook page) identifiers */ +enum panel_netlist_index { + PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */ + PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */ + PANELCADSTAR, /* Handle Netlist format CadStar */ + PANELSPICE, /* Handle Netlist format Pspice */ + PANELCUSTOMBASE /* First auxiliary panel (custom netlists). + * others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */ +}; + +/* Values returned when the netlist dialog is demiss */ +enum gen_netlist_diag { + NET_OK, + NET_ABORT, + NET_PLUGIN_CHANGE +}; + + +/* wxPanels for creating the NoteBook pages for each netlist format: */ +class EDA_NoteBookPage : public wxPanel +{ +public: + int m_IdNetType; + wxCheckBox* m_IsCurrentFormat; + WinEDA_EnterText* m_CommandStringCtrl; + WinEDA_EnterText* m_TitleStringCtrl; + wxButton* m_ButtonCancel; + wxBoxSizer* m_LeftBoxSizer; + wxBoxSizer* m_RightBoxSizer; + wxBoxSizer* m_RightOptionsBoxSizer; + wxBoxSizer* m_LowBoxSizer; + + EDA_NoteBookPage( wxNotebook* parent, const wxString& title, + int id_NetType, int idCheckBox, int idCreateFile ); + ~EDA_NoteBookPage() { }; +}; + + +/* Dialog frame for creating netlists */ +class WinEDA_NetlistFrame : public wxDialog +{ +public: + WinEDA_SchematicFrame* m_Parent; + wxNotebook* m_NoteBook; + EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; + + wxRadioBox* m_UseNetNamesInNetlist; + +public: + + // Constructor and destructor + WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ); + ~WinEDA_NetlistFrame() { }; + +private: + void InstallCustomPages(); + void InstallPageSpice(); + void GenNetlist( wxCommandEvent& event ); + void RunSimulator( wxCommandEvent& event ); + void NetlistUpdateOpt(); + void OnCancelClick( wxCommandEvent& event ); + void SelectNetlistType( wxCommandEvent& event ); + void SetupPluginData( wxCommandEvent& event ); + void DeletePluginPanel( wxCommandEvent& event ); + void ValidatePluginPanel( wxCommandEvent& event ); + + void WriteCurrentNetlistSetup( void ); + + DECLARE_EVENT_TABLE() +}; + +#endif /* _NETLIST_CONTROL_H_ */ diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index d1dfeef16e..527dc046e9 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -15,6 +15,8 @@ #include "protos.h" +#include "schframe.h" + static wxArrayString s_CmpNameList; static wxArrayString s_PowerNameList; diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 14d8703fb4..3ab6b87e52 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -20,6 +20,8 @@ #include "bitmaps.h" +#include "schframe.h" + #include "Enter_Sheet.xpm" #include "Leave_Sheet.xpm" #include "Delete_Sheet.xpm" diff --git a/eeschema/plothpgl.cpp b/eeschema/plothpgl.cpp index 38c532fa53..feb74b48e6 100644 --- a/eeschema/plothpgl.cpp +++ b/eeschema/plothpgl.cpp @@ -41,6 +41,8 @@ #include "protos.h" +#include "schframe.h" + /* coeff de conversion dim en 1 mil -> dim en unite HPGL: */ #define SCALE_HPGL 1.02041 diff --git a/eeschema/plotps.cpp b/eeschema/plotps.cpp index 6a1f1e1670..137bd5aa54 100644 --- a/eeschema/plotps.cpp +++ b/eeschema/plotps.cpp @@ -36,6 +36,8 @@ #include "plot_common.h" #include "protos.h" +#include "schframe.h" + #include "wx/defs.h" // coeff de conversion dim en 1 mil -> dim en unite PS: diff --git a/eeschema/protos.h b/eeschema/protos.h index 6ae64fa783..c7bed1ac49 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -293,14 +293,12 @@ void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry); /* NETLIST.CPP */ /**************/ int IsBusLabel(const wxString & LabelDrawList); -void InstallNetlistFrame(WinEDA_SchematicFrame *parent, wxPoint &pos); /***************/ /* ANNOTATE.CPP */ /***************/ void ReAnnotatePowerSymbolsOnly(); -void InstallAnnotateFrame(WinEDA_SchematicFrame * parent); int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly); /* Retourne le nombre de composants non annotes ou erron�s Si OneSheetOnly : recherche sur le schema courant @@ -354,12 +352,6 @@ void DeleteOneLibraryDrawStruct(WinEDA_DrawPanel * panel, Affiche (si != 0 Efface le graphique correspondant de l'ecran) */ -/**********/ -/* ERC.CPP */ -/**********/ -void InstallErcFrame(WinEDA_SchematicFrame *parent, wxPoint & pos); - - /**************/ /* GETPART.CPP */ /**************/ @@ -408,7 +400,6 @@ bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName); /***************/ /* GENLISTE.CPP */ /***************/ -void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint &pos); struct ListComponent; int GenListeCmp( ListComponent * List ); @@ -447,12 +438,6 @@ int LocateAlias( const wxArrayString & AliasData, const wxString & Name); /* Return an index in alias data list ( -1 if not found ) */ -/************/ -/* FIND.CPP */ -/************/ -void InstallFindFrame(WinEDA_SchematicFrame *parent, wxPoint &pos); - - /***************/ /* OPTIONS.CPP */ /***************/ diff --git a/eeschema/save_schemas.cpp b/eeschema/save_schemas.cpp index 2964debfa5..68aa9f6091 100644 --- a/eeschema/save_schemas.cpp +++ b/eeschema/save_schemas.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + /* Format des fichiers: Voir EELOAD.CC */ /* Fonctions externes */ diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 285fd0aece..2794d71875 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -15,17 +15,19 @@ #include "protos.h" -/*****************************************************************************/ -void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) -/*****************************************************************************/ +#include "schframe.h" -/* Traite les selections d'outils et les commandes appelees du menu POPUP - */ + +/***************************************************************************** + * + * Traite les selections d'outils et les commandes appelees du menu POPUP + * + *****************************************************************************/ +void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) { int id = event.GetId(); wxPoint pos; wxClientDC dc( DrawPanel ); - wxPoint defaultpos( -1, -1 ); DrawPanel->PrepareGraphicContext( &dc ); @@ -36,84 +38,6 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // If needed, stop the current command and deselect current tool switch( id ) { - case ID_POPUP_SCH_ENTRY_SELECT_SLASH: // Do nothing: - case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: - case ID_POPUP_END_LINE: - case ID_POPUP_SCH_EDIT_TEXT: - case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: - case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: - case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: - case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: - case ID_POPUP_SCH_SET_SHAPE_TEXT: - case ID_POPUP_SCH_ROTATE_TEXT: - case ID_POPUP_SCH_EDIT_SHEET: - case ID_POPUP_SCH_CLEANUP_SHEET: - case ID_POPUP_SCH_END_SHEET: - case ID_POPUP_SCH_RESIZE_SHEET: - case ID_POPUP_SCH_EDIT_PINSHEET: - case ID_POPUP_SCH_MOVE_PINSHEET: - case ID_POPUP_SCH_MOVE_ITEM_REQUEST: - case ID_POPUP_SCH_MOVE_CMP_REQUEST: - case ID_POPUP_SCH_DRAG_CMP_REQUEST: - case ID_POPUP_SCH_EDIT_CMP: - case ID_POPUP_SCH_MIROR_X_CMP: - case ID_POPUP_SCH_MIROR_Y_CMP: - case ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE: - case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE: - case ID_POPUP_SCH_ORIENT_NORMAL_CMP: - case ID_POPUP_SCH_INIT_CMP: - case ID_POPUP_SCH_DISPLAYDOC_CMP: - case ID_POPUP_SCH_EDIT_VALUE_CMP: - case ID_POPUP_SCH_EDIT_REF_CMP: - case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP: - case ID_POPUP_SCH_EDIT_CONVERT_CMP: - case ID_POPUP_SCH_SELECT_UNIT_CMP: - case ID_POPUP_SCH_SELECT_UNIT1: - case ID_POPUP_SCH_SELECT_UNIT2: - case ID_POPUP_SCH_SELECT_UNIT3: - case ID_POPUP_SCH_SELECT_UNIT4: - case ID_POPUP_SCH_SELECT_UNIT5: - case ID_POPUP_SCH_SELECT_UNIT6: - case ID_POPUP_SCH_SELECT_UNIT7: - case ID_POPUP_SCH_SELECT_UNIT8: - case ID_POPUP_SCH_SELECT_UNIT9: - case ID_POPUP_SCH_SELECT_UNIT10: - case ID_POPUP_SCH_SELECT_UNIT11: - case ID_POPUP_SCH_SELECT_UNIT12: - case ID_POPUP_SCH_SELECT_UNIT13: - case ID_POPUP_SCH_SELECT_UNIT14: - case ID_POPUP_SCH_SELECT_UNIT15: - case ID_POPUP_SCH_SELECT_UNIT16: - case ID_POPUP_SCH_SELECT_UNIT17: - case ID_POPUP_SCH_SELECT_UNIT18: - case ID_POPUP_SCH_SELECT_UNIT19: - case ID_POPUP_SCH_SELECT_UNIT20: - case ID_POPUP_SCH_SELECT_UNIT21: - case ID_POPUP_SCH_SELECT_UNIT22: - case ID_POPUP_SCH_SELECT_UNIT23: - case ID_POPUP_SCH_SELECT_UNIT24: - case ID_POPUP_SCH_SELECT_UNIT25: - case ID_POPUP_SCH_SELECT_UNIT26: - case ID_POPUP_SCH_ROTATE_FIELD: - case ID_POPUP_SCH_EDIT_FIELD: - case ID_POPUP_DELETE_BLOCK: - case ID_POPUP_PLACE_BLOCK: - case ID_POPUP_ZOOM_BLOCK: - case ID_POPUP_DRAG_BLOCK: - case ID_POPUP_COPY_BLOCK: - case ID_POPUP_ROTATE_BLOCK: - case ID_POPUP_MIRROR_X_BLOCK: - case ID_POPUP_MIRROR_Y_BLOCK: - case ID_POPUP_SCH_DELETE_NODE: - case ID_POPUP_SCH_DELETE_CONNECTION: - case wxID_CUT: - case wxID_COPY: - case ID_POPUP_SCH_ENTER_SHEET: - case ID_POPUP_SCH_LEAVE_SHEET: - case ID_POPUP_SCH_ADD_JUNCTION: - case ID_POPUP_SCH_ADD_LABEL: - break; // Do nothing: - case ID_POPUP_CANCEL_CURRENT_COMMAND: if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE ) DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = @@ -156,100 +80,6 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) switch( id ) // Command execution: { - case ID_EXIT: - Close( TRUE ); - break; - - case ID_NEW_PROJECT: /* New EED Project */ - LoadOneEEProject( wxEmptyString, TRUE ); - break; - - case ID_LOAD_PROJECT: - LoadOneEEProject( wxEmptyString, FALSE ); - break; - - case ID_LOAD_ONE_SHEET: - - //how is this different from above? - //LoadOneSheet( GetSheet(), wxEmptyString ); - break; - - case ID_LOAD_FILE_1: - case ID_LOAD_FILE_2: - case ID_LOAD_FILE_3: - case ID_LOAD_FILE_4: - case ID_LOAD_FILE_5: - case ID_LOAD_FILE_6: - case ID_LOAD_FILE_7: - case ID_LOAD_FILE_8: - case ID_LOAD_FILE_9: - case ID_LOAD_FILE_10: - LoadOneEEProject( GetLastProject( id - ID_LOAD_FILE_1 ).GetData( - ), FALSE ); - break; - - case ID_TO_LIBRARY: - if( m_Parent->m_LibeditFrame ) - { - m_Parent->m_LibeditFrame->Show( TRUE ); - } - else - { - m_Parent->m_LibeditFrame = - new WinEDA_LibeditFrame( m_Parent->m_SchematicFrame, - m_Parent, - wxT( "Library Editor" ), - wxPoint( -1, -1 ), - wxSize( 600, 400 ) ); - ActiveScreen = ScreenLib; - m_Parent->m_LibeditFrame->AdjustScrollBars(); - } - break; - - case ID_TO_PCB: - { - wxString Line; - if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString ) - { - Line = GetScreen()->m_FileName; - AddDelimiterString( Line ); - ChangeFileNameExt( Line, wxEmptyString ); - ExecuteFile( this, PCBNEW_EXE, Line ); - } - else - ExecuteFile( this, PCBNEW_EXE ); - break; - } - - case ID_TO_CVPCB: - { - wxString Line; - if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString ) - { - Line = g_RootSheet->m_AssociatedScreen->m_FileName; - AddDelimiterString( Line ); - ChangeFileNameExt( Line, wxEmptyString ); - ExecuteFile( this, CVPCB_EXE, Line ); - } - else - ExecuteFile( this, CVPCB_EXE ); - break; - } - - case ID_TO_LIBVIEW: - if( m_Parent->m_ViewlibFrame ) - { - m_Parent->m_ViewlibFrame->Show( TRUE ); - } - else - { - m_Parent->m_ViewlibFrame = - new WinEDA_ViewlibFrame( m_Parent->m_SchematicFrame, - m_Parent ); - m_Parent->m_ViewlibFrame->AdjustScrollBars(); - } - break; - case ID_HIERARCHY: InstallHierarchyFrame( &dc, pos ); g_ItemToRepeat = NULL; @@ -262,27 +92,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) g_ItemToRepeat = NULL; break; - case wxID_PASTE: HandleBlockBegin( &dc, BLOCK_PASTE, GetScreen()->m_Curseur ); break; - case ID_GET_ERC: - InstallErcFrame( this, defaultpos ); - break; - - case ID_GET_NETLIST: - InstallNetlistFrame( this, defaultpos ); - break; - - case ID_GET_TOOLS: - InstallToolsFrame( this, defaultpos ); - break; - - case ID_FIND_ITEMS: - InstallFindFrame( this, pos ); - break; - case ID_HIERARCHY_PUSH_POP_BUTT: SetToolID( id, wxCURSOR_HAND, _( "Push/Pop Hierarchy" ) ); break; @@ -815,8 +628,6 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->Refresh( TRUE ); break; - - default: // Log error: DisplayError( this, wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) ); diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index d9cdab5a32..dd8b1c7fdd 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -13,6 +13,8 @@ #include "protos.h" +#include "schframe.h" + /* Functions to undo and redo edit commands. * commmands to undo are in CurrentScreen->m_UndoList * commmands to redo are in CurrentScreen->m_RedoList diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 29b51f2741..25651f36d9 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -16,8 +16,14 @@ #include "bitmaps.h" #include "protos.h" #include "id.h" +#include "netlist.h" +#include "schframe.h" #include "annotate_dialog.h" +#include "dialog_build_BOM.h" +#include "dialog_erc.h" +#include "dialog_find.h" +#include "netlist_control.h" /*******************************/ @@ -32,11 +38,15 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame ) EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow ) EVT_SIZE( WinEDA_SchematicFrame::OnSize ) - EVT_MENU_RANGE( ID_LOAD_PROJECT, ID_LOAD_FILE_10, - WinEDA_SchematicFrame::Process_Special_Functions ) + EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) + EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) + + EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10, + WinEDA_SchematicFrame::OnLoadFile ) + + EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) + EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) - EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL_RANGE( ID_SCHEMATIC_MAIN_TOOLBAR_START, ID_SCHEMATIC_MAIN_TOOLBAR_END, WinEDA_SchematicFrame::Process_Special_Functions ) @@ -54,7 +64,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame ) EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print ) EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard ) EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard ) - EVT_MENU( ID_EXIT, WinEDA_SchematicFrame::Process_Special_Functions ) + EVT_MENU( ID_EXIT, WinEDA_SchematicFrame::OnExit ) EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END, @@ -68,14 +78,11 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame ) EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, WinEDA_SchematicFrame::Process_Zoom ) - EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions ) + EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::OnOpenLibraryEditor ) + EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::OnOpenLibraryViewer ) - EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::Process_Special_Functions ) - - EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::Process_Special_Functions ) + EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::OnOpenPcbnew ) + EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::OnOpenCvpcb ) EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings ) EVT_TOOL( ID_HIERARCHY, WinEDA_SchematicFrame::Process_Special_Functions ) @@ -85,8 +92,10 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame ) EVT_TOOL( ID_UNDO_BUTT, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate ) EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter ) - EVT_TOOL_RANGE( ID_GET_ERC, ID_FIND_ITEMS, - WinEDA_SchematicFrame::Process_Special_Functions ) + EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc ) + EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist ) + EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials ) + EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout ) @@ -145,17 +154,16 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, g_ItemToRepeat = NULL; /* Get config */ GetSettings(); - g_DrawMinimunLineWidth = m_Parent->m_EDA_Config->Read( - MINI_DRAW_LINE_WIDTH_KEY, - (long) 0 ); - g_PlotPSMinimunLineWidth = m_Parent->m_EDA_Config->Read( - MINI_PLOTPS_LINE_WIDTH_KEY, - (long) 4 ); + g_DrawMinimunLineWidth = + m_Parent->m_EDA_Config->Read( MINI_DRAW_LINE_WIDTH_KEY, (long) 0 ); + g_PlotPSMinimunLineWidth = + m_Parent->m_EDA_Config->Read( MINI_PLOTPS_LINE_WIDTH_KEY, (long) 4 ); - /****/ SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); + if( DrawPanel ) DrawPanel->m_Block_Enable = TRUE; + ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); @@ -215,9 +223,7 @@ wxString WinEDA_SchematicFrame::GetScreenDesc() } -/*******************************************/ void WinEDA_SchematicFrame::CreateScreens() -/*******************************************/ { /* creation des ecrans Sch , Lib */ if( g_RootSheet == NULL ) @@ -243,7 +249,6 @@ void WinEDA_SchematicFrame::CreateScreens() /**************************************************************/ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) -/**************************************************************/ { DrawSheetList* sheet; @@ -295,7 +300,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) } if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty() && - (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) ) + (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) ) SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName ); ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE ); @@ -314,12 +319,12 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) } -/********************************************/ +/***************************************************************************** + * + * Enable or disable some tools according to current conditions + * + *****************************************************************************/ void WinEDA_SchematicFrame::SetToolbars() -/********************************************/ - -/* Enable or disable some tools according to current conditions - */ { if( m_HToolBar ) { @@ -389,9 +394,7 @@ void WinEDA_SchematicFrame::SetToolbars() } -/******************************************/ int WinEDA_SchematicFrame::BestZoom() -/******************************************/ { int dx, dy, ii, jj; int bestzoom; @@ -418,3 +421,129 @@ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event ) dlg->ShowModal(); dlg->Destroy(); } + +void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event ) +{ + WinEDA_ErcFrame* dlg = new WinEDA_ErcFrame( this ); + dlg->ShowModal(); + dlg->Destroy(); +} + +void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event ) +{ + int i; + + if ( g_NetFormat < NET_TYPE_PCBNEW ) + g_NetFormat = NET_TYPE_PCBNEW; + + do + { + WinEDA_NetlistFrame* dlg = new WinEDA_NetlistFrame( this ); + i = dlg->ShowModal(); + dlg->Destroy(); + } while( i == NET_PLUGIN_CHANGE ); + // If a plugin is removed or added, rebuild and reopen the new dialog +} + +void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent & ) +{ + WinEDA_Build_BOM_Frame* dlg = new WinEDA_Build_BOM_Frame( this ); + dlg->ShowModal(); + dlg->Destroy(); +} + +void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) +{ + this->DrawPanel->m_IgnoreMouseEvents = TRUE; + WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this ); + dlg->ShowModal(); + dlg->Destroy(); + this->DrawPanel->m_IgnoreMouseEvents = FALSE; +} + +void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event ) +{ + int i = event.GetId() - ID_LOAD_FILE_1; + + LoadOneEEProject( GetLastProject( i ).GetData( ), false ); + SetToolbars(); +} + +void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event ) +{ + LoadOneEEProject( wxEmptyString, true ); +} + +void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event ) +{ + LoadOneEEProject( wxEmptyString, false ); +} + +void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event ) +{ + wxString Line; + + if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString ) + { + Line = GetScreen()->m_FileName; + AddDelimiterString( Line ); + ChangeFileNameExt( Line, wxEmptyString ); + ExecuteFile( this, PCBNEW_EXE, Line ); + } + else + ExecuteFile( this, PCBNEW_EXE ); +} + +void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event ) +{ + wxString Line; + + if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString ) + { + Line = g_RootSheet->m_AssociatedScreen->m_FileName; + AddDelimiterString( Line ); + ChangeFileNameExt( Line, wxEmptyString ); + ExecuteFile( this, CVPCB_EXE, Line ); + } + else + ExecuteFile( this, CVPCB_EXE ); +} + +void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) +{ + if( m_Parent->m_ViewlibFrame ) + { + m_Parent->m_ViewlibFrame->Show( TRUE ); + } + else + { + m_Parent->m_ViewlibFrame = + new WinEDA_ViewlibFrame( m_Parent->m_SchematicFrame, + m_Parent ); + m_Parent->m_ViewlibFrame->AdjustScrollBars(); + } +} + +void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event ) +{ + if( m_Parent->m_LibeditFrame ) + { + m_Parent->m_LibeditFrame->Show( TRUE ); + } + else + { + m_Parent->m_LibeditFrame = + new WinEDA_LibeditFrame( m_Parent->m_SchematicFrame, + m_Parent, + wxT( "Library Editor" ), + wxPoint( -1, -1 ), + wxSize( 600, 400 ) ); + ActiveScreen = ScreenLib; + m_Parent->m_LibeditFrame->AdjustScrollBars(); + } +} + +void WinEDA_SchematicFrame::OnExit( wxCommandEvent& event ) +{ + Close( true ); +} diff --git a/eeschema/schframe.h b/eeschema/schframe.h new file mode 100644 index 0000000000..fd46989fd5 --- /dev/null +++ b/eeschema/schframe.h @@ -0,0 +1,244 @@ +/***************************************************************************** + * + * schframe.h + * + * Header for class definition of WinEDA_SchematicFrame. This is the main + * window for EESchema. + * + *****************************************************************************/ + +#ifndef _SCHFRAME_H_ +#define _SCHFRAME_H_ + +class WinEDA_DrawFrame; + +class WinEDA_SchematicFrame : public WinEDA_DrawFrame +{ +public: + WinEDAChoiceBox* m_SelPartBox; + DrawSheetList* m_CurrentSheet; //which sheet we are presently working on. +private: + wxMenu* m_FilesMenu; + +public: + WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent, + const wxString& title, + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); + + ~WinEDA_SchematicFrame(); + + void OnCloseWindow( wxCloseEvent& Event ); + void Process_Special_Functions( wxCommandEvent& event ); + void Process_Config( wxCommandEvent& event ); + void Save_Config( wxWindow* displayframe ); + + void RedrawActiveWindow( wxDC* DC, bool EraseBg ); + + void CreateScreens(); + void ReCreateHToolbar(); + void ReCreateVToolbar(); + void ReCreateOptToolbar(); + void ReCreateMenuBar(); + void SetToolbars(); + void OnHotKey( wxDC* DC, + int hotkey, + EDA_BaseStruct* DrawStruct ); + + DrawSheetList* GetSheet(); + virtual BASE_SCREEN* GetScreen(); + virtual void SetScreen(SCH_SCREEN* screen); + virtual wxString GetScreenDesc(); + + void InstallConfigFrame( const wxPoint& pos ); + + void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); + void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); + bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); + void OnSelectOptionToolbar( wxCommandEvent& event ); + void ToolOnRightClick( wxCommandEvent& event ); + int BestZoom(); // Retourne le meilleur zoom + + EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE ); + EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, + bool IncludePin ); + + EDA_BaseStruct* FindComponentAndItem( const wxString& component_reference, + bool Find_in_hierarchy, + int SearchType, + const wxString& text_to_find, + bool mouseWarp ); + + /* Cross probing with pcbnew */ + void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, + EDA_SchComponentStruct* LibItem ); + + /* netlist generation */ + void* BuildNetListBase(); + + // FUnctions used for hierarchy handling + void InstallPreviousSheet(); + void InstallNextScreen( DrawSheetStruct* Sheet ); + + void ToPlot_PS( wxCommandEvent& event ); + void ToPlot_HPGL( wxCommandEvent& event ); + void ToPostProcess( wxCommandEvent& event ); + + void Save_File( wxCommandEvent& event ); + void SaveProject(); + int LoadOneEEProject( const wxString& FileName, bool IsNew ); + bool LoadOneEEFile(SCH_SCREEN* screen, const wxString& FullFileName ); + bool SaveEEFile( SCH_SCREEN* screen, int FileSave ); + SCH_SCREEN * CreateNewScreen(SCH_SCREEN * OldScreen, int TimeStamp); + + // General search: + + /** + * Function FindSchematicItem + * finds a string in the schematic. + * @param pattern The text to search for, either in value, reference or + * elsewhere. + * @param SearchType: 0 => Search is made in current sheet + * 1 => the whole hierarchy + * 2 => or for the next item + * @param mouseWarp If true, then move the mouse cursor to the item. + */ + EDA_BaseStruct* FindSchematicItem( const wxString& pattern, + int SearchType, + bool mouseWarp = true ); + + EDA_BaseStruct* FindMarker( int SearchType ); + +private: + void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC ); + void OnExit( wxCommandEvent& event ); + void OnAnnotate ( wxCommandEvent& event ); + void OnErc( wxCommandEvent& event ); + void OnCreateNetlist( wxCommandEvent& event ); + void OnCreateBillOfMaterials( wxCommandEvent& event ); + void OnFindItems( wxCommandEvent& event ); + void OnLoadFile( wxCommandEvent& event ); + void OnNewProject( wxCommandEvent& event ); + void OnLoadProject( wxCommandEvent& event ); + void OnOpenPcbnew( wxCommandEvent& event ); + void OnOpenCvpcb( wxCommandEvent& event ); + void OnOpenLibraryViewer( wxCommandEvent& event ); + void OnOpenLibraryEditor( wxCommandEvent& event ); + + + // Bus Entry + DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type ); + void SetBusEntryShape( wxDC* DC, + DrawBusEntryStruct* BusEntry, + int entry_type ); + int GetBusEntryShape( DrawBusEntryStruct* BusEntry ); + void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC ); + + // NoConnect + EDA_BaseStruct* CreateNewNoConnectStruct( wxDC* DC ); + + // Junction + DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC, + const wxPoint& pos, + bool PutInUndoList = FALSE ); + + // Text ,label, glabel + EDA_BaseStruct* CreateNewText( wxDC* DC, int type ); + void EditSchematicText( DrawTextStruct* TextStruct, wxDC* DC ); + void ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* DC ); + void StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC ); + void ConvertTextType( DrawTextStruct* Text, wxDC* DC, int newtype ); + + // Wire, Bus + void BeginSegment( wxDC* DC, int type ); + void EndSegment( wxDC* DC ); + void DeleteCurrentSegment( wxDC* DC ); + void DeleteConnection( wxDC* DC, bool DeleteFullConnection ); + + // graphic lines + void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); + void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC ); + void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC ); + DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC ); + + // Hierarchical Sheet & PinSheet + void InstallHierarchyFrame( wxDC* DC, wxPoint& pos ); + DrawSheetStruct* CreateSheet( wxDC* DC ); + void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ); + +public: + bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC ); + +private: + void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC ); + DrawSheetLabelStruct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC ); + void Edit_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC ); + void StartMove_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC ); + void Place_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC ); + DrawSheetLabelStruct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC ); + +public: + void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel ); + +private: + + // Component + EDA_SchComponentStruct* Load_Component( wxDC* DC, + const wxString& libname, + wxArrayString& List, + bool UseLibBrowser ); + void StartMovePart( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); + +public: + void CmpRotationMiroir( EDA_SchComponentStruct* DrawComponent, + wxDC* DC, int type_rotate ); + +private: + void SelPartUnit( EDA_SchComponentStruct* DrawComponent, + int unit, wxDC* DC ); + void ConvertPart( EDA_SchComponentStruct* DrawComponent, wxDC* DC ); + void SetInitCmp( EDA_SchComponentStruct* DrawComponent, wxDC* DC ); + void EditComponentReference( EDA_SchComponentStruct* DrawLibItem, + wxDC* DC ); + void EditComponentValue( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); + void EditComponentFootprint( EDA_SchComponentStruct* DrawLibItem, + wxDC* DC ); + void StartMoveCmpField( PartTextStruct* Field, wxDC* DC ); + void EditCmpFieldText( PartTextStruct* Field, wxDC* DC ); + void RotateCmpField( PartTextStruct* Field, wxDC* DC ); + + /* Operations sur bloc */ + void PasteStruct( wxDC* DC ); + + /* Undo - redo */ +public: + void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, + int flag_type_command = 0 ); + +private: + void PutDataInPreviousState( DrawPickedStruct* List ); + bool GetSchematicFromRedoList(); + bool GetSchematicFromUndoList(); + + +public: + void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); + + /* Gestion generale des operations sur block */ + int ReturnBlockCommand( int key ); + void InitBlockPasteInfos(); + void HandleBlockPlace( wxDC* DC ); + int HandleBlockEnd( wxDC* DC ); + void HandleBlockEndByPopUp( int Command, wxDC* DC ); + + // Repetition automatique de placements + void RepeatDrawItem( wxDC* DC ); + + // Test des points de connexion en l'air (dangling ends) + void TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ); + LibDrawPin* LocatePinEnd( EDA_BaseStruct* DrawList, const wxPoint& pos ); + + DECLARE_EVENT_TABLE() +}; + +#endif /* _SCHFRAME_H_ */ diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 71f020bab7..8a5d0ac887 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -39,6 +39,8 @@ #include "protos.h" +#include "schframe.h" + /* Routines Locales */ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 7883dcb387..cfa91918c5 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -12,6 +12,9 @@ #include "protos.h" +#include "schframe.h" + + /* Routines Locales */ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index 54de729a69..6307d3a63b 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -13,6 +13,8 @@ #include "protos.h" #include "hotkeys.h" +#include "schframe.h" + #define BITMAP wxBitmap #include "bitmaps.h" /* general bitmaps */ diff --git a/include/wxstruct.h b/include/wxstruct.h index 305995e484..59c1eb1c54 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -338,220 +338,6 @@ enum fl_rot_cmp { CMP_MIROIR_Y = 0x200 // miroir selon axe Y }; -class WinEDA_SchematicFrame : public WinEDA_DrawFrame -{ -public: - WinEDAChoiceBox* m_SelPartBox; - DrawSheetList* m_CurrentSheet; //which sheet we are presently working on. -private: - wxMenu* m_FilesMenu; - -public: - WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent, - const wxString& title, - const wxPoint& pos, const wxSize& size, - long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); - - ~WinEDA_SchematicFrame(); - - void OnCloseWindow( wxCloseEvent& Event ); - void Process_Special_Functions( wxCommandEvent& event ); - void Process_Config( wxCommandEvent& event ); - void Save_Config( wxWindow* displayframe ); - - void RedrawActiveWindow( wxDC* DC, bool EraseBg ); - - void CreateScreens(); - void ReCreateHToolbar(); - void ReCreateVToolbar(); - void ReCreateOptToolbar(); - void ReCreateMenuBar(); - void SetToolbars(); - void OnHotKey( wxDC* DC, - int hotkey, - EDA_BaseStruct* DrawStruct ); - - DrawSheetList* GetSheet(); - virtual BASE_SCREEN* GetScreen(); - virtual void SetScreen(SCH_SCREEN* screen); - virtual wxString GetScreenDesc(); - - void InstallConfigFrame( const wxPoint& pos ); - - void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); - void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); - bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - void OnSelectOptionToolbar( wxCommandEvent& event ); - void ToolOnRightClick( wxCommandEvent& event ); - int BestZoom(); // Retourne le meilleur zoom - - EDA_BaseStruct* SchematicGeneralLocateAndDisplay( - bool IncludePin = TRUE ); - EDA_BaseStruct* SchematicGeneralLocateAndDisplay( - const wxPoint& refpoint, - bool IncludePin ); - - EDA_BaseStruct* FindComponentAndItem( - const wxString& component_reference, bool Find_in_hierarchy, - int SearchType, - const wxString& text_to_find, - bool mouseWarp ); - - /* Cross probing with pcbnew */ - void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, - EDA_SchComponentStruct* LibItem ); - - /* netlist generation */ - void* BuildNetListBase(); - - // FUnctions used for hierarchy handling - void InstallPreviousSheet(); - void InstallNextScreen( DrawSheetStruct* Sheet ); - - void ToPlot_PS( wxCommandEvent& event ); - void ToPlot_HPGL( wxCommandEvent& event ); - void ToPostProcess( wxCommandEvent& event ); - - void Save_File( wxCommandEvent& event ); - void SaveProject(); - int LoadOneEEProject( const wxString& FileName, bool IsNew ); - bool LoadOneEEFile(SCH_SCREEN* screen, const wxString& FullFileName ); - bool SaveEEFile( SCH_SCREEN* screen, int FileSave ); - SCH_SCREEN * CreateNewScreen(SCH_SCREEN * OldScreen, int TimeStamp); - - // General search: - - /** - * Function FindSchematicItem - * finds a string in the schematic. - * @param pattern The text to search for, either in value, reference or elsewhere. - * @param SearchType: 0 => Search is made in current sheet - * 1 => the whole hierarchy - * 2 => or for the next item - * @param mouseWarp If true, then move the mouse cursor to the item. - */ - EDA_BaseStruct* FindSchematicItem( const wxString& pattern, - int SearchType, - bool mouseWarp = true ); - - EDA_BaseStruct* FindMarker( int SearchType ); - -private: - void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC ); - void OnAnnotate ( wxCommandEvent& event ); - - // Bus Entry - DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type ); - void SetBusEntryShape( wxDC* DC, - DrawBusEntryStruct* BusEntry, - int entry_type ); - int GetBusEntryShape( DrawBusEntryStruct* BusEntry ); - void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC ); - - // NoConnect - EDA_BaseStruct* CreateNewNoConnectStruct( wxDC* DC ); - - // Junction - DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC, - const wxPoint& pos, - bool PutInUndoList = FALSE ); - - // Text ,label, glabel - EDA_BaseStruct* CreateNewText( wxDC* DC, int type ); - void EditSchematicText( DrawTextStruct* TextStruct, wxDC* DC ); - void ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* DC ); - void StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC ); - void ConvertTextType( DrawTextStruct* Text, wxDC* DC, int newtype ); - - // Wire, Bus - void BeginSegment( wxDC* DC, int type ); - void EndSegment( wxDC* DC ); - void DeleteCurrentSegment( wxDC* DC ); - void DeleteConnection( wxDC* DC, bool DeleteFullConnection ); - - // graphic lines - void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC ); - void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC ); - DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - - // Hierarchical Sheet & PinSheet - void InstallHierarchyFrame( wxDC* DC, wxPoint& pos ); - DrawSheetStruct* CreateSheet( wxDC* DC ); - void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ); - -public: - bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC ); - -private: - void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC ); - DrawSheetLabelStruct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC ); - void Edit_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC ); - void StartMove_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC ); - void Place_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC ); - DrawSheetLabelStruct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC ); - -public: - void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel ); - -private: - - // Component - EDA_SchComponentStruct* Load_Component( wxDC* DC, - const wxString& libname, - wxArrayString& List, - bool UseLibBrowser ); - void StartMovePart( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); - -public: - void CmpRotationMiroir( - EDA_SchComponentStruct* DrawComponent, wxDC* DC, int type_rotate ); - -private: - void SelPartUnit( EDA_SchComponentStruct* DrawComponent, int unit, wxDC* DC ); - void ConvertPart( EDA_SchComponentStruct* DrawComponent, wxDC* DC ); - void SetInitCmp( EDA_SchComponentStruct* DrawComponent, wxDC* DC ); - void EditComponentReference( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); - void EditComponentValue( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); - void EditComponentFootprint( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ); - void StartMoveCmpField( PartTextStruct* Field, wxDC* DC ); - void EditCmpFieldText( PartTextStruct* Field, wxDC* DC ); - void RotateCmpField( PartTextStruct* Field, wxDC* DC ); - - /* Operations sur bloc */ - void PasteStruct( wxDC* DC ); - - /* Undo - redo */ -public: - void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, - int flag_type_command = 0 ); - -private: - void PutDataInPreviousState( DrawPickedStruct* List ); - bool GetSchematicFromRedoList(); - bool GetSchematicFromUndoList(); - - -public: - void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); - - /* Gestion generale des operations sur block */ - int ReturnBlockCommand( int key ); - void InitBlockPasteInfos(); - void HandleBlockPlace( wxDC* DC ); - int HandleBlockEnd( wxDC* DC ); - void HandleBlockEndByPopUp( int Command, wxDC* DC ); - - // Repetition automatique de placements - void RepeatDrawItem( wxDC* DC ); - - // Test des points de connexion en l'air (dangling ends) - void TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ); - LibDrawPin* LocatePinEnd( EDA_BaseStruct* DrawList, const wxPoint& pos ); - - DECLARE_EVENT_TABLE() -}; - /*****************************/ /* class WinEDA_LibeditFrame */ diff --git a/share/svg_print.cpp b/share/svg_print.cpp index 4aee060b8e..8c61d21ca4 100644 --- a/share/svg_print.cpp +++ b/share/svg_print.cpp @@ -43,6 +43,7 @@ #ifdef EESCHEMA #include "program.h" +#include "../eeschema/schframe.h" #endif ////@begin XPM images