Push some search stuff down into EDA_DRAW_FRAME so it can be shared.

Also rewrites the PCBNew Find dialog to make use of the above, including:
1) searching in user-defined footprint fields
2) searching in pcb text
3) a history list in the search popup
4) case sensitive searching
5) word sensitive searching
6) the ability to turn wildcard searching on/off
7) better placement of the result when the dialog obscures part of the
window

Fixes: lp:1838006
* https://bugs.launchpad.net/kicad/+bug/1838006
This commit is contained in:
Jeff Young 2019-07-26 17:52:17 -06:00
parent 21b90de829
commit 3904d7ccfc
17 changed files with 578 additions and 451 deletions

View File

@ -32,15 +32,11 @@
#include <trigo.h>
#include <common.h>
#include <macros.h>
#include <kicad_string.h>
#include <eda_base_frame.h>
#include <base_screen.h>
#include <bitmaps.h>
#include <trace_helpers.h>
#include <eda_rect.h>
#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,

View File

@ -42,7 +42,6 @@
#include <tool/action_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/actions.h>
#include <wx/clipbrd.h>
#include <ws_draw_item.h>
#include <page_info.h>
#include <title_block.h>
@ -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 ] );
}
}

View File

@ -24,7 +24,6 @@
#include <dialog_schematic_find.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <sch_edit_frame.h>
#include <tools/sch_editor_control.h>

View File

@ -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:

View File

@ -43,15 +43,15 @@
#include <widgets/widget_eeschema_color_config.h>
#include <widgets/symbol_tree_pane.h>
#include <dialogs/panel_libedit_settings.h>
#include <sch_view.h>
#include <sch_painter.h>
#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 );

View File

@ -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;

View File

@ -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;

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* 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 <core/typeinfo.h>
#include "common.h"
#include <wx/fdrepdlg.h>
#include <bitmap_types.h>
#include <view/view_item.h>
@ -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;

View File

@ -32,6 +32,7 @@
#include <gal/gal_display_options.h>
#include <gal/color4d.h>
#include <class_draw_panel_gal.h>
#include <wx/fdrepdlg.h>
#include "hotkeys_basic.h"
class wxSingleInstanceChecker;
@ -93,36 +94,40 @@ protected:
std::unique_ptr<wxSingleInstanceChecker> 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;

View File

@ -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();

View File

@ -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();

View File

@ -24,7 +24,6 @@
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <confirm.h>
#include <kicad_string.h>
#include <pcb_edit_frame.h>
@ -33,42 +32,44 @@
#include <class_board.h>
#include <class_module.h>
#include <class_marker_pcb.h>
#include <class_text_mod.h>
#include <class_pcb_text.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <dialog_find.h>
#include <wx/fdrepdlg.h>
// 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<TEXTE_MODULE*>( 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<TEXTE_PCB*>( 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 );
}

View File

@ -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<void (BOARD_ITEM*)> aCallback ) { callback = aCallback; }
inline BOARD_ITEM* GetItem() const { return m_foundItem; }
void SetCallback( boost::function<void (BOARD_ITEM*)> 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<void (BOARD_ITEM*)> callback;
boost::function<void (BOARD_ITEM*)> m_highlightCallback;
void onButtonFindItemClick( wxCommandEvent& event ) override;
void onButtonFindMarkerClick( wxCommandEvent& event ) override;

View File

@ -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 );

View File

@ -95,7 +95,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -189,7 +189,7 @@
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<object class="wxComboBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -203,6 +203,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices"></property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -220,12 +221,11 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_SearchTextCtrl</property>
<property name="name">m_SearchCombo</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -233,10 +233,11 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size">200,-1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -248,6 +249,9 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCombobox"></event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -270,98 +274,283 @@
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnTextEnter">OnTextEnter</event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Do not warp mouse pointer</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_NoMouseWarpCheckBox</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<property name="name">bSizer4</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Match case</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_matchCase</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Words</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_matchWords</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Wildcards</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_wildcards</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
@ -377,7 +566,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@ -465,7 +654,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -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 <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -20,7 +18,7 @@ class DIALOG_SHIM;
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
@ -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(); }

View File

@ -25,24 +25,14 @@
#include <pgm_base.h>
#include <kiface_i.h>
#include <confirm.h>
#include <macros.h>
#include <pcb_edit_frame.h>
#include <eda_dde.h>
#include <wx/stdpaths.h>
#include <wx/file.h>
#include <wx/snglinst.h>
#include <wx/dir.h>
#include <gestfich.h>
#include <pcbnew.h>
#include <wildcards_and_files_ext.h>
#include <class_board.h>
#include <fp_lib_table.h>
#include <footprint_edit_frame.h>
#include <footprint_viewer_frame.h>
#include <footprint_wizard_frame.h>
#include <pcb_edit_frame.h>
#include <class_board.h>
#include <class_track.h>
#include <class_drawsegment.h>
#include <class_pcb_text.h>
#include <class_pcb_target.h>
@ -52,7 +42,6 @@
#include <class_edge_mod.h>
#include <tools/pcb_actions.h>
#include <router/router_tool.h>
#include "pcb_tool_base.h"
#include <dialog_find.h>
#include <dialog_block_options.h>
@ -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;