summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/document-properties.cpp93
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp27
-rw-r--r--src/ui/dialog/svg-fonts-dialog.h6
-rw-r--r--src/ui/widget/icon-widget.cpp17
-rw-r--r--src/ui/widget/licensor.cpp9
-rw-r--r--src/ui/widget/tolerance-slider.cpp21
-rw-r--r--src/ui/widget/tolerance-slider.h14
7 files changed, 90 insertions, 97 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 307cf2bbc..fa392cccc 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -74,8 +74,7 @@ static Inkscape::XML::NodeEventVector const _repr_events = {
};
-DocumentProperties &
-DocumentProperties::getInstance()
+DocumentProperties& DocumentProperties::getInstance()
{
DocumentProperties &instance = *new DocumentProperties();
instance.init();
@@ -85,9 +84,13 @@ DocumentProperties::getInstance()
DocumentProperties::DocumentProperties()
: UI::Widget::Panel ("", "/dialogs/documentoptions", SP_VERB_DIALOG_NAMEDVIEW),
- _page_page(1, 1, true, true), _page_guides(1, 1),
- _page_snap(1, 1), _page_cms(1, 1), _page_scripting(1, 1),
- _page_external_scripts(1, 1), _page_embedded_scripts(1, 1),
+ _page_page(1, 1, true, true),
+ _page_guides(1, 1),
+ _page_snap(1, 1),
+ _page_cms(1, 1),
+ _page_scripting(1, 1),
+ _page_external_scripts(1, 1),
+ _page_embedded_scripts(1, 1),
//---------------------------------------------------------------
_rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false),
_rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false),
@@ -102,6 +105,21 @@ DocumentProperties::DocumentProperties()
_rcp_gui(_("Guide co_lor:"), _("Guideline color"), _("Color of guidelines"), "guidecolor", "guideopacity", _wr),
_rcp_hgui(_("_Highlight color:"), _("Highlighted guideline color"), _("Color of a guideline when it is under mouse"), "guidehicolor", "guidehiopacity", _wr),
//---------------------------------------------------------------
+ _rsu_sno(_("Snap _distance"), _("Snap only when _closer than:"), _("Always snap"),
+ _("Snapping distance, in screen pixels, for snapping to objects"), _("Always snap to objects, regardless of their distance"),
+ _("If set, objects only snap to another object when it's within the range specified below"),
+ "objecttolerance", _wr),
+ //Options for snapping to grids
+ _rsu_sn(_("Snap d_istance"), _("Snap only when c_loser than:"), _("Always snap"),
+ _("Snapping distance, in screen pixels, for snapping to grid"), _("Always snap to grids, regardless of the distance"),
+ _("If set, objects only snap to a grid line when it's within the range specified below"),
+ "gridtolerance", _wr),
+ //Options for snapping to guides
+ _rsu_gusn(_("Snap dist_ance"), _("Snap only when close_r than:"), _("Always snap"),
+ _("Snapping distance, in screen pixels, for snapping to guides"), _("Always snap to guides, regardless of the distance"),
+ _("If set, objects only snap to a guide when it's within the range specified below"),
+ "guidetolerance", _wr),
+ //---------------------------------------------------------------
_rcb_snclp(_("Snap to clip paths"), _("When snapping to paths, then also try snapping to clip paths"), "inkscape:snap-path-clip", _wr),
_rcb_snmsk(_("Snap to mask paths"), _("When snapping to paths, then also try snapping to mask paths"), "inkscape:snap-path-mask", _wr),
//---------------------------------------------------------------
@@ -138,8 +156,7 @@ DocumentProperties::DocumentProperties()
signalDeactiveDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDeactivateDesktop));
}
-void
-DocumentProperties::init()
+void DocumentProperties::init()
{
update();
@@ -210,8 +227,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con
}
}
-void
-DocumentProperties::build_page()
+void DocumentProperties::build_page()
{
_page_page.show();
@@ -242,8 +258,7 @@ DocumentProperties::build_page()
attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array));
}
-void
-DocumentProperties::build_guides()
+void DocumentProperties::build_guides()
{
_page_guides.show();
@@ -261,28 +276,10 @@ DocumentProperties::build_guides()
attach_all(_page_guides.table(), widget_array, G_N_ELEMENTS(widget_array));
}
-void
-DocumentProperties::build_snap()
+void DocumentProperties::build_snap()
{
_page_snap.show();
- _rsu_sno.init (_("Snap _distance"), _("Snap only when _closer than:"), _("Always snap"),
- _("Snapping distance, in screen pixels, for snapping to objects"), _("Always snap to objects, regardless of their distance"),
- _("If set, objects only snap to another object when it's within the range specified below"),
- "objecttolerance", _wr);
-
- //Options for snapping to grids
- _rsu_sn.init (_("Snap d_istance"), _("Snap only when c_loser than:"), _("Always snap"),
- _("Snapping distance, in screen pixels, for snapping to grid"), _("Always snap to grids, regardless of the distance"),
- _("If set, objects only snap to a grid line when it's within the range specified below"),
- "gridtolerance", _wr);
-
- //Options for snapping to guides
- _rsu_gusn.init (_("Snap dist_ance"), _("Snap only when close_r than:"), _("Always snap"),
- _("Snapping distance, in screen pixels, for snapping to guides"), _("Always snap to guides, regardless of the distance"),
- _("If set, objects only snap to a guide when it's within the range specified below"),
- "guidetolerance", _wr);
-
Gtk::Label *label_o = manage (new Gtk::Label);
label_o->set_markup (_("<b>Snap to objects</b>"));
Gtk::Label *label_gr = manage (new Gtk::Label);
@@ -369,8 +366,7 @@ static void sanitizeName( Glib::ustring& str )
}
}
-void
-DocumentProperties::linkSelectedProfile()
+void DocumentProperties::linkSelectedProfile()
{
//store this profile in the SVG document (create <color-profile> element in the XML)
// TODO remove use of 'active' desktop
@@ -410,8 +406,7 @@ DocumentProperties::linkSelectedProfile()
}
}
-void
-DocumentProperties::populate_linked_profiles_box()
+void DocumentProperties::populate_linked_profiles_box()
{
_LinkedProfilesListStore->clear();
const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
@@ -505,8 +500,7 @@ void DocumentProperties::removeSelectedProfile(){
populate_linked_profiles_box();
}
-void
-DocumentProperties::build_cms()
+void DocumentProperties::build_cms()
{
_page_cms.show();
@@ -571,8 +565,7 @@ DocumentProperties::build_cms()
}
#endif // ENABLE_LCMS
-void
-DocumentProperties::build_scripting()
+void DocumentProperties::build_scripting()
{
_page_scripting.show();
@@ -1057,8 +1050,7 @@ DocumentProperties::_createPageTabLabel(const Glib::ustring& label, const char *
//--------------------------------------------------------------------
-void
-DocumentProperties::on_response (int id)
+void DocumentProperties::on_response (int id)
{
if (id == Gtk::RESPONSE_DELETE_EVENT || id == Gtk::RESPONSE_CLOSE)
{
@@ -1072,8 +1064,7 @@ DocumentProperties::on_response (int id)
hide();
}
-void
-DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document)
+void DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document)
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->addListener(&_repr_events, this);
@@ -1082,8 +1073,7 @@ DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *docu
update();
}
-void
-DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop)
+void DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop)
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->addListener(&_repr_events, this);
@@ -1092,8 +1082,7 @@ DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *d
update();
}
-void
-DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop)
+void DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop)
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->removeListenerByData(this);
@@ -1101,15 +1090,13 @@ DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop
root->removeListenerByData(this);
}
-static void
-on_child_added(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
+static void on_child_added(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
{
if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
dialog->update_gridspage();
}
-static void
-on_child_removed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
+static void on_child_removed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
{
if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
dialog->update_gridspage();
@@ -1131,8 +1118,7 @@ static void on_repr_attr_changed(Inkscape::XML::Node *, gchar const *, gchar con
# BUTTON CLICK HANDLERS (callbacks)
########################################################################*/
-void
-DocumentProperties::onNewGrid()
+void DocumentProperties::onNewGrid()
{
SPDesktop *dt = getDesktop();
Inkscape::XML::Node *repr = sp_desktop_namedview(dt)->getRepr();
@@ -1146,8 +1132,7 @@ DocumentProperties::onNewGrid()
}
-void
-DocumentProperties::onRemoveGrid()
+void DocumentProperties::onRemoveGrid()
{
gint pagenum = _grids_notebook.get_current_page();
if (pagenum == -1) // no pages
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 2c116f137..658ef6613 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -28,24 +28,27 @@
#include "xml/node.h"
#include "xml/repr.h"
-SvgFontDrawingArea::SvgFontDrawingArea(){
- this->text = "";
- this->svgfont = NULL;
+SvgFontDrawingArea::SvgFontDrawingArea():
+ _x(0),
+ _y(0),
+ _svgfont(0),
+ _text()
+{
}
void SvgFontDrawingArea::set_svgfont(SvgFont* svgfont){
- this->svgfont = svgfont;
+ _svgfont = svgfont;
}
void SvgFontDrawingArea::set_text(Glib::ustring text){
- this->text = text;
+ _text = text;
redraw();
}
void SvgFontDrawingArea::set_size(int x, int y){
- this->x = x;
- this->y = y;
- ((Gtk::Widget*) this)->set_size_request(x, y);
+ _x = x;
+ _y = y;
+ ((Gtk::Widget*) this)->set_size_request(_x, _y);
}
void SvgFontDrawingArea::redraw(){
@@ -53,13 +56,13 @@ void SvgFontDrawingArea::redraw(){
}
bool SvgFontDrawingArea::on_expose_event (GdkEventExpose */*event*/){
- if (this->svgfont){
+ if (_svgfont){
Glib::RefPtr<Gdk::Window> window = get_window();
Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
- cr->set_font_face( Cairo::RefPtr<Cairo::FontFace>(new Cairo::FontFace(this->svgfont->get_font_face(), false /* does not have reference */)) );
- cr->set_font_size (this->y-20);
+ cr->set_font_face( Cairo::RefPtr<Cairo::FontFace>(new Cairo::FontFace(_svgfont->get_font_face(), false /* does not have reference */)) );
+ cr->set_font_size (_y-20);
cr->move_to (10, 10);
- cr->show_text (this->text.c_str());
+ cr->show_text (_text.c_str());
}
return TRUE;
}
diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h
index 8c2bdc1a4..41bd6ecc8 100644
--- a/src/ui/dialog/svg-fonts-dialog.h
+++ b/src/ui/dialog/svg-fonts-dialog.h
@@ -39,9 +39,9 @@ public:
void set_size(int x, int y);
void redraw();
private:
- int x,y;
- SvgFont* svgfont;
- Glib::ustring text;
+ int _x,_y;
+ SvgFont* _svgfont;
+ Glib::ustring _text;
bool on_expose_event (GdkEventExpose *event);
};
diff --git a/src/ui/widget/icon-widget.cpp b/src/ui/widget/icon-widget.cpp
index 1bc4ad308..b671e8812 100644
--- a/src/ui/widget/icon-widget.cpp
+++ b/src/ui/widget/icon-widget.cpp
@@ -19,13 +19,16 @@ namespace Inkscape {
namespace UI {
namespace Widget {
-IconWidget::IconWidget()
+IconWidget::IconWidget() :
+ _pb(0),
+ _size(0),
+ _do_bitmap_icons(false)
{
- _pb = NULL;
- _size = 0;
}
-IconWidget::IconWidget(int unsigned size, int unsigned scale, gchar const *name)
+IconWidget::IconWidget(int unsigned size, int unsigned scale, gchar const *name) :
+ _pb(0),
+ _do_bitmap_icons(false)
{
_size = std::max((int unsigned)128, std::min(size, (int unsigned)1));
@@ -35,7 +38,7 @@ IconWidget::IconWidget(int unsigned size, int unsigned scale, gchar const *name)
if (pixels == NULL) {
g_warning("Couldn't find matching icon for %s - has this application been installed?", name);
- _pb = NULL;
+ //_pb = NULL;
} else {
/* TODO
_pb = gdk_pixbuf_new_from_data(pixels, GDK_COLORSPACE_RGB,
@@ -45,7 +48,9 @@ IconWidget::IconWidget(int unsigned size, int unsigned scale, gchar const *name)
}
}
-IconWidget::IconWidget(int unsigned size, guchar const */*px*/)
+IconWidget::IconWidget(int unsigned size, guchar const */*px*/) :
+ _pb(0),
+ _do_bitmap_icons(false)
{
_size = std::max((int unsigned)128, std::min(size, (int unsigned)1));
diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp
index 9cb904c9f..7caf732a4 100644
--- a/src/ui/widget/licensor.cpp
+++ b/src/ui/widget/licensor.cpp
@@ -57,8 +57,7 @@ LicenseItem::LicenseItem (struct rdf_license_t const* license, EntityEntry* enti
}
/// \pre it is assumed that the license URI entry is a Gtk::Entry
-void
-LicenseItem::on_toggled()
+void LicenseItem::on_toggled()
{
if (_wr.isUpdating()) return;
@@ -83,8 +82,7 @@ Licensor::~Licensor()
if (_eentry) delete _eentry;
}
-void
-Licensor::init (Gtk::Tooltips& tt, Registry& wr)
+void Licensor::init (Gtk::Tooltips& tt, Registry& wr)
{
/* add license-specific metadata entry areas */
rdf_work_entity_t* entity = rdf_find_entity ( "license_uri" );
@@ -118,8 +116,7 @@ Licensor::init (Gtk::Tooltips& tt, Registry& wr)
show_all_children();
}
-void
-Licensor::update (SPDocument *doc)
+void Licensor::update (SPDocument *doc)
{
/* identify the license info */
struct rdf_license_t * license = rdf_get_license (doc);
diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp
index 40f58f0ae..aa749fb39 100644
--- a/src/ui/widget/tolerance-slider.cpp
+++ b/src/ui/widget/tolerance-slider.cpp
@@ -40,9 +40,10 @@ namespace Widget {
//====================================================
-ToleranceSlider::ToleranceSlider()
+ToleranceSlider::ToleranceSlider(const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& label3, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& tip3, const Glib::ustring& key, Registry& wr)
: _vbox(0)
{
+ init(label1, label2, label3, tip1, tip2, tip3, key, wr);
}
ToleranceSlider::~ToleranceSlider()
@@ -51,8 +52,7 @@ ToleranceSlider::~ToleranceSlider()
_scale_changed_connection.disconnect();
}
-void
-ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& label3, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& tip3, const Glib::ustring& key, Registry& wr)
+void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& label3, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& tip3, const Glib::ustring& key, Registry& wr)
{
// hbox = label + slider
//
@@ -109,8 +109,7 @@ ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2,
_vbox->show_all_children();
}
-void
-ToleranceSlider::setValue (double val)
+void ToleranceSlider::setValue (double val)
{
Gtk::Adjustment *adj = _hscale->get_adjustment();
@@ -135,21 +134,18 @@ ToleranceSlider::setValue (double val)
_hbox->show_all();
}
-void
-ToleranceSlider::setLimits (double theMin, double theMax)
+void ToleranceSlider::setLimits (double theMin, double theMax)
{
_hscale->set_range (theMin, theMax);
_hscale->get_adjustment()->set_step_increment (1);
}
-void
-ToleranceSlider::on_scale_changed()
+void ToleranceSlider::on_scale_changed()
{
update (_hscale->get_value());
}
-void
-ToleranceSlider::on_toggled()
+void ToleranceSlider::on_toggled()
{
if (!_button2->get_active())
{
@@ -168,8 +164,7 @@ ToleranceSlider::on_toggled()
}
}
-void
-ToleranceSlider::update (double val)
+void ToleranceSlider::update (double val)
{
if (_wr->isUpdating())
return;
diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h
index 0a9663bc3..6865ec769 100644
--- a/src/ui/widget/tolerance-slider.h
+++ b/src/ui/widget/tolerance-slider.h
@@ -28,9 +28,7 @@ class Registry;
*/
class ToleranceSlider {
public:
- ToleranceSlider();
- ~ToleranceSlider();
- void init (const Glib::ustring& label1,
+ ToleranceSlider(const Glib::ustring& label1,
const Glib::ustring& label2,
const Glib::ustring& label3,
const Glib::ustring& tip1,
@@ -38,9 +36,19 @@ public:
const Glib::ustring& tip3,
const Glib::ustring& key,
Registry& wr);
+ ~ToleranceSlider();
void setValue (double);
void setLimits (double, double);
Gtk::VBox* _vbox;
+private:
+ void init (const Glib::ustring& label1,
+ const Glib::ustring& label2,
+ const Glib::ustring& label3,
+ const Glib::ustring& tip1,
+ const Glib::ustring& tip2,
+ const Glib::ustring& tip3,
+ const Glib::ustring& key,
+ Registry& wr);
protected:
void on_scale_changed();