Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
find.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5/* Authors:
6 * Bryce W. Harrington <bryce@bryceharrington.org>
7 *
8 * Copyright (C) 2004, 2005 Authors
9 *
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12
13#ifndef INKSCAPE_UI_DIALOG_FIND_H
14#define INKSCAPE_UI_DIALOG_FIND_H
15
16#include <gtkmm/button.h>
17#include <gtkmm/checkbutton.h>
18#include <gtkmm/expander.h>
19
21#include "ui/widget/entry.h"
22#include "ui/widget/frame.h"
23
24namespace Gtk {
25class SizeGroup;
26} // namespace Gtk
27
28class SPItem;
29class SPObject;
30
31namespace Inkscape {
32
33class Selection;
34
35namespace UI::Dialog {
36
47class Find : public DialogBase
48{
49public:
50 Find();
51 ~Find() override;
52
53 void desktopReplaced() override;
54 void selectionChanged(Selection *selection) override;
55
56protected:
60 void onFind();
61 void onReplace();
62 void onExpander();
63 void onAction();
64 void onToggleAlltypes();
65 void onToggleCheck();
66 void onSearchinText();
67 void onSearchinProperty();
68
72 void searchinToggle(bool on);
73
84 bool item_id_match (SPItem *item, const gchar *id, bool exact, bool casematch, bool replace=false);
96 bool item_text_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false);
107 bool item_style_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false);
119 bool item_desc_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false);
120 bool item_title_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false);
131 bool item_attr_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
142 bool item_attrvalue_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
153 bool item_font_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
157 std::vector<SPItem*> filter_fields (std::vector<SPItem*> &l, bool exact, bool casematch);
159 std::vector<SPItem*> filter_types (std::vector<SPItem*> &l);
160 std::vector<SPItem*> & filter_list (std::vector<SPItem*> &l, bool exact, bool casematch);
161
165 bool find_strcmp(const gchar *str, const gchar *find, bool exact, bool casematch);
166
170 gsize find_strcmp_pos(const gchar *str, const gchar *find, bool exact, bool casematch, gsize start=0);
171
175 Glib::ustring find_replace(const gchar *str, const gchar *find, const gchar *replace, bool exact, bool casematch, bool replaceall);
176
181 std::vector<SPItem*> & all_items (SPObject *r, std::vector<SPItem*> &l, bool hidden, bool locked);
186 std::vector<SPItem*> & all_selection_items (Inkscape::Selection *s, std::vector<SPItem*> &l, SPObject *ancestor, bool hidden, bool locked);
187
192 void squeeze_window();
193
194private:
195 /*
196 * Find and replace combo box widgets
197 */
200 Glib::RefPtr<Gtk::SizeGroup> label_group;
201
205 Gtk::CheckButton check_scope_all;
206 Gtk::CheckButton check_scope_layer;
207 Gtk::CheckButton check_scope_selection;
208 Gtk::CheckButton check_searchin_text;
209 Gtk::CheckButton check_searchin_property;
211 Gtk::Box vbox_scope;
215
219 Gtk::CheckButton check_case_sensitive;
220 Gtk::CheckButton check_exact_match;
221 Gtk::CheckButton check_include_hidden;
222 Gtk::CheckButton check_include_locked;
225 Gtk::Box hbox_options;
227 Gtk::Expander expander_options;
229
233 Gtk::CheckButton check_ids;
234 Gtk::CheckButton check_attributename;
235 Gtk::CheckButton check_attributevalue;
236 Gtk::CheckButton check_style;
237 Gtk::CheckButton check_font;
238 Gtk::CheckButton check_desc;
239 Gtk::CheckButton check_title;
244
248 std::vector<Gtk::CheckButton *> checkProperties;
249
253 Gtk::CheckButton check_alltypes;
254 Gtk::CheckButton check_rects;
255 Gtk::CheckButton check_ellipses;
256 Gtk::CheckButton check_stars;
257 Gtk::CheckButton check_spirals;
258 Gtk::CheckButton check_paths;
259 Gtk::CheckButton check_texts;
260 Gtk::CheckButton check_groups;
261 Gtk::CheckButton check_clones;
262 Gtk::CheckButton check_images;
263 Gtk::CheckButton check_offsets;
264 Gtk::Box vbox_types1;
265 Gtk::Box vbox_types2;
266 Gtk::Box hbox_types;
268
269 Glib::RefPtr<Gtk::SizeGroup> _left_size_group;
270 Glib::RefPtr<Gtk::SizeGroup> _right_size_group;
271
275 std::vector<Gtk::CheckButton *> checkTypes;
276
277 //Gtk::Box hbox_text;
278
282 Gtk::Label status;
283 Gtk::Button button_find;
284 Gtk::Button button_replace;
285 Gtk::Box box_buttons;
287
293};
294
295} // namespace UI::Dialog
296} // namespace Inkscape
297
298#endif // INKSCAPE_UI_DIALOG_FIND_H
299
300/*
301 Local Variables:
302 mode:c++
303 c-file-style:"stroustrup"
304 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
305 indent-tabs-mode:nil
306 fill-column:99
307 End:
308*/
309// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
The set of selected SPObjects for a given document and layer model.
Definition selection.h:80
DialogBase is the base class for the dialog system.
Definition dialog-base.h:40
The Find class defines the Find and replace dialog.
Definition find.h:48
Gtk::CheckButton check_include_locked
Definition find.h:222
void onFind()
Callbacks for pressing the dialog buttons.
Definition find.cpp:942
Gtk::CheckButton check_texts
Definition find.h:259
Gtk::CheckButton check_groups
Definition find.h:260
Gtk::CheckButton check_ellipses
Definition find.h:255
Gtk::Box vbox_properties2
Definition find.h:242
Gtk::CheckButton check_scope_selection
Definition find.h:207
Gtk::CheckButton check_ids
Property type widgets.
Definition find.h:233
Gtk::Button button_replace
Definition find.h:284
gsize find_strcmp_pos(const gchar *str, const gchar *find, bool exact, bool casematch, gsize start=0)
Find a string within a string and return the position with options for exact, casematching and search...
Definition find.cpp:416
Glib::RefPtr< Gtk::SizeGroup > _left_size_group
Definition find.h:269
std::vector< Gtk::CheckButton * > checkTypes
A vector of all the check option widgets for easy processing.
Definition find.h:275
bool item_id_match(SPItem *item, const gchar *id, bool exact, bool casematch, bool replace=false)
Returns true if the SPItem 'item' has the same id.
Definition find.cpp:509
void desktopReplaced() override
Called when the desktop has certainly changed.
Definition find.cpp:372
Gtk::CheckButton check_stars
Definition find.h:256
Gtk::CheckButton check_images
Definition find.h:262
Glib::RefPtr< Gtk::SizeGroup > _right_size_group
Definition find.h:270
Gtk::CheckButton check_case_sensitive
General option widgets.
Definition find.h:219
Gtk::CheckButton check_include_hidden
Definition find.h:221
void searchinToggle(bool on)
Toggle all the properties checkboxes.
Definition find.cpp:1100
Gtk::CheckButton check_paths
Definition find.h:258
Gtk::Box vbox_properties1
Definition find.h:241
bool item_attr_match(SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false)
Returns true if found the SPItem 'item' has the same attribute name.
Definition find.cpp:560
UI::Widget::Frame frame_searchin
Definition find.h:213
std::vector< SPItem * > & all_items(SPObject *r, std::vector< SPItem * > &l, bool hidden, bool locked)
recursive function to return a list of all the items in the SPObject tree
Definition find.cpp:891
bool find_strcmp(const gchar *str, const gchar *find, bool exact, bool casematch)
Find a string within a string and returns true if found with options for exact and casematching.
Definition find.cpp:439
Gtk::Expander expander_options
Definition find.h:227
bool item_attrvalue_match(SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false)
Returns true if the SPItem 'item' has the same attribute value.
Definition find.cpp:584
bool item_type_match(SPItem *item)
Definition find.cpp:827
Gtk::CheckButton check_style
Definition find.h:236
Gtk::CheckButton check_desc
Definition find.h:238
std::vector< SPItem * > filter_fields(std::vector< SPItem * > &l, bool exact, bool casematch)
Function to filter a list of items based on the item type by calling each item_XXX_match function.
Definition find.cpp:670
Gtk::CheckButton check_clones
Definition find.h:261
UI::Widget::Entry entry_find
Definition find.h:198
Gtk::CheckButton check_searchin_property
Definition find.h:209
Gtk::CheckButton check_scope_layer
Definition find.h:206
Gtk::CheckButton check_alltypes
Object type widgets.
Definition find.h:253
Gtk::CheckButton check_font
Definition find.h:237
bool item_style_match(SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false)
Returns true if the SPItem 'item' has the same text in the style attribute.
Definition find.cpp:534
std::vector< SPItem * > filter_types(std::vector< SPItem * > &l)
Definition find.cpp:869
UI::Widget::Entry entry_replace
Definition find.h:199
bool item_font_match(SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false)
Returns true if the SPItem 'item' has the same font values.
Definition find.cpp:615
Gtk::CheckButton check_offsets
Definition find.h:263
UI::Widget::Frame frame_types
Definition find.h:267
Gtk::CheckButton check_attributename
Definition find.h:234
Glib::RefPtr< Gtk::SizeGroup > label_group
Definition find.h:200
Gtk::Button button_find
Definition find.h:283
Gtk::CheckButton check_exact_match
Definition find.h:220
Gtk::CheckButton check_searchin_text
Definition find.h:208
std::vector< SPItem * > & filter_list(std::vector< SPItem * > &l, bool exact, bool casematch)
Definition find.cpp:884
std::vector< Gtk::CheckButton * > checkProperties
A vector of all the properties widgets for easy processing.
Definition find.h:248
Gtk::CheckButton check_scope_all
Scope and search in widgets.
Definition find.h:205
UI::Widget::Frame frame_scope
Definition find.h:214
Gtk::CheckButton check_spirals
Definition find.h:257
bool item_desc_match(SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false)
Returns true if the SPItem 'item' has a <title> or <desc> child that matches.
Definition find.cpp:444
bool item_text_match(SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false)
Returns true if the SPItem 'item' has the same text content.
Definition find.cpp:468
Gtk::Label status
Action Buttons and status.
Definition find.h:282
UI::Widget::Frame frame_options
Definition find.h:228
void selectionChanged(Selection *selection) override
Definition find.cpp:385
UI::Widget::Frame frame_properties
Definition find.h:243
std::vector< SPItem * > & all_selection_items(Inkscape::Selection *s, std::vector< SPItem * > &l, SPObject *ancestor, bool hidden, bool locked)
to return a list of all the selected items
Definition find.cpp:914
Gtk::CheckButton check_attributevalue
Definition find.h:235
bool item_title_match(SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false)
Definition find.cpp:456
void squeeze_window()
Shrink the dialog size when the expander widget is closed Currently not working, no known way to do t...
Definition find.cpp:1117
Gtk::CheckButton check_title
Definition find.h:239
bool _action_replace
Finding or replacing.
Definition find.h:291
Glib::ustring find_replace(const gchar *str, const gchar *find, const gchar *replace, bool exact, bool casematch, bool replaceall)
Replace a string with another string with options for exact and casematching and replace once/all.
Definition find.cpp:396
Gtk::CheckButton check_rects
Definition find.h:254
Helperclass for Gtk::Entry widgets.
Definition entry.h:24
Creates a Gnome HIG style indented frame with bold label See http://developer.gnome....
Definition frame.h:24
Base class for visual SVG elements.
Definition sp-item.h:109
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
A base class for all dialogs.
SPItem * item
Definition desktop.h:50
Helper class to stream background task notifications as a series of messages.
Glib::ustring name
Definition toolbars.cpp:55