find.h revision 0de73848362e95b081e5fa85f910d6481094b2b9
1192N/A/** @file
1434N/A * @brief Find dialog
492N/A */
492N/A/* Authors:
919N/A * Bryce W. Harrington <bryce@bryceharrington.org>
919N/A *
919N/A * Copyright (C) 2004, 2005 Authors
919N/A *
919N/A * Released under GNU GPL. Read the file 'COPYING' for more information.
919N/A */
919N/A
919N/A#ifndef INKSCAPE_UI_DIALOG_FIND_H
919N/A#define INKSCAPE_UI_DIALOG_FIND_H
919N/A
919N/A#ifdef HAVE_CONFIG_H
919N/A# include <config.h>
919N/A#endif
919N/A
919N/A#include "selection.h"
919N/A#include "ui/widget/panel.h"
919N/A#include "ui/widget/button.h"
492N/A#include "ui/widget/entry.h"
492N/A#include "ui/widget/frame.h"
908N/A
908N/A#include <gtkmm/box.h>
492N/A#include <gtkmm/buttonbox.h>
492N/A#include <gtkmm/expander.h>
1466N/A#include <gtkmm/label.h>
1466N/A
1434N/A#include "ui/dialog/desktop-tracker.h"
1434N/A
492N/Aclass SPItem;
908N/Aclass SPObject;
908N/A
908N/Anamespace Inkscape {
1434N/Aclass Selection;
492N/A
492N/Anamespace UI {
492N/Anamespace Dialog {
492N/A
492N/A/**
492N/A * The Find class defines the Find and replace dialog.
492N/A *
492N/A * The Find and replace dialog allows you to search within the
908N/A * current document for specific text or properties of items.
908N/A * Matches items are highlighted and can be replaced as well.
492N/A * Scope can be limited to the entire document, current layer or selected items.
908N/A * Other options allow searching on specific object types and properties.
908N/A */
492N/A
492N/Aclass Find : public UI::Widget::Panel {
492N/Apublic:
492N/A Find();
492N/A virtual ~Find();
492N/A
492N/A /**
492N/A * Helper function which returns a new instance of the dialog.
492N/A * getInstance is needed by the dialog manager (Inkscape::UI::Dialog::DialogManager).
492N/A */
492N/A static Find &getInstance() { return *new Find(); }
492N/A
492N/Aprotected:
492N/A
/**
* Callbacks for pressing the dialog buttons.
*/
void onFind();
void onReplace();
void onExpander();
void onAction();
void onToggleAlltypes();
void onToggleCheck();
void onSearchinText();
void onSearchinProperty();
/**
* Toggle all the properties checkboxes
*/
void searchinToggle(bool on);
/**
* Returns true if the SPItem 'item' has the same id
*
* @param item the SPItem to check
* @param id the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
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 text content
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*
*/
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 in the style attribute
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_style_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false);
/**
* Returns true if found the SPItem 'item' has the same attribute name
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_attr_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
/**
* Returns true if the SPItem 'item' has the same attribute value
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
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 font values
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_font_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
/**
* Function to filter a list of items based on the item type by calling each item_XXX_match function
*/
SelContainer filter_fields (SelContainer &l, bool exact, bool casematch);
bool item_type_match (SPItem *item);
SelContainer filter_types (SelContainer &l);
SelContainer & filter_list (SelContainer &l, bool exact, bool casematch);
/**
* Find a string within a string and returns true if found with options for exact and casematching
*/
bool find_strcmp(const gchar *str, const gchar *find, bool exact, bool casematch);
/**
* Find a string within a string and return the position with options for exact, casematching and search start location
*/
gsize find_strcmp_pos(const gchar *str, const gchar *find, bool exact, bool casematch, gsize start=0);
/**
* Replace a string with another string with options for exact and casematching and replace once/all
*/
Glib::ustring find_replace(const gchar *str, const gchar *find, const gchar *replace, bool exact, bool casematch, bool replaceall);
/**
* recursive function to return a list of all the items in the SPObject tree
*
*/
SelContainer & all_items (SPObject *r, SelContainer &l, bool hidden, bool locked);
/**
* to return a list of all the selected items
*
*/
SelContainer & all_selection_items (Inkscape::Selection *s, SelContainer &l, SPObject *ancestor, bool hidden, bool locked);
/**
* Shrink the dialog size when the expander widget is closed
* Currently not working, no known way to do this
*/
void squeeze_window();
/**
* Can be invoked for setting the desktop. Currently not used.
*/
void setDesktop(SPDesktop *desktop);
/**
* Is invoked by the desktop tracker when the desktop changes.
*/
void setTargetDesktop(SPDesktop *desktop);
/**
* Called when desktop selection changes
*/
void onSelectionChange(void);
private:
Find(Find const &d);
Find& operator=(Find const &d);
/*
* Find and replace combo box widgets
*/
UI::Widget::Entry entry_find;
UI::Widget::Entry entry_replace;
/**
* Scope and search in widgets
*/
UI::Widget::RadioButton check_scope_all;
UI::Widget::RadioButton check_scope_layer;
UI::Widget::RadioButton check_scope_selection;
UI::Widget::RadioButton check_searchin_text;
UI::Widget::RadioButton check_searchin_property;
Gtk::HBox hbox_searchin;
Gtk::VBox vbox_scope;
Gtk::VBox vbox_searchin;
UI::Widget::Frame frame_searchin;
UI::Widget::Frame frame_scope;
/**
* General option widgets
*/
UI::Widget::CheckButton check_case_sensitive;
UI::Widget::CheckButton check_exact_match;
UI::Widget::CheckButton check_include_hidden;
UI::Widget::CheckButton check_include_locked;
Gtk::VBox vbox_options1;
Gtk::VBox vbox_options2;
Gtk::HBox hbox_options;
Gtk::VBox vbox_expander;
Gtk::Expander expander_options;
UI::Widget::Frame frame_options;
/**
* Property type widgets
*/
UI::Widget::CheckButton check_ids;
UI::Widget::CheckButton check_attributename;
UI::Widget::CheckButton check_attributevalue;
UI::Widget::CheckButton check_style;
UI::Widget::CheckButton check_font;
Gtk::VBox vbox_properties;
Gtk::HBox hbox_properties1;
Gtk::HBox hbox_properties2;
UI::Widget::Frame frame_properties;
/**
* A vector of all the properties widgets for easy processing
*/
std::vector<UI::Widget::CheckButton *> checkProperties;
/**
* Object type widgets
*/
UI::Widget::CheckButton check_alltypes;
UI::Widget::CheckButton check_rects;
UI::Widget::CheckButton check_ellipses;
UI::Widget::CheckButton check_stars;
UI::Widget::CheckButton check_spirals;
UI::Widget::CheckButton check_paths;
UI::Widget::CheckButton check_texts;
UI::Widget::CheckButton check_groups;
UI::Widget::CheckButton check_clones;
UI::Widget::CheckButton check_images;
UI::Widget::CheckButton check_offsets;
Gtk::VBox vbox_types1;
Gtk::VBox vbox_types2;
Gtk::HBox hbox_types;
UI::Widget::Frame frame_types;
/**
* A vector of all the check option widgets for easy processing
*/
std::vector<UI::Widget::CheckButton *> checkTypes;
//Gtk::HBox hbox_text;
/**
* Action Buttons and status
*/
Gtk::Label status;
UI::Widget::Button button_find;
UI::Widget::Button button_replace;
#if WITH_GTKMM_3_0
Gtk::ButtonBox box_buttons;
#else
Gtk::HButtonBox box_buttons;
#endif
Gtk::HBox hboxbutton_row;
/**
* Finding or replacing
*/
bool _action_replace;
bool blocked;
SPDesktop *desktop;
DesktopTracker deskTrack;
sigc::connection desktopChangeConn;
sigc::connection selectChangedConn;
};
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
#endif // INKSCAPE_UI_DIALOG_FIND_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :