From 1bbc009da84854a219d0bd3fc909b459d0b1e254 Mon Sep 17 00:00:00 2001 From: stambaughw Date: Tue, 16 Mar 2010 18:22:59 +0000 Subject: [PATCH] New EESchema find dialog and other minor fixes. * Replaced find dialog with wxFormBuilder version. * New find dialog is modeless, supports more advanced search features, remembers it's last position, size, search history, and search settings, and implements initial support for replacing. * Added Shift+F5 hot key to search for next DRC marker. F5 now just repeats previous search. * Minor cosmetic enhancements to label edit dialog. * Remove tab from grid size text printf to fix toolbar grid combobox display in wxGTK. * Updated my TODO list items. --- TODO.txt | 43 +- common/common.cpp | 48 +- common/sch_item_struct.cpp | 26 + common/zoom.cpp | 4 +- eeschema/CMakeLists.txt | 3 +- eeschema/class_drawsheet.cpp | 9 + eeschema/class_drawsheet.h | 25 +- eeschema/class_drawsheetpath.cpp | 293 +++++- eeschema/class_drawsheetpath.h | 104 ++- eeschema/class_hierarchical_PIN_sheet.cpp | 6 + eeschema/class_library.cpp | 24 +- eeschema/class_marker_sch.cpp | 9 + eeschema/class_marker_sch.h | 8 + eeschema/class_sch_cmp_field.cpp | 6 + eeschema/class_sch_cmp_field.h | 8 + eeschema/class_sch_component.cpp | 21 + eeschema/class_sch_component.h | 8 + eeschema/class_text-label.cpp | 6 + eeschema/class_text-label.h | 8 + eeschema/dialog_edit_label.cpp | 124 +-- eeschema/dialog_edit_label.h | 15 +- eeschema/dialog_edit_label_base.cpp | 92 +- eeschema/dialog_edit_label_base.fbp | 668 ++++++-------- eeschema/dialog_edit_label_base.h | 25 +- eeschema/dialog_find.cpp | 245 ----- eeschema/dialog_find.h | 126 --- eeschema/dialog_find.pjd | 1002 -------------------- eeschema/dialog_sch_find.fbp | 1017 +++++++++++++++++++++ eeschema/dialog_schematic_find.cpp | 171 ++++ eeschema/dialog_schematic_find.h | 88 ++ eeschema/dialog_schematic_find_base.cpp | 147 +++ eeschema/dialog_schematic_find_base.h | 71 ++ eeschema/edit_label.cpp | 41 +- eeschema/eeschema.cpp | 4 - eeschema/eeschema_config.cpp | 80 ++ eeschema/files-io.cpp | 2 +- eeschema/find.cpp | 607 ++---------- eeschema/general.h | 5 - eeschema/hotkeys.cpp | 33 +- eeschema/hotkeys.h | 3 +- eeschema/lib_export.cpp | 2 +- eeschema/libedit.cpp | 2 +- eeschema/schframe.cpp | 49 +- eeschema/symbdraw.cpp | 2 +- eeschema/symbedit.cpp | 2 +- include/common.h | 18 +- include/sch_item_struct.h | 26 + include/wxEeschemaStruct.h | 30 +- 48 files changed, 2830 insertions(+), 2526 deletions(-) delete mode 100644 eeschema/dialog_find.cpp delete mode 100644 eeschema/dialog_find.h delete mode 100644 eeschema/dialog_find.pjd create mode 100644 eeschema/dialog_sch_find.fbp create mode 100644 eeschema/dialog_schematic_find.cpp create mode 100644 eeschema/dialog_schematic_find.h create mode 100644 eeschema/dialog_schematic_find_base.cpp create mode 100644 eeschema/dialog_schematic_find_base.h diff --git a/TODO.txt b/TODO.txt index 3f85ec3714..136f850a7d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -45,11 +45,6 @@ C2) Write a tool to generate DSNLEXER keyword tables (and enums) as *.cpp and CMake. -Wayne: -C1) Fix mouse wheel scrolling (ctrl + Mouse wheel) and (Shift + mouse wheel) - to move more than a single scroll increment. - - CvPCB ----- * Preview of the already assigned footprint. @@ -61,8 +56,18 @@ EESchema * Drag and drop between two EESchema windows. Wayne: -E1) Relpace find dialog with wxFormBuilder version using a modeless dialog - and event driven design similar to wxFindReplaceDialog implementation. +E2) Finish adding replace capability to new Find dialog. +E3) Hook up perform last library search hot key to replace search libraries for + component support removed from find dialog. +E4) Change add component dialog search text control to combobox and add component + search history save and restore capability. Also add session save and restore + to component history list control. Add advanced search capability similar to + new find dialog. +E5) Make escape key work correctly in add component dialog. +E6) Start initial work for changing component library file format to use Dick's + dsnlexer. See note C2 above. Come up with a workable library file format to + handle the wishes of the library implementation group. Add initial clipboard + support to the library editor. GerbView @@ -118,27 +123,3 @@ L8) LAYER_WIDGET::GetBestSize() needs platform independence. L9) On board load, ReFill() is called, this should also update the Render checkboxes and colors. - - -Use wxDC for coordinate scaling and offsetting fix. (Wayne) ------------------------------------------------------------- -W1) Make wxAutoBufferedPaintDC function properly. - -W2) Make bitmap grid drawing method function properly or figure out a more - efficient method for drawing the grid. - -W3) Use one cursor position (preferrably logical (drawing) units) instead - of keeping track of both logical and device cursor positions at the same - time. - -W4) Figure out why none of the apps render correctly using wxGCDC on Windows. - -** After (if?) new code accepted as project default: ** - -W6) Remove all old coordinate scaling and offset code from Kicad. - -W7) Remove conditional compilation pragmas and dead code paths. - -W8) Remove redundant drawing helper functions from gr_basic.cpp. - -W9) Remove all global variables used by old drawing code. diff --git a/common/common.cpp b/common/common.cpp index ec49e8df82..b4607248bd 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -221,33 +221,40 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, } -wxString ReturnUnitSymbol( int Units ) +wxString ReturnUnitSymbol( int aUnits, const wxString& formatString ) { + wxString tmp; wxString label; - switch( Units ) + switch( aUnits ) { case INCHES: - label = _( " (\"):" ); + tmp = _( "\"" ); break; case MILLIMETRE: - label = _( " (mm):" ); + tmp = _( "mm" ); break; default: + tmp = _( "??" ); break; } + if( formatString.IsEmpty() ) + return tmp; + + label.Printf( formatString, GetChars( tmp ) ); + return label; } -wxString GetUnitsLabel( int units ) +wxString GetUnitsLabel( int aUnits ) { wxString label; - switch( units ) + switch( aUnits ) { case INCHES: label = _( "inches" ); @@ -260,6 +267,7 @@ wxString GetUnitsLabel( int units ) case CENTIMETRE: label = _( "centimeters" ); break; + default: label = _( "Unknown" ); break; @@ -268,6 +276,34 @@ wxString GetUnitsLabel( int units ) return label; } + +wxString GetAbbreviatedUnitsLabel( int aUnits ) +{ + wxString label; + + switch( aUnits ) + { + case INCHES: + label = _( "in" ); + break; + + case MILLIMETRE: + label = _( "mm" ); + break; + + case CENTIMETRE: + label = _( "cm" ); + break; + + default: + label = _( "??" ); + break; + } + + return label; +} + + /* * Add string " (mm):" or " ("):" to the static text Stext. * Used in dialog boxes for entering values depending on selected units diff --git a/common/sch_item_struct.cpp b/common/sch_item_struct.cpp index 93eb366281..1e59e28964 100644 --- a/common/sch_item_struct.cpp +++ b/common/sch_item_struct.cpp @@ -15,6 +15,9 @@ #include "general.h" #include "protos.h" +#include "../eeschema/dialog_schematic_find.h" + + /* Constructor and destructor for SCH_ITEM */ /* They are not inline because this creates problems with gcc at linking time * in debug mode @@ -60,3 +63,26 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) frame->DrawPanel->CursorOn( DC ); // Display schematic cursor } } + + +bool SCH_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData ) +{ + wxString text = aText; + wxString searchText = aSearchData.GetFindString(); + + if( aSearchData.GetFlags() & wxFR_WHOLEWORD ) + return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE ); + + if( aSearchData.GetFlags() & FR_MATCH_WILDCARD ) + { + if( aSearchData.GetFlags() & wxFR_MATCHCASE ) + return text.Matches( searchText ); + + return text.MakeUpper().Matches( searchText.MakeUpper() ); + } + + if( aSearchData.GetFlags() & wxFR_MATCHCASE ) + return aText.Find( searchText ) != wxNOT_FOUND; + + return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND; +} diff --git a/common/zoom.cpp b/common/zoom.cpp index 707efd86b6..a2738c0164 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -247,10 +247,10 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu ) else { if( g_UnitMetric == 0 ) // inches - msg.Printf( wxT( "%.1f mils\t(%.3f mm)" ), + msg.Printf( wxT( "%.1f mils, (%.3f mm)" ), gridValueInch * 1000, gridValue_mm ); else - msg.Printf( wxT( "%.3f mm\t(%.1f mils)" ), + msg.Printf( wxT( "%.3f mm, (%.1f mils)" ), gridValue_mm, gridValueInch * 1000 ); } gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true ); diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 813631a8c8..8b723e530e 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -56,7 +56,6 @@ set(EESCHEMA_SRCS dialog_eeschema_options.cpp dialog_erc.cpp dialog_erc_base.cpp -# dialog_find.cpp dialog_lib_edit_draw_item.cpp dialog_lib_edit_draw_item_base.cpp dialog_lib_edit_pin.cpp @@ -67,6 +66,8 @@ set(EESCHEMA_SRCS dialog_print_using_printer.cpp dialog_sch_sheet_props.cpp dialog_sch_sheet_props_base.cpp + dialog_schematic_find.cpp + dialog_schematic_find_base.cpp dialog_SVG_print.cpp dialog_SVG_print_base.cpp edit_component_in_lib.cpp diff --git a/eeschema/class_drawsheet.cpp b/eeschema/class_drawsheet.cpp index bc2d4c4c8c..dd0b6fd3ce 100644 --- a/eeschema/class_drawsheet.cpp +++ b/eeschema/class_drawsheet.cpp @@ -694,6 +694,15 @@ void SCH_SHEET::Mirror_Y( int aYaxis_position ) } +bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData ) +{ + if( !SCH_ITEM::Matches( m_SheetName, aSearchData ) ) + return SCH_ITEM::Matches( m_FileName, aSearchData ); + + return true; +} + + #if defined(DEBUG) void SCH_SHEET::Show( int nestLevel, std::ostream& os ) { diff --git a/eeschema/class_drawsheet.h b/eeschema/class_drawsheet.h index 44d7ae90fd..654951d129 100644 --- a/eeschema/class_drawsheet.h +++ b/eeschema/class_drawsheet.h @@ -28,9 +28,10 @@ public: // m_Number >= 2 // value 0 is for sheet name and 1 for sheet filename -public: SCH_SHEET_PIN( SCH_SHEET* parent, - const wxPoint& pos = wxPoint( 0, 0 ), - const wxString& text = wxEmptyString ); +public: + SCH_SHEET_PIN( SCH_SHEET* parent, + const wxPoint& pos = wxPoint( 0, 0 ), + const wxString& text = wxEmptyString ); ~SCH_SHEET_PIN() { } @@ -107,6 +108,14 @@ public: SCH_SHEET_PIN( SCH_SHEET* parent, NEGATE( m_Pos.x ); m_Pos.x += aYaxis_position; } + + /** + * Compare schematic sheet entry (pin?) name against search string. + * + * @param aSearchData - Criteria to search against. + * @return True if this item matches the search criteria. + */ + virtual bool Matches( wxFindReplaceData& aSearchData ); }; @@ -308,6 +317,16 @@ public: */ virtual void Mirror_Y( int aYaxis_position ); + /** + * Compare schematic sheet file and sheet name against search string. + * + * @param aSearchData - Criteria to search against. + * @param aCaseSensitive - True for case sensitive search. + * @param aWholeWord - True to match whole word. + * @return True if this item matches the search criteria. + */ + virtual bool Matches( wxFindReplaceData& aSearchData ); + #if defined(DEBUG) // comment inherited by Doxygen from Base_Struct diff --git a/eeschema/class_drawsheetpath.cpp b/eeschema/class_drawsheetpath.cpp index c7e83d76d6..9011fba868 100644 --- a/eeschema/class_drawsheetpath.cpp +++ b/eeschema/class_drawsheetpath.cpp @@ -1,5 +1,4 @@ ///////////////////////////////////////////////////////////////////////////// - // Name: class_drawsheet.cpp // Purpose: member functions for SCH_SHEET // header = class_drawsheet.h @@ -13,6 +12,9 @@ #include "common.h" #include "program.h" #include "general.h" +#include "dlist.h" + +#include "dialog_schematic_find.h" /**********************************************/ @@ -34,9 +36,7 @@ SCH_SHEET_PATH::SCH_SHEET_PATH() * @param aPath = path of the sheet to reach (in non human readable format) * @return true if success else false */ -bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( - const wxString& aPath, - bool aFound ) +bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound ) { if( aFound ) return true; @@ -129,6 +129,29 @@ SCH_ITEM* SCH_SHEET_PATH::LastDrawList() } +SCH_ITEM* SCH_SHEET_PATH::FirstDrawList() +{ + SCH_ITEM* item = NULL; + + if( m_numSheets && m_sheets[0]->m_AssociatedScreen ) + item = m_sheets[0]->m_AssociatedScreen->EEDrawList; + + /* @fixme - These lists really should be one of the boost pointer containers. This + * is a brain dead hack to allow reverse iteration of EDA_BaseStruct linked + * list. + */ + SCH_ITEM* lastItem = NULL; + + while( item != NULL ) + { + lastItem = item; + item = item->Next(); + } + + return lastItem; +} + + /** Function Push * store (push) aSheet in list * @param aSheet = pointer to the SCH_SHEET to store in list @@ -136,8 +159,11 @@ SCH_ITEM* SCH_SHEET_PATH::LastDrawList() void SCH_SHEET_PATH::Push( SCH_SHEET* aSheet ) { if( m_numSheets > DSLSZ ) - wxMessageBox( wxT( "SCH_SHEET_PATH::Push() error: no room in buffer \ -to store sheet" ) ); + { + wxString msg; + msg.Printf( _( "Schematic sheets can only be nested %d levels deep." ), DSLSZ ); + wxMessageBox( msg ); + } if( m_numSheets < DSLSZ ) { @@ -225,6 +251,105 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences() } +SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) +{ + bool hasWrapped = false; + bool firstItemFound = false; + SCH_ITEM* drawItem = LastDrawList(); + + while( drawItem != NULL ) + { + if( drawItem->Type() == aType ) + { + if( aLastItem == NULL || firstItemFound ) + { + return drawItem; + } + else if( !firstItemFound && drawItem == aLastItem ) + { + firstItemFound = true; + } + } + + drawItem = drawItem->Next(); + + if( drawItem == NULL && aLastItem && aWrap && !hasWrapped ) + { + hasWrapped = true; + drawItem = LastDrawList(); + } + } + + return NULL; +} + + +SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) +{ + bool hasWrapped = false; + bool firstItemFound = false; + SCH_ITEM* drawItem = FirstDrawList(); + + while( drawItem != NULL ) + { + if( drawItem->Type() == aType ) + { + if( aLastItem == NULL || firstItemFound ) + { + return drawItem; + } + else if( !firstItemFound && drawItem == aLastItem ) + { + firstItemFound = true; + } + } + + drawItem = drawItem->Back(); + + if( drawItem == NULL && aLastItem && aWrap && !hasWrapped ) + { + hasWrapped = true; + drawItem = FirstDrawList(); + } + } + + return NULL; +} + + +SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData, + SCH_ITEM* aLastItem ) +{ + bool hasWrapped = false; + bool firstItemFound = false; + bool wrap = ( aSearchData.GetFlags() & FR_SEARCH_WRAP ) != 0; + SCH_ITEM* drawItem = LastDrawList(); + + while( drawItem != NULL ) + { + if( aLastItem && !firstItemFound ) + { + firstItemFound = ( drawItem == aLastItem ); + } + else + { + if( drawItem->Matches( aSearchData ) ) + return drawItem; + } + + drawItem = drawItem->Next(); + + if( drawItem == NULL && aLastItem && firstItemFound && wrap && !hasWrapped ) + { + hasWrapped = true; + drawItem = LastDrawList(); + } + } + + return NULL; +} + + bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 ) { m_numSheets = d1.m_numSheets; @@ -315,6 +440,28 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetNext() } +SCH_SHEET_PATH* SCH_SHEET_LIST::GetLast() +{ + if( GetCount() == 0 ) + return NULL; + + m_index = GetCount() - 1; + + return GetSheet( m_index ); +} + + +SCH_SHEET_PATH* SCH_SHEET_LIST::GetPrevious() +{ + if( m_index == 0 ) + return NULL; + + m_index -= 1; + + return GetSheet( m_index ); +} + + /** Function GetSheet * @return the item (sheet) in aIndex position in m_List or NULL if less than * index items @@ -372,3 +519,137 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet ) m_currList.Pop(); } + + +SCH_ITEM* SCH_SHEET_LIST::FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn, + SCH_ITEM* aLastItem, bool aWrap ) +{ + bool hasWrapped = false; + bool firstItemFound = false; + SCH_ITEM* drawItem = NULL; + SCH_SHEET_PATH* sheet = GetFirst(); + + while( sheet != NULL ) + { + drawItem = sheet->LastDrawList(); + + while( drawItem != NULL ) + { + if( drawItem->Type() == aType ) + { + if( aLastItem == NULL || firstItemFound ) + { + if( aSheetFoundIn ) + *aSheetFoundIn = sheet; + return drawItem; + } + else if( !firstItemFound && drawItem == aLastItem ) + { + firstItemFound = true; + } + } + + drawItem = drawItem->Next(); + } + + sheet = GetNext(); + + if( sheet == NULL && aLastItem && aWrap && !hasWrapped ) + { + hasWrapped = true; + sheet = GetFirst(); + } + } + + return NULL; +} + + +SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn, + SCH_ITEM* aLastItem, bool aWrap ) +{ + bool hasWrapped = false; + bool firstItemFound = false; + SCH_ITEM* drawItem = NULL; + SCH_SHEET_PATH* sheet = GetLast(); + + while( sheet != NULL ) + { + drawItem = sheet->FirstDrawList(); + + while( drawItem != NULL ) + { + if( drawItem->Type() == aType ) + { + if( aLastItem == NULL || firstItemFound ) + { + if( aSheetFoundIn ) + *aSheetFoundIn = sheet; + return drawItem; + } + else if( !firstItemFound && drawItem == aLastItem ) + { + firstItemFound = true; + } + } + + drawItem = drawItem->Back(); + } + + sheet = GetPrevious(); + + if( sheet == NULL && aLastItem && aWrap && !hasWrapped ) + { + hasWrapped = true; + sheet = GetLast(); + } + } + + return NULL; +} + + +SCH_ITEM* SCH_SHEET_LIST::MatchNextItem( wxFindReplaceData& aSearchData, + SCH_SHEET_PATH** aSheetFoundIn, + SCH_ITEM* aLastItem ) +{ + bool hasWrapped = false; + bool firstItemFound = false; + bool wrap = ( aSearchData.GetFlags() & FR_SEARCH_WRAP ) != 0; + SCH_ITEM* drawItem = NULL; + SCH_SHEET_PATH* sheet = GetFirst(); + + while( sheet != NULL ) + { + drawItem = sheet->LastDrawList(); + + while( drawItem != NULL ) + { + if( aLastItem && !firstItemFound ) + { + firstItemFound = ( drawItem == aLastItem ); + } + else + { + if( drawItem->Matches( aSearchData ) ) + { + if( aSheetFoundIn ) + *aSheetFoundIn = sheet; + return drawItem; + } + } + + drawItem = drawItem->Next(); + } + + sheet = GetNext(); + + if( sheet == NULL && aLastItem && firstItemFound && wrap && !hasWrapped ) + { + hasWrapped = true; + sheet = GetFirst(); + } + } + + return NULL; +} diff --git a/eeschema/class_drawsheetpath.h b/eeschema/class_drawsheetpath.h index 4361679b0e..5cb7d2a4f4 100644 --- a/eeschema/class_drawsheetpath.h +++ b/eeschema/class_drawsheetpath.h @@ -50,6 +50,9 @@ */ +class SCH_MARKER; + + /****************************************/ /* class to handle and access to a sheet */ /* a 'path' so to speak.. */ @@ -72,9 +75,11 @@ public: #define DSLSZ 32 // Max number of levels for a sheet path SCH_SHEET * m_sheets[DSLSZ]; -public: SCH_SHEET_PATH(); +public: + SCH_SHEET_PATH(); ~SCH_SHEET_PATH() { }; - void Clear() + + void Clear() { m_numSheets = 0; } @@ -110,6 +115,14 @@ public: SCH_SHEET_PATH(); */ SCH_ITEM* LastDrawList(); + /** + * Get the last schematic item relative to the first sheet in the list. + * + * @return Last schematic item relative to the first sheet in the list if list + * is not empty. Otherwise NULL. + */ + SCH_ITEM* FirstDrawList(); + /** Function Push * store (push) aSheet in list * @param aSheet = pointer to the SCH_SHEET to store in list @@ -161,6 +174,39 @@ public: SCH_SHEET_PATH(); */ void UpdateAllScreenReferences(); + /** + * Find the next schematic item in this sheet ojbect. + * + * @param aType - The type of schematic item object to search for. + * @param aLastItem - Start search from aLastItem. If no aLastItem, search from + * the beginning of the list. + * @param aWrap - Wrap around the end of the list to find the next item if aLastItem + * is defined. + * @return - The next schematic item if found. Otherwise, NULL is returned. + */ + SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ); + + /** + * Find the previous schematic item in this sheet path object. + * + * @param aItemType - The type of schematic item object to search for. + * @param aLastItem - Start search from aLastItem. If no aLastItem, search from + * the end of the list. + * @param aWrap - Wrap around the beginning of the list to find the next item if aLastItem + * is defined. + * @return - The previous schematic item if found. Otherwise, NULL is returned. + */ + SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ); + + /** + * Search this sheet path for the next item that matches the search criteria. + * + * @param aSearchData - Criteria to search item against. + * @param aLastItem - Find next item after aLastItem if not NULL. + * @return If found, Returns the next schematic item. Otherwise, returns NULL. + */ + SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem = NULL ); + bool operator=( const SCH_SHEET_PATH& d1 ); bool operator==( const SCH_SHEET_PATH& d1 ); @@ -228,6 +274,21 @@ public: */ SCH_SHEET_PATH* GetNext(); + /** + * Get the last sheet in the sheet list. + * + * @return Last sheet in the list or NULL if sheet list is empty. + */ + SCH_SHEET_PATH* GetLast(); + + /** + * Get the previous sheet in the sheet list. + * + * @return The previous sheet in the sheet list or NULL if already at the + * beginning of the list. + */ + SCH_SHEET_PATH* GetPrevious(); + /** Function GetSheet * @return the item (sheet) in aIndex position in m_List or NULL if less * than index items @@ -235,6 +296,45 @@ public: */ SCH_SHEET_PATH* GetSheet( int aIndex ); + /** + * Search the entire schematic for the next schematic object. + * + * @param aType - The type of schematic item to find. + * @param aSheetFound - The sheet the item was found in. NULL if the next item + * is not found. + * @param aLastItem - Find next item after aLastItem if not NULL. + * @param aWrap - Wrap past around the end of the list of sheets. + * @return If found, Returns the next schematic item. Otherwise, returns NULL. + */ + SCH_ITEM* FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFound = NULL, + SCH_ITEM* aLastItem = NULL, bool aWrap = true ); + + /** + * Search the entire schematic for the previous schematic item. + * + * @param aType - The type of schematic item to find. + * @param aSheetFound - The sheet the item was found in. NULL if the previous item + * is not found. + * @param aLastItem - Find the previous item before aLastItem if not NULL. + * @param aWrap - Wrap past around the beginning of the list of sheets. + * @return If found, the previous schematic item. Otherwise, NULL. + */ + SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFound = NULL, + SCH_ITEM* aLastItem = NULL, bool aWrap = true ); + + /** + * Search the entire schematic for the next item that matches the search criteria. + * + * @param aSearchData - Criteria to search item against. + * @param aSheetFound - The sheet the item was found in. NULL if the next item + * is not found. + * @param aLastItem - Find next item after aLastItem if not NULL. + * @return If found, Returns the next schematic item. Otherwise, returns NULL. + */ + SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, + SCH_SHEET_PATH** aSheetFound = NULL, + SCH_ITEM* aLastItem = NULL ); + private: /** Function BuildSheetList diff --git a/eeschema/class_hierarchical_PIN_sheet.cpp b/eeschema/class_hierarchical_PIN_sheet.cpp index dbbdd44d6b..57a167bdde 100644 --- a/eeschema/class_hierarchical_PIN_sheet.cpp +++ b/eeschema/class_hierarchical_PIN_sheet.cpp @@ -219,6 +219,12 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const } +bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData ) +{ + return SCH_ITEM::Matches( m_Text, aSearchData ); +} + + #if defined(DEBUG) void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os ) { diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 6474328008..6dfb817ead 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -252,19 +252,23 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) continue; LIB_COMPONENT* cparent = alias->GetComponent(); - if( cparent == NULL || // Lib error, should not occurs + if( cparent == NULL || // Lib error, should not occur. ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) ) { + if( cparent ) + msg = cparent->GetName(); + else + msg = _( "unknown" ); wxString msg1; wxString parentName; if( cparent ) parentName = cparent->GetName(); else parentName = _("not found"); - msg1.Printf( _("alias <%s> already exists and has root name<%s>"), - GetChars( alias->GetName() ), - GetChars( parentName ) ); - msg << msg1 << wxT("\n"); + msg1.Printf( _( "alias <%s> already exists and has root name<%s>" ), + GetChars( alias->GetName() ), + GetChars( parentName ) ); + msg << msg1 << wxT( "\n" ); conflict_count++; } @@ -278,10 +282,10 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) wxString msg1; title.Printf( _( "Conflict in library <%s>"), GetChars( fileName.GetName())); msg1.Printf( _("and appears in alias list of current component <%s>." ), - GetChars( newCmp->GetName() ) ); - msg << wxT("\n\n") << msg1; - msg << wxT("\n\n") << _("All old aliases will be removed. Continue ?"); - int diag = wxMessageBox(msg, title, wxYES | wxICON_QUESTION); + GetChars( newCmp->GetName() ) ); + msg << wxT( "\n\n" ) << msg1; + msg << wxT( "\n\n" ) << _( "All old aliases will be removed. Continue ?" ); + int diag = wxMessageBox( msg, title, wxYES | wxICON_QUESTION ); if( diag != wxYES ) return NULL; } @@ -299,7 +303,7 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) } else { - LIB_COMPONENT* cparent = alias->GetComponent(); + LIB_COMPONENT* cparent = alias->GetComponent(); if( cparent == NULL || // Lib error, should not occurs ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0) ) diff --git a/eeschema/class_marker_sch.cpp b/eeschema/class_marker_sch.cpp index fe89409377..1ea2d33710 100644 --- a/eeschema/class_marker_sch.cpp +++ b/eeschema/class_marker_sch.cpp @@ -114,6 +114,15 @@ void SCH_MARKER::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, } +bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData ) +{ + if( !SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) ) + return SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ); + + return true; +} + + /** * Function GetBoundingBox * returns the orthogonal, bounding box of this object for display purposes. diff --git a/eeschema/class_marker_sch.h b/eeschema/class_marker_sch.h index e5b8c59cbd..1e26c7ff33 100644 --- a/eeschema/class_marker_sch.h +++ b/eeschema/class_marker_sch.h @@ -99,6 +99,14 @@ public: m_Pos.x += aYaxis_position; } + /** + * Compare DRC marker main and auxilary text against search string. + * + * @param aSearchData - Criteria to search against. + * @return True if the DRC main or auxiliary text matches the search criteria. + */ + virtual bool Matches( wxFindReplaceData& aSearchData ); + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ); #endif diff --git a/eeschema/class_sch_cmp_field.cpp b/eeschema/class_sch_cmp_field.cpp index 7d121faf1f..07e80a8476 100644 --- a/eeschema/class_sch_cmp_field.cpp +++ b/eeschema/class_sch_cmp_field.cpp @@ -418,3 +418,9 @@ void SCH_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) frame->OnModify( ); frame->SetCurrentField( NULL ); } + + +bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData ) +{ + return SCH_ITEM::Matches( m_Text, aSearchData ); +} diff --git a/eeschema/class_sch_cmp_field.h b/eeschema/class_sch_cmp_field.h index 4d6d078616..19f49b013f 100644 --- a/eeschema/class_sch_cmp_field.h +++ b/eeschema/class_sch_cmp_field.h @@ -114,6 +114,14 @@ public: * this function is only needed by the virtual pure function of the * master class */ } + + /** + * Compare schematic field text against search string. + * + * @param aSearchData - Criteria to search against. + * @return True if this field text matches the search criteria. + */ + virtual bool Matches( wxFindReplaceData& aSearchData ); }; diff --git a/eeschema/class_sch_component.cpp b/eeschema/class_sch_component.cpp index de1bd8f787..806e37efc1 100644 --- a/eeschema/class_sch_component.cpp +++ b/eeschema/class_sch_component.cpp @@ -12,6 +12,7 @@ #include "macros.h" #include "protos.h" #include "class_library.h" +#include "dialog_schematic_find.h" #include @@ -1150,3 +1151,23 @@ void SCH_COMPONENT::Mirror_Y(int aYaxis_position) GetField( ii )->m_Pos.x -= dx; } } + + +bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData ) +{ + if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_FIELDS ) ) + { + if( !GetField( REFERENCE )->Matches( aSearchData ) ) + return GetField( VALUE )->Matches( aSearchData ); + + return true; + } + + for( size_t i = 0; i < NUMBER_OF_FIELDS; i++ ) + { + if( GetField( i )->Matches( aSearchData ) ) + return true; + } + + return false; +} diff --git a/eeschema/class_sch_component.h b/eeschema/class_sch_component.h index f232ccaddc..59b944a32b 100644 --- a/eeschema/class_sch_component.h +++ b/eeschema/class_sch_component.h @@ -349,6 +349,14 @@ public: */ virtual void Mirror_Y(int aYaxis_position); + /** + * Compare schematic component reference and value fields against search string. + * + * @param aSearchData - Criteria to search against. + * @return True if this component reference or value field matches the search criteria. + */ + virtual bool Matches( wxFindReplaceData& aSearchData ); + #if defined (DEBUG) /** diff --git a/eeschema/class_text-label.cpp b/eeschema/class_text-label.cpp index afb9c82e71..2e945f1aa6 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/class_text-label.cpp @@ -181,6 +181,12 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() } +bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData ) +{ + return SCH_ITEM::Matches( m_Text, aSearchData ); +} + + /** function GetSchematicTextOffset (virtual) * @return the offset between the SCH_TEXT position and the text itself * position diff --git a/eeschema/class_text-label.h b/eeschema/class_text-label.h index ffeaaca370..16b6b75497 100644 --- a/eeschema/class_text-label.h +++ b/eeschema/class_text-label.h @@ -145,6 +145,14 @@ public: */ virtual void Mirror_Y( int aYaxis_position ); + /** + * Compare schematic text entry against search string. + * + * @param aSearchData - Criterial to search against. + * @return True if this schematic text item matches the search criteria. + */ + virtual bool Matches( wxFindReplaceData& aSearchData ); + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ); diff --git a/eeschema/dialog_edit_label.cpp b/eeschema/dialog_edit_label.cpp index c2a657e131..be228e87d7 100644 --- a/eeschema/dialog_edit_label.cpp +++ b/eeschema/dialog_edit_label.cpp @@ -1,5 +1,4 @@ ///////////////////////////////////////////////////////////////////////////// - // Name: dialog_edit_label.cpp // Author: jean-pierre Charras // Modified by: @@ -19,31 +18,32 @@ #include "dialog_edit_label.h" -/*************************************************************************/ -void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct ) -{ -/*************************************************************************/ /* Edit the properties of the text (Label, Global label, graphic text).. ) - * pointed by "TextStruct" + * pointed by "aTextStruct" */ - if( TextStruct == NULL ) +void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* aTextItem ) +{ + if( aTextItem == NULL ) return; - DialogLabelEditor dialog( this, TextStruct ); - dialog.ShowModal(); + DialogLabelEditor dialog( this, aTextItem ); + dialog.ShowModal(); } - -DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText ) : - DialogLabelEditor_Base( parent ) +DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* aParent, SCH_TEXT* aTextItem ) : + DialogLabelEditor_Base( aParent ) { - m_Parent = parent; - m_CurrentText = CurrentText; + m_Parent = aParent; + m_CurrentText = aTextItem; InitDialog(); - GetSizer()->SetSizeHints(this); + GetSizer()->SetSizeHints( this ); + Layout(); + Fit(); + SetMinSize( GetBestSize() ); + Centre(); } @@ -51,22 +51,26 @@ DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* C void DialogLabelEditor::InitDialog() { wxString msg; - bool multine = false; + bool multiLine = false; if( m_CurrentText->m_MultilineAllowed ) { - m_TextLabel = m_textCtrlMultiline; - m_TextLabelSingleline->Show(false); - multine = true; - } - else - { - m_TextLabel = m_TextLabelSingleline; - m_textCtrlMultiline->Show(false); + /* Multiline text edit control must be created because changing the text + * control style to multiline must be done when the control is created. + */ + m_textControlSizer->Detach( m_textLabel ); + m_textLabel->Destroy(); + m_textLabel = NULL; + m_textLabel = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, + wxDefaultSize, wxTE_MULTILINE | wxTE_PROCESS_ENTER ); + m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") ); + m_textLabel->SetMinSize( wxSize( -1, 60 ) ); + m_textControlSizer->Insert( 1, m_textLabel, 0, wxLEFT | wxEXPAND, 3 ); + multiLine = true; } - m_TextLabel->SetValue( m_CurrentText->m_Text ); - m_TextLabel->SetFocus(); + m_textLabel->SetValue( m_CurrentText->m_Text ); + m_textLabel->SetFocus(); switch( m_CurrentText->Type() ) { @@ -76,7 +80,6 @@ void DialogLabelEditor::InitDialog() case TYPE_SCH_HIERLABEL: SetTitle( _( "Hierarchal Label Properties" ) ); - m_TextShape->SetLabel( _("Hlabel Shape") ); break; case TYPE_SCH_LABEL: @@ -85,34 +88,38 @@ void DialogLabelEditor::InitDialog() default: SetTitle( _( "Text Properties" ) ); - m_TextLabel->Disconnect(wxEVT_COMMAND_TEXT_ENTER , wxCommandEventHandler ( DialogLabelEditor::onEnterKey ), NULL, this); + m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, + wxCommandEventHandler ( DialogLabelEditor::OnEnterKey ), + NULL, this ); break; } - unsigned MINTEXTWIDTH = 30; // M's are big characters, a few establish a lot of width + unsigned MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width if( m_CurrentText->m_Text.Length() < MINTEXTWIDTH ) { wxString textWidth; textWidth.Append( 'M', MINTEXTWIDTH ); - EnsureTextCtrlWidth( m_TextLabel, &textWidth ); + EnsureTextCtrlWidth( m_textLabel, &textWidth ); + } + else if ( !multiLine ) + { + EnsureTextCtrlWidth( m_textLabel ); } - else if ( ! multine ) - EnsureTextCtrlWidth( m_TextLabel ); else { - // calculate the lenght of the biggest line - // we cannot use the lenght of the entire text that has no meaning + // calculate the length of the biggest line + // we cannot use the length of the entire text that has no meaning int max_len = 0; int curr_len = 0; int imax = m_CurrentText->m_Text.Len(); for( int count = 0; count < imax; count++ ) { if( m_CurrentText->m_Text[count] == '\n' || - m_CurrentText->m_Text[count] == '\r' ) // new line - { - curr_len = 0; - } + m_CurrentText->m_Text[count] == '\r' ) // new line + { + curr_len = 0; + } else { curr_len++; @@ -122,7 +129,7 @@ void DialogLabelEditor::InitDialog() } wxString textWidth; textWidth.Append( 'M', max_len ); - EnsureTextCtrlWidth( m_TextLabel, &textWidth ); + EnsureTextCtrlWidth( m_textLabel, &textWidth ); } // Set validators @@ -137,10 +144,12 @@ void DialogLabelEditor::InitDialog() m_TextStyle->SetSelection( style ); - msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol(); - m_SizeTitle->SetLabel( msg ); + wxString units = ReturnUnitSymbol( g_UnitMetric, wxT( "(%s)" ) ); + msg = _( "H" ) + units + _( " x W" ) + units; + m_staticSizeUnits->SetLabel( msg ); - msg = ReturnStringFromValue( g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits ); + msg = ReturnStringFromValue( g_UnitMetric, m_CurrentText->m_Size.x, + m_Parent->m_InternalUnits ); m_TextSize->SetValue( msg ); if( m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL @@ -150,23 +159,24 @@ void DialogLabelEditor::InitDialog() } } + /*! - * wxTE_PROCESS_ENTER event handler for m_TextLabel + * wxTE_PROCESS_ENTER event handler for m_textLabel */ -void DialogLabelEditor::onEnterKey( wxCommandEvent& event ) +void DialogLabelEditor::OnEnterKey( wxCommandEvent& aEvent ) { - TextPropertiesAccept( event ); + TextPropertiesAccept( aEvent ); } + /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ -void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event ) +void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent ) { - TextPropertiesAccept( event ); - EndModal( wxID_OK ); + TextPropertiesAccept( aEvent ); } @@ -174,16 +184,15 @@ void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event ) * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ -void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event ) +void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent ) { m_Parent->DrawPanel->MouseToCursorSchema(); EndModal( wxID_CANCEL ); } -/****************************************************************************/ -void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) + +void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) { -/****************************************************************************/ wxString text; int value; @@ -193,7 +202,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() ); - text = m_TextLabel->GetValue(); + text = m_textLabel->GetValue(); if( !text.IsEmpty() ) m_CurrentText->m_Text = text; else if( (m_CurrentText->m_Flags & IS_NEW) == 0 ) @@ -201,8 +210,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() ); text = m_TextSize->GetValue(); - value = ReturnValueFromString( g_UnitMetric, text, - m_Parent->m_InternalUnits ); + value = ReturnValueFromString( g_UnitMetric, text, m_Parent->m_InternalUnits ); m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value; if( m_TextShape ) m_CurrentText->m_Shape = m_TextShape->GetSelection(); @@ -224,7 +232,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) m_CurrentText->m_Width = 0; } - m_Parent->OnModify( ); + m_Parent->OnModify(); /* Make the text size as new default size if it is a new text */ if( (m_CurrentText->m_Flags & IS_NEW) != 0 ) @@ -232,7 +240,5 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() ); m_Parent->DrawPanel->MouseToCursorSchema(); - EndModal( 0 ); + EndModal( wxID_OK ); } - - diff --git a/eeschema/dialog_edit_label.h b/eeschema/dialog_edit_label.h index e76e288855..1ffedc4821 100644 --- a/eeschema/dialog_edit_label.h +++ b/eeschema/dialog_edit_label.h @@ -13,12 +13,11 @@ class DialogLabelEditor : public DialogLabelEditor_Base { private: - WinEDA_SchematicFrame * m_Parent; - SCH_TEXT * m_CurrentText; - wxTextCtrl* m_TextLabel; + WinEDA_SchematicFrame* m_Parent; + SCH_TEXT* m_CurrentText; public: - DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText); + DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* aTextItem ); ~DialogLabelEditor(){}; @@ -26,10 +25,10 @@ public: private: void InitDialog( ); - void onEnterKey( wxCommandEvent& event ); - void OnButtonOKClick( wxCommandEvent& event ); - void OnButtonCANCEL_Click( wxCommandEvent& event ); - void TextPropertiesAccept( wxCommandEvent& event ); + virtual void OnEnterKey( wxCommandEvent& aEvent ); + virtual void OnOkClick( wxCommandEvent& aEvent ); + virtual void OnCancelClick( wxCommandEvent& aEvent ); + void TextPropertiesAccept( wxCommandEvent& aEvent ); }; diff --git a/eeschema/dialog_edit_label_base.cpp b/eeschema/dialog_edit_label_base.cpp index 19b4d001ad..0845c11e39 100644 --- a/eeschema/dialog_edit_label_base.cpp +++ b/eeschema/dialog_edit_label_base.cpp @@ -16,78 +16,82 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 ); + m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 ); + m_textControlSizer->SetFlexibleDirection( wxBOTH ); + m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); - bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 ); - m_TextLabelSingleline = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); - m_TextLabelSingleline->SetToolTip( _("Enter the text to be used within the schematic") ); + m_textLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") ); - bMainSizer->Add( m_TextLabelSingleline, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_textControlSizer->Add( m_textLabel, 0, wxEXPAND|wxLEFT, 3 ); - m_textCtrlMultiline = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER ); - m_textCtrlMultiline->SetToolTip( _("Enter the text to be used within the schematic") ); - m_textCtrlMultiline->SetMinSize( wxSize( -1,60 ) ); + m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SizeTitle->Wrap( -1 ); + m_textControlSizer->Add( m_SizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); - bMainSizer->Add( m_textCtrlMultiline, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + wxBoxSizer* bSizeCtrlSizer; + bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 ); + + m_staticSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticSizeUnits->Wrap( -1 ); + bSizeCtrlSizer->Add( m_staticSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + + m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 ); + + bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); wxBoxSizer* m_OptionsSizer; m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") }; int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString ); - m_TextOrient = new wxRadioBox( this, wxID_ANY, _("Direction"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS ); + m_TextOrient = new wxRadioBox( this, wxID_ANY, _("O&rietation"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS ); m_TextOrient->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextOrient, 1, wxALL, 5 ); + m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP, 3 ); wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString ); - m_TextStyle = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS ); + m_TextStyle = new wxRadioBox( this, wxID_ANY, _("St&yle"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS ); m_TextStyle->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextStyle, 1, wxALL, 5 ); + m_OptionsSizer->Add( m_TextStyle, 1, wxLEFT|wxRIGHT|wxTOP, 3 ); - wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidi"), _("TriState"), _("Passive") }; + wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidirectional"), _("Tri-State"), _("Passive") }; int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString ); - m_TextShape = new wxRadioBox( this, wxID_ANY, _("Glabel Shape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS ); - m_TextShape->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 ); + m_TextShape = new wxRadioBox( this, wxID_ANY, _("S&hape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS ); + m_TextShape->SetSelection( 2 ); + m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP, 3 ); - wxBoxSizer* bSizer4; - bSizer4 = new wxBoxSizer( wxVERTICAL ); + bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); - m_SizeTitle = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); - m_SizeTitle->Wrap( -1 ); - bSizer4->Add( m_SizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - - bSizer4->Add( 8, 8, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer4->Add( m_buttonOK, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer4->Add( m_buttonCANCEL, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_OptionsSizer->Add( bSizer4, 1, 0, 5 ); - - bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND, 5 ); + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); this->SetSizer( bMainSizer ); this->Layout(); + bMainSizer->Fit( this ); // Connect Events - m_TextLabelSingleline->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this ); - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); - m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); + m_textLabel->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this ); } DialogLabelEditor_Base::~DialogLabelEditor_Base() { // Disconnect Events - m_TextLabelSingleline->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this ); - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); - m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); + m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this ); } diff --git a/eeschema/dialog_edit_label_base.fbp b/eeschema/dialog_edit_label_base.fbp index 783f681be0..0dd2949570 100644 --- a/eeschema/dialog_edit_label_base.fbp +++ b/eeschema/dialog_edit_label_base.fbp @@ -32,7 +32,7 @@ DialogLabelEditor_Base - 526,290 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Text Editor @@ -76,203 +76,98 @@ wxVERTICAL none - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Text - - - m_staticText1 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_VALUE - - 0 - - m_TextLabelSingleline - protected - - - wxTE_PROCESS_ENTER - - Enter the text to be used within the schematic - - - - - - - - - - - - - - - - - - - - - - - - - - - - onEnterKey - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT + 12 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP 1 - - - - 1 - - - 0 - wxID_ANY - - 0 - -1,60 - m_textCtrlMultiline - protected - - - wxTE_MULTILINE|wxTE_PROCESS_ENTER - - Enter the text to be used within the schematic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - + + 2 + wxBOTH + + + 3 - m_OptionsSizer - wxHORIZONTAL - none + m_textControlSizer + wxFLEX_GROWMODE_SPECIFIED + protected + 2 + 3 - 5 - wxALL - 1 - + 3 + wxRIGHT + 0 + - "Right" "Up" "Left" "Down" 1 0 wxID_ANY - Direction - 1 + &Text: - m_TextOrient + m_staticText1 protected - 0 - wxRA_SPECIFY_COLS + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxEXPAND|wxLEFT + 0 + + + + 1 + + + 0 + wxID_VALUE + + 0 + + m_textLabel + protected + + + wxTE_PROCESS_ENTER + + Enter the text to be used within the schematic + + + + @@ -290,43 +185,44 @@ - + + OnEnterKey + + - 5 - wxALL - 1 - + 3 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + - "Normal" "Italic" "Bold" "Bold Italic" 1 0 wxID_ANY - Style - 1 + &Size: - m_TextStyle + m_SizeTitle protected - 0 - wxRA_SPECIFY_COLS + + -1 @@ -344,7 +240,6 @@ - @@ -354,122 +249,17 @@ - 5 - wxALL - 1 - - - "Input" "Output" "Bidi" "TriState" "Passive" - - 1 - - - 0 - wxID_ANY - Glabel Shape - 1 - - - m_TextShape - protected - - 0 - - wxRA_SPECIFY_COLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - + 3 + wxEXPAND 1 - bSizer4 - wxVERTICAL + bSizeCtrlSizer + wxHORIZONTAL none - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Size - - - m_SizeTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 3 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT 0 @@ -523,32 +313,21 @@ - 5 - wxALIGN_CENTER_HORIZONTAL|wxEXPAND + 3 + wxALIGN_CENTER_VERTICAL|wxLEFT 0 - - 8 - protected - 8 - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 1 - + - 0 1 0 - wxID_OK - OK + wxID_ANY + units - m_buttonOK + m_staticSizeUnits protected @@ -558,59 +337,7 @@ - OnButtonOKClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 1 - - - - 0 - 1 - - - 0 - wxID_CANCEL - Cancel - - - m_buttonCANCEL - protected - - - - - - - - - OnButtonCANCEL_Click + -1 @@ -640,6 +367,205 @@ + + 12 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + + m_OptionsSizer + wxHORIZONTAL + none + + 3 + wxRIGHT|wxTOP + 1 + + + "Right" "Up" "Left" "Down" + + 1 + + + 0 + wxID_ANY + O&rietation + 1 + + + m_TextOrient + protected + + 0 + + wxRA_SPECIFY_COLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxLEFT|wxRIGHT|wxTOP + 1 + + + "Normal" "Italic" "Bold" "Bold Italic" + + 1 + + + 0 + wxID_ANY + St&yle + 1 + + + m_TextStyle + protected + + 0 + + wxRA_SPECIFY_COLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALL|wxLEFT|wxTOP + 1 + + + "Input" "Output" "Bidirectional" "Tri-State" "Passive" + + 1 + + + 0 + wxID_ANY + S&hape + 1 + + + m_TextShape + protected + + 2 + + wxRA_SPECIFY_COLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancelClick + + + + OnOkClick + + + + diff --git a/eeschema/dialog_edit_label_base.h b/eeschema/dialog_edit_label_base.h index e85e5bfe61..d6c93301a2 100644 --- a/eeschema/dialog_edit_label_base.h +++ b/eeschema/dialog_edit_label_base.h @@ -17,9 +17,9 @@ #include #include #include +#include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -38,26 +38,27 @@ class DialogLabelEditor_Base : public wxDialog wxID_SIZE, }; + wxFlexGridSizer* m_textControlSizer; wxStaticText* m_staticText1; - wxTextCtrl* m_TextLabelSingleline; - wxTextCtrl* m_textCtrlMultiline; + wxTextCtrl* m_textLabel; + wxStaticText* m_SizeTitle; + wxTextCtrl* m_TextSize; + wxStaticText* m_staticSizeUnits; wxRadioBox* m_TextOrient; wxRadioBox* m_TextStyle; wxRadioBox* m_TextShape; - wxStaticText* m_SizeTitle; - wxTextCtrl* m_TextSize; - - wxButton* m_buttonOK; - wxButton* m_buttonCANCEL; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; // Virtual event handlers, overide them in your derived class - virtual void onEnterKey( wxCommandEvent& event ){ event.Skip(); } - virtual void OnButtonOKClick( wxCommandEvent& event ){ event.Skip(); } - virtual void OnButtonCANCEL_Click( wxCommandEvent& event ){ event.Skip(); } + virtual void OnEnterKey( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } public: - DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 526,290 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DialogLabelEditor_Base(); }; diff --git a/eeschema/dialog_find.cpp b/eeschema/dialog_find.cpp deleted file mode 100644 index 408406b5e1..0000000000 --- a/eeschema/dialog_find.cpp +++ /dev/null @@ -1,245 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_find.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 16/02/2006 20:18:11 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 16/02/2006 20:18:11 - - -////@begin includes -////@end includes - -#include "dialog_find.h" - -////@begin XPM images -////@end XPM images - -/*! - * WinEDA_FindFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_FindFrame, wxDialog ) - -/*! - * WinEDA_FindFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_FindFrame, wxDialog ) - -////@begin WinEDA_FindFrame event table entries - EVT_BUTTON( FIND_SHEET, WinEDA_FindFrame::OnFindSheetClick ) - - EVT_BUTTON( FIND_HIERARCHY, WinEDA_FindFrame::OnFindHierarchyClick ) - - EVT_BUTTON( FIND_NEXT, WinEDA_FindFrame::OnFindNextClick ) - - EVT_BUTTON( FIND_MARKERS, WinEDA_FindFrame::OnFindMarkersClick ) - - EVT_BUTTON( FIND_NEXT_MARKER, WinEDA_FindFrame::OnFindNextMarkerClick ) - - EVT_BUTTON( LOCATE_IN_LIBRARIES, WinEDA_FindFrame::OnLocateInLibrariesClick ) - -////@end WinEDA_FindFrame event table entries - -END_EVENT_TABLE() - -/*! - * WinEDA_FindFrame constructors - */ - -WinEDA_FindFrame::WinEDA_FindFrame( ) -{ -} - -WinEDA_FindFrame::WinEDA_FindFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - m_Parent = parent; - Create(parent, id, caption, pos, size, style); -} - -/*! - * WinEDA_FindFrame creator - */ - -bool WinEDA_FindFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin WinEDA_FindFrame member initialisation - m_NewTextCtrl = NULL; -////@end WinEDA_FindFrame member initialisation - -////@begin WinEDA_FindFrame creation - SetExtraStyle(wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - if (GetSizer()) - { - GetSizer()->SetSizeHints(this); - } - Centre(); -////@end WinEDA_FindFrame creation - - m_NewTextCtrl->SetFocus(); - - /* does not work here, might work if moved elsewhere, - see void DrcDialog::OnInitDialog( wxInitDialogEvent& event ) - // deselect the existing text, seems SetFocus() wants to emulate - // Microsoft and select all text, which is not desireable here. - m_NewTextCtrl->SetSelection(0,0); - */ - - return true; -} - -/*! - * Control creation for WinEDA_FindFrame - */ - -void WinEDA_FindFrame::CreateControls() -{ -////@begin WinEDA_FindFrame content construction - // Generated by DialogBlocks, 24/04/2009 14:23:21 (unregistered) - - WinEDA_FindFrame* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); - itemDialog1->SetSizer(itemBoxSizer2); - - wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxLEFT|wxRIGHT, 5); - - wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Item to find:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_NewTextCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer3->Add(m_NewTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); - - wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); - - wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer6->Add(itemBoxSizer7, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); - - wxButton* itemButton8 = new wxButton( itemDialog1, FIND_SHEET, _("Item in &Sheet"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1); - - wxButton* itemButton9 = new wxButton( itemDialog1, FIND_HIERARCHY, _("Item in &Hierarchy"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxLEFT|wxRIGHT, 1); - - wxButton* itemButton10 = new wxButton( itemDialog1, FIND_NEXT, _("Find &Next Item (F5)"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer7->Add(itemButton10, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1); - - wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer6->Add(itemBoxSizer11, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxFIXED_MINSIZE, 5); - - wxButton* itemButton12 = new wxButton( itemDialog1, FIND_MARKERS, _("Find Markers"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer11->Add(itemButton12, 0, wxGROW|wxLEFT|wxRIGHT, 1); - - wxButton* itemButton13 = new wxButton( itemDialog1, FIND_NEXT_MARKER, _("Next Marker (F5)"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer11->Add(itemButton13, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1); - - wxButton* itemButton14 = new wxButton( itemDialog1, LOCATE_IN_LIBRARIES, _("Find Cmp in &Lib"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer11->Add(itemButton14, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1); - - // Set validators - m_NewTextCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, & s_OldStringFound) ); -////@end WinEDA_FindFrame content construction -} - -/*! - * Should we show tooltips? - */ - -bool WinEDA_FindFrame::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_FindFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_FindFrame bitmap retrieval - wxUnusedVar(name); - return wxNullBitmap; -////@end WinEDA_FindFrame bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon WinEDA_FindFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_FindFrame icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end WinEDA_FindFrame icon retrieval -} -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON - */ - -void WinEDA_FindFrame::OnFindSheetClick( wxCommandEvent& event ) -{ - FindSchematicItem(event); -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 - */ - -void WinEDA_FindFrame::OnFindHierarchyClick( wxCommandEvent& event ) -{ - FindSchematicItem(event); -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3 - */ - -void WinEDA_FindFrame::OnLocateInLibrariesClick( wxCommandEvent& event ) -{ - LocatePartInLibs(event); -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON5 - */ - -void WinEDA_FindFrame::OnFindNextMarkerClick( wxCommandEvent& event ) -{ - FindMarker(event); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_MARKERS - */ - -void WinEDA_FindFrame::OnFindMarkersClick( wxCommandEvent& event ) -{ - FindMarker(event); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT - */ - -void WinEDA_FindFrame::OnFindNextClick( wxCommandEvent& event ) -{ - FindSchematicItem(event); -} - - diff --git a/eeschema/dialog_find.h b/eeschema/dialog_find.h deleted file mode 100644 index 50072a0696..0000000000 --- a/eeschema/dialog_find.h +++ /dev/null @@ -1,126 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_find.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 16/02/2006 20:18:11 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 16/02/2006 20:18:11 - -#ifndef _DIALOG_FIND_H_ -#define _DIALOG_FIND_H_ - -/*! - * Includes - */ - -////@begin includes -#include "wx/valtext.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define ID_TEXTCTRL1 10008 -#define FIND_SHEET 10001 -#define FIND_HIERARCHY 10002 -#define FIND_NEXT 10005 -#define FIND_MARKERS 10003 -#define FIND_NEXT_MARKER 10006 -#define LOCATE_IN_LIBRARIES 10004 -#define SYMBOL_WINEDA_FINDFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER -#define SYMBOL_WINEDA_FINDFRAME_TITLE _("EESchema Locate") -#define SYMBOL_WINEDA_FINDFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_FINDFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_FINDFRAME_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_FindFrame class declaration - */ - -class WinEDA_FindFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_FindFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_FindFrame( ); - WinEDA_FindFrame( WinEDA_SchematicFrame* parent, wxWindowID id = SYMBOL_WINEDA_FINDFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_FINDFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_FINDFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_FINDFRAME_SIZE, long style = SYMBOL_WINEDA_FINDFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_FINDFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_FINDFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_FINDFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_FINDFRAME_SIZE, long style = SYMBOL_WINEDA_FINDFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_FindFrame event handler declarations - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_SHEET - void OnFindSheetClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_HIERARCHY - void OnFindHierarchyClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT - void OnFindNextClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_MARKERS - void OnFindMarkersClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT_MARKER - void OnFindNextMarkerClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for LOCATE_IN_LIBRARIES - void OnLocateInLibrariesClick( wxCommandEvent& event ); - -////@end WinEDA_FindFrame event handler declarations - -////@begin WinEDA_FindFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_FindFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - - void FindSchematicItem(wxCommandEvent& event); - void FindMarker(wxCommandEvent& event); - void LocatePartInLibs(wxCommandEvent& event); - int ExploreAllLibraries(const wxString & wildmask, wxString & FindList); - -////@begin WinEDA_FindFrame member variables - wxTextCtrl* m_NewTextCtrl; -////@end WinEDA_FindFrame member variables - WinEDA_SchematicFrame * m_Parent; -}; - -#endif - // _DIALOG_FIND_H_ diff --git a/eeschema/dialog_find.pjd b/eeschema/dialog_find.pjd deleted file mode 100644 index 37974b7740..0000000000 --- a/eeschema/dialog_find.pjd +++ /dev/null @@ -1,1002 +0,0 @@ - - -
- 0 - "" - "" - "" - "" - "" - 0 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - "jean-pierre Charras" - "License GNU" - "" - 0 - 0 - 0 - "<All platforms>" - "<Any>" - "///////////////////////////////////////////////////////////////////////////// -// Name: %HEADER-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SOURCE-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SYMBOLS-FILENAME% -// Purpose: Symbols file -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "%HEADER-FILENAME%" -#endif - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "%HEADER-FILENAME%" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -" - " /// %BODY% -" - " -/*! - * %BODY% - */ - -" - "app_resources.h" - "app_resources.cpp" - "AppResources" - "app.h" - "app.cpp" - "Application" - 0 - "" - "<None>" - "<System>" - "utf-8" - "<System>" - "" - 0 - 0 - 4 - " " - "" - 0 - 0 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 -
- - - "" - "data-document" - "" - "" - 0 - 1 - 0 - 0 - - "Configurations" - "config-data-document" - "" - "" - 0 - 1 - 0 - 0 - "" - 1 - 0 - "" - "Debug" - "ANSI" - "Static" - "Modular" - "GUI" - "wxMSW" - "Dynamic" - "Yes" - "No" - "No" - "%WXVERSION%" - "%EXECUTABLE%" - "" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - 0 - 1 - "" - - - - - - - "Projects" - "root-document" - "" - "project" - 1 - 1 - 0 - 1 - - "Windows" - "html-document" - "" - "dialogsfolder" - 1 - 1 - 0 - 1 - - "EESchema Locate" - "dialog-document" - "" - "dialog" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbDialogProxy" - 10000 - 0 - "" - 0 - "" - 0 - 0 - "ID_DIALOG" - 10000 - "WinEDA_FindFrame" - "wxDialog" - "wxDialog" - "dialog_find.cpp" - "dialog_find.h" - "" - "EESchema Locate" - 1 - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "Tiled" - 0 - 1 - 0 - 1 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - "MAYBE_RESIZE_BORDER" - 0 - 1 - -1 - -1 - 400 - 300 - 0 - "" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "wbBoxSizerProxy" - "Vertical" - "" - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbBoxSizerProxy" - "Vertical" - "" - "Expand" - "Expand" - 0 - 5 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "" - "Item to find:" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Top" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL1" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbTextCtrlProxy" - "ID_TEXTCTRL1" - 10008 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_NewTextCtrl" - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "s_OldStringFound" - "wxTextValidator(wxFILTER_NONE, & %VARIABLE%)" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - "" - "" - 0 - - - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbBoxSizerProxy" - "Horizontal" - "" - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbBoxSizerProxy" - "Vertical" - "" - "Centre" - "Expand" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxButton: FIND_SHEET" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnFindSheetClick" - "FIND_SHEET" - 10001 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "Item in &Sheet" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - "" - "" - - - "wxButton: FIND_HIERARCHY" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnFindHierarchyClick" - "FIND_HIERARCHY" - 10002 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "Item in &Hierarchy" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - "" - "" - - - "wxButton: FIND_NEXT" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "3/3/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnFindNextClick" - "FIND_NEXT" - 10005 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "Find &Next Item (F5)" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 1 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - "" - "" - - - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbBoxSizerProxy" - "Vertical" - "" - "Centre" - "Expand" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 0 - 1 - "<Any platform>" - - "wxButton: FIND_MARKERS" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnFindMarkersClick" - "FIND_MARKERS" - 10003 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "Find Markers" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - "" - "" - - - "wxButton: FIND_NEXT_MARKER" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "3/3/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnFindNextMarkerClick" - "FIND_NEXT_MARKER" - 10006 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "Next Marker (F5)" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - "" - "" - - - "wxButton: LOCATE_IN_LIBRARIES" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "16/11/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnLocateInLibrariesClick" - "LOCATE_IN_LIBRARIES" - 10004 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "Find Cmp in &Lib" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 1 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - "" - "" - - - - - - - - "Sources" - "html-document" - "" - "sourcesfolder" - 1 - 1 - 0 - 1 - - "dialog_find.rc" - "source-editor-document" - "dialog_find.rc" - "source-editor" - 0 - 0 - 1 - 0 - "16/11/2006" - "" - - - - "Images" - "html-document" - "" - "bitmapsfolder" - 1 - 1 - 0 - 1 - - - - -
diff --git a/eeschema/dialog_sch_find.fbp b/eeschema/dialog_sch_find.fbp new file mode 100644 index 0000000000..06e6376df1 --- /dev/null +++ b/eeschema/dialog_sch_find.fbp @@ -0,0 +1,1017 @@ + + + + + + C++ + 1 + UTF-8 + connect + dialog_schematic_find_base + 1000 + none + 1 + dialog_sch_find + + . + + 1 + 0 + 0 + + + wxBOTH + + 1 + + + + 0 + wxID_ANY + + + DIALOG_SCH_FIND_BASE + + + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Find + + + + + + + + OnClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mainSizer + wxHORIZONTAL + none + + 6 + wxALL|wxEXPAND + 1 + + + leftSizer + wxVERTICAL + none + + 6 + wxALL|wxEXPAND + 1 + + 2 + wxBOTH + + + 3 + + leftGridSizer + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 3 + + 6 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + &Search for: + + + m_staticText1 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 0 + + + + + 1 + + + 0 + wxID_ANY + + 125,-1 + m_comboFind + protected + + + wxCB_DROPDOWN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUpdateDrcUI + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 1 + wxID_ANY + Replace &with: + + + m_staticReplace + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND + 0 + + + + + 1 + + + 1 + wxID_ANY + + + m_comboReplace + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUpdateDrcUI + + + + 5 + + 0 + + + + 1 + + + 1 + wxID_ANY + Direction: + + + m_staticDirection + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + directionSizer + wxVERTICAL + none + + 3 + wxALL + 0 + + + + 1 + + + 1 + wxID_ANY + F&orward + + + m_radioForward + protected + + + wxRB_GROUP + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALL + 0 + + + + 1 + + + 1 + wxID_ANY + &Backward + + + m_radioBackward + protected + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Match &whole word + + + m_checkWholeWord + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUpdateWholeWordUI + + + + 6 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + &Match case + + + m_checkMatchCase + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Search &using simple wildcard matching + + + m_checkWildcardMatch + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnUpdateWildcardUI + + + + 6 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + 1 + + 1 + + + 0 + wxID_ANY + Wrap around &end of search list + + + m_checkWrap + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Search all component &fields + + + m_checkAllFields + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Search the current sheet on&ly + + + m_checkCurrentSheetOnly + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALL|wxEXPAND + 0 + + + rightSizer + wxVERTICAL + none + + 6 + wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_FIND + &Find + + + m_buttonFind + protected + + + + + + + + + OnFind + + + + + + + + + + + + + + + + + + + + + + + OnUpdateFindUI + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 1 + wxID_ANY + &Replace + + + m_buttonReplace + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 1 + wxID_ANY + Replace &All + + + m_buttonReplaceAll + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + m_buttonCancel + protected + + + + + + + + + OnCancel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eeschema/dialog_schematic_find.cpp b/eeschema/dialog_schematic_find.cpp new file mode 100644 index 0000000000..c4dd8ab465 --- /dev/null +++ b/eeschema/dialog_schematic_find.cpp @@ -0,0 +1,171 @@ +#include "dialog_schematic_find.h" + + +DEFINE_EVENT_TYPE( EVT_COMMAND_FIND_DRC_MARKER ) +DEFINE_EVENT_TYPE( EVT_COMMAND_FIND_COMPONENT_IN_LIB ) + + +DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, + const wxPoint& aPosition, const wxSize& aSize, int aStyle ) : + DIALOG_SCH_FIND_BASE( aParent, wxID_ANY, _( "Find" ), aPosition, aSize, + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | aStyle ) +{ + SetData( aData ); + + wxASSERT_MSG( m_findReplaceData, wxT( "can't create find dialog without data" ) ); + + if( aStyle & wxFR_REPLACEDIALOG ) + { + m_staticReplace->Show( true ); + m_comboReplace->Show( true ); + } + + int flags = m_findReplaceData->GetFlags(); + m_radioForward->SetValue( flags & wxFR_DOWN ); + m_radioBackward->SetValue( ( flags & wxFR_DOWN ) == 0 ); + m_checkMatchCase->SetValue( flags & wxFR_MATCHCASE ); + m_checkWholeWord->SetValue( flags & wxFR_WHOLEWORD ); + + /* Whole work and wild card searches are mutually exclusive. */ + if( !( flags & wxFR_WHOLEWORD ) ) + m_checkWildcardMatch->SetValue( flags & FR_MATCH_WILDCARD ); + + m_checkAllFields->SetValue( flags & FR_SEARCH_ALL_FIELDS ); + m_checkWrap->SetValue( flags & FR_SEARCH_WRAP ); + m_checkCurrentSheetOnly->SetValue( flags & FR_CURRENT_SHEET_ONLY ); + + m_comboFind->SetFocus(); + + SetPosition( aPosition ); + SetSize( aSize ); +} + + +void DIALOG_SCH_FIND::OnClose( wxCloseEvent& aEvent ) +{ + SendEvent( wxEVT_COMMAND_FIND_CLOSE ); +} + + +void DIALOG_SCH_FIND::OnUpdateFindUI( wxUpdateUIEvent& aEvent ) +{ + aEvent.Enable( !m_comboFind->GetValue().empty() ); +} + + +void DIALOG_SCH_FIND::OnUpdateWholeWordUI( wxUpdateUIEvent& aEvent ) +{ + aEvent.Enable( !m_checkWildcardMatch->GetValue() ); +} + + +void DIALOG_SCH_FIND::OnUpdateWildcardUI( wxUpdateUIEvent& aEvent ) +{ + aEvent.Enable( !m_checkWholeWord->GetValue() ); +} + + +void DIALOG_SCH_FIND::OnFind( wxCommandEvent& aEvent ) +{ + int index = m_comboFind->FindString( m_comboFind->GetValue(), true ); + + if( index == wxNOT_FOUND ) + { + m_comboFind->Insert( m_comboFind->GetValue(), 0 ); + } + else if( index != 0 ) + { + /* Move the search string to the top of the list if it isn't already there. */ + wxString tmp = m_comboFind->GetValue(); + m_comboFind->Delete( index ); + m_comboFind->Insert( tmp, 0 ); + m_comboFind->SetSelection( 0 ); + } + + SendEvent( wxEVT_COMMAND_FIND ); +} + + +void DIALOG_SCH_FIND::OnCancel( wxCommandEvent& aEvent ) +{ + SendEvent( wxEVT_COMMAND_FIND_CLOSE ); + Show( false ); +} + + +void DIALOG_SCH_FIND::SendEvent( const wxEventType& aEventType ) +{ + wxFindDialogEvent event( aEventType, GetId() ); + event.SetEventObject( this ); + event.SetFindString( m_comboFind->GetValue() ); + + if ( HasFlag( wxFR_REPLACEDIALOG ) ) + { + event.SetReplaceString( m_comboReplace->GetValue() ); + } + + int flags = 0; + + if( m_radioForward->GetValue() ) + flags |= wxFR_DOWN; + + if( m_checkMatchCase->GetValue() ) + flags |= wxFR_MATCHCASE; + + if( m_checkWholeWord->GetValue() ) + flags |= wxFR_WHOLEWORD; + + if( m_checkWildcardMatch->GetValue() ) + flags |= FR_MATCH_WILDCARD; + + if( m_checkAllFields->GetValue() ) + flags |= FR_SEARCH_ALL_FIELDS; + + if( m_checkWrap->GetValue() ) + flags |= FR_SEARCH_WRAP; + + if( m_checkCurrentSheetOnly->GetValue() ) + flags |= FR_CURRENT_SHEET_ONLY; + + m_findReplaceData->SetFindString( event.GetFindString() ); + + if( HasFlag( wxFR_REPLACEDIALOG ) + && ( event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE + || event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL ) ) + { + m_findReplaceData->SetReplaceString( event.GetReplaceString() ); + } + + event.SetFlags( flags ); + + m_findReplaceData->SetFlags( event.GetFlags() ); + + if( !GetEventHandler()->ProcessEvent( event ) ) + { + GetParent()->GetEventHandler()->ProcessEvent( event ); + } +} + + +wxArrayString DIALOG_SCH_FIND::GetFindEntries() const +{ + return m_comboFind->GetStrings(); +} + + +void DIALOG_SCH_FIND::SetFindEntries( const wxArrayString& aEntries ) +{ + m_comboFind->Append( aEntries ); + + if( !m_comboFind->IsEmpty() ) + m_comboFind->SetSelection( 0 ); +} + + +void DIALOG_SCH_FIND::SetReplaceEntries( const wxArrayString& aEntries ) +{ + m_comboReplace->Append( aEntries ); + + if( !m_comboReplace->IsEmpty() ) + m_comboReplace->SetSelection( 0 ); +} diff --git a/eeschema/dialog_schematic_find.h b/eeschema/dialog_schematic_find.h new file mode 100644 index 0000000000..b6b44e7844 --- /dev/null +++ b/eeschema/dialog_schematic_find.h @@ -0,0 +1,88 @@ +#ifndef __dialog_schematic_find__ +#define __dialog_schematic_find__ + +/** + * @file + * + * Subclass of DIALOG_SCH_FIND_BASE, which is generated by wxFormBuilder. + * + * This dialog is used to define the search criteria used to search for items + * in the current schematic. What is searched depends on the schematic item + * type. Check the Matches() method for each item derived from SCH_ITEM() to + * find out how matching is performed against that item. + */ + +#include "dialog_schematic_find_base.h" + +#include // Use the wxFindReplaceDialog events, data, and enums. + + +/* Define schematic specific find and replace dialog flags based on the enum entries + * in wxFindReplaceFlags. These flags are intended to be used as bit masks in the + * wxFindReplaceData::m_Flags member variable. The varialble is defined as a wxUint32. + */ +enum SchematicFindReplaceFlags +{ + /* The last wxFindReplaceFlag enum is wxFR_MATCHCASE. */ + + /* Search the current sheet only. */ + FR_CURRENT_SHEET_ONLY = wxFR_MATCHCASE << 1, + + /* Search all fields in component, not just the value and reference fields. */ + FR_SEARCH_ALL_FIELDS = wxFR_MATCHCASE << 2, + + /* Perform search using simple wild card matching (* & ?). */ + FR_MATCH_WILDCARD = wxFR_MATCHCASE << 3, + + /* Wrap around the beginning or end of search list. */ + FR_SEARCH_WRAP = wxFR_MATCHCASE << 4 +}; + + +/** Implementing DIALOG_SCH_FIND_BASE */ +class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE +{ +protected: + // Handlers for DIALOG_SCH_FIND_BASE events. + void OnClose( wxCloseEvent& aEvent ); + void OnUpdateFindUI( wxUpdateUIEvent& aEvent ); + void OnUpdateWholeWordUI( wxUpdateUIEvent& aEvent ); + void OnUpdateWildcardUI( wxUpdateUIEvent& aEvent ); + void OnFind( wxCommandEvent& aEvent ); + void OnCancel( wxCommandEvent& aEvent ); + + void SendEvent( const wxEventType& aEventType ); + + wxFindReplaceData *m_findReplaceData; + + DECLARE_NO_COPY_CLASS( DIALOG_SCH_FIND ) + +public: + DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, + const wxPoint& aPosition = wxDefaultPosition, + const wxSize& aSize = wxDefaultSize, int aStyle = 0 ); + + const wxFindReplaceData *GetData() const { return m_findReplaceData; } + void SetData(wxFindReplaceData *aData) { m_findReplaceData = aData; } + + void SetFindEntries( const wxArrayString& aEntries ); + wxArrayString GetFindEntries() const; + + void SetReplaceEntries( const wxArrayString& aEntries ); + wxArrayString GetReplaceEntries() const { return m_comboReplace->GetStrings(); } +}; + + +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EVENT_TYPE( EVT_COMMAND_FIND_DRC_MARKER, wxID_HIGHEST + 5000 ) + DECLARE_EVENT_TYPE( EVT_COMMAND_FIND_COMPONENT_IN_LIB, wxID_HIGHEST + 5001 ) +END_DECLARE_EVENT_TYPES() + + +#define EVT_FIND_DRC_MARKER( id, fn ) \ + wx__DECLARE_EVT1( EVT_COMMAND_FIND_DRC_MARKER, id, wxFindDialogEventHandler( fn ) ) + +#define EVT_FIND_COMPONENT_IN_LIB( id, fn ) \ + wx__DECLARE_EVT1( EVT_COMMAND_FIND_COMPONENT_IN_LIB, id, wxFindDialogEventHandler( fn ) ) + +#endif // __dialog_schematic_find__ diff --git a/eeschema/dialog_schematic_find_base.cpp b/eeschema/dialog_schematic_find_base.cpp new file mode 100644 index 0000000000..0198709937 --- /dev/null +++ b/eeschema/dialog_schematic_find_base.cpp @@ -0,0 +1,147 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_schematic_find_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_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* mainSizer; + mainSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* leftSizer; + leftSizer = new wxBoxSizer( wxVERTICAL ); + + wxFlexGridSizer* leftGridSizer; + leftGridSizer = new wxFlexGridSizer( 3, 2, 3, 3 ); + leftGridSizer->SetFlexibleDirection( wxBOTH ); + leftGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Search for:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + leftGridSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 6 ); + + m_comboFind = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN ); + m_comboFind->SetMinSize( wxSize( 125,-1 ) ); + + leftGridSizer->Add( m_comboFind, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 6 ); + + m_staticReplace = new wxStaticText( this, wxID_ANY, _("Replace &with:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticReplace->Wrap( -1 ); + m_staticReplace->Hide(); + + leftGridSizer->Add( m_staticReplace, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_comboReplace = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_comboReplace->Hide(); + + leftGridSizer->Add( m_comboReplace, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 ); + + m_staticDirection = new wxStaticText( this, wxID_ANY, _("Direction:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticDirection->Wrap( -1 ); + m_staticDirection->Hide(); + + leftGridSizer->Add( m_staticDirection, 0, 0, 5 ); + + wxBoxSizer* directionSizer; + directionSizer = new wxBoxSizer( wxVERTICAL ); + + m_radioForward = new wxRadioButton( this, wxID_ANY, _("F&orward"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_radioForward->Hide(); + + directionSizer->Add( m_radioForward, 0, wxALL, 3 ); + + m_radioBackward = new wxRadioButton( this, wxID_ANY, _("&Backward"), wxDefaultPosition, wxDefaultSize, 0 ); + m_radioBackward->Hide(); + + directionSizer->Add( m_radioBackward, 0, wxALL, 3 ); + + leftGridSizer->Add( directionSizer, 1, wxEXPAND, 5 ); + + leftSizer->Add( leftGridSizer, 1, wxALL|wxEXPAND, 6 ); + + m_checkWholeWord = new wxCheckBox( this, wxID_ANY, _("Match &whole word"), wxDefaultPosition, wxDefaultSize, 0 ); + + leftSizer->Add( m_checkWholeWord, 0, wxALL, 6 ); + + m_checkMatchCase = new wxCheckBox( this, wxID_ANY, _("&Match case"), wxDefaultPosition, wxDefaultSize, 0 ); + + leftSizer->Add( m_checkMatchCase, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_checkWildcardMatch = new wxCheckBox( this, wxID_ANY, _("Search &using simple wildcard matching"), wxDefaultPosition, wxDefaultSize, 0 ); + + leftSizer->Add( m_checkWildcardMatch, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_checkWrap = new wxCheckBox( this, wxID_ANY, _("Wrap around &end of search list"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkWrap->SetValue(true); + + leftSizer->Add( m_checkWrap, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_checkAllFields = new wxCheckBox( this, wxID_ANY, _("Search all component &fields"), wxDefaultPosition, wxDefaultSize, 0 ); + + leftSizer->Add( m_checkAllFields, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_checkCurrentSheetOnly = new wxCheckBox( this, wxID_ANY, _("Search the current sheet on&ly"), wxDefaultPosition, wxDefaultSize, 0 ); + + leftSizer->Add( m_checkCurrentSheetOnly, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + mainSizer->Add( leftSizer, 1, wxALL|wxEXPAND, 6 ); + + wxBoxSizer* rightSizer; + rightSizer = new wxBoxSizer( wxVERTICAL ); + + m_buttonFind = new wxButton( this, wxID_FIND, _("&Find"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonFind->SetDefault(); + rightSizer->Add( m_buttonFind, 0, wxALL, 6 ); + + m_buttonReplace = new wxButton( this, wxID_ANY, _("&Replace"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonReplace->Hide(); + + rightSizer->Add( m_buttonReplace, 0, wxALL, 5 ); + + m_buttonReplaceAll = new wxButton( this, wxID_ANY, _("Replace &All"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonReplaceAll->Hide(); + + rightSizer->Add( m_buttonReplaceAll, 0, wxALL, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + rightSizer->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + mainSizer->Add( rightSizer, 0, wxALL|wxEXPAND, 6 ); + + this->SetSizer( mainSizer ); + this->Layout(); + mainSizer->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SCH_FIND_BASE::OnClose ) ); + m_comboFind->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this ); + m_comboReplace->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this ); + m_checkWholeWord->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWholeWordUI ), NULL, this ); + m_checkWildcardMatch->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWildcardUI ), NULL, this ); + m_buttonFind->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this ); + m_buttonFind->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateFindUI ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this ); +} + +DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SCH_FIND_BASE::OnClose ) ); + m_comboFind->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this ); + m_comboReplace->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this ); + m_checkWholeWord->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWholeWordUI ), NULL, this ); + m_checkWildcardMatch->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWildcardUI ), NULL, this ); + m_buttonFind->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this ); + m_buttonFind->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateFindUI ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this ); +} diff --git a/eeschema/dialog_schematic_find_base.h b/eeschema/dialog_schematic_find_base.h new file mode 100644 index 0000000000..4aecd44ae7 --- /dev/null +++ b/eeschema/dialog_schematic_find_base.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_schematic_find_base__ +#define __dialog_schematic_find_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_SCH_FIND_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_SCH_FIND_BASE : public wxDialog +{ + private: + + protected: + wxStaticText* m_staticText1; + wxComboBox* m_comboFind; + wxStaticText* m_staticReplace; + wxComboBox* m_comboReplace; + wxStaticText* m_staticDirection; + wxRadioButton* m_radioForward; + wxRadioButton* m_radioBackward; + wxCheckBox* m_checkWholeWord; + wxCheckBox* m_checkMatchCase; + wxCheckBox* m_checkWildcardMatch; + wxCheckBox* m_checkWrap; + wxCheckBox* m_checkAllFields; + wxCheckBox* m_checkCurrentSheetOnly; + wxButton* m_buttonFind; + wxButton* m_buttonReplace; + wxButton* m_buttonReplaceAll; + wxButton* m_buttonCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnUpdateDrcUI( wxUpdateUIEvent& event ){ event.Skip(); } + virtual void OnUpdateWholeWordUI( wxUpdateUIEvent& event ){ event.Skip(); } + virtual void OnUpdateWildcardUI( wxUpdateUIEvent& event ){ event.Skip(); } + virtual void OnFind( wxCommandEvent& event ){ event.Skip(); } + virtual void OnUpdateFindUI( wxUpdateUIEvent& event ){ event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); } + + + public: + DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_SCH_FIND_BASE(); + +}; + +#endif //__dialog_schematic_find_base__ diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 7ad283fac0..1d4891a283 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -22,14 +22,14 @@ static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC ); static wxPoint ItemInitialPosition; static int OldOrient; static wxSize OldSize; -static int s_DefaultShapeGLabel = (int) NET_INPUT; -static int s_DefaultOrientGLabel = 0; +static int lastGlobalLabelShape = (int) NET_INPUT; +static int lastTextOrientation = 0; +static bool lastTextBold = false; +static bool lastTextItalic = false; -/*****************************************************************************/ void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) { -/*****************************************************************************/ if( TextStruct == NULL ) return; @@ -72,10 +72,8 @@ void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) } -/*****************************************************************************/ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) { -/*****************************************************************************/ if( TextStruct == NULL ) TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur, GetScreen(), TEXTITEM | LABELITEM ); @@ -113,11 +111,9 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) } -/*************************************************************************/ -SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) -/*************************************************************************/ /* Routine to create new text struct (GraphicText, label or Glabel). */ +SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) { SCH_TEXT* NewText = NULL; @@ -135,14 +131,12 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) case LAYER_HIERLABEL: NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur ); - NewText->m_Shape = s_DefaultShapeGLabel; - NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel ); + NewText->m_Shape = lastGlobalLabelShape; break; case LAYER_GLOBLABEL: NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur ); - NewText->m_Shape = s_DefaultShapeGLabel; - NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel ); + NewText->m_Shape = lastGlobalLabelShape; break; default: @@ -151,6 +145,9 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) return NULL; } + NewText->m_Bold = lastTextBold; + NewText->m_Italic = lastTextItalic; + NewText->SetSchematicTextOrientation( lastTextOrientation ); NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; NewText->m_Flags = IS_NEW | IS_MOVED; @@ -163,10 +160,13 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) return NULL; } + lastTextBold = NewText->m_Bold; + lastTextItalic = NewText->m_Italic; + lastTextOrientation = NewText->GetSchematicTextOrientation(); + if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL ) { - s_DefaultShapeGLabel = NewText->m_Shape; - s_DefaultOrientGLabel = NewText->GetSchematicTextOrientation(); + lastGlobalLabelShape = NewText->m_Shape; } RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE ); @@ -208,11 +208,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) } -/*************************************************************/ +/* Abort function for the command move text */ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) { -/*************************************************************/ -/* Abort function for the command move text */ BASE_SCREEN* screen = Panel->GetScreen(); SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); @@ -260,17 +258,14 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) } -/*****************************************************************************/ -void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, - wxDC* DC, int newtype ) -{ -/*****************************************************************************/ /* Routine to change a text type to an other one (GraphicText, label or * Glabel). * A new test, label or hierarchical or global label is created from the old * text. * the old text is deleted */ +void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ) +{ if( Text == NULL ) return; diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 73c430ec73..5c140b8fd6 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -33,10 +33,6 @@ SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item * before it is modified (used for undo * managing to restore old values ) */ -bool g_LastSearchIsMarker; /* True if last seach is a marker serach - * False for a schematic item search - * Used for hotkey next search */ - /* Block operation (copy, paste) */ BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste // (Created by Block Save) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index c55542c618..cc987a5694 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -18,9 +18,13 @@ #include "hotkeys.h" #include "dialog_eeschema_options.h" +#include + #define HOTKEY_FILENAME wxT( "eeschema" ) +#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings. + void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event ) { @@ -352,6 +356,15 @@ static const wxString PrintDialogPositionXEntry( wxT( "PrintDialogPositionX" ) ) static const wxString PrintDialogPositionYEntry( wxT( "PrintDialogPositionY" ) ); static const wxString PrintDialogWidthEntry( wxT( "PrintDialogWidth" ) ); static const wxString PrintDialogHeightEntry( wxT( "PrintDialogHeight" ) ); +static const wxString FindDialogPositionXEntry( wxT( "FindDialogPositionX" ) ); +static const wxString FindDialogPositionYEntry( wxT( "FindDialogPositionY" ) ); +static const wxString FindDialogWidthEntry( wxT( "FindDialogWidth" ) ); +static const wxString FindDialogHeightEntry( wxT( "FindDialogHeight" ) ); +static const wxString FindReplaceFlagsEntry( wxT( "LastFindReplaceFlags" ) ); +static const wxString FindStringEntry( wxT( "LastFindString" ) ); +static const wxString ReplaceStringEntry( wxT( "LastReplaceString" ) ); +static const wxString FindStringHistoryEntry( wxT( "FindStringHistoryList%d" ) ); +static const wxString ReplaceStringHistoryEntry( wxT( "ReplaceStringHistoryList%d" ) ); /* @@ -474,6 +487,8 @@ void WinEDA_SchematicFrame::LoadSettings() (long) 6 ); cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false ); cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true ); + + /* Load print preview window session settings. */ cfg->Read( PreviewFramePositionXEntry, &tmp, -1 ); m_previewPosition.x = (int) tmp; cfg->Read( PreviewFramePositionYEntry, &tmp, -1 ); @@ -483,6 +498,7 @@ void WinEDA_SchematicFrame::LoadSettings() cfg->Read( PreviewFrameHeightEntry, &tmp, -1 ); m_previewSize.SetHeight( (int) tmp ); + /* Load print dialog session settings. */ cfg->Read( PrintDialogPositionXEntry, &tmp, -1 ); m_printDialogPosition.x = (int) tmp; cfg->Read( PrintDialogPositionYEntry, &tmp, -1 ); @@ -491,6 +507,40 @@ void WinEDA_SchematicFrame::LoadSettings() m_printDialogSize.SetWidth( (int) tmp ); cfg->Read( PrintDialogHeightEntry, &tmp, -1 ); m_printDialogSize.SetHeight( (int) tmp ); + + /* Load find dialog session setting. */ + cfg->Read( FindDialogPositionXEntry, &tmp, -1 ); + m_findDialogPosition.x = (int) tmp; + cfg->Read( FindDialogPositionYEntry, &tmp, -1 ); + m_findDialogPosition.y = (int) tmp; + cfg->Read( FindDialogWidthEntry, &tmp, -1 ); + m_findDialogSize.SetWidth( (int) tmp ); + cfg->Read( FindDialogHeightEntry, &tmp, -1 ); + m_findDialogSize.SetHeight( (int) tmp ); + wxASSERT_MSG( m_findReplaceData, + wxT( "Find dialog data settings object not created. Bad programmer!" ) ); + cfg->Read( FindReplaceFlagsEntry, &tmp, (long) wxFR_DOWN ); + m_findReplaceData->SetFlags( (wxUint32) tmp ); + m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) ); + m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, wxEmptyString ) ); + + /* Load the find and replace string history list. */ + for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ ) + { + wxString tmpHistory; + wxString entry; + entry.Printf( FindStringHistoryEntry, i ); + tmpHistory = cfg->Read( entry, wxEmptyString ); + + if( !tmpHistory.IsEmpty() ) + m_findStringHistoryList.Add( tmpHistory ); + + entry.Printf( ReplaceStringHistoryEntry, i ); + tmpHistory = cfg->Read( entry, wxEmptyString ); + + if( !tmpHistory.IsEmpty() ) + m_replaceStringHistoryList.Add( tmpHistory ); + } } @@ -511,13 +561,43 @@ void WinEDA_SchematicFrame::SaveSettings() cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins ); cfg->Write( HorzVertLinesOnlyEntry, g_HVLines ); + /* Save print preview window session settings. */ cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x ); cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y ); cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() ); cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() ); + /* Save print dialog session settings. */ cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x ); cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y ); cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() ); cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() ); + + /* Save find dialog session setting. */ + cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x ); + cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y ); + cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() ); + cfg->Write( FindDialogHeightEntry, m_findDialogSize.GetHeight() ); + wxASSERT_MSG( m_findReplaceData, + wxT( "Find dialog data settings object not created. Bad programmer!" ) ); + cfg->Write( FindReplaceFlagsEntry, (long) m_findReplaceData->GetFlags() ); + cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() ); + cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() ); + + /* Save the find and replace string history list. */ + size_t i; + wxString tmpHistory; + wxString entry; + + for ( i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ ) + { + entry.Printf( FindStringHistoryEntry, i ); + cfg->Write( entry, m_findStringHistoryList[ i ] ); + } + + for ( i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ ) + { + entry.Printf( ReplaceStringHistoryEntry, i ); + cfg->Write( entry, m_replaceStringHistoryList[ i ] ); + } } diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 53158d7720..93f80a84d0 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -97,7 +97,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, wxSetWorkingDirectory( wxPathOnly( FullFileName ) ); screen->m_FileName = FullFileName; g_RootSheet->SetFileName( FullFileName ); - Affiche_Message( wxEmptyString ); + SetStatusText( wxEmptyString ); ClearMsgPanel(); memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) ); diff --git a/eeschema/find.cpp b/eeschema/find.cpp index 2d094662aa..642f0cbf4f 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -24,50 +24,59 @@ #include "kicad_device_context.h" -#include // Use the wxFindReplaceDialog events, data, and enums. #include +#include "dialog_schematic_find.h" -/* Define schematic specific find and replace dialog flags based on the enum entries - * in wxFindReplaceFlags. These flags are intended to be used as bit masks in the - * wxFindReplaceData::m_Flags member variable. The varialble is defined as a wxUint32. - */ -enum SchematicFindReplaceFlags + +void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event ) { - /* The last wxFindReplaceFlag enum is wxFR_MATCHCASE. */ + static SCH_MARKER* lastMarker = NULL; - /* Search the current sheet only. */ - schFR_CURRENT_SHEET_ONLY = wxFR_MATCHCASE << 1, + wxString msg; + SCH_SHEET_LIST schematic; + SCH_SHEET_PATH* sheetFoundIn = NULL; + bool wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0; + wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() ); - /* Search for design rule check markers. */ - schFR_DRC_MARKERS = wxFR_MATCHCASE << 2, - - /* Search for component in all loaded libraries. */ - schFR_SEARCH_LIBS_FOR_COMPONENT = wxFR_MATCHCASE << 3 -}; - - -/* Variables Locales */ -static int s_ItemsCount, s_MarkerCount; -static wxString s_OldStringFound; - -#include "dialog_find.cpp" - - -/* Search markers in whole hierarchy. - * Mouse cursor is put on the marker - * search the first marker, or next marker - */ -void WinEDA_FindFrame::FindMarker( wxCommandEvent& event ) -{ - int id = event.GetId(); - - if( id != FIND_NEXT_MARKER ) - m_Parent->FindMarker( 0 ); + if( event.GetFlags() & FR_CURRENT_SHEET_ONLY ) + { + sheetFoundIn = m_CurrentSheet; + lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( TYPE_SCH_MARKER, + lastMarker, wrap ); + } else - m_Parent->FindMarker( 1 ); + { + lastMarker = (SCH_MARKER*) schematic.FindNextItem( TYPE_SCH_MARKER, &sheetFoundIn, + lastMarker, wrap ); + } - Close(); + if( lastMarker != NULL ) + { + if( sheetFoundIn != GetSheet() ) + { + sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() ); + *m_CurrentSheet = *sheetFoundIn; + ActiveScreen = m_CurrentSheet->LastScreen(); + m_CurrentSheet->UpdateAllScreenReferences(); + } + + sheetFoundIn->LastScreen()->m_Curseur = lastMarker->m_Pos; + + Recadre_Trace( TRUE ); + + wxString path = sheetFoundIn->Path(); + wxString units = GetAbbreviatedUnitsLabel(); + double x = To_User_Unit( g_UnitMetric, (double) lastMarker->m_Pos.x, m_InternalUnits ); + double y = To_User_Unit( g_UnitMetric, (double) lastMarker->m_Pos.y, m_InternalUnits ); + msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ), + GetChars( path ), x, GetChars( units ), y, GetChars( units) ); + SetStatusText( msg ); + } + else + { + SetStatusText( _( "No more markers were found." ) ); + } } @@ -86,11 +95,11 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event ) * >= 4 => unused (same as 0) * @param mouseWarp If true, then move the mouse cursor to the item. */ -SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( - const wxString& component_reference, bool Find_in_hierarchy, - int SearchType, - const wxString& text_to_find, - bool mouseWarp ) +SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component_reference, + bool Find_in_hierarchy, + int SearchType, + const wxString& text_to_find, + bool mouseWarp ) { SCH_SHEET_PATH* sheet, * SheetWithComponentFound = NULL; SCH_ITEM* DrawList = NULL; @@ -268,513 +277,59 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( msg += _( " not found" ); } - Affiche_Message( msg ); + SetStatusText( msg ); return DrawList; } -/* Search markers in whole the hierarchy. - * Mouse cursor is put on the marker - * SearchType = 0: search the first marker, else search next marker - */ -SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType ) -{ - SCH_SHEET_PATH* sheet, * FirstSheet = NULL; - SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL; - SCH_MARKER* Marker = NULL; - int StartCount; - bool NotFound; - wxPoint firstpos, pos; - wxSize DrawAreaSize = DrawPanel->GetClientSize(); - wxPoint curpos, old_cursor_position; - bool DoCenterAndRedraw = FALSE; - wxString msg, WildText; - - g_LastSearchIsMarker = TRUE; - /* Set s_MarkerCount to 0 if we are look for the first marker */ - if( SearchType == 0 ) - s_MarkerCount = 0; - - SCH_SHEET_LIST SheetList; - - NotFound = TRUE; StartCount = 0; - /* Search for s_MarkerCount markers */ - for( sheet = SheetList.GetFirst(); sheet != NULL; - sheet = SheetList.GetNext() ) - { - DrawList = (SCH_ITEM*) sheet->LastDrawList(); - while( DrawList && NotFound ) - { - if( DrawList->Type() == TYPE_SCH_MARKER ) - { - Marker = (SCH_MARKER*) DrawList; - NotFound = FALSE; - pos = Marker->m_Pos; - if( FirstSheet == NULL ) /* First item found */ - { - FirstSheet = sheet; firstpos = pos; - FirstStruct = DrawList; - } - - StartCount++; - if( s_MarkerCount >= StartCount ) - { - NotFound = TRUE; /* Search for other markers */ - } - else /* We have found s_MarkerCount - * markers -> Ok */ - { - Struct = DrawList; s_MarkerCount++; break; - } - } - DrawList = DrawList->Next(); - } - - if( NotFound == FALSE ) - break; - } - - if( NotFound && FirstSheet ) /* markers are found, but we have - * reach the last marker */ - { - // After the last marker, the first marker is used */ - NotFound = FALSE; sheet = FirstSheet; - Struct = FirstStruct; - pos = firstpos; s_MarkerCount = 1; - } - - if( NotFound == FALSE ) - { - if( sheet != GetSheet() ) - { - sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); - *m_CurrentSheet = *sheet; - ActiveScreen = m_CurrentSheet->LastScreen(); - m_CurrentSheet->UpdateAllScreenReferences(); - DoCenterAndRedraw = TRUE; - } - - old_cursor_position = sheet->LastScreen()->m_Curseur; - sheet->LastScreen()->m_Curseur = pos; - curpos = DrawPanel->CursorScreenPosition(); - - DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x, - &m_CurrentSheet->LastScreen()->m_StartVisu.y ); - curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x; - curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y; - - // reposition the window if the chosen marker is off screen. - #define MARGIN 30 - if( ( curpos.x <= MARGIN ) || ( curpos.x >= DrawAreaSize.x - MARGIN ) - || ( curpos.y <= MARGIN ) || ( curpos.y >= DrawAreaSize.y - MARGIN ) ) - { - DoCenterAndRedraw = true;; - } - #undef MARGIN - - if( DoCenterAndRedraw ) - Recadre_Trace( TRUE ); - else - { - INSTALL_DC( dc, DrawPanel ); - EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); - DrawPanel->CursorOff( &dc ); - DrawPanel->MouseTo( curpos ); - EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); - DrawPanel->CursorOn( &dc ); - } - wxString path = sheet->Path(); - msg.Printf( _( "Marker %d found in %s" ), - s_MarkerCount, path.GetData() ); - Affiche_Message( msg ); - } - else - { - Affiche_Message( wxEmptyString ); - msg = _( "Marker Not Found" ); - DisplayError( this, msg, 10 ); - } - - return Marker; -} - - -/* Find a string in schematic. - * Call to WinEDA_SchematicFrame::FindSchematicItem() - */ -void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event ) -{ - int id = event.GetId(); - - if( id == FIND_SHEET ) - m_Parent->FindSchematicItem( m_NewTextCtrl->GetValue(), 0 ); - else if( id == FIND_HIERARCHY ) - m_Parent->FindSchematicItem( m_NewTextCtrl->GetValue(), 1 ); - else if( id == FIND_NEXT ) - m_Parent->FindSchematicItem( wxEmptyString, 2 ); - - Close(); -} - - /** - * 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. + * Finds an item in the schematic matching the search string. + * + * @param event - Find dialog event containing the find parameters. */ -SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( const wxString& pattern, - int SearchType, - bool mouseWarp ) +void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event ) { - SCH_SHEET_PATH* Sheet, * FirstSheet = NULL; - SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL; - int StartCount; - bool NotFound; - wxPoint firstpos, pos, old_cursor_position; - static int Find_in_hierarchy; - wxSize DrawAreaSize = DrawPanel->GetClientSize(); - wxPoint curpos; - bool DoCenterAndRedraw = FALSE; - wxString msg, WildText; + static SCH_ITEM* lastItem = NULL; - g_LastSearchIsMarker = FALSE; + SCH_SHEET_LIST schematic; + wxString msg; + SCH_SHEET_PATH* sheetFoundIn = NULL; + wxFindReplaceData searchCriteria; - if( SearchType == 0 ) + searchCriteria.SetFlags( event.GetFlags() ); + searchCriteria.SetFindString( event.GetFindString() ); + searchCriteria.SetReplaceString( event.GetReplaceString() ); + + if( event.GetFlags() & FR_CURRENT_SHEET_ONLY ) { - s_OldStringFound = pattern; - Find_in_hierarchy = FALSE; + sheetFoundIn = m_CurrentSheet; + lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem ); + } + else + { + lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem ); } - if( SearchType == 1 ) + if( lastItem != NULL ) { - s_OldStringFound = pattern; - Find_in_hierarchy = TRUE; - } - - if( SearchType != 2 ) - s_ItemsCount = 0; - - WildText = s_OldStringFound; - NotFound = TRUE; - StartCount = 0; - - SCH_SHEET_LIST SheetList; - - Sheet = SheetList.GetFirst(); - if( !Find_in_hierarchy ) - Sheet = m_CurrentSheet; - - for( ; Sheet != NULL; Sheet = SheetList.GetNext() ) - { - DrawList = (SCH_ITEM*) Sheet->LastDrawList(); - while( DrawList ) + if( sheetFoundIn != GetSheet() ) { - switch( DrawList->Type() ) - { - case TYPE_SCH_COMPONENT: - SCH_COMPONENT * pSch; - pSch = (SCH_COMPONENT*) DrawList; - if( WildCompareString( WildText, pSch->GetRef( Sheet ), FALSE ) ) - { - NotFound = FALSE; - pos = pSch->GetField( REFERENCE )->m_Pos; - break; - } - if( WildCompareString( WildText, - pSch->GetField( VALUE )->m_Text, - false ) ) - { - NotFound = FALSE; - pos = pSch->GetField( VALUE )->m_Pos; - } - break; - - case TYPE_SCH_LABEL: - case TYPE_SCH_GLOBALLABEL: - case TYPE_SCH_HIERLABEL: - case TYPE_SCH_TEXT: - SCH_TEXT * pDraw; - pDraw = (SCH_TEXT*) DrawList; - if( WildCompareString( WildText, pDraw->m_Text, FALSE ) ) - { - NotFound = FALSE; - pos = pDraw->m_Pos; - } - break; - - default: - break; - } - - if( NotFound == FALSE ) /* Item found ! */ - { - if( FirstSheet == NULL ) /* First Item found */ - { - FirstSheet = Sheet; - firstpos = pos; - FirstStruct = DrawList; - } - - StartCount++; - if( s_ItemsCount >= StartCount ) - { - NotFound = TRUE; /* Continue search of the next element */ - } - else - { - Struct = DrawList; - s_ItemsCount++; - break; - } - } - if( NotFound == FALSE ) - break; - DrawList = DrawList->Next(); - } - - if( NotFound == FALSE ) - break; - - if( Find_in_hierarchy == FALSE ) - break; - } - - if( NotFound && FirstSheet ) - { - NotFound = FALSE; - Sheet = FirstSheet; - Struct = FirstStruct; - pos = firstpos; - s_ItemsCount = 1; - } - - if( NotFound == FALSE ) - { - if( Sheet != GetSheet() ) - { - Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); - *m_CurrentSheet = *Sheet; + sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() ); + *m_CurrentSheet = *sheetFoundIn; ActiveScreen = m_CurrentSheet->LastScreen(); m_CurrentSheet->UpdateAllScreenReferences(); - DoCenterAndRedraw = TRUE; } - /* the struct is a TYPE_SCH_COMPONENT type, - * coordinates must be computed according to its orientation matrix - */ - if( Struct->Type() == TYPE_SCH_COMPONENT ) - { - SCH_COMPONENT* pSch = (SCH_COMPONENT*) Struct; + sheetFoundIn->LastScreen()->m_Curseur = lastItem->GetBoundingBox().Centre(); + Recadre_Trace( true ); - pos -= pSch->m_Pos; - pos = TransformCoordinate( pSch->m_Transform, pos ); - pos += pSch->m_Pos; - } - - old_cursor_position = Sheet->LastScreen()->m_Curseur; - Sheet->LastScreen()->m_Curseur = pos; - - curpos = DrawPanel->CursorScreenPosition(); - - DrawPanel->GetViewStart( - &( GetScreen()->m_StartVisu.x ), - &( GetScreen()->m_StartVisu.y ) ); - - curpos -= m_CurrentSheet->LastScreen()->m_StartVisu; - - /* There may be need to reframe the drawing */ - #define MARGIN 30 - if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN) - || (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) ) - { - DoCenterAndRedraw = true; - } - - if( DoCenterAndRedraw ) - Recadre_Trace( mouseWarp ); - else - { - INSTALL_DC( dc, DrawPanel ); - - EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur ); - DrawPanel->CursorOff( &dc ); - - if( mouseWarp ) - DrawPanel->MouseTo( curpos ); - - EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur ); - - DrawPanel->CursorOn( &dc ); - } - - msg = WildText + _( " Found in " ) + Sheet->Last()->m_SheetName; - Affiche_Message( msg ); + msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable(); + SetStatusText( msg ); } else { - Affiche_Message( wxEmptyString ); - - if( !mouseWarp ) - { - // if called from RemoteCommand() don't popup the dialog which - // needs to be dismissed, user is in PCBNEW, and doesn't want to - // bother with dismissing the dialog in EESCHEMA. - msg = WildText + _( " Not Found" ); - DisplayError( this, msg, 10 ); - } + msg.Printf( _( "No item found matching %s." ), GetChars( event.GetFindString() ) ); + SetStatusText( msg ); } - - return DrawList; -} - - -/* - * Search for a given component. - * - * The search is made in loaded libraries, and if not found in all libraries - * found in lib paths. - */ -void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) -{ - wxArrayString nameList; - wxString Text, FindList; - bool FoundInLib = false; - - Text = m_NewTextCtrl->GetValue(); - if( Text.IsEmpty() ) - { - Close(); - return; - } - - s_OldStringFound = Text; - - if( CMP_LIBRARY::GetLibraryCount() == 0 ) - { - DisplayError( this, _( "No component libraries are loaded." ) ); - Close(); - return; - } - - int nbitemsFound = 0; - - BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() ) - { - nameList.Clear(); - lib.SearchEntryNames( nameList, Text ); - - if( nameList.IsEmpty() ) - continue; - - nbitemsFound += nameList.GetCount(); - - if( !lib.IsCache() ) - FoundInLib = true; - - for( size_t i = 0; i < nameList.GetCount(); i++ ) - { - if( !FindList.IsEmpty() ) - FindList += wxT( "\n" ); - FindList << _( "Found " ) + nameList[i] + _( " in library " ) - + lib.GetName(); - } - } - - if( !FoundInLib ) - { - if( nbitemsFound ) - FindList = wxT( "\n" ) + Text + _( " found only in cache" ); - else - FindList = Text + _( " not found" ); - FindList += _( "\nExplore All Libraries?" ); - if( IsOK( this, FindList ) ) - { - FindList.Empty(); - ExploreAllLibraries( Text, FindList ); - if( FindList.IsEmpty() ) - DisplayInfoMessage( this, _( "Nothing found" ) ); - else - DisplayInfoMessage( this, FindList ); - } - } - else - { - DisplayInfoMessage( this, FindList ); - } - - Close(); -} - - -int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, - wxString& FindList ) -{ - wxString FullFileName; - FILE* file; - int nbitems = 0, LineNum = 0; - char Line[2048], * name; - wxString path; - - for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ ) - { - path = wxGetApp().GetLibraryPathList()[ii] + STRING_DIR_SEP; - FullFileName = wxFindFirstFile( path + wxT( "*." ) + - CompLibFileExtension ); - - while( !FullFileName.IsEmpty() ) - { - file = wxFopen( FullFileName, wxT( "rt" ) ); - if( file == NULL ) - continue; - - while( GetLine( file, Line, &LineNum, sizeof(Line) ) ) - { - if( strnicmp( Line, "DEF", 3 ) == 0 ) - { - /* Read one DEF part from library: - * DEF 74LS00 U 0 30 Y Y 4 0 N */ - strtok( Line, " \t\r\n" ); - name = strtok( NULL, " \t\r\n" ); - wxString st_name = CONV_FROM_UTF8( name ); - if( WildCompareString( wildmask, st_name, FALSE ) ) - { - nbitems++; - if( !FindList.IsEmpty() ) - FindList += wxT( "\n" ); - FindList << _( "Found " ) << CONV_FROM_UTF8( name ) - << _( " in lib " ) << FullFileName; - } - } - else if( strnicmp( Line, "ALIAS", 5 ) == 0 ) - { - /* Read one ALIAS part from library: - * ALIAS 74HC00 74HCT00 7400 74LS37 */ - strtok( Line, " \t\r\n" ); - while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL ) - { - wxString st_name = CONV_FROM_UTF8( name ); - if( WildCompareString( wildmask, st_name, FALSE ) ) - { - nbitems++; - if( !FindList.IsEmpty() ) - FindList += wxT( "\n" ); - FindList << _( "Found " ) << CONV_FROM_UTF8( name ) - << _( " in lib " ) << FullFileName; - } - } - } - } - - fclose( file ); - FullFileName = wxFindNextFile(); - } - } - - return nbitems; } diff --git a/eeschema/general.h b/eeschema/general.h index 7008b28046..58d445f6dd 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -104,11 +104,6 @@ extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item * before it is modified (used for undo * managing to restore old values ) */ -extern bool g_LastSearchIsMarker; /* True if last search is a marker - * search. False for a schematic - * item search. Used for hotkey - * next search. */ - /* Block operation (copy, paste) */ extern BLOCK_SELECTOR g_BlockSaveDataList; /* List of items to paste (Created * by Block Save) */ diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 9c876049bf..79c8371a7f 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -13,6 +13,8 @@ #include "libeditframe.h" #include "class_libentry.h" +#include "dialog_schematic_find.h" + /* How to add a new hotkey: * add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see @@ -137,8 +139,10 @@ static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE ); static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ); -static Ki_HotkeyInfo HkNextSearch( wxT( "Next Search" ), HK_NEXT_SEARCH, - WXK_F5 ); +static Ki_HotkeyInfo HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM, + WXK_F5 ); +static Ki_HotkeyInfo HkFindNextDrcMarker( wxT( "Find next DRC marker" ), HK_FIND_NEXT_DRC_MARKER, + WXK_F5 + GR_KB_SHIFT ); // Special keys for library editor: static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, @@ -167,7 +171,8 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] = Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = { &HkFindItem, - &HkNextSearch, + &HkFindNextItem, + &HkFindNextDrcMarker, &HkDelete, &HkInsert, &HkMove2Drag, @@ -345,13 +350,25 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, } break; - case HK_NEXT_SEARCH: + case HK_FIND_NEXT_ITEM: if( !ItemInEdit ) { - if( g_LastSearchIsMarker ) - WinEDA_SchematicFrame::FindMarker( 1 ); - else - FindSchematicItem( wxEmptyString, 2 ); + wxFindDialogEvent event( wxEVT_COMMAND_FIND, GetId() ); + event.SetEventObject( this ); + event.SetFlags( m_findReplaceData->GetFlags() ); + event.SetFindString( m_findReplaceData->GetFindString() ); + GetEventHandler()->ProcessEvent( event ); + } + break; + + case HK_FIND_NEXT_DRC_MARKER: + if( !ItemInEdit ) + { + wxFindDialogEvent event( EVT_COMMAND_FIND_DRC_MARKER, GetId() ); + event.SetEventObject( this ); + event.SetFlags( m_findReplaceData->GetFlags() ); + event.SetFindString( m_findReplaceData->GetFindString() ); + GetEventHandler()->ProcessEvent( event ); } break; diff --git a/eeschema/hotkeys.h b/eeschema/hotkeys.h index c03f41ee9a..1995b52175 100644 --- a/eeschema/hotkeys.h +++ b/eeschema/hotkeys.h @@ -10,7 +10,8 @@ // see also enum common_hotkey_id_commnand in hotkeys_basic.h // for shared hotkeys id enum hotkey_id_commnand { - HK_NEXT_SEARCH = HK_COMMON_END, + HK_FIND_NEXT_ITEM = HK_COMMON_END, + HK_FIND_NEXT_DRC_MARKER, HK_FIND_ITEM, HK_DELETE, HK_REPEAT_LAST, diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp index 73e2cac035..9cca70fc7d 100644 --- a/eeschema/lib_export.cpp +++ b/eeschema/lib_export.cpp @@ -146,5 +146,5 @@ if you want to include it as part of this project." ) ); } // Error else msg = _( "Error creating " ) + fn.GetFullName(); - Affiche_Message( msg ); + SetStatusText( msg ); } diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 7d0f58bc19..c08fd1a0d3 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -626,5 +626,5 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory() msg.Printf( _( "Component %s saved in library %s" ), GetChars( Component->GetName() ), GetChars( m_library->GetName() ) ); - Affiche_Message( msg ); + SetStatusText( msg ); } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index e9a1ef1833..68b4eef589 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -23,13 +23,14 @@ #include "annotate_dialog.h" #include "dialog_build_BOM.h" #include "dialog_erc.h" -#include "dialog_find.h" #include "netlist_control.h" #include "dialog_erc.h" #include "libeditframe.h" #include "viewlib_frame.h" #include "hotkeys.h" +#include "dialog_schematic_find.h" + BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, @@ -137,6 +138,12 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH, WinEDA_SchematicFrame::OnUpdateUnits ) + + /* Search dialog events. */ + EVT_FIND_CLOSE( wxID_ANY, WinEDA_SchematicFrame::OnFindDialogClose ) + EVT_FIND_DRC_MARKER( wxID_ANY, WinEDA_SchematicFrame::OnFindDrcMarker ) + EVT_FIND( wxID_ANY, WinEDA_SchematicFrame::OnFindSchematicItem ) + END_EVENT_TABLE() @@ -164,6 +171,8 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, m_printMonochrome = true; m_showSheetReference = true; m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr; + m_dlgFindReplace = NULL; + m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); CreateScreens(); @@ -240,8 +249,8 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, WinEDA_SchematicFrame::~WinEDA_SchematicFrame() { SAFE_DELETE( g_RootSheet ); - SAFE_DELETE( m_CurrentSheet ); //a SCH_SHEET_PATH, on the heap. - m_CurrentSheet = NULL; + SAFE_DELETE( m_CurrentSheet ); // a SCH_SHEET_PATH, on the heap. + SAFE_DELETE( m_findReplaceData ); } @@ -604,10 +613,38 @@ void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& ) void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) { + wxASSERT_MSG( m_findReplaceData != NULL, + wxT( "Forgot to create find/replace data. Bad Programmer!" ) ); + this->DrawPanel->m_IgnoreMouseEvents = TRUE; - WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this ); - dlg->ShowModal(); - dlg->Destroy(); + + if( m_dlgFindReplace ) + { + delete m_dlgFindReplace; + m_dlgFindReplace = NULL; + } + + m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, m_findDialogPosition, + m_findDialogSize ); + m_dlgFindReplace->SetFindEntries( m_findStringHistoryList ); + m_dlgFindReplace->SetReplaceEntries( m_replaceStringHistoryList ); + m_dlgFindReplace->SetMinSize( m_dlgFindReplace->GetBestSize() ); + m_dlgFindReplace->Show( true ); +} + + +void WinEDA_SchematicFrame::OnFindDialogClose( wxFindDialogEvent& event ) +{ + if( m_dlgFindReplace ) + { + m_findDialogPosition = m_dlgFindReplace->GetPosition(); + m_findDialogSize = m_dlgFindReplace->GetSize(); + m_findStringHistoryList = m_dlgFindReplace->GetFindEntries(); + m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries(); + m_dlgFindReplace->Destroy(); + m_dlgFindReplace = NULL; + } + this->DrawPanel->m_IgnoreMouseEvents = FALSE; } diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 99dcbc92aa..e30d1478d2 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -938,7 +938,7 @@ static void ComputeArcRadiusAngles( LIB_ARC* arc ) wxPoint centerStartVector = TwoPointVector( arc->m_Pos, arc->m_ArcStart ); wxPoint centerEndVector = TwoPointVector( arc->m_Pos, arc->m_ArcEnd ); - arc->m_Radius = EuclideanNorm( centerStartVector ); + arc->m_Radius = wxRound( EuclideanNorm( centerStartVector ) ); arc->m_t1 = (int) ( atan2( (double) centerStartVector.y, (double) centerStartVector.x ) * 1800 / M_PI ); diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index 25acbe107a..770d1f49d7 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -157,7 +157,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol() } msg.Printf( _( "Saving symbol in [%s]" ), GetChars( fn.GetPath() ) ); - Affiche_Message( msg ); + SetStatusText( msg ); wxString line; diff --git a/include/common.h b/include/common.h index 7e062d650c..bb2b32af8d 100644 --- a/include/common.h +++ b/include/common.h @@ -300,18 +300,28 @@ int GetCommandOptions( const int argc, const char** argv, */ const wxString& valeur_param( int valeur, wxString& buf_texte ); -wxString ReturnUnitSymbol( int Units = g_UnitMetric ); +/** + * Returns the units symbol. + * + * @param aUnits - Units type, default is current units setting. + * @param aFormatString - A formatting string to embed the units symbol into. Note: + * the format string must contain the %s format specifier. + * @return The formatted units symbol. + */ +wxString ReturnUnitSymbol( int aUnits = g_UnitMetric, + const wxString& aFormatString = _( " (%s):" ) ); /** * Get a human readable units string. * * The strings returned are full text name and not abbreviations or symbolic - * representations of units. Set ReturnUnitSymbol() for that. + * representations of the units. Use ReturnUnitSymbol() for that. * - * @param units - The units text to return. + * @param aUnits - The units text to return. * @return The human readable units string. */ -wxString GetUnitsLabel( int units ); +wxString GetUnitsLabel( int aUnits ); +wxString GetAbbreviatedUnitsLabel( int aUnits = g_UnitMetric ); int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit ); diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 9ab62bcd19..b283fcde28 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -7,6 +7,7 @@ class WinEDA_SchematicFrame; +class wxFindReplaceData; /** @@ -33,6 +34,7 @@ public: } SCH_ITEM* Next() { return (SCH_ITEM*) Pnext; } + SCH_ITEM* Back() { return (SCH_ITEM*) Pback; } /** * Function GetLayer @@ -86,6 +88,30 @@ public: * @return bool - true if success writing else false. */ virtual bool Save( FILE* aFile ) const = 0; + + /** + * Compare schematic item against search string. + * + * The base class returns false since many of the objects derived from + * SCH_ITEM do not have any text to search. + * + * @todo - This should probably be pushed down to EDA_BaseStruct so that + * searches can be done on all of the Kicad applications that use + * objects derived from EDA_BaseStruct. + * + * @param aSearchData - The search criteria. + * @return True if this schematic text item matches the search criteria. + */ + virtual bool Matches( wxFindReplaceData& aSearchData ) { return false; } + + /** + * Compare schematic item against search string. + * + * @param aText - String test. + * @param aSearchData - The criteria to search against. + * @return True if this item matches the search criteria. + */ + bool Matches( const wxString& aText, wxFindReplaceData& aSearchData ); }; #endif /* SCH_ITEM_STRUCT_H */ diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 0b94b79ae8..421e6fd013 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -32,6 +32,10 @@ class SCH_COMPONENT; class SCH_FIELD; class LIB_PIN; class SCH_JUNCTION; +class DIALOG_SCH_FIND; +class wxFindDialogEvent; +class wxFindReplaceData; + /* enum used in RotationMiroir() */ enum fl_rot_cmp @@ -73,12 +77,18 @@ private: PARAM_CFG_ARRAY m_projectFileParams; PARAM_CFG_ARRAY m_configSettings; wxPageSetupDialogData m_pageSetupData; + wxFindReplaceData* m_findReplaceData; wxPoint m_previewPosition; wxSize m_previewSize; wxPoint m_printDialogPosition; wxSize m_printDialogSize; bool m_printMonochrome; ///< Print monochrome instead of grey scale. bool m_showSheetReference; + DIALOG_SCH_FIND* m_dlgFindReplace; + wxPoint m_findDialogPosition; + wxSize m_findDialogSize; + wxArrayString m_findStringHistoryList; + wxArrayString m_replaceStringHistoryList; public: WinEDA_SchematicFrame( wxWindow* father, @@ -268,22 +278,6 @@ public: // 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. - */ - SCH_ITEM* FindSchematicItem( const wxString& pattern, - int SearchType, - bool mouseWarp = true ); - - SCH_ITEM* FindMarker( int SearchType ); - private: void Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC ); void OnExit( wxCommandEvent& event ); @@ -292,6 +286,10 @@ private: void OnCreateNetlist( wxCommandEvent& event ); void OnCreateBillOfMaterials( wxCommandEvent& event ); void OnFindItems( wxCommandEvent& event ); + void OnFindDialogClose( wxFindDialogEvent& event ); + void OnFindDrcMarker( wxFindDialogEvent& event ); + void OnFindCompnentInLib( wxFindDialogEvent& event ); + void OnFindSchematicItem( wxFindDialogEvent& event ); void OnLoadFile( wxCommandEvent& event ); void OnLoadStuffFile( wxCommandEvent& event ); void OnNewProject( wxCommandEvent& event );