diff --git a/common/base_struct.cpp b/common/base_struct.cpp index f319665c78..6b4288feb2 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -32,15 +32,11 @@ #include #include #include -#include -#include #include #include #include #include -#include "../eeschema/dialogs/dialog_schematic_find.h" - static const unsigned char dummy_png[] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 306a0537ad..187e720b3e 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -55,10 +54,17 @@ ///@{ /// \ingroup config -static const wxString FirstRunShownKeyword( wxT( "FirstRunShown" ) ); +static const wxChar FirstRunShownKeyword[] = wxT( "FirstRunShown" ); +static const wxChar FindReplaceFlagsEntry[] = wxT( "LastFindReplaceFlags" ); +static const wxChar FindStringEntry[] = wxT( "LastFindString" ); +static const wxChar ReplaceStringEntry[] = wxT( "LastReplaceString" ); +static const wxChar FindStringHistoryEntry[] = wxT( "FindStringHistoryList%d" ); +static const wxChar ReplaceStringHistoryEntry[] = wxT( "ReplaceStringHistoryList%d" ); ///@} +#define FR_HISTORY_LIST_CNT 10 ///< Maximum size of the find/replace history stacks. + /** * Integer to set the maximum number of undo items on the stack. If zero, * undo items are unlimited. @@ -90,7 +96,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame m_UndoRedoCountMax = DEFAULT_MAX_UNDO_ITEMS; m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; - m_canvas = NULL; + m_canvas = NULL; m_toolDispatcher = NULL; m_messagePanel = NULL; m_currentScreen = NULL; @@ -105,6 +111,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame m_zoomLevelCoeff = 1.0; m_userUnits = MILLIMETRES; m_PolarCoords = false; + m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_auimgr.SetFlags(wxAUI_MGR_DEFAULT); @@ -175,6 +182,8 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME() delete m_currentScreen; m_currentScreen = NULL; + delete m_findReplaceData; + m_auimgr.UnInit(); ReleaseFile(); @@ -474,6 +483,30 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); m_galDisplayOptions.ReadConfig( *cmnCfg, *aCfg, baseCfgName, this ); + + long tmp; + aCfg->Read( FindReplaceFlagsEntry, &tmp, (long) wxFR_DOWN ); + m_findReplaceData->SetFlags( (wxUint32) tmp & ~FR_REPLACE_ITEM_FOUND ); + m_findReplaceData->SetFindString( aCfg->Read( FindStringEntry, wxEmptyString ) ); + m_findReplaceData->SetReplaceString( aCfg->Read( ReplaceStringEntry, wxEmptyString ) ); + + // Load the find and replace string history list. + for( int i = 0; i < FR_HISTORY_LIST_CNT; ++i ) + { + wxString tmpHistory; + wxString entry; + entry.Printf( FindStringHistoryEntry, i ); + tmpHistory = aCfg->Read( entry, wxEmptyString ); + + if( !tmpHistory.IsEmpty() ) + m_findStringHistoryList.Add( tmpHistory ); + + entry.Printf( ReplaceStringHistoryEntry, i ); + tmpHistory = aCfg->Read( entry, wxEmptyString ); + + if( !tmpHistory.IsEmpty() ) + m_replaceStringHistoryList.Add( tmpHistory ); + } } @@ -492,6 +525,28 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg ) aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) ); m_galDisplayOptions.WriteConfig( *aCfg, baseCfgName ); + + // Save find dialog session setting. + aCfg->Write( FindReplaceFlagsEntry, (long) m_findReplaceData->GetFlags() ); + aCfg->Write( FindStringEntry, m_findReplaceData->GetFindString() ); + aCfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() ); + + // Save the find and replace string history list. + unsigned i; + wxString tmpHistory; + wxString entry; // invoke constructor outside of any loops + + for( i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ ) + { + entry.Printf( FindStringHistoryEntry, i ); + aCfg->Write( entry, m_findStringHistoryList[ i ] ); + } + + for( i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ ) + { + entry.Printf( ReplaceStringHistoryEntry, i ); + aCfg->Write( entry, m_replaceStringHistoryList[ i ] ); + } } diff --git a/eeschema/dialogs/dialog_schematic_find.cpp b/eeschema/dialogs/dialog_schematic_find.cpp index 88b349931c..c5aee4f692 100644 --- a/eeschema/dialogs/dialog_schematic_find.cpp +++ b/eeschema/dialogs/dialog_schematic_find.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include diff --git a/eeschema/dialogs/dialog_schematic_find.h b/eeschema/dialogs/dialog_schematic_find.h index 06456a5982..57a6e72a18 100644 --- a/eeschema/dialogs/dialog_schematic_find.h +++ b/eeschema/dialogs/dialog_schematic_find.h @@ -44,91 +44,6 @@ class SCH_EDIT_FRAME; class SCH_EDITOR_CONTROL; -/** - * 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 variable is defined as a wxUint32. - */ -enum SchematicFindReplaceFlags -{ - // The last wxFindReplaceFlag enum is wxFR_MATCHCASE = 0x4. - - /// 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, - - /// Search texts (name and number (a 4 letters text) )in pins. - FR_SEARCH_ALL_PINS = wxFR_MATCHCASE << 3, - - /// Perform search using simple wild card matching (* & ?). - FR_MATCH_WILDCARD = wxFR_MATCHCASE << 4, - - /// Wrap around the beginning or end of search list. - FR_SEARCH_WRAP = wxFR_MATCHCASE << 5, - - /// Perform a search for a item that has replaceable text. - FR_SEARCH_REPLACE = wxFR_MATCHCASE << 7, - - /// Used by the search event handler to let the dialog know that a replaceable - /// item has been found. - FR_REPLACE_ITEM_FOUND = wxFR_MATCHCASE << 8, - - /// Used by replace to ignore the component reference designator field. - FR_REPLACE_REFERENCES = wxFR_MATCHCASE << 9 -}; - - -/** - * Definition FR_MASK_NON_COMPARE_FLAGS - * is used to mask find/replace flag bits that do not effect the search results. - */ -#define FR_MASK_NON_COMPARE_FLAGS ~( wxFR_DOWN | FR_SEARCH_WRAP | FR_REPLACE_ITEM_FOUND ) - - -/** - * Class SCH_FIND_REPLACE_DATA - * adds missing useful comparison and assignment operators to the wxFindReplaceData object. - */ -class SCH_FIND_REPLACE_DATA : public wxFindReplaceData -{ -public: - - SCH_FIND_REPLACE_DATA& operator =( const SCH_FIND_REPLACE_DATA& aFindReplaceData ) - { - if( this == &aFindReplaceData ) - return *this; - - SetFlags( aFindReplaceData.GetFlags() ); - SetFindString( aFindReplaceData.GetFindString() ); - SetReplaceString( aFindReplaceData.GetReplaceString() ); - - return *this; - } - - bool operator ==( SCH_FIND_REPLACE_DATA& aFindReplaceData ) - { - return ( (GetFlags() == aFindReplaceData.GetFlags()) - && (GetFindString() == aFindReplaceData.GetFindString()) - && (GetReplaceString() == aFindReplaceData.GetReplaceString()) ); - } - - bool operator !=( SCH_FIND_REPLACE_DATA& aFindReplaceData ) - { - return !( *this == aFindReplaceData ); - } - -private: - /** - * Function GetSearchFlags - * @return The flags that only effect the search result. - */ - wxUint32 GetCompareFlags() const { return GetFlags() & FR_MASK_NON_COMPARE_FLAGS; } -}; - - -/** Implementing DIALOG_SCH_FIND_BASE */ class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE { protected: diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index c2ee65fc58..b7d5b539ec 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -43,15 +43,15 @@ #include #include #include -#include #include #include "sch_junction.h" #include "eeschema_id.h" -#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings. - - static int s_defaultBusThickness = DEFAULTBUSTHICKNESS; +static int s_defaultWireThickness = DEFAULTDRAWLINETHICKNESS; +static int s_defaultTextSize = DEFAULT_SIZE_TEXT; +static int s_drawDefaultLineThickness = -1; + int GetDefaultBusThickness() { @@ -61,16 +61,10 @@ int GetDefaultBusThickness() void SetDefaultBusThickness( int aThickness) { - if( aThickness >= 1 ) - s_defaultBusThickness = aThickness; - else - s_defaultBusThickness = 1; + s_defaultBusThickness = std::max( 1, aThickness ); } -static int s_defaultWireThickness = DEFAULTDRAWLINETHICKNESS; - - int GetDefaultWireThickness() { return s_defaultWireThickness; @@ -79,16 +73,10 @@ int GetDefaultWireThickness() void SetDefaultWireThickness( int aThickness ) { - if( aThickness >=1 ) - s_defaultWireThickness = aThickness; - else - s_defaultWireThickness = 1; + s_defaultWireThickness = std::max( 1, aThickness ); } -/// Default size for text (not only labels) -static int s_defaultTextSize = DEFAULT_SIZE_TEXT; - int GetDefaultTextSize() { return s_defaultTextSize; @@ -101,13 +89,6 @@ void SetDefaultTextSize( int aTextSize ) } -/* - * Default line (in Eeschema units) thickness used to draw/plot items having a - * default thickness line value (i.e. = 0 ). - */ -static int s_drawDefaultLineThickness = -1; - - int GetDefaultLineThickness() { return s_drawDefaultLineThickness; @@ -116,10 +97,7 @@ int GetDefaultLineThickness() void SetDefaultLineThickness( int aThickness ) { - if( aThickness >=1 ) - s_drawDefaultLineThickness = aThickness; - else - s_drawDefaultLineThickness = 1; + s_drawDefaultLineThickness = std::max( 1, aThickness ); } @@ -164,19 +142,9 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() &m_plotDirectoryName ) ); m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ), - LIB_PART::SubpartIdSeparatorPtr(), - 0, 0, 126 ) ); + LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) ); m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ), - LIB_PART::SubpartFirstIdPtr(), - 'A', '1', 'z' ) ); - - /* moved to library load/save specific code, in a specific section in .pro file - m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ), - &m_userLibraryPath ) ); - m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), - &m_componentLibFiles, - GROUP_SCH_LIBS ) ); - */ + LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) ); m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), &m_netListFormat) ); @@ -184,8 +152,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() &m_spiceAjustPassiveValues, false ) ); m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ), - &s_defaultTextSize, - DEFAULT_SIZE_TEXT, 5, 1000 ) ); + &s_defaultTextSize, DEFAULT_SIZE_TEXT, 5, 1000 ) ); m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ERC_WriteFile" ), &m_ercSettings.write_erc_file, false ) ); @@ -282,11 +249,6 @@ static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" static const wxChar DefaultJctSizeEntry[] = wxT( "DefaultJunctionSize" ); static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" ); static const wxChar HorzVertLinesOnlyEntry[] = wxT( "HorizVertLinesOnly" ); -static const wxChar FindReplaceFlagsEntry[] = wxT( "LastFindReplaceFlags" ); -static const wxChar FindStringEntry[] = wxT( "LastFindString" ); -static const wxChar ReplaceStringEntry[] = wxT( "LastReplaceString" ); -static const wxChar FindStringHistoryEntry[] = wxT( "FindStringHistoryList%d" ); -static const wxChar ReplaceStringHistoryEntry[] = wxT( "ReplaceStringHistoryList%d" ); static const wxChar FieldNamesEntry[] = wxT( "FieldNames" ); static const wxChar SimulatorCommandEntry[] = wxT( "SimCmdLine" ); static const wxString ShowPageLimitsEntry = "ShowPageLimits"; @@ -326,18 +288,14 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings() &m_printSheetReference, true ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatStepXEntry, - &m_repeatStep.x, - DEFAULT_REPEAT_OFFSET_X, - -REPEAT_OFFSET_MAX, - REPEAT_OFFSET_MAX ) ); + &m_repeatStep.x, DEFAULT_REPEAT_OFFSET_X, + -REPEAT_OFFSET_MAX, REPEAT_OFFSET_MAX ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatStepYEntry, - &m_repeatStep.y, - DEFAULT_REPEAT_OFFSET_Y, - -REPEAT_OFFSET_MAX, - REPEAT_OFFSET_MAX ) ); + &m_repeatStep.y, DEFAULT_REPEAT_OFFSET_Y, + -REPEAT_OFFSET_MAX, REPEAT_OFFSET_MAX ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, RepeatLabelIncrementEntry, - &m_repeatDeltaLabel, - DEFAULT_REPEAT_LABEL_INC, -10, +10 ) ); + &m_repeatDeltaLabel, DEFAULT_REPEAT_LABEL_INC, + -10, +10 ) ); return m_configSettings; } @@ -382,32 +340,6 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) // Load netlists options: aCfg->Read( SimulatorCommandEntry, &m_simulatorCommand ); - wxASSERT_MSG( m_findReplaceData, - wxT( "Find dialog data settings object not created. Bad programmer!" ) ); - - aCfg->Read( FindReplaceFlagsEntry, &tmp, (long) wxFR_DOWN ); - m_findReplaceData->SetFlags( (wxUint32) tmp & ~FR_REPLACE_ITEM_FOUND ); - m_findReplaceData->SetFindString( aCfg->Read( FindStringEntry, wxEmptyString ) ); - m_findReplaceData->SetReplaceString( aCfg->Read( ReplaceStringEntry, wxEmptyString ) ); - - // Load the find and replace string history list. - for( int i = 0; i < FR_HISTORY_LIST_CNT; ++i ) - { - wxString tmpHistory; - wxString entry; - entry.Printf( FindStringHistoryEntry, i ); - tmpHistory = aCfg->Read( entry, wxEmptyString ); - - if( !tmpHistory.IsEmpty() ) - m_findStringHistoryList.Add( tmpHistory ); - - entry.Printf( ReplaceStringHistoryEntry, i ); - tmpHistory = aCfg->Read( entry, wxEmptyString ); - - if( !tmpHistory.IsEmpty() ) - m_replaceStringHistoryList.Add( tmpHistory ); - } - wxString templateFieldNames = aCfg->Read( FieldNamesEntry, wxEmptyString ); if( !templateFieldNames.IsEmpty() ) @@ -458,31 +390,6 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) // Save netlists options: aCfg->Write( SimulatorCommandEntry, m_simulatorCommand ); - // Save find dialog session setting. - wxASSERT_MSG( m_findReplaceData, - wxT( "Find dialog data settings object not created. Bad programmer!" ) ); - aCfg->Write( FindReplaceFlagsEntry, - (long) m_findReplaceData->GetFlags() & ~FR_REPLACE_ITEM_FOUND ); - aCfg->Write( FindStringEntry, m_findReplaceData->GetFindString() ); - aCfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() ); - - // Save the find and replace string history list. - unsigned i; - wxString tmpHistory; - wxString entry; // invoke constructor outside of any loops - - for( i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ ) - { - entry.Printf( FindStringHistoryEntry, i ); - aCfg->Write( entry, m_findStringHistoryList[ i ] ); - } - - for( i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ ) - { - entry.Printf( ReplaceStringHistoryEntry, i ); - aCfg->Write( entry, m_replaceStringHistoryList[ i ] ); - } - // Save template fieldnames STRING_FORMATTER sf; m_templateFieldNames.Format( &sf, 0 ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 917a52c661..2d637aa536 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -245,7 +245,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs m_AboutTitle = "Eeschema"; - m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_findReplaceDialog = nullptr; m_findReplaceStatusPopup = nullptr; @@ -313,7 +312,6 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME() delete g_CurrentSheet; // a SCH_SHEET_PATH, on the heap. delete g_ConnectionGraph; delete m_undoItem; - delete m_findReplaceData; delete g_RootSheet; g_CurrentSheet = nullptr; diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 2c4cbc4ba3..d83f6c1b05 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -126,11 +126,8 @@ private: bool m_autoplaceAlign; ///< align autoplaced fields to the grid bool m_footprintPreview; ///< whether to show footprint previews - wxFindReplaceData* m_findReplaceData; DIALOG_SCH_FIND* m_findReplaceDialog; STATUS_TEXT_POPUP* m_findReplaceStatusPopup; - wxArrayString m_findStringHistoryList; - wxArrayString m_replaceStringHistoryList; /// Flag to indicate show hidden pins. bool m_showAllPins; diff --git a/include/base_struct.h b/include/base_struct.h index 5ea1383dbe..9bd05495e6 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -4,7 +4,7 @@ * Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2019 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,11 +24,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file base_struct.h - * @brief Basic classes for most KiCad items. - */ - #ifndef BASE_STRUCT_H_ #define BASE_STRUCT_H_ @@ -36,7 +31,7 @@ #include #include "common.h" - +#include #include #include @@ -62,6 +57,24 @@ enum SEARCH_RESULT { }; +/** + * Additional flag values wxFindReplaceData::m_Flags + */ +enum FIND_REPLACE_FLAGS +{ + // The last wxFindReplaceFlag enum is wxFR_MATCHCASE = 0x4. + FR_CURRENT_SHEET_ONLY = wxFR_MATCHCASE << 1, // Search the current sheet only. + FR_SEARCH_ALL_FIELDS = wxFR_MATCHCASE << 2, // Search user fields as well as ref and value. + FR_SEARCH_ALL_PINS = wxFR_MATCHCASE << 3, // Search pin name and number. + FR_MATCH_WILDCARD = wxFR_MATCHCASE << 4, // Use simple wild card matching (* & ?). + FR_SEARCH_WRAP = wxFR_MATCHCASE << 5, // Wrap around the start or end of search. + FR_SEARCH_REPLACE = wxFR_MATCHCASE << 7, // Search for a item that has replaceable text. + FR_REPLACE_ITEM_FOUND = wxFR_MATCHCASE << 8, // Indicates an item with replaceable text has + // been found. + FR_REPLACE_REFERENCES = wxFR_MATCHCASE << 9 // Don't replace in references. +}; + + class wxFindReplaceData; class EDA_ITEM; class EDA_DRAW_FRAME; diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h index f55b2e9ba0..0857a862b3 100644 --- a/include/eda_draw_frame.h +++ b/include/eda_draw_frame.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "hotkeys_basic.h" class wxSingleInstanceChecker; @@ -93,36 +94,40 @@ protected: std::unique_ptr m_file_checker; ///< prevents opening same file multiple times. - int m_LastGridSizeId; // The command id offset (>= 0) of the last selected + int m_LastGridSizeId; // The command id offset (>= 0) of the last selected // grid 0 is for the grid corresponding to a // wxCommand ID = ID_POPUP_GRID_LEVEL_1000. - bool m_drawGrid; // Hide/Show grid - bool m_showPageLimits; // True to display the page limits - COLOR4D m_gridColor; // Grid color - COLOR4D m_drawBgColor; // The background color of the draw canvas; BLACK for + bool m_drawGrid; // Hide/Show grid + bool m_showPageLimits; // True to display the page limits + COLOR4D m_gridColor; // Grid color + COLOR4D m_drawBgColor; // The background color of the draw canvas; BLACK for // Pcbnew, BLACK or WHITE for eeschema - double m_zoomLevelCoeff; // A suitable value to convert the internal zoom + double m_zoomLevelCoeff; // A suitable value to convert the internal zoom // scaling factor to a zoom level value which rougly // gives 1.0 when the board/schematic is at scale = 1 - int m_UndoRedoCountMax; // Default Undo/Redo command Max depth, to be handed + int m_UndoRedoCountMax; // Default Undo/Redo command Max depth, to be handed // to screens - bool m_PolarCoords; // For those frames that support polar coordinates + bool m_PolarCoords; // For those frames that support polar coordinates - TOOL_DISPATCHER* m_toolDispatcher; + TOOL_DISPATCHER* m_toolDispatcher; - bool m_showBorderAndTitleBlock; /// Show the worksheet (border and title block). - long m_firstRunDialogSetting; /// Show first run dialog on startup + bool m_showBorderAndTitleBlock; // Show the worksheet (border and title block). + long m_firstRunDialogSetting; // Show first run dialog on startup - wxChoice* m_gridSelectBox; - wxChoice* m_zoomSelectBox; + wxChoice* m_gridSelectBox; + wxChoice* m_zoomSelectBox; - ACTION_TOOLBAR* m_mainToolBar; - ACTION_TOOLBAR* m_auxiliaryToolBar; // Additional tools under main toolbar - ACTION_TOOLBAR* m_drawToolBar; // Drawing tools (typically on right edge of window) - ACTION_TOOLBAR* m_optionsToolBar; // Options (typically on left edge of window) + ACTION_TOOLBAR* m_mainToolBar; + ACTION_TOOLBAR* m_auxiliaryToolBar; // Additional tools under main toolbar + ACTION_TOOLBAR* m_drawToolBar; // Drawing tools (typically on right edge of window) + ACTION_TOOLBAR* m_optionsToolBar; // Options (typically on left edge of window) - EDA_MSG_PANEL* m_messagePanel; - int m_MsgFrameHeight; + wxFindReplaceData* m_findReplaceData; + wxArrayString m_findStringHistoryList; + wxArrayString m_replaceStringHistoryList; + + EDA_MSG_PANEL* m_messagePanel; + int m_MsgFrameHeight; /// The current canvas type EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType; @@ -189,6 +194,9 @@ public: */ void ReleaseFile(); + wxFindReplaceData& GetFindReplaceData() { return *m_findReplaceData; } + wxArrayString& GetFindHistoryList() { return m_findStringHistoryList; } + virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0; virtual const PAGE_INFO& GetPageSettings() const = 0; diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index acf28156d6..eafb7d3d58 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -53,6 +53,11 @@ public: return aItem && PCB_TEXT_T == aItem->Type(); } + bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override + { + return BOARD_ITEM::Matches( GetShownText(), aSearchData ); + } + virtual const wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 98523c4101..0775678e6a 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -74,6 +74,11 @@ public: return aItem && PCB_MODULE_TEXT_T == aItem->Type(); } + bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override + { + return BOARD_ITEM::Matches( GetShownText(), aSearchData ); + } + virtual const wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); diff --git a/pcbnew/dialogs/dialog_find.cpp b/pcbnew/dialogs/dialog_find.cpp index bb61739587..c14ace91fd 100644 --- a/pcbnew/dialogs/dialog_find.cpp +++ b/pcbnew/dialogs/dialog_find.cpp @@ -24,7 +24,6 @@ */ #include -#include #include #include #include @@ -33,42 +32,44 @@ #include #include #include +#include +#include #include #include #include +#include -// Initialize static member variables -wxString DIALOG_FIND::prevSearchString; -bool DIALOG_FIND::warpMouse = true; - - -DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent ) +DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aFrame ) : + DIALOG_FIND_BASE( aFrame ) { - parent = aParent; - foundItem = NULL; + m_frame = aFrame; + m_foundItem = NULL; GetSizer()->SetSizeHints( this ); - m_SearchTextCtrl->AppendText( prevSearchString ); - m_NoMouseWarpCheckBox->SetValue( !warpMouse ); + m_SearchCombo->Append( m_frame->GetFindHistoryList() ); - itemCount = markerCount = 0; + if( m_SearchCombo->GetCount() ) + { + m_SearchCombo->SetSelection( 0 ); + m_SearchCombo->SelectAll(); + } + + m_matchCase->SetValue( ( m_frame->GetFindReplaceData().GetFlags() & wxFR_MATCHCASE ) > 0 ); + m_matchWords->SetValue( ( m_frame->GetFindReplaceData().GetFlags() & wxFR_WHOLEWORD ) > 0 ); + m_wildcards->SetValue( ( m_frame->GetFindReplaceData().GetFlags() & FR_MATCH_WILDCARD ) > 0 ); + + m_itemCount = m_markerCount = 0; + + SetInitialFocus( m_SearchCombo ); Center(); } -void DIALOG_FIND::OnInitDialog( wxInitDialogEvent& event ) +void DIALOG_FIND::OnTextEnter( wxCommandEvent& aEvent ) { - m_SearchTextCtrl->SetFocus(); - m_SearchTextCtrl->SetSelection( -1, -1 ); -} - - -void DIALOG_FIND::EnableWarp( bool aEnabled ) -{ - m_NoMouseWarpCheckBox->SetValue( !aEnabled ); - warpMouse = aEnabled; + onButtonFindItemClick( aEvent ); } @@ -80,117 +81,159 @@ void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent ) void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent ) { - PCB_SCREEN* screen = parent->GetScreen(); - wxPoint pos; + PCB_SCREEN* screen = m_frame->GetScreen(); + int flags = 0; + wxString msg; + if( m_matchCase->GetValue() ) + flags |= wxFR_MATCHCASE; - parent->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); - wxString searchString = m_SearchTextCtrl->GetValue(); + if( m_matchWords->GetValue() ) + flags |= wxFR_WHOLEWORD; - if( !searchString.IsSameAs( prevSearchString, false ) ) + if( m_wildcards->GetValue() ) + flags |= FR_MATCH_WILDCARD; + + m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); + wxString searchString = m_SearchCombo->GetValue(); + wxString last; + + if( !m_frame->GetFindHistoryList().empty() ) + last = m_frame->GetFindHistoryList().back(); + + if( !searchString.IsSameAs( last, false ) ) { - itemCount = 0; - foundItem = NULL; + m_itemCount = 0; + m_foundItem = NULL; + m_frame->GetFindHistoryList().push_back( searchString ); } - prevSearchString = searchString; + m_frame->GetFindReplaceData().SetFindString( searchString ); + m_frame->GetFindReplaceData().SetFlags( flags ); - parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); + m_frame->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); int count = 0; - for( auto module : parent->GetBoard()->Modules() ) + for( MODULE* module : m_frame->GetBoard()->Modules() ) { - if( WildCompareString( searchString, module->GetReference().GetData(), false ) ) + if( module->Reference().Matches( m_frame->GetFindReplaceData(), nullptr ) + || module->Value().Matches( m_frame->GetFindReplaceData(), nullptr ) ) { count++; - if( count > itemCount ) + if( count > m_itemCount ) { - foundItem = module; - pos = module->GetPosition(); - itemCount++; + m_foundItem = module; + m_itemCount++; break; } } - if( WildCompareString( searchString, module->GetValue().GetData(), false ) ) + for( BOARD_ITEM* item : module->GraphicalItems() ) + { + TEXTE_MODULE* textItem = dynamic_cast( item ); + + if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) ) + { + count++; + + if( count > m_itemCount ) + { + m_foundItem = module; + m_itemCount++; + break; + } + } + } + } + + for( BOARD_ITEM* item : m_frame->GetBoard()->Drawings() ) + { + TEXTE_PCB* textItem = dynamic_cast( item ); + + if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) ) { count++; - if( count > itemCount ) + if( count > m_itemCount ) { - foundItem = module; - pos = module->GetPosition(); - itemCount++; + m_foundItem = textItem; + m_itemCount++; break; } } } - wxString msg; - - if( foundItem ) + if( m_foundItem ) { - parent->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, foundItem ); - parent->FocusOnLocation( pos, true ); + m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, m_foundItem ); + m_frame->FocusOnLocation( m_foundItem->GetPosition(), true ); msg.Printf( _( "\"%s\" found" ), GetChars( searchString ) ); - parent->SetStatusText( msg ); + m_frame->SetStatusText( msg ); } else { - parent->SetStatusText( wxEmptyString ); + m_frame->SetStatusText( wxEmptyString ); msg.Printf( _( "\"%s\" not found" ), GetChars( searchString ) ); DisplayError( this, msg, 10 ); - itemCount = 0; + m_itemCount = 0; } - if( callback ) - callback( foundItem ); + if( m_highlightCallback ) + m_highlightCallback( m_foundItem ); } void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent ) { - PCB_SCREEN* screen = parent->GetScreen(); - wxPoint pos; - foundItem = NULL; + PCB_SCREEN* screen = m_frame->GetScreen(); + wxString msg; - parent->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); - parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); + m_foundItem = nullptr; - MARKER_PCB* marker = parent->GetBoard()->GetMARKER( markerCount++ ); + m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); + m_frame->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); + + MARKER_PCB* marker = m_frame->GetBoard()->GetMARKER( m_markerCount++ ); if( marker ) - { - foundItem = marker; - pos = marker->GetPosition(); - } + m_foundItem = marker; - wxString msg; - if( foundItem ) + if( m_foundItem ) { - parent->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, foundItem ); - parent->FocusOnLocation( pos ); + m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, m_foundItem ); + m_frame->FocusOnLocation( m_foundItem->GetPosition() ); msg = _( "Marker found" ); - parent->SetStatusText( msg ); + m_frame->SetStatusText( msg ); } else { - parent->SetStatusText( wxEmptyString ); + m_frame->SetStatusText( wxEmptyString ); msg = _( "No marker found" ); DisplayError( this, msg, 10 ); - markerCount = 0; + m_markerCount = 0; } - if( callback ) - callback( foundItem ); + if( m_highlightCallback ) + m_highlightCallback( m_foundItem ); } void DIALOG_FIND::onClose( wxCloseEvent& aEvent ) { - warpMouse = !m_NoMouseWarpCheckBox->IsChecked(); + int flags = 0; + + if( m_matchCase->GetValue() ) + flags |= wxFR_MATCHCASE; + + if( m_matchWords->GetValue() ) + flags |= wxFR_WHOLEWORD; + + if( m_wildcards->GetValue() ) + flags |= FR_MATCH_WILDCARD; + + m_frame->GetFindReplaceData().SetFlags( flags ); EndModal( 1 ); } diff --git a/pcbnew/dialogs/dialog_find.h b/pcbnew/dialogs/dialog_find.h index 763aaa783b..27c07d5a86 100644 --- a/pcbnew/dialogs/dialog_find.h +++ b/pcbnew/dialogs/dialog_find.h @@ -33,21 +33,24 @@ class DIALOG_FIND : public DIALOG_FIND_BASE { public: DIALOG_FIND( PCB_BASE_FRAME* aParent ); - void OnInitDialog( wxInitDialogEvent& event ) override; - inline BOARD_ITEM* GetItem() const { return foundItem; } - void EnableWarp( bool aEnabled ); - void SetCallback( boost::function aCallback ) { callback = aCallback; } + + inline BOARD_ITEM* GetItem() const { return m_foundItem; } + + void SetCallback( boost::function aCallback ) + { + m_highlightCallback = aCallback; + } + + void OnTextEnter( wxCommandEvent& event ) override; private: - PCB_BASE_FRAME* parent; + PCB_BASE_FRAME* m_frame; - int itemCount, markerCount; - static wxString prevSearchString; - static bool warpMouse; - BOARD_ITEM* foundItem; + int m_itemCount; + int m_markerCount; + BOARD_ITEM* m_foundItem; - // Function called when an item is found - boost::function callback; + boost::function m_highlightCallback; void onButtonFindItemClick( wxCommandEvent& event ) override; void onButtonFindMarkerClick( wxCommandEvent& event ) override; diff --git a/pcbnew/dialogs/dialog_find_base.cpp b/pcbnew/dialogs/dialog_find_base.cpp index a3c2a2b963..dbd4fc5ce7 100644 --- a/pcbnew/dialogs/dialog_find_base.cpp +++ b/pcbnew/dialogs/dialog_find_base.cpp @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 15 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "dialog_find_base.h" @@ -23,25 +23,36 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr m_staticText1->Wrap( -1 ); bSizerLeft->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_SearchTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 ); - m_SearchTextCtrl->SetMaxLength( 0 ); - bSizerLeft->Add( m_SearchTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_SearchCombo = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizerLeft->Add( m_SearchCombo, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_NoMouseWarpCheckBox = new wxCheckBox( this, wxID_ANY, _("Do not warp mouse pointer"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerLeft->Add( m_NoMouseWarpCheckBox, 1, wxALL|wxEXPAND, 5 ); + wxBoxSizer* bSizer4; + bSizer4 = new wxBoxSizer( wxHORIZONTAL ); + + m_matchCase = new wxCheckBox( this, wxID_ANY, _("Match case"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer4->Add( m_matchCase, 0, wxALL, 5 ); + + m_matchWords = new wxCheckBox( this, wxID_ANY, _("Words"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer4->Add( m_matchWords, 0, wxALL, 5 ); + + m_wildcards = new wxCheckBox( this, wxID_ANY, _("Wildcards"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer4->Add( m_wildcards, 0, wxALL, 5 ); - bSizerMain->Add( bSizerLeft, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + bSizerLeft->Add( bSizer4, 1, wxEXPAND|wxTOP, 5 ); + + + bSizerMain->Add( bSizerLeft, 1, wxEXPAND|wxALL, 5 ); wxBoxSizer* bSizerRight; bSizerRight = new wxBoxSizer( wxVERTICAL ); m_button1 = new wxButton( this, wxID_ANY, _("Find Item"), wxDefaultPosition, wxDefaultSize, 0 ); m_button1->SetDefault(); - bSizerRight->Add( m_button1, 1, wxALL|wxEXPAND, 5 ); + bSizerRight->Add( m_button1, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_button2, 1, wxALL|wxEXPAND, 5 ); + bSizerRight->Add( m_button2, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_button3 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_button3, 1, wxALL|wxEXPAND, 5 ); @@ -59,6 +70,7 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) ); this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FIND_BASE::OnInitDialog ) ); + m_SearchCombo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::OnTextEnter ), NULL, this ); m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this ); m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this ); m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this ); @@ -69,6 +81,7 @@ DIALOG_FIND_BASE::~DIALOG_FIND_BASE() // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) ); this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FIND_BASE::OnInitDialog ) ); + m_SearchCombo->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::OnTextEnter ), NULL, this ); m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this ); m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this ); m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_find_base.fbp b/pcbnew/dialogs/dialog_find_base.fbp index 51add4fabb..bb47a504a5 100644 --- a/pcbnew/dialogs/dialog_find_base.fbp +++ b/pcbnew/dialogs/dialog_find_base.fbp @@ -95,7 +95,7 @@ none 5 - wxEXPAND|wxTOP|wxBOTTOM + wxEXPAND|wxALL 1 @@ -189,7 +189,7 @@ 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -203,6 +203,7 @@ 1 0 + 1 1 @@ -220,12 +221,11 @@ 0 - 0 0 1 - m_SearchTextCtrl + m_SearchCombo 1 @@ -233,10 +233,11 @@ 1 Resizable + -1 1 - 200,-1 + - + ; forward_declare 0 @@ -248,6 +249,9 @@ + + + @@ -270,98 +274,283 @@ - - - + OnTextEnter 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Do not warp mouse pointer - - 0 - - - 0 + - 1 - m_NoMouseWarpCheckBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + bSizer4 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Match case + + 0 + + + 0 + + 1 + m_matchCase + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Words + + 0 + + + 0 + + 1 + m_matchWords + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Wildcards + + 0 + + + 0 + + 1 + m_wildcards + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -377,7 +566,7 @@ none 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 1 @@ -465,7 +654,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 1 diff --git a/pcbnew/dialogs/dialog_find_base.h b/pcbnew/dialogs/dialog_find_base.h index a8c04640c1..82acff43cb 100644 --- a/pcbnew/dialogs/dialog_find_base.h +++ b/pcbnew/dialogs/dialog_find_base.h @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 15 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #ifndef __DIALOG_FIND_BASE_H__ @@ -11,8 +11,6 @@ #include #include #include -class DIALOG_SHIM; - #include "dialog_shim.h" #include #include @@ -20,7 +18,7 @@ class DIALOG_SHIM; #include #include #include -#include +#include #include #include #include @@ -38,8 +36,10 @@ class DIALOG_FIND_BASE : public DIALOG_SHIM protected: wxStaticText* m_staticText1; - wxTextCtrl* m_SearchTextCtrl; - wxCheckBox* m_NoMouseWarpCheckBox; + wxComboBox* m_SearchCombo; + wxCheckBox* m_matchCase; + wxCheckBox* m_matchWords; + wxCheckBox* m_wildcards; wxButton* m_button1; wxButton* m_button2; wxButton* m_button3; @@ -47,6 +47,7 @@ class DIALOG_FIND_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void onClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } + virtual void OnTextEnter( wxCommandEvent& event ) { event.Skip(); } virtual void onButtonFindItemClick( wxCommandEvent& event ) { event.Skip(); } virtual void onButtonFindMarkerClick( wxCommandEvent& event ) { event.Skip(); } virtual void onButtonCloseClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index df2a9a6c9d..5538ecda3d 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -25,24 +25,14 @@ #include #include #include -#include #include #include -#include #include #include -#include -#include -#include -#include #include #include -#include #include #include -#include -#include -#include #include #include #include @@ -52,7 +42,6 @@ #include #include #include -#include "pcb_tool_base.h" #include #include @@ -149,25 +138,17 @@ void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset ) } -// Initialize static member variables -wxString DIALOG_FIND::prevSearchString; -bool DIALOG_FIND::warpMouse = true; DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent ) { // these members are initialized to avoid warnings about non initialized vars - parent = aParent; - itemCount = markerCount = 0; - foundItem = nullptr; + m_frame = aParent; + m_itemCount = m_markerCount = 0; + m_foundItem = nullptr; } -void DIALOG_FIND::OnInitDialog( wxInitDialogEvent& event ) -{ -} - - -void DIALOG_FIND::EnableWarp( bool aEnabled ) +void DIALOG_FIND::OnTextEnter( wxCommandEvent& event ) { } @@ -201,8 +182,7 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, { // these members are initialized only to avoid warnings about non initialized vars m_staticText1 = nullptr; - m_SearchTextCtrl = nullptr; - m_NoMouseWarpCheckBox = nullptr; + m_SearchCombo = nullptr; m_button1 = nullptr; m_button2 = nullptr; m_button3 = nullptr;