X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fdialog%2Ffind.cpp;h=0a0538c30ab4efcf512b455bcd9af609dd2cc79c;hb=11a7559367dd1824198fe3b75e6d6ceb208ea1b7;hp=42f09e99839d02fef0f7088784d1b6d23b5dac83;hpb=4a64b92c950bdd76bbdbfe685aa4a76ec847e536;p=inkscape.git diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 42f09e998..0a0538c30 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -14,6 +14,7 @@ # include #endif +#include #include "find.h" #include "verbs.h" @@ -26,27 +27,28 @@ #include "selection.h" #include "desktop-handles.h" -#include "dialog-events.h" -#include "../prefs-utils.h" -#include "../verbs.h" -#include "../interface.h" -#include "../sp-text.h" -#include "../sp-flowtext.h" -#include "../text-editing.h" -#include "../sp-tspan.h" -#include "../selection-chemistry.h" -#include "../sp-defs.h" -#include "../sp-rect.h" -#include "../sp-ellipse.h" -#include "../sp-star.h" -#include "../sp-spiral.h" -#include "../sp-path.h" -#include "../sp-line.h" -#include "../sp-polyline.h" -#include "../sp-item-group.h" -#include "../sp-use.h" -#include "../sp-image.h" -#include "../sp-offset.h" +#include "dialogs/dialog-events.h" +#include "prefs-utils.h" +#include "verbs.h" +#include "interface.h" +#include "sp-text.h" +#include "sp-flowtext.h" +#include "text-editing.h" +#include "sp-tspan.h" +#include "sp-tref.h" +#include "selection-chemistry.h" +#include "sp-defs.h" +#include "sp-rect.h" +#include "sp-ellipse.h" +#include "sp-star.h" +#include "sp-spiral.h" +#include "sp-path.h" +#include "sp-line.h" +#include "sp-polyline.h" +#include "sp-item-group.h" +#include "sp-use.h" +#include "sp-image.h" +#include "sp-offset.h" #include @@ -54,8 +56,8 @@ namespace Inkscape { namespace UI { namespace Dialog { -Find::Find() - : Dialog ("dialogs.find", SP_VERB_DIALOG_FIND), +Find::Find(Behavior::BehaviorFactory behavior_factory) + : Dialog (behavior_factory, "dialogs.find", SP_VERB_DIALOG_FIND), _entry_text(_("_Text: "), _("Find objects by their text content (exact or partial match)")), _entry_id(_("_ID: "), _("Find objects by the value of the id attribute (exact or partial match)")), _entry_style(_("_Style: "), _("Find objects by the value of the style attribute (exact or partial match)")), @@ -111,14 +113,18 @@ Find::Find() vbox->pack_start(_button_clear, true, true); vbox->pack_start(_button_find, true, true); + // set signals to handle clicks + _check_all.signal_clicked().connect(sigc::mem_fun(*this, &Find::onToggleAlltypes)); + _check_all_shapes.signal_clicked().connect(sigc::mem_fun(*this, &Find::onToggleShapes)); _button_clear.signal_clicked().connect(sigc::mem_fun(*this, &Find::onClear)); _button_find.signal_clicked().connect(sigc::mem_fun(*this, &Find::onFind)); + _button_find.set_flags(Gtk::CAN_DEFAULT); set_default (_button_find); // activatable by Enter - - + _entry_text.getEntry()->grab_focus(); show_all_children(); + onClear(); } Find::~Find() @@ -287,7 +293,7 @@ Find::item_type_match (SPItem *item) } else if (SP_IS_PATH(item) || SP_IS_LINE(item) || SP_IS_POLYLINE(item)) { return (_check_paths.get_active()); - } else if (SP_IS_TEXT(item) || SP_IS_TSPAN(item) || SP_IS_STRING(item)) { + } else if (SP_IS_TEXT(item) || SP_IS_TSPAN(item) || SP_IS_TREF(item) || SP_IS_STRING(item)) { return (_check_texts.get_active()); } else if (SP_IS_GROUP(item) && !desktop->isLayer(item) ) { // never select layers! @@ -440,6 +446,75 @@ Find::onFind() } } +void +Find::onToggleAlltypes () +{ + if (_check_all.get_active()) { + // explicit toggle to make sure its handler gets called, no matter what was the original state + _check_all_shapes.toggled(); + _check_all_shapes.set_active(); + _check_all_shapes.hide(); + _check_paths.hide(); + _check_texts.hide(); + _check_groups.hide(); + _check_clones.hide(); + _check_images.hide(); + _check_offsets.hide(); + } else { + // explicit toggle to make sure its handler gets called, no matter what was the original state + _check_all_shapes.toggled(); + _check_all_shapes.set_active(); + _check_all_shapes.show(); + + _check_paths.set_active(); + _check_paths.show(); + _check_texts.set_active(); + _check_texts.show(); + _check_groups.set_active(); + _check_groups.show(); + _check_clones.set_active(); + _check_clones.show(); + _check_images.set_active(); + _check_images.show(); + _check_offsets.set_active(); + _check_offsets.show(); + } + squeeze_window(); +} + +void +Find::onToggleShapes () +{ + if (_check_all_shapes.get_active()) { + _check_rects.hide(); + _check_ellipses.hide(); + _check_stars.hide(); + _check_spirals.hide(); + } else { + _check_rects.set_active(); + _check_rects.show(); + _check_ellipses.set_active(); + _check_ellipses.show(); + _check_stars.set_active(); + _check_stars.show(); + _check_spirals.set_active(); + _check_spirals.show(); + } + squeeze_window(); +} + + +/*######################################################################## +# UTILITY +########################################################################*/ + + + +void +Find::squeeze_window() +{ + // TO DO: make window as small as possible +}