document-properties.cpp revision 94dbc6815a2905121e25184ad31b8534f53dfe4c
/** \file
*
* Document properties dialog, Gtkmm-style
*
* Authors:
* bulia byak <buliabyak@users.sf.net>
* Bryce W. Harrington <bryce@bryceharrington.org>
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
*
* Copyright (C) 2000 - 2005 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "ui/widget/color-picker.h"
#include "ui/widget/scalar-unit.h"
#include "xml/node-event-vector.h"
#include "inkscape.h"
#include "verbs.h"
#include "document.h"
#include "desktop-handles.h"
#include "desktop.h"
#include "sp-namedview.h"
#include "document-properties.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
#define SPACE_SIZE_X 15
#define SPACE_SIZE_Y 10
//===================================================
//---------------------------------------------------
static DocumentProperties *_instance = 0;
static void on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer);
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
{
_instance = new DocumentProperties;
return _instance;
}
void
{
if (_instance)
{
delete _instance;
_instance = 0;
}
}
_prefs_path("dialogs.documentoptions")
{
hide();
set_resizable (false);
build_page();
build_grid();
build_snap();
}
void
{
update();
_doc_replaced_connection = SP_ACTIVE_DESKTOP->connectDocumentReplaced (sigc::ptr_fun (on_doc_replaced));
present();
}
{
repr->removeListenerByData (this);
}
//========================================================================
/**
* Helper function that attachs widgets in a 3xn table. The widgets come in an
* array that has two entries per table row. The two entries code for four
* possible cases: (0,0) means insert space in first column; (0, non-0) means
* widget in columns 2-3; (non-0, 0) means label in columns 1-3; and
* (non-0, non-0) means two widgets in columns 2 and 3.
**/
inline void
{
{
{
}
else
{
if (arr[i+1])
else if (arr[i])
{
}
else
{
}
}
++r;
}
}
void
{
_page_page.show();
_rcp_bg.init (_("Back_ground:"), _("Background color"), _("Color and transparency of the page background (also used for bitmap export)"),
_rcb_canb.init (_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false);
_rcb_bord.init (_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false);
_("Color of the page border"),
_rcb_shad.init (_("_Show border shadow"), "If set, page border shows a shadow on its right and lower side", "inkscape:showpageshadow", _wr, false);
{
label_gen, 0,
0, 0,
label_for, 0,
0, &_page_sizer,
0, 0,
label_bor, 0,
};
}
void
{
_page_grid.show();
/// \todo FIXME: gray out snapping when grid is off.
/// Dissenting view: you want snapping without grid.
_("Color of the major (highlighted) grid lines"),
_("Color of a guideline when it is under mouse"),
{
label_grid, 0,
0, 0,
0, 0,
label_gui, 0,
};
}
void
{
_page_snap.show();
_("Snap the edges of the object bounding boxes to other objects"),
"inkscape:object-bbox", _wr);
_("Snap the nodes of objects to other objects"),
"inkscape:object-points", _wr);
_("Snap to other object paths"),
"inkscape:object-paths", _wr);
_("Snap to other object nodes"),
"inkscape:object-nodes", _wr);
_("Controls max. snapping distance from object"),
"objecttolerance", _wr);
_("Snap the edges of the object bounding boxes"),
"inkscape:grid-bbox", _wr);
_("Snap path nodes, text baselines, ellipse centers, etc."),
"inkscape:grid-points", _wr);
_("Controls max. snapping distance from grid"),
"gridtolerance", _wr);
_("Snap the edges of the object bounding boxes"),
"inkscape:guide-bbox", _wr);
_("Snap path nodes, text baselines, ellipse centers, etc."),
"inkscape:guide-points", _wr);
_("Sensitivity is always the same, regardless of zoom."),
_("Sensitivity changes with zoom; zooming in will enlarge max. snapping distance."),
_("inkscape:has_abs_tolerance"), _wr);
{
label_o, 0,
0, 0,
label_gr, 0,
0, 0,
label_gu, 0,
0, _rcb_snpgui._button,
0, _rcb_snbgui._button,
0, 0,
};
}
/**
* Update dialog widgets from desktop.
*/
void
{
if (_wr.isUpdating()) return;
_wr.setUpdating (true);
set_sensitive (true);
//-----------------------------------------------------------page page
//-----------------------------------------------------------grid page
//-----------------------------------------------------------guide
//-----------------------------------------------------------snap
_wr.setUpdating (false);
}
//--------------------------------------------------------------------
void
{
{
}
hide();
}
/**
* Called when XML node attribute changed; updates dialog widgets.
*/
static void
on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer)
{
if (!_instance)
return;
}
static void
{
if (!_instance)
return;
_instance->_doc_replaced_connection = SP_ACTIVE_DESKTOP->connectDocumentReplaced (sigc::ptr_fun (on_doc_replaced));
}
static void
{
if (!_instance)
return;
}
static void
{
if (!_instance)
return;
}
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :