KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_find_by_properties.h
Go to the documentation of this file.
1/*
2* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
3*
4* This program is free software; you can redistribute it and/or
5* modify it under the terms of the GNU General Public License
6* as published by the Free Software Foundation; either version 2
7* of the License, or (at your option) any later version.
8*/
9
10#pragma once
11
12#include <vector>
13#include <map>
14#include <set>
15
16#include <board.h>
17#include <board_item.h>
19
20class PCB_EDIT_FRAME;
21class PROPERTY_BASE;
23
30
40
41wxString normalizeQueryFieldAliases( const wxString& aExpression, const std::vector<PROPERTY_ROW_DATA>& aRows );
42
44{
45public:
48
49 bool Show( bool show = true ) override;
50
51 void OnSelectionChanged();
52
53protected:
54 void OnBoardChanged( wxCommandEvent& event );
55
56 // Event handlers from base
57 void onNotebookPageChanged( wxNotebookEvent& event ) override;
58 void onSelectMatchingClick( wxCommandEvent& event ) override;
59 void onCreateQueryClick( wxCommandEvent& event ) override;
60 void onCheckSyntaxClick( wxCommandEvent& event ) override;
61 void onRecentQuerySelected( wxCommandEvent& event ) override;
62 void OnCloseButtonClick( wxCommandEvent& event ) override;
63
64private:
68 void applyMatchResults( EDA_ITEMS& aMatchList, wxStaticText* aStatusLabel );
69 wxString generateExpressionFromProperties( wxArrayString* aSkippedRows = nullptr );
70 std::vector<BOARD_ITEM*> collectAllBoardItems();
72 void saveRecentQuery( const wxString& aQuery );
73 void loadRecentQueries();
74 void onGridCellClick( wxGridEvent& aEvent );
75 void onGridCellChanged( wxGridEvent& aEvent );
76 void onGridSizeChanged( wxSizeEvent& aEvent );
77 void onScintillaCharAdded( wxStyledTextEvent& aEvent );
78 void updateMatchModeCell( int aRow );
79
80 static wxString propNameToExprField( const wxString& aPropName );
81 static wxVariant anyToVariant( const wxAny& aValue );
82 wxString formatValueForExpression( PROPERTY_BASE* aProp, const wxVariant& aValue );
83 wxVariant getVariantAwareValue( EDA_ITEM* aItem, PROPERTY_BASE* aProperty );
84
88 std::vector<PROPERTY_ROW_DATA> m_propertyRows;
89 std::set<size_t> m_selectedTypes;
90};
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:410
DIALOG_FIND_BY_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Find by Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
bool Show(bool show=true) override
DIALOG_FIND_BY_PROPERTIES(PCB_EDIT_FRAME *aParent)
void onSelectMatchingClick(wxCommandEvent &event) override
void applyMatchResults(EDA_ITEMS &aMatchList, wxStaticText *aStatusLabel)
wxString generateExpressionFromProperties(wxArrayString *aSkippedRows=nullptr)
std::vector< PROPERTY_ROW_DATA > m_propertyRows
void onGridCellChanged(wxGridEvent &aEvent)
void saveRecentQuery(const wxString &aQuery)
wxString formatValueForExpression(PROPERTY_BASE *aProp, const wxVariant &aValue)
wxVariant getVariantAwareValue(EDA_ITEM *aItem, PROPERTY_BASE *aProperty)
void onNotebookPageChanged(wxNotebookEvent &event) override
void OnBoardChanged(wxCommandEvent &event)
void onCheckSyntaxClick(wxCommandEvent &event) override
static wxVariant anyToVariant(const wxAny &aValue)
bool itemMatchesPropertyCriteria(BOARD_ITEM *aItem)
void onScintillaCharAdded(wxStyledTextEvent &aEvent)
static wxString propNameToExprField(const wxString &aPropName)
void onRecentQuerySelected(wxCommandEvent &event) override
void OnCloseButtonClick(wxCommandEvent &event) override
void onGridCellClick(wxGridEvent &aEvent)
std::vector< BOARD_ITEM * > collectAllBoardItems()
void onGridSizeChanged(wxSizeEvent &aEvent)
void onCreateQueryClick(wxCommandEvent &event) override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
The main frame for Pcbnew.
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
wxString normalizeQueryFieldAliases(const wxString &aExpression, const std::vector< PROPERTY_ROW_DATA > &aRows)
std::vector< EDA_ITEM * > EDA_ITEMS
PROPERTY_MATCH_MODE matchMode