find.cpp revision 9b9f1cf38b528f0fc1f86654a90cd066787caf5e
/**
* @file
* Find dialog.
*/
/* Authors:
* bulia byak <bulia@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* Copyright (C) 2004 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "message-stack.h"
//TODO : delete this
GtkWidget * sp_find_dialog_old (void);
void
//GtkWidget *
// DialogFind::get().present();
return;
}
#include "macros.h"
#include "inkscape.h"
#include "document.h"
#include "desktop.h"
#include "selection.h"
#include "desktop-handles.h"
#include "dialog-events.h"
#include "../preferences.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 "sp-root.h"
#define MIN_ONSCREEN_DISTANCE 50
// impossible original values to make sure they are read from prefs
{
}
{
if (x<0) x=0;
if (y<0) y=0;
return FALSE; // which means, go ahead and destroy it
}
void
{
gtk_widget_size_request(dlg, &r);
}
bool
{
return false;
}
return false;
}
return false;
}
if (exact) {
} else {
// g_print ("strstr: %s %s: %s\n", item_id, id, strstr(item_id, id) != NULL? "yes":"no");
}
}
bool
{
return false;
}
return false;
bool ret;
if (exact) {
} else {
//FIXME: strcasestr
}
return ret;
}
return false;
}
bool
{
return false;
}
return false;
}
if (exact) {
} else {
}
}
{
bool result = false;
if (exact) {
} else {
}
}
return result;
}
GSList *
filter_onefield (GSList *l, GObject *dlg, const gchar *field, bool (*match_function)(SPItem *, const gchar *, bool), bool exact)
{
n = g_slist_prepend (n, i->data);
}
}
return n;
} else {
return l;
}
return NULL;
}
bool
{
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (widget), data)));
}
bool
{
if (SP_IS_RECT(item)) {
} else if (SP_IS_GENERICELLIPSE(item) || SP_IS_ELLIPSE(item) || SP_IS_ARC(item) || SP_IS_CIRCLE(item)) {
} else if (SP_IS_SPIRAL(item)) {
} else if (SP_IS_IMAGE(item)) {
} else if (SP_IS_OFFSET(item)) {
}
return false;
}
GSList *
{
return l;
n = g_slist_prepend (n, i->data);
}
}
return n;
}
GSList *
{
return l;
}
GSList *
{
if (SP_IS_DEFS(r)) {
return l; // we're not interested in items in defs
}
return l; // we're not interested in metadata
}
l = g_slist_prepend (l, child);
}
}
}
return l;
}
GSList *
all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked)
{
if ( SP_IS_ITEM(i->data) && !reinterpret_cast<SPObject*>(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) {
l = g_slist_prepend (l, i->data);
}
}
}
}
}
return l;
}
{
bool hidden = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "includehidden")));
bool locked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "includelocked")));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inselection")))) {
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inlayer")))) {
} else {
}
} else {
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inlayer")))) {
} else {
}
}
bool exact = true;
if (n == NULL) {
exact = false;
}
if (n != NULL) {
int count = g_slist_length (n);
// TRANSLATORS: "%s" is replaced with "exact" or "partial" when this string is displayed
ngettext("<b>%d</b> object found (out of <b>%d</b>), %s match.",
"<b>%d</b> objects found (out of <b>%d</b>), %s match.",
count),
} else {
}
}
void
{
}
void
{
}
#define FIND_LABELWIDTH 80
void
sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, const gchar *id, const gchar *tip)
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
void
sp_find_new_button (GtkWidget *dlg, GtkWidget *hb, const gchar *label, const gchar *tip, void (*function) (GObject *, GObject *))
{
gtk_widget_show (b);
}
void
{
if (gtk_toggle_button_get_active (tb)) {
} else {
// excplicit toggle to make sure its handler gets called, no matter what was the original state
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "shapes")), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "paths")), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "texts")), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "groups")), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "clones")), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "images")), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "offsets")), TRUE);
}
}
void
{
if (gtk_toggle_button_get_active (tb)) {
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "rects")), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "ellipses")), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "stars")), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "spirals")), FALSE);
}
}
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
{
gtk_widget_show (b);
if (toggled)
}
return hb;
}
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
{ // empty label for indent
gtk_widget_show (l);
}
return hb;
}
{
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
{
gtk_widget_show (l);
}
GtkWidget *alltypes = sp_find_types_checkbox (vb, "all", TRUE, _("Search in all object types"), _("All types"), toggle_alltypes);
}
{
{
GtkWidget *c = sp_find_types_checkbox_indented (vb, "shapes", FALSE, _("Search all shapes"), _("All shapes"), toggle_shapes, 10);
}
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
{ // empty label for alignment
gtk_widget_show (l);
}
{
GtkWidget *c = sp_find_types_checkbox (vb, "rects", FALSE, _("Search rectangles"), _("Rectangles"), NULL);
}
{
GtkWidget *c = sp_find_types_checkbox (vb, "ellipses", FALSE, _("Search ellipses, arcs, circles"), _("Ellipses"), NULL);
}
{
GtkWidget *c = sp_find_types_checkbox (vb, "stars", FALSE, _("Search stars and polygons"), _("Stars"), NULL);
}
{
GtkWidget *c = sp_find_types_checkbox (vb, "spirals", FALSE, _("Search spirals"), _("Spirals"), NULL);
}
}
{
// TRANSLATORS: polyline is a set of connected straight line segments
// http://www.w3.org/TR/SVG11/shapes.html#PolylineElement
GtkWidget *c = sp_find_types_checkbox_indented (vb, "paths", TRUE, _("Search paths, lines, polylines"), _("Paths"), NULL, 10);
}
{
GtkWidget *c = sp_find_types_checkbox_indented (vb, "texts", TRUE, _("Search text objects"), _("Texts"), NULL, 10);
}
{
GtkWidget *c = sp_find_types_checkbox_indented (vb, "groups", TRUE, _("Search groups"), _("Groups"), NULL, 10);
}
{
//TRANSLATORS: "Clones" is a noun indicating type of object to find
}
{
GtkWidget *c = sp_find_types_checkbox_indented (vb, "images", TRUE, _("Search images"), _("Images"), NULL, 10);
}
{
GtkWidget *c = sp_find_types_checkbox_indented (vb, "offsets", TRUE, _("Search offset objects"), _("Offsets"), NULL, 10);
}
}
return vb;
}
sp_find_dialog_old (void)
{
if (!dlg)
{
if (x == -1000 || y == -1000) {
}
if (w ==0 || h == 0) {
}
// if (x<0) x=0;
// if (y<0) y=0;
if (w && h)
if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) {
} else {
}
g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd );
/* Toplevel vbox */
sp_find_new_searchfield (dlg, vb, _("_Text:"), "text", _("Find objects by their text content (exact or partial match)"));
sp_find_new_searchfield (dlg, vb, _("_ID:"), "id", _("Find objects by the value of the id attribute (exact or partial match)"));
sp_find_new_searchfield (dlg, vb, _("_Style:"), "style", _("Find objects by the value of the style attribute (exact or partial match)"));
sp_find_new_searchfield (dlg, vb, _("_Attribute:"), "attr", _("Find objects by the name of an attribute (exact or partial match)"));
{
GtkWidget *w = gtk_hseparator_new ();
gtk_widget_show (w);
{
gtk_widget_show (b);
gtk_widget_set_tooltip_text (b, _("Limit search to the current selection"));
}
{
gtk_widget_show (b);
gtk_widget_set_tooltip_text (b, _("Limit search to the current layer"));
}
{
gtk_widget_show (b);
gtk_widget_set_tooltip_text (b, _("Include hidden objects in search"));
}
{
gtk_widget_show (b);
gtk_widget_set_tooltip_text (b, _("Include locked objects in search"));
}
}
{
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
// TRANSLATORS: "Clear" is a verb here
sp_find_new_button (dlg, hb, _("_Find"), _("Select objects matching all of the fields you filled in"), sp_find_dialog_find);
}
}
return dlg;
}
/*
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 :