From 657b13ae69fddd620bbc70423fd6914bbd2142d2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 8 Apr 2011 23:18:50 +0200 Subject: remember status of relative checkbox for guideline dialog Fixed bugs: - https://launchpad.net/bugs/484187 (bzr r10147) --- src/ui/dialog/guides.cpp | 6 +++++- src/ui/dialog/guides.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index bd9777048..e7d8b3a7b 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -52,6 +52,8 @@ GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop * { } +bool GuidelinePropertiesDialog::_relative_toggle_status = false; // initialize relative checkbox status for when this dialog is opened for first time + GuidelinePropertiesDialog::~GuidelinePropertiesDialog() { } @@ -64,6 +66,7 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) { void GuidelinePropertiesDialog::_modeChanged() { _mode = !_relative_toggle.get_active(); + _relative_toggle_status = _relative_toggle.get_active(); if (!_mode) { // relative _spin_angle.set_value(0); @@ -149,7 +152,7 @@ void GuidelinePropertiesDialog::_response(gint response) } void GuidelinePropertiesDialog::_setup() { - set_title(_("Guideline")); + set_title(_("Guidelinea")); add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); add_button(Gtk::Stock::DELETE, -12); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); @@ -179,6 +182,7 @@ void GuidelinePropertiesDialog::_setup() { _layout_table.attach(_relative_toggle, 1, 3, 9, 10, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); + _relative_toggle.set_active(_relative_toggle_status); // unitmenu /* fixme: We should allow percents here too, as percents of the canvas size */ diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 2817e2644..5c74d3618 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -60,6 +60,7 @@ private: Gtk::Label _label_Y; Gtk::Label _label_degrees; Inkscape::UI::Widget::CheckButton _relative_toggle; + static bool _relative_toggle_status; // remember the status of the _relative_toggle_status button across instances Gtk::Adjustment _adjustment_x; Gtk::SpinButton _spin_button_x; Gtk::Adjustment _adjustment_y; -- cgit v1.2.3 From c4a45aa8008c2bfe48a794bbcc4200ad07b12cc9 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 8 Apr 2011 23:29:23 +0200 Subject: automatically apply and close guideline dialog when pressing enter in X, Y and angle entry boxes Fixed bugs: - https://launchpad.net/bugs/484187 (bzr r10148) --- src/ui/dialog/guides.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index e7d8b3a7b..1ac1e5d82 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -205,9 +205,6 @@ void GuidelinePropertiesDialog::_setup() { 1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_button_y, 2, 3, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - gtk_signal_connect_object(GTK_OBJECT(_spin_button_x.gobj()), "activate", - GTK_SIGNAL_FUNC(gtk_window_activate_default), - gobj()); _layout_table.attach(_label_units, 1, 2, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); @@ -223,6 +220,14 @@ void GuidelinePropertiesDialog::_setup() { _layout_table.attach(_spin_angle, 2, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + // don't know what this exactly does, but it results in that the dialog closes when entering a value and pressing enter (see LP bug 484187) + gtk_signal_connect_object(GTK_OBJECT(_spin_button_x.gobj()), "activate", + GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); + gtk_signal_connect_object(GTK_OBJECT(_spin_button_y.gobj()), "activate", + GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); + gtk_signal_connect_object(GTK_OBJECT(_spin_angle.gobj()), "activate", + GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); + // dialog set_default_response(Gtk::RESPONSE_OK); -- cgit v1.2.3 From 7e1f9b0ff682eb03394692fbe7b38a2838fbd29a Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 9 Apr 2011 00:16:53 +0200 Subject: allow other than numeric characters in guideline dialog Fixed bugs: - https://launchpad.net/bugs/484187 (bzr r10149) --- src/ui/dialog/guides.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 1ac1e5d82..b0b4705b1 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -194,9 +194,9 @@ void GuidelinePropertiesDialog::_setup() { sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_x.gobj())); sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_y.gobj())); _spin_button_x.configure(_adjustment_x, 1.0 , 3); - _spin_button_x.set_numeric(); + // _spin_button_x.set_numeric(); // not setting numeric enables writing '.' instead of ',' for decimal _spin_button_y.configure(_adjustment_y, 1.0 , 3); - _spin_button_y.set_numeric(); + //_spin_button_y.set_numeric(); // not setting numeric enables writing '.' instead of ',' for decimal _layout_table.attach(_label_X, 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_button_x, @@ -213,7 +213,7 @@ void GuidelinePropertiesDialog::_setup() { // angle spinbutton _spin_angle.configure(_adj_angle, 5.0 , 3); - _spin_angle.set_numeric(); + //_spin_angle.set_numeric(); // not setting numeric enables writing '.' instead of ',' for decimal _spin_angle.show(); _layout_table.attach(_label_degrees, 1, 2, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); -- cgit v1.2.3 From cba60dd473848d5e980894dd4a48fdeb9890a8ac Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 9 Apr 2011 01:19:48 +0200 Subject: add a subclassed spinbutton class. this numeric entry box accepts both ',' and '.' as the decimal point when in numeric mode. (bzr r10150) --- src/ui/dialog/guides.cpp | 6 ++--- src/ui/dialog/guides.h | 7 ++--- src/ui/widget/Makefile_insert | 2 ++ src/ui/widget/spinbutton.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++ src/ui/widget/spinbutton.h | 57 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 src/ui/widget/spinbutton.cpp create mode 100644 src/ui/widget/spinbutton.h (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index b0b4705b1..1ac1e5d82 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -194,9 +194,9 @@ void GuidelinePropertiesDialog::_setup() { sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_x.gobj())); sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_y.gobj())); _spin_button_x.configure(_adjustment_x, 1.0 , 3); - // _spin_button_x.set_numeric(); // not setting numeric enables writing '.' instead of ',' for decimal + _spin_button_x.set_numeric(); _spin_button_y.configure(_adjustment_y, 1.0 , 3); - //_spin_button_y.set_numeric(); // not setting numeric enables writing '.' instead of ',' for decimal + _spin_button_y.set_numeric(); _layout_table.attach(_label_X, 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_button_x, @@ -213,7 +213,7 @@ void GuidelinePropertiesDialog::_setup() { // angle spinbutton _spin_angle.configure(_adj_angle, 5.0 , 3); - //_spin_angle.set_numeric(); // not setting numeric enables writing '.' instead of ',' for decimal + _spin_angle.set_numeric(); _spin_angle.show(); _layout_table.attach(_label_degrees, 1, 2, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 5c74d3618..8485c78a7 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -21,6 +21,7 @@ #include #include #include "ui/widget/button.h" +#include "ui/widget/spinbutton.h" #include <2geom/point.h> namespace Inkscape { @@ -62,12 +63,12 @@ private: Inkscape::UI::Widget::CheckButton _relative_toggle; static bool _relative_toggle_status; // remember the status of the _relative_toggle_status button across instances Gtk::Adjustment _adjustment_x; - Gtk::SpinButton _spin_button_x; + Inkscape::UI::Widget::SpinButton _spin_button_x; Gtk::Adjustment _adjustment_y; - Gtk::SpinButton _spin_button_y; + Inkscape::UI::Widget::SpinButton _spin_button_y; Gtk::Adjustment _adj_angle; - Gtk::SpinButton _spin_angle; + Inkscape::UI::Widget::SpinButton _spin_angle; Gtk::Widget *_unit_selector; bool _mode; diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert index b6069631b..bd23b6782 100644 --- a/src/ui/widget/Makefile_insert +++ b/src/ui/widget/Makefile_insert @@ -66,6 +66,8 @@ ink_common_sources += \ ui/widget/scalar.h \ ui/widget/selected-style.h \ ui/widget/selected-style.cpp \ + ui/widget/spinbutton.h \ + ui/widget/spinbutton.cpp \ ui/widget/spin-slider.h \ ui/widget/spin-slider.cpp \ ui/widget/style-subject.h \ diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp new file mode 100644 index 000000000..55c2d877f --- /dev/null +++ b/src/ui/widget/spinbutton.cpp @@ -0,0 +1,60 @@ +/** + * \brief SpinButton widget, that allows entry of both '.' and ',' for the decimal, even when in numeric mode. + */ +/* + * Author: + * Johan B. C. Engelen + * + * Copyright (C) 2011 Author + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "spinbutton.h" + +#include + +namespace Inkscape { +namespace UI { +namespace Widget { + +void +SpinButton::on_insert_text(const Glib::ustring& text, int* position) +{ + Glib::ustring newtext = text; + + // if in numeric mode: replace '.' or ',' with the locale's decimal point + if (get_numeric()) { + size_t found = newtext.find('.'); + if (found != Glib::ustring::npos) { + newtext.replace(found, 1, localeconv()->decimal_point); + } else { + found = newtext.find(','); + if (found != Glib::ustring::npos) { + newtext.replace(found, 1, localeconv()->decimal_point); + } + } + } + + // call parent function with replaced text: + Gtk::SpinButton::on_insert_text(newtext, position); +} + +} // namespace Widget +} // 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 : diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h new file mode 100644 index 000000000..d9b382b08 --- /dev/null +++ b/src/ui/widget/spinbutton.h @@ -0,0 +1,57 @@ +/** + * \brief SpinButton widget, that allows entry of both '.' and ',' for the decimal, even when in numeric mode. + */ +/* + * Author: + * Johan B. C. Engelen + * + * Copyright (C) 2011 Author + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_UI_WIDGET_SPINBUTTON_H +#define INKSCAPE_UI_WIDGET_SPINBUTTON_H + +#include + +namespace Inkscape { +namespace UI { +namespace Widget { + +/** + * SpinButton widget, that allows entry of both '.' and ',' for the decimal, even when in numeric mode. + */ +class SpinButton : public Gtk::SpinButton +{ +public: + SpinButton() : Gtk::SpinButton() {}; + /// @todo perhaps more constructors should be added here + + virtual ~SpinButton() {}; + +protected: + virtual void on_insert_text(const Glib::ustring& text, int* position); + +private: + // noncopyable + SpinButton(const SpinButton&); + SpinButton& operator=(const SpinButton&); +}; + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +#endif // INKSCAPE_UI_WIDGET_SPINBUTTON_H + +/* + 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 : -- cgit v1.2.3 From 47086e74dc63803678f9f67b5b38d3fcc2a31fca Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 10 Apr 2011 22:53:12 +0200 Subject: go wild adding % at the end of each latex line (pdf+latex output) Fixed bugs: - https://launchpad.net/bugs/643849 - https://launchpad.net/bugs/687344 (bzr r10154) --- src/extension/internal/latex-text-renderer.cpp | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 1f9bdfef1..a443a905a 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -196,22 +196,22 @@ static char const preamble[] = "%% \n" "%% For more information, please see info/svg-inkscape on CTAN:\n" "%% http://tug.ctan.org/tex-archive/info/svg-inkscape\n" -"\n" -"\\begingroup\n" -" \\makeatletter\n" +"%%\n" +"\\begingroup%\n" +" \\makeatletter%\n" " \\providecommand\\color[2][]{%\n" -" \\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package \'color.sty\' is not loaded}\n" +" \\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package \'color.sty\' is not loaded}%\n" " \\renewcommand\\color[2][]{}%\n" -" }\n" +" }%\n" " \\providecommand\\transparent[1]{%\n" -" \\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package \'transparent.sty\' is not loaded}\n" +" \\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package \'transparent.sty\' is not loaded}%\n" " \\renewcommand\\transparent[1]{}%\n" -" }\n" -" \\providecommand\\rotatebox[2]{#2}\n"; +" }%\n" +" \\providecommand\\rotatebox[2]{#2}%\n"; static char const postamble[] = " \\end{picture}%\n" -"\\endgroup\n"; +"\\endgroup%\n"; void LaTeXTextRenderer::writePreamble() @@ -598,19 +598,19 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * // scaling of the image when including it in LaTeX - os << " \\ifx\\svgwidth\\undefined\n"; - os << " \\setlength{\\unitlength}{" << d->width() * PT_PER_PX << "pt}\n"; - os << " \\ifx\\svgscale\\undefined\n"; - os << " \\relax\n"; - os << " \\else\n"; - os << " \\setlength{\\unitlength}{\\unitlength * \\real{\\svgscale}}\n"; - os << " \\fi\n"; - os << " \\else\n"; - os << " \\setlength{\\unitlength}{\\svgwidth}\n"; - os << " \\fi\n"; - os << " \\global\\let\\svgwidth\\undefined\n"; - os << " \\global\\let\\svgscale\\undefined\n"; - os << " \\makeatother\n"; + os << " \\ifx\\svgwidth\\undefined%\n"; + os << " \\setlength{\\unitlength}{" << d->width() * PT_PER_PX << "pt}%\n"; + os << " \\ifx\\svgscale\\undefined%\n"; + os << " \\relax%\n"; + os << " \\else%\n"; + os << " \\setlength{\\unitlength}{\\unitlength * \\real{\\svgscale}}%\n"; + os << " \\fi%\n"; + os << " \\else%\n"; + os << " \\setlength{\\unitlength}{\\svgwidth}%\n"; + os << " \\fi%\n"; + os << " \\global\\let\\svgwidth\\undefined%\n"; + os << " \\global\\let\\svgscale\\undefined%\n"; + os << " \\makeatother%\n"; os << " \\begin{picture}(" << _width << "," << _height << ")%\n"; // strip pathname, as it is probably desired. Having a specific path in the TeX file is not convenient. -- cgit v1.2.3 From 28ad8dcc8291ea4fecf59fd27c6d67e2778c540a Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 10 Apr 2011 23:23:11 +0200 Subject: pdf+latex: fix newline bug due to changes in r10089 (bzr r10155) --- src/extension/internal/latex-text-renderer.cpp | 45 +++++++++++++++++--------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index a443a905a..417dbb9ff 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -266,10 +266,15 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) SPText *textobj = SP_TEXT (item); SPStyle *style = item->style; - gchar *str = sp_te_get_string_multiline(item); - if (!str) { + gchar *strtext = sp_te_get_string_multiline(item); + if (!strtext) { return; } + // replace carriage return with double slash + gchar ** splitstr = g_strsplit(strtext, "\n", -1); + gchar *str = g_strjoinv("\\\\ ", splitstr); + g_free(strtext); + g_strfreev(splitstr); // get position and alignment // Align vertically on the baseline of the font (retreived from the anchor point) @@ -361,8 +366,17 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) Inkscape::Text::Layout::iterator ln = li; ln.nextStartOfSpan(); - Glib::ustring spanstr = sp_te_get_string_multiline (item, li, ln); - os << spanstr; + Glib::ustring uspanstr = sp_te_get_string_multiline (item, li, ln); + const gchar *spanstr = uspanstr.c_str(); + if (!spanstr) { + continue; + } + // replace carriage return with double slash + gchar ** splitstr = g_strsplit(spanstr, "\n", -1); + gchar *spanstr_new = g_strjoinv("\\\\ ", splitstr); + os << spanstr_new; + g_strfreev(splitstr); + g_free(spanstr_new); if (is_italic) { os << "}"; } // italic end if (is_bold) { os << "}"; } // bold end @@ -389,16 +403,6 @@ Flowing in rectangle is possible, not in arb shape. SPFlowtext *flowtext = SP_FLOWTEXT(item); SPStyle *style = item->style; - gchar *strtext = sp_te_get_string_multiline(item); - if (!strtext) { - return; - } - // replace carriage return with double slash - gchar ** splitstr = g_strsplit(strtext, "\n", -1); - gchar *str = g_strjoinv("\\\\ ", splitstr); - g_free(strtext); - g_strfreev(splitstr); - SPItem *frame_item = flowtext->get_frame(NULL); if (!frame_item || !SP_IS_RECT(frame_item)) { g_warning("LaTeX export: non-rectangular flowed text shapes are not supported, skipping text."); @@ -500,8 +504,17 @@ Flowing in rectangle is possible, not in arb shape. Inkscape::Text::Layout::iterator ln = li; ln.nextStartOfSpan(); - Glib::ustring spanstr = sp_te_get_string_multiline (item, li, ln); - os << spanstr; + Glib::ustring uspanstr = sp_te_get_string_multiline (item, li, ln); + const gchar *spanstr = uspanstr.c_str(); + if (!spanstr) { + continue; + } + // replace carriage return with double slash + gchar ** splitstr = g_strsplit(spanstr, "\n", -1); + gchar *spanstr_new = g_strjoinv("\\\\ ", splitstr); + os << spanstr_new; + g_strfreev(splitstr); + g_free(spanstr_new); if (is_italic) { os << "}"; } // italic end if (is_bold) { os << "}"; } // bold end -- cgit v1.2.3 From 102bcf0bf771f0fc40d8f63ee9c727256b2d70f1 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 10 Apr 2011 23:55:40 +0200 Subject: pdf+latex: * use textit instead of itshape, use textbf instead of bfseries; this improves kerning * add textsl (slanted) for oblique font shapes (e.g. Arial) (bzr r10156) --- src/extension/internal/latex-text-renderer.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 417dbb9ff..98142632d 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -345,7 +345,7 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) li != le; li.nextStartOfSpan()) { SPStyle const &spanstyle = *(sp_te_style_at_position (item, li)); - bool is_bold = false, is_italic = false; + bool is_bold = false, is_italic = false, is_oblique = false; if (spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_500 || spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_600 || @@ -356,12 +356,17 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_BOLDER) { is_bold = true; - os << "{\\bfseries{}"; + os << "\\textbf{"; } if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_ITALIC) { is_italic = true; - os << "{\\itshape{}"; + os << "\\textit{"; + } + if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_OBLIQUE) + { + is_oblique = true; + os << "\\textsl{"; // this is an accurate choice if the LaTeX chosen font matches the font in Inkscape. Gives bad results when it is not so... } Inkscape::Text::Layout::iterator ln = li; @@ -378,6 +383,7 @@ LaTeXTextRenderer::sp_text_render(SPItem *item) g_strfreev(splitstr); g_free(spanstr_new); + if (is_oblique) { os << "}"; } // oblique end if (is_italic) { os << "}"; } // italic end if (is_bold) { os << "}"; } // bold end } @@ -483,7 +489,7 @@ Flowing in rectangle is possible, not in arb shape. li != le; li.nextStartOfSpan()) { SPStyle const &spanstyle = *(sp_te_style_at_position (item, li)); - bool is_bold = false, is_italic = false; + bool is_bold = false, is_italic = false, is_oblique = false; if (spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_500 || spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_600 || @@ -494,12 +500,17 @@ Flowing in rectangle is possible, not in arb shape. spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_BOLDER) { is_bold = true; - os << "{\\bfseries{}"; + os << "\\textbf{"; } if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_ITALIC) { is_italic = true; - os << "{\\itshape{}"; + os << "\\textit{"; + } + if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_OBLIQUE) + { + is_oblique = true; + os << "\\textsl{"; // this is an accurate choice if the LaTeX chosen font matches the font in Inkscape. Gives bad results when it is not so... } Inkscape::Text::Layout::iterator ln = li; @@ -516,6 +527,7 @@ Flowing in rectangle is possible, not in arb shape. g_strfreev(splitstr); g_free(spanstr_new); + if (is_oblique) { os << "}"; } // oblique end if (is_italic) { os << "}"; } // italic end if (is_bold) { os << "}"; } // bold end } -- cgit v1.2.3 From c10590daa8606b1afcbe29e054523ce95cbdca74 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 11 Apr 2011 17:58:35 +0200 Subject: Guides and clonetiler. Fix for bug #477649 (GTK warning about an adjustment with non-zero page in the guide editor dialog). Clonetiler. Code consistency fix. (bzr r10157) --- src/dialogs/clonetiler.cpp | 179 ++++++++++++++++++++------------------------- src/ui/dialog/guides.cpp | 6 +- 2 files changed, 81 insertions(+), 104 deletions(-) (limited to 'src') diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 2a78cf5a1..40b5f601e 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -82,8 +82,7 @@ static sigc::connection _color_changed_connection; static Inkscape::UI::Widget::ColorPicker *color_picker; -static void -clonetiler_dialog_destroy( GtkObject */*object*/, gpointer /*data*/ ) +static void clonetiler_dialog_destroy(GtkObject */*object*/, gpointer /*data*/) { sp_signal_disconnect_by_data (INKSCAPE, dlg); _color_changed_connection.disconnect(); @@ -95,14 +94,17 @@ clonetiler_dialog_destroy( GtkObject */*object*/, gpointer /*data*/ ) } -static gboolean -clonetiler_dialog_delete (GtkObject */*object*/, GdkEvent * /*event*/, gpointer /*data*/) +static gboolean clonetiler_dialog_delete(GtkObject */*object*/, GdkEvent * /*event*/, gpointer /*data*/) { gtk_window_get_position ((GtkWindow *) dlg, &x, &y); gtk_window_get_size ((GtkWindow *) dlg, &w, &h); - if (x<0) x=0; - if (y<0) y=0; + if (x < 0) { + x = 0; + } + if (y < 0) { + y = 0; + } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt(prefs_path + "x", x); @@ -114,8 +116,7 @@ clonetiler_dialog_delete (GtkObject */*object*/, GdkEvent * /*event*/, gpointer } -static void -on_picker_color_changed (guint rgba) +static void on_picker_color_changed(guint rgba) { static bool is_updating = false; if (is_updating || !SP_ACTIVE_DESKTOP) @@ -131,10 +132,9 @@ on_picker_color_changed (guint rgba) is_updating = false; } -static guint clonetiler_number_of_clones (SPObject *obj); +static guint clonetiler_number_of_clones(SPObject *obj); -static void -clonetiler_change_selection (Inkscape::Application * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg) +static void clonetiler_change_selection(Inkscape::Application * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg) { GtkWidget *buttons = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "buttons_on_tiles"); GtkWidget *status = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "status"); @@ -163,15 +163,16 @@ clonetiler_change_selection (Inkscape::Application * /*inkscape*/, Inkscape::Sel } } -static void -clonetiler_external_change (Inkscape::Application * /*inkscape*/, GtkWidget *dlg) +static void clonetiler_external_change(Inkscape::Application * /*inkscape*/, GtkWidget *dlg) { clonetiler_change_selection (NULL, sp_desktop_selection(SP_ACTIVE_DESKTOP), dlg); } -static void clonetiler_disconnect_gsignal (GObject *widget, gpointer source) { - if (source && G_IS_OBJECT(source)) +static void clonetiler_disconnect_gsignal(GObject *widget, gpointer source) +{ + if (source && G_IS_OBJECT(source)) { sp_signal_disconnect_by_data (source, widget); + } } @@ -196,9 +197,7 @@ enum { }; -static Geom::Affine -clonetiler_get_transform ( - +static Geom::Affine clonetiler_get_transform( // symmetry group int type, @@ -800,8 +799,7 @@ clonetiler_get_transform ( return Geom::identity(); } -static bool -clonetiler_is_a_clone_of (SPObject *tile, SPObject *obj) +static bool clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj) { bool result = false; char *id_href = NULL; @@ -834,8 +832,7 @@ static NRArenaItem *trace_root; static gdouble trace_zoom; static SPDocument *trace_doc; -static void -clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) +static void clonetiler_trace_hide_tiled_clones_recursively(SPObject *from) { if (!trace_arena) return; @@ -847,8 +844,7 @@ clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) } } -static void -clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) +static void clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *original) { trace_arena = NRArena::create(); /* Create ArenaItem and set transform */ @@ -866,11 +862,11 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) trace_zoom = zoom; } -static guint32 -clonetiler_trace_pick (Geom::Rect box) +static guint32 clonetiler_trace_pick(Geom::Rect box) { - if (!trace_arena) + if (!trace_arena) { return 0; + } Geom::Affine t(Geom::Scale(trace_zoom, trace_zoom)); nr_arena_item_set_transform(trace_root, &t); @@ -940,8 +936,7 @@ clonetiler_trace_pick (Geom::Rect box) return SP_RGBA32_F_COMPOSE (R, G, B, A); } -static void -clonetiler_trace_finish () +static void clonetiler_trace_finish() { if (trace_doc) { SP_ITEM(trace_doc->getRoot())->invoke_hide(trace_visionkey); @@ -952,12 +947,12 @@ clonetiler_trace_finish () } } -static void -clonetiler_unclump( GtkWidget */*widget*/, void * ) +static void clonetiler_unclump(GtkWidget */*widget*/, void *) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) + if (desktop == NULL) { return; + } Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -988,8 +983,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) _("Unclump tiled clones")); } -static guint -clonetiler_number_of_clones (SPObject *obj) +static guint clonetiler_number_of_clones(SPObject *obj) { SPObject *parent = obj->parent; @@ -1004,12 +998,12 @@ clonetiler_number_of_clones (SPObject *obj) return n; } -static void -clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) +static void clonetiler_remove(GtkWidget */*widget*/, void *, bool do_undo = true) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) + if (desktop == NULL) { return; + } Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -1042,8 +1036,7 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) } } -static Geom::Rect -transform_rect( Geom::Rect const &r, Geom::Affine const &m) +static Geom::Rect transform_rect(Geom::Rect const &r, Geom::Affine const &m) { using Geom::X; using Geom::Y; @@ -1064,22 +1057,23 @@ transform_rect( Geom::Rect const &r, Geom::Affine const &m) Randomizes \a val by \a rand, with 0 < val < 1 and all values (including 0, 1) having the same probability of being displaced. */ -static double -randomize01 (double val, double rand) +static double randomize01(double val, double rand) { double base = MIN (val - rand, 1 - 2*rand); - if (base < 0) base = 0; + if (base < 0) { + base = 0; + } val = base + g_random_double_range (0, MIN (2 * rand, 1 - base)); return CLAMP(val, 0, 1); // this should be unnecessary with the above provisions, but just in case... } -static void -clonetiler_apply( GtkWidget */*widget*/, void * ) +static void clonetiler_apply(GtkWidget */*widget*/, void *) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop == NULL) + if (desktop == NULL) { return; + } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -1429,11 +1423,11 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) } if (opacity < 1e-6) { // invisibly transparent, skip - continue; + continue; } if (fabs(t[0]) + fabs (t[1]) + fabs(t[2]) + fabs(t[3]) < 1e-6) { // too small, skip - continue; + continue; } // Create the clone @@ -1506,8 +1500,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) _("Create tiled clones")); } -static GtkWidget * -clonetiler_new_tab (GtkWidget *nb, const gchar *label) +static GtkWidget * clonetiler_new_tab(GtkWidget *nb, const gchar *label) { GtkWidget *l = gtk_label_new_with_mnemonic (label); GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN); @@ -1516,16 +1509,14 @@ clonetiler_new_tab (GtkWidget *nb, const gchar *label) return vb; } -static void -clonetiler_checkbox_toggled (GtkToggleButton *tb, gpointer *data) +static void clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data) { const gchar *attr = (const gchar *) data; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool(prefs_path + attr, gtk_toggle_button_get_active(tb)); } -static GtkWidget * -clonetiler_checkbox (GtkTooltips *tt, const char *tip, const char *attr) +static GtkWidget * clonetiler_checkbox(GtkTooltips *tt, const char *tip, const char *attr) { GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); @@ -1545,32 +1536,31 @@ clonetiler_checkbox (GtkTooltips *tt, const char *tip, const char *attr) return hb; } - -static void -clonetiler_value_changed (GtkAdjustment *adj, gpointer data) +static void clonetiler_value_changed(GtkAdjustment *adj, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; prefs->setDouble(prefs_path + pref, adj->value); } -static GtkWidget * -clonetiler_spinbox (GtkTooltips *tt, const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false) +static GtkWidget * clonetiler_spinbox(GtkTooltips *tt, const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false) { GtkWidget *hb = gtk_hbox_new(FALSE, 0); { GtkObject *a; - if (exponent) - a = gtk_adjustment_new(1.0, lower, upper, 0.01, 0.05, 0.1); - else - a = gtk_adjustment_new(0.0, lower, upper, 0.1, 0.5, 2); + if (exponent) { + a = gtk_adjustment_new(1.0, lower, upper, 0.01, 0.05, 0); + } else { + a = gtk_adjustment_new(0.0, lower, upper, 0.1, 0.5, 0); + } GtkWidget *sb; - if (exponent) + if (exponent) { sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 0.01, 2); - else + } else { sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 0.1, 1); + } gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, tip, NULL); gtk_entry_set_width_chars (GTK_ENTRY (sb), 4); @@ -1582,10 +1572,11 @@ clonetiler_spinbox (GtkTooltips *tt, const char *tip, const char *attr, double l gtk_signal_connect(GTK_OBJECT(a), "value_changed", GTK_SIGNAL_FUNC(clonetiler_value_changed), (gpointer) attr); - if (exponent) + if (exponent) { g_object_set_data (G_OBJECT(sb), "oneable", GINT_TO_POINTER(TRUE)); - else + } else { g_object_set_data (G_OBJECT(sb), "zeroable", GINT_TO_POINTER(TRUE)); + } } { @@ -1598,31 +1589,27 @@ clonetiler_spinbox (GtkTooltips *tt, const char *tip, const char *attr, double l return hb; } -static void -clonetiler_symgroup_changed( GtkMenuItem */*item*/, gpointer data ) +static void clonetiler_symgroup_changed(GtkMenuItem */*item*/, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint group_new = GPOINTER_TO_INT (data); prefs->setInt(prefs_path + "symmetrygroup", group_new); } -static void -clonetiler_xy_changed (GtkAdjustment *adj, gpointer data) +static void clonetiler_xy_changed(GtkAdjustment *adj, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; prefs->setInt(prefs_path + pref, (int) floor(adj->value + 0.5)); } -static void -clonetiler_keep_bbox_toggled( GtkToggleButton *tb, gpointer /*data*/ ) +static void clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool(prefs_path + "keepbbox", gtk_toggle_button_get_active(tb)); } -static void -clonetiler_pick_to (GtkToggleButton *tb, gpointer data) +static void clonetiler_pick_to(GtkToggleButton *tb, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; @@ -1630,8 +1617,7 @@ clonetiler_pick_to (GtkToggleButton *tb, gpointer data) } -static void -clonetiler_reset_recursive (GtkWidget *w) +static void clonetiler_reset_recursive(GtkWidget *w) { if (w && GTK_IS_OBJECT(w)) { { @@ -1665,22 +1651,19 @@ clonetiler_reset_recursive (GtkWidget *w) } } -static void -clonetiler_reset( GtkWidget */*widget*/, void * ) +static void clonetiler_reset(GtkWidget */*widget*/, void *) { clonetiler_reset_recursive (dlg); } -static void -clonetiler_table_attach (GtkWidget *table, GtkWidget *widget, float align, int row, int col) +static void clonetiler_table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col) { GtkWidget *a = gtk_alignment_new (align, 0, 0, 0); gtk_container_add(GTK_CONTAINER(a), widget); gtk_table_attach ( GTK_TABLE (table), a, col, col + 1, row, row + 1, (GtkAttachOptions)4, (GtkAttachOptions)0, 0, 0 ); } -static GtkWidget * -clonetiler_table_x_y_rand (int values) +static GtkWidget * clonetiler_table_x_y_rand(int values) { GtkWidget *table = gtk_table_new (values + 2, 5, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), VB_MARGIN); @@ -1722,8 +1705,7 @@ clonetiler_table_x_y_rand (int values) return table; } -static void -clonetiler_pick_switched( GtkToggleButton */*tb*/, gpointer data ) +static void clonetiler_pick_switched(GtkToggleButton */*tb*/, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint v = GPOINTER_TO_INT (data); @@ -1731,8 +1713,7 @@ clonetiler_pick_switched( GtkToggleButton */*tb*/, gpointer data ) } -static void -clonetiler_switch_to_create( GtkToggleButton */*tb*/, GtkWidget *dlg ) +static void clonetiler_switch_to_create(GtkToggleButton */*tb*/, GtkWidget *dlg) { GtkWidget *rowscols = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "rowscols"); GtkWidget *widthheight = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "widthheight"); @@ -1749,8 +1730,7 @@ clonetiler_switch_to_create( GtkToggleButton */*tb*/, GtkWidget *dlg ) } -static void -clonetiler_switch_to_fill( GtkToggleButton */*tb*/, GtkWidget *dlg ) +static void clonetiler_switch_to_fill(GtkToggleButton */*tb*/, GtkWidget *dlg) { GtkWidget *rowscols = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "rowscols"); GtkWidget *widthheight = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "widthheight"); @@ -1769,8 +1749,7 @@ clonetiler_switch_to_fill( GtkToggleButton */*tb*/, GtkWidget *dlg ) -static void -clonetiler_fill_width_changed (GtkAdjustment *adj, GtkWidget *u) +static void clonetiler_fill_width_changed(GtkAdjustment *adj, GtkWidget *u) { gdouble const raw_dist = adj->value; SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(u)); @@ -1780,8 +1759,7 @@ clonetiler_fill_width_changed (GtkAdjustment *adj, GtkWidget *u) prefs->setDouble(prefs_path + "fillwidth", pixels); } -static void -clonetiler_fill_height_changed (GtkAdjustment *adj, GtkWidget *u) +static void clonetiler_fill_height_changed(GtkAdjustment *adj, GtkWidget *u) { gdouble const raw_dist = adj->value; SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(u)); @@ -1792,23 +1770,22 @@ clonetiler_fill_height_changed (GtkAdjustment *adj, GtkWidget *u) } -static void -clonetiler_do_pick_toggled( GtkToggleButton *tb, gpointer /*data*/ ) +static void clonetiler_do_pick_toggled(GtkToggleButton *tb, gpointer /*data*/) { GtkWidget *vvb = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "dotrace"); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool(prefs_path + "dotrace", gtk_toggle_button_get_active (tb)); - if (vvb) + if (vvb) { gtk_widget_set_sensitive (vvb, gtk_toggle_button_get_active (tb)); + } } -void -clonetiler_dialog (void) +void clonetiler_dialog(void) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (!dlg) @@ -2764,7 +2741,7 @@ clonetiler_dialog (void) g_object_set_data (G_OBJECT(dlg), "rowscols", (gpointer) hb); { - GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 10); + GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 0); int value = prefs->getInt(prefs_path + "jmax", 2); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0); @@ -2784,7 +2761,7 @@ clonetiler_dialog (void) } { - GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 10); + GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 0); int value = prefs->getInt(prefs_path + "imax", 2); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0); @@ -2809,7 +2786,7 @@ clonetiler_dialog (void) { // Width spinbutton - GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 10.0); + GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 0); sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a)); double value = prefs->getDouble(prefs_path + "fillwidth", 50.0); @@ -2833,7 +2810,7 @@ clonetiler_dialog (void) { // Height spinbutton - GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 10.0); + GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 0); sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a)); double value = prefs->getDouble(prefs_path + "fillheight", 50.0); diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 1ac1e5d82..910b4ac39 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -45,9 +45,9 @@ GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop * _label_Y(_("Y:")), _label_degrees(_("Angle (degrees):")), _relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")), - _adjustment_x(0.0, -1e6, 1e6, 1.0, 10.0, 10.0), - _adjustment_y(0.0, -1e6, 1e6, 1.0, 10.0, 10.0), - _adj_angle(0.0, -360, 360, 1.0, 10.0, 10.0), + _adjustment_x(0.0, -1e6, 1e6, 1.0, 10.0, 0), + _adjustment_y(0.0, -1e6, 1e6, 1.0, 10.0, 0), + _adj_angle(0.0, -360, 360, 1.0, 10.0, 0), _unit_selector(NULL), _mode(true), _oldpos(0.,0.), _oldangle(0.0) { } -- cgit v1.2.3 From a23c64310e23a948aaeed4a47b4a2cd65f5d9201 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 11 Apr 2011 20:45:22 +0200 Subject: revert silly error in r10147 (bzr r10158) --- src/ui/dialog/guides.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 910b4ac39..619b6fb16 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -152,7 +152,7 @@ void GuidelinePropertiesDialog::_response(gint response) } void GuidelinePropertiesDialog::_setup() { - set_title(_("Guidelinea")); + set_title(_("Guideline")); add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); add_button(Gtk::Stock::DELETE, -12); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); -- cgit v1.2.3 From ae45a98ae609d27cf5cf8471c2cea685bde5da70 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 11 Apr 2011 21:20:20 +0200 Subject: Use the subclassed SpinButton class for numeric inputs, such that '.' and ',' both can be used as decimal point. (related to bug 484187) (bzr r10159) --- src/ui/dialog/session-player.h | 2 +- src/ui/widget/preferences-widget.h | 3 ++- src/ui/widget/scalar.cpp | 39 +++++++++++++++++++------------------- src/ui/widget/scalar.h | 3 --- src/ui/widget/spinbutton.h | 6 ++++-- 5 files changed, 27 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/session-player.h b/src/ui/dialog/session-player.h index 9c10f264f..2d235cd25 100644 --- a/src/ui/dialog/session-player.h +++ b/src/ui/dialog/session-player.h @@ -75,7 +75,7 @@ private: Gtk::Tooltips _tooltips; Gtk::Toolbar _playbackcontrols; Gtk::Adjustment _delay; - Gtk::SpinButton _delayentry; + Widget::SpinButton _delayentry; Gtk::Frame _filemanager; Gtk::VBox _fm; diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 6c7f9ce4a..4cd2ff569 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -32,6 +32,7 @@ #include "ui/widget/color-picker.h" #include "ui/widget/unit-menu.h" +#include "ui/widget/spinbutton.h" namespace Inkscape { namespace UI { @@ -68,7 +69,7 @@ protected: void on_toggled(); }; -class PrefSpinButton : public Gtk::SpinButton +class PrefSpinButton : public SpinButton { public: void init(Glib::ustring const &prefs_path, diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index 26a1f6541..eda8cd2cc 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -18,6 +18,7 @@ #include "scalar.h" +#include "spinbutton.h" namespace Inkscape { namespace UI { @@ -37,10 +38,10 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, bool mnemonic) - : Labelled(label, tooltip, new Gtk::SpinButton(), suffix, icon, mnemonic), + : Labelled(label, tooltip, new SpinButton(), suffix, icon, mnemonic), setProgrammatically(false) { - static_cast(_widget)->set_numeric(); + static_cast(_widget)->set_numeric(); } /** @@ -59,10 +60,10 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, bool mnemonic) - : Labelled(label, tooltip, new Gtk::SpinButton(0.0, digits), suffix, icon, mnemonic), + : Labelled(label, tooltip, new SpinButton(0.0, digits), suffix, icon, mnemonic), setProgrammatically(false) { - static_cast(_widget)->set_numeric(); + static_cast(_widget)->set_numeric(); } /** @@ -83,10 +84,10 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, bool mnemonic) - : Labelled(label, tooltip, new Gtk::SpinButton(adjust, 0.0, digits), suffix, icon, mnemonic), + : Labelled(label, tooltip, new SpinButton(adjust, 0.0, digits), suffix, icon, mnemonic), setProgrammatically(false) { - static_cast(_widget)->set_numeric(); + static_cast(_widget)->set_numeric(); } /** Fetches the precision of the spin buton */ @@ -94,7 +95,7 @@ unsigned Scalar::getDigits() const { g_assert(_widget != NULL); - return static_cast(_widget)->get_digits(); + return static_cast(_widget)->get_digits(); } /** Gets the current step ingrement used by the spin button */ @@ -103,7 +104,7 @@ Scalar::getStep() const { g_assert(_widget != NULL); double step, page; - static_cast(_widget)->get_increments(step, page); + static_cast(_widget)->get_increments(step, page); return step; } @@ -113,7 +114,7 @@ Scalar::getPage() const { g_assert(_widget != NULL); double step, page; - static_cast(_widget)->get_increments(step, page); + static_cast(_widget)->get_increments(step, page); return page; } @@ -123,7 +124,7 @@ Scalar::getRangeMin() const { g_assert(_widget != NULL); double min, max; - static_cast(_widget)->get_range(min, max); + static_cast(_widget)->get_range(min, max); return min; } @@ -133,7 +134,7 @@ Scalar::getRangeMax() const { g_assert(_widget != NULL); double min, max; - static_cast(_widget)->get_range(min, max); + static_cast(_widget)->get_range(min, max); return max; } @@ -142,7 +143,7 @@ double Scalar::getValue() const { g_assert(_widget != NULL); - return static_cast(_widget)->get_value(); + return static_cast(_widget)->get_value(); } /** Get the value spin_button represented as an integer. */ @@ -150,7 +151,7 @@ int Scalar::getValueAsInt() const { g_assert(_widget != NULL); - return static_cast(_widget)->get_value_as_int(); + return static_cast(_widget)->get_value_as_int(); } @@ -159,7 +160,7 @@ void Scalar::setDigits(unsigned digits) { g_assert(_widget != NULL); - static_cast(_widget)->set_digits(digits); + static_cast(_widget)->set_digits(digits); } /** Sets the step and page increments for the spin button @@ -169,7 +170,7 @@ void Scalar::setIncrements(double step, double /*page*/) { g_assert(_widget != NULL); - static_cast(_widget)->set_increments(step, 0); + static_cast(_widget)->set_increments(step, 0); } /** Sets the minimum and maximum range allowed for the spin button */ @@ -177,7 +178,7 @@ void Scalar::setRange(double min, double max) { g_assert(_widget != NULL); - static_cast(_widget)->set_range(min, max); + static_cast(_widget)->set_range(min, max); } /** Sets the value of the spin button */ @@ -186,14 +187,14 @@ Scalar::setValue(double value) { g_assert(_widget != NULL); setProgrammatically = true; // callback is supposed to reset back, if it cares - static_cast(_widget)->set_value(value); + static_cast(_widget)->set_value(value); } /** Manually forces an update of the spin button */ void Scalar::update() { g_assert(_widget != NULL); - static_cast(_widget)->update(); + static_cast(_widget)->update(); } @@ -202,7 +203,7 @@ Scalar::update() { Glib::SignalProxy0 Scalar::signal_value_changed() { - return static_cast(_widget)->signal_value_changed(); + return static_cast(_widget)->signal_value_changed(); } diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 6de128edb..7142ba93f 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -15,9 +15,6 @@ #ifndef INKSCAPE_UI_WIDGET_SCALAR_H #define INKSCAPE_UI_WIDGET_SCALAR_H -#include -#include - #include "labelled.h" namespace Inkscape { diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index d9b382b08..408310d09 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -25,8 +25,10 @@ namespace Widget { class SpinButton : public Gtk::SpinButton { public: - SpinButton() : Gtk::SpinButton() {}; - /// @todo perhaps more constructors should be added here + SpinButton(double climb_rate = 0.0, guint digits = 0) + : Gtk::SpinButton(climb_rate, digits) {}; + explicit SpinButton(Gtk::Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0) + : Gtk::SpinButton(adjustment, climb_rate, digits) {}; virtual ~SpinButton() {}; -- cgit v1.2.3 From ccc2ac21c121259c9400d547d53fde6da2093e84 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Tue, 12 Apr 2011 21:13:24 +0200 Subject: fix build (bzr r10160) --- src/ui/widget/random.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index 02201be12..3dcf09cb5 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -25,6 +25,8 @@ #include +#include + namespace Inkscape { namespace UI { namespace Widget { -- cgit v1.2.3 From fe875852760883dd20b6a57b57be50de83e37fc2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 14 Apr 2011 00:04:49 +0200 Subject: add expression evaluator for spinbox input boxes. also knows a little about units. needs more work to fully integrate it in all of inkscape spinboxes also needs documentation rework (bzr r10162) --- src/ui/dialog/guides.cpp | 3 - src/ui/widget/preferences-widget.cpp | 1 - src/ui/widget/scalar-unit.cpp | 3 + src/ui/widget/scalar.cpp | 3 - src/ui/widget/spinbutton.cpp | 41 +-- src/ui/widget/spinbutton.h | 24 +- src/util/Makefile_insert | 2 + src/util/expression-evaluator.cpp | 571 +++++++++++++++++++++++++++++++++++ src/util/expression-evaluator.h | 80 +++++ 9 files changed, 700 insertions(+), 28 deletions(-) create mode 100644 src/util/expression-evaluator.cpp create mode 100644 src/util/expression-evaluator.h (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 619b6fb16..fd64a713f 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -194,9 +194,7 @@ void GuidelinePropertiesDialog::_setup() { sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_x.gobj())); sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_y.gobj())); _spin_button_x.configure(_adjustment_x, 1.0 , 3); - _spin_button_x.set_numeric(); _spin_button_y.configure(_adjustment_y, 1.0 , 3); - _spin_button_y.set_numeric(); _layout_table.attach(_label_X, 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_button_x, @@ -213,7 +211,6 @@ void GuidelinePropertiesDialog::_setup() { // angle spinbutton _spin_angle.configure(_adj_angle, 5.0 , 3); - _spin_angle.set_numeric(); _spin_angle.show(); _layout_table.attach(_label_degrees, 1, 2, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index afcaa338e..f92e2518d 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -227,7 +227,6 @@ void PrefSpinButton::init(Glib::ustring const &prefs_path, this->set_range (lower, upper); this->set_increments (step_increment, 0); - this->set_numeric(); this->set_value (value); this->set_width_chars(6); if (is_int) diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index 6209d40e0..e00e82198 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -27,6 +27,7 @@ #endif #include "scalar-unit.h" +#include "spinbutton.h" namespace Inkscape { namespace UI { @@ -65,6 +66,8 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, } _unit_menu->signal_changed() .connect_notify(sigc::mem_fun(*this, &ScalarUnit::on_unit_changed)); + + static_cast(_widget)->setUnitMenu(_unit_menu); } /** diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index eda8cd2cc..6ada379fb 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -41,7 +41,6 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, : Labelled(label, tooltip, new SpinButton(), suffix, icon, mnemonic), setProgrammatically(false) { - static_cast(_widget)->set_numeric(); } /** @@ -63,7 +62,6 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, : Labelled(label, tooltip, new SpinButton(0.0, digits), suffix, icon, mnemonic), setProgrammatically(false) { - static_cast(_widget)->set_numeric(); } /** @@ -87,7 +85,6 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, : Labelled(label, tooltip, new SpinButton(adjust, 0.0, digits), suffix, icon, mnemonic), setProgrammatically(false) { - static_cast(_widget)->set_numeric(); } /** Fetches the precision of the spin buton */ diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 55c2d877f..22bc30bb2 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -16,32 +16,39 @@ #include "spinbutton.h" -#include +#include "unit-menu.h" +#include "util/expression-evaluator.h" namespace Inkscape { namespace UI { namespace Widget { -void -SpinButton::on_insert_text(const Glib::ustring& text, int* position) +/** + * This callback function should try to convert the entered text to a number and write it to newvalue. + * It calls a method to evaluate the (potential) mathematical expression. + * + * @retval false No conversion done, continue with default handler. + * @retval true Conversion successful, don't call default handler. + */ +int +SpinButton::on_input(double* newvalue) { - Glib::ustring newtext = text; - - // if in numeric mode: replace '.' or ',' with the locale's decimal point - if (get_numeric()) { - size_t found = newtext.find('.'); - if (found != Glib::ustring::npos) { - newtext.replace(found, 1, localeconv()->decimal_point); - } else { - found = newtext.find(','); - if (found != Glib::ustring::npos) { - newtext.replace(found, 1, localeconv()->decimal_point); - } + try { + Inkscape::Util::GimpEevlQuantity result = Inkscape::Util::gimp_eevl_evaluate (get_text().c_str(), _unit_menu ? &_unit_menu->getUnit() : NULL); + // check if output dimension corresponds to input unit + if (_unit_menu && result.dimension != (_unit_menu->getUnit().isAbsolute() ? 1 : 0) ) { + throw Inkscape::Util::EvaluatorException("Input dimensions do not match with parameter dimensions.",""); } + + *newvalue = result.value; + } + catch(Inkscape::Util::EvaluatorException &e) { + g_message ("%s", e.what()); + + return false; } - // call parent function with replaced text: - Gtk::SpinButton::on_insert_text(newtext, position); + return true; } } // namespace Widget diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index 408310d09..0eb58bb9e 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -19,21 +19,37 @@ namespace Inkscape { namespace UI { namespace Widget { +class UnitMenu; + /** - * SpinButton widget, that allows entry of both '.' and ',' for the decimal, even when in numeric mode. + * SpinButton widget, that allows entry of simple math expressions (also units, when linked with UnitMenu). + * + * Calling "set_numeric()" effectively disables the expression parsing. If no unit menu is linked, all unitlike characters are ignored. */ class SpinButton : public Gtk::SpinButton { public: SpinButton(double climb_rate = 0.0, guint digits = 0) - : Gtk::SpinButton(climb_rate, digits) {}; + : Gtk::SpinButton(climb_rate, digits), + _unit_menu(NULL) + { + signal_input().connect(sigc::mem_fun(*this, &SpinButton::on_input)); + }; explicit SpinButton(Gtk::Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0) - : Gtk::SpinButton(adjustment, climb_rate, digits) {}; + : Gtk::SpinButton(adjustment, climb_rate, digits), + _unit_menu(NULL) + { + signal_input().connect(sigc::mem_fun(*this, &SpinButton::on_input)); + }; virtual ~SpinButton() {}; + void setUnitMenu(UnitMenu* unit_menu) { _unit_menu = unit_menu; }; + protected: - virtual void on_insert_text(const Glib::ustring& text, int* position); + UnitMenu *_unit_menu; /// Linked unit menu for unit conversion in entered expressions. + + int on_input(double* newvalue); private: // noncopyable diff --git a/src/util/Makefile_insert b/src/util/Makefile_insert index deff951d4..4066ffd5d 100644 --- a/src/util/Makefile_insert +++ b/src/util/Makefile_insert @@ -9,6 +9,8 @@ ink_common_sources += \ util/ege-appear-time-tracker.h \ util/ege-tags.h \ util/ege-tags.cpp \ + util/expression-evaluator.h \ + util/expression-evaluator.cpp \ util/filter-list.h \ util/find-if-before.h \ util/find-last-if.h \ diff --git a/src/util/expression-evaluator.cpp b/src/util/expression-evaluator.cpp new file mode 100644 index 000000000..b43a61a6d --- /dev/null +++ b/src/util/expression-evaluator.cpp @@ -0,0 +1,571 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * Original file from libgimpwidgets: gimpeevl.c + * Copyright (C) 2008 Fredrik Alstromer + * Copyright (C) 2008 Martin Nordholts + * Modified for Inkscape by Johan Engelen + * Copyright (C) 2011 Johan Engelen + * + * This library is free software: you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +/** Introducing eevl eva, the evaluator. A straightforward recursive + * descent parser, no fuss, no new dependencies. The lexer is hand + * coded, tedious, not extremely fast but works. It evaluates the + * expression as it goes along, and does not create a parse tree or + * anything, and will not optimize anything. It uses doubles for + * precision, with the given use case, that's enough to combat any + * rounding errors (as opposed to optimizing the evalutation). + * + * It relies on external unit resolving through a callback and does + * elementary dimensionality constraint check (e.g. "2 mm + 3 px * 4 + * in" is an error, as L + L^2 is a missmatch). It uses g_strtod() for numeric + * conversions and it's non-destructive in terms of the paramters, and + * it's reentrant. + * + * EBNF: + * + * expression ::= term { ('+' | '-') term }* | + * ; + * + * term ::= signed factor { ( '*' | '/' ) signed factor }* ; + * + * signed factor ::= ( '+' | '-' )? factor ; + * + * unit factor ::= factor unit? ; + * + * factor ::= number | '(' expression ')' ; + * + * number ::= ? what g_strtod() consumes ? ; + * + * unit ::= ? what not g_strtod() consumes and not whitespace ? ; + * + * The code should match the EBNF rather closely (except for the + * non-terminal unit factor, which is inlined into factor) for + * maintainability reasons. + * + * It will allow 1++1 and 1+-1 (resulting in 2 and 0, respectively), + * but I figured one might want that, and I don't think it's going to + * throw anyone off. + */ + +#include "config.h" + +#include "util/expression-evaluator.h" +#include "util/units.h" + +#include + +#include + +namespace Inkscape { +namespace Util { + +enum +{ + GIMP_EEVL_TOKEN_NUM = 30000, + GIMP_EEVL_TOKEN_IDENTIFIER = 30001, + + GIMP_EEVL_TOKEN_ANY = 40000, + + GIMP_EEVL_TOKEN_END = 50000 +} GimpEevlTokenTypeEnum; + +typedef int GimpEevlTokenType; + + +typedef struct +{ + GimpEevlTokenType type; + + union + { + gdouble fl; + + struct + { + const gchar *c; + gint size; + }; + + } value; + +} GimpEevlToken; + +typedef struct +{ + const gchar *string; + GimpEevlUnitResolverProc unit_resolver_proc; + Unit *unit; + + GimpEevlToken current_token; + const gchar *start_of_current_token; +} GimpEevl; + +/** Unit Resolver... + */ +bool unitresolverproc (const gchar* identifier, GimpEevlQuantity *result, Unit* unit) +{ + static UnitTable unit_table; + + if (!unit) { + result->value = 1; + result->dimension = 1; + return true; + }else if (!identifier) { + result->value = 1; + result->dimension = unit->isAbsolute() ? 1 : 0; + return true; + } else if (unit_table.hasUnit(identifier)) { + Unit identifier_unit = unit_table.getUnit(identifier); + + // Catch the case of zero or negative unit factors (error!) + if (identifier_unit.factor < 0.0000001) { + return false; + } + + result->value = unit->factor / identifier_unit.factor; + result->dimension = identifier_unit.isAbsolute() ? 1 : 0; + return true; + } else { + return false; + } +} + +static void gimp_eevl_init (GimpEevl *eva, + const gchar *string, + GimpEevlUnitResolverProc unit_resolver_proc, + Unit *unit); +static GimpEevlQuantity gimp_eevl_complete (GimpEevl *eva); +static GimpEevlQuantity gimp_eevl_expression (GimpEevl *eva); +static GimpEevlQuantity gimp_eevl_term (GimpEevl *eva); +static GimpEevlQuantity gimp_eevl_signed_factor (GimpEevl *eva); +static GimpEevlQuantity gimp_eevl_factor (GimpEevl *eva); +static gboolean gimp_eevl_accept (GimpEevl *eva, + GimpEevlTokenType token_type, + GimpEevlToken *consumed_token); +static void gimp_eevl_lex (GimpEevl *eva); +static void gimp_eevl_lex_accept_count (GimpEevl *eva, + gint count, + GimpEevlTokenType token_type); +static void gimp_eevl_lex_accept_to (GimpEevl *eva, + gchar *to, + GimpEevlTokenType token_type); +static void gimp_eevl_move_past_whitespace (GimpEevl *eva); +static gboolean gimp_eevl_unit_identifier_start (gunichar c); +static gboolean gimp_eevl_unit_identifier_continue (gunichar c); +static gint gimp_eevl_unit_identifier_size (const gchar *s, + gint start); +static void gimp_eevl_expect (GimpEevl *eva, + GimpEevlTokenType token_type, + GimpEevlToken *value); +static void gimp_eevl_error (GimpEevl *eva, + const char *msg); + + +/** + * Evaluates the given arithmetic expression, along with an optional dimension + * analysis, and basic unit conversions. + * + * @param string The NULL-terminated string to be evaluated. + * @param unit_resolver_proc Unit resolver callback. + * + * All units conversions factors are relative to some implicit + * base-unit (which in GIMP is inches). This is also the unit of the + * returned value. + * + * Returns: A #GimpEevlQuantity with a value given in the base unit along with + * the order of the dimension (i.e. if the base unit is inches, a dimension + * order of two menas in^2). + * + * @return Result of evaluation. + * @throws Inkscape::Util::EvaluatorException There was a parse error. + **/ +GimpEevlQuantity +gimp_eevl_evaluate (const gchar* string, Unit* unit) +{ + if (! g_utf8_validate (string, -1, NULL)) { + throw EvaluatorException("Invalid UTF8 string", NULL); + } + + GimpEevl eva; + gimp_eevl_init (&eva, string, unitresolverproc, unit); + + return gimp_eevl_complete(&eva); +} + +static void +gimp_eevl_init (GimpEevl *eva, + const gchar *string, + GimpEevlUnitResolverProc unit_resolver_proc, + Unit *unit) +{ + eva->string = string; + eva->unit_resolver_proc = unit_resolver_proc; + eva->unit = unit; + + eva->current_token.type = GIMP_EEVL_TOKEN_END; + + /* Preload symbol... */ + gimp_eevl_lex (eva); +} + +static GimpEevlQuantity +gimp_eevl_complete (GimpEevl *eva) +{ + GimpEevlQuantity result = {0, 0}; + GimpEevlQuantity default_unit_factor; + + /* Empty expression evaluates to 0 */ + if (gimp_eevl_accept (eva, GIMP_EEVL_TOKEN_END, NULL)) + return result; + + result = gimp_eevl_expression (eva); + + /* There should be nothing left to parse by now */ + gimp_eevl_expect (eva, GIMP_EEVL_TOKEN_END, 0); + + eva->unit_resolver_proc (NULL, &default_unit_factor, eva->unit); + + /* Entire expression is dimensionless, apply default unit if + * applicable + */ + if (result.dimension == 0 && default_unit_factor.dimension != 0) + { + result.value /= default_unit_factor.value; + result.dimension = default_unit_factor.dimension; + } + return result; +} + +static GimpEevlQuantity +gimp_eevl_expression (GimpEevl *eva) +{ + gboolean subtract; + GimpEevlQuantity evaluated_terms; + + evaluated_terms = gimp_eevl_term (eva); + + /* continue evaluating terms, chained with + or -. */ + for (subtract = FALSE; + gimp_eevl_accept (eva, '+', NULL) || + (subtract = gimp_eevl_accept (eva, '-', NULL)); + subtract = FALSE) + { + GimpEevlQuantity new_term = gimp_eevl_term (eva); + + /* If dimensions missmatch, attempt default unit assignent */ + if (new_term.dimension != evaluated_terms.dimension) + { + GimpEevlQuantity default_unit_factor; + + eva->unit_resolver_proc (NULL, + &default_unit_factor, + eva->unit); + + if (new_term.dimension == 0 && + evaluated_terms.dimension == default_unit_factor.dimension) + { + new_term.value /= default_unit_factor.value; + new_term.dimension = default_unit_factor.dimension; + } + else if (evaluated_terms.dimension == 0 && + new_term.dimension == default_unit_factor.dimension) + { + evaluated_terms.value /= default_unit_factor.value; + evaluated_terms.dimension = default_unit_factor.dimension; + } + else + { + gimp_eevl_error (eva, "Dimension missmatch during addition"); + } + } + + evaluated_terms.value += (subtract ? -new_term.value : new_term.value); + } + + return evaluated_terms; +} + +static GimpEevlQuantity +gimp_eevl_term (GimpEevl *eva) +{ + gboolean division; + GimpEevlQuantity evaluated_signed_factors; + + evaluated_signed_factors = gimp_eevl_signed_factor (eva); + + for (division = FALSE; + gimp_eevl_accept (eva, '*', NULL) || + (division = gimp_eevl_accept (eva, '/', NULL)); + division = FALSE) + { + GimpEevlQuantity new_signed_factor = gimp_eevl_signed_factor (eva); + + if (division) + { + evaluated_signed_factors.value /= new_signed_factor.value; + evaluated_signed_factors.dimension -= new_signed_factor.dimension; + + } + else + { + evaluated_signed_factors.value *= new_signed_factor.value; + evaluated_signed_factors.dimension += new_signed_factor.dimension; + } + } + + return evaluated_signed_factors; +} + +static GimpEevlQuantity +gimp_eevl_signed_factor (GimpEevl *eva) +{ + GimpEevlQuantity result; + gboolean negate = FALSE; + + if (! gimp_eevl_accept (eva, '+', NULL)) + negate = gimp_eevl_accept (eva, '-', NULL); + + result = gimp_eevl_factor (eva); + + if (negate) result.value = -result.value; + + return result; +} + +static GimpEevlQuantity +gimp_eevl_factor (GimpEevl *eva) +{ + GimpEevlQuantity evaluated_factor = { 0, 0 }; + GimpEevlToken consumed_token; + + if (gimp_eevl_accept (eva, + GIMP_EEVL_TOKEN_NUM, + &consumed_token)) + { + evaluated_factor.value = consumed_token.value.fl; + } + else if (gimp_eevl_accept (eva, '(', NULL)) + { + evaluated_factor = gimp_eevl_expression (eva); + gimp_eevl_expect (eva, ')', 0); + } + else + { + gimp_eevl_error (eva, "Expected number or '('"); + } + + if (eva->current_token.type == GIMP_EEVL_TOKEN_IDENTIFIER) + { + gchar *identifier; + GimpEevlQuantity result; + + gimp_eevl_accept (eva, + GIMP_EEVL_TOKEN_ANY, + &consumed_token); + + identifier = g_newa (gchar, consumed_token.value.size + 1); + + strncpy (identifier, consumed_token.value.c, consumed_token.value.size); + identifier[consumed_token.value.size] = '\0'; + + if (eva->unit_resolver_proc (identifier, + &result, + eva->unit)) + { + evaluated_factor.value /= result.value; + evaluated_factor.dimension += result.dimension; + } + else + { + gimp_eevl_error (eva, "Unit was not resolved"); + } + } + + return evaluated_factor; +} + +static gboolean +gimp_eevl_accept (GimpEevl *eva, + GimpEevlTokenType token_type, + GimpEevlToken *consumed_token) +{ + gboolean existed = FALSE; + + if (token_type == eva->current_token.type || + token_type == GIMP_EEVL_TOKEN_ANY) + { + existed = TRUE; + + if (consumed_token) + *consumed_token = eva->current_token; + + /* Parse next token */ + gimp_eevl_lex (eva); + } + + return existed; +} + +static void +gimp_eevl_lex (GimpEevl *eva) +{ + const gchar *s; + + gimp_eevl_move_past_whitespace (eva); + s = eva->string; + eva->start_of_current_token = s; + + if (! s || s[0] == '\0') + { + /* We're all done */ + eva->current_token.type = GIMP_EEVL_TOKEN_END; + } + else if (s[0] == '+' || s[0] == '-') + { + /* Snatch these before the g_strtod() does, othewise they might + * be used in a numeric conversion. + */ + gimp_eevl_lex_accept_count (eva, 1, s[0]); + } + else + + { + /* Attempt to parse a numeric value */ + gchar *endptr = NULL; + gdouble value = g_strtod (s, &endptr); + + if (endptr && endptr != s) + { + /* A numeric could be parsed, use it */ + eva->current_token.value.fl = value; + + gimp_eevl_lex_accept_to (eva, endptr, GIMP_EEVL_TOKEN_NUM); + } + else if (gimp_eevl_unit_identifier_start (s[0])) + { + /* Unit identifier */ + eva->current_token.value.c = s; + eva->current_token.value.size = gimp_eevl_unit_identifier_size (s, 0); + + gimp_eevl_lex_accept_count (eva, + eva->current_token.value.size, + GIMP_EEVL_TOKEN_IDENTIFIER); + } + else + { + /* Everything else is a single character token */ + gimp_eevl_lex_accept_count (eva, 1, s[0]); + } + } +} + +static void +gimp_eevl_lex_accept_count (GimpEevl *eva, + gint count, + GimpEevlTokenType token_type) +{ + eva->current_token.type = token_type; + eva->string += count; +} + +static void +gimp_eevl_lex_accept_to (GimpEevl *eva, + gchar *to, + GimpEevlTokenType token_type) +{ + eva->current_token.type = token_type; + eva->string = to; +} + +static void +gimp_eevl_move_past_whitespace (GimpEevl *eva) +{ + if (! eva->string) + return; + + while (g_ascii_isspace (*eva->string)) + eva->string++; +} + +static gboolean +gimp_eevl_unit_identifier_start (gunichar c) +{ + return (g_unichar_isalpha (c) || + c == (gunichar) '%' || + c == (gunichar) '\''); +} + +static gboolean +gimp_eevl_unit_identifier_continue (gunichar c) +{ + return (gimp_eevl_unit_identifier_start (c) || + g_unichar_isdigit (c)); +} + +/** + * gimp_eevl_unit_identifier_size: + * @s: + * @start: + * + * Returns: Size of identifier in bytes (not including NULL + * terminator). + **/ +static gint +gimp_eevl_unit_identifier_size (const gchar *string, + gint start_offset) +{ + const gchar *start = g_utf8_offset_to_pointer (string, start_offset); + const gchar *s = start; + gunichar c = g_utf8_get_char (s); + gint length = 0; + + if (gimp_eevl_unit_identifier_start (c)) + { + s = g_utf8_next_char (s); + c = g_utf8_get_char (s); + length++; + + while (gimp_eevl_unit_identifier_continue (c)) + { + s = g_utf8_next_char (s); + c = g_utf8_get_char (s); + length++; + } + } + + return g_utf8_offset_to_pointer (start, length) - start; +} + +static void +gimp_eevl_expect (GimpEevl *eva, + GimpEevlTokenType token_type, + GimpEevlToken *value) +{ + if (! gimp_eevl_accept (eva, token_type, value)) + gimp_eevl_error (eva, "Unexpected token"); +} + +static void +gimp_eevl_error (GimpEevl *eva, + const char *msg) +{ + throw EvaluatorException(msg, eva->start_of_current_token); +} + +} // namespace Util +} // namespace Inkscape diff --git a/src/util/expression-evaluator.h b/src/util/expression-evaluator.h new file mode 100644 index 000000000..90789a25f --- /dev/null +++ b/src/util/expression-evaluator.h @@ -0,0 +1,80 @@ +/* LIBGIMP - The GIMP Library + * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball + * + * Original file from libgimpwidgets: gimpeevl.h + * Copyright (C) 2008-2009 Fredrik Alstromer + * Copyright (C) 2008-2009 Martin Nordholts + * Modified for Inkscape by Johan Engelen + * Copyright (C) 2011 Johan Engelen + * + * This library is free software: you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#ifndef __GIMP_EEVL_H__ +#define __GIMP_EEVL_H__ + +#include "util/units.h" + +#include +#include +#include + +namespace Inkscape { +namespace Util { + +class Unit; + +/** +* GimpEevlQuantity: +* @value: In reference units. +* @dimension: in has a dimension of 1, in^2 has a dimension of 2 etc +*/ +typedef struct +{ + double value; + gint dimension; +} GimpEevlQuantity; + +typedef bool (* GimpEevlUnitResolverProc) (const gchar *identifier, + GimpEevlQuantity *result, + Unit* unit); + +GimpEevlQuantity gimp_eevl_evaluate (const gchar* string, Unit* unit = NULL); + +/** + * Special exception class for the expression evaluator. + */ +class EvaluatorException : public std::exception { +public: + EvaluatorException(const char * message, const char *at_position) { + std::ostringstream os; + const char* token = at_position ? at_position : ""; + os << "Expression evaluator error: " << message << " at '" << token << "'"; + msgstr = os.str(); + } + + virtual ~EvaluatorException() throw() {} // necessary to destroy the string object!!! + + virtual const char* what() const throw () { + return msgstr.c_str(); + } +protected: + std::string msgstr; +}; + +} +} + +#endif /* __GIMP_EEVL_H__ */ -- cgit v1.2.3 From de76d854317e700b1f0297c83f6a1cacc2ffa533 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 14 Apr 2011 08:29:21 +0200 Subject: Tracing. Potrace 1.9 update (see http://potrace.sourceforge.net/ChangeLog). (bzr r10163) --- src/trace/potrace/auxiliary.h | 29 ++++++++++++- src/trace/potrace/bitmap.h | 6 +-- src/trace/potrace/curve.cpp | 4 +- src/trace/potrace/curve.h | 2 +- src/trace/potrace/decompose.cpp | 50 +++++++--------------- src/trace/potrace/decompose.h | 5 ++- src/trace/potrace/greymap.cpp | 52 +++++++++++++---------- src/trace/potrace/greymap.h | 10 ++--- src/trace/potrace/lists.h | 4 +- src/trace/potrace/potracelib.cpp | 9 ++-- src/trace/potrace/potracelib.h | 12 +++++- src/trace/potrace/progress.h | 8 ++-- src/trace/potrace/render.cpp | 4 +- src/trace/potrace/render.h | 4 +- src/trace/potrace/trace.cpp | 90 +++++++++++++++++++++++----------------- src/trace/potrace/trace.h | 5 ++- 16 files changed, 166 insertions(+), 128 deletions(-) (limited to 'src') diff --git a/src/trace/potrace/auxiliary.h b/src/trace/potrace/auxiliary.h index 7baab851c..1c2765816 100644 --- a/src/trace/potrace/auxiliary.h +++ b/src/trace/potrace/auxiliary.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ @@ -75,4 +75,31 @@ static inline int floordiv(int a, int n) { #define sq(a) ((a)*(a)) #define cu(a) ((a)*(a)*(a)) +/* ---------------------------------------------------------------------- */ +/* deterministically and efficiently hash (x,y) into a pseudo-random bit */ +static inline int detrand(int x, int y) { + unsigned int z; + static const unsigned char t[256] = { + /* non-linear sequence: constant term of inverse in GF(8), + mod x^8+x^4+x^3+x+1 */ + 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, + 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, + 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, + 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, + 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, + 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + }; + + /* 0x04b3e375 and 0x05a8ef93 are chosen to contain every possible + 5-bit sequence */ + z = ((0x04b3e375 * x) ^ y) * 0x05a8ef93; + z = t[z & 0xff] ^ t[(z>>8) & 0xff] ^ t[(z>>16) & 0xff] ^ t[(z>>24) & 0xff]; + return z; +} + #endif /* AUXILIARY_H */ diff --git a/src/trace/potrace/bitmap.h b/src/trace/potrace/bitmap.h index 2a172b1ad..671382dc2 100644 --- a/src/trace/potrace/bitmap.h +++ b/src/trace/potrace/bitmap.h @@ -1,14 +1,10 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ #ifndef BITMAP_H #define BITMAP_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/src/trace/potrace/curve.cpp b/src/trace/potrace/curve.cpp index c9a6fbe04..00d7bd2db 100644 --- a/src/trace/potrace/curve.cpp +++ b/src/trace/potrace/curve.cpp @@ -1,8 +1,8 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: curve.c 227 2010-12-16 05:47:19Z selinger $ */ /* private part of the path and curve data structures */ #include diff --git a/src/trace/potrace/curve.h b/src/trace/potrace/curve.h index 45c0790be..bfde0af1a 100644 --- a/src/trace/potrace/curve.h +++ b/src/trace/potrace/curve.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ diff --git a/src/trace/potrace/decompose.cpp b/src/trace/potrace/decompose.cpp index 15c39825e..8219234c4 100644 --- a/src/trace/potrace/decompose.cpp +++ b/src/trace/potrace/decompose.cpp @@ -1,8 +1,8 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: decompose.c 227 2010-12-16 05:47:19Z selinger $ */ #include #include @@ -55,32 +55,6 @@ static void clear_bm_with_bbox(potrace_bitmap_t *bm, bbox_t *bbox) { /* ---------------------------------------------------------------------- */ /* auxiliary functions */ -/* deterministically and efficiently hash (x,y) into a pseudo-random bit */ -static inline int detrand(int x, int y) { - unsigned int z; - static const unsigned char t[256] = { - /* non-linear sequence: constant term of inverse in GF(8), - mod x^8+x^4+x^3+x+1 */ - 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, - 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, - 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, - 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, - 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, - 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, - 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - }; - - /* 0x04b3e375 and 0x05a8ef93 are chosen to contain every possible - 5-bit sequence */ - z = ((0x04b3e375 * x) ^ y) * 0x05a8ef93; - z = t[z & 0xff] ^ t[(z>>8) & 0xff] ^ t[(z>>16) & 0xff] ^ t[(z>>24) & 0xff]; - return z & 1; -} - /* return the "majority" value of bitmap bm at intersection (x,y). We assume that the bitmap is balanced at "radius" 1. */ static int majority(potrace_bitmap_t *bm, int x, int y) { @@ -304,7 +278,8 @@ static void pathlist_to_tree(path_t *plist, potrace_bitmap_t *bm) { path_t *heap, *heap1; path_t *cur; path_t *head; - path_t **hook, **hook_in, **hook_out; /* for fast appending to linked list */ + path_t **plist_hook; /* for fast appending to linked list */ + path_t **hook_in, **hook_out; /* for fast appending to linked list */ bbox_t bbox; bm_clear(bm, 0); @@ -391,18 +366,18 @@ static void pathlist_to_tree(path_t *plist, potrace_bitmap_t *bm) { heap->next = NULL; /* heap is a linked list of childlists */ } plist = NULL; - hook = &plist; + plist_hook = &plist; while (heap) { heap1 = heap->next; for (p=heap; p; p=p->sibling) { /* p is a positive path */ /* append to linked list */ - list_insert_beforehook(p, hook); + list_insert_beforehook(p, plist_hook); /* go through its children */ for (p1=p->childlist; p1; p1=p1->sibling) { /* append to linked list */ - list_insert_beforehook(p1, hook); + list_insert_beforehook(p1, plist_hook); /* append its childlist to heap, if non-empty */ if (p1->childlist) { list_append(path_t, heap1, p1->childlist); @@ -423,9 +398,12 @@ static void pathlist_to_tree(path_t *plist, potrace_bitmap_t *bm) { static int findnext(potrace_bitmap_t *bm, int *xp, int *yp) { int x; int y; + int x0; + + x0 = (*xp) & ~(BM_WORDBITS-1); for (y=*yp; y>=0; y--) { - for (x=0; xw; x+=BM_WORDBITS) { + for (x=x0; xw; x+=BM_WORDBITS) { if (*bm_index(bm, x, y)) { while (!BM_GET(bm, x, y)) { x++; @@ -436,6 +414,7 @@ static int findnext(potrace_bitmap_t *bm, int *xp, int *yp) { return 0; } } + x0 = 0; } /* not found */ return 1; @@ -451,7 +430,7 @@ int bm_to_pathlist(const potrace_bitmap_t *bm, path_t **plistp, const potrace_pa int y; path_t *p; path_t *plist = NULL; /* linked list of path objects */ - path_t **hook = &plist; /* used to speed up appending to linked list */ + path_t **plist_hook = &plist; /* used to speed up appending to linked list */ potrace_bitmap_t *bm1 = NULL; int sign; @@ -465,6 +444,7 @@ int bm_to_pathlist(const potrace_bitmap_t *bm, path_t **plistp, const potrace_pa bm_clearexcess(bm1); /* iterate through components */ + x = 0; y = bm1->h - 1; while (findnext(bm1, &x, &y) == 0) { /* calculate the sign by looking at the original */ @@ -483,7 +463,7 @@ int bm_to_pathlist(const potrace_bitmap_t *bm, path_t **plistp, const potrace_pa if (p->area <= param->turdsize) { path_free(p); } else { - list_insert_beforehook(p, hook); + list_insert_beforehook(p, plist_hook); } if (bm1->h > 0) { /* to be sure */ diff --git a/src/trace/potrace/decompose.h b/src/trace/potrace/decompose.h index 5552fa0a1..409439c62 100644 --- a/src/trace/potrace/decompose.h +++ b/src/trace/potrace/decompose.h @@ -1,14 +1,15 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: decompose.h 227 2010-12-16 05:47:19Z selinger $ */ #ifndef DECOMPOSE_H #define DECOMPOSE_H #include "potracelib.h" #include "progress.h" +#include "curve.h" int bm_to_pathlist(const potrace_bitmap_t *bm, path_t **plistp, const potrace_param_t *param, progress_t *progress); diff --git a/src/trace/potrace/greymap.cpp b/src/trace/potrace/greymap.cpp index 646ecc3a5..770dd72e6 100644 --- a/src/trace/potrace/greymap.cpp +++ b/src/trace/potrace/greymap.cpp @@ -1,14 +1,13 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: greymap.c 227 2010-12-16 05:47:19Z selinger $ */ /* Routines for manipulating greymaps, including reading pgm files. We only deal with greymaps of depth 8 bits. */ #include -#include #include #include @@ -28,7 +27,6 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp); greymap_t *gm_new(int w, int h) { greymap_t *gm; - int errno_save; gm = (greymap_t *) malloc(sizeof(greymap_t)); if (!gm) { @@ -38,9 +36,7 @@ greymap_t *gm_new(int w, int h) { gm->h = h; gm->map = (signed short int *) malloc(w*h*sizeof(signed short int)); if (!gm->map) { - errno_save = errno; free(gm); - errno = errno_save; return NULL; } return gm; @@ -60,7 +56,7 @@ greymap_t *gm_dup(greymap_t *gm) { if (!gm1) { return NULL; } - memcpy(gm1->map, gm->map, gm->w*gm->h*2); + memcpy(gm1->map, gm->map, gm->w*gm->h*sizeof(signed short int)); return gm1; } @@ -69,7 +65,7 @@ void gm_clear(greymap_t *gm, int b) { int i; if (b==0) { - memset(gm->map, 0, gm->w*gm->h*2); + memset(gm->map, 0, gm->w*gm->h*sizeof(signed short int)); } else { for (i=0; iw*gm->h; i++) { gm->map[i] = b; @@ -161,16 +157,16 @@ static int readbit(FILE *f) { /* ---------------------------------------------------------------------- */ -char const *gm_read_error = NULL; - -/** Read a PNM stream: P1-P6 format (see pnm(5)), or a BMP stream, and +/* read a PNM stream: P1-P6 format (see pnm(5)), or a BMP stream, and convert the output to a greymap. Return greymap in *gmp. Return 0 on success, -1 on error with errno set, -2 on bad file format (with error message in gm_read_error), and 1 on premature end of file, -3 on empty file (including files with only whitespace and comments), -4 if wrong magic number. If the return value is >=0, *gmp is - valid. - */ + valid. */ + +char const *gm_read_error = NULL; + int gm_read(FILE *f, greymap_t **gmp) { int magic[2]; @@ -413,6 +409,7 @@ struct bmp_info_s { unsigned int ncolors; /* number of colors in palette */ unsigned int ColorsImportant; unsigned int ctbits; /* sample size for color table */ + int topdown; /* top-down mode? */ }; typedef struct bmp_info_s bmp_info_t; @@ -481,6 +478,9 @@ static int bmp_forward(FILE *f, int pos) { #define TRY(x) if (x) goto try_error #define TRY_EOF(x) if (x) goto eof +/* correct y-coordinate for top-down format */ +#define ycorr(y) (bmpinfo.topdown ? bmpinfo.h-1-y : y) + /* read BMP stream after magic number. Return values as for gm_read. We choose to be as permissive as possible, since there are many programs out there which produce BMP. For instance, ppmtobmp can @@ -512,7 +512,8 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { /* info header */ TRY(bmp_readint(f, 4, &bmpinfo.InfoSize)); - if (bmpinfo.InfoSize == 40 || bmpinfo.InfoSize == 64) { + if (bmpinfo.InfoSize == 40 || bmpinfo.InfoSize == 64 + || bmpinfo.InfoSize == 108 || bmpinfo.InfoSize == 124) { /* Windows or new OS/2 format */ bmpinfo.ctbits = 32; /* sample size in color table */ TRY(bmp_readint(f, 4, &bmpinfo.w)); @@ -525,6 +526,12 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { TRY(bmp_readint(f, 4, &bmpinfo.YpixelsPerM)); TRY(bmp_readint(f, 4, &bmpinfo.ncolors)); TRY(bmp_readint(f, 4, &bmpinfo.ColorsImportant)); + if ((signed int)bmpinfo.h < 0) { + bmpinfo.h = -bmpinfo.h; + bmpinfo.topdown = 1; + } else { + bmpinfo.topdown = 0; + } } else if (bmpinfo.InfoSize == 12) { /* old OS/2 format */ bmpinfo.ctbits = 24; /* sample size in color table */ @@ -534,11 +541,12 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { TRY(bmp_readint(f, 2, &bmpinfo.bits)); bmpinfo.comp = 0; bmpinfo.ncolors = 0; + bmpinfo.topdown = 0; } else { goto format_error; } - /* forward to color table (i.e., if bmpinfo.InfoSize == 64) */ + /* forward to color table (e.g., if bmpinfo.InfoSize == 64) */ TRY(bmp_forward(f, 14+bmpinfo.InfoSize)); if (bmpinfo.Planes != 1) { @@ -593,7 +601,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { for (i=0; 8*i> j) ? coltable[1] : coltable[0]); + GM_PUT(gm, i*8+j, ycorr(y), b & (0x80 >> j) ? coltable[1] : coltable[0]); } } TRY(bmp_pad(f)); @@ -620,7 +628,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { b = bitbuf >> (INTBITS - bmpinfo.bits); bitbuf <<= bmpinfo.bits; n -= bmpinfo.bits; - GM_UPUT(gm, x, y, coltable[b]); + GM_UPUT(gm, x, ycorr(y), coltable[b]); } TRY(bmp_pad(f)); } @@ -640,7 +648,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { for (x=0; x>16) & 0xff) + ((c>>8) & 0xff) + (c & 0xff); - GM_UPUT(gm, x, y, c/3); + GM_UPUT(gm, x, ycorr(y), c/3); } TRY(bmp_pad(f)); } @@ -664,7 +672,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { if (y>=bmpinfo.h) { break; } - GM_UPUT(gm, x, y, col[i&1]); + GM_UPUT(gm, x, ycorr(y), col[i&1]); x++; } } else if (c == 0) { @@ -693,7 +701,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { if (y>=bmpinfo.h) { break; } - GM_PUT(gm, x, y, coltable[(b>>(4-4*(i&1))) & 0xf]); + GM_PUT(gm, x, ycorr(y), coltable[(b>>(4-4*(i&1))) & 0xf]); x++; } if ((c+1) & 2) { @@ -720,7 +728,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { if (y>=bmpinfo.h) { break; } - GM_UPUT(gm, x, y, coltable[c]); + GM_UPUT(gm, x, ycorr(y), coltable[c]); x++; } } else if (c == 0) { @@ -747,7 +755,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { if (y>=bmpinfo.h) { break; } - GM_PUT(gm, x, y, coltable[b]); + GM_PUT(gm, x, ycorr(y), coltable[b]); x++; } if (c & 1) { diff --git a/src/trace/potrace/greymap.h b/src/trace/potrace/greymap.h index 059fec4e4..0736232a7 100644 --- a/src/trace/potrace/greymap.h +++ b/src/trace/potrace/greymap.h @@ -1,11 +1,11 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: greymap.h 227 2010-12-16 05:47:19Z selinger $ */ -#ifndef PGM_H -#define PGM_H +#ifndef GREYMAP_H +#define GREYMAP_H #include @@ -55,4 +55,4 @@ int gm_read(FILE *f, greymap_t **gmp); int gm_writepgm(FILE *f, greymap_t *gm, char *comment, int raw, int mode, double gamma); int gm_print(FILE *f, greymap_t *gm); -#endif /* PGM_H */ +#endif /* GREYMAP_H */ diff --git a/src/trace/potrace/lists.h b/src/trace/potrace/lists.h index fc853398a..4f78bf20f 100644 --- a/src/trace/potrace/lists.h +++ b/src/trace/potrace/lists.h @@ -1,8 +1,8 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: lists.h 227 2010-12-16 05:47:19Z selinger $ */ #ifndef _PS_LISTS_H #define _PS_LISTS_H diff --git a/src/trace/potrace/potracelib.cpp b/src/trace/potrace/potracelib.cpp index 17e04cabb..3dbf3230b 100644 --- a/src/trace/potrace/potracelib.cpp +++ b/src/trace/potrace/potracelib.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ @@ -48,15 +48,16 @@ potrace_param_t *potrace_param_default(void) { /* On success, returns a Potrace state st with st->status == POTRACE_STATUS_OK. On failure, returns NULL if no Potrace state could be created (with errno set), or returns an incomplete Potrace - state (with st->status == POTRACE_STATUS_INCOMPLETE). Complete or - incomplete Potrace state can be freed with potrace_state_free(). */ + state (with st->status == POTRACE_STATUS_INCOMPLETE, and with errno + set). Complete or incomplete Potrace state can be freed with + potrace_state_free(). */ potrace_state_t *potrace_trace(const potrace_param_t *param, const potrace_bitmap_t *bm) { int r; path_t *plist = NULL; potrace_state_t *st; progress_t prog; progress_t subprog; - + /* prepare private progress bar state */ prog.callback = param->progress.callback; prog.data = param->progress.data; diff --git a/src/trace/potrace/potracelib.h b/src/trace/potrace/potracelib.h index 0b93d65de..d15b05e5c 100644 --- a/src/trace/potrace/potracelib.h +++ b/src/trace/potrace/potracelib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ @@ -6,7 +6,11 @@ #define POTRACELIB_H /* this file defines the API for the core Potrace library. For a more - detailed description of the API, see doc/potracelib.txt */ + detailed description of the API, see potracelib.pdf */ + +#ifdef __cplusplus +extern "C" { +#endif /* ---------------------------------------------------------------------- */ /* tracing parameters */ @@ -128,4 +132,8 @@ void potrace_state_free(potrace_state_t *st); of potracelib */ char *potrace_version(void); +#ifdef __cplusplus +} /* end of extern "C" */ +#endif + #endif /* POTRACELIB_H */ diff --git a/src/trace/potrace/progress.h b/src/trace/potrace/progress.h index 0e077430d..220639c6e 100644 --- a/src/trace/potrace/progress.h +++ b/src/trace/potrace/progress.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ @@ -28,7 +28,7 @@ typedef struct progress_s progress_t; static inline void progress_update(double d, progress_t *prog) { double d_scaled; - if (prog->callback != NULL) { + if (prog != NULL && prog->callback != NULL) { d_scaled = prog->min * (1-d) + prog->max * d; if (d == 1.0 || d_scaled >= prog->d_prev + prog->epsilon) { prog->callback(prog->min * (1-d) + prog->max * d, prog->data); @@ -43,7 +43,7 @@ static inline void progress_update(double d, progress_t *prog) { static inline void progress_subrange_start(double a, double b, const progress_t *prog, progress_t *sub) { double min, max; - if (prog->callback == NULL) { + if (prog == NULL || prog->callback == NULL) { sub->callback = NULL; return; } @@ -66,7 +66,7 @@ static inline void progress_subrange_start(double a, double b, const progress_t } static inline void progress_subrange_end(progress_t *prog, progress_t *sub) { - if (prog->callback != NULL) { + if (prog != NULL && prog->callback != NULL) { if (sub->callback == NULL) { progress_update(sub->b, prog); } else { diff --git a/src/trace/potrace/render.cpp b/src/trace/potrace/render.cpp index f9183b931..39bec0684 100644 --- a/src/trace/potrace/render.cpp +++ b/src/trace/potrace/render.cpp @@ -1,8 +1,8 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: render.c 227 2010-12-16 05:47:19Z selinger $ */ #include #include diff --git a/src/trace/potrace/render.h b/src/trace/potrace/render.h index 9c9d921d2..6cfbe0964 100644 --- a/src/trace/potrace/render.h +++ b/src/trace/potrace/render.h @@ -1,8 +1,8 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: render.h 227 2010-12-16 05:47:19Z selinger $ */ #ifndef RENDER_H #define RENDER_H diff --git a/src/trace/potrace/trace.cpp b/src/trace/potrace/trace.cpp index 909ffb712..8fe1a1bc4 100644 --- a/src/trace/potrace/trace.cpp +++ b/src/trace/potrace/trace.cpp @@ -1,8 +1,8 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: trace.c 227 2010-12-16 05:47:19Z selinger $ */ /* transform jaggy paths into smooth curves */ #include @@ -483,28 +483,38 @@ static double penalty3(privpath_t *pp, int i, int j) { double a, b, c, s; double px, py, ex, ey; - int r=0; /* rotations from i to j */ + int r = 0; /* rotations from i to j */ if (j>=n) { - j-=n; - r+=1; + j -= n; + r = 1; } - x = sums[j+1].x-sums[i].x+r*sums[n].x; - y = sums[j+1].y-sums[i].y+r*sums[n].y; - x2 = sums[j+1].x2-sums[i].x2+r*sums[n].x2; - xy = sums[j+1].xy-sums[i].xy+r*sums[n].xy; - y2 = sums[j+1].y2-sums[i].y2+r*sums[n].y2; - k = j+1-i+r*n; - - px = (pt[i].x+pt[j].x)/2.0-pt[0].x; - py = (pt[i].y+pt[j].y)/2.0-pt[0].y; - ey = (pt[j].x-pt[i].x); - ex = -(pt[j].y-pt[i].y); - - a = ((x2-2*x*px)/k+px*px); - b = ((xy-x*py-y*px)/k+px*py); - c = ((y2-2*y*py)/k+py*py); + /* critical inner loop: the "if" gives a 4.6 percent speedup */ + if (r == 0) { + x = sums[j+1].x - sums[i].x; + y = sums[j+1].y - sums[i].y; + x2 = sums[j+1].x2 - sums[i].x2; + xy = sums[j+1].xy - sums[i].xy; + y2 = sums[j+1].y2 - sums[i].y2; + k = j+1 - i; + } else { + x = sums[j+1].x - sums[i].x + sums[n].x; + y = sums[j+1].y - sums[i].y + sums[n].y; + x2 = sums[j+1].x2 - sums[i].x2 + sums[n].x2; + xy = sums[j+1].xy - sums[i].xy + sums[n].xy; + y2 = sums[j+1].y2 - sums[i].y2 + sums[n].y2; + k = j+1 - i + n; + } + + px = (pt[i].x + pt[j].x) / 2.0 - pt[0].x; + py = (pt[i].y + pt[j].y) / 2.0 - pt[0].y; + ey = (pt[j].x - pt[i].x); + ex = -(pt[j].y - pt[i].y); + + a = ((x2 - 2*x*px) / k + px*px); + b = ((xy - x*py - y*px) / k + px*py); + c = ((y2 - 2*y*py) / k + py*py); s = ex*ex*a + 2*ex*ey*b + ey*ey*c; @@ -513,7 +523,7 @@ static double penalty3(privpath_t *pp, int i, int j) { /* find the optimal polygon. Fill in the m and po components. Return 1 on failure with errno set, else 0. Non-cyclic version: assumes i=0 - is in the polygon. Fixme: ### implement cyclic version. */ + is in the polygon. Fixme: implement cyclic version. */ static int bestpolygon(privpath_t *pp) { int i, j, m, k; @@ -576,7 +586,7 @@ static int bestpolygon(privpath_t *pp) seg1[0] = 0; /* now find the shortest path with m segments, based on penalty3 */ - /* note: the outer 2 loops jointly have at most n interations, thus + /* note: the outer 2 loops jointly have at most n iterations, thus the worst-case behavior here is quadratic. In practice, it is close to linear since the inner loop tends to be short. */ pen[0]=0; @@ -828,24 +838,27 @@ static int adjust_vertices(privpath_t *pp) { /* ---------------------------------------------------------------------- */ /* Stage 4: smoothing and corner analysis (Sec. 2.3.3) */ -/* Always succeeds and returns 0 */ -static int smooth(privcurve_t *curve, int sign, double alphamax) { +/* reverse orientation of a path */ +static void reverse(privcurve_t *curve) { + int m = curve->n; + int i, j; + dpoint_t tmp; + + for (i=0, j=m-1; ivertex[i]; + curve->vertex[i] = curve->vertex[j]; + curve->vertex[j] = tmp; + } +} + +/* Always succeeds */ +static void smooth(privcurve_t *curve, double alphamax) { int m = curve->n; int i, j, k; double dd, denom, alpha; dpoint_t p2, p3, p4; - if (sign == '-') { - /* reverse orientation of negative paths */ - for (i=0, j=m-1; ivertex[i]; - curve->vertex[i] = curve->vertex[j]; - curve->vertex[j] = tmp; - } - } - /* examine each vertex and find its best fit */ for (i=0; ialphacurve = 1; - return 0; + return; } /* ---------------------------------------------------------------------- */ @@ -1098,7 +1111,7 @@ static int opticurve(privpath_t *pp, double opttolerance) { len[0] = 0; /* Fixme: we always start from a fixed point -- should find the best - curve cyclically ### */ + curve cyclically */ for (j=1; j<=m; j++) { /* calculate best path from 0 to j */ @@ -1206,7 +1219,10 @@ int process_path(path_t *plist, const potrace_param_t *param, progress_t *progre TRY(calc_lon(p->priv)); TRY(bestpolygon(p->priv)); TRY(adjust_vertices(p->priv)); - TRY(smooth(&p->priv->curve, p->sign, param->alphamax)); + if (p->sign == '-') { /* reverse orientation of negative paths */ + reverse(&p->priv->curve); + } + smooth(&p->priv->curve, param->alphamax); if (param->opticurve) { TRY(opticurve(p->priv, param->opttolerance)); p->priv->fcurve = &p->priv->ocurve; diff --git a/src/trace/potrace/trace.h b/src/trace/potrace/trace.h index b33f8ba4d..72d1a3696 100644 --- a/src/trace/potrace/trace.h +++ b/src/trace/potrace/trace.h @@ -1,14 +1,15 @@ -/* Copyright (C) 2001-2007 Peter Selinger. +/* Copyright (C) 2001-2010 Peter Selinger. This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -/* $Id$ */ +/* $Id: trace.h 227 2010-12-16 05:47:19Z selinger $ */ #ifndef TRACE_H #define TRACE_H #include "potracelib.h" #include "progress.h" +#include "curve.h" int process_path(path_t *plist, const potrace_param_t *param, progress_t *progress); -- cgit v1.2.3 From fb49f01264d072beec29a8f40b0e52d9c04f47ce Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 14 Apr 2011 22:51:50 +0200 Subject: small tweaks (bzr r10164) --- src/util/expression-evaluator.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/util/expression-evaluator.cpp b/src/util/expression-evaluator.cpp index b43a61a6d..87937be9a 100644 --- a/src/util/expression-evaluator.cpp +++ b/src/util/expression-evaluator.cpp @@ -69,8 +69,6 @@ #include -#include - namespace Inkscape { namespace Util { @@ -82,7 +80,7 @@ enum GIMP_EEVL_TOKEN_ANY = 40000, GIMP_EEVL_TOKEN_END = 50000 -} GimpEevlTokenTypeEnum; +}; typedef int GimpEevlTokenType; -- cgit v1.2.3 From 91d5bb754933ec128238a3a570d59e4d74c5c349 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 15 Apr 2011 01:02:53 +0200 Subject: ScalarUnit: add functionality to grab focus and select the entry text. and add setValueKeepUnit (bzr r10165) --- src/ui/widget/scalar-unit.cpp | 22 ++++++++++++++++++++++ src/ui/widget/scalar-unit.h | 3 +++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index e00e82198..533f0a200 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -118,6 +118,19 @@ ScalarUnit::setValue(double number, Glib::ustring const &units) { Scalar::setValue(number); } +/** Convert and sets the number only and keeps the current unit. */ +void +ScalarUnit::setValueKeepUnit(double number, Glib::ustring const &units) { + g_assert(_unit_menu != NULL); + if (units == "") { + // set the value in the default units + Scalar::setValue(number); + } else { + double conversion = _unit_menu->getConversion(units); + Scalar::setValue(number / conversion); + } +} + /** Sets the number only */ void ScalarUnit::setValue(double number) { @@ -137,6 +150,15 @@ ScalarUnit::getValue(Glib::ustring const &unit_name) const { } } +/** Grab focus, and select the text that is in the entry field. + */ +void +ScalarUnit::grabFocusAndSelectEntry() { + _widget->grab_focus(); + static_cast(_widget)->select_region(0, 20); +} + + void ScalarUnit::setHundredPercent(double number) { diff --git a/src/ui/widget/scalar-unit.h b/src/ui/widget/scalar-unit.h index d8b2edbd5..8f6c8e210 100644 --- a/src/ui/widget/scalar-unit.h +++ b/src/ui/widget/scalar-unit.h @@ -41,8 +41,11 @@ public: bool setUnit(Glib::ustring const &units); void setValue(double number, Glib::ustring const &units); + void setValueKeepUnit(double number, Glib::ustring const &units); void setValue(double number); + void grabFocusAndSelectEntry(); + void setHundredPercent(double number); void setAbsoluteIsIncrement(bool value); void setPercentageIsIncrement(bool value); -- cgit v1.2.3 From 384adc13f591fc200e9be292ced829ef8734cba0 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 15 Apr 2011 01:03:50 +0200 Subject: convert guideline dialog to ui/widget/... newer widgets. add unit to guideline angle. save angle unit status when closing dialog (bzr r10166) --- src/ui/dialog/guides.cpp | 119 +++++++++++++++++++++-------------------------- src/ui/dialog/guides.h | 26 ++++++----- 2 files changed, 68 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index fd64a713f..60038cab0 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -15,9 +15,9 @@ #ifdef HAVE_CONFIG_H # include #endif +#include "guides.h" + #include "display/guideline.h" -#include "helper/unit-menu.h" -#include "helper/units.h" #include "desktop.h" #include "document.h" #include "sp-guide.h" @@ -25,14 +25,13 @@ #include "desktop-handles.h" #include "event-context.h" #include "widgets/desktop-widget.h" -#include "sp-metrics.h" #include #include "dialogs/dialog-events.h" #include "message-context.h" #include "xml/repr.h" + #include <2geom/point.h> #include <2geom/angle.h> -#include "guides.h" namespace Inkscape { namespace UI { @@ -40,21 +39,21 @@ namespace Dialogs { GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop) : _desktop(desktop), _guide(guide), - _label_units(_("Unit:")), - _label_X(_("X:")), - _label_Y(_("Y:")), - _label_degrees(_("Angle (degrees):")), _relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")), - _adjustment_x(0.0, -1e6, 1e6, 1.0, 10.0, 0), - _adjustment_y(0.0, -1e6, 1e6, 1.0, 10.0, 0), - _adj_angle(0.0, -360, 360, 1.0, 10.0, 0), - _unit_selector(NULL), _mode(true), _oldpos(0.,0.), _oldangle(0.0) + _spin_button_x(_("X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), + _spin_button_y(_("Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), + _spin_angle(_("Angle:"), "", UNIT_TYPE_RADIAL), + _mode(true), _oldpos(0.,0.), _oldangle(0.0) { } bool GuidelinePropertiesDialog::_relative_toggle_status = false; // initialize relative checkbox status for when this dialog is opened for first time +Glib::ustring GuidelinePropertiesDialog::_angle_unit_status = "deg"; // initialize angle unit status GuidelinePropertiesDialog::~GuidelinePropertiesDialog() { + // save current status + _relative_toggle_status = _relative_toggle.get_active(); + _angle_unit_status = _spin_angle.getUnit().abbr; } void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) { @@ -66,28 +65,24 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) { void GuidelinePropertiesDialog::_modeChanged() { _mode = !_relative_toggle.get_active(); - _relative_toggle_status = _relative_toggle.get_active(); if (!_mode) { // relative - _spin_angle.set_value(0); + _spin_angle.setValue(0); - _spin_button_y.set_value(0); - _spin_button_x.set_value(0); + _spin_button_y.setValue(0); + _spin_button_x.setValue(0); } else { // absolute - _spin_angle.set_value(_oldangle); + _spin_angle.setValueKeepUnit(_oldangle, "deg"); - SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector->gobj())); - gdouble const val_y = sp_pixels_get_units(_oldpos[Geom::Y], unit); - _spin_button_y.set_value(val_y); - gdouble const val_x = sp_pixels_get_units(_oldpos[Geom::X], unit); - _spin_button_x.set_value(val_x); + _spin_button_x.setValueKeepUnit(_oldpos[Geom::X], "px"); + _spin_button_y.setValueKeepUnit(_oldpos[Geom::Y], "px"); } } void GuidelinePropertiesDialog::_onApply() { - double deg_angle = _spin_angle.get_value(); + double deg_angle = _spin_angle.getValue("deg"); if (!_mode) deg_angle += _oldangle; Geom::Point normal; @@ -101,11 +96,8 @@ void GuidelinePropertiesDialog::_onApply() } sp_guide_set_normal(*_guide, normal, true); - SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector->gobj())); - gdouble const raw_dist_x = _spin_button_x.get_value(); - gdouble const points_x = sp_units_get_pixels(raw_dist_x, unit); - gdouble const raw_dist_y = _spin_button_y.get_value(); - gdouble const points_y = sp_units_get_pixels(raw_dist_y, unit); + double const points_x = _spin_button_x.getValue("px"); + double const points_y = _spin_button_y.getValue("px"); Geom::Point newpos(points_x, points_y); if (!_mode) newpos += _oldpos; @@ -178,51 +170,49 @@ void GuidelinePropertiesDialog::_setup() { _layout_table.attach(*manage(new Gtk::Label(" ")), 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10); - // mode radio button - _layout_table.attach(_relative_toggle, - 1, 3, 9, 10, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); - _relative_toggle.set_active(_relative_toggle_status); - - // unitmenu + // unitmenus /* fixme: We should allow percents here too, as percents of the canvas size */ - GtkWidget *unit_selector = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE); - sp_unit_selector_set_unit(SP_UNIT_SELECTOR(unit_selector), _desktop->namedview->doc_units); - _unit_selector = Gtk::manage(Glib::wrap(unit_selector)); + _unit_menu.setUnitType(UNIT_TYPE_LINEAR); + _unit_menu.setUnit("px"); + if (_desktop->namedview->doc_units) { + _unit_menu.setUnit( sp_unit_get_abbreviation(_desktop->namedview->doc_units) ); + } + _spin_angle.setUnit(_angle_unit_status); // position spinbuttons - sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_x.gobj())); - sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment_y.gobj())); - _spin_button_x.configure(_adjustment_x, 1.0 , 3); - _spin_button_y.configure(_adjustment_y, 1.0 , 3); - _layout_table.attach(_label_X, - 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + _spin_button_x.setDigits(3); + _spin_button_x.setIncrements(1.0, 10.0); + _spin_button_x.setRange(-1e6, 1e6); + _spin_button_y.setDigits(3); + _spin_button_y.setIncrements(1.0, 10.0); + _spin_button_y.setRange(-1e6, 1e6); _layout_table.attach(_spin_button_x, - 2, 3, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - _layout_table.attach(_label_Y, - 1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); _layout_table.attach(_spin_button_y, - 2, 3, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + 1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - _layout_table.attach(_label_units, - 1, 2, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - _layout_table.attach(*_unit_selector, - 2, 3, 6, 7, Gtk::FILL, Gtk::FILL); + _layout_table.attach(_unit_menu, + 2, 3, 4, 5, Gtk::FILL, Gtk::FILL); // angle spinbutton - _spin_angle.configure(_adj_angle, 5.0 , 3); - _spin_angle.show(); - _layout_table.attach(_label_degrees, - 1, 2, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + _spin_angle.setDigits(3); + _spin_angle.setIncrements(1.0, 10.0); + _spin_angle.setRange(-3600., 3600.); _layout_table.attach(_spin_angle, - 2, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + 1, 3, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + + // mode radio button + _layout_table.attach(_relative_toggle, + 1, 3, 7, 8, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); + _relative_toggle.set_active(_relative_toggle_status); // don't know what this exactly does, but it results in that the dialog closes when entering a value and pressing enter (see LP bug 484187) - gtk_signal_connect_object(GTK_OBJECT(_spin_button_x.gobj()), "activate", + gtk_signal_connect_object(GTK_OBJECT(_spin_button_x.getWidget()->gobj()), "activate", GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); - gtk_signal_connect_object(GTK_OBJECT(_spin_button_y.gobj()), "activate", + gtk_signal_connect_object(GTK_OBJECT(_spin_button_y.getWidget()->gobj()), "activate", GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); - gtk_signal_connect_object(GTK_OBJECT(_spin_angle.gobj()), "activate", + gtk_signal_connect_object(GTK_OBJECT(_spin_angle.getWidget()->gobj()), "activate", GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); @@ -258,14 +248,11 @@ void GuidelinePropertiesDialog::_setup() { _modeChanged(); // sets values of spinboxes. if ( _oldangle == 90. || _oldangle == 270. || _oldangle == -90. || _oldangle == -270.) { - _spin_button_x.grab_focus(); - _spin_button_x.select_region(0, 20); + _spin_button_x.grabFocusAndSelectEntry(); } else if ( _oldangle == 0. || _oldangle == 180. || _oldangle == -180.) { - _spin_button_y.grab_focus(); - _spin_button_y.select_region(0, 20); + _spin_button_y.grabFocusAndSelectEntry(); } else { - _spin_angle.grab_focus(); - _spin_angle.select_region(0, 20); + _spin_angle.grabFocusAndSelectEntry(); } set_position(Gtk::WIN_POS_MOUSE); diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 8485c78a7..f015c49ff 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -22,10 +22,20 @@ #include #include "ui/widget/button.h" #include "ui/widget/spinbutton.h" +#include "ui/widget/unit-menu.h" +#include "ui/widget/scalar-unit.h" #include <2geom/point.h> +class SPGuide; +class SPDesktop; + namespace Inkscape { namespace UI { + +namespace Widget { + class UnitMenu; +}; + namespace Dialogs { class GuidelinePropertiesDialog : public Gtk::Dialog { @@ -56,21 +66,15 @@ private: Gtk::Table _layout_table; Gtk::Label _label_name; Gtk::Label _label_descr; - Gtk::Label _label_units; - Gtk::Label _label_X; - Gtk::Label _label_Y; - Gtk::Label _label_degrees; Inkscape::UI::Widget::CheckButton _relative_toggle; static bool _relative_toggle_status; // remember the status of the _relative_toggle_status button across instances - Gtk::Adjustment _adjustment_x; - Inkscape::UI::Widget::SpinButton _spin_button_x; - Gtk::Adjustment _adjustment_y; - Inkscape::UI::Widget::SpinButton _spin_button_y; + Inkscape::UI::Widget::UnitMenu _unit_menu; + Inkscape::UI::Widget::ScalarUnit _spin_button_x; + Inkscape::UI::Widget::ScalarUnit _spin_button_y; - Gtk::Adjustment _adj_angle; - Inkscape::UI::Widget::SpinButton _spin_angle; + Inkscape::UI::Widget::ScalarUnit _spin_angle; + static Glib::ustring _angle_unit_status; // remember the status of the _relative_toggle_status button across instances - Gtk::Widget *_unit_selector; bool _mode; Geom::Point _oldpos; gdouble _oldangle; -- cgit v1.2.3 From ba0656ed825139624f4726c2e9d4389e2a8c2f37 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 15 Apr 2011 21:38:27 +0200 Subject: add undo to SpinButton (bzr r10167) --- src/ui/widget/spinbutton.cpp | 70 +++++++++++++++++++++++++++++++++++++++++--- src/ui/widget/spinbutton.h | 10 +++++-- 2 files changed, 74 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 22bc30bb2..32090f96c 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -18,11 +18,20 @@ #include "unit-menu.h" #include "util/expression-evaluator.h" +#include "event-context.h" namespace Inkscape { namespace UI { namespace Widget { + +void +SpinButton::connect_signals() { + signal_input().connect(sigc::mem_fun(*this, &SpinButton::on_input)); + signal_focus_in_event().connect(sigc::mem_fun(*this, &SpinButton::on_my_focus_in_event)); + signal_key_press_event().connect(sigc::mem_fun(*this, &SpinButton::on_my_key_press_event)); +}; + /** * This callback function should try to convert the entered text to a number and write it to newvalue. * It calls a method to evaluate the (potential) mathematical expression. @@ -34,10 +43,16 @@ int SpinButton::on_input(double* newvalue) { try { - Inkscape::Util::GimpEevlQuantity result = Inkscape::Util::gimp_eevl_evaluate (get_text().c_str(), _unit_menu ? &_unit_menu->getUnit() : NULL); - // check if output dimension corresponds to input unit - if (_unit_menu && result.dimension != (_unit_menu->getUnit().isAbsolute() ? 1 : 0) ) { - throw Inkscape::Util::EvaluatorException("Input dimensions do not match with parameter dimensions.",""); + Inkscape::Util::GimpEevlQuantity result; + if (_unit_menu) { + Unit unit = _unit_menu->getUnit(); + result = Inkscape::Util::gimp_eevl_evaluate (get_text().c_str(), &unit); + // check if output dimension corresponds to input unit + if (result.dimension != (unit.isAbsolute() ? 1 : 0) ) { + throw Inkscape::Util::EvaluatorException("Input dimensions do not match with parameter dimensions.",""); + } + } else { + result = Inkscape::Util::gimp_eevl_evaluate (get_text().c_str(), NULL); } *newvalue = result.value; @@ -51,6 +66,53 @@ SpinButton::on_input(double* newvalue) return true; } +/** When focus is obtained, save the value to enable undo later. + * @retval false continue with default handler. + * @retval true don't call default handler. +*/ +bool +SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/) +{ + on_focus_in_value = get_value(); + return false; // do not consume the event +} + +/** Handle specific keypress events, like Ctrl+Z + * @retval false continue with default handler. + * @retval true don't call default handler. +*/ +bool +SpinButton::on_my_key_press_event(GdkEventKey* event) +{ + switch (get_group0_keyval (event)) { + case GDK_Escape: + undo(); + return true; // I consumed the event + break; + case GDK_z: + case GDK_Z: + if (event->state & GDK_CONTROL_MASK) { + undo(); + return true; // I consumed the event + } + break; + default: + break; + } + + return false; // do not consume the event +} + +/** + * Undo the editing, by resetting the value upon when the spinbutton got focus. + */ +void +SpinButton::undo() +{ + set_value(on_focus_in_value); +} + + } // namespace Widget } // namespace UI } // namespace Inkscape diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index 0eb58bb9e..df913553d 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -33,13 +33,13 @@ public: : Gtk::SpinButton(climb_rate, digits), _unit_menu(NULL) { - signal_input().connect(sigc::mem_fun(*this, &SpinButton::on_input)); + connect_signals(); }; explicit SpinButton(Gtk::Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0) : Gtk::SpinButton(adjustment, climb_rate, digits), _unit_menu(NULL) { - signal_input().connect(sigc::mem_fun(*this, &SpinButton::on_input)); + connect_signals(); }; virtual ~SpinButton() {}; @@ -49,7 +49,13 @@ public: protected: UnitMenu *_unit_menu; /// Linked unit menu for unit conversion in entered expressions. + void connect_signals(); int on_input(double* newvalue); + bool on_my_focus_in_event(GdkEventFocus* event); + bool on_my_key_press_event(GdkEventKey* event); + void undo(); + + double on_focus_in_value; private: // noncopyable -- cgit v1.2.3 From f61973f0c721f0546c5f9946fc084ba50680efce Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 15 Apr 2011 21:51:57 +0200 Subject: remove ridiculous comment (bzr r10168) --- src/ege-adjustment-action.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index c075d67e7..de8814f55 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -39,8 +39,6 @@ * * ***** END LICENSE BLOCK ***** */ -/* Note: this file should be kept compilable as both .cpp and .c */ - #include #include -- cgit v1.2.3 From 12f44c4f342837bd36dbd0f9b269d36edb2e41c6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 15 Apr 2011 22:09:36 +0200 Subject: hack C++ spinbuttons into toolbars. unit conversion does not work, and will probably be a huge pain to add (bzr r10169) --- src/ege-adjustment-action.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index de8814f55..bfab201f4 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -62,6 +62,8 @@ #include "icon-size.h" #include "ege-adjustment-action.h" +#include "ui/widget/spinbutton.h" + static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ); static void ege_adjustment_action_init( EgeAdjustmentAction* action ); @@ -846,7 +848,9 @@ static GtkWidget* create_tool_item( GtkAction* action ) gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); #endif /* GTK_CHECK_VERSION(2,12,0) */ } else { - spinbutton = gtk_spin_button_new( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); + //spinbutton = gtk_spin_button_new( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); + Inkscape::UI::Widget::SpinButton *inkscape_spinbutton = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(act->private_data->adj, true), act->private_data->climbRate, act->private_data->digits); + spinbutton = GTK_WIDGET( inkscape_spinbutton->gobj() ); } item = GTK_WIDGET( gtk_tool_item_new() ); -- cgit v1.2.3 From a0d74348937bf217b073311936e5aefc6105a1b9 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 16 Apr 2011 23:09:31 +0200 Subject: ScalarUnit widget: fix initialization bug. add constructor which takes another scalarunit's unitmenu. (bzr r10171) --- src/ui/widget/scalar-unit.cpp | 34 ++++++++++++++++++++++++++++++++++ src/ui/widget/scalar-unit.h | 5 +++++ 2 files changed, 39 insertions(+) (limited to 'src') diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index 533f0a200..e713f3e06 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -68,8 +68,42 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, .connect_notify(sigc::mem_fun(*this, &ScalarUnit::on_unit_changed)); static_cast(_widget)->setUnitMenu(_unit_menu); + + lastUnits = _unit_menu->getUnitAbbr(); +} + +/** + * Construct a ScalarUnit + * + * \param label Label. + * \param tooltip Tooltip text. + * \param take_unitmenu Use the unitmenu from this parameter. + * \param suffix Suffix, placed after the widget (defaults to ""). + * \param icon Icon filename, placed before the label (defaults to ""). + * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ +ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, + ScalarUnit &take_unitmenu, + Glib::ustring const &suffix, + Glib::ustring const &icon, + bool mnemonic) + : Scalar(label, tooltip, suffix, icon, mnemonic), + _unit_menu(take_unitmenu._unit_menu), + _hundred_percent(0), + _absolute_is_increment(false), + _percentage_is_increment(false) +{ + _unit_menu->signal_changed() + .connect_notify(sigc::mem_fun(*this, &ScalarUnit::on_unit_changed)); + + static_cast(_widget)->setUnitMenu(_unit_menu); + + lastUnits = _unit_menu->getUnitAbbr(); } + /** * Initializes the scalar based on the settings in _unit_menu. * Requires that _unit_menu has already been initialized. diff --git a/src/ui/widget/scalar-unit.h b/src/ui/widget/scalar-unit.h index 8f6c8e210..4e08d63f4 100644 --- a/src/ui/widget/scalar-unit.h +++ b/src/ui/widget/scalar-unit.h @@ -32,6 +32,11 @@ public: Glib::ustring const &icon = "", UnitMenu *unit_menu = NULL, bool mnemonic = true); + ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, + ScalarUnit &take_unitmenu, + Glib::ustring const &suffix = "", + Glib::ustring const &icon = "", + bool mnemonic = true); void initScalar(double min_value, double max_value); -- cgit v1.2.3 From 7f1598badb821e086ee9e34865389844bd9ddd70 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 16 Apr 2011 23:48:59 +0200 Subject: upgrade the spinboxes in tile dialog. (alignment is a bit awkward, have tried to fix it, but didnt work out) (bzr r10172) --- src/ui/dialog/tile.cpp | 74 ++++++++++++++++++-------------------------------- src/ui/dialog/tile.h | 20 ++++---------- 2 files changed, 32 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index b0a39bd0e..3510503d3 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -136,8 +136,8 @@ void TileDialog::Grid_Arrange () on_row_spinbutton_changed(); // set padding to manual values - paddingx = XPadSpinner.get_value(); - paddingy = YPadSpinner.get_value(); + paddingx = XPadding.getValue("px"); + paddingy = YPadding.getValue("px"); std::vector row_heights; std::vector col_widths; @@ -422,7 +422,7 @@ void TileDialog::on_col_spinbutton_changed() void TileDialog::on_xpad_spinbutton_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/XPad", XPadSpinner.get_value()); + prefs->setDouble("/dialogs/gridtiler/XPad", XPadding.getValue("px")); } @@ -432,7 +432,7 @@ void TileDialog::on_xpad_spinbutton_changed() void TileDialog::on_ypad_spinbutton_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/dialogs/gridtiler/YPad", YPadSpinner.get_value()); + prefs->setDouble("/dialogs/gridtiler/YPad", YPadding.getValue("px")); } @@ -512,7 +512,8 @@ void TileDialog::Spacing_button_changed() prefs->setDouble("/dialogs/gridtiler/SpacingType", -20); } - SizesHBox.set_sensitive ( SpaceManualRadioButton.get_active()); + XPadding.set_sensitive ( SpaceManualRadioButton.get_active()); + YPadding.set_sensitive ( SpaceManualRadioButton.get_active()); } /** @@ -614,7 +615,9 @@ static void updateSelectionCallback(Inkscape::Application */*inkscape*/, Inkscap * Constructor */ TileDialog::TileDialog() - : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE) + : UI::Widget::Panel("", "/dialogs/gridtiler", SP_VERB_SELECTION_GRIDTILE), + XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns"), + YPadding(_("Y:"), _("Vertical spacing between rows."), XPadding, "", "object-rows") { // bool used by spin button callbacks to stop loops where they change each other. updating = false; @@ -814,51 +817,25 @@ TileDialog::TileDialog() } { - /*#### Y Padding ####*/ + /*#### Padding ####*/ - GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_MENU, "object-rows"); - YPadBox.pack_start (*(Glib::wrap(i)), false, false, MARGIN); + YPadding.setDigits(1); + YPadding.setIncrements(0.2, 0); + YPadding.setRange(-10000, 10000); + double yPad = prefs->getDouble("/dialogs/gridtiler/YPad", 15); + YPadding.setValue(yPad, "px"); + YPadding.signal_value_changed().connect(sigc::mem_fun(*this, &TileDialog::on_ypad_spinbutton_changed)); - YPadSpinner.set_digits(1); - YPadSpinner.set_increments(0.2, 0); - YPadSpinner.set_range(-10000, 10000); - double YPad = prefs->getDouble("/dialogs/gridtiler/YPad", 15); - YPadSpinner.set_value(YPad); - YPadBox.pack_start(YPadSpinner, true, true, MARGIN); - tips.set_tip(YPadSpinner, _("Vertical spacing between rows (px units)")); - YPadSpinner.signal_changed().connect(sigc::mem_fun(*this, &TileDialog::on_ypad_spinbutton_changed)); - gtk_size_group_add_widget(_col1, (GtkWidget *) YPadBox.gobj()); + XPadding.setDigits(1); + XPadding.setIncrements(0.2, 0); + XPadding.setRange(-10000, 10000); + double xPad = prefs->getDouble("/dialogs/gridtiler/XPad", 15); + XPadding.setValue(xPad, "px"); - SizesHBox.pack_start(YPadBox, false, false, MARGIN); + XPadding.signal_value_changed().connect(sigc::mem_fun(*this, &TileDialog::on_xpad_spinbutton_changed)); } - - { - Gtk::HBox *spacer = new Gtk::HBox; - SizesHBox.pack_start(*spacer, false, false, 0); - gtk_size_group_add_widget(_col2, (GtkWidget *) spacer->gobj()); - } - - { - /*#### X padding ####*/ - - GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_MENU, "object-columns"); - XPadBox.pack_start (*(Glib::wrap(i)), false, false, MARGIN); - - XPadSpinner.set_digits(1); - XPadSpinner.set_increments(0.2, 0); - XPadSpinner.set_range(-10000, 10000); - double XPad = prefs->getDouble("/dialogs/gridtiler/XPad", 15); - XPadSpinner.set_value(XPad); - XPadBox.pack_start(XPadSpinner, true, true, MARGIN); - tips.set_tip(XPadSpinner, _("Horizontal spacing between columns (px units)")); - XPadSpinner.signal_changed().connect(sigc::mem_fun(*this, &TileDialog::on_xpad_spinbutton_changed)); - gtk_size_group_add_widget(_col3, (GtkWidget *) XPadBox.gobj()); - - SizesHBox.pack_start(XPadBox, false, false, MARGIN); - } - - - TileBox.pack_start(SizesHBox, false, false, MARGIN); + TileBox.pack_start(XPadding, false, false, MARGIN); + TileBox.pack_start(YPadding, false, false, MARGIN); contents->pack_start(TileBox); @@ -870,7 +847,8 @@ TileDialog::TileDialog() } SpaceManualRadioButton.set_active(ManualSpacing); SpaceByBBoxRadioButton.set_active(!ManualSpacing); - SizesHBox.set_sensitive (ManualSpacing); + XPadding.set_sensitive (ManualSpacing); + YPadding.set_sensitive (ManualSpacing); //## The OK button TileOkButton = addResponseButton(C_("Rows and columns dialog","_Arrange"), GTK_RESPONSE_APPLY); diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index 16ae3e4f8..09a648e1f 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -24,6 +24,8 @@ #include #include "ui/widget/panel.h" +#include "ui/widget/spinbutton.h" +#include "ui/widget/scalar-unit.h" namespace Inkscape { namespace UI { @@ -88,12 +90,11 @@ private: Gtk::HBox AlignHBox; Gtk::HBox SpinsHBox; - Gtk::HBox SizesHBox; // Number per Row Gtk::VBox NoOfColsBox; Gtk::Label NoOfColsLabel; - Gtk::SpinButton NoOfColsSpinner; + Inkscape::UI::Widget::SpinButton NoOfColsSpinner; bool AutoRowSize; Gtk::CheckButton RowHeightButton; @@ -104,7 +105,7 @@ private: // Number per Column Gtk::VBox NoOfRowsBox; Gtk::Label NoOfRowsLabel; - Gtk::SpinButton NoOfRowsSpinner; + Inkscape::UI::Widget::SpinButton NoOfRowsSpinner; bool AutoColSize; Gtk::CheckButton ColumnWidthButton; @@ -128,15 +129,8 @@ private: Gtk::RadioButton HorizRightRadioButton; double HorizAlign; - // padding in x - Gtk::VBox XPadBox; - Gtk::Label XPadLabel; - Gtk::SpinButton XPadSpinner; - - // padding in y - Gtk::VBox YPadBox; - Gtk::Label YPadLabel; - Gtk::SpinButton YPadSpinner; + Inkscape::UI::Widget::ScalarUnit XPadding; + Inkscape::UI::Widget::ScalarUnit YPadding; // BBox or manual spacing Gtk::VBox SpacingVBox; @@ -145,8 +139,6 @@ private: Gtk::RadioButton SpaceManualRadioButton; bool ManualSpacing; - - // Row height Gtk::VBox RowHeightVBox; Gtk::HBox RowHeightBox; -- cgit v1.2.3 From cc5c699ce54696232000ab14a64351d696b4b1a9 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 16 Apr 2011 23:55:46 +0200 Subject: extensions: use improved spinbutton with math expression evaluation (bzr r10173) --- src/extension/param/float.cpp | 4 ++-- src/extension/param/int.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index d94463a5b..4ef816d61 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include "ui/widget/spinbutton.h" #include "xml/node.h" #include "extension/extension.h" @@ -172,7 +172,7 @@ ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::sign hbox->pack_start(*scale, false, false); } - Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 0.1, _precision)); + Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 0.1, _precision)); spin->show(); hbox->pack_start(*spin, false, false); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 69849c656..3ed8addd9 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include "ui/widget/spinbutton.h" #include "xml/node.h" #include "extension/extension.h" @@ -157,7 +157,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal hbox->pack_start(*scale, false, false); } - Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 1.0, 0)); + Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 1.0, 0)); spin->show(); hbox->pack_start(*spin, false, false); -- cgit v1.2.3 From 5bce9c92692548162b10aa06370f1e28806572f7 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 16 Apr 2011 23:57:13 +0200 Subject: remove unnecessary includes. (bzr r10174) --- src/extension/param/parameter.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index a9935cfe6..fb53035a1 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -19,10 +19,6 @@ # define ESCAPE_DOLLAR_COMMANDLINE #endif -#include -#include -#include - #include #include -- cgit v1.2.3 From 21d73e3319ea07a5323a318a376a8c664640265d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Apr 2011 00:14:34 +0200 Subject: remove superfluous includes (bzr r10175) --- src/ui/dialog/fill-and-stroke.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index fe72aa31c..b4be9ce59 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -15,11 +15,9 @@ #ifndef INKSCAPE_UI_DIALOG_FILL_AND_STROKE_H #define INKSCAPE_UI_DIALOG_FILL_AND_STROKE_H -#include #include #include #include -#include #include #include "ui/widget/panel.h" -- cgit v1.2.3 From b1b23e8d5eed247d2603a5a83b8e8a9a969793ed Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Apr 2011 00:56:19 +0200 Subject: change spinbox to new one in many places. (bzr r10176) --- src/extension/internal/pdf-input-cairo.cpp | 4 +++- src/extension/internal/pdf-input-cairo.h | 10 ++++++++-- src/extension/internal/pdfinput/pdf-input.cpp | 3 ++- src/extension/internal/pdfinput/pdf-input.h | 10 ++++++++-- src/jabber_whiteboard/pedrogui.h | 3 ++- src/pedro/pedrogui.h | 3 ++- src/ui/dialog/align-and-distribute.cpp | 6 +++--- src/ui/dialog/filter-effects-dialog.cpp | 12 ++++++------ src/ui/dialog/inkscape-preferences.cpp | 3 ++- src/ui/dialog/layers.h | 4 ++-- src/ui/dialog/svg-fonts-dialog.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.h | 3 ++- src/ui/dialog/tile.h | 4 ++-- src/ui/dialog/tracedialog.cpp | 18 +++++++++--------- src/ui/widget/object-composite-settings.h | 4 ++-- src/ui/widget/preferences-widget.h | 6 +++--- src/ui/widget/selected-style.h | 4 ++-- src/ui/widget/spin-slider.cpp | 4 ++-- src/ui/widget/spin-slider.h | 8 ++++---- src/ui/widget/zoom-status.h | 4 ++-- src/widgets/dash-selector.cpp | 4 ++-- src/widgets/stroke-style.cpp | 11 ++++++----- 22 files changed, 75 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index 048b26bed..daa185268 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -31,6 +31,8 @@ #include #include +#include "ui/widget/spinbutton.h" + namespace Inkscape { namespace Extension { namespace Internal { @@ -67,7 +69,7 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc) // Page number int num_pages = poppler_document_get_n_pages(_poppler_doc); Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, num_pages, 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new class Gtk::SpinButton(*_pageNumberSpin_adj, 1, 1)); + _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); _labelTotalPages = Gtk::manage(new class Gtk::Label()); hbox2 = Gtk::manage(new class Gtk::HBox(false, 0)); // Disable the page selector when there's only one page diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h index ad7c884cb..7581cb0a5 100644 --- a/src/extension/internal/pdf-input-cairo.h +++ b/src/extension/internal/pdf-input-cairo.h @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -39,6 +38,13 @@ #include "../implementation/implementation.h" namespace Inkscape { + +namespace UI { +namespace Widget { + class SpinButton; +} +} + namespace Extension { namespace Internal { @@ -64,7 +70,7 @@ private: class Gtk::Button * cancelbutton; class Gtk::Button * okbutton; class Gtk::Label * _labelSelect; - class Gtk::SpinButton * _pageNumberSpin; + class Inkscape::UI::Widget::SpinButton * _pageNumberSpin; class Gtk::Label * _labelTotalPages; class Gtk::HBox * hbox2; class Gtk::CheckButton * _cropCheck; diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index ae3e473a5..fc2db7e69 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -41,6 +41,7 @@ #include "dialogs/dialog-events.h" #include +#include "ui/widget/spinbutton.h" namespace Inkscape { namespace Extension { @@ -75,7 +76,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar *uri) // Page number Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage( new class Gtk::Adjustment(1, 1, _pdf_doc->getNumPages(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new class Gtk::SpinButton(*_pageNumberSpin_adj, 1, 1)); + _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); _labelTotalPages = Gtk::manage(new class Gtk::Label()); hbox2 = Gtk::manage(new class Gtk::HBox(false, 0)); // Disable the page selector when there's only one page diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 6bf0f11a2..c2fd0b6d8 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -41,6 +40,13 @@ #endif namespace Inkscape { + +namespace UI { +namespace Widget { + class SpinButton; +} +} + namespace Extension { namespace Internal { @@ -66,7 +72,7 @@ private: class Gtk::Button * cancelbutton; class Gtk::Button * okbutton; class Gtk::Label * _labelSelect; - class Gtk::SpinButton * _pageNumberSpin; + class Inkscape::UI::Widget::SpinButton * _pageNumberSpin; class Gtk::Label * _labelTotalPages; class Gtk::HBox * hbox2; class Gtk::CheckButton * _cropCheck; diff --git a/src/jabber_whiteboard/pedrogui.h b/src/jabber_whiteboard/pedrogui.h index d9a66a5e5..f4ebb4544 100644 --- a/src/jabber_whiteboard/pedrogui.h +++ b/src/jabber_whiteboard/pedrogui.h @@ -26,6 +26,7 @@ #include +#include "ui/widget/spinbutton.h" #include "pedro/pedroxmpp.h" #include "pedro/pedroconfig.h" @@ -595,7 +596,7 @@ private: Gtk::Label hostLabel; Gtk::Entry hostField; Gtk::Label portLabel; - Gtk::SpinButton portSpinner; + Inkscape::UI::Widget::SpinButton portSpinner; Gtk::Label userLabel; Gtk::Entry userField; Gtk::Label passLabel; diff --git a/src/pedro/pedrogui.h b/src/pedro/pedrogui.h index 4af4f1aac..2898da118 100644 --- a/src/pedro/pedrogui.h +++ b/src/pedro/pedrogui.h @@ -26,6 +26,7 @@ #include +#include "ui/widget/spinbutton.h" #include "pedroxmpp.h" #include "pedroconfig.h" @@ -590,7 +591,7 @@ private: Gtk::Label hostLabel; Gtk::Entry hostField; Gtk::Label portLabel; - Gtk::SpinButton portSpinner; + Inkscape::UI::Widget::SpinButton portSpinner; Gtk::Label userLabel; Gtk::Entry userField; Gtk::Label passLabel; diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index f974ec6ce..81e2b64a9 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -20,7 +20,7 @@ # include #endif -#include +#include "ui/widget/spinbutton.h" #include "desktop-handles.h" #include "unclump.h" @@ -445,8 +445,8 @@ class ActionRemoveOverlaps : public Action { private: Gtk::Label removeOverlapXGapLabel; Gtk::Label removeOverlapYGapLabel; - Gtk::SpinButton removeOverlapXGap; - Gtk::SpinButton removeOverlapYGap; + Inkscape::UI::Widget::SpinButton removeOverlapXGap; + Inkscape::UI::Widget::SpinButton removeOverlapYGap; public: ActionRemoveOverlaps(Glib::ustring const &id, diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 2699d9201..2e17daa11 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include "ui/widget/spinbutton.h" #include #include #include @@ -133,12 +133,12 @@ private: const Glib::ustring _true_val, _false_val; }; -class SpinButtonAttr : public Gtk::SpinButton, public AttrWidget +class SpinButtonAttr : public Inkscape::UI::Widget::SpinButton, public AttrWidget { public: SpinButtonAttr(double lower, double upper, double step_inc, double climb_rate, int digits, const SPAttributeEnum a, double def, char* tip_text) - : Gtk::SpinButton(climb_rate, digits), + : Inkscape::UI::Widget::SpinButton(climb_rate, digits), AttrWidget(a, def) { if (tip_text) _tt.set_tip(*this, tip_text); @@ -248,12 +248,12 @@ public: pack_start(_s2, false, false); } - Gtk::SpinButton& get_spinbutton1() + Inkscape::UI::Widget::SpinButton& get_spinbutton1() { return _s1; } - Gtk::SpinButton& get_spinbutton2() + Inkscape::UI::Widget::SpinButton& get_spinbutton2() { return _s2; } @@ -285,7 +285,7 @@ public: } private: - Gtk::SpinButton _s1, _s2; + Inkscape::UI::Widget::SpinButton _s1, _s2; }; class ColorButton : public Gtk::ColorButton, public AttrWidget diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 8681ed98f..7963dd512 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -38,6 +38,7 @@ #include "selection-chemistry.h" #include "xml/repr.h" #include "ui/widget/style-swatch.h" +#include "ui/widget/spinbutton.h" #include "display/nr-filter-gaussian.h" #include "display/nr-filter-types.h" #include "color-profile-fns.h" @@ -70,7 +71,7 @@ InkscapePreferences::InkscapePreferences() _current_page(0) { //get the width of a spinbutton - Gtk::SpinButton* sb = new Gtk::SpinButton; + Inkscape::UI::Widget::SpinButton* sb = new Inkscape::UI::Widget::SpinButton; sb->set_width_chars(6); _getContents()->add(*sb); show_all_children(); diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index b7e81480c..018357425 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include "ui/widget/spinbutton.h" #include //#include "ui/previewholder.h" @@ -117,7 +117,7 @@ private: Gtk::HButtonBox _buttonsRow; Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; - Gtk::SpinButton _spinBtn; + Inkscape::UI::Widget::SpinButton _spinBtn; Gtk::VBox _layersPage; UI::Widget::StyleSubject::CurrentLayer _subject; diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 2d1b5ae39..d836bfa22 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -137,7 +137,7 @@ Gtk::HBox* SvgFontsDialog::AttrCombo(gchar* lbl, const SPAttributeEnum /*attr*/) Gtk::HBox* SvgFontsDialog::AttrSpin(gchar* lbl){ Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox()); hbox->add(* Gtk::manage(new Gtk::Label(lbl)) ); - hbox->add(* Gtk::manage(new Gtk::SpinBox()) ); + hbox->add(* Gtk::manage(new Inkscape::UI::Widget::SpinBox()) ); hbox->show_all(); return hbox; }*/ diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index e819187a1..50821cc6c 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -12,6 +12,7 @@ #define INKSCAPE_UI_DIALOG_SVG_FONTS_H #include "ui/widget/panel.h" +#include "ui/widget/spinbutton.h" #include "sp-font.h" #include "sp-font-face.h" #include "verbs.h" @@ -206,7 +207,7 @@ private: SvgFontDrawingArea _font_da, kerning_preview; GlyphComboBox first_glyph, second_glyph; SPGlyphKerning* kerning_pair; - Gtk::SpinButton setwidth_spin; + Inkscape::UI::Widget::SpinButton setwidth_spin; Gtk::HScale kerning_slider; class EntryWidget : public Gtk::HBox diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index 09a648e1f..fe77a9098 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -143,13 +143,13 @@ private: Gtk::VBox RowHeightVBox; Gtk::HBox RowHeightBox; Gtk::Label RowHeightLabel; - Gtk::SpinButton RowHeightSpinner; + Inkscape::UI::Widget::SpinButton RowHeightSpinner; // Column width Gtk::VBox ColumnWidthVBox; Gtk::HBox ColumnWidthBox; Gtk::Label ColumnWidthLabel; - Gtk::SpinButton ColumnWidthSpinner; + Inkscape::UI::Widget::SpinButton ColumnWidthSpinner; }; diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index f6dd6cb28..083cd0077 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include "ui/widget/spinbutton.h" #include #include //for GTK_RESPONSE* types @@ -109,7 +109,7 @@ class TraceDialogImpl : public TraceDialog Gtk::HBox modeBrightnessBox; Gtk::RadioButton modeBrightnessRadioButton; Gtk::Label modeBrightnessSpinnerLabel; - Gtk::SpinButton modeBrightnessSpinner; + Inkscape::UI::Widget::SpinButton modeBrightnessSpinner; //edge detection Gtk::Frame modeCannyFrame; Gtk::HBox modeCannyBox; @@ -117,16 +117,16 @@ class TraceDialogImpl : public TraceDialog Gtk::RadioButton modeCannyRadioButton; //Gtk::HSeparator modeCannySeparator; //Gtk::Label modeCannyLoSpinnerLabel; - //Gtk::SpinButton modeCannyLoSpinner; + //Inkscape::UI::Widget::SpinButton modeCannyLoSpinner; Gtk::Label modeCannyHiSpinnerLabel; - Gtk::SpinButton modeCannyHiSpinner; + Inkscape::UI::Widget::SpinButton modeCannyHiSpinner; //quantization Gtk::Frame modeQuantFrame; Gtk::HBox modeQuantBox; Gtk::VBox modeQuantVBox; Gtk::RadioButton modeQuantRadioButton; Gtk::Label modeQuantNrColorLabel; - Gtk::SpinButton modeQuantNrColorSpinner; + Inkscape::UI::Widget::SpinButton modeQuantNrColorSpinner; //params Gtk::CheckButton modeInvertButton; Gtk::HBox modeInvertBox; @@ -137,7 +137,7 @@ class TraceDialogImpl : public TraceDialog //brightness Gtk::HBox modeMultiScanHBox1; Gtk::RadioButton modeMultiScanBrightnessRadioButton; - Gtk::SpinButton modeMultiScanNrColorSpinner; + Inkscape::UI::Widget::SpinButton modeMultiScanNrColorSpinner; //colors Gtk::HBox modeMultiScanHBox2; Gtk::RadioButton modeMultiScanColorRadioButton; @@ -162,15 +162,15 @@ class TraceDialogImpl : public TraceDialog Gtk::HBox optionsSpecklesBox; Gtk::CheckButton optionsSpecklesButton; Gtk::Label optionsSpecklesSizeLabel; - Gtk::SpinButton optionsSpecklesSizeSpinner; + Inkscape::UI::Widget::SpinButton optionsSpecklesSizeSpinner; Gtk::HBox optionsCornersBox; Gtk::CheckButton optionsCornersButton; Gtk::Label optionsCornersThresholdLabel; - Gtk::SpinButton optionsCornersThresholdSpinner; + Inkscape::UI::Widget::SpinButton optionsCornersThresholdSpinner; Gtk::HBox optionsOptimBox; Gtk::CheckButton optionsOptimButton; Gtk::Label optionsOptimToleranceLabel; - Gtk::SpinButton optionsOptimToleranceSpinner; + Inkscape::UI::Widget::SpinButton optionsOptimToleranceSpinner; //#### Credits diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index 76538d6a7..8ef31a889 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include "ui/widget/spinbutton.h" #include #include @@ -47,7 +47,7 @@ private: Gtk::Label _opacity_label; Gtk::Adjustment _opacity_adjustment; Gtk::HScale _opacity_hscale; - Gtk::SpinButton _opacity_spin_button; + Inkscape::UI::Widget::SpinButton _opacity_spin_button; StyleSubject *_subject; diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 4cd2ff569..758ab38cd 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include "ui/widget/spinbutton.h" #include #include #include @@ -117,7 +117,7 @@ private: void on_spinbutton_value_changed(); void on_unit_changed(); - Gtk::SpinButton _sb; + Inkscape::UI::Widget::SpinButton _sb; UnitMenu _unit; Gtk::HScale _slider; ZoomCorrRuler _ruler; @@ -135,7 +135,7 @@ private: void on_spinbutton_value_changed(); Glib::ustring _prefs_path; - Gtk::SpinButton _sb; + Inkscape::UI::Widget::SpinButton _sb; Gtk::HScale _slider; bool freeze; // used to block recursive updates of slider and spinbutton }; diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index e74d5b1ae..0caa7fe4c 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include "ui/widget/spinbutton.h" #include #include @@ -138,7 +138,7 @@ protected: Gtk::EventBox _opacity_place; Gtk::Adjustment _opacity_adjustment; - Gtk::SpinButton _opacity_sb; + Inkscape::UI::Widget::SpinButton _opacity_sb; Gtk::Label _na[2]; Glib::ustring __na[2]; diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index faafc63b4..259b057aa 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -90,11 +90,11 @@ Gtk::HScale& SpinSlider::get_scale() return _scale; } -const Gtk::SpinButton& SpinSlider::get_spin_button() const +const Inkscape::UI::Widget::SpinButton& SpinSlider::get_spin_button() const { return _spin; } -Gtk::SpinButton& SpinSlider::get_spin_button() +Inkscape::UI::Widget::SpinButton& SpinSlider::get_spin_button() { return _spin; } diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index a4d0aa9d6..703c5d896 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include "spinbutton.h" #include "attr-widget.h" namespace Inkscape { @@ -42,8 +42,8 @@ public: const Gtk::HScale& get_scale() const; Gtk::HScale& get_scale(); - const Gtk::SpinButton& get_spin_button() const; - Gtk::SpinButton& get_spin_button(); + const Inkscape::UI::Widget::SpinButton& get_spin_button() const; + Inkscape::UI::Widget::SpinButton& get_spin_button(); void set_update_policy(const Gtk::UpdateType); @@ -52,7 +52,7 @@ public: private: Gtk::Adjustment _adjustment; Gtk::HScale _scale; - Gtk::SpinButton _spin; + Inkscape::UI::Widget::SpinButton _spin; }; // Contains two SpinSliders for controlling number-opt-number attributes diff --git a/src/ui/widget/zoom-status.h b/src/ui/widget/zoom-status.h index 58d595329..85c3eeee1 100644 --- a/src/ui/widget/zoom-status.h +++ b/src/ui/widget/zoom-status.h @@ -13,7 +13,7 @@ */ #include -#include +#include "ui/widget/spinbutton.h" struct SPDesktop; @@ -22,7 +22,7 @@ namespace Inkscape { namespace UI { namespace Widget { -class ZoomStatus : public Gtk::SpinButton +class ZoomStatus : public Inkscape::UI::Widget::SpinButton { public: ZoomStatus(); diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp index e7e029334..dead653de 100644 --- a/src/widgets/dash-selector.cpp +++ b/src/widgets/dash-selector.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include "ui/widget/spinbutton.h" #include "dash-selector.h" @@ -73,7 +73,7 @@ SPDashSelector::SPDashSelector() { dash->set_menu(*m); offset = new Gtk::Adjustment(0.0, 0.0, 10.0, 0.1, 1.0, 0.0); - Gtk::SpinButton *sb = new Gtk::SpinButton(*offset, 0.1, 2); + Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(*offset, 0.1, 2); tt->set_tip(*sb, _("Pattern offset")); sp_dialog_defocus_on_enter_cpp(sb); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 555418269..99d8228c8 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -55,6 +55,7 @@ #include "widgets/paint-selector.h" #include "widgets/sp-widget.h" #include "widgets/spw-utilities.h" +#include "ui/widget/spinbutton.h" #include "xml/repr.h" #include "stroke-style.h" @@ -653,7 +654,7 @@ sp_stroke_style_line_widget_new(void) Gtk::Container *spw; Gtk::Table *t; Gtk::Adjustment *a; - Gtk::SpinButton *sb; + Inkscape::UI::Widget::SpinButton *sb; Gtk::RadioButton *tb; Gtk::HBox *f, *hb; @@ -688,7 +689,7 @@ sp_stroke_style_line_widget_new(void) a = new Gtk::Adjustment(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0); spw->set_data("width", a); - sb = new Gtk::SpinButton(*a, 0.1, 3); + sb = new Inkscape::UI::Widget::SpinButton(*a, 0.1, 3); tt->set_tip(*sb, _("Stroke width")); sb->show(); spw_label(t, C_("Stroke width", "_Width:"), 0, i, sb); @@ -765,7 +766,7 @@ sp_stroke_style_line_widget_new(void) a = new Gtk::Adjustment(4.0, 0.0, 100.0, 0.1, 10.0, 0.0); spw->set_data("miterlimit", a); - sb = new Gtk::SpinButton(*a, 0.1, 2); + sb = new Inkscape::UI::Widget::SpinButton(*a, 0.1, 2); tt->set_tip(*sb, _("Maximum length of the miter (in units of stroke width)")); sb->show(); spw_label(t, _("Miter _limit:"), 0, i, sb); @@ -1057,8 +1058,8 @@ sp_stroke_style_line_update(Gtk::Container *spw, Inkscape::Selection *sel) tb = static_cast(spw->get_data("bevel join")); tb->set_sensitive(enabled); - Gtk::SpinButton* sb = NULL; - sb = static_cast(spw->get_data("miterlimit_sb")); + Inkscape::UI::Widget::SpinButton* sb = NULL; + sb = static_cast(spw->get_data("miterlimit_sb")); sb->set_sensitive(enabled); tb = static_cast(spw->get_data("cap butt")); -- cgit v1.2.3 From 70829da1b189d6d8f07f12d97b9273d56dbd789e Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Apr 2011 14:51:06 +0200 Subject: add new preference widget for a number with a unit. change Preferences > Steps to this new widget (bzr r10177) --- src/extension/internal/bluredge.cpp | 8 ++--- src/gradient-context.cpp | 2 +- src/pen-context.cpp | 2 +- src/preferences-skeleton.h | 6 ++-- src/preferences.cpp | 44 +++++++++++++++++++++++ src/preferences.h | 62 +++++++++++++++++++++++++++------ src/select-context.cpp | 4 +-- src/splivarot.cpp | 6 ++-- src/ui/dialog/inkscape-preferences.cpp | 18 +++++----- src/ui/dialog/inkscape-preferences.h | 8 ++--- src/ui/tool/control-point-selection.cpp | 4 +-- src/ui/tool/path-manipulator.cpp | 2 +- src/ui/widget/preferences-widget.cpp | 39 +++++++++++++++++++++ src/ui/widget/preferences-widget.h | 16 +++++++++ src/ui/widget/scalar-unit.cpp | 16 +++++++++ src/ui/widget/scalar-unit.h | 2 ++ src/ui/widget/unit-menu.cpp | 13 +++++++ src/ui/widget/unit-menu.h | 1 + 18 files changed, 212 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 8ec09d11e..76582ab05 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -59,7 +59,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View int steps = module->get_param_int("num-steps"); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0); + double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); using Inkscape::Util::GSListConstIterator; // TODO need to properly refcount the items, at least @@ -97,10 +97,10 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View if (offset < 0.0) { /* Doing an inset here folks */ offset *= -1.0; - prefs->setDouble("/options/defaultoffsetwidth/value", offset); + prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(desktop), NULL); } else if (offset > 0.0) { - prefs->setDouble("/options/defaultoffsetwidth/value", offset); + prefs->setDoubleUnit("/options/defaultoffsetwidth/value", offset, "px"); sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(desktop), NULL); } @@ -110,7 +110,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View Inkscape::GC::release(new_group); } - prefs->setDouble("/options/defaultoffsetwidth/value", old_offset); + prefs->setDoubleUnit("/options/defaultoffsetwidth/value", old_offset, "px"); selection->clear(); selection->add(items.begin(), items.end()); diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index b98ae09fc..007fa549a 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -497,7 +497,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) SPGradientContext *rc = SP_GRADIENT_CONTEXT(event_context); event_context->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); - double const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000); // in px + double const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000, "px"); // in px GrDrag *drag = event_context->_grdrag; g_assert (drag); diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 607bdaedc..64137d56f 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -989,7 +989,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event) gint ret = FALSE; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gdouble const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000); // in px + gdouble const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000, "px"); // in px switch (get_group0_keyval (&event->key)) { diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 124a2ae51..62744bd53 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -238,7 +238,7 @@ static char const preferences_skeleton[] = " " " " " " -" \n" +" \n" " \n" " \n" " \n" @@ -258,8 +258,8 @@ static char const preferences_skeleton[] = " preserveblack=\"0\"\n" " uri=\"\" />\n" " \n" -" \n" -" \n" +" \n" +" \n" " \n" " \n" " \n" diff --git a/src/preferences.cpp b/src/preferences.cpp index 94fbc7257..444acfcac 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -23,6 +23,7 @@ #include "xml/node-observer.h" #include "xml/node-iterators.h" #include "xml/attribute-record.h" +#include "util/units.h" #define PREFERENCES_FILE_NAME "preferences.xml" @@ -452,6 +453,22 @@ void Preferences::setDouble(Glib::ustring const &pref_path, double value) _setRawValue(pref_path, buf); } +/** + * Set a floating point attribute of a preference. + * + * @param pref_path Path of the preference to modify. + * @param value The new value of the pref attribute. + * @param unit_abbr The string of the unit (abbreviated). + */ +void Preferences::setDoubleUnit(Glib::ustring const &pref_path, double value, Glib::ustring const &unit_abbr) +{ + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; + g_ascii_dtostr(buf, G_ASCII_DTOSTR_BUF_SIZE, value); + Glib::ustring str(buf); + str += unit_abbr; + _setRawValue(pref_path, str.c_str()); +} + void Preferences::setColor(Glib::ustring const &pref_path, guint32 value) { gchar buf[16]; @@ -745,11 +762,38 @@ double Preferences::_extractDouble(Entry const &v) return g_ascii_strtod(s, NULL); } +double Preferences::_extractDouble(Entry const &v, Glib::ustring const &requested_unit) +{ + static Inkscape::Util::UnitTable unit_table; // load the unit_table once by making it static + + double val = _extractDouble(v); + Glib::ustring unit = _extractUnit(v); + + return val * (unit_table.getUnit(unit).factor / unit_table.getUnit(requested_unit).factor); +} + Glib::ustring Preferences::_extractString(Entry const &v) { return Glib::ustring(static_cast(v._value)); } +Glib::ustring Preferences::_extractUnit(Entry const &v) +{ + gchar const *str = static_cast(v._value); + gchar const *e; + g_ascii_strtod(str, (char **) &e); + if (e == str) { + return ""; + } + + if (e[0] == 0) { + /* Unitless */ + return ""; + } else { + return Glib::ustring(e); + } +} + guint32 Preferences::_extractColor(Entry const &v) { gchar const *s = static_cast(v._value); diff --git a/src/preferences.h b/src/preferences.h index c79a7377d..64bb6ac4f 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -159,9 +159,10 @@ public: /** * Interpret the preference as a floating point value. * - * @param def Default value if the preference is not set. + * @param def Default value if the preference is not set. + * @param unit Specifies the unit of the returned result. Will be ignored when equal to "". If the preference has no unit set, the default unit will be assumed. */ - inline double getDouble(double def=0.0) const; + inline double getDouble(double def=0.0, Glib::ustring const &unit = "") const; /** * Interpret the preference as a limited floating point value. @@ -172,8 +173,9 @@ public: * @param def Default value if the preference is not set. * @param min Minimum value allowed to return. * @param max Maximum value allowed to return. + * @param unit Specifies the unit of the returned result. Will be ignored when equal to "". If the preference has no unit set, the default unit will be assumed. */ - inline double getDoubleLimited(double def=0.0, double min=DBL_MIN, double max=DBL_MAX) const; + inline double getDoubleLimited(double def=0.0, double min=DBL_MIN, double max=DBL_MAX, Glib::ustring const &unit = "") const; /** * Interpret the preference as an UTF-8 string. @@ -182,6 +184,11 @@ public: */ inline Glib::ustring getString() const; + /** + * Interpret the preference as a number followed by a unit (without space), and return this unit string. + */ + inline Glib::ustring getUnit() const; + /** * Interpret the preference as an RGBA color value. */ @@ -316,8 +323,8 @@ public: return getEntry(pref_path).getIntLimited(def, min, max); } - double getDouble(Glib::ustring const &pref_path, double def=0.0) { - return getEntry(pref_path).getDouble(def); + double getDouble(Glib::ustring const &pref_path, double def=0.0, Glib::ustring const &unit = "") { + return getEntry(pref_path).getDouble(def, unit); } /** @@ -330,9 +337,10 @@ public: * @param def The default value to return if the preference is not set. * @param min Minimum value to return. * @param max Maximum value to return. + * @param unit Specifies the unit of the returned result. Will be ignored when equal to "". If the preference has no unit set, the default unit will be assumed. */ - double getDoubleLimited(Glib::ustring const &pref_path, double def=0.0, double min=DBL_MIN, double max=DBL_MAX) { - return getEntry(pref_path).getDoubleLimited(def, min, max); + double getDoubleLimited(Glib::ustring const &pref_path, double def=0.0, double min=DBL_MIN, double max=DBL_MAX, Glib::ustring const &unit = "") { + return getEntry(pref_path).getDoubleLimited(def, min, max, unit); } /** @@ -344,6 +352,15 @@ public: return getEntry(pref_path).getString(); } + /** + * Retrieve the unit string. + * + * @param pref_path Path to the retrieved preference. + */ + Glib::ustring getUnit(Glib::ustring const &pref_path) { + return getEntry(pref_path).getUnit(); + } + guint32 getColor(Glib::ustring const &pref_path, guint32 def=0x000000ff) { return getEntry(pref_path).getColor(def); } @@ -398,6 +415,11 @@ public: */ void setDouble(Glib::ustring const &pref_path, double value); + /** + * Set a floating point value with unit. + */ + void setDoubleUnit(Glib::ustring const &pref_path, double value, Glib::ustring const &unit_abbr); + /** * Set an UTF-8 string value. */ @@ -484,7 +506,9 @@ protected: bool _extractBool(Entry const &v); int _extractInt(Entry const &v); double _extractDouble(Entry const &v); + double _extractDouble(Entry const &v, Glib::ustring const &requested_unit); Glib::ustring _extractString(Entry const &v); + Glib::ustring _extractUnit(Entry const &v); guint32 _extractColor(Entry const &v); SPCSSAttr *_extractStyle(Entry const &v); SPCSSAttr *_extractInheritedStyle(Entry const &v); @@ -566,21 +590,28 @@ inline int Preferences::Entry::getIntLimited(int def, int min, int max) const } } -inline double Preferences::Entry::getDouble(double def) const +inline double Preferences::Entry::getDouble(double def, Glib::ustring const &unit) const { if (!this->isValid()) { return def; - } else { + } else if (unit.length() == 0) { return Inkscape::Preferences::get()->_extractDouble(*this); + } else { + return Inkscape::Preferences::get()->_extractDouble(*this, unit); } } -inline double Preferences::Entry::getDoubleLimited(double def, double min, double max) const +inline double Preferences::Entry::getDoubleLimited(double def, double min, double max, Glib::ustring const &unit) const { if (!this->isValid()) { return def; } else { - double val = Inkscape::Preferences::get()->_extractDouble(*this); + double val = def; + if (unit.length() == 0) { + val = Inkscape::Preferences::get()->_extractDouble(*this); + } else { + val = Inkscape::Preferences::get()->_extractDouble(*this, unit); + } return ( val >= min && val <= max ? val : def ); } } @@ -594,6 +625,15 @@ inline Glib::ustring Preferences::Entry::getString() const } } +inline Glib::ustring Preferences::Entry::getUnit() const +{ + if (!this->isValid()) { + return ""; + } else { + return Inkscape::Preferences::get()->_extractUnit(*this); + } +} + inline guint32 Preferences::Entry::getColor(guint32 def) const { if (!this->isValid()) { diff --git a/src/select-context.cpp b/src/select-context.cpp index e6d78975b..640aae9ee 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -867,8 +867,8 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) } } - gdouble const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000); // in px - gdouble const offset = prefs->getDoubleLimited("/options/defaultscale/value", 2, 0, 1000); + gdouble const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000, "px"); // in px + gdouble const offset = prefs->getDoubleLimited("/options/defaultscale/value", 2, 0, 1000, "px"); int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); switch (get_group0_keyval (&event->key)) { diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 0e27ce26d..ac2acf330 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -1264,7 +1264,7 @@ void sp_selected_path_offset(SPDesktop *desktop) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double prefOffset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0); + double prefOffset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); sp_selected_path_do_offset(desktop, true, prefOffset); } @@ -1272,7 +1272,7 @@ void sp_selected_path_inset(SPDesktop *desktop) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double prefOffset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0); + double prefOffset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); sp_selected_path_do_offset(desktop, false, prefOffset); } @@ -1398,7 +1398,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - o_width = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0); + o_width = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); } if (o_width < 0.01) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 7963dd512..81bd4dba0 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -249,17 +249,17 @@ void InkscapePreferences::initPageSteps() { this->AddPage(_page_steps, _("Steps"), PREFS_PAGE_STEPS); - _steps_arrow.init ( "/options/nudgedistance/value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false); + _steps_arrow.init ( "/options/nudgedistance/value", 0.0, 1000.0, 0.01, 2.0, UNIT_TYPE_LINEAR, "px"); //nudgedistance is limited to 1000 in select-context.cpp: use the same limit here - _page_steps.add_line( false, _("Arrow keys move by:"), _steps_arrow, _("px"), - _("Pressing an arrow key moves selected object(s) or node(s) by this distance (in px units)"), false); - _steps_scale.init ( "/options/defaultscale/value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false); + _page_steps.add_line( false, _("Arrow keys move by:"), _steps_arrow, "", + _("Pressing an arrow key moves selected object(s) or node(s) by this distance"), false); + _steps_scale.init ( "/options/defaultscale/value", 0.0, 1000.0, 0.01, 2.0, UNIT_TYPE_LINEAR, "px"); //defaultscale is limited to 1000 in select-context.cpp: use the same limit here - _page_steps.add_line( false, _("> and < scale by:"), _steps_scale, _("px"), - _("Pressing > or < scales selection up or down by this increment (in px units)"), false); - _steps_inset.init ( "/options/defaultoffsetwidth/value", 0.0, 3000.0, 0.01, 1.0, 2.0, false, false); - _page_steps.add_line( false, _("Inset/Outset by:"), _steps_inset, _("px"), - _("Inset and Outset commands displace the path by this distance (in px units)"), false); + _page_steps.add_line( false, _("> and < scale by:"), _steps_scale, "", + _("Pressing > or < scales selection up or down by this increment"), false); + _steps_inset.init ( "/options/defaultoffsetwidth/value", 0.0, 3000.0, 0.01, 2.0, UNIT_TYPE_LINEAR, "px"); + _page_steps.add_line( false, _("Inset/Outset by:"), _steps_inset, "", + _("Inset and Outset commands displace the path by this distance"), false); _steps_compass.init ( _("Compass-like display of angles"), "/options/compassangledisplay/value", true); _page_steps.add_line( false, "", _steps_compass, "", _("When on, angles are displayed with 0 at north, 0 to 360 range, positive clockwise; otherwise with 0 at east, -180 to 180 range, positive counterclockwise")); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index a20278551..eede9eafe 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -178,10 +178,10 @@ protected: UI::Widget::PrefCombo _steps_rot_snap; UI::Widget::PrefCheckButton _steps_compass; - UI::Widget::PrefSpinButton _steps_arrow; - UI::Widget::PrefSpinButton _steps_scale; - UI::Widget::PrefSpinButton _steps_inset; - UI::Widget::PrefSpinButton _steps_zoom; + UI::Widget::PrefSpinUnit _steps_arrow; + UI::Widget::PrefSpinUnit _steps_scale; + UI::Widget::PrefSpinUnit _steps_inset; + UI::Widget::PrefSpinButton _steps_zoom; UI::Widget::PrefRadioButton _t_sel_trans_obj; UI::Widget::PrefRadioButton _t_sel_trans_outl; diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index 1fb98d78f..13da4a712 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -432,7 +432,7 @@ bool ControlPointSelection::_keyboardMove(GdkEventKey const &event, Geom::Point delta /= _desktop->current_zoom(); } else { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000); + double nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000, "px"); delta *= nudge; } @@ -533,7 +533,7 @@ bool ControlPointSelection::_keyboardScale(GdkEventKey const &event, int dir) length_change = 1.0 / _desktop->current_zoom() * dir; } else { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - length_change = prefs->getDoubleLimited("/options/defaultscale/value", 2, 1, 1000); + length_change = prefs->getDoubleLimited("/options/defaultscale/value", 2, 1, 1000, "px"); length_change *= dir; } double scale = (maxext + length_change) / maxext; diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 7c2013872..52286c6cc 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -727,7 +727,7 @@ void PathManipulator::scaleHandle(Node *n, int which, int dir, bool pixel) length_change = 1.0 / _desktop->current_zoom() * dir; } else { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - length_change = prefs->getDoubleLimited("/options/defaultscale/value", 2, 1, 1000); + length_change = prefs->getDoubleLimited("/options/defaultscale/value", 2, 1, 1000, "px"); length_change *= dir; } diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index f92e2518d..9cf80153a 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -255,6 +255,45 @@ void PrefSpinButton::on_value_changed() } } +void PrefSpinUnit::init(Glib::ustring const &prefs_path, + double lower, double upper, double step_increment, + double default_value, UnitType unit_type, Glib::ustring const &default_unit) +{ + _prefs_path = prefs_path; + _is_percent = (unit_type == UNIT_TYPE_DIMENSIONLESS); + + setUnitType(unit_type); + setUnit(default_unit); + setRange (lower, upper); /// @fixme this disregards changes of units + setIncrements (step_increment, 0); + if (step_increment < 0.1) { + setDigits(4); + } else { + setDigits(2); + } + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + double value = prefs->getDoubleLimited(prefs_path, default_value, lower, upper); + Glib::ustring unitstr = prefs->getUnit(prefs_path); + if (unitstr.length() == 0) { + unitstr = default_unit; + // write the assumed unit to preferences: + prefs->setDoubleUnit(_prefs_path, value, unitstr); + } + setValue(value, unitstr); + + signal_value_changed().connect_notify(sigc::mem_fun(*this, &PrefSpinUnit::on_my_value_changed)); +} + +void PrefSpinUnit::on_my_value_changed() +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (getWidget()->is_visible()) //only take action if user changed value + { + prefs->setDoubleUnit(_prefs_path, getValue(getUnit().abbr), getUnit().abbr); + } +} + const double ZoomCorrRuler::textsize = 7; const double ZoomCorrRuler::textpadding = 5; diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 758ab38cd..6caab11ae 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -33,6 +33,7 @@ #include "ui/widget/color-picker.h" #include "ui/widget/unit-menu.h" #include "ui/widget/spinbutton.h" +#include "ui/widget/scalar-unit.h" namespace Inkscape { namespace UI { @@ -82,6 +83,21 @@ protected: void on_value_changed(); }; +class PrefSpinUnit : public ScalarUnit +{ +public: + PrefSpinUnit() : ScalarUnit("", "") {}; + + void init(Glib::ustring const &prefs_path, + double lower, double upper, double step_increment, + double default_value, + UnitType unit_type, Glib::ustring const &default_unit); +protected: + Glib::ustring _prefs_path; + bool _is_percent; + void on_my_value_changed(); +}; + class ZoomCorrRuler : public Gtk::DrawingArea { public: ZoomCorrRuler(int width = 100, int height = 20); diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index e713f3e06..1c0fdff68 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -130,6 +130,22 @@ ScalarUnit::setUnit(Glib::ustring const &unit) { return true; } +/** Adds the unit type to the ScalarUnit widget */ +void +ScalarUnit::setUnitType(UnitType unit_type) { + g_assert(_unit_menu != NULL); + _unit_menu->setUnitType(unit_type); + lastUnits = _unit_menu->getUnitAbbr(); +} + +/** Resets the unit type for the ScalarUnit widget */ +void +ScalarUnit::resetUnitType(UnitType unit_type) { + g_assert(_unit_menu != NULL); + _unit_menu->resetUnitType(unit_type); + lastUnits = _unit_menu->getUnitAbbr(); +} + /** Gets the object for the currently selected unit */ Unit ScalarUnit::getUnit() const { diff --git a/src/ui/widget/scalar-unit.h b/src/ui/widget/scalar-unit.h index 4e08d63f4..ed3728e69 100644 --- a/src/ui/widget/scalar-unit.h +++ b/src/ui/widget/scalar-unit.h @@ -45,6 +45,8 @@ public: double getValue(Glib::ustring const &units) const; bool setUnit(Glib::ustring const &units); + void setUnitType(UnitType unit_type); + void resetUnitType(UnitType unit_type); void setValue(double number, Glib::ustring const &units); void setValueKeepUnit(double number, Glib::ustring const &units); void setValue(double number); diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp index b4271762c..5c68f7196 100644 --- a/src/ui/widget/unit-menu.cpp +++ b/src/ui/widget/unit-menu.cpp @@ -54,6 +54,19 @@ UnitMenu::setUnitType(UnitType unit_type) return true; } +/** Removes all unit entries, then adds the unit type to the widget. + This extracts the corresponding + units from the unit map matching the given type, and appends them + to the dropdown widget. It causes the primary unit for the given + unit_type to be selected. */ +bool +UnitMenu::resetUnitType(UnitType unit_type) +{ + clear_text(); + + return setUnitType(unit_type); +} + /** Returns the Unit object corresponding to the current selection in the dropdown widget */ Unit diff --git a/src/ui/widget/unit-menu.h b/src/ui/widget/unit-menu.h index 60a9702b4..efeb10ead 100644 --- a/src/ui/widget/unit-menu.h +++ b/src/ui/widget/unit-menu.h @@ -28,6 +28,7 @@ public: virtual ~UnitMenu(); bool setUnitType(UnitType unit_type); + bool resetUnitType(UnitType unit_type); bool setUnit(Glib::ustring const &unit); -- cgit v1.2.3 From 6d0280ef0e02c447a9dfb5c91a1a506cee2333b6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Apr 2011 15:31:32 +0200 Subject: fix duplicate units in Preferences > Steps (bzr r10178) --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 9cf80153a..68faa3c66 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -262,7 +262,7 @@ void PrefSpinUnit::init(Glib::ustring const &prefs_path, _prefs_path = prefs_path; _is_percent = (unit_type == UNIT_TYPE_DIMENSIONLESS); - setUnitType(unit_type); + resetUnitType(unit_type); setUnit(default_unit); setRange (lower, upper); /// @fixme this disregards changes of units setIncrements (step_increment, 0); -- cgit v1.2.3 From 899a64ccd59dfede80a93501e5ef13b5f0a724d0 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 17 Apr 2011 16:32:40 -0700 Subject: Restore comment needed in *shared* code file. (bzr r10179) --- src/ege-adjustment-action.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index bfab201f4..0a4dde320 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -39,6 +39,8 @@ * * ***** END LICENSE BLOCK ***** */ +/* Note: this file should be kept compilable as both .cpp and .c */ + #include #include -- cgit v1.2.3 From 1feebda40c5bcd8890794fb271989e8673875460 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 18 Apr 2011 23:36:02 +0200 Subject: Added mnemonics for font dialog (Bug #170765) (bzr r10182) --- src/dialogs/text-edit.cpp | 11 +++++------ src/widgets/font-selector.cpp | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index d741e2de0..d46f62d17 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -203,7 +203,7 @@ sp_text_edit_dialog (void) // Font tab { - GtkWidget *l = gtk_label_new (_("Font")); + GtkWidget *l = gtk_label_new_with_mnemonic (_("_Font")); GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN); gtk_container_set_border_width (GTK_CONTAINER (vb), VB_MARGIN); gtk_notebook_append_page (GTK_NOTEBOOK (nb), vb, l); @@ -330,7 +330,7 @@ sp_text_edit_dialog (void) gtk_box_pack_start (GTK_BOX (l_vb), row, FALSE, FALSE, 0); } - + { GtkWidget *row = gtk_hbox_new (FALSE, VB_MARGIN); @@ -343,7 +343,6 @@ sp_text_edit_dialog (void) { GtkWidget *row = gtk_hbox_new (FALSE, VB_MARGIN); - GtkWidget *c = gtk_combo_new (); gtk_combo_set_value_in_list ((GtkCombo *) c, FALSE, FALSE); gtk_combo_set_use_arrows ((GtkCombo *) c, TRUE); @@ -359,7 +358,7 @@ sp_text_edit_dialog (void) gtk_combo_set_popdown_strings ((GtkCombo *) c, sl); g_list_free (sl); } - + g_signal_connect ( (GObject *) ((GtkCombo *) c)->entry, "changed", (GCallback) sp_text_edit_dialog_line_spacing_changed, @@ -380,7 +379,7 @@ sp_text_edit_dialog (void) // Text tab { - GtkWidget *l = gtk_label_new (_("Text")); + GtkWidget *l = gtk_label_new_with_mnemonic (_("_Text")); GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN); gtk_container_set_border_width (GTK_CONTAINER (vb), VB_MARGIN); gtk_notebook_append_page (GTK_NOTEBOOK (nb), vb, l); @@ -427,7 +426,7 @@ sp_text_edit_dialog (void) gtk_box_pack_start (GTK_BOX (mainvb), hb, FALSE, FALSE, 0); { - GtkWidget *b = gtk_button_new_with_label (_("Set as default")); + GtkWidget *b = gtk_button_new_with_mnemonic (_("Set as _default")); g_signal_connect ( G_OBJECT (b), "clicked", G_CALLBACK (sp_text_edit_dialog_set_default), dlg ); diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 71e9563cd..6cc73e42f 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -154,7 +154,10 @@ static void sp_font_selector_init(SPFontSelector *fsel) gtk_box_set_spacing(GTK_BOX(fsel), 4); /* Family frame */ - GtkWidget *f = gtk_frame_new(_("Font family")); + GtkWidget *ft = gtk_label_new_with_mnemonic(_("F_ont family")); + GtkWidget *f = gtk_frame_new(NULL); + gtk_frame_set_label_widget ((GtkFrame*)f, ft); + gtk_widget_show (f); gtk_box_pack_start (GTK_BOX(fsel), f, TRUE, TRUE, 0); @@ -178,6 +181,7 @@ static void sp_font_selector_init(SPFontSelector *fsel) gtk_tree_view_set_model (GTK_TREE_VIEW(fsel->family_treeview), GTK_TREE_MODEL (Glib::unwrap (store))); gtk_container_add(GTK_CONTAINER(sw), fsel->family_treeview); gtk_widget_show_all (sw); + gtk_label_set_mnemonic_widget((GtkLabel*)ft, fsel->family_treeview); GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(fsel->family_treeview)); g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (sp_font_selector_family_select_row), fsel); @@ -185,7 +189,9 @@ static void sp_font_selector_init(SPFontSelector *fsel) /* Style frame */ - f = gtk_frame_new(C_("Font selector", "Style")); + ft = gtk_label_new_with_mnemonic(C_("Font selector", "_Style")); + f = gtk_frame_new(NULL); + gtk_frame_set_label_widget ((GtkFrame*)f, ft); gtk_widget_show(f); gtk_box_pack_start(GTK_BOX (fsel), f, TRUE, TRUE, 0); @@ -210,6 +216,7 @@ static void sp_font_selector_init(SPFontSelector *fsel) gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(fsel->style_treeview), FALSE); gtk_container_add(GTK_CONTAINER(sw), fsel->style_treeview); gtk_widget_show_all (sw); + gtk_label_set_mnemonic_widget((GtkLabel*)ft, fsel->style_treeview); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(fsel->style_treeview)); g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (sp_font_selector_style_select_row), fsel); @@ -223,13 +230,14 @@ static void sp_font_selector_init(SPFontSelector *fsel) g_signal_connect (G_OBJECT(fsel->size), "changed", G_CALLBACK (sp_font_selector_size_changed), fsel); gtk_box_pack_end (GTK_BOX(hb), fsel->size, FALSE, FALSE, 0); - GtkWidget *l = gtk_label_new(_("Font size:")); + GtkWidget *l = gtk_label_new_with_mnemonic(_("Font si_ze:")); gtk_widget_show_all (l); gtk_box_pack_end(GTK_BOX (hb), l, FALSE, FALSE, 0); + gtk_label_set_mnemonic_widget((GtkLabel*)l, fsel->size); for (unsigned int n = 0; sizes[n]; ++n) { - gtk_combo_box_append_text (GTK_COMBO_BOX(fsel->size), sizes[n]); + gtk_combo_box_append_text ((GtkComboBox *)fsel->size, sizes[n]); } gtk_widget_show_all (fsel->size); -- cgit v1.2.3 From 84766315ff4f59563bc8e6e100b6fc1d435df6f7 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 18 Apr 2011 23:14:35 -0700 Subject: Restore modularity to adjustment action. (bzr r10184) --- src/ege-adjustment-action.cpp | 47 +++++++++++++++++++++++------------------- src/ege-adjustment-action.h | 18 ++++++++++++++++ src/widgets/select-toolbar.cpp | 17 +++++++++++++++ src/widgets/toolbox.cpp | 15 ++++++++++++++ 4 files changed, 76 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 0a4dde320..9c01b4c7c 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -1,5 +1,3 @@ - - /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * */ @@ -64,8 +62,6 @@ #include "icon-size.h" #include "ege-adjustment-action.h" -#include "ui/widget/spinbutton.h" - static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ); static void ege_adjustment_action_init( EgeAdjustmentAction* action ); @@ -89,14 +85,15 @@ static void egeAct_free_all_descriptions( EgeAdjustmentAction* action ); static GtkActionClass* gParentClass = 0; +static EgeCreateAdjWidgetCB gFactoryCb = 0; static GQuark gDataName = 0; enum { APPEARANCE_UNKNOWN = -1, APPEARANCE_NONE = 0, - APPEARANCE_FULL, // label, then all choices represented by separate buttons - APPEARANCE_COMPACT, // label, then choices in a drop-down menu - APPEARANCE_MINIMAL, // no label, just choices in a drop-down menu + APPEARANCE_FULL, /* label, then all choices represented by separate buttons */ + APPEARANCE_COMPACT, /* label, then choices in a drop-down menu */ + APPEARANCE_MINIMAL, /* no label, just choices in a drop-down menu */ }; #if GTK_CHECK_VERSION(2,12,0) @@ -197,6 +194,7 @@ static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ) gDataName = g_quark_from_string("ege-adj-action"); + objClass->finalize = ege_adjustment_action_finalize; objClass->get_property = ege_adjustment_action_get_property; @@ -283,6 +281,11 @@ static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ) } } +void ege_adjustment_action_set_compact_tool_factory( EgeCreateAdjWidgetCB factoryCb ) +{ + gFactoryCb = factoryCb; +} + static void ege_adjustment_action_init( EgeAdjustmentAction* action ) { action->private_data = EGE_ADJUSTMENT_ACTION_GET_PRIVATE( action ); @@ -383,11 +386,11 @@ static void ege_adjustment_action_get_property( GObject* obj, guint propId, GVal case PROP_ICON_ID: g_value_set_string( value, action->private_data->iconId ); - break; + break; case PROP_ICON_SIZE: g_value_set_int( value, action->private_data->iconSize ); - break; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec ); @@ -836,7 +839,7 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_object_get_property( G_OBJECT(action), "short_label", &value ); if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { - // Slider + /* Slider */ gchar *leakyForNow = g_value_dup_string( &value ); spinbutton = gtk_hscale_new( act->private_data->adj); gtk_widget_set_size_request(spinbutton, 100, -1); @@ -850,9 +853,11 @@ static GtkWidget* create_tool_item( GtkAction* action ) gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); #endif /* GTK_CHECK_VERSION(2,12,0) */ } else { - //spinbutton = gtk_spin_button_new( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); - Inkscape::UI::Widget::SpinButton *inkscape_spinbutton = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(act->private_data->adj, true), act->private_data->climbRate, act->private_data->digits); - spinbutton = GTK_WIDGET( inkscape_spinbutton->gobj() ); + if ( gFactoryCb ) { + spinbutton = gFactoryCb( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); + } else { + spinbutton = gtk_spin_button_new( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); + } } item = GTK_WIDGET( gtk_tool_item_new() ); @@ -869,22 +874,22 @@ static GtkWidget* create_tool_item( GtkAction* action ) } gtk_tooltips_set_tip( act->private_data->toolTips, spinbutton, tipstr, 0 ); } - g_value_unset( &tooltip ); + g_value_unset( &tooltip ); } if ( act->private_data->appearanceMode != APPEARANCE_FULL ) { - GtkWidget* filler1 = gtk_label_new(" "); - gtk_box_pack_start( GTK_BOX(hb), filler1, FALSE, FALSE, 0 ); + GtkWidget* filler1 = gtk_label_new(" "); + gtk_box_pack_start( GTK_BOX(hb), filler1, FALSE, FALSE, 0 ); - // Use an icon if available or use short-label - if ( act->private_data->iconId && strcmp( act->private_data->iconId, "" ) != 0 ) { + /* Use an icon if available or use short-label */ + if ( act->private_data->iconId && strcmp( act->private_data->iconId, "" ) != 0 ) { GtkWidget* icon = sp_icon_new( act->private_data->iconSize, act->private_data->iconId ); gtk_box_pack_start( GTK_BOX(hb), icon, FALSE, FALSE, 0 ); - } else { + } else { GtkWidget* lbl = gtk_label_new( g_value_get_string( &value ) ? g_value_get_string( &value ) : "wwww" ); gtk_misc_set_alignment( GTK_MISC(lbl), 1.0, 0.5 ); gtk_box_pack_start( GTK_BOX(hb), lbl, FALSE, FALSE, 0 ); - } + } } if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { @@ -923,7 +928,7 @@ static GtkWidget* create_tool_item( GtkAction* action ) act->private_data->toolPost( item ); } - g_value_unset( &value ); + g_value_unset( &value ); } else { item = gParentClass->create_tool_item( action ); } diff --git a/src/ege-adjustment-action.h b/src/ege-adjustment-action.h index 4a8a172e2..b7da6a499 100644 --- a/src/ege-adjustment-action.h +++ b/src/ege-adjustment-action.h @@ -87,6 +87,24 @@ struct _EgeAdjustmentActionClass /** Standard Gtk type function */ GType ege_adjustment_action_get_type( void ); + +/* + * Note: This normally could be implemented via a GType property for the class to construct, + * but gtkmm classes implemented in C++ only will often not funciton properly. + * + */ + +/** Callback type for widgets creation factory */ +typedef GtkWidget* (*EgeCreateAdjWidgetCB)( GtkAdjustment *adjustment, gdouble climb_rate, guint digits ); + +/** + * Sets a factory callback to be used to create the specific widget. + * + * @param factoryCb the callback to use to create custom widgets, NULL to use the default. + */ +void ege_adjustment_action_set_compact_tool_factory( EgeCreateAdjWidgetCB factoryCb ); + + /** * Creates a new EgeAdjustmentAction instance. * This is a GtkAction subclass that manages a value stored in a diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 89253983b..e08b4ac61 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -23,6 +23,7 @@ #include "widgets/spw-utilities.h" #include "widgets/widget-sizes.h" #include "widgets/spinbutton-events.h" +#include "ui/widget/spinbutton.h" #include "widgets/icon.h" #include "widgets/sp-widget.h" @@ -255,6 +256,16 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE)); } +static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits ) +{ + Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits); + inkSpinner = Gtk::manage( inkSpinner ); + GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() ); + return widget; +} + +// TODO create_adjustment_action appears to be a rogue tile copy from toolbox.cpp. Resolve it to be unified: + static EgeAdjustmentAction * create_adjustment_action( gchar const *name, gchar const *label, gchar const *shortLabel, @@ -266,6 +277,12 @@ static EgeAdjustmentAction * create_adjustment_action( gchar const *name, gchar const *tooltip, gboolean altx ) { + static bool init = false; + if ( !init ) { + init = true; + ege_adjustment_action_set_compact_tool_factory( createCustomSlider ); + } + GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, lower, 1e6, SPIN_STEP, SPIN_PAGE_STEP, 0 ) ); if (tracker) { tracker->addAdjustment(adj); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index fe87bc4e2..8496ec0d0 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -100,6 +100,7 @@ #include "../verbs.h" #include "../widgets/button.h" #include "../widgets/spinbutton-events.h" +#include "ui/widget/spinbutton.h" #include "../widgets/spw-utilities.h" #include "../widgets/widget-sizes.h" #include "../xml/attribute-record.h" @@ -1052,6 +1053,14 @@ GtkWidget *ToolboxFactory::createSnapToolbox() return toolboxNewCommon( tb, BAR_SNAP, GTK_POS_LEFT ); } +static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits ) +{ + Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits); + inkSpinner = Gtk::manage( inkSpinner ); + GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() ); + return widget; +} + static EgeAdjustmentAction * create_adjustment_action( gchar const *name, gchar const *label, gchar const *shortLabel, gchar const *tooltip, Glib::ustring const &path, gdouble def, @@ -1064,6 +1073,12 @@ static EgeAdjustmentAction * create_adjustment_action( gchar const *name, void (*callback)(GtkAdjustment *, GObject *), gdouble climb = 0.1, guint digits = 3, double factor = 1.0 ) { + static bool init = false; + if ( !init ) { + init = true; + ege_adjustment_action_set_compact_tool_factory( createCustomSlider ); + } + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); GtkAdjustment* adj = GTK_ADJUSTMENT( gtk_adjustment_new( prefs->getDouble(path, def) * factor, lower, upper, step, page, 0 ) ); -- cgit v1.2.3 From 6b38df080f453bfade2625985d2e6753e9a3f196 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 21 Apr 2011 17:14:10 +0200 Subject: UI. New mnemonics (see Bug #768277 , Add mnemonics for menu items without verbs / default key mapping). Fixed bugs: - https://launchpad.net/bugs/768277 (bzr r10187) --- src/interface.cpp | 6 +++--- src/menus-skeleton.h | 2 +- src/verbs.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/interface.cpp b/src/interface.cpp index 4ac82a509..f27700c25 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -829,11 +829,11 @@ sp_ui_checkboxes_menus(GtkMenu *m, Inkscape::UI::View::View *view) { //sp_ui_menu_append_check_item_from_verb(m, view, _("_Menu"), _("Show or hide the menu bar"), "menu", // checkitem_toggled, checkitem_update, 0); - sp_ui_menu_append_check_item_from_verb(m, view, _("Commands Bar"), _("Show or hide the Commands bar (under the menu)"), "commands", + sp_ui_menu_append_check_item_from_verb(m, view, _("_Commands Bar"), _("Show or hide the Commands bar (under the menu)"), "commands", checkitem_toggled, checkitem_update, 0); - sp_ui_menu_append_check_item_from_verb(m, view, _("Snap Controls Bar"), _("Show or hide the snapping controls"), "snaptoolbox", + sp_ui_menu_append_check_item_from_verb(m, view, _("Sn_ap Controls Bar"), _("Show or hide the snapping controls"), "snaptoolbox", checkitem_toggled, checkitem_update, 0); - sp_ui_menu_append_check_item_from_verb(m, view, _("Tool Controls Bar"), _("Show or hide the Tool Controls bar"), "toppanel", + sp_ui_menu_append_check_item_from_verb(m, view, _("T_ool Controls Bar"), _("Show or hide the Tool Controls bar"), "toppanel", checkitem_toggled, checkitem_update, 0); sp_ui_menu_append_check_item_from_verb(m, view, _("_Toolbox"), _("Show or hide the main toolbox (on the left)"), "toolbox", checkitem_toggled, checkitem_update, 0); diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index f1b633865..080163d48 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -126,7 +126,7 @@ static char const menus_skeleton[] = " \n" " \n" " \n" -" \n" +" \n" " \n" " \n" " \n" diff --git a/src/verbs.cpp b/src/verbs.cpp index 1ad68b792..4dbe15a03 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2298,7 +2298,7 @@ Verb *Verb::_base_verbs[] = { N_("Apply the path effect of the copied object to selection"), NULL), new EditVerb(SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, "RemoveLivePathEffect", N_("Remove Path _Effect"), N_("Remove any path effects from selected objects"), NULL), - new EditVerb(SP_VERB_EDIT_REMOVE_FILTER, "RemoveFilter", N_("Remove Filters"), + new EditVerb(SP_VERB_EDIT_REMOVE_FILTER, "RemoveFilter", N_("_Remove Filters"), N_("Remove any filters from selected objects"), NULL), new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"), N_("Delete selection"), GTK_STOCK_DELETE), @@ -2645,7 +2645,7 @@ Verb *Verb::_base_verbs[] = { N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON_DOCUMENT_METADATA ), new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."), N_("Edit objects' colors, gradients, arrowheads, and other fill and stroke properties..."), INKSCAPE_ICON_DIALOG_FILL_AND_STROKE), - new DialogVerb(SP_VERB_DIALOG_GLYPHS, "DialogGlyphs", N_("Glyphs..."), + new DialogVerb(SP_VERB_DIALOG_GLYPHS, "DialogGlyphs", N_("Gl_yphs..."), N_("Select characters from a glyphs palette"), GTK_STOCK_SELECT_FONT), // TRANSLATORS: "Swatches" means: color samples new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."), @@ -2690,7 +2690,7 @@ Verb *Verb::_base_verbs[] = { N_("View Layers"), INKSCAPE_ICON_DIALOG_LAYERS), new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path E_ffect Editor..."), N_("Manage, edit, and apply path effects"), NULL), - new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter Editor..."), + new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter _Editor..."), N_("Manage, edit, and apply SVG filters"), NULL), new DialogVerb(SP_VERB_DIALOG_SVG_FONTS, "DialogSVGFonts", N_("SVG Font Editor..."), N_("Edit SVG fonts"), NULL), @@ -2727,9 +2727,9 @@ Verb *Verb::_base_verbs[] = { N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/), /* Effect -- renamed Extension */ - new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Extension"), + new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Exte_nsion"), N_("Repeat the last extension with the same settings"), NULL), - new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Extension Settings..."), + new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("_Previous Extension Settings..."), N_("Repeat the last extension with new settings"), NULL), /* Fit Page */ -- cgit v1.2.3 From 51b899c859afdc3b0d7743e20b558bfc0e54c340 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 21 Apr 2011 20:04:14 +0200 Subject: Font Editor. Fix for Bug #706506 (Crash when kerning an empty pair). Fixed bugs: - https://launchpad.net/bugs/706506 (bzr r10189) --- src/ui/dialog/svg-fonts-dialog.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index d836bfa22..667d01de7 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -162,7 +162,10 @@ void GlyphComboBox::update(SPFont* spfont){ } void SvgFontsDialog::on_kerning_value_changed(){ - if (!this->kerning_pair) return; + if (!get_selected_kerning_pair()) { + return; + } + SPDocument* document = sp_desktop_document(this->getDesktop()); //TODO: I am unsure whether this is the correct way of calling SPDocumentUndo::maybe_done -- cgit v1.2.3 From fb8198311fa62b09e3fdad9546e92420825ebcd2 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 23 Apr 2011 15:18:35 -0700 Subject: Fixed warning to use GUI when appropriate. (bzr r10191) --- src/extension/system.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index cf58f2733..aa5731985 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -35,6 +35,8 @@ #include "implementation/xslt.h" #include "xml/rebase-hrefs.h" #include "io/sys.h" +#include "inkscape.h" + /* #include "implementation/plugin.h" */ namespace Inkscape { @@ -64,8 +66,7 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio * * Lastly, the open function is called in the module itself. */ -SPDocument * -open(Extension *key, gchar const *filename) +SPDocument *open(Extension *key, gchar const *filename) { Input *imod = NULL; if (key == NULL) { @@ -93,8 +94,9 @@ open(Extension *key, gchar const *filename) throw Input::open_failed(); } - if (!imod->prefs(filename)) + if (!imod->prefs(filename)) { return NULL; + } SPDocument *doc = imod->open(filename); if (!doc) { @@ -102,11 +104,11 @@ open(Extension *key, gchar const *filename) } if (last_chance_svg) { - /* We can't call sp_ui_error_dialog because we may be - running from the console, in which case calling sp_ui - routines will cause a segfault. See bug 1000350 - bryce */ - // sp_ui_error_dialog(_("Format autodetect failed. The file is being opened as SVG.")); - g_warning(_("Format autodetect failed. The file is being opened as SVG.")); + if ( inkscape_use_gui() ) { + sp_ui_error_dialog(_("Format autodetect failed. The file is being opened as SVG.")); + } else { + g_warning(_("Format autodetect failed. The file is being opened as SVG.")); + } } /* This kinda overkill as most of these are already set, but I want -- cgit v1.2.3 From 8362c4e0211ba58423d6f43de68d18bcc2454e40 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Wed, 27 Apr 2011 19:18:49 -0400 Subject: emf import. support for clip rectangle (Bug 383180) Fixed bugs: - https://launchpad.net/bugs/383180 (bzr r10193) --- src/extension/internal/emf-win32-inout.cpp | 67 +++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index cea68c6da..8aa26a213 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -82,6 +82,8 @@ namespace Extension { namespace Internal { static float device_scale = DEVICESCALE; +static RECTL rc_old; +static bool clipset = false; EmfWin32::EmfWin32 (void) // The null constructor { @@ -205,6 +207,7 @@ typedef struct emf_device_context { typedef struct emf_callback_data { Glib::ustring *outsvg; Glib::ustring *path; + Glib::ustring *outdef; EMF_DEVICE_CONTEXT dc[EMF_MAX_DC+1]; // FIXME: This should be dynamic.. int level; @@ -311,6 +314,9 @@ output_style(PEMF_CALLBACK_DATA d, int iType) tmp_style << "stroke-opacity:1;"; } tmp_style << "\" "; + if (clipset) + tmp_style << "\n\tclip-path=\"url(#clipEmfPath" << d->id << ")\" "; + clipset = false; *(d->outsvg) += tmp_style.str().c_str(); } @@ -770,19 +776,20 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * { dbg_str << "\n"; - *(d->outsvg) += "\n"; + *(d->outdef) += "\n"; if (d->pDesc) { - *(d->outsvg) += "\n"; + *(d->outdef) += "\n"; } ENHMETAHEADER *pEmr = (ENHMETAHEADER *) lpEMFR; - tmp_outsvg << "xDPI = 2540; d->yDPI = 2540; @@ -800,15 +807,13 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * if (pEmr->szlMillimeters.cx && pEmr->szlDevice.cx) device_scale = PX_PER_MM*pEmr->szlMillimeters.cx/pEmr->szlDevice.cx; - tmp_outsvg << + tmp_outdef << " width=\"" << d->MMX << "mm\"\n" << " height=\"" << d->MMY << "mm\">\n"; -// tmp_outsvg << -// " id=\"" << (d->id++) << "\">\n"; + *(d->outdef) += tmp_outdef.str().c_str(); + *(d->outdef) += ""; // temporary end of header - tmp_outsvg << "\n"; -// "id++) << "\">\n"; + tmp_outsvg << "\n\n\n"; // start of main body if (pEmr->nHandles) { d->n_obj = pEmr->nHandles; @@ -1152,6 +1157,7 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * assert_empty_path(d, "EMR_EOF"); tmp_outsvg << "\n"; tmp_outsvg << "\n"; + *(d->outsvg) = *(d->outdef) + *(d->outsvg); break; } case EMR_SETPIXELV: @@ -1234,8 +1240,37 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const * dbg_str << "\n"; break; case EMR_INTERSECTCLIPRECT: + { dbg_str << "\n"; + + PEMRINTERSECTCLIPRECT pEmr = (PEMRINTERSECTCLIPRECT) lpEMFR; + RECTL rc = pEmr->rclClip; + clipset = true; + if ((rc.left == rc_old.left) && (rc.top == rc_old.top) && (rc.right == rc_old.right) && (rc.bottom == rc_old.bottom)) + break; + rc_old = rc; + + double l = pix_to_x_point( d, rc.left, rc.top ); + double t = pix_to_y_point( d, rc.left, rc.top ); + double r = pix_to_x_point( d, rc.right, rc.bottom ); + double b = pix_to_y_point( d, rc.right, rc.bottom ); + + SVGOStringStream tmp_rectangle; + tmp_rectangle << "\nid) << "\" >"; + tmp_rectangle << "\n"; + tmp_rectangle << "\n"; + + assert_empty_path(d, "EMR_RECTANGLE"); + + *(d->outdef) += tmp_rectangle.str().c_str(); + *(d->path) = ""; break; + } case EMR_SCALEVIEWPORTEXTEX: dbg_str << "\n"; break; @@ -2273,6 +2308,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.outsvg = new Glib::ustring(""); d.path = new Glib::ustring(""); + d.outdef = new Glib::ustring(""); CHAR *ansi_uri = (CHAR *) local_fn; gunichar2 *unicode_fn = g_utf8_to_utf16( local_fn, -1, NULL, NULL, NULL ); @@ -2414,6 +2450,8 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) delete d.outsvg; if (d.path) delete d.path; + if (d.outdef) + delete d.outdef; if (local_fn) g_free(local_fn); if (unicode_fn) @@ -2455,6 +2493,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) delete d.outsvg; delete d.path; + delete d.outdef; if (d.emf_obj) { int i; -- cgit v1.2.3 From 7f81932011c4ad87db74d62a2843949f4a5a3ffe Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 1 May 2011 16:27:28 +0200 Subject: Fix crashes on empty marker definitions. Fixed bugs: - https://launchpad.net/bugs/774834 (bzr r10195) --- src/extension/internal/cairo-renderer.cpp | 12 +++++++----- src/sp-shape.cpp | 12 +++++++----- src/splivarot.cpp | 7 ++++++- 3 files changed, 20 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index dbda82c28..c7c9d3a61 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -170,11 +170,13 @@ static void sp_shape_render_invoke_marker_rendering(SPMarker* marker, Geom::Affi if (render) { SPItem* marker_item = sp_item_first_item_child(marker); - tr = (Geom::Affine)marker_item->transform * (Geom::Affine)marker->c2p * tr; - Geom::Affine old_tr = marker_item->transform; - marker_item->transform = tr; - ctx->getRenderer()->renderItem (ctx, marker_item); - marker_item->transform = old_tr; + if (marker_item) { + tr = (Geom::Affine)marker_item->transform * (Geom::Affine)marker->c2p * tr; + Geom::Affine old_tr = marker_item->transform; + marker_item->transform = tr; + ctx->getRenderer()->renderItem (ctx, marker_item); + marker_item->transform = old_tr; + } } } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 72559c63f..358e2a595 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -725,12 +725,14 @@ sp_shape_print_invoke_marker_printing(SPObject* obj, Geom::Affine tr, SPStyle* s } SPItem* marker_item = sp_item_first_item_child( marker ); - tr = marker_item->transform * marker->c2p * tr; + if (marker_item) { + tr = marker_item->transform * marker->c2p * tr; - Geom::Affine old_tr = marker_item->transform; - marker_item->transform = tr; - marker_item->invoke_print (ctx); - marker_item->transform = old_tr; + Geom::Affine old_tr = marker_item->transform; + marker_item->transform = tr; + marker_item->invoke_print (ctx); + marker_item->transform = old_tr; + } } /** * Prepares shape for printing. Handles printing of comments for printing diff --git a/src/splivarot.cpp b/src/splivarot.cpp index ac2acf330..5ff394782 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -607,6 +607,9 @@ void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Affine { SPMarker* marker = SP_MARKER (marker_object); SPItem* marker_item = sp_item_first_item_child(marker_object); + if (!marker_item) { + return; + } Geom::Affine tr(marker_transform); @@ -665,7 +668,9 @@ void item_outline_add_marker( SPObject const *marker_object, Geom::Affine marker tr = marker->c2p * tr; SPItem const * marker_item = sp_item_first_item_child(marker_object); // why only consider the first item? can a marker only consist of a single item (that may be a group)? - item_outline_add_marker_child(marker_item, tr, pathv_in); + if (marker_item) { + item_outline_add_marker_child(marker_item, tr, pathv_in); + } } /** -- cgit v1.2.3 From 58889caa38b152f64fa2968a121edbce44971838 Mon Sep 17 00:00:00 2001 From: Adib Taraben Date: Wed, 4 May 2011 22:45:08 +0200 Subject: more 63734242, missing fraction of patch for gcc 4.6 compatibility (bzr r10196) --- src/2geom/utils.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/2geom/utils.h b/src/2geom/utils.h index ecd1b7283..e90a4623b 100644 --- a/src/2geom/utils.h +++ b/src/2geom/utils.h @@ -33,6 +33,7 @@ * */ +#include #include namespace Geom { -- cgit v1.2.3 From b4a47c1fac39951baab9c209bcdae5914ff4bb3a Mon Sep 17 00:00:00 2001 From: Adib Taraben Date: Thu, 5 May 2011 23:42:21 +0200 Subject: symbol rendering fix for bug:705345 (bzr r10196.1.1) --- src/extension/internal/cairo-renderer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index c7c9d3a61..f5504d755 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -544,6 +544,9 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) if (SP_IS_ROOT(item)) { TRACE(("root\n")); return sp_root_render(item, ctx); + } else if (SP_IS_SYMBOL(item)) { + TRACE(("symbol\n")); + return sp_symbol_render(item, ctx); } else if (SP_IS_GROUP(item)) { TRACE(("group\n")); return sp_group_render(item, ctx); @@ -554,9 +557,6 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) TRACE(("use begin---\n")); sp_use_render(item, ctx); TRACE(("---use end\n")); - } else if (SP_IS_SYMBOL(item)) { - TRACE(("symbol\n")); - return sp_symbol_render(item, ctx); } else if (SP_IS_TEXT(item)) { TRACE(("text\n")); return sp_text_render(item, ctx); -- cgit v1.2.3 From a4d0a358424440128cd4c4fb2915ccc4b86f4587 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 5 May 2011 23:21:51 -0700 Subject: Adding initial cut of resource manager. (bzr r10198) --- src/Makefile_insert | 1 + src/desktop.cpp | 7 + src/desktop.h | 1 + src/dir-util.cpp | 218 +++++++++++++---------------- src/dir-util.h | 37 ++++- src/display/curve-test.h | 2 +- src/document-undo.h | 6 +- src/file.cpp | 28 ++-- src/inkscape.cpp | 2 + src/resource-manager.cpp | 272 ++++++++++++++++++++++++++++++++++++ src/resource-manager.h | 49 +++++++ src/sp-image.cpp | 71 ++++------ src/ui/view/edit-widget-interface.h | 4 + src/widgets/desktop-widget.cpp | 19 +++ src/widgets/desktop-widget.h | 7 + src/xml/Makefile_insert | 1 + src/xml/rebase-hrefs-test.h | 126 +++++++++++++++++ src/xml/rebase-hrefs.cpp | 231 +++++++++++++++--------------- src/xml/rebase-hrefs.h | 27 +++- src/xml/repr-action-test.h | 1 - src/xml/repr-io.cpp | 47 +++++-- src/xml/repr.h | 3 + 22 files changed, 840 insertions(+), 320 deletions(-) create mode 100644 src/resource-manager.cpp create mode 100644 src/resource-manager.h create mode 100644 src/xml/rebase-hrefs-test.h (limited to 'src') diff --git a/src/Makefile_insert b/src/Makefile_insert index 36c9de34f..3a3862437 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -123,6 +123,7 @@ ink_common_sources += \ removeoverlap.cpp removeoverlap.h \ rdf.cpp rdf.h \ rect-context.cpp rect-context.h \ + resource-manager.cpp resource-manager.h \ require-config.h \ round.h \ rubberband.cpp rubberband.h \ diff --git a/src/desktop.cpp b/src/desktop.cpp index a6224a71c..361ed7fea 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -87,6 +87,7 @@ #include "device-manager.h" #include "layer-fns.h" #include "layer-manager.h" +#include "resource-manager.h" #include "event-log.h" #include "display/canvas-grid.h" #include "widgets/desktop-widget.h" @@ -177,6 +178,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid // Temporary workaround for link order issues: Inkscape::DeviceManager::getManager().getDevices(); + Inkscape::ResourceManager::getManager(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _guides_message_context = new Inkscape::MessageContext(const_cast(messageStack())); @@ -1320,6 +1322,11 @@ SPDesktop::presentWindow() _widget->present(); } +bool SPDesktop::showInfoDialog( Glib::ustring const & message ) +{ + return _widget->showInfoDialog( message ); +} + bool SPDesktop::warnDialog (gchar *text) { diff --git a/src/desktop.h b/src/desktop.h index 947e92fe7..6d1bcd194 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -288,6 +288,7 @@ public: void setWindowTransient (void* p, int transient_policy=1); Gtk::Window* getToplevel(); void presentWindow(); + bool showInfoDialog( Glib::ustring const &message ); bool warnDialog (gchar *text); void toggleRulers(); void toggleScrollbars(); diff --git a/src/dir-util.cpp b/src/dir-util.cpp index 67db03628..acec39953 100644 --- a/src/dir-util.cpp +++ b/src/dir-util.cpp @@ -1,9 +1,8 @@ -/** @file - * @brief Utility functions for filenames +/** + * @file + * Utility functions for filenames. */ -#define DIR_UTIL_C - #include #include #include @@ -13,49 +12,37 @@ #include #include -/** Returns a form of \a path relative to \a base if that is easy to construct (e.g. if \a path - appears to be in the directory specified by \a base), otherwise returns \a path. - - N.B. The return value is a pointer into the \a path string. - - \a base is expected to be either NULL or the absolute path of a directory. - - \a path is expected to be an absolute path. - - \see inkscape_abs2rel for a more sophisticated version. - \see prepend_current_dir_if_relative. -*/ -char const * -sp_relative_path_from_path(char const *const path, char const *const base) +std::string sp_relative_path_from_path( std::string const &path, std::string const &base) { - if (base == NULL || path == NULL) { - return path; - } + std::string result; + if ( !base.empty() && !path.empty() ) { + size_t base_len = base.length(); + while (base_len != 0 + && (base[base_len - 1] == G_DIR_SEPARATOR)) + { + --base_len; + } - size_t base_len = strlen(base); - while (base_len != 0 - && (base[base_len - 1] == G_DIR_SEPARATOR)) - { - --base_len; - } + if ( (path.substr(0, base_len) == base.substr(0, base_len)) + && (path[base_len] == G_DIR_SEPARATOR)) + { + size_t retPos = base_len + 1; + while ( (retPos < path.length()) && (path[retPos] == G_DIR_SEPARATOR) ) { + retPos++; + } + if ( (retPos + 1) < path.length() ) { + result = path.substr(retPos); + } + } - if ((memcmp(path, base, base_len) == 0) - && (path[base_len] == G_DIR_SEPARATOR)) - { - char const *ret = path + base_len + 1; - while (*ret == G_DIR_SEPARATOR) { - ++ret; - } - if (*ret != '\0') { - return ret; - } - } - - return path; + } + if ( result.empty() ) { + result = path; + } + return result; } -char const * -sp_extension_from_path(char const *const path) +char const *sp_extension_from_path(char const *const path) { if (path == NULL) { return NULL; @@ -77,25 +64,7 @@ static char const dots[] = {'.', '.', G_DIR_SEPARATOR, '\0'}; static char const *const parent = dots; static char const *const current = dots + 1; -/** - * \brief Convert a relative path name into absolute. If path is already absolute, does nothing except copying path to result. - * - * \param path relative path - * \param base base directory (must be absolute path) - * \param result result buffer - * \param size size of result buffer - * \return != NULL: absolute path - * == NULL: error - -\comment - based on functions by Shigio Yamaguchi. - FIXME:TODO: force it to also do path normalization of the entire resulting path, - i.e. get rid of any .. and . in any place, even if 'path' is already absolute - (now it returns it unchanged in this case) - - */ -char * -inkscape_rel2abs (const char *path, const char *base, char *result, const size_t size) +char *inkscape_rel2abs(const char *path, const char *base, char *result, const size_t size) { const char *pp, *bp; /* endp points the last position which is safe in the result buffer. */ @@ -181,79 +150,77 @@ erange: return (NULL); } -char * -inkscape_abs2rel (const char *path, const char *base, char *result, const size_t size) +char *inkscape_abs2rel(const char *path, const char *base, char *result, const size_t size) { - const char *pp, *bp, *branch; - /* endp points the last position which is safe in the result buffer. */ - const char *endp = result + size - 1; - char *rp; + const char *pp, *bp, *branch; + // endp points the last position which is safe in the result buffer. + const char *endp = result + size - 1; + char *rp; - if (*path != G_DIR_SEPARATOR) + if (*path != G_DIR_SEPARATOR) { - if (strlen (path) >= size) - goto erange; - strcpy (result, path); - goto finish; + if (strlen (path) >= size) + goto erange; + strcpy (result, path); + goto finish; } - else if (*base != G_DIR_SEPARATOR || !size) + else if (*base != G_DIR_SEPARATOR || !size) { - errno = EINVAL; - return (NULL); + errno = EINVAL; + return (NULL); } - else if (size == 1) - goto erange; - /* seek to branched point. */ - branch = path; - for (pp = path, bp = base; *pp && *bp && *pp == *bp; pp++, bp++) - if (*pp == G_DIR_SEPARATOR) - branch = pp; - if (((*pp == 0) || ((*pp == G_DIR_SEPARATOR) && (*(pp + 1) == 0))) && - ((*bp == 0) || ((*bp == G_DIR_SEPARATOR) && (*(bp + 1) == 0)))) + else if (size == 1) + goto erange; + /* seek to branched point. */ + branch = path; + for (pp = path, bp = base; *pp && *bp && *pp == *bp; pp++, bp++) + if (*pp == G_DIR_SEPARATOR) + branch = pp; + if (((*pp == 0) || ((*pp == G_DIR_SEPARATOR) && (*(pp + 1) == 0))) && + ((*bp == 0) || ((*bp == G_DIR_SEPARATOR) && (*(bp + 1) == 0)))) { - rp = result; - *rp++ = '.'; - if (*pp == G_DIR_SEPARATOR || *(pp - 1) == G_DIR_SEPARATOR) - *rp++ = G_DIR_SEPARATOR; - if (rp > endp) - goto erange; - *rp = 0; - goto finish; + rp = result; + *rp++ = '.'; + if (*pp == G_DIR_SEPARATOR || *(pp - 1) == G_DIR_SEPARATOR) + *rp++ = G_DIR_SEPARATOR; + if (rp > endp) + goto erange; + *rp = 0; + goto finish; } - if (((*pp == 0) && (*bp == G_DIR_SEPARATOR)) || ((*pp == G_DIR_SEPARATOR) && (*bp == 0))) - branch = pp; - /* up to root. */ - rp = result; - for (bp = base + (branch - path); *bp; bp++) - if (*bp == G_DIR_SEPARATOR && *(bp + 1) != 0) - { - if (rp + 3 > endp) - goto erange; - *rp++ = '.'; - *rp++ = '.'; - *rp++ = G_DIR_SEPARATOR; - } - if (rp > endp) - goto erange; - *rp = 0; - /* down to leaf. */ - if (*branch) + if (((*pp == 0) && (*bp == G_DIR_SEPARATOR)) || ((*pp == G_DIR_SEPARATOR) && (*bp == 0))) + branch = pp; + /* up to root. */ + rp = result; + for (bp = base + (branch - path); *bp; bp++) + if (*bp == G_DIR_SEPARATOR && *(bp + 1) != 0) + { + if (rp + 3 > endp) + goto erange; + *rp++ = '.'; + *rp++ = '.'; + *rp++ = G_DIR_SEPARATOR; + } + if (rp > endp) + goto erange; + *rp = 0; + /* down to leaf. */ + if (*branch) { - if (rp + strlen (branch + 1) > endp) - goto erange; - strcpy (rp, branch + 1); + if (rp + strlen (branch + 1) > endp) + goto erange; + strcpy (rp, branch + 1); } - else - *--rp = 0; + else + *--rp = 0; finish: - return result; + return result; erange: - errno = ERANGE; - return (NULL); + errno = ERANGE; + return (NULL); } -gchar * -prepend_current_dir_if_relative(gchar const *uri) +gchar *prepend_current_dir_if_relative(gchar const *uri) { if (!uri) { return NULL; @@ -278,4 +245,13 @@ prepend_current_dir_if_relative(gchar const *uri) return ret; } - +/* + 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: +*/ +// vi: set autoindent shiftwidth=4 tabstop=8 filetype=cpp expandtab softtabstop=4 encoding=utf-8 textwidth=99 : diff --git a/src/dir-util.h b/src/dir-util.h index 7d04b3007..f7700cfa3 100644 --- a/src/dir-util.h +++ b/src/dir-util.h @@ -12,14 +12,47 @@ #include #include -char const *sp_relative_path_from_path(char const *path, char const *base); +/** + * Returns a form of \a path relative to \a base if that is easy to construct (eg if \a path + * appears to be in the directory specified by \a base), otherwise returns \a path. + * + * @param path is expected to be an absolute path. + * @param base is expected to be either empty or the absolute path of a directory. + * + * @return a relative version of the path, if reasonable. + * + * @see inkscape_abs2rel for a more sophisticated version. + * @see prepend_current_dir_if_relative. +*/ +std::string sp_relative_path_from_path(std::string const &path, std::string const &base); + char const *sp_extension_from_path(char const *path); + +/** + * Convert a relative path name into absolute. If path is already absolute, does nothing except copying path to result. + * + * @param path relative path. + * @param base base directory (must be absolute path). + * @param result result buffer. + * @param size size of result buffer. + * + * @return != NULL: absolute path + * == NULL: error + * + * based on functions by Shigio Yamaguchi. + * FIXME:TODO: force it to also do path normalization of the entire resulting path, + * i.e. get rid of any .. and . in any place, even if 'path' is already absolute + * (now it returns it unchanged in this case) + * + */ char *inkscape_rel2abs(char const *path, char const *base, char *result, size_t const size); + char *inkscape_abs2rel(char const *path, char const *base, char *result, size_t const size); + gchar *prepend_current_dir_if_relative(gchar const *filename); -#endif /* !SEEN_DIR_UTIL_H */ +#endif // !SEEN_DIR_UTIL_H /* Local Variables: diff --git a/src/display/curve-test.h b/src/display/curve-test.h index d89cb4c99..3d698ca07 100644 --- a/src/display/curve-test.h +++ b/src/display/curve-test.h @@ -21,7 +21,7 @@ public: path1.close(); // Closed path (ClosingSegment is zero length) path2.append(Geom::LineSegment(Geom::Point(2,0),Geom::Point(3,0))); - path2.append(Geom::BezierCurve<3>(Geom::Point(3,0),Geom::Point(2,1),Geom::Point(1,1),Geom::Point(2,0))); + // TODO fix path2.append(Geom::BezierCurve<3>(Geom::Point(3,0),Geom::Point(2,1),Geom::Point(1,1),Geom::Point(2,0))); path2.close(); // Open path path3.append(Geom::SVGEllipticalArc(Geom::Point(4,0),1,2,M_PI,false,false,Geom::Point(5,1))); diff --git a/src/document-undo.h b/src/document-undo.h index 9be260fa2..e4f0d15a8 100644 --- a/src/document-undo.h +++ b/src/document-undo.h @@ -15,10 +15,10 @@ public: * Since undo sensitivity needs to be nested, setting undo sensitivity * should be done like this: *\verbatim - bool saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive(document, false); + bool saved = DocumentUndo::getUndoSensitive(document); + DocumentUndo::setUndoSensitive(document, false); ... do stuff ... - sp_document_set_undo_sensitive(document, saved); \endverbatim + DocumentUndo::setUndoSensitive(document, saved); \endverbatim */ static void setUndoSensitive(SPDocument *doc, bool sensitive); diff --git a/src/file.cpp b/src/file.cpp index c93188358..a1fc23117 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -54,6 +54,7 @@ #include "path-prefix.h" #include "preferences.h" #include "print.h" +#include "resource-manager.h" #include "rdf.h" #include "selection-chemistry.h" #include "selection.h" @@ -209,14 +210,14 @@ sp_file_exit() * \param replace_empty if true, and the current desktop is empty, this document * will replace the empty one. */ -bool -sp_file_open(const Glib::ustring &uri, - Inkscape::Extension::Extension *key, - bool add_to_recent, bool replace_empty) +bool sp_file_open(const Glib::ustring &uri, + Inkscape::Extension::Extension *key, + bool add_to_recent, bool replace_empty) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop) + if (desktop) { desktop->setWaitingCursor(); + } SPDocument *doc = NULL; try { @@ -227,27 +228,30 @@ sp_file_open(const Glib::ustring &uri, doc = NULL; } - if (desktop) + if (desktop) { desktop->clearWaitingCursor(); + } if (doc) { SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; if (existing && existing->virgin && replace_empty) { // If the current desktop is empty, open the document there - doc->ensureUpToDate(); + doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. desktop->change_document(doc); doc->emitResizedSignal(doc->getWidth(), doc->getHeight()); } else { // create a whole new desktop and window - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc. sp_create_window(dtw, TRUE); desktop = static_cast(dtw->view); } doc->virgin = FALSE; + // everyone who cares now has a reference, get rid of ours doc->doUnref(); + // resize the window to match the document properties sp_namedview_window_from_document(desktop); sp_namedview_update_layers_from_document(desktop); @@ -256,6 +260,14 @@ sp_file_open(const Glib::ustring &uri, sp_file_add_recent( doc->getURI() ); } + if ( inkscape_use_gui() ) { + // Perform a fixup pass for hrefs. + if ( Inkscape::ResourceManager::getManager().fixupBrokenLinks(doc) ) { + Glib::ustring msg = _("Broken links have been changed to point to existing files."); + desktop->showInfoDialog(msg); + } + } + return TRUE; } else { gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 1007c315a..91e3b0c5f 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -59,6 +59,7 @@ using Inkscape::Extension::Internal::PrintWin32; #include "io/sys.h" #include "message-stack.h" #include "preferences.h" +#include "resource-manager.h" #include "selection.h" #include "ui/dialog/debug.h" #include "xml/repr.h" @@ -820,6 +821,7 @@ inkscape_application_init (const gchar *argv0, gboolean use_gui) inkscape_load_menus(inkscape); Inkscape::DeviceManager::getManager().loadConfig(); } + Inkscape::ResourceManager::getManager(); /* set language for user interface according setting in preferences */ Glib::ustring ui_language = prefs->getString("/ui/language"); diff --git a/src/resource-manager.cpp b/src/resource-manager.cpp new file mode 100644 index 000000000..a68b2c7ae --- /dev/null +++ b/src/resource-manager.cpp @@ -0,0 +1,272 @@ +/* + * Inkscape::ResourceManager - tracks external resources such as image and css files. + * + * Copyright 2011 Jon A. Cruz + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "resource-manager.h" + +#include "document.h" +#include "sp-object.h" +#include "xml/node.h" +#include "document-undo.h" + +namespace Inkscape { + + + +class ResourceManagerImpl : public ResourceManager { +public: + ResourceManagerImpl(); + virtual ~ResourceManagerImpl(); + + virtual bool fixupBrokenLinks(SPDocument *doc); + + + /** + * Walk all links in a document and create a listing of unique broken links. + * + * @return a list of all broken links. + */ + std::vector findBrokenLinks(SPDocument *doc); + + /** + * Resolve broken links as a whole and return a map for those that can be found. + * + * Note: this will allow for future enhancements including relinking to new locations + * with the most broken files found, etc. + * + * @return a map of found links. + */ + std::map locateLinks(Glib::ustring const & docbase, std::vector const & brokenLinks); + + bool extractFilepath( Glib::ustring const &href, std::string &uri ); + +protected: +}; + + +ResourceManagerImpl::ResourceManagerImpl() + : ResourceManager() +{ +} + +ResourceManagerImpl::~ResourceManagerImpl() +{ +} + +bool ResourceManagerImpl::extractFilepath( Glib::ustring const &href, std::string &uri ) +{ + bool isFile = false; + + uri.clear(); + + std::string scheme = Glib::uri_parse_scheme(href); + if ( !scheme.empty() ) { + // TODO debug g_message("Scheme is now [%s]", scheme.c_str()); + if ( scheme == "file" ) { + // TODO debug g_message("--- is a file URI [%s]", href.c_str()); + + // throws Glib::ConvertError: + uri = Glib::filename_from_uri(href); // TODO see if we can get this to throw + // TODO debug g_message(" [%s]", uri.c_str()); + isFile = true; + } + } else { + // No scheme. Assuming it is a file path (absolute or relative). + // throws Glib::ConvertError: + uri = Glib::filename_from_utf8( href ); + isFile = true; + } + + return isFile; +} + + +std::vector ResourceManagerImpl::findBrokenLinks( SPDocument *doc ) +{ + std::vector result; + std::set uniques; + + if ( doc ) { + GSList const *images = doc->getResourceList("image"); + for (GSList const *it = images; it; it = it->next) { + Inkscape::XML::Node *ir = static_cast(it->data)->getRepr(); + + gchar const *href = ir->attribute("xlink:href"); + if ( href && ( uniques.find(href) == uniques.end() ) ) { + std::string uri; + if ( extractFilepath( href, uri ) ) { + if ( Glib::path_is_absolute(uri) ) { + if ( !Glib::file_test(uri, Glib::FILE_TEST_EXISTS) ) { + result.push_back(href); + uniques.insert(href); + } + } else { + std::string combined = Glib::build_filename(doc->getBase(), uri); + if ( !Glib::file_test(uri, Glib::FILE_TEST_EXISTS) ) { + result.push_back(href); + uniques.insert(href); + } + } + } + } + } + } + + return result; +} + + +std::map ResourceManagerImpl::locateLinks(Glib::ustring const & docbase, std::vector const & brokenLinks) +{ + std::map result; + + // At the moment we expect this list to contain file:// references, or simple relative or absolute paths. + for ( std::vector::const_iterator it = brokenLinks.begin(); it != brokenLinks.end(); ++it ) { + // TODO debug g_message("========{%s}", it->c_str()); + + std::string uri; + if ( extractFilepath( *it, uri ) ) { + // We were able to get some path. Check it + + if ( !Glib::path_is_absolute(uri) ) { + uri = Glib::build_filename(docbase, uri); + // TODO debug g_message(" not absolute. Fixing up as [%s]", uri.c_str()); + } + + if ( !Glib::file_test(uri, Glib::FILE_TEST_EXISTS) ) { + // TODO debug g_message(" DOES NOT EXIST."); + std::string tmp = uri; + std::string prior; + std::string remainder; + bool exists = false; + while ( (tmp != prior) && !exists) { + prior = tmp; + std::string basename = Glib::path_get_basename(tmp); + tmp = Glib::path_get_dirname(tmp); + if ( remainder.empty() ) { + remainder = basename; + } else { + remainder = Glib::build_filename(basename, remainder); + } + + std::string rebuild = Glib::build_filename(docbase, remainder); + exists = Glib::file_test(rebuild, Glib::FILE_TEST_EXISTS); + + // TODO debug g_message(" [%s] [%s]%s", tmp.c_str(), remainder.c_str(), exists ? " XXXX" : ""); + if ( exists ) { + Glib::ustring replacement = Glib::filename_to_utf8( remainder ); + result[*it] = replacement; + } + } + } + } + } + + return result; +} + +bool ResourceManagerImpl::fixupBrokenLinks(SPDocument *doc) +{ + bool changed = false; + if ( doc ) { + // TODO debug g_message("FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP FIXUP"); + // TODO debug g_message(" base is [%s]", doc->getBase()); + + std::vector brokenHrefs = findBrokenLinks(doc); + if ( !brokenHrefs.empty() ) { + // TODO debug g_message(" FOUND SOME LINKS %d", brokenHrefs.size()); + for ( std::vector::iterator it = brokenHrefs.begin(); it != brokenHrefs.end(); ++it ) { + // TODO debug g_message(" [%s]", it->c_str()); + } + } + + std::map mapping = locateLinks(doc->getBase(), brokenHrefs); + for ( std::map::iterator it = mapping.begin(); it != mapping.end(); ++it ) + { + // TODO debug g_message(" [%s] ==> {%s}", it->first.c_str(), it->second.c_str()); + } + + bool savedUndoState = DocumentUndo::getUndoSensitive(doc); + DocumentUndo::setUndoSensitive(doc, true); + + GSList const *images = doc->getResourceList("image"); + for (GSList const *it = images; it; it = it->next) { + Inkscape::XML::Node *ir = static_cast(it->data)->getRepr(); + + gchar const *href = ir->attribute("xlink:href"); + if ( href ) { + // TODO debug g_message(" consider [%s]", href); + + if ( mapping.find(href) != mapping.end() ) { + // TODO debug g_message(" Found a replacement"); + + ir->setAttribute( "xlink:href", mapping[href].c_str() ); + if ( ir->attribute( "sodipodi:absref" ) ) { + ir->setAttribute( "sodipodi:absref", 0 ); // Remove this attribute + } + + SPObject *updated = doc->getObjectByRepr(ir); + if (updated) { + // force immediate update of dependant attributes + updated->updateRepr(); + } + + changed = true; + } + } + } + if ( changed ) { + DocumentUndo::done( doc, SP_VERB_DIALOG_XML_EDITOR, _("Fixup broken links") ); + } + DocumentUndo::setUndoSensitive(doc, savedUndoState); + } + + return changed; +} + + + + +static ResourceManagerImpl* theInstance = 0; + +ResourceManager::ResourceManager() + : Glib::Object() +{ +} + +ResourceManager::~ResourceManager() { +} + +ResourceManager& ResourceManager::getManager() { + if ( !theInstance ) { + theInstance = new ResourceManagerImpl(); + } + + return *theInstance; +} + + +} // namespace Inkscape + +/* + 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 : diff --git a/src/resource-manager.h b/src/resource-manager.h new file mode 100644 index 000000000..8f01c23a0 --- /dev/null +++ b/src/resource-manager.h @@ -0,0 +1,49 @@ +/* + * Inkscape::ResourceManager - Manages external resources such as image and css files. + * + * Copyright 2011 Jon A. Cruz + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_RESOURCE_MANAGER_H +#define SEEN_INKSCAPE_RESOURCE_MANAGER_H + +#include + +class SPDocument; + +namespace Inkscape { + +class ResourceManager : public Glib::Object { + +public: + static ResourceManager& getManager(); + + virtual bool fixupBrokenLinks(SPDocument *doc) = 0; + +protected: + ResourceManager(); + virtual ~ResourceManager(); + +private: + ResourceManager(ResourceManager const &); // no copy + void operator=(ResourceManager const &); // no assign +}; + + + +} // namespace Inkscape + +#endif // SEEN_INKSCAPE_RESOURCE_MANAGER_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 : diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 8bd1bfadd..746cd97d9 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -5,6 +5,7 @@ * Lauris Kaplinski * Edward Flick (EAF) * Abhishek Sharma + * Jon A. Cruz * * Copyright (C) 1999-2005 Authors * Copyright (C) 2000-2001 Ximian, Inc. @@ -107,7 +108,6 @@ extern "C" void user_read_data( png_structp png_ptr, png_bytep data, png_size_t length ); void user_write_data( png_structp png_ptr, png_bytep data, png_size_t length ); void user_flush_data( png_structp png_ptr ); - } @@ -557,8 +557,7 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, GError **error ) } } -GType -sp_image_get_type (void) +GType sp_image_get_type(void) { static GType image_type = 0; if (!image_type) { @@ -579,8 +578,7 @@ sp_image_get_type (void) return image_type; } -static void -sp_image_class_init (SPImageClass * klass) +static void sp_image_class_init( SPImageClass * klass ) { GObjectClass * gobject_class; SPObjectClass * sp_object_class; @@ -635,8 +633,7 @@ static void sp_image_init( SPImage *image ) image->lastMod = 0; } -static void -sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_image_build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr ) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); @@ -654,8 +651,7 @@ sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep document->addResource("image", object); } -static void -sp_image_release (SPObject *object) +static void sp_image_release( SPObject *object ) { SPImage *image = SP_IMAGE(object); @@ -695,8 +691,7 @@ sp_image_release (SPObject *object) } } -static void -sp_image_set (SPObject *object, unsigned int key, const gchar *value) +static void sp_image_set( SPObject *object, unsigned int key, const gchar *value ) { SPImage *image = SP_IMAGE (object); @@ -818,8 +813,7 @@ sp_image_set (SPObject *object, unsigned int key, const gchar *value) sp_image_set_curve(image); //creates a curve at the image's boundary for snapping } -static void -sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) +static void sp_image_update( SPObject *object, SPCtx *ctx, unsigned int flags ) { SPImage *image = SP_IMAGE(object); SPDocument *doc = object->document; @@ -1026,8 +1020,7 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) sp_image_update_canvas_image ((SPImage *) object); } -static void -sp_image_modified (SPObject *object, unsigned int flags) +static void sp_image_modified( SPObject *object, unsigned int flags ) { SPImage *image = SP_IMAGE (object); @@ -1042,8 +1035,7 @@ sp_image_modified (SPObject *object, unsigned int flags) } } -static Inkscape::XML::Node * -sp_image_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_image_write( SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags ) { SPImage *image = SP_IMAGE (object); @@ -1081,8 +1073,7 @@ sp_image_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM return repr; } -static void -sp_image_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const /*flags*/) +static void sp_image_bbox( SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const /*flags*/ ) { SPImage const &image = *SP_IMAGE(item); @@ -1099,8 +1090,7 @@ sp_image_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, u } } -static void -sp_image_print (SPItem *item, SPPrintContext *ctx) +static void sp_image_print( SPItem *item, SPPrintContext *ctx ) { SPImage *image = SP_IMAGE(item); @@ -1135,8 +1125,7 @@ sp_image_print (SPItem *item, SPPrintContext *ctx) } } -static gchar * -sp_image_description(SPItem *item) +static gchar *sp_image_description( SPItem *item ) { SPImage *image = SP_IMAGE(item); char *href_desc; @@ -1159,8 +1148,7 @@ sp_image_description(SPItem *item) return ret; } -static NRArenaItem * -sp_image_show (SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int /*flags*/) +static NRArenaItem *sp_image_show( SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int /*flags*/ ) { SPImage * image = SP_IMAGE(item); NRArenaItem *ai = NRArenaImage::create(arena); @@ -1286,8 +1274,7 @@ GdkPixbuf *sp_image_repr_read_image( time_t& modTime, char*& pixPath, const gcha return pixbuf; } -static GdkPixbuf * -sp_image_pixbuf_force_rgba (GdkPixbuf * pixbuf) +static GdkPixbuf *sp_image_pixbuf_force_rgba( GdkPixbuf * pixbuf ) { GdkPixbuf* result; if (gdk_pixbuf_get_has_alpha(pixbuf)) { @@ -1301,8 +1288,7 @@ sp_image_pixbuf_force_rgba (GdkPixbuf * pixbuf) /* We assert that realpixbuf is either NULL or identical size to pixbuf */ -static void -sp_image_update_canvas_image (SPImage *image) +static void sp_image_update_canvas_image( SPImage *image ) { SPItem *item = SP_ITEM(image); @@ -1342,7 +1328,7 @@ sp_image_update_canvas_image (SPImage *image) } } -static void sp_image_snappoints(SPItem const *item, std::vector &p, Inkscape::SnapPreferences const */*snapprefs*/) +static void sp_image_snappoints( SPItem const *item, std::vector &p, Inkscape::SnapPreferences const */*snapprefs*/ ) { /* An image doesn't have any nodes to snap, but still we want to be able snap one image to another. Therefore we will create some snappoints at the corner, similar to a rect. If @@ -1376,8 +1362,7 @@ static void sp_image_snappoints(SPItem const *item, std::vectorheight.computed < MAGIC_EPSILON_TOO) || (image->width.computed < MAGIC_EPSILON_TOO) || (image->clip_ref->getObject())) { @@ -1580,8 +1562,7 @@ sp_image_set_curve(SPImage *image) /** * Return duplicate of curve (if any exists) or NULL if there is no curve */ -SPCurve * -sp_image_get_curve (SPImage *image) +SPCurve *sp_image_get_curve( SPImage *image ) { SPCurve *result = 0; if (image->curve) { @@ -1590,8 +1571,7 @@ sp_image_get_curve (SPImage *image) return result; } -void -sp_embed_image(Inkscape::XML::Node *image_node, GdkPixbuf *pb, Glib::ustring const &mime_in) +void sp_embed_image( Inkscape::XML::Node *image_node, GdkPixbuf *pb, Glib::ustring const &mime_in ) { Glib::ustring format, mime; if (mime_in == "image/jpeg") { @@ -1602,8 +1582,8 @@ sp_embed_image(Inkscape::XML::Node *image_node, GdkPixbuf *pb, Glib::ustring con format = "png"; } - gchar *data; - gsize length; + gchar *data = 0; + gsize length = 0; gdk_pixbuf_save_to_buffer(pb, &data, &length, format.data(), NULL, NULL); // Save base64 encoded data in image node @@ -1614,7 +1594,8 @@ sp_embed_image(Inkscape::XML::Node *image_node, GdkPixbuf *pb, Glib::ustring con gchar *buffer = (gchar *) g_malloc(needed_size), *buf_work = buffer; buf_work += g_sprintf(buffer, "data:%s;base64,", mime.data()); - gint state = 0, save = 0; + gint state = 0; + gint save = 0; gsize written = 0; written += g_base64_encode_step((guchar*) data, length, TRUE, buf_work, &state, &save); written += g_base64_encode_close(TRUE, buf_work + written, &state, &save); diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h index 919b570dd..4ff4f92f9 100644 --- a/src/ui/view/edit-widget-interface.h +++ b/src/ui/view/edit-widget-interface.h @@ -137,6 +137,10 @@ struct EditWidgetInterface /// Message widget will get no content virtual void setMessage (Inkscape::MessageType type, gchar const* msg) = 0; + + /** Show an info dialog with the given message */ + virtual bool showInfoDialog( Glib::ustring const &message ) = 0; + /// Open yes/no dialog with warning text and confirmation question. virtual bool warnDialog (gchar*) = 0; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 63fdc5930..87ce9053f 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1150,6 +1150,25 @@ SPDesktopWidget::presentWindow() gtk_window_present (w); } +bool SPDesktopWidget::showInfoDialog( Glib::ustring const &message ) +{ + bool result = false; + GtkWindow *window = GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET(this) ) ); + if (window) + { + GtkWidget *dialog = gtk_message_dialog_new( + window, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "%s", message.c_str()); + gtk_window_set_title( GTK_WINDOW(dialog), _("Note:")); // probably want to take this as a parameter. + gint response = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + } + return result; +} + bool SPDesktopWidget::warnDialog (gchar* text) { diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 0102897e5..53d9dd1bc 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -200,8 +200,14 @@ struct SPDesktopWidget { { _dtw->setCoordinateStatus (p); } virtual void setMessage (Inkscape::MessageType type, gchar const* msg) { _dtw->setMessage (type, msg); } + + virtual bool showInfoDialog( Glib::ustring const &message ) { + return _dtw->showInfoDialog( message ); + } + virtual bool warnDialog (gchar* text) { return _dtw->warnDialog (text); } + virtual Inkscape::UI::Widget::Dock* getDock () { return _dtw->getDock(); } }; @@ -218,6 +224,7 @@ struct SPDesktopWidget { void setWindowSize (gint w, gint h); void setWindowTransient (void *p, int transient_policy); void presentWindow(); + bool showInfoDialog( Glib::ustring const &message ); bool warnDialog (gchar *text); void setToolboxFocusTo (gchar const *); void setToolboxAdjustmentValue (gchar const * id, double value); diff --git a/src/xml/Makefile_insert b/src/xml/Makefile_insert index 7190b7948..b10f2448b 100644 --- a/src/xml/Makefile_insert +++ b/src/xml/Makefile_insert @@ -47,5 +47,6 @@ ink_common_sources += \ # ### CxxTest stuff #### # ###################### CXXTEST_TESTSUITES += \ + $(srcdir)/xml/rebase-hrefs-test.h \ $(srcdir)/xml/repr-action-test.h \ $(srcdir)/xml/quote-test.h diff --git a/src/xml/rebase-hrefs-test.h b/src/xml/rebase-hrefs-test.h new file mode 100644 index 000000000..e00337836 --- /dev/null +++ b/src/xml/rebase-hrefs-test.h @@ -0,0 +1,126 @@ +#include + +#include +#include + +#include "uri.h" + + +class RebaseHrefsTest : public CxxTest::TestSuite +{ + Inkscape::XML::Document *document; + Inkscape::XML::Node *a, *b, *c, *root; + +public: + + RebaseHrefsTest() + { + Inkscape::GC::init(); + + document = sp_repr_document_new("test"); + root = document->root(); + + a = document->createElement("a"); + b = document->createElement("b"); + c = document->createElement("c"); + } + virtual ~RebaseHrefsTest() {} + +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static RebaseHrefsTest *createSuite() { return new RebaseHrefsTest(); } + static void destroySuite( RebaseHrefsTest *suite ) { delete suite; } + + + void dump_str(gchar const *str, gchar const *prefix) + { + Glib::ustring tmp; + tmp = prefix; + tmp += " ["; + size_t const total = strlen(str); + for (unsigned i = 0; i < total; i++) { + gchar *const tmp2 = g_strdup_printf(" %02x", (0x0ff & str[i])); + tmp += tmp2; + g_free(tmp2); + } + + tmp += "]"; + g_message("%s", tmp.c_str()); + } + + void testFlipples() + { + using Inkscape::URI; + using Inkscape::MalformedURIException; + + gchar const* things[] = { + "data:foo,bar", + "http://www.google.com/image.png", + "ftp://ssd.com/doo", + "/foo/dee/bar.svg", + "foo.svg", + "file:/foo/dee/bar.svg", + "file:///foo/dee/bar.svg", + "file:foo.svg", + "/foo/bar\xe1\x84\x92.svg", + "file:///foo/bar\xe1\x84\x92.svg", + "file:///foo/bar%e1%84%92.svg", + "/foo/bar%e1%84%92.svg", + "bar\xe1\x84\x92.svg", + "bar%e1%84%92.svg", + NULL + }; + g_message("+------"); + for ( int i = 0; things[i]; i++ ) + { + try + { + URI uri(things[i]); + gboolean isAbs = g_path_is_absolute( things[i] ); + gchar *str = uri.toString(); + g_message( "abs:%d isRel:%d scheme:[%s] path:[%s][%s] uri[%s] / [%s]", (int)isAbs, + (int)uri.isRelative(), + uri.getScheme(), + uri.getPath(), + uri.getOpaque(), + things[i], + str ); + g_free(str); + } + catch ( MalformedURIException err ) + { + dump_str( things[i], "MalformedURIException" ); + xmlChar *redo = xmlURIEscape((xmlChar const *)things[i]); + g_message(" gone from [%s] to [%s]", things[i], redo ); + if ( redo == NULL ) + { + URI again = URI::fromUtf8( things[i] ); + g_message(" uri from [%s] to [%s]", things[i], again.toString() ); + gboolean isAbs = g_path_is_absolute( things[i] ); + gchar *str = again.toString(); + g_message( "abs:%d isRel:%d scheme:[%s] path:[%s][%s] uri[%s] / [%s]", (int)isAbs, + (int)again.isRelative(), + again.getScheme(), + again.getPath(), + again.getOpaque(), + things[i], + str ); + g_free(str); + g_message(" ----"); + } + } + } + g_message("+------"); + } +}; + +/* + 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 : diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index 33b31685d..71e1cfb87 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -10,68 +10,64 @@ #include #include #include -using Inkscape::XML::AttributeRecord; +#include +#include +#include +using Inkscape::XML::AttributeRecord; /** - * \pre href. + * Determine if a href needs rebasing. */ -static bool -href_needs_rebasing(char const *const href) +static bool href_needs_rebasing(std::string const &href) { - g_return_val_if_fail(href, false); + bool ret = true; - if (!*href || *href == '#') { - return false; + if ( href.empty() || (href[0] == '#') ) { + ret = false; /* False (no change) is the right behaviour even when the base URI differs from the * document URI: RFC 3986 defines empty string relative URL as referring to the containing * document, rather than referring to the base URI. */ - } - - /* Don't change data or http hrefs. */ - { - char *const scheme = g_uri_parse_scheme(href); - if (scheme) { + } else { + /* Don't change data or http hrefs. */ + std::string scheme = Glib::uri_parse_scheme(href); + if ( !scheme.empty() ) { /* Assume it shouldn't be changed. This is probably wrong if the scheme is `file' * (or if the scheme of the new base is non-file, though I believe that never * happens at the time of writing), but that's rare, and we won't try too hard to * handle this now: wait until after the freeze, then add liburiparser (or similar) * as a dependency and do it properly. For now we'll just try to be simple (while * at least still correctly handling data hrefs). */ - free(scheme); - return false; + ret = false; + } else if (Glib::path_is_absolute(href)) { + /* If absolute then keep it as is. + * + * Even in the following borderline cases: + * + * - We keep it absolute even if it is in new_base (directly or indirectly). + * + * - We assume that if xlink:href is absolute then we honour it in preference to + * sodipodi:absref even if sodipodi:absref points to an existing file while xlink:href + * doesn't. This is because we aren't aware of any bugs in xlink:href handling when + * it's absolute, so we assume that it's the best value to use even in this case.) + */ + /* No strong preference on what we do for sodipodi:absref. Once we're + * confident of our handling of xlink:href and xlink:base, we should clear it. + * Though for the moment we do the simple thing: neither clear nor set it. */ + ret = false; } } - /* If absolute then keep it as is. - * - * Even in the following borderline cases: - * - * - We keep it absolute even if it is in new_base (directly or indirectly). - * - * - We assume that if xlink:href is absolute then we honour it in preference to - * sodipodi:absref even if sodipodi:absref points to an existing file while xlink:href - * doesn't. This is because we aren't aware of any bugs in xlink:href handling when - * it's absolute, so we assume that it's the best value to use even in this case.) - */ - if (g_path_is_absolute(href)) { - /* No strong preference on what we do for sodipodi:absref. Once we're - * confident of our handling of xlink:href and xlink:base, we should clear it. - * Though for the moment we do the simple thing: neither clear nor set it. */ - return false; - } - - return true; + return ret; } -static gchar * -calc_abs_href(gchar const *const abs_base_dir, gchar const *const href, - gchar const *const sp_absref) +static std::string calc_abs_href(std::string const &abs_base_dir, std::string const &href, + gchar const *const sp_absref) { - gchar *ret = g_build_filename(abs_base_dir, href, NULL); + std::string ret = Glib::build_filename(abs_base_dir, href); if ( sp_absref - && !Inkscape::IO::file_test(ret, G_FILE_TEST_EXISTS) + && !Inkscape::IO::file_test(ret.c_str(), G_FILE_TEST_EXISTS) && Inkscape::IO::file_test(sp_absref, G_FILE_TEST_EXISTS) ) { /* sodipodi:absref points to an existing file while xlink:href doesn't. @@ -93,18 +89,12 @@ calc_abs_href(gchar const *const abs_base_dir, gchar const *const href, * effic: Once we no longer consult sodipodi:absref, we can do * `if (base unchanged) { return; }' at the start of rebase_hrefs. */ - g_free(ret); - ret = g_strdup(sp_absref); + ret = sp_absref; } return ret; } -/** - * Change relative xlink:href attributes to be relative to \a new_abs_base instead of old_abs_base. - * - * Note that old_abs_base and new_abs_base must each be non-NULL, absolute directory paths. - */ Inkscape::Util::List Inkscape::XML::rebase_href_attrs(gchar const *const old_abs_base, gchar const *const new_abs_base, @@ -115,6 +105,7 @@ Inkscape::XML::rebase_href_attrs(gchar const *const old_abs_base, using Inkscape::Util::ptr_shared; using Inkscape::Util::share_string; + if (old_abs_base == new_abs_base) { return attributes; } @@ -133,7 +124,7 @@ Inkscape::XML::rebase_href_attrs(gchar const *const old_abs_base, for (List ai(attributes); ai; ++ai) { if (ai->key == href_key) { old_href = ai->value; - if (!href_needs_rebasing(old_href)) { + if (!href_needs_rebasing(static_cast(old_href))) { return attributes; } } else if (ai->key == absref_key) { @@ -153,23 +144,33 @@ Inkscape::XML::rebase_href_attrs(gchar const *const old_abs_base, * reversed.) */ } - gchar *const abs_href(calc_abs_href(old_abs_base, old_href, sp_absref)); - gchar const *const new_href = sp_relative_path_from_path(abs_href, new_abs_base); - ret = cons(AttributeRecord(href_key, share_string(new_href)), ret); + std::string abs_href = calc_abs_href(old_abs_base, static_cast(old_href), sp_absref); + std::string new_href = sp_relative_path_from_path(abs_href, new_abs_base); + ret = cons(AttributeRecord(href_key, share_string(new_href.c_str())), ret); // Check if this is safe/copied or if it is only held. if (sp_absref) { /* We assume that if there wasn't previously a sodipodi:absref attribute * then we shouldn't create one. */ - ret = cons(AttributeRecord(absref_key, ( streq(abs_href, sp_absref) + ret = cons(AttributeRecord(absref_key, ( streq(abs_href.c_str(), sp_absref) ? sp_absref - : share_string(abs_href) )), + : share_string(abs_href.c_str()) )), ret); } - g_free(abs_href); + return ret; } -gchar * -Inkscape::XML::calc_abs_doc_base(gchar const *const doc_base) +// std::string Inkscape::XML::rebase_href_attrs( std::string const &oldAbsBase, std::string const &newAbsBase, gchar const * /*href*/, gchar const */*absref*/ ) +// { +// std::string ret; +// //g_message( "XX need to flip from [%s] to [%s]", oldAbsBase.c_str(), newAbsBase.c_str() ); + +// if ( oldAbsBase != newAbsBase ) { +// } + +// return ret; +// } + +std::string Inkscape::XML::calc_abs_doc_base(gchar const *doc_base) { /* Note that we don't currently try to handle the case of doc_base containing * `..' or `.' path components. This non-handling means that sometimes @@ -179,34 +180,27 @@ Inkscape::XML::calc_abs_doc_base(gchar const *const doc_base) * relative URL/IRI href processing (with liburiparser). * * (Note that one possibile difficulty with `..' is symlinks.) */ + std::string ret; if (!doc_base) { - return g_get_current_dir(); - } else if (g_path_is_absolute(doc_base)) { - return g_strdup(doc_base); + ret = Glib::get_current_dir(); + } else if (Glib::path_is_absolute(doc_base)) { + ret = doc_base; } else { - gchar *const cwd = g_get_current_dir(); - gchar *const ret = g_build_filename(cwd, doc_base, NULL); - g_free(cwd); - return ret; + ret = Glib::build_filename( Glib::get_current_dir(), doc_base ); } + + return ret; } -/** - * Change relative hrefs in doc to be relative to \a new_base instead of doc.base. - * - * (NULL doc base or new_base is interpreted as current working directory.) - * - * \param spns True iff doc should contain sodipodi:absref attributes. - */ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_base, bool const spns) { if (!doc->getBase()) { return; } - gchar *const old_abs_base = calc_abs_doc_base(doc->getBase()); - gchar *const new_abs_base = calc_abs_doc_base(new_base); + std::string old_abs_base = calc_abs_doc_base(doc->getBase()); + std::string new_abs_base = calc_abs_doc_base(new_base); /* TODO: Should handle not just image but also: * @@ -232,22 +226,26 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b for (GSList const *l = images; l != NULL; l = l->next) { Inkscape::XML::Node *ir = static_cast(l->data)->getRepr(); - gchar * uri = g_strdup(ir->attribute("xlink:href")); - if (!uri) { - continue; + std::string uri; + { + gchar const *tmp = ir->attribute("xlink:href"); + if ( !tmp ) { + continue; + } + uri = tmp; } - if (!strncmp(uri, "file://", 7)) { - uri = g_strdup(g_filename_from_uri(ir->attribute("xlink:href"), NULL, NULL)); + if ( uri.substr(0, 7) == "file://" ) { + uri = Glib::filename_from_uri(uri); } // The following two cases are for absolute hrefs that can be converted to relative. // Imported images, first time rebased, need an old base. - gchar * href = uri; - if (g_path_is_absolute(href)) { - href = (gchar *) sp_relative_path_from_path(uri, old_abs_base); + std::string href = uri; + if ( Glib::path_is_absolute(href) ) { + href = sp_relative_path_from_path(uri, old_abs_base); } // Files moved from a absolute path need a new one. - if (g_path_is_absolute(href)) { - href = (gchar *) sp_relative_path_from_path(uri, new_abs_base); + if ( Glib::path_is_absolute(href) ) { + href = sp_relative_path_from_path(uri, new_abs_base); } // Other bitmaps are either really absolute, or already relative. @@ -264,52 +262,41 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b * changing non-file hrefs), which breaks if href starts with a scheme or if href contains * any escaping. */ - if (!href || !href_needs_rebasing(href)) { - g_free(uri); - continue; - } - - gchar *const abs_href(calc_abs_href(old_abs_base, href, ir->attribute("sodipodi:absref"))); - - /* todo: One difficult case once we support writing to non-file locations is where - * existing hrefs in the document point to local files. In this case, we should - * probably copy those referenced files to the new location at the same time. It's - * less clear what to do when copying from one non-file location to another. We may - * need to ask the user in some way (even if it's as a checkbox), but we'd like to - * bother the user as little as possible yet also want to warn the user about the case - * of file hrefs. */ - - gchar const *const new_href = sp_relative_path_from_path(abs_href, new_abs_base); - ir->setAttribute("sodipodi:absref", ( spns - ? abs_href - : NULL )); - if (!g_path_is_absolute(new_href)) { + if ( href_needs_rebasing(href) ) { + std::string abs_href = calc_abs_href(old_abs_base, href, ir->attribute("sodipodi:absref")); + + /* todo: One difficult case once we support writing to non-file locations is where + * existing hrefs in the document point to local files. In this case, we should + * probably copy those referenced files to the new location at the same time. It's + * less clear what to do when copying from one non-file location to another. We may + * need to ask the user in some way (even if it's as a checkbox), but we'd like to + * bother the user as little as possible yet also want to warn the user about the case + * of file hrefs. */ + + std::string new_href = sp_relative_path_from_path(abs_href, new_abs_base); + ir->setAttribute("sodipodi:absref", ( spns + ? abs_href.c_str() + : NULL )); + if (!Glib::path_is_absolute(new_href)) { #ifdef WIN32 - /* Native Windows path separators are replaced with / so that the href - * also works on Gnu/Linux and OSX */ - ir->setAttribute("xlink:href", g_strdelimit((gchar *) new_href, "\\", '/')); + /* Native Windows path separators are replaced with / so that the href + * also works on Gnu/Linux and OSX */ + ir->setAttribute("xlink:href", g_strdelimit(new_href.c_str(), "\\", '/')); #else - ir->setAttribute("xlink:href", new_href); + ir->setAttribute("xlink:href", new_href.c_str()); #endif - } else { - ir->setAttribute("xlink:href", g_filename_to_uri((gchar *) new_href, NULL, NULL)); - } + } else { + ir->setAttribute("xlink:href", g_filename_to_uri(new_href.c_str(), NULL, NULL)); + } - /* impl: I assume that if !spns then any existing sodipodi:absref is about to get - * cleared (or is already cleared) anyway, in which case it doesn't matter whether we - * clear or leave any existing sodipodi:absref value. If that assumption turns out to - * be wrong, then leaving it means risking leaving the wrong value (if xlink:href - * referred to a different file than sodipodi:absref) while clearing it means risking - * losing information. */ - - g_free(uri); - // (No need to free href, it's guaranteed to point into uri.) - g_free(abs_href); - // (No need to free new_href, it's guaranteed to point into abs_href.) + /* impl: I assume that if !spns then any existing sodipodi:absref is about to get + * cleared (or is already cleared) anyway, in which case it doesn't matter whether we + * clear or leave any existing sodipodi:absref value. If that assumption turns out to + * be wrong, then leaving it means risking leaving the wrong value (if xlink:href + * referred to a different file than sodipodi:absref) while clearing it means risking + * losing information. */ + } } - - g_free(new_abs_base); - g_free(old_abs_base); } diff --git a/src/xml/rebase-hrefs.h b/src/xml/rebase-hrefs.h index b4f288c4d..4cbdec9a5 100644 --- a/src/xml/rebase-hrefs.h +++ b/src/xml/rebase-hrefs.h @@ -9,17 +9,36 @@ struct SPDocument; namespace Inkscape { namespace XML { -gchar *calc_abs_doc_base(gchar const *doc_base); - +std::string calc_abs_doc_base(gchar const *doc_base); + +/** + * Change relative hrefs in doc to be relative to \a new_base instead of doc.base. + * + * (NULL doc base or new_base is interpreted as current working directory.) + * + * @param spns True if doc should contain sodipodi:absref attributes. + */ void rebase_hrefs(SPDocument *doc, gchar const *new_base, bool spns); +/** + * Change relative xlink:href attributes to be relative to \a new_abs_base instead of old_abs_base. + * + * Note that old_abs_base and new_abs_base must each be non-NULL, absolute directory paths. + */ Inkscape::Util::List rebase_href_attrs( gchar const *old_abs_base, gchar const *new_abs_base, Inkscape::Util::List attributes); -} -} + +// /** +// * . +// * @return a non-empty replacement href if needed, empty otherwise. +// */ +// std::string rebase_href_attrs( std::string const &oldAbsBase, std::string const &newAbsBase, gchar const *href, gchar const *absref = 0 ); + +} // namespace XML +} // namespace Inkscape #endif /* !REBASE_HREFS_H_SEEN */ diff --git a/src/xml/repr-action-test.h b/src/xml/repr-action-test.h index afc9b2c46..ae4291397 100644 --- a/src/xml/repr-action-test.h +++ b/src/xml/repr-action-test.h @@ -88,7 +88,6 @@ public: } /* lots more tests needed ... */ - }; /* diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 5f7654ba8..2a0bb6ce8 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -52,6 +52,7 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out, int inlineattrs, int indent, gchar const *old_href_abs_base, gchar const *new_href_abs_base); + static void sp_repr_write_stream_element(Node *repr, Writer &out, gint indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix, @@ -644,7 +645,7 @@ sp_repr_save_rebased_file(Document *doc, gchar const *const filename, gchar cons return false; } - gchar *old_href_abs_base = NULL; + std::string old_href_abs_base; gchar *new_href_abs_base = NULL; if (for_filename) { old_href_abs_base = calc_abs_doc_base(old_base); @@ -662,9 +663,8 @@ sp_repr_save_rebased_file(Document *doc, gchar const *const filename, gchar cons * to using sodipodi:absref instead of the xlink:href value, * then we should do `if streq() { free them and set both to NULL; }'. */ } - sp_repr_save_stream(doc, file, default_ns, compress, old_href_abs_base, new_href_abs_base); + sp_repr_save_stream(doc, file, default_ns, compress, old_href_abs_base.c_str(), new_href_abs_base); - g_free(old_href_abs_base); g_free(new_href_abs_base); if (fclose (file) != 0) { @@ -879,17 +879,16 @@ void sp_repr_write_stream( Node *repr, Writer &out, gint indent_level, } -static void -sp_repr_write_stream_element (Node * repr, Writer & out, gint indent_level, - bool add_whitespace, - Glib::QueryQuark elide_prefix, - List attributes, - int inlineattrs, int indent, - gchar const *const old_href_base, - gchar const *const new_href_base) +void sp_repr_write_stream_element( Node * repr, Writer & out, + gint indent_level, bool add_whitespace, + Glib::QueryQuark elide_prefix, + List attributes, + int inlineattrs, int indent, + gchar const *old_href_base, + gchar const *new_href_base ) { - Node *child; - bool loose; + Node *child = 0; + bool loose = false; g_return_if_fail (repr != NULL); @@ -921,6 +920,28 @@ sp_repr_write_stream_element (Node * repr, Writer & out, gint indent_level, add_whitespace = false; } + + { + GQuark const href_key = g_quark_from_static_string("xlink:href"); + GQuark const absref_key = g_quark_from_static_string("sodipodi:absref"); + + gchar const *xxHref = 0; + gchar const *xxAbsref = 0; + for ( List ai(attributes); ai; ++ai ) { + if ( ai->key == href_key ) { + xxHref = ai->value; + } else if ( ai->key == absref_key ) { + xxAbsref = ai->value; + } + } + + // Might add a special case for absref but no href. + if ( old_href_base && new_href_base && xxHref ) { + //g_message("href rebase test with [%s] and [%s]", xxHref, xxAbsref); + //std::string newOne = rebase_href_attrs( old_href_base, new_href_base, xxHref, xxAbsref ); + } + } + for ( List iter = rebase_href_attrs(old_href_base, new_href_base, attributes); iter ; ++iter ) diff --git a/src/xml/repr.h b/src/xml/repr.h index bde3e533f..5fa9387c7 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -79,10 +79,13 @@ void sp_repr_write_stream(Inkscape::XML::Node *repr, Inkscape::IO::Writer &out, gchar const *new_href_base = NULL); Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const gchar *default_ns); Glib::ustring sp_repr_save_buf(Inkscape::XML::Document *doc); + +// TODO convert to std::string void sp_repr_save_stream(Inkscape::XML::Document *doc, FILE *to_file, gchar const *default_ns = NULL, bool compress = false, gchar const *old_href_base = NULL, gchar const *new_href_base = NULL); + bool sp_repr_save_file(Inkscape::XML::Document *doc, gchar const *filename, gchar const *default_ns=NULL); bool sp_repr_save_rebased_file(Inkscape::XML::Document *doc, gchar const *filename_utf8, gchar const *default_ns, -- cgit v1.2.3 From 433bde5f59b67c04fdbb82d484e823a2cfd8624c Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 6 May 2011 21:49:50 -0700 Subject: Fix windows build. (bzr r10199) --- src/xml/rebase-hrefs.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index 71e1cfb87..4a7e050fa 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -252,8 +252,8 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b #ifdef WIN32 /* Windows relative path needs their native separators before we * compare it to native baserefs. */ - if (!g_path_is_absolute(href)) { - g_strdelimit(href, "/", '\\'); + if ( !Glib::path_is_absolute(href) ) { + std::replace(href.begin(), href.end(), '/', '\\'); } #endif @@ -281,10 +281,9 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b #ifdef WIN32 /* Native Windows path separators are replaced with / so that the href * also works on Gnu/Linux and OSX */ - ir->setAttribute("xlink:href", g_strdelimit(new_href.c_str(), "\\", '/')); -#else - ir->setAttribute("xlink:href", new_href.c_str()); + std::replace(href.begin(), href.end(), '\\', '/'); #endif + ir->setAttribute("xlink:href", new_href.c_str()); } else { ir->setAttribute("xlink:href", g_filename_to_uri(new_href.c_str(), NULL, NULL)); } -- cgit v1.2.3 From 9263246258064eb68a501eb9d260cf050953dad6 Mon Sep 17 00:00:00 2001 From: Adib Taraben Date: Sat, 7 May 2011 13:11:57 +0200 Subject: corrected fill-rule handling in pdf export, fixes bug:436962 (bzr r10198.1.1) --- src/extension/internal/cairo-render-context.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 9a612549d..4eecb5ecc 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1361,7 +1361,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con addClipPath(pathv, &style->fill_rule); } else { setPathVector(pathv); - if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { + if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD); } else { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); @@ -1391,7 +1391,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con _setFillStyle(style, pbox); setPathVector(pathv); - if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { + if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD); } else { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); @@ -1606,7 +1606,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const *font_ma if (_render_mode == RENDER_MODE_CLIP) { if (_clip_mode == CLIP_MODE_MASK) { - if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { + if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD); } else { cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); -- cgit v1.2.3 From c35d732013f71fd9096a464ab53953129fb919cb Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 9 May 2011 00:43:56 +0200 Subject: Fix compilation on GCC 4.6 (bzr r10202) --- src/2geom/transforms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/2geom/transforms.h b/src/2geom/transforms.h index 1c965eb9f..48d4b1dba 100644 --- a/src/2geom/transforms.h +++ b/src/2geom/transforms.h @@ -209,7 +209,7 @@ protected: public: Coord factor() const { return f; } void setFactor(Coord nf) { f = nf; } - S &operator*=(S const &s) { f += s.f; return *static_cast(this); } + S &operator*=(S const &s) { f += s.f; return static_cast(*this); } bool operator==(S const &s) const { return f == s.f; } S inverse() const { return S(-f); } static S identity() { return S(0); } -- cgit v1.2.3 From f365062bdb05d23dbf33073af566f98002ada583 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 9 May 2011 23:49:35 -0700 Subject: Added simple usage of most recent file locations. (bzr r10204) --- src/resource-manager.cpp | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/resource-manager.cpp b/src/resource-manager.cpp index a68b2c7ae..0ccc05d49 100644 --- a/src/resource-manager.cpp +++ b/src/resource-manager.cpp @@ -8,11 +8,13 @@ #include #include +#include #include #include #include #include #include +#include #include "resource-manager.h" @@ -132,6 +134,25 @@ std::map ResourceManagerImpl::locateLinks(Glib::us { std::map result; + + // Note: we use a vector because we want them to stay in order: + std::vector priorLocations; + + Glib::RefPtr recentMgr = Gtk::RecentManager::get_default(); + std::vector< Glib::RefPtr > recentItems = recentMgr->get_items(); + for ( std::vector< Glib::RefPtr >::iterator it = recentItems.begin(); it != recentItems.end(); ++it ) { + Glib::ustring uri = (*it)->get_uri(); + std::string scheme = Glib::uri_parse_scheme(uri); + if ( scheme == "file" ) { + std::string path = Glib::filename_from_uri(uri); + path = Glib::path_get_dirname(path); + if ( std::find(priorLocations.begin(), priorLocations.end(), path) == priorLocations.end() ) { + // TODO debug g_message(" ==>[%s]", path.c_str()); + priorLocations.push_back(path); + } + } + } + // At the moment we expect this list to contain file:// references, or simple relative or absolute paths. for ( std::vector::const_iterator it = brokenLinks.begin(); it != brokenLinks.end(); ++it ) { // TODO debug g_message("========{%s}", it->c_str()); @@ -139,6 +160,7 @@ std::map ResourceManagerImpl::locateLinks(Glib::us std::string uri; if ( extractFilepath( *it, uri ) ) { // We were able to get some path. Check it + std::string origPath = uri; if ( !Glib::path_is_absolute(uri) ) { uri = Glib::build_filename(docbase, uri); @@ -165,11 +187,25 @@ std::map ResourceManagerImpl::locateLinks(Glib::us exists = Glib::file_test(rebuild, Glib::FILE_TEST_EXISTS); // TODO debug g_message(" [%s] [%s]%s", tmp.c_str(), remainder.c_str(), exists ? " XXXX" : ""); - if ( exists ) { - Glib::ustring replacement = Glib::filename_to_utf8( remainder ); - result[*it] = replacement; + } + + if ( !exists ) { + // TODO debug g_message("Expanding the search..."); + + // Check if the MRU bases point us to it. + if ( !Glib::path_is_absolute(origPath) ) { + for ( std::vector::iterator it = priorLocations.begin(); !exists && (it != priorLocations.end()); ++it ) { + remainder = Glib::build_filename( *it, origPath ); + exists = Glib::file_test( remainder, Glib::FILE_TEST_EXISTS ); + } } } + + if ( exists ) { + bool isAbsolute = Glib::path_is_absolute( remainder ); + Glib::ustring replacement = isAbsolute ? Glib::filename_to_uri( remainder ) : Glib::filename_to_utf8( remainder ); + result[*it] = replacement; + } } } } @@ -186,7 +222,7 @@ bool ResourceManagerImpl::fixupBrokenLinks(SPDocument *doc) std::vector brokenHrefs = findBrokenLinks(doc); if ( !brokenHrefs.empty() ) { - // TODO debug g_message(" FOUND SOME LINKS %d", brokenHrefs.size()); + // TODO debug g_message(" FOUND SOME LINKS %d", static_cast(brokenHrefs.size())); for ( std::vector::iterator it = brokenHrefs.begin(); it != brokenHrefs.end(); ++it ) { // TODO debug g_message(" [%s]", it->c_str()); } -- cgit v1.2.3 From 010da2dbdf05c0fa2ea791cb9d75a558551c8413 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 10 May 2011 00:48:37 -0700 Subject: Convert fixed paths to relative, including .. (bzr r10205) --- src/resource-manager.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'src') diff --git a/src/resource-manager.cpp b/src/resource-manager.cpp index 0ccc05d49..14a5ccfb8 100644 --- a/src/resource-manager.cpp +++ b/src/resource-manager.cpp @@ -25,6 +25,76 @@ namespace Inkscape { +std::vector splitPath( std::string const &path ) +{ + std::vector parts; + + std::string prior; + std::string tmp = path; + while ( !tmp.empty() && (tmp != prior) ) { + prior = tmp; + + parts.push_back( Glib::path_get_basename(tmp) ); + tmp = Glib::path_get_dirname(tmp); + } + if ( !parts.empty() ) { + std::reverse(parts.begin(), parts.end()); + } + + return parts; +} + +std::string convertPathToRelative( std::string const &path, std::string const &docbase ) +{ + std::string result = path; + + if ( !path.empty() && Glib::path_is_absolute(path) ) { + // Whack the parts into pieces + + std::vector parts = splitPath(path); + std::vector baseParts = splitPath(docbase); + + // TODO debug g_message("+++++++++++++++++++++++++"); + for ( std::vector::iterator it = parts.begin(); it != parts.end(); ++it ) { + // TODO debug g_message(" [%s]", it->c_str()); + } + // TODO debug g_message(" - - - - - - - - - - - - - - - "); + for ( std::vector::iterator it = baseParts.begin(); it != baseParts.end(); ++it ) { + // TODO debug g_message(" [%s]", it->c_str()); + } + // TODO debug g_message("+++++++++++++++++++++++++"); + + if ( !parts.empty() && !baseParts.empty() && (parts[0] == baseParts[0]) ) { + // Both paths have the same root. We can proceed. + while ( !parts.empty() && !baseParts.empty() && (parts[0] == baseParts[0]) ) { + parts.erase( parts.begin() ); + baseParts.erase( baseParts.begin() ); + } + + // TODO debug g_message("+++++++++++++++++++++++++"); + for ( std::vector::iterator it = parts.begin(); it != parts.end(); ++it ) { + // TODO debug g_message(" [%s]", it->c_str()); + } + // TODO debug g_message(" - - - - - - - - - - - - - - - "); + for ( std::vector::iterator it = baseParts.begin(); it != baseParts.end(); ++it ) { + // TODO debug g_message(" [%s]", it->c_str()); + } + // TODO debug g_message("+++++++++++++++++++++++++"); + + if ( !parts.empty() ) { + result.clear(); + + for ( size_t i = 0; i < baseParts.size(); ++i ) { + parts.insert(parts.begin(), ".."); + } + result = Glib::build_filename( parts ); + // TODO debug g_message("----> [%s]", result.c_str()); + } + } + } + + return result; +} class ResourceManagerImpl : public ResourceManager { @@ -202,6 +272,11 @@ std::map ResourceManagerImpl::locateLinks(Glib::us } if ( exists ) { + if ( Glib::path_is_absolute( remainder ) ) { + // TODO debug g_message("Need to convert to relative if possible [%s]", remainder.c_str()); + remainder = convertPathToRelative( remainder, docbase ); + } + bool isAbsolute = Glib::path_is_absolute( remainder ); Glib::ustring replacement = isAbsolute ? Glib::filename_to_uri( remainder ) : Glib::filename_to_utf8( remainder ); result[*it] = replacement; -- cgit v1.2.3 From 61495157884d4282f8539935f664c2453b5fb08e Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 10 May 2011 07:48:19 -0700 Subject: Fix test case to compile. (bzr r10203.1.1) --- src/dir-util-test.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/dir-util-test.h b/src/dir-util-test.h index 8f8475873..cc3bc20b8 100644 --- a/src/dir-util-test.h +++ b/src/dir-util-test.h @@ -17,17 +17,17 @@ public: {"/foo/bar/baz", "/foo/", "bar/baz"}, {"/foo/bar/baz", "/", "foo/bar/baz"}, {"/foo/bar/baz", "/foo/qux", "/foo/bar/baz"}, - {"/foo", NULL, "/foo"} }; for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ ) { - char const* result = sp_relative_path_from_path( cases[i][0], cases[i][1] ); - TS_ASSERT( result ); - TS_ASSERT( cases[i][2] ); - if ( result && cases[i][2] ) - { - TS_ASSERT_EQUALS( std::string(result), std::string(cases[i][2]) ); + if ( cases[i][0] && cases[i][1] ) { // std::string can't use null. + std::string result = sp_relative_path_from_path( cases[i][0], cases[i][1] ); + TS_ASSERT( !result.empty() ); + if ( !result.empty() ) + { + TS_ASSERT_EQUALS( result, std::string(cases[i][2]) ); + } } } } -- cgit v1.2.3 From 30b576108f09306c301c3f1ec2ea1a1a31d450e3 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 11 May 2011 11:49:37 -0400 Subject: Fix fallback to MRU locations. (bzr r10207) --- src/resource-manager.cpp | 56 +++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/resource-manager.cpp b/src/resource-manager.cpp index 14a5ccfb8..b5cf67f91 100644 --- a/src/resource-manager.cpp +++ b/src/resource-manager.cpp @@ -39,6 +39,9 @@ std::vector splitPath( std::string const &path ) } if ( !parts.empty() ) { std::reverse(parts.begin(), parts.end()); + if ( (parts[0] == ".") && (path[0] != '.') ) { + parts.erase(parts.begin()); + } } return parts; @@ -124,6 +127,8 @@ public: bool extractFilepath( Glib::ustring const &href, std::string &uri ); + bool searchUpwards( std::string const &base, std::string const &subpath, std::string &dest ); + protected: }; @@ -239,25 +244,8 @@ std::map ResourceManagerImpl::locateLinks(Glib::us if ( !Glib::file_test(uri, Glib::FILE_TEST_EXISTS) ) { // TODO debug g_message(" DOES NOT EXIST."); - std::string tmp = uri; - std::string prior; std::string remainder; - bool exists = false; - while ( (tmp != prior) && !exists) { - prior = tmp; - std::string basename = Glib::path_get_basename(tmp); - tmp = Glib::path_get_dirname(tmp); - if ( remainder.empty() ) { - remainder = basename; - } else { - remainder = Glib::build_filename(basename, remainder); - } - - std::string rebuild = Glib::build_filename(docbase, remainder); - exists = Glib::file_test(rebuild, Glib::FILE_TEST_EXISTS); - - // TODO debug g_message(" [%s] [%s]%s", tmp.c_str(), remainder.c_str(), exists ? " XXXX" : ""); - } + bool exists = searchUpwards( docbase, origPath, remainder ); if ( !exists ) { // TODO debug g_message("Expanding the search..."); @@ -265,8 +253,7 @@ std::map ResourceManagerImpl::locateLinks(Glib::us // Check if the MRU bases point us to it. if ( !Glib::path_is_absolute(origPath) ) { for ( std::vector::iterator it = priorLocations.begin(); !exists && (it != priorLocations.end()); ++it ) { - remainder = Glib::build_filename( *it, origPath ); - exists = Glib::file_test( remainder, Glib::FILE_TEST_EXISTS ); + exists = searchUpwards( *it, origPath, remainder ); } } } @@ -348,6 +335,35 @@ bool ResourceManagerImpl::fixupBrokenLinks(SPDocument *doc) } +bool ResourceManagerImpl::searchUpwards( std::string const &base, std::string const &subpath, std::string &dest ) +{ + bool exists = false; + // TODO debug g_message("............"); + + std::vector parts = splitPath(subpath); + std::vector baseParts = splitPath(base); + + while ( !exists && !baseParts.empty() ) { + std::vector current; + current.insert(current.begin(), parts.begin(), parts.end()); + // TODO debug g_message(" ---{%s}", Glib::build_filename( baseParts ).c_str()); + while ( !exists && !current.empty() ) { + std::vector combined; + combined.insert( combined.end(), baseParts.begin(), baseParts.end() ); + combined.insert( combined.end(), current.begin(), current.end() ); + std::string filepath = Glib::build_filename( combined ); + exists = Glib::file_test(filepath, Glib::FILE_TEST_EXISTS); + // TODO debug g_message(" ...[%s] %s", filepath.c_str(), (exists ? "XXX" : "")); + if ( exists ) { + dest = filepath; + } + current.erase( current.begin() ); + } + baseParts.pop_back(); + } + + return exists; +} static ResourceManagerImpl* theInstance = 0; -- cgit v1.2.3 From bb2e451ada0bbd3a04dddd7732a44c83f135af04 Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Wed, 11 May 2011 13:50:57 -0400 Subject: Don't adjust the shink/grow value because we're saving the units. Fixed bugs: - https://launchpad.net/bugs/781244 (bzr r10207.1.1) --- src/widgets/toolbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 8496ec0d0..0dcecfcb1 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -8377,7 +8377,9 @@ static void paintbucket_offset_changed(GtkAdjustment *adj, GObject *tbl) SPUnit const *unit = tracker->getActiveUnit(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/tools/paintbucket/offset", (gdouble)sp_units_get_pixels(adj->value, *unit)); + // Don't adjust the offset value because we're saving the + // unit and it'll be correctly handled on load. + prefs->setDouble("/tools/paintbucket/offset", (gdouble)adj->value); prefs->setString("/tools/paintbucket/offsetunits", sp_unit_get_abbreviation(unit)); } -- cgit v1.2.3 From 08eedb1441005f836d223b6143dc15c8009a3535 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 17 May 2011 23:25:49 -0700 Subject: Made dependencies explicit and bumped versions. (bzr r10208) --- src/display/sp-canvas.cpp | 7 +------ src/ege-adjustment-action.cpp | 10 ---------- src/ege-select-one-action.cpp | 3 --- src/ink-comboboxentry-action.cpp | 27 --------------------------- src/ink-comboboxentry-action.h | 2 -- src/inkscape.cpp | 4 ---- src/io/sys.cpp | 4 +--- src/ui/dialog/glyphs.cpp | 20 -------------------- src/ui/dialog/glyphs.h | 2 -- src/widgets/sp-color-slider.cpp | 18 ++++++------------ src/widgets/sp-color-wheel-selector.cpp | 4 ---- 11 files changed, 8 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 2d1e57092..0d450362a 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -47,12 +47,9 @@ using Inkscape::Debug::GdkEventLatencyTracker; -// GTK_CHECK_VERSION returns false on failure -#define HAS_GDK_EVENT_REQUEST_MOTIONS GTK_CHECK_VERSION(2, 12, 0) - // gtk_check_version returns non-NULL on failure static bool const HAS_BROKEN_MOTION_HINTS = - true || gtk_check_version(2, 12, 0) != NULL || !HAS_GDK_EVENT_REQUEST_MOTIONS; + true || gtk_check_version(2, 12, 0) != NULL; // Define this to visualize the regions to be redrawn //#define DEBUG_REDRAW 1; @@ -1599,9 +1596,7 @@ sp_canvas_scroll (GtkWidget *widget, GdkEventScroll *event) static inline void request_motions(GdkWindow *w, GdkEventMotion *event) { gdk_window_get_pointer(w, NULL, NULL, NULL); -#if HAS_GDK_EVENT_REQUEST_MOTIONS gdk_event_request_motions(event); -#endif } /** diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 9c01b4c7c..b8ee66f08 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -47,10 +47,8 @@ #include #include #include -#if GTK_CHECK_VERSION(2,12,0) #include #include -#endif /* GTK_CHECK_VERSION(2,12,0) */ #include #include #include @@ -96,7 +94,6 @@ enum { APPEARANCE_MINIMAL, /* no label, just choices in a drop-down menu */ }; -#if GTK_CHECK_VERSION(2,12,0) /* TODO need to have appropriate icons setup for these: */ static const gchar *floogles[] = { GTK_STOCK_REMOVE, @@ -105,7 +102,6 @@ static const gchar *floogles[] = { GTK_STOCK_ABOUT, GTK_STOCK_GO_UP, 0}; -#endif /* GTK_CHECK_VERSION(2,12,0) */ typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr; @@ -846,12 +842,10 @@ static GtkWidget* create_tool_item( GtkAction* action ) gtk_scale_set_digits( GTK_SCALE(spinbutton), 0 ); g_signal_connect( G_OBJECT(spinbutton), "format-value", G_CALLBACK(slider_format_falue), leakyForNow ); -#if GTK_CHECK_VERSION(2,12,0) } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 ); gtk_scale_button_set_adjustment( GTK_SCALE_BUTTON(spinbutton), act->private_data->adj ); gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); -#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { if ( gFactoryCb ) { spinbutton = gFactoryCb( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); @@ -913,10 +907,8 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_signal_connect_swapped( G_OBJECT(spinbutton), "event", G_CALLBACK(event_cb), action ); if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { /* */ -#if GTK_CHECK_VERSION(2,12,0) } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { /* */ -#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { gtk_entry_set_width_chars( GTK_ENTRY(spinbutton), act->private_data->digits + 3 ); } @@ -962,10 +954,8 @@ gboolean focus_in_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) EgeAdjustmentAction* action = EGE_ADJUSTMENT_ACTION( data ); if ( GTK_IS_SPIN_BUTTON(widget) ) { action->private_data->lastVal = gtk_spin_button_get_value( GTK_SPIN_BUTTON(widget) ); -#if GTK_CHECK_VERSION(2,12,0) } else if ( GTK_IS_SCALE_BUTTON(widget) ) { action->private_data->lastVal = gtk_scale_button_get_value( GTK_SCALE_BUTTON(widget) ); -#endif /* GTK_CHECK_VERSION(2,12,0) */ } else if (GTK_IS_RANGE(widget) ) { action->private_data->lastVal = gtk_range_get_value( GTK_RANGE(widget) ); } diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 83a083425..1c3ec1ff5 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -935,7 +935,6 @@ void resync_sensitive( EgeSelectOneAction* act ) GSList* group = (GSList*)data; // List is backwards in group as compared to GtkTreeModel, we better do matching. while ( group ) { -#if GTK_CHECK_VERSION(2,16,0) GtkRadioAction* ract = GTK_RADIO_ACTION(group->data); const gchar* label = gtk_action_get_label( GTK_ACTION( ract ) ); @@ -964,8 +963,6 @@ void resync_sensitive( EgeSelectOneAction* act ) } gtk_action_set_sensitive( GTK_ACTION(ract), sens ); -#endif - group = g_slist_next(group); } } diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index 74034e537..eaaf62113 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -266,9 +266,7 @@ static void ink_comboboxentry_action_init (Ink_ComboBoxEntry_Action *action) action->active = -1; action->text = NULL; action->entry_completion = NULL; -#if !GTK_CHECK_VERSION(2,16,0) action->indicator = NULL; -#endif action->popup = false; action->warning = NULL; action->altx_name = NULL; @@ -348,15 +346,7 @@ GtkWidget* create_tool_item( GtkAction* action ) { GtkWidget *align = gtk_alignment_new(0, 0.5, 0, 0); -#if GTK_CHECK_VERSION(2,16,0) gtk_container_add( GTK_CONTAINER(align), comboBoxEntry ); -#else // GTK_CHECK_VERSION(2,16,0) - GtkWidget *hbox = gtk_hbox_new( FALSE, 0 ); - ink_comboboxentry_action->indicator = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_box_pack_start( GTK_BOX(hbox), comboBoxEntry, TRUE, TRUE, 0 ); - gtk_box_pack_start( GTK_BOX(hbox), ink_comboboxentry_action->indicator, FALSE, FALSE, 0 ); - gtk_container_add( GTK_CONTAINER(align), hbox ); -#endif // GTK_CHECK_VERSION(2,16,0) gtk_container_add( GTK_CONTAINER(item), align ); } @@ -415,10 +405,7 @@ GtkWidget* create_tool_item( GtkAction* action ) } -#if GTK_CHECK_VERSION(2,16,0) gtk_action_connect_proxy( GTK_ACTION( action ), item ); -#endif - gtk_widget_show_all( item ); } else { @@ -480,7 +467,6 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink // Show or hide warning if( ink_comboboxentry_action->active == -1 && ink_comboboxentry_action->warning != NULL ) { -#if GTK_CHECK_VERSION(2,16,0) { GtkStockItem item; gboolean isStock = gtk_stock_lookup( GTK_STOCK_DIALOG_WARNING, &item ); @@ -498,22 +484,13 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink gtk_entry_set_icon_tooltip_text( ink_comboboxentry_action->entry, GTK_ENTRY_ICON_SECONDARY, ink_comboboxentry_action->warning ); -#else // GTK_CHECK_VERSION(2,16,0) - gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, ink_comboboxentry_action->warning ); -#endif // GTK_CHECK_VERSION(2,16,0) } else { -#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_from_icon_name( GTK_ENTRY(ink_comboboxentry_action->entry), GTK_ENTRY_ICON_SECONDARY, NULL ); gtk_entry_set_icon_from_stock( GTK_ENTRY(ink_comboboxentry_action->entry), GTK_ENTRY_ICON_SECONDARY, NULL ); -#else // GTK_CHECK_VERSION(2,16,0) - gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), NULL, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, NULL ); -#endif // GTK_CHECK_VERSION(2,16,0) } } @@ -585,13 +562,9 @@ void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action, // Widget may not have been created.... if( action->entry ) { -#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_tooltip_text( GTK_ENTRY(action->entry), GTK_ENTRY_ICON_SECONDARY, action->warning ); -#else // GTK_CHECK_VERSION(2,16,0) - gtk_image_set_from_stock( GTK_IMAGE(action->indicator), action->warning ? GTK_STOCK_DIALOG_WARNING : 0, GTK_ICON_SIZE_SMALL_TOOLBAR ); -#endif // GTK_CHECK_VERSION(2,16,0) } } diff --git a/src/ink-comboboxentry-action.h b/src/ink-comboboxentry-action.h index e080e6cdf..1a83cb053 100644 --- a/src/ink-comboboxentry-action.h +++ b/src/ink-comboboxentry-action.h @@ -49,9 +49,7 @@ struct _Ink_ComboBoxEntry_Action { GtkComboBoxEntry *combobox; GtkEntry *entry; GtkEntryCompletion *entry_completion; -#if !GTK_CHECK_VERSION(2,16,0) GtkWidget *indicator; -#endif gpointer cell_data_func; // drop-down menu format diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 91e3b0c5f..1b0893c0b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -442,11 +442,7 @@ void inkscape_autosave_init() // Turn on autosave guint32 timeout = prefs->getInt("/options/autosave/interval", 10) * 60; // g_debug("options.autosave.interval = %d", prefs->getInt("/options/autosave/interval", 10)); -#if GLIB_CHECK_VERSION(2,14,0) autosave_timeout_id = g_timeout_add_seconds(timeout, inkscape_autosave, NULL); -#else - autosave_timeout_id = g_timeout_add(timeout * 1000, inkscape_autosave, NULL); -#endif } } diff --git a/src/io/sys.cpp b/src/io/sys.cpp index a68d02707..e6c512be2 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -19,9 +19,7 @@ #include #include #include -#if GLIB_CHECK_VERSION(2,6,0) - #include -#endif +#include #include #include diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index f3d7ed971..8eef5d89b 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -48,7 +48,6 @@ GlyphsPanel &GlyphsPanel::getInstance() } -#if GLIB_CHECK_VERSION(2,14,0) static std::map & getScriptToName() { static bool init = false; @@ -123,8 +122,6 @@ static std::map & getScriptToName() mappings[G_UNICODE_SCRIPT_PHOENICIAN] = _("Phoenician"); mappings[G_UNICODE_SCRIPT_PHAGS_PA] = _("Phags-pa"); mappings[G_UNICODE_SCRIPT_NKO] = _("N'Ko"); - -#if GLIB_CHECK_VERSION(2,14,0) mappings[G_UNICODE_SCRIPT_KAYAH_LI] = _("Kayah Li"); mappings[G_UNICODE_SCRIPT_LEPCHA] = _("Lepcha"); mappings[G_UNICODE_SCRIPT_REJANG] = _("Rejang"); @@ -136,11 +133,9 @@ static std::map & getScriptToName() mappings[G_UNICODE_SCRIPT_CARIAN] = _("Carian"); mappings[G_UNICODE_SCRIPT_LYCIAN] = _("Lycian"); mappings[G_UNICODE_SCRIPT_LYDIAN] = _("Lydian"); -#endif // GLIB_CHECK_VERSION(2,14,0) } return mappings; } -#endif // GLIB_CHECK_VERSION(2,14,0) typedef std::pair Range; typedef std::pair NamedRange; @@ -337,9 +332,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : entry(0), label(0), insertBtn(0), -#if GLIB_CHECK_VERSION(2,14,0) scriptCombo(0), -#endif // GLIB_CHECK_VERSION(2,14,0) fsel(0), targetDesktop(0), deskTrack(), @@ -366,7 +359,6 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : // ------------------------------- -#if GLIB_CHECK_VERSION(2,14,0) { Gtk::Label *label = new Gtk::Label(_("Script: ")); table->attach( *Gtk::manage(label), @@ -391,7 +383,6 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : } row++; -#endif // GLIB_CHECK_VERSION(2,14,0) // ------------------------------- @@ -464,10 +455,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : insertBtn = new Gtk::Button(_("Append")); conn = insertBtn->signal_clicked().connect(sigc::mem_fun(*this, &GlyphsPanel::insertText)); instanceConns.push_back(conn); -#if GTK_CHECK_VERSION(2,18,0) - //gtkmm 2.18 insertBtn->set_can_default(); -#endif insertBtn->set_sensitive(false); box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK); @@ -607,13 +595,11 @@ void GlyphsPanel::glyphSelectionChanged() Glib::ustring scriptName; -#if GLIB_CHECK_VERSION(2,14,0) GUnicodeScript script = g_unichar_get_script(ch); std::map mappings = getScriptToName(); if (mappings.find(script) != mappings.end()) { scriptName = mappings[script]; } -#endif gchar * tmp = g_strdup_printf("U+%04X %s", ch, scriptName.c_str()); label->set_text(tmp); } @@ -680,7 +666,6 @@ void GlyphsPanel::rebuild() if (font) { //double sp_font_selector_get_size (SPFontSelector *fsel); -#if GLIB_CHECK_VERSION(2,14,0) GUnicodeScript script = G_UNICODE_SCRIPT_INVALID_CODE; Glib::ustring scriptName = scriptCombo->get_active_text(); std::map items = getScriptToName(); @@ -690,7 +675,6 @@ void GlyphsPanel::rebuild() break; } } -#endif // GLIB_CHECK_VERSION(2,14,0) // Disconnect the model while we update it. Simple work-around for 5x+ performance boost. Glib::RefPtr tmp = Gtk::ListStore::create(*getColumns()); @@ -707,13 +691,9 @@ void GlyphsPanel::rebuild() for (gunichar ch = lower; ch <= upper; ch++) { int glyphId = font->MapUnicodeChar(ch); if (glyphId > 0) { -#if GLIB_CHECK_VERSION(2,14,0) if ((script == G_UNICODE_SCRIPT_INVALID_CODE) || (script == g_unichar_get_script(ch))) { present.push_back(ch); } -#else - present.push_back(ch); -#endif } } diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h index d6c731dda..1440a693f 100644 --- a/src/ui/dialog/glyphs.h +++ b/src/ui/dialog/glyphs.h @@ -77,9 +77,7 @@ private: Gtk::Entry *entry; Gtk::Label *label; Gtk::Button *insertBtn; -#if GLIB_CHECK_VERSION(2,14,0) Gtk::ComboBoxText *scriptCombo; -#endif //GLIB_CHECK_VERSION(2,14,0) Gtk::ComboBoxText *rangeCombo; SPFontSelector *fsel; SPDesktop *targetDesktop; diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index 0e30b1ce6..0690caaab 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -1,5 +1,3 @@ -#define __SP_COLOR_SLIDER_C__ - /* * A slider with colored background * @@ -329,21 +327,17 @@ sp_color_slider_new (GtkAdjustment *adjustment) return GTK_WIDGET (slider); } -void -sp_color_slider_set_adjustment (SPColorSlider *slider, GtkAdjustment *adjustment) +void sp_color_slider_set_adjustment(SPColorSlider *slider, GtkAdjustment *adjustment) { - g_return_if_fail (slider != NULL); - g_return_if_fail (SP_IS_COLOR_SLIDER (slider)); + g_return_if_fail (slider != NULL); + g_return_if_fail (SP_IS_COLOR_SLIDER (slider)); - if (!adjustment) { - adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0); - } -#if GTK_CHECK_VERSION (2,14,0) - else { + if (!adjustment) { + adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0); + } else { gtk_adjustment_set_page_increment(adjustment, 0.0); gtk_adjustment_set_page_size(adjustment, 0.0); } -#endif if (slider->adjustment != adjustment) { if (slider->adjustment) { diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 2e36a024e..784dd23ad 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -135,14 +135,12 @@ static void resizeHSVWheel( GtkHSV *hsv, GtkAllocation *allocation ) gtk_hsv_set_metrics( hsv, diam, ring ); } -#if GTK_CHECK_VERSION(2,18,0) static void handleWheelStyleSet(GtkHSV *hsv, GtkStyle* /*previous*/, gpointer /*userData*/) { GtkAllocation allocation = {0, 0, 0, 0}; gtk_widget_get_allocation( GTK_WIDGET(hsv), &allocation ); resizeHSVWheel( hsv, &allocation ); } -#endif // GTK_CHECK_VERSION(2,18,0) static void handleWheelAllocation(GtkHSV *hsv, GtkAllocation *allocation, gpointer /*userData*/) { @@ -220,10 +218,8 @@ void ColorWheelSelector::init() // GTK does not automatically scale the color wheel, so we have to add that in: gtk_signal_connect( GTK_OBJECT(_wheel), "size-allocate", GTK_SIGNAL_FUNC(handleWheelAllocation), _csel ); -#if GTK_CHECK_VERSION(2,18,0) gtk_signal_connect( GTK_OBJECT(_wheel), "style-set", GTK_SIGNAL_FUNC(handleWheelStyleSet), _csel ); -#endif // GTK_CHECK_VERSION(2,18,0) } static void -- cgit v1.2.3 From 7239afff554c14388dd6e930d903beb7bbd8b2ca Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Wed, 18 May 2011 17:04:33 -0300 Subject: Adding inkscape:label parameter to guidelines so that our guidelanes can display labels (we still dont have a user interface, but files with that parameter will render correctly) (bzr r10209) --- src/desktop-events.cpp | 2 +- src/display/guideline.cpp | 58 +++++++++++++++++++++++++++++++++++++++-------- src/display/guideline.h | 4 +++- src/sp-guide.cpp | 25 +++++++++++++++++++- src/sp-guide.h | 2 ++ src/ui/widget/ruler.cpp | 2 +- 6 files changed, 80 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index b458827f0..b7b7529a1 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -131,7 +131,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge } } - guide = sp_guideline_new(desktop->guides, event_dt, normal); + guide = sp_guideline_new(desktop->guides, NULL, event_dt, normal); sp_guideline_set_color(SP_GUIDELINE(guide), desktop->namedview->guidehicolor); gdk_pointer_grab(widget->window, FALSE, (GdkEventMask)(GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ), diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index bebec2852..f0e1c7724 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -19,6 +19,8 @@ #include "sp-canvas-util.h" #include "sp-ctrlpoint.h" #include "guideline.h" +#include "cairo.h" +#include "inkscape-cairo.h" static void sp_guideline_class_init(SPGuideLineClass *c); static void sp_guideline_init(SPGuideLine *guideline); @@ -78,6 +80,7 @@ static void sp_guideline_init(SPGuideLine *gl) gl->sensitive = 0; gl->origin = NULL; + gl->label = NULL; } static void sp_guideline_destroy(GtkObject *object) @@ -99,25 +102,35 @@ static void sp_guideline_destroy(GtkObject *object) static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) { + //TODO: the routine that renders the label of a specific guideline sometimes + // ends up erasing the labels of the other guidelines. + // Maybe we should render all labels everytime. + SPGuideLine const *gl = SP_GUIDELINE (item); sp_canvas_prepare_buffer(buf); + cairo_t* ctx = nr_create_cairo_context_canvasbuf (NULL /*area*/, buf); //this function ignores the "area" parameter + cairo_set_font_size (ctx, 10); + cairo_set_line_width (ctx, 10); + cairo_set_source_rgb (ctx, 0, 0, 0); unsigned int const r = NR_RGBA32_R (gl->rgba); unsigned int const g = NR_RGBA32_G (gl->rgba); unsigned int const b = NR_RGBA32_B (gl->rgba); unsigned int const a = NR_RGBA32_A (gl->rgba); + int px = (int) Inkscape::round(gl->point_on_line[Geom::X]); + int py = (int) Inkscape::round(gl->point_on_line[Geom::Y]); + if (gl->is_vertical()) { - int position = (int) Inkscape::round(gl->point_on_line[Geom::X]); - if (position < buf->rect.x0 || position >= buf->rect.x1) { + if (px < buf->rect.x0 || px >= buf->rect.x1) { return; } int p0 = buf->rect.y0; int p1 = buf->rect.y1; int step = buf->buf_rowstride; - unsigned char *d = buf->buf + 4 * (position - buf->rect.x0); + unsigned char *d = buf->buf + 4 * (px - buf->rect.x0); for (int p = p0; p < p1; p++) { d[0] = NR_COMPOSEN11_1111(r, a, d[0]); @@ -125,16 +138,22 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) d[2] = NR_COMPOSEN11_1111(b, a, d[2]); d += step; } + + if (gl->label){ + cairo_move_to(ctx, px - buf->rect.x0 + 5, py - buf->rect.y0); + cairo_rotate(ctx, 3.1415/2); + cairo_show_text(ctx, gl->label); + } + } else if (gl->is_horizontal()) { - int position = (int) Inkscape::round(gl->point_on_line[Geom::Y]); - if (position < buf->rect.y0 || position >= buf->rect.y1) { + if (py < buf->rect.y0 || py >= buf->rect.y1) { return; } int p0 = buf->rect.x0; int p1 = buf->rect.x1; int step = 4; - unsigned char *d = buf->buf + (position - buf->rect.y0) * buf->buf_rowstride; + unsigned char *d = buf->buf + (py - buf->rect.y0) * buf->buf_rowstride; for (int p = p0; p < p1; p++) { d[0] = NR_COMPOSEN11_1111(r, a, d[0]); @@ -142,6 +161,12 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) d[2] = NR_COMPOSEN11_1111(b, a, d[2]); d += step; } + + if (gl->label){ + cairo_move_to(ctx, px - buf->rect.x0, py - buf->rect.y0 - 5); + cairo_show_text(ctx, gl->label); + } + } else { // render angled line, once intersection has been detected, draw from there. Geom::Point parallel_to_line( gl->normal_to_line[Geom::Y], @@ -180,6 +205,12 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) sp_guideline_drawline (buf, static_cast(round(x_intersect_bottom)), buf->rect.y1, static_cast(round(x_intersect_top)), buf->rect.y0, gl->rgba); return; } + + if (gl->label){ + cairo_move_to(ctx, px - buf->rect.x0 + 5, py - buf->rect.y0); + cairo_rotate(ctx, atan2(gl->normal_to_line[Geom::X], gl->normal_to_line[Geom::Y])); + cairo_show_text(ctx, gl->label); + } } } @@ -198,10 +229,11 @@ static void sp_guideline_update(SPCanvasItem *item, Geom::Affine const &affine, sp_canvas_item_request_update(SP_CANVAS_ITEM (gl->origin)); if (gl->is_horizontal()) { - sp_canvas_update_bbox (item, -1000000, (int) Inkscape::round(gl->point_on_line[Geom::Y]), 1000000, (int) Inkscape::round(gl->point_on_line[Geom::Y] + 1)); + sp_canvas_update_bbox (item, -1000000, (int) Inkscape::round(gl->point_on_line[Geom::Y] - 16), 1000000, (int) Inkscape::round(gl->point_on_line[Geom::Y] + 1)); } else if (gl->is_vertical()) { - sp_canvas_update_bbox (item, (int) Inkscape::round(gl->point_on_line[Geom::X]), -1000000, (int) Inkscape::round(gl->point_on_line[Geom::X] + 1), 1000000); + sp_canvas_update_bbox (item, (int) Inkscape::round(gl->point_on_line[Geom::X]), -1000000, (int) Inkscape::round(gl->point_on_line[Geom::X] + 16), 1000000); } else { + //TODO: labels in angled guidelines are not showing up for some reason. sp_canvas_update_bbox (item, -1000000, -1000000, 1000000, 1000000); } } @@ -222,7 +254,7 @@ static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem return MAX(fabs(distance)-1, 0); } -SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, Geom::Point point_on_line, Geom::Point normal) +SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point point_on_line, Geom::Point normal) { SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_GUIDELINE, NULL); SPCanvasItem *origin = sp_canvas_item_new(parent, SP_TYPE_CTRLPOINT, NULL); @@ -232,6 +264,7 @@ SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, Geom::Point point_on_line, gl->origin = cp; normal.normalize(); + gl->label = label; gl->normal_to_line = normal; gl->angle = tan( -gl->normal_to_line[Geom::X] / gl->normal_to_line[Geom::Y]); sp_guideline_set_position(gl, point_on_line); @@ -241,6 +274,13 @@ SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, Geom::Point point_on_line, return item; } +void sp_guideline_set_label(SPGuideLine *gl, char* label) +{ + gl->label = label; + + sp_canvas_item_request_update(SP_CANVAS_ITEM (gl)); +} + void sp_guideline_set_position(SPGuideLine *gl, Geom::Point point_on_line) { sp_canvas_item_affine_absolute(SP_CANVAS_ITEM (gl), Geom::Affine(Geom::Translate(point_on_line))); diff --git a/src/display/guideline.h b/src/display/guideline.h index 9654d04a1..dbf990d1f 100644 --- a/src/display/guideline.h +++ b/src/display/guideline.h @@ -29,6 +29,7 @@ struct SPGuideLine { guint32 rgba; + char* label; Geom::Point normal_to_line; Geom::Point point_on_line; double angle; @@ -45,8 +46,9 @@ struct SPGuideLineClass { GType sp_guideline_get_type(); -SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, Geom::Point point_on_line, Geom::Point normal); +SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point point_on_line, Geom::Point normal); +void sp_guideline_set_label(SPGuideLine *gl, char* label); void sp_guideline_set_position(SPGuideLine *gl, Geom::Point point_on_line); void sp_guideline_set_normal(SPGuideLine *gl, Geom::Point normal_to_line); void sp_guideline_set_color(SPGuideLine *gl, unsigned int rgba); diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 7d36df4a3..1e51ee4d5 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -160,6 +160,7 @@ static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML (* ((SPObjectClass *) (parent_class))->build)(object, document, repr); } + object->readAttr( "inkscape:label" ); object->readAttr( "orientation" ); object->readAttr( "position" ); } @@ -183,6 +184,15 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) SPGuide *guide = SP_GUIDE(object); switch (key) { + case SP_ATTR_INKSCAPE_LABEL: + if (value) { + guide->label = g_strdup(value); + } else { + guide->label = NULL; + } + + sp_guide_set_label(*guide, guide->label, false); + break; case SP_ATTR_ORIENTATION: { if (value && !strcmp(value, "horizontal")) { @@ -291,7 +301,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) { void SPGuide::showSPGuide(SPCanvasGroup *group, GCallback handler) { - SPCanvasItem *item = sp_guideline_new(group, point_on_line, normal_to_line); + SPCanvasItem *item = sp_guideline_new(group, label, point_on_line, normal_to_line); sp_guideline_set_color(SP_GUIDELINE(item), color); g_signal_connect(G_OBJECT(item), "event", G_CALLBACK(handler), this); @@ -402,6 +412,19 @@ void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool */ } +void sp_guide_set_label(SPGuide &guide, char* label, bool const commit) +{ + g_assert(SP_IS_GUIDE(&guide)); + if (guide.views){ + sp_guideline_set_label(SP_GUIDELINE(guide.views->data), label); + } + + if (commit){ + //XML Tree being used directly while it shouldn't be + guide.getRepr()->setAttribute("label", label); + } +} + /** * Returns a human-readable description of the guideline for use in dialog boxes and status bar. * If verbose is false, only positioning information is included (useful for dialogs). diff --git a/src/sp-guide.h b/src/sp-guide.h index c53042da5..1dcdbc662 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -31,6 +31,7 @@ struct SPCanvasGroup; /* Represents the constraint on p that dot(g.direction, p) == g.position. */ class SPGuide : public SPObject { public: + char* label; Geom::Point normal_to_line; Geom::Point point_on_line; @@ -62,6 +63,7 @@ void sp_guide_create_guides_around_page(SPDesktop *dt); void sp_guide_moveto(SPGuide &guide, Geom::Point const point_on_line, bool const commit); void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool const commit); +void sp_guide_set_label(SPGuide &guide, char* const label, bool const commit); void sp_guide_remove(SPGuide *guide); char *sp_guide_description(SPGuide const *guide, const bool verbose = true); diff --git a/src/ui/widget/ruler.cpp b/src/ui/widget/ruler.cpp index a220a54ad..c6ac3a381 100644 --- a/src/ui/widget/ruler.cpp +++ b/src/ui/widget/ruler.cpp @@ -108,7 +108,7 @@ Ruler::on_button_press_event(GdkEventButton *evb) _dragging = true; sp_repr_set_boolean(repr, "showguides", TRUE); sp_repr_set_boolean(repr, "inkscape:guide-bbox", TRUE); - _guide = sp_guideline_new(_dt->guides, event_dt, _horiz_f ? Geom::Point(0.,1.) : Geom::Point(1.,0.)); + _guide = sp_guideline_new(_dt->guides, NULL, event_dt, _horiz_f ? Geom::Point(0.,1.) : Geom::Point(1.,0.)); sp_guideline_set_color(SP_GUIDELINE(_guide), _dt->namedview->guidehicolor); (void) get_window()->pointer_grab(false, Gdk::BUTTON_RELEASE_MASK | -- cgit v1.2.3 From a622000f4859173bb7ac484b86cefe9fa4f169e4 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 18 May 2011 21:43:01 -0700 Subject: Revert version bump so win devlibs can catch up. (bzr r10210) --- src/display/sp-canvas.cpp | 7 ++++++- src/ege-adjustment-action.cpp | 10 ++++++++++ src/ege-select-one-action.cpp | 3 +++ src/ink-comboboxentry-action.cpp | 27 +++++++++++++++++++++++++++ src/ink-comboboxentry-action.h | 2 ++ src/inkscape.cpp | 4 ++++ src/io/sys.cpp | 4 +++- src/ui/dialog/glyphs.cpp | 20 ++++++++++++++++++++ src/ui/dialog/glyphs.h | 2 ++ src/widgets/sp-color-slider.cpp | 18 ++++++++++++------ src/widgets/sp-color-wheel-selector.cpp | 4 ++++ 11 files changed, 93 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 0d450362a..2d1e57092 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -47,9 +47,12 @@ using Inkscape::Debug::GdkEventLatencyTracker; +// GTK_CHECK_VERSION returns false on failure +#define HAS_GDK_EVENT_REQUEST_MOTIONS GTK_CHECK_VERSION(2, 12, 0) + // gtk_check_version returns non-NULL on failure static bool const HAS_BROKEN_MOTION_HINTS = - true || gtk_check_version(2, 12, 0) != NULL; + true || gtk_check_version(2, 12, 0) != NULL || !HAS_GDK_EVENT_REQUEST_MOTIONS; // Define this to visualize the regions to be redrawn //#define DEBUG_REDRAW 1; @@ -1596,7 +1599,9 @@ sp_canvas_scroll (GtkWidget *widget, GdkEventScroll *event) static inline void request_motions(GdkWindow *w, GdkEventMotion *event) { gdk_window_get_pointer(w, NULL, NULL, NULL); +#if HAS_GDK_EVENT_REQUEST_MOTIONS gdk_event_request_motions(event); +#endif } /** diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index b8ee66f08..9c01b4c7c 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -47,8 +47,10 @@ #include #include #include +#if GTK_CHECK_VERSION(2,12,0) #include #include +#endif /* GTK_CHECK_VERSION(2,12,0) */ #include #include #include @@ -94,6 +96,7 @@ enum { APPEARANCE_MINIMAL, /* no label, just choices in a drop-down menu */ }; +#if GTK_CHECK_VERSION(2,12,0) /* TODO need to have appropriate icons setup for these: */ static const gchar *floogles[] = { GTK_STOCK_REMOVE, @@ -102,6 +105,7 @@ static const gchar *floogles[] = { GTK_STOCK_ABOUT, GTK_STOCK_GO_UP, 0}; +#endif /* GTK_CHECK_VERSION(2,12,0) */ typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr; @@ -842,10 +846,12 @@ static GtkWidget* create_tool_item( GtkAction* action ) gtk_scale_set_digits( GTK_SCALE(spinbutton), 0 ); g_signal_connect( G_OBJECT(spinbutton), "format-value", G_CALLBACK(slider_format_falue), leakyForNow ); +#if GTK_CHECK_VERSION(2,12,0) } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 ); gtk_scale_button_set_adjustment( GTK_SCALE_BUTTON(spinbutton), act->private_data->adj ); gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); +#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { if ( gFactoryCb ) { spinbutton = gFactoryCb( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); @@ -907,8 +913,10 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_signal_connect_swapped( G_OBJECT(spinbutton), "event", G_CALLBACK(event_cb), action ); if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { /* */ +#if GTK_CHECK_VERSION(2,12,0) } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { /* */ +#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { gtk_entry_set_width_chars( GTK_ENTRY(spinbutton), act->private_data->digits + 3 ); } @@ -954,8 +962,10 @@ gboolean focus_in_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) EgeAdjustmentAction* action = EGE_ADJUSTMENT_ACTION( data ); if ( GTK_IS_SPIN_BUTTON(widget) ) { action->private_data->lastVal = gtk_spin_button_get_value( GTK_SPIN_BUTTON(widget) ); +#if GTK_CHECK_VERSION(2,12,0) } else if ( GTK_IS_SCALE_BUTTON(widget) ) { action->private_data->lastVal = gtk_scale_button_get_value( GTK_SCALE_BUTTON(widget) ); +#endif /* GTK_CHECK_VERSION(2,12,0) */ } else if (GTK_IS_RANGE(widget) ) { action->private_data->lastVal = gtk_range_get_value( GTK_RANGE(widget) ); } diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 1c3ec1ff5..83a083425 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -935,6 +935,7 @@ void resync_sensitive( EgeSelectOneAction* act ) GSList* group = (GSList*)data; // List is backwards in group as compared to GtkTreeModel, we better do matching. while ( group ) { +#if GTK_CHECK_VERSION(2,16,0) GtkRadioAction* ract = GTK_RADIO_ACTION(group->data); const gchar* label = gtk_action_get_label( GTK_ACTION( ract ) ); @@ -963,6 +964,8 @@ void resync_sensitive( EgeSelectOneAction* act ) } gtk_action_set_sensitive( GTK_ACTION(ract), sens ); +#endif + group = g_slist_next(group); } } diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index eaaf62113..74034e537 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -266,7 +266,9 @@ static void ink_comboboxentry_action_init (Ink_ComboBoxEntry_Action *action) action->active = -1; action->text = NULL; action->entry_completion = NULL; +#if !GTK_CHECK_VERSION(2,16,0) action->indicator = NULL; +#endif action->popup = false; action->warning = NULL; action->altx_name = NULL; @@ -346,7 +348,15 @@ GtkWidget* create_tool_item( GtkAction* action ) { GtkWidget *align = gtk_alignment_new(0, 0.5, 0, 0); +#if GTK_CHECK_VERSION(2,16,0) gtk_container_add( GTK_CONTAINER(align), comboBoxEntry ); +#else // GTK_CHECK_VERSION(2,16,0) + GtkWidget *hbox = gtk_hbox_new( FALSE, 0 ); + ink_comboboxentry_action->indicator = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_box_pack_start( GTK_BOX(hbox), comboBoxEntry, TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX(hbox), ink_comboboxentry_action->indicator, FALSE, FALSE, 0 ); + gtk_container_add( GTK_CONTAINER(align), hbox ); +#endif // GTK_CHECK_VERSION(2,16,0) gtk_container_add( GTK_CONTAINER(item), align ); } @@ -405,7 +415,10 @@ GtkWidget* create_tool_item( GtkAction* action ) } +#if GTK_CHECK_VERSION(2,16,0) gtk_action_connect_proxy( GTK_ACTION( action ), item ); +#endif + gtk_widget_show_all( item ); } else { @@ -467,6 +480,7 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink // Show or hide warning if( ink_comboboxentry_action->active == -1 && ink_comboboxentry_action->warning != NULL ) { +#if GTK_CHECK_VERSION(2,16,0) { GtkStockItem item; gboolean isStock = gtk_stock_lookup( GTK_STOCK_DIALOG_WARNING, &item ); @@ -484,13 +498,22 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink gtk_entry_set_icon_tooltip_text( ink_comboboxentry_action->entry, GTK_ENTRY_ICON_SECONDARY, ink_comboboxentry_action->warning ); +#else // GTK_CHECK_VERSION(2,16,0) + gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, ink_comboboxentry_action->warning ); +#endif // GTK_CHECK_VERSION(2,16,0) } else { +#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_from_icon_name( GTK_ENTRY(ink_comboboxentry_action->entry), GTK_ENTRY_ICON_SECONDARY, NULL ); gtk_entry_set_icon_from_stock( GTK_ENTRY(ink_comboboxentry_action->entry), GTK_ENTRY_ICON_SECONDARY, NULL ); +#else // GTK_CHECK_VERSION(2,16,0) + gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), NULL, GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, NULL ); +#endif // GTK_CHECK_VERSION(2,16,0) } } @@ -562,9 +585,13 @@ void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action, // Widget may not have been created.... if( action->entry ) { +#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_tooltip_text( GTK_ENTRY(action->entry), GTK_ENTRY_ICON_SECONDARY, action->warning ); +#else // GTK_CHECK_VERSION(2,16,0) + gtk_image_set_from_stock( GTK_IMAGE(action->indicator), action->warning ? GTK_STOCK_DIALOG_WARNING : 0, GTK_ICON_SIZE_SMALL_TOOLBAR ); +#endif // GTK_CHECK_VERSION(2,16,0) } } diff --git a/src/ink-comboboxentry-action.h b/src/ink-comboboxentry-action.h index 1a83cb053..e080e6cdf 100644 --- a/src/ink-comboboxentry-action.h +++ b/src/ink-comboboxentry-action.h @@ -49,7 +49,9 @@ struct _Ink_ComboBoxEntry_Action { GtkComboBoxEntry *combobox; GtkEntry *entry; GtkEntryCompletion *entry_completion; +#if !GTK_CHECK_VERSION(2,16,0) GtkWidget *indicator; +#endif gpointer cell_data_func; // drop-down menu format diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 1b0893c0b..91e3b0c5f 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -442,7 +442,11 @@ void inkscape_autosave_init() // Turn on autosave guint32 timeout = prefs->getInt("/options/autosave/interval", 10) * 60; // g_debug("options.autosave.interval = %d", prefs->getInt("/options/autosave/interval", 10)); +#if GLIB_CHECK_VERSION(2,14,0) autosave_timeout_id = g_timeout_add_seconds(timeout, inkscape_autosave, NULL); +#else + autosave_timeout_id = g_timeout_add(timeout * 1000, inkscape_autosave, NULL); +#endif } } diff --git a/src/io/sys.cpp b/src/io/sys.cpp index e6c512be2..a68d02707 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -19,7 +19,9 @@ #include #include #include -#include +#if GLIB_CHECK_VERSION(2,6,0) + #include +#endif #include #include diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 8eef5d89b..f3d7ed971 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -48,6 +48,7 @@ GlyphsPanel &GlyphsPanel::getInstance() } +#if GLIB_CHECK_VERSION(2,14,0) static std::map & getScriptToName() { static bool init = false; @@ -122,6 +123,8 @@ static std::map & getScriptToName() mappings[G_UNICODE_SCRIPT_PHOENICIAN] = _("Phoenician"); mappings[G_UNICODE_SCRIPT_PHAGS_PA] = _("Phags-pa"); mappings[G_UNICODE_SCRIPT_NKO] = _("N'Ko"); + +#if GLIB_CHECK_VERSION(2,14,0) mappings[G_UNICODE_SCRIPT_KAYAH_LI] = _("Kayah Li"); mappings[G_UNICODE_SCRIPT_LEPCHA] = _("Lepcha"); mappings[G_UNICODE_SCRIPT_REJANG] = _("Rejang"); @@ -133,9 +136,11 @@ static std::map & getScriptToName() mappings[G_UNICODE_SCRIPT_CARIAN] = _("Carian"); mappings[G_UNICODE_SCRIPT_LYCIAN] = _("Lycian"); mappings[G_UNICODE_SCRIPT_LYDIAN] = _("Lydian"); +#endif // GLIB_CHECK_VERSION(2,14,0) } return mappings; } +#endif // GLIB_CHECK_VERSION(2,14,0) typedef std::pair Range; typedef std::pair NamedRange; @@ -332,7 +337,9 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : entry(0), label(0), insertBtn(0), +#if GLIB_CHECK_VERSION(2,14,0) scriptCombo(0), +#endif // GLIB_CHECK_VERSION(2,14,0) fsel(0), targetDesktop(0), deskTrack(), @@ -359,6 +366,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : // ------------------------------- +#if GLIB_CHECK_VERSION(2,14,0) { Gtk::Label *label = new Gtk::Label(_("Script: ")); table->attach( *Gtk::manage(label), @@ -383,6 +391,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : } row++; +#endif // GLIB_CHECK_VERSION(2,14,0) // ------------------------------- @@ -455,7 +464,10 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : insertBtn = new Gtk::Button(_("Append")); conn = insertBtn->signal_clicked().connect(sigc::mem_fun(*this, &GlyphsPanel::insertText)); instanceConns.push_back(conn); +#if GTK_CHECK_VERSION(2,18,0) + //gtkmm 2.18 insertBtn->set_can_default(); +#endif insertBtn->set_sensitive(false); box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK); @@ -595,11 +607,13 @@ void GlyphsPanel::glyphSelectionChanged() Glib::ustring scriptName; +#if GLIB_CHECK_VERSION(2,14,0) GUnicodeScript script = g_unichar_get_script(ch); std::map mappings = getScriptToName(); if (mappings.find(script) != mappings.end()) { scriptName = mappings[script]; } +#endif gchar * tmp = g_strdup_printf("U+%04X %s", ch, scriptName.c_str()); label->set_text(tmp); } @@ -666,6 +680,7 @@ void GlyphsPanel::rebuild() if (font) { //double sp_font_selector_get_size (SPFontSelector *fsel); +#if GLIB_CHECK_VERSION(2,14,0) GUnicodeScript script = G_UNICODE_SCRIPT_INVALID_CODE; Glib::ustring scriptName = scriptCombo->get_active_text(); std::map items = getScriptToName(); @@ -675,6 +690,7 @@ void GlyphsPanel::rebuild() break; } } +#endif // GLIB_CHECK_VERSION(2,14,0) // Disconnect the model while we update it. Simple work-around for 5x+ performance boost. Glib::RefPtr tmp = Gtk::ListStore::create(*getColumns()); @@ -691,9 +707,13 @@ void GlyphsPanel::rebuild() for (gunichar ch = lower; ch <= upper; ch++) { int glyphId = font->MapUnicodeChar(ch); if (glyphId > 0) { +#if GLIB_CHECK_VERSION(2,14,0) if ((script == G_UNICODE_SCRIPT_INVALID_CODE) || (script == g_unichar_get_script(ch))) { present.push_back(ch); } +#else + present.push_back(ch); +#endif } } diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h index 1440a693f..d6c731dda 100644 --- a/src/ui/dialog/glyphs.h +++ b/src/ui/dialog/glyphs.h @@ -77,7 +77,9 @@ private: Gtk::Entry *entry; Gtk::Label *label; Gtk::Button *insertBtn; +#if GLIB_CHECK_VERSION(2,14,0) Gtk::ComboBoxText *scriptCombo; +#endif //GLIB_CHECK_VERSION(2,14,0) Gtk::ComboBoxText *rangeCombo; SPFontSelector *fsel; SPDesktop *targetDesktop; diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index 0690caaab..0e30b1ce6 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -1,3 +1,5 @@ +#define __SP_COLOR_SLIDER_C__ + /* * A slider with colored background * @@ -327,17 +329,21 @@ sp_color_slider_new (GtkAdjustment *adjustment) return GTK_WIDGET (slider); } -void sp_color_slider_set_adjustment(SPColorSlider *slider, GtkAdjustment *adjustment) +void +sp_color_slider_set_adjustment (SPColorSlider *slider, GtkAdjustment *adjustment) { - g_return_if_fail (slider != NULL); - g_return_if_fail (SP_IS_COLOR_SLIDER (slider)); + g_return_if_fail (slider != NULL); + g_return_if_fail (SP_IS_COLOR_SLIDER (slider)); - if (!adjustment) { - adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0); - } else { + if (!adjustment) { + adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0); + } +#if GTK_CHECK_VERSION (2,14,0) + else { gtk_adjustment_set_page_increment(adjustment, 0.0); gtk_adjustment_set_page_size(adjustment, 0.0); } +#endif if (slider->adjustment != adjustment) { if (slider->adjustment) { diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 784dd23ad..2e36a024e 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -135,12 +135,14 @@ static void resizeHSVWheel( GtkHSV *hsv, GtkAllocation *allocation ) gtk_hsv_set_metrics( hsv, diam, ring ); } +#if GTK_CHECK_VERSION(2,18,0) static void handleWheelStyleSet(GtkHSV *hsv, GtkStyle* /*previous*/, gpointer /*userData*/) { GtkAllocation allocation = {0, 0, 0, 0}; gtk_widget_get_allocation( GTK_WIDGET(hsv), &allocation ); resizeHSVWheel( hsv, &allocation ); } +#endif // GTK_CHECK_VERSION(2,18,0) static void handleWheelAllocation(GtkHSV *hsv, GtkAllocation *allocation, gpointer /*userData*/) { @@ -218,8 +220,10 @@ void ColorWheelSelector::init() // GTK does not automatically scale the color wheel, so we have to add that in: gtk_signal_connect( GTK_OBJECT(_wheel), "size-allocate", GTK_SIGNAL_FUNC(handleWheelAllocation), _csel ); +#if GTK_CHECK_VERSION(2,18,0) gtk_signal_connect( GTK_OBJECT(_wheel), "style-set", GTK_SIGNAL_FUNC(handleWheelStyleSet), _csel ); +#endif // GTK_CHECK_VERSION(2,18,0) } static void -- cgit v1.2.3 From cdddf155baf531b9783c8c5a02ec491a9cde3afc Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Thu, 19 May 2011 15:36:51 -0300 Subject: fix rendering of SVG Fonts. Apparently the glyphs were wrongly rendered upside-down since I was trying to make it compatible with fontforge rendering. Now, reading again the SVG spec, it seems to me that it is fontforge that renders it incorrectly. I have also added support for rendering path tags that are children of glyph and missing-glyph nodes. And also use tags. But fontforge does not seem to understand use tags in glyph descriptions... compatibility issues that we have to figure out how to solve. (bzr r10211) --- src/display/nr-svgfonts.cpp | 71 +++++++++++++++++++++++++++++++++------------ src/display/nr-svgfonts.h | 4 +++ 2 files changed, 57 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp index 62d52b04b..b071ba21b 100644 --- a/src/display/nr-svgfonts.cpp +++ b/src/display/nr-svgfonts.cpp @@ -20,6 +20,11 @@ #include "svg/svg.h" #include "inkscape-cairo.h" #include "nr-svgfonts.h" +#include "../sp-path.h" +#include "../sp-object-group.h" +#include "../sp-use.h" +#include "../sp-use-reference.h" +#include "curve.h" //*************************// // UserFont Implementation // @@ -212,6 +217,29 @@ SvgFont::scaled_font_text_to_glyphs (cairo_scaled_font_t */*scaled_font*/, return CAIRO_STATUS_SUCCESS; } +void +SvgFont::render_glyph_path(cairo_t* cr, Geom::PathVector* pathv){ + if (!pathv->empty()){ + //This glyph has a path description on its d attribute, so we render it: + cairo_new_path(cr); + + //adjust scale of the glyph +// Geom::Scale s(1.0/((SPFont*) node->parent)->horiz_adv_x); + Geom::Scale s(1.0/1000);//TODO: use here the units-per-em attribute? + + Geom::Rect area( Geom::Point(0,0), Geom::Point(1,1) ); //I need help here! (reaction: note that the 'area' parameter is an *optional* rect, so you can pass an empty Geom::OptRect() ) + + feed_pathvector_to_cairo (cr, *pathv, s, area, false, 0); + cairo_fill(cr); + } +} + +void +SvgFont::glyph_modified(SPObject* /* blah */, unsigned int /* bleh */){ + this->refresh(); + //TODO: update rendering on svgfonts preview widget (in the svg fonts dialog) +} + cairo_status_t SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, unsigned long glyph, @@ -234,37 +262,44 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, node = (SPObject*) this->glyphs[glyph]; } + if (!SP_IS_GLYPH(node) && !SP_IS_MISSING_GLYPH(node)) { + return CAIRO_STATUS_SUCCESS; // FIXME: is this the right code to return? + } + //glyphs can be described by arbitrary SVG declared in the childnodes of a glyph node // or using the d attribute of a glyph node. // pathv stores the path description from the d attribute: Geom::PathVector pathv; if (SP_IS_GLYPH(node) && ((SPGlyph*)node)->d) { pathv = sp_svg_read_pathv(((SPGlyph*)node)->d); + this->render_glyph_path(cr, &pathv); } else if (SP_IS_MISSING_GLYPH(node) && ((SPMissingGlyph*)node)->d) { pathv = sp_svg_read_pathv(((SPMissingGlyph*)node)->d); - } else { - return CAIRO_STATUS_SUCCESS; // FIXME: is this the right code to return? + this->render_glyph_path(cr, &pathv); } - if (!pathv.empty()){ - //This glyph has a path description on its d attribute, so we render it: - cairo_new_path(cr); - //adjust scale of the glyph -// Geom::Scale s(1.0/((SPFont*) node->parent)->horiz_adv_x); - Geom::Scale s(1.0/1000);//TODO: use here the units-per-em attribute? - //This matrix flips the glyph vertically - Geom::Affine m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(0)); - //then we offset it -// pathv += Geom::Point(Geom::Coord(0),Geom::Coord(-((SPFont*) node->parent)->horiz_adv_x)); - pathv += Geom::Point(Geom::Coord(0),Geom::Coord(-1000));//TODO: use here the units-per-em attribute? - - Geom::Rect area( Geom::Point(0,0), Geom::Point(1,1) ); //I need help here! (reaction: note that the 'area' parameter is an *optional* rect, so you can pass an empty Geom::OptRect() ) + if (node->hasChildren()){ + //render the SVG described on this glyph's child nodes. + for(node = node->children; node; node=node->next){ + if (SP_IS_PATH(node)){ + pathv = ((SPShape*)node)->curve->get_pathvector(); + this->render_glyph_path(cr, &pathv); + } + if (SP_IS_OBJECTGROUP(node)){ + g_warning("TODO: svgfonts: render OBJECTGROUP"); + } + if (SP_IS_USE(node)){ + SPItem* item = SP_USE(node)->ref->getObject(); + if (SP_IS_PATH(item)){ + pathv = ((SPShape*)item)->curve->get_pathvector(); + this->render_glyph_path(cr, &pathv); + } - feed_pathvector_to_cairo (cr, pathv, s*m, area, false, 0); - cairo_fill(cr); + glyph_modified_connection = ((SPObject*) item)->connectModified(sigc::mem_fun(*this, &SvgFont::glyph_modified)); + } + } } - //TODO: render the SVG described on this glyph's child nodes. return CAIRO_STATUS_SUCCESS; } diff --git a/src/display/nr-svgfonts.h b/src/display/nr-svgfonts.h index ddf4ba327..b6eaf449d 100644 --- a/src/display/nr-svgfonts.h +++ b/src/display/nr-svgfonts.h @@ -19,6 +19,7 @@ #include "../sp-missing-glyph.h" #include "../sp-font.h" #include "../sp-glyph-kerning.h" +#include class SvgFont; struct SPFont; @@ -37,12 +38,15 @@ cairo_font_face_t* get_font_face(); cairo_status_t scaled_font_init (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *metrics); cairo_status_t scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font, const char *utf8, int utf8_len, cairo_glyph_t **glyphs, int *num_glyphs, cairo_text_cluster_t **clusters, int *num_clusters, cairo_text_cluster_flags_t *flags); cairo_status_t scaled_font_render_glyph (cairo_scaled_font_t *scaled_font, unsigned long glyph, cairo_t *cr, cairo_text_extents_t *metrics); +void render_glyph_path(cairo_t* cr, Geom::PathVector* pathv); +void glyph_modified(SPObject *, unsigned int); private: SPFont* font; UserFont* userfont; std::vector glyphs; SPMissingGlyph* missingglyph; +sigc::connection glyph_modified_connection; bool drawing_expose_cb (Gtk::Widget *widget, GdkEventExpose *event, gpointer data); }; -- cgit v1.2.3 From 9865291b790f185d7ec2271c58e8653c9d4bb295 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 19 May 2011 22:01:27 -0700 Subject: Reinstating version bump. (bzr r10215) --- src/display/sp-canvas.cpp | 7 +------ src/ege-adjustment-action.cpp | 10 ---------- src/ege-select-one-action.cpp | 3 --- src/ink-comboboxentry-action.cpp | 27 --------------------------- src/ink-comboboxentry-action.h | 2 -- src/inkscape.cpp | 4 ---- src/io/sys.cpp | 4 +--- src/ui/dialog/glyphs.cpp | 20 -------------------- src/ui/dialog/glyphs.h | 2 -- src/widgets/sp-color-slider.cpp | 18 ++++++------------ src/widgets/sp-color-wheel-selector.cpp | 4 ---- 11 files changed, 8 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 2d1e57092..0d450362a 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -47,12 +47,9 @@ using Inkscape::Debug::GdkEventLatencyTracker; -// GTK_CHECK_VERSION returns false on failure -#define HAS_GDK_EVENT_REQUEST_MOTIONS GTK_CHECK_VERSION(2, 12, 0) - // gtk_check_version returns non-NULL on failure static bool const HAS_BROKEN_MOTION_HINTS = - true || gtk_check_version(2, 12, 0) != NULL || !HAS_GDK_EVENT_REQUEST_MOTIONS; + true || gtk_check_version(2, 12, 0) != NULL; // Define this to visualize the regions to be redrawn //#define DEBUG_REDRAW 1; @@ -1599,9 +1596,7 @@ sp_canvas_scroll (GtkWidget *widget, GdkEventScroll *event) static inline void request_motions(GdkWindow *w, GdkEventMotion *event) { gdk_window_get_pointer(w, NULL, NULL, NULL); -#if HAS_GDK_EVENT_REQUEST_MOTIONS gdk_event_request_motions(event); -#endif } /** diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 9c01b4c7c..b8ee66f08 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -47,10 +47,8 @@ #include #include #include -#if GTK_CHECK_VERSION(2,12,0) #include #include -#endif /* GTK_CHECK_VERSION(2,12,0) */ #include #include #include @@ -96,7 +94,6 @@ enum { APPEARANCE_MINIMAL, /* no label, just choices in a drop-down menu */ }; -#if GTK_CHECK_VERSION(2,12,0) /* TODO need to have appropriate icons setup for these: */ static const gchar *floogles[] = { GTK_STOCK_REMOVE, @@ -105,7 +102,6 @@ static const gchar *floogles[] = { GTK_STOCK_ABOUT, GTK_STOCK_GO_UP, 0}; -#endif /* GTK_CHECK_VERSION(2,12,0) */ typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr; @@ -846,12 +842,10 @@ static GtkWidget* create_tool_item( GtkAction* action ) gtk_scale_set_digits( GTK_SCALE(spinbutton), 0 ); g_signal_connect( G_OBJECT(spinbutton), "format-value", G_CALLBACK(slider_format_falue), leakyForNow ); -#if GTK_CHECK_VERSION(2,12,0) } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 ); gtk_scale_button_set_adjustment( GTK_SCALE_BUTTON(spinbutton), act->private_data->adj ); gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); -#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { if ( gFactoryCb ) { spinbutton = gFactoryCb( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); @@ -913,10 +907,8 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_signal_connect_swapped( G_OBJECT(spinbutton), "event", G_CALLBACK(event_cb), action ); if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { /* */ -#if GTK_CHECK_VERSION(2,12,0) } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { /* */ -#endif /* GTK_CHECK_VERSION(2,12,0) */ } else { gtk_entry_set_width_chars( GTK_ENTRY(spinbutton), act->private_data->digits + 3 ); } @@ -962,10 +954,8 @@ gboolean focus_in_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) EgeAdjustmentAction* action = EGE_ADJUSTMENT_ACTION( data ); if ( GTK_IS_SPIN_BUTTON(widget) ) { action->private_data->lastVal = gtk_spin_button_get_value( GTK_SPIN_BUTTON(widget) ); -#if GTK_CHECK_VERSION(2,12,0) } else if ( GTK_IS_SCALE_BUTTON(widget) ) { action->private_data->lastVal = gtk_scale_button_get_value( GTK_SCALE_BUTTON(widget) ); -#endif /* GTK_CHECK_VERSION(2,12,0) */ } else if (GTK_IS_RANGE(widget) ) { action->private_data->lastVal = gtk_range_get_value( GTK_RANGE(widget) ); } diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 83a083425..1c3ec1ff5 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -935,7 +935,6 @@ void resync_sensitive( EgeSelectOneAction* act ) GSList* group = (GSList*)data; // List is backwards in group as compared to GtkTreeModel, we better do matching. while ( group ) { -#if GTK_CHECK_VERSION(2,16,0) GtkRadioAction* ract = GTK_RADIO_ACTION(group->data); const gchar* label = gtk_action_get_label( GTK_ACTION( ract ) ); @@ -964,8 +963,6 @@ void resync_sensitive( EgeSelectOneAction* act ) } gtk_action_set_sensitive( GTK_ACTION(ract), sens ); -#endif - group = g_slist_next(group); } } diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index 74034e537..eaaf62113 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -266,9 +266,7 @@ static void ink_comboboxentry_action_init (Ink_ComboBoxEntry_Action *action) action->active = -1; action->text = NULL; action->entry_completion = NULL; -#if !GTK_CHECK_VERSION(2,16,0) action->indicator = NULL; -#endif action->popup = false; action->warning = NULL; action->altx_name = NULL; @@ -348,15 +346,7 @@ GtkWidget* create_tool_item( GtkAction* action ) { GtkWidget *align = gtk_alignment_new(0, 0.5, 0, 0); -#if GTK_CHECK_VERSION(2,16,0) gtk_container_add( GTK_CONTAINER(align), comboBoxEntry ); -#else // GTK_CHECK_VERSION(2,16,0) - GtkWidget *hbox = gtk_hbox_new( FALSE, 0 ); - ink_comboboxentry_action->indicator = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_box_pack_start( GTK_BOX(hbox), comboBoxEntry, TRUE, TRUE, 0 ); - gtk_box_pack_start( GTK_BOX(hbox), ink_comboboxentry_action->indicator, FALSE, FALSE, 0 ); - gtk_container_add( GTK_CONTAINER(align), hbox ); -#endif // GTK_CHECK_VERSION(2,16,0) gtk_container_add( GTK_CONTAINER(item), align ); } @@ -415,10 +405,7 @@ GtkWidget* create_tool_item( GtkAction* action ) } -#if GTK_CHECK_VERSION(2,16,0) gtk_action_connect_proxy( GTK_ACTION( action ), item ); -#endif - gtk_widget_show_all( item ); } else { @@ -480,7 +467,6 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink // Show or hide warning if( ink_comboboxentry_action->active == -1 && ink_comboboxentry_action->warning != NULL ) { -#if GTK_CHECK_VERSION(2,16,0) { GtkStockItem item; gboolean isStock = gtk_stock_lookup( GTK_STOCK_DIALOG_WARNING, &item ); @@ -498,22 +484,13 @@ gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink gtk_entry_set_icon_tooltip_text( ink_comboboxentry_action->entry, GTK_ENTRY_ICON_SECONDARY, ink_comboboxentry_action->warning ); -#else // GTK_CHECK_VERSION(2,16,0) - gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, ink_comboboxentry_action->warning ); -#endif // GTK_CHECK_VERSION(2,16,0) } else { -#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_from_icon_name( GTK_ENTRY(ink_comboboxentry_action->entry), GTK_ENTRY_ICON_SECONDARY, NULL ); gtk_entry_set_icon_from_stock( GTK_ENTRY(ink_comboboxentry_action->entry), GTK_ENTRY_ICON_SECONDARY, NULL ); -#else // GTK_CHECK_VERSION(2,16,0) - gtk_image_set_from_stock( GTK_IMAGE(ink_comboboxentry_action->indicator), NULL, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_widget_set_tooltip_text( ink_comboboxentry_action->indicator, NULL ); -#endif // GTK_CHECK_VERSION(2,16,0) } } @@ -585,13 +562,9 @@ void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action, // Widget may not have been created.... if( action->entry ) { -#if GTK_CHECK_VERSION(2,16,0) gtk_entry_set_icon_tooltip_text( GTK_ENTRY(action->entry), GTK_ENTRY_ICON_SECONDARY, action->warning ); -#else // GTK_CHECK_VERSION(2,16,0) - gtk_image_set_from_stock( GTK_IMAGE(action->indicator), action->warning ? GTK_STOCK_DIALOG_WARNING : 0, GTK_ICON_SIZE_SMALL_TOOLBAR ); -#endif // GTK_CHECK_VERSION(2,16,0) } } diff --git a/src/ink-comboboxentry-action.h b/src/ink-comboboxentry-action.h index e080e6cdf..1a83cb053 100644 --- a/src/ink-comboboxentry-action.h +++ b/src/ink-comboboxentry-action.h @@ -49,9 +49,7 @@ struct _Ink_ComboBoxEntry_Action { GtkComboBoxEntry *combobox; GtkEntry *entry; GtkEntryCompletion *entry_completion; -#if !GTK_CHECK_VERSION(2,16,0) GtkWidget *indicator; -#endif gpointer cell_data_func; // drop-down menu format diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 91e3b0c5f..1b0893c0b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -442,11 +442,7 @@ void inkscape_autosave_init() // Turn on autosave guint32 timeout = prefs->getInt("/options/autosave/interval", 10) * 60; // g_debug("options.autosave.interval = %d", prefs->getInt("/options/autosave/interval", 10)); -#if GLIB_CHECK_VERSION(2,14,0) autosave_timeout_id = g_timeout_add_seconds(timeout, inkscape_autosave, NULL); -#else - autosave_timeout_id = g_timeout_add(timeout * 1000, inkscape_autosave, NULL); -#endif } } diff --git a/src/io/sys.cpp b/src/io/sys.cpp index a68d02707..e6c512be2 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -19,9 +19,7 @@ #include #include #include -#if GLIB_CHECK_VERSION(2,6,0) - #include -#endif +#include #include #include diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index f3d7ed971..8eef5d89b 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -48,7 +48,6 @@ GlyphsPanel &GlyphsPanel::getInstance() } -#if GLIB_CHECK_VERSION(2,14,0) static std::map & getScriptToName() { static bool init = false; @@ -123,8 +122,6 @@ static std::map & getScriptToName() mappings[G_UNICODE_SCRIPT_PHOENICIAN] = _("Phoenician"); mappings[G_UNICODE_SCRIPT_PHAGS_PA] = _("Phags-pa"); mappings[G_UNICODE_SCRIPT_NKO] = _("N'Ko"); - -#if GLIB_CHECK_VERSION(2,14,0) mappings[G_UNICODE_SCRIPT_KAYAH_LI] = _("Kayah Li"); mappings[G_UNICODE_SCRIPT_LEPCHA] = _("Lepcha"); mappings[G_UNICODE_SCRIPT_REJANG] = _("Rejang"); @@ -136,11 +133,9 @@ static std::map & getScriptToName() mappings[G_UNICODE_SCRIPT_CARIAN] = _("Carian"); mappings[G_UNICODE_SCRIPT_LYCIAN] = _("Lycian"); mappings[G_UNICODE_SCRIPT_LYDIAN] = _("Lydian"); -#endif // GLIB_CHECK_VERSION(2,14,0) } return mappings; } -#endif // GLIB_CHECK_VERSION(2,14,0) typedef std::pair Range; typedef std::pair NamedRange; @@ -337,9 +332,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : entry(0), label(0), insertBtn(0), -#if GLIB_CHECK_VERSION(2,14,0) scriptCombo(0), -#endif // GLIB_CHECK_VERSION(2,14,0) fsel(0), targetDesktop(0), deskTrack(), @@ -366,7 +359,6 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : // ------------------------------- -#if GLIB_CHECK_VERSION(2,14,0) { Gtk::Label *label = new Gtk::Label(_("Script: ")); table->attach( *Gtk::manage(label), @@ -391,7 +383,6 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : } row++; -#endif // GLIB_CHECK_VERSION(2,14,0) // ------------------------------- @@ -464,10 +455,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : insertBtn = new Gtk::Button(_("Append")); conn = insertBtn->signal_clicked().connect(sigc::mem_fun(*this, &GlyphsPanel::insertText)); instanceConns.push_back(conn); -#if GTK_CHECK_VERSION(2,18,0) - //gtkmm 2.18 insertBtn->set_can_default(); -#endif insertBtn->set_sensitive(false); box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK); @@ -607,13 +595,11 @@ void GlyphsPanel::glyphSelectionChanged() Glib::ustring scriptName; -#if GLIB_CHECK_VERSION(2,14,0) GUnicodeScript script = g_unichar_get_script(ch); std::map mappings = getScriptToName(); if (mappings.find(script) != mappings.end()) { scriptName = mappings[script]; } -#endif gchar * tmp = g_strdup_printf("U+%04X %s", ch, scriptName.c_str()); label->set_text(tmp); } @@ -680,7 +666,6 @@ void GlyphsPanel::rebuild() if (font) { //double sp_font_selector_get_size (SPFontSelector *fsel); -#if GLIB_CHECK_VERSION(2,14,0) GUnicodeScript script = G_UNICODE_SCRIPT_INVALID_CODE; Glib::ustring scriptName = scriptCombo->get_active_text(); std::map items = getScriptToName(); @@ -690,7 +675,6 @@ void GlyphsPanel::rebuild() break; } } -#endif // GLIB_CHECK_VERSION(2,14,0) // Disconnect the model while we update it. Simple work-around for 5x+ performance boost. Glib::RefPtr tmp = Gtk::ListStore::create(*getColumns()); @@ -707,13 +691,9 @@ void GlyphsPanel::rebuild() for (gunichar ch = lower; ch <= upper; ch++) { int glyphId = font->MapUnicodeChar(ch); if (glyphId > 0) { -#if GLIB_CHECK_VERSION(2,14,0) if ((script == G_UNICODE_SCRIPT_INVALID_CODE) || (script == g_unichar_get_script(ch))) { present.push_back(ch); } -#else - present.push_back(ch); -#endif } } diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h index d6c731dda..1440a693f 100644 --- a/src/ui/dialog/glyphs.h +++ b/src/ui/dialog/glyphs.h @@ -77,9 +77,7 @@ private: Gtk::Entry *entry; Gtk::Label *label; Gtk::Button *insertBtn; -#if GLIB_CHECK_VERSION(2,14,0) Gtk::ComboBoxText *scriptCombo; -#endif //GLIB_CHECK_VERSION(2,14,0) Gtk::ComboBoxText *rangeCombo; SPFontSelector *fsel; SPDesktop *targetDesktop; diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index 0e30b1ce6..0690caaab 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -1,5 +1,3 @@ -#define __SP_COLOR_SLIDER_C__ - /* * A slider with colored background * @@ -329,21 +327,17 @@ sp_color_slider_new (GtkAdjustment *adjustment) return GTK_WIDGET (slider); } -void -sp_color_slider_set_adjustment (SPColorSlider *slider, GtkAdjustment *adjustment) +void sp_color_slider_set_adjustment(SPColorSlider *slider, GtkAdjustment *adjustment) { - g_return_if_fail (slider != NULL); - g_return_if_fail (SP_IS_COLOR_SLIDER (slider)); + g_return_if_fail (slider != NULL); + g_return_if_fail (SP_IS_COLOR_SLIDER (slider)); - if (!adjustment) { - adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0); - } -#if GTK_CHECK_VERSION (2,14,0) - else { + if (!adjustment) { + adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 1.0, 0.01, 0.0, 0.0); + } else { gtk_adjustment_set_page_increment(adjustment, 0.0); gtk_adjustment_set_page_size(adjustment, 0.0); } -#endif if (slider->adjustment != adjustment) { if (slider->adjustment) { diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 2e36a024e..784dd23ad 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -135,14 +135,12 @@ static void resizeHSVWheel( GtkHSV *hsv, GtkAllocation *allocation ) gtk_hsv_set_metrics( hsv, diam, ring ); } -#if GTK_CHECK_VERSION(2,18,0) static void handleWheelStyleSet(GtkHSV *hsv, GtkStyle* /*previous*/, gpointer /*userData*/) { GtkAllocation allocation = {0, 0, 0, 0}; gtk_widget_get_allocation( GTK_WIDGET(hsv), &allocation ); resizeHSVWheel( hsv, &allocation ); } -#endif // GTK_CHECK_VERSION(2,18,0) static void handleWheelAllocation(GtkHSV *hsv, GtkAllocation *allocation, gpointer /*userData*/) { @@ -220,10 +218,8 @@ void ColorWheelSelector::init() // GTK does not automatically scale the color wheel, so we have to add that in: gtk_signal_connect( GTK_OBJECT(_wheel), "size-allocate", GTK_SIGNAL_FUNC(handleWheelAllocation), _csel ); -#if GTK_CHECK_VERSION(2,18,0) gtk_signal_connect( GTK_OBJECT(_wheel), "style-set", GTK_SIGNAL_FUNC(handleWheelStyleSet), _csel ); -#endif // GTK_CHECK_VERSION(2,18,0) } static void -- cgit v1.2.3 From d0d22ef1d26069adc5dcf4e2ce9e25d0d4331958 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Fri, 20 May 2011 17:06:41 -0300 Subject: Remove flipping of y-axis from methods that get curves from selection in the svg fonts dialog. This flipping of y-axis seems to be a fontforge bug. (bzr r10216) --- src/ui/dialog/svg-fonts-dialog.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 667d01de7..6bcd5d898 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -500,12 +500,6 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d")); - //This matrix flips the glyph vertically - Geom::Affine m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(0)); - pathv*=m; - //then we offset it - pathv+=Geom::Point(Geom::Coord(0),Geom::Coord(get_selected_spfont()->horiz_adv_x)); - SPGlyph* glyph = get_selected_glyph(); if (!glyph){ char *msg = _("No glyph selected in the SVGFonts dialog."); @@ -545,13 +539,6 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d")); - //This matrix flips the glyph vertically - Geom::Affine m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(0)); - pathv*=m; - //then we offset it -// pathv+=Geom::Point(Geom::Coord(0),Geom::Coord(get_selected_spfont()->horiz_adv_x)); - pathv+=Geom::Point(Geom::Coord(0),Geom::Coord(1000));//TODO: use here the units-per-em attribute? - SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ -- cgit v1.2.3 From 3adbef99b318bd361c429b470a5f38cf21e8000a Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Sun, 22 May 2011 18:11:19 -0300 Subject: actually fontforge flipping of y-axis for svgfont glyphs is compliant with the svg spec. So we need to do it also. (bzr r10218) --- src/display/nr-svgfonts.cpp | 30 ++++++++++++++++++++++++++++++ src/display/nr-svgfonts.h | 2 ++ src/ui/dialog/svg-fonts-dialog.cpp | 28 +++++++++++++++++++++++----- src/ui/dialog/svg-fonts-dialog.h | 2 ++ 4 files changed, 57 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/display/nr-svgfonts.cpp b/src/display/nr-svgfonts.cpp index b071ba21b..cf23ee5d5 100644 --- a/src/display/nr-svgfonts.cpp +++ b/src/display/nr-svgfonts.cpp @@ -25,6 +25,9 @@ #include "../sp-use.h" #include "../sp-use-reference.h" #include "curve.h" +#include "xml/repr.h" +#include "sp-font-face.h" + //*************************// // UserFont Implementation // @@ -240,6 +243,24 @@ SvgFont::glyph_modified(SPObject* /* blah */, unsigned int /* bleh */){ //TODO: update rendering on svgfonts preview widget (in the svg fonts dialog) } +Geom::PathVector +SvgFont::flip_coordinate_system(SPFont* spfont, Geom::PathVector pathv){ + double units_per_em = 1000; + SPObject* obj; + for (obj = ((SPObject*) spfont)->children; obj; obj=obj->next){ + if (SP_IS_FONTFACE(obj)){ + //XML Tree being directly used here while it shouldn't be. + sp_repr_get_double(obj->getRepr(), "units_per_em", &units_per_em); + } + } + + double baseline_offset = units_per_em - spfont->horiz_origin_y; + + //This matrix flips y-axis and places the origin at baseline + Geom::Affine m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(baseline_offset)); + return pathv*m; +} + cairo_status_t SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, unsigned long glyph, @@ -266,15 +287,22 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, return CAIRO_STATUS_SUCCESS; // FIXME: is this the right code to return? } + SPFont* spfont = (SPFont*) node->parent; + if (!spfont) { + return CAIRO_STATUS_SUCCESS; // FIXME: is this the right code to return? + } + //glyphs can be described by arbitrary SVG declared in the childnodes of a glyph node // or using the d attribute of a glyph node. // pathv stores the path description from the d attribute: Geom::PathVector pathv; if (SP_IS_GLYPH(node) && ((SPGlyph*)node)->d) { pathv = sp_svg_read_pathv(((SPGlyph*)node)->d); + pathv = flip_coordinate_system(spfont, pathv); this->render_glyph_path(cr, &pathv); } else if (SP_IS_MISSING_GLYPH(node) && ((SPMissingGlyph*)node)->d) { pathv = sp_svg_read_pathv(((SPMissingGlyph*)node)->d); + pathv = flip_coordinate_system(spfont, pathv); this->render_glyph_path(cr, &pathv); } @@ -283,6 +311,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, for(node = node->children; node; node=node->next){ if (SP_IS_PATH(node)){ pathv = ((SPShape*)node)->curve->get_pathvector(); + pathv = flip_coordinate_system(spfont, pathv); this->render_glyph_path(cr, &pathv); } if (SP_IS_OBJECTGROUP(node)){ @@ -292,6 +321,7 @@ SvgFont::scaled_font_render_glyph (cairo_scaled_font_t */*scaled_font*/, SPItem* item = SP_USE(node)->ref->getObject(); if (SP_IS_PATH(item)){ pathv = ((SPShape*)item)->curve->get_pathvector(); + pathv = flip_coordinate_system(spfont, pathv); this->render_glyph_path(cr, &pathv); } diff --git a/src/display/nr-svgfonts.h b/src/display/nr-svgfonts.h index b6eaf449d..3cfcbaa72 100644 --- a/src/display/nr-svgfonts.h +++ b/src/display/nr-svgfonts.h @@ -38,6 +38,8 @@ cairo_font_face_t* get_font_face(); cairo_status_t scaled_font_init (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *metrics); cairo_status_t scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font, const char *utf8, int utf8_len, cairo_glyph_t **glyphs, int *num_glyphs, cairo_text_cluster_t **clusters, int *num_clusters, cairo_text_cluster_flags_t *flags); cairo_status_t scaled_font_render_glyph (cairo_scaled_font_t *scaled_font, unsigned long glyph, cairo_t *cr, cairo_text_extents_t *metrics); + +Geom::PathVector flip_coordinate_system(SPFont* spfont, Geom::PathVector pathv); void render_glyph_path(cairo_t* cr, Geom::PathVector* pathv); void glyph_modified(SPObject *, unsigned int); diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 6bcd5d898..4d53154d8 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -16,7 +16,6 @@ #ifdef ENABLE_SVG_FONTS -#include <2geom/pathvector.h> #include "document-private.h" #include #include @@ -474,6 +473,24 @@ void SvgFontsDialog::add_glyph(){ update_glyphs(); } +Geom::PathVector +SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){ + double units_per_em = 1000; + SPObject* obj; + for (obj = get_selected_spfont()->children; obj; obj=obj->next){ + if (SP_IS_FONTFACE(obj)){ + //XML Tree being directly used here while it shouldn't be. + sp_repr_get_double(obj->getRepr(), "units_per_em", &units_per_em); + } + } + + double baseline_offset = units_per_em - get_selected_spfont()->horiz_origin_y; + + //This matrix flips y-axis and places the origin at baseline + Geom::Affine m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(baseline_offset)); + return pathv*m; +} + void SvgFontsDialog::set_glyph_description_from_selected_path(){ SPDesktop* desktop = this->getDesktop(); if (!desktop) { @@ -498,16 +515,17 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ return; } //TODO: //Is there a better way to tell it to to the user? - Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d")); - SPGlyph* glyph = get_selected_glyph(); if (!glyph){ char *msg = _("No glyph selected in the SVGFonts dialog."); msgStack->flash(Inkscape::ERROR_MESSAGE, msg); return; } + + Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d")); + //XML Tree being directly used here while it shouldn't be. - glyph->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv)); + glyph->getRepr()->setAttribute("d", (char*) sp_svg_write_path (flip_coordinate_system(pathv))); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); update_glyphs(); @@ -544,7 +562,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ if (SP_IS_MISSING_GLYPH(obj)){ //XML Tree being directly used here while it shouldn't be. - obj->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv)); + obj->getRepr()->setAttribute("d", (char*) sp_svg_write_path (flip_coordinate_system(pathv))); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); } } diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index 50821cc6c..8c2bdc1a4 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -11,6 +11,7 @@ #ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H #define INKSCAPE_UI_DIALOG_SVG_FONTS_H +#include <2geom/pathvector.h> #include "ui/widget/panel.h" #include "ui/widget/spinbutton.h" #include "sp-font.h" @@ -78,6 +79,7 @@ public: void on_kerning_value_changed(); void on_setwidth_changed(); void add_font(); + Geom::PathVector flip_coordinate_system(Geom::PathVector pathv); //TODO: AttrEntry is currently unused. Should we remove it? class AttrEntry : public Gtk::HBox -- cgit v1.2.3 From bea49afe6164373f27a08c947087bc25c783b5b4 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Sun, 22 May 2011 22:21:27 -0300 Subject: Fixing bug 600267: "Languages are not sorted alphabetically in Inkscape preferences" https://bugs.launchpad.net/inkscape/+bug/600267 Patch submitted by Fernando Lucchesi Bastos Jurema Applied with minor changes to use Glib::ustring instead of Glib::ustring* (bzr r10219) --- src/ui/dialog/inkscape-preferences.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 81bd4dba0..28c59c321 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1124,6 +1124,31 @@ void InkscapePreferences::initPageUI() "gl", "he", "hu", "id", "it", "ja", "km", "rw", "ko", "lt", "mk", "mn", "ne", "nb", "nn", "pa", "pl", "pt", "pt_BR", "ro", "ru", "sr", "sr@latin", "sk", "sl", "es", "es_MX", "sv", "te_IN", "th", "tr", "uk", "vi" }; + { + // sorting languages according to translated name + int i = 0; + int j = 0; + int n = sizeof( languages ) / sizeof( Glib::ustring ); + Glib::ustring key_language; + Glib::ustring key_langValue; + for ( j = 1 ; j < n ; j++ ) { + key_language = languages[j]; + key_langValue = langValues[j]; + i = j-1; + while ( i >= 0 + && ( ( languages[i] > key_language + && langValues[i] != "" ) + || key_langValue == "" ) ) + { + languages[i+1] = languages[i]; + langValues[i+1] = langValues[i]; + i--; + } + languages[i+1] = key_language; + langValues[i+1] = key_langValue; + } + } + _ui_languages.init( "/ui/language", languages, langValues, G_N_ELEMENTS(languages), languages[0]); _page_ui.add_line( false, _("Language (requires restart):"), _ui_languages, "", _("Set the language for menus and number formats"), false); -- cgit v1.2.3 From e221cd716d74e63d1f27ddedd598f23b0fce611d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 26 May 2011 22:04:59 +0200 Subject: unitmenu: add method to add a unit (bzr r10232) --- src/ui/widget/unit-menu.cpp | 8 ++++++++ src/ui/widget/unit-menu.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp index 5c68f7196..362f5d90f 100644 --- a/src/ui/widget/unit-menu.cpp +++ b/src/ui/widget/unit-menu.cpp @@ -67,6 +67,14 @@ UnitMenu::resetUnitType(UnitType unit_type) return setUnitType(unit_type); } +/** Adds a unit, possibly user-defined, to the menu. */ +void +UnitMenu::addUnit(Unit const& u) +{ + _unit_table.addUnit(u, false); + append_text(u.abbr); +} + /** Returns the Unit object corresponding to the current selection in the dropdown widget */ Unit diff --git a/src/ui/widget/unit-menu.h b/src/ui/widget/unit-menu.h index efeb10ead..cf42231ba 100644 --- a/src/ui/widget/unit-menu.h +++ b/src/ui/widget/unit-menu.h @@ -29,6 +29,7 @@ public: bool setUnitType(UnitType unit_type); bool resetUnitType(UnitType unit_type); + void addUnit(Unit const& u); bool setUnit(Glib::ustring const &unit); -- cgit v1.2.3 From d08f8e9ed468767cc64766eb80ea134bb5edb197 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 26 May 2011 23:17:37 +0200 Subject: add entry widget to guideline dialog to change guide's label (and fix some label xml writing and rendering bugs) (bzr r10234) --- src/display/guideline.cpp | 11 ++++++++--- src/display/guideline.h | 2 +- src/sp-guide.cpp | 4 ++-- src/sp-guide.h | 2 +- src/ui/dialog/guides.cpp | 14 ++++++++++++-- src/ui/dialog/guides.h | 2 ++ 6 files changed, 26 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index f0e1c7724..dddf1f30e 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -21,6 +21,7 @@ #include "guideline.h" #include "cairo.h" #include "inkscape-cairo.h" +#include "color.h" static void sp_guideline_class_init(SPGuideLineClass *c); static void sp_guideline_init(SPGuideLine *guideline); @@ -112,7 +113,8 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) cairo_t* ctx = nr_create_cairo_context_canvasbuf (NULL /*area*/, buf); //this function ignores the "area" parameter cairo_set_font_size (ctx, 10); cairo_set_line_width (ctx, 10); - cairo_set_source_rgb (ctx, 0, 0, 0); + /// @todo uh??! why must the order of these arguments be reversed? bgra instead of rgba! + cairo_set_source_rgba (ctx, SP_RGBA32_B_F(gl->rgba), SP_RGBA32_G_F(gl->rgba), SP_RGBA32_R_F(gl->rgba), SP_RGBA32_A_F(gl->rgba)); unsigned int const r = NR_RGBA32_R (gl->rgba); unsigned int const g = NR_RGBA32_G (gl->rgba); @@ -274,9 +276,12 @@ SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point p return item; } -void sp_guideline_set_label(SPGuideLine *gl, char* label) +void sp_guideline_set_label(SPGuideLine *gl, const char* label) { - gl->label = label; + if (gl->label) { + g_free(gl->label); + } + gl->label = g_strdup(label); sp_canvas_item_request_update(SP_CANVAS_ITEM (gl)); } diff --git a/src/display/guideline.h b/src/display/guideline.h index dbf990d1f..dfc3b7007 100644 --- a/src/display/guideline.h +++ b/src/display/guideline.h @@ -48,7 +48,7 @@ GType sp_guideline_get_type(); SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point point_on_line, Geom::Point normal); -void sp_guideline_set_label(SPGuideLine *gl, char* label); +void sp_guideline_set_label(SPGuideLine *gl, const char* label); void sp_guideline_set_position(SPGuideLine *gl, Geom::Point point_on_line); void sp_guideline_set_normal(SPGuideLine *gl, Geom::Point normal_to_line); void sp_guideline_set_color(SPGuideLine *gl, unsigned int rgba); diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 1e51ee4d5..584a6a366 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -412,7 +412,7 @@ void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool */ } -void sp_guide_set_label(SPGuide &guide, char* label, bool const commit) +void sp_guide_set_label(SPGuide &guide, const char* label, bool const commit) { g_assert(SP_IS_GUIDE(&guide)); if (guide.views){ @@ -421,7 +421,7 @@ void sp_guide_set_label(SPGuide &guide, char* label, bool const commit) if (commit){ //XML Tree being used directly while it shouldn't be - guide.getRepr()->setAttribute("label", label); + guide.getRepr()->setAttribute("inkscape:label", label); } } diff --git a/src/sp-guide.h b/src/sp-guide.h index 1dcdbc662..a164fda84 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -63,7 +63,7 @@ void sp_guide_create_guides_around_page(SPDesktop *dt); void sp_guide_moveto(SPGuide &guide, Geom::Point const point_on_line, bool const commit); void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool const commit); -void sp_guide_set_label(SPGuide &guide, char* const label, bool const commit); +void sp_guide_set_label(SPGuide &guide, const char* label, bool const commit); void sp_guide_remove(SPGuide *guide); char *sp_guide_description(SPGuide const *guide, const bool verbose = true); diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 60038cab0..12aeddecc 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -42,6 +42,7 @@ GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop * _relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")), _spin_button_x(_("X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), _spin_button_y(_("Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), + _label_entry(_("Label:"), _("Optionally give this guideline a name")), _spin_angle(_("Angle:"), "", UNIT_TYPE_RADIAL), _mode(true), _oldpos(0.,0.), _oldangle(0.0) { @@ -104,6 +105,9 @@ void GuidelinePropertiesDialog::_onApply() sp_guide_moveto(*_guide, newpos, true); + const gchar* name = _label_entry.getEntry()->get_text().c_str(); + sp_guide_set_label(*_guide, name, true); + DocumentUndo::done(_guide->document, SP_VERB_NONE, _("Set guide properties")); } @@ -167,8 +171,11 @@ void GuidelinePropertiesDialog::_setup() { _label_descr.set_alignment(0, 0.5); // indent - _layout_table.attach(*manage(new Gtk::Label(" ")), - 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10); +// _layout_table.attach(*manage(new Gtk::Label(" ")), +// 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10); + + _layout_table.attach(_label_entry, + 1, 3, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); // unitmenus /* fixme: We should allow percents here too, as percents of the canvas size */ @@ -245,6 +252,9 @@ void GuidelinePropertiesDialog::_setup() { g_free(label); } + // init name entry + _label_entry.getEntry()->set_text(_guide->label ? _guide->label : ""); + _modeChanged(); // sets values of spinboxes. if ( _oldangle == 90. || _oldangle == 270. || _oldangle == -90. || _oldangle == -270.) { diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index f015c49ff..efef0142b 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -24,6 +24,7 @@ #include "ui/widget/spinbutton.h" #include "ui/widget/unit-menu.h" #include "ui/widget/scalar-unit.h" +#include "ui/widget/entry.h" #include <2geom/point.h> class SPGuide; @@ -71,6 +72,7 @@ private: Inkscape::UI::Widget::UnitMenu _unit_menu; Inkscape::UI::Widget::ScalarUnit _spin_button_x; Inkscape::UI::Widget::ScalarUnit _spin_button_y; + Inkscape::UI::Widget::Entry _label_entry; Inkscape::UI::Widget::ScalarUnit _spin_angle; static Glib::ustring _angle_unit_status; // remember the status of the _relative_toggle_status button across instances -- cgit v1.2.3 From 8dffb2e7a2725a77d3af74bc984e48ac940f2679 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 26 May 2011 20:28:44 -0700 Subject: Applying patch from Gellule Xg to fix crash on 64-bit. Fixed bugs: - https://launchpad.net/bugs/629363 (bzr r10237) --- src/inkscape.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 1b0893c0b..b794138ca 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -190,7 +190,7 @@ inkscape_class_init (Inkscape::ApplicationClass * klass) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (Inkscape::ApplicationClass, modify_selection), NULL, NULL, - g_cclosure_marshal_VOID__UINT_POINTER, + gtk_marshal_VOID__POINTER_UINT, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT); inkscape_signals[CHANGE_SELECTION] = g_signal_new ("change_selection", -- cgit v1.2.3 From 3d6053d862638f21a5028cbf9f6eb77c9b4bc791 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Fri, 27 May 2011 20:37:38 -0300 Subject: Add "silent" option to extension inx file so that extension authors can opt-out of displaying the "working, please wait" dialog. Extensions that are tipically slow can still have the dialog show up by simply not adding this attribute to the inx file. (bzr r10240) --- src/extension/execution-env.cpp | 5 ++++- src/extension/extension.cpp | 14 ++++++++++++++ src/extension/extension.h | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index f9e099c26..a2550024a 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -141,7 +141,10 @@ ExecutionEnv::createWorkingDialog (void) { true); // modal _visibleDialog->signal_response().connect(sigc::mem_fun(this, &ExecutionEnv::workingCanceled)); g_free(dlgmessage); - _visibleDialog->show(); + + if (!_effect->is_silent()){ + _visibleDialog->show(); + } return; } diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index e67a4b95f..a70c79943 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -59,6 +59,7 @@ Parameter * get_param (const gchar * name); */ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) : _help(NULL) + , silent(false) , _gui(true) { repr = in_repr; @@ -105,6 +106,9 @@ Extension::Extension (Inkscape::XML::Node * in_repr, Implementation::Implementat if (!strcmp(chname, "dependency")) { _deps.push_back(new Dependency(child_repr)); } /* dependency */ + if (!strcmp(chname, "options")) { + silent = !strcmp( child_repr->attribute("silent"), "true" ); + } child_repr = sp_repr_next(child_repr); } @@ -309,6 +313,16 @@ Extension::get_repr (void) return repr; } +/** + \return bool + \brief Whether this extension should hide the "working, please wait" dialog +*/ +bool +Extension::is_silent (void) +{ + return silent; +} + /** \return The textual id of this extension \brief Get the ID of this extension - not a copy don't delete! diff --git a/src/extension/extension.h b/src/extension/extension.h index 936d2a907..dba8eeb45 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -99,6 +99,7 @@ private: state_t _state; /**< Which state the Extension is currently in */ std::vector _deps; /**< Dependencies for this extension */ static std::ofstream error_file; /**< This is the place where errors get reported */ + bool silent; bool _gui; protected: @@ -120,6 +121,7 @@ public: gchar * get_name (void); /** \brief Gets the help string for this extension */ gchar const * get_help (void) { return _help; } + bool is_silent (void); void deactivate (void); bool deactivated (void); void printFailure (Glib::ustring reason); -- cgit v1.2.3 From aabb5bb05a97e7414fd6f0204178788800871151 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 28 May 2011 03:36:31 -0700 Subject: Port of 0.48.x branch revision 9781. Cleanup of legacy code and casting that was breaking 64-bit gradient use. Fixes bug #743530 and bug #778441. Fixed bugs: - https://launchpad.net/bugs/743530 - https://launchpad.net/bugs/778441 (bzr r10242) --- src/Makefile_insert | 1 + src/display/nr-arena-glyphs.cpp | 1 + src/display/nr-arena-glyphs.h | 2 +- src/display/nr-arena.cpp | 1 + src/display/nr-arena.h | 3 ++- src/forward.h | 3 --- src/id-clash.cpp | 1 + src/sp-gradient.cpp | 10 +++++----- src/sp-object.cpp | 1 + src/sp-paint-server-reference.h | 43 +++++++++++++++++++++++++++++++++++++++++ src/sp-paint-server.cpp | 23 +++++++++++++++++----- src/sp-paint-server.h | 23 ++++------------------ src/sp-pattern.cpp | 13 +++++-------- src/style.h | 2 +- 14 files changed, 84 insertions(+), 43 deletions(-) create mode 100644 src/sp-paint-server-reference.h (limited to 'src') diff --git a/src/Makefile_insert b/src/Makefile_insert index 3a3862437..e7bf9715a 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -200,6 +200,7 @@ ink_common_sources += \ sp-object-repr.cpp sp-object-repr.h \ sp-offset.cpp sp-offset.h \ sp-paint-server.cpp sp-paint-server.h \ + sp-paint-server-reference.h \ sp-path.cpp sp-path.h \ sp-pattern.cpp sp-pattern.h \ sp-polygon.cpp sp-polygon.h \ diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp index 42bca7d94..a67812d8f 100644 --- a/src/display/nr-arena-glyphs.cpp +++ b/src/display/nr-arena-glyphs.cpp @@ -25,6 +25,7 @@ #include #include "inkscape-cairo.h" #include "display/grayscale.h" +#include "sp-paint-server.h" #ifdef test_glyph_liv #include "../display/canvas-bpath.h" diff --git a/src/display/nr-arena-glyphs.h b/src/display/nr-arena-glyphs.h index d04fdb4dc..b56a9f56c 100644 --- a/src/display/nr-arena-glyphs.h +++ b/src/display/nr-arena-glyphs.h @@ -20,13 +20,13 @@ #include "libnrtype/nrtype-forward.h" #include "forward.h" -#include "sp-paint-server.h" #include "display/nr-arena-item.h" #define test_glyph_liv struct SPCurve; class Shape; +class SPPainter; NRType nr_arena_glyphs_get_type (void); diff --git a/src/display/nr-arena.cpp b/src/display/nr-arena.cpp index 837bc0d86..147269727 100644 --- a/src/display/nr-arena.cpp +++ b/src/display/nr-arena.cpp @@ -17,6 +17,7 @@ #include "nr-filter-gaussian.h" #include "nr-filter-types.h" #include +#include "sp-paint-server.h" #include "preferences.h" #include "color.h" diff --git a/src/display/nr-arena.h b/src/display/nr-arena.h index bd6c3029d..402bc198f 100644 --- a/src/display/nr-arena.h +++ b/src/display/nr-arena.h @@ -30,7 +30,8 @@ G_END_DECLS #include #include #include "nr-arena-forward.h" -#include "sp-paint-server.h" + +class SPPainter; NRType nr_arena_get_type (void); diff --git a/src/forward.h b/src/forward.h index 97d2c15ed..897f3fe48 100644 --- a/src/forward.h +++ b/src/forward.h @@ -101,9 +101,6 @@ class SPTSpanClass; class SPString; class SPStringClass; -class SPPaintServer; -class SPPaintServerClass; - class SPStop; class SPStopClass; diff --git a/src/id-clash.cpp b/src/id-clash.cpp index 67e27e2f0..d305b5a9f 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -22,6 +22,7 @@ #include "id-clash.h" #include "sp-object.h" #include "style.h" +#include "sp-paint-server.h" #include "xml/node.h" #include "xml/repr.h" diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index 830e12f53..82d62547a 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -360,7 +360,7 @@ void SPGradientImpl::classInit(SPGradientClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *) klass; - gradient_parent_class = (SPPaintServerClass *)g_type_class_ref(SP_TYPE_PAINT_SERVER); + gradient_parent_class = SP_PAINT_SERVER_CLASS( g_type_class_ref(SP_TYPE_PAINT_SERVER) ); sp_object_class->build = SPGradientImpl::build; sp_object_class->release = SPGradientImpl::release; @@ -1520,7 +1520,7 @@ sp_lineargradient_get_type() static void sp_lineargradient_class_init(SPLinearGradientClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *) klass; - SPPaintServerClass *ps_class = (SPPaintServerClass *) klass; + SPPaintServerClass *ps_class = SP_PAINT_SERVER_CLASS( klass ); lg_parent_class = (SPGradientClass*)g_type_class_ref(SP_TYPE_GRADIENT); @@ -1648,7 +1648,7 @@ SPPainter * SPLGPainter::painter_new(SPPaintServer *ps, SPLGPainter *lgp = g_new(SPLGPainter, 1); - lgp->painter.type = SP_PAINTER_IND; + lgp->painter.server_type = G_OBJECT_TYPE(ps); lgp->painter.fill = sp_lg_fill; lgp->lg = lg; @@ -1801,7 +1801,7 @@ sp_radialgradient_get_type() static void sp_radialgradient_class_init(SPRadialGradientClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *) klass; - SPPaintServerClass *ps_class = (SPPaintServerClass *) klass; + SPPaintServerClass *ps_class = SP_PAINT_SERVER_CLASS( klass ); rg_parent_class = (SPGradientClass*)g_type_class_ref(SP_TYPE_GRADIENT); @@ -1937,7 +1937,7 @@ SPPainter *SPRGPainter::painter_new(SPPaintServer *ps, SPRGPainter *rgp = g_new(SPRGPainter, 1); - rgp->painter.type = SP_PAINTER_IND; + rgp->painter.server_type = G_OBJECT_TYPE(ps); rgp->painter.fill = sp_rg_fill; rgp->rg = rg; diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 17def7f15..c37e48983 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -43,6 +43,7 @@ #include "document.h" #include "style.h" #include "sp-object-repr.h" +#include "sp-paint-server.h" #include "sp-root.h" #include "sp-style-elem.h" #include "sp-script.h" diff --git a/src/sp-paint-server-reference.h b/src/sp-paint-server-reference.h new file mode 100644 index 000000000..90d8979f8 --- /dev/null +++ b/src/sp-paint-server-reference.h @@ -0,0 +1,43 @@ +#ifndef SEEN_SP_PAINT_SERVER_REFERENCE_H +#define SEEN_SP_PAINT_SERVER_REFERENCE_H + +/* + * Reference class for gradients and patterns. + * + * Author: + * Lauris Kaplinski + * Jon A. Cruz + * + * Copyright (C) 1999-2002 Lauris Kaplinski + * Copyright (C) 2000-2001 Ximian, Inc. + * Copyright (C) 2010 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "sp-object.h" +#include "uri-references.h" + +struct SPPaintServer; + +class SPPaintServerReference : public Inkscape::URIReference { +public: + SPPaintServerReference (SPObject *obj) : URIReference(obj) {} + SPPaintServerReference (SPDocument *doc) : URIReference(doc) {} + SPPaintServer *getObject() const; + +protected: + virtual bool _acceptObject(SPObject *obj) const; +}; + +#endif // SEEN_SP_PAINT_SERVER_REFERENCE_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:encoding=utf-8:textwidth=99 : diff --git a/src/sp-paint-server.cpp b/src/sp-paint-server.cpp index b672e4480..18b1eea7d 100644 --- a/src/sp-paint-server.cpp +++ b/src/sp-paint-server.cpp @@ -15,6 +15,7 @@ #include #include "libnr/nr-pixblock-pattern.h" +#include "sp-paint-server-reference.h" #include "sp-paint-server.h" #include "sp-gradient.h" @@ -29,6 +30,17 @@ static void sp_painter_stale_fill(SPPainter *painter, NRPixBlock *pb); static SPObjectClass *parent_class; static GSList *stale_painters = NULL; + +SPPaintServer *SPPaintServerReference::getObject() const +{ + return static_cast(URIReference::getObject()); +} + +bool SPPaintServerReference::_acceptObject(SPObject *obj) const +{ + return SP_IS_PAINT_SERVER(obj); +} + GType SPPaintServer::getType(void) { static GType type = 0; @@ -91,7 +103,7 @@ SPPainter *sp_paint_server_painter_new(SPPaintServer *ps, g_return_val_if_fail(bbox != NULL, NULL); SPPainter *painter = NULL; - SPPaintServerClass *psc = (SPPaintServerClass *) G_OBJECT_GET_CLASS(ps); + SPPaintServerClass *psc = SP_PAINT_SERVER_CLASS( G_OBJECT_GET_CLASS(ps) ); if ( psc->painter_new ) { painter = (*psc->painter_new)(ps, full_transform, parent_transform, bbox); } @@ -99,7 +111,7 @@ SPPainter *sp_paint_server_painter_new(SPPaintServer *ps, if (painter) { painter->next = ps->painters; painter->server = ps; - painter->type = (SPPainterType) G_OBJECT_TYPE(ps); + painter->server_type = G_OBJECT_TYPE(ps); ps->painters = painter; } @@ -112,7 +124,7 @@ static void sp_paint_server_painter_free(SPPaintServer *ps, SPPainter *painter) g_return_if_fail(SP_IS_PAINT_SERVER(ps)); g_return_if_fail(painter != NULL); - SPPaintServerClass *psc = (SPPaintServerClass *) G_OBJECT_GET_CLASS(ps); + SPPaintServerClass *psc = SP_PAINT_SERVER_CLASS( G_OBJECT_GET_CLASS(ps) ); SPPainter *r = NULL; for (SPPainter *p = ps->painters; p != NULL; p = p->next) { @@ -141,9 +153,10 @@ SPPainter *sp_painter_free(SPPainter *painter) if (painter->server) { sp_paint_server_painter_free(painter->server, painter); } else { - SPPaintServerClass *psc = (SPPaintServerClass *) g_type_class_ref(painter->type); - if (psc->painter_free) + SPPaintServerClass *psc = SP_PAINT_SERVER_CLASS( g_type_class_ref(painter->server_type) ); + if (psc->painter_free) { (*psc->painter_free)(NULL, painter); + } stale_painters = g_slist_remove(stale_painters, painter); } diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h index 05f5b7bad..c77aad694 100644 --- a/src/sp-paint-server.h +++ b/src/sp-paint-server.h @@ -19,7 +19,8 @@ #include "sp-object.h" #include "uri-references.h" -class SPPainter; +struct SPPainter; +struct SPPaintServer; #define SP_TYPE_PAINT_SERVER (SPPaintServer::getType()) #define SP_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_PAINT_SERVER, SPPaintServer)) @@ -27,19 +28,15 @@ class SPPainter; #define SP_IS_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_PAINT_SERVER)) #define SP_IS_PAINT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_PAINT_SERVER)) -typedef enum { - SP_PAINTER_IND, - SP_PAINTER_DEP -} SPPainterType; - typedef void (* SPPainterFillFunc) (SPPainter *painter, NRPixBlock *pb); + /* fixme: I do not like that class thingie (Lauris) */ struct SPPainter { SPPainter *next; SPPaintServer *server; GType server_type; - SPPainterType type; +// SPPainterType type; SPPainterFillFunc fill; }; @@ -72,18 +69,6 @@ SPPainter *sp_paint_server_painter_new (SPPaintServer *ps, Geom::Affine const &f SPPainter *sp_painter_free (SPPainter *painter); -class SPPaintServerReference : public Inkscape::URIReference { -public: - SPPaintServerReference (SPObject *obj) : URIReference(obj) {} - SPPaintServerReference (SPDocument *doc) : URIReference(doc) {} - SPPaintServer *getObject() const { - return static_cast(URIReference::getObject()); - } -protected: - virtual bool _acceptObject(SPObject *obj) const { - return SP_IS_PAINT_SERVER (obj); - } -}; #endif // SEEN_SP_PAINT_SERVER_H /* diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 9ea0ef891..0b2fe8389 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -78,7 +78,7 @@ static void pattern_ref_modified (SPObject *ref, guint flags, SPPattern *pattern static SPPainter *sp_pattern_painter_new (SPPaintServer *ps, Geom::Affine const &full_transform, Geom::Affine const &parent_transform, const NRRect *bbox); static void sp_pattern_painter_free (SPPaintServer *ps, SPPainter *painter); -static SPPaintServerClass * pattern_parent_class; +static SPPaintServerClass * pattern_parent_class = 0; GType sp_pattern_get_type (void) @@ -105,13 +105,10 @@ sp_pattern_get_type (void) static void sp_pattern_class_init (SPPatternClass *klass) { - SPObjectClass *sp_object_class; - SPPaintServerClass *ps_class; + SPObjectClass *sp_object_class = SP_OBJECT_CLASS( klass ); + SPPaintServerClass *ps_class = SP_PAINT_SERVER_CLASS( klass ); - sp_object_class = (SPObjectClass *) klass; - ps_class = (SPPaintServerClass *) klass; - - pattern_parent_class = (SPPaintServerClass*)g_type_class_ref (SP_TYPE_PAINT_SERVER); + pattern_parent_class = SP_PAINT_SERVER_CLASS( g_type_class_ref(SP_TYPE_PAINT_SERVER) ); sp_object_class->build = sp_pattern_build; sp_object_class->release = sp_pattern_release; @@ -683,7 +680,7 @@ sp_pattern_painter_new (SPPaintServer *ps, Geom::Affine const &full_transform, G SPPattern *pat = SP_PATTERN (ps); SPPatPainter *pp = g_new (SPPatPainter, 1); - pp->painter.type = SP_PAINTER_IND; + pp->painter.server_type = G_OBJECT_TYPE(ps); pp->painter.fill = sp_pat_fill; pp->pat = pat; diff --git a/src/style.h b/src/style.h index 70e84ab42..a12db388a 100644 --- a/src/style.h +++ b/src/style.h @@ -22,7 +22,7 @@ #include "sp-filter-reference.h" #include "uri-references.h" #include "uri.h" -#include "sp-paint-server.h" +#include "sp-paint-server-reference.h" #include #include -- cgit v1.2.3 From 961baa0d3d2691ebeabc3f51fdab8d816b32c563 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 30 May 2011 00:36:58 -0700 Subject: Queue swatch updates during periods of high UI usage, such as dragging gradient handles. Fixes bug #734981. Fixed bugs: - https://launchpad.net/bugs/734981 (bzr r10244) --- src/ui/dialog/swatches.cpp | 89 ++++++++++++++++++++++++++++++++++++++++++++-- src/ui/dialog/swatches.h | 3 ++ 2 files changed, 89 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index b2b1b26da..935fe9806 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "color-item.h" @@ -63,8 +64,6 @@ namespace Dialogs { void _loadPaletteFile( gchar const *filename ); -class DocTrack; - std::vector possible; static std::map docPalettes; static std::vector docTrackings; @@ -715,14 +714,31 @@ class DocTrack public: DocTrack(SPDocument *doc, sigc::connection &gradientRsrcChanged, sigc::connection &defsChanged, sigc::connection &defsModified) : doc(doc), + updatePending(false), + lastGradientUpdate(0.0), gradientRsrcChanged(gradientRsrcChanged), defsChanged(defsChanged), defsModified(defsModified) { + if ( !timer ) { + timer = new Glib::Timer(); + refreshTimer = Glib::signal_timeout().connect( sigc::ptr_fun(handleTimerCB), 33 ); + } + timerRefCount++; } ~DocTrack() { + timerRefCount--; + if ( timerRefCount <= 0 ) { + refreshTimer.disconnect(); + timerRefCount = 0; + if ( timer ) { + timer->stop(); + delete timer; + timer = 0; + } + } if (doc) { gradientRsrcChanged.disconnect(); defsChanged.disconnect(); @@ -730,7 +746,22 @@ public: } } + static bool handleTimerCB(); + + /** + * Checks if update should be queued or executed immediately. + * + * @return true if the update was queued and should not be immediately executed. + */ + static bool queueUpdateIfNeeded(SPDocument *doc); + + static Glib::Timer *timer; + static int timerRefCount; + static sigc::connection refreshTimer; + SPDocument *doc; + bool updatePending; + double lastGradientUpdate; sigc::connection gradientRsrcChanged; sigc::connection defsChanged; sigc::connection defsModified; @@ -740,6 +771,58 @@ private: DocTrack &operator=(DocTrack const &); // no assign }; +Glib::Timer *DocTrack::timer = 0; +int DocTrack::timerRefCount = 0; +sigc::connection DocTrack::refreshTimer; + +static const double DOC_UPDATE_THREASHOLD = 0.090; + +bool DocTrack::handleTimerCB() +{ + double now = timer->elapsed(); + + std::vector needCallback; + for (std::vector::iterator it = docTrackings.begin(); it != docTrackings.end(); ++it) { + DocTrack *track = *it; + if ( track->updatePending && ( (now - track->lastGradientUpdate) >= DOC_UPDATE_THREASHOLD) ) { + needCallback.push_back(track); + } + } + + for (std::vector::iterator it = needCallback.begin(); it != needCallback.end(); ++it) { + DocTrack *track = *it; + if ( std::find(docTrackings.begin(), docTrackings.end(), track) != docTrackings.end() ) { // Just in case one gets deleted while we are looping + // Note: calling handleDefsModified will call queueUpdateIfNeeded and thus update the time and flag. + SwatchesPanel::handleDefsModified(track->doc); + } + } + + return true; +} + +bool DocTrack::queueUpdateIfNeeded( SPDocument *doc ) +{ + bool deferProcessing = false; + for (std::vector::iterator it = docTrackings.begin(); it != docTrackings.end(); ++it) { + DocTrack *track = *it; + if ( track->doc == doc ) { + double now = timer->elapsed(); + double elapsed = now - track->lastGradientUpdate; + + if ( elapsed < DOC_UPDATE_THREASHOLD ) { + deferProcessing = true; + track->updatePending = true; + } else { + track->lastGradientUpdate = now; + track->updatePending = false; + } + + break; + } + } + return deferProcessing; +} + void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document ) { SPDocument *oldDoc = 0; @@ -897,7 +980,7 @@ void SwatchesPanel::handleGradientsChange(SPDocument *document) void SwatchesPanel::handleDefsModified(SPDocument *document) { SwatchPage *docPalette = (docPalettes.find(document) != docPalettes.end()) ? docPalettes[document] : 0; - if (docPalette) { + if (docPalette && !DocTrack::queueUpdateIfNeeded(document) ) { std::vector tmpColors; std::map tmpPrevs; std::map tmpGrads; diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h index f9f3daf91..95d7acb00 100644 --- a/src/ui/dialog/swatches.h +++ b/src/ui/dialog/swatches.h @@ -23,6 +23,7 @@ namespace Dialogs { class ColorItem; class SwatchPage; +class DocTrack; /** * A panel that displays paint swatches. @@ -68,6 +69,8 @@ private: sigc::connection _documentConnection; sigc::connection _selChanged; + + friend class DocTrack; }; } //namespace Dialogs -- cgit v1.2.3 From 50f0c3735473690f71df9862c5d9675f9efcfa8c Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Tue, 31 May 2011 19:15:11 -0500 Subject: fix rendering of angled guidelines (bzr r10246) --- src/display/guideline.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index dddf1f30e..abfec250f 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -170,6 +170,13 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) } } else { + + if (gl->label){ + cairo_move_to(ctx, px - buf->rect.x0 + 5, py - buf->rect.y0); + cairo_rotate(ctx, atan2(gl->normal_to_line[Geom::X], gl->normal_to_line[Geom::Y])); + cairo_show_text(ctx, gl->label); + } + // render angled line, once intersection has been detected, draw from there. Geom::Point parallel_to_line( gl->normal_to_line[Geom::Y], /*should be minus, but inverted y axis*/ gl->normal_to_line[Geom::X]); @@ -207,12 +214,6 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) sp_guideline_drawline (buf, static_cast(round(x_intersect_bottom)), buf->rect.y1, static_cast(round(x_intersect_top)), buf->rect.y0, gl->rgba); return; } - - if (gl->label){ - cairo_move_to(ctx, px - buf->rect.x0 + 5, py - buf->rect.y0); - cairo_rotate(ctx, atan2(gl->normal_to_line[Geom::X], gl->normal_to_line[Geom::Y])); - cairo_show_text(ctx, gl->label); - } } } -- cgit v1.2.3 From 2d87b4c8eb4eaaf67c9e92356368a8ab86a19454 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 1 Jun 2011 22:45:16 +0200 Subject: improve explanation of lpe parameter (bzr r10250) --- src/live_effects/effect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index 7fe4e9348..91d09fef6 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -157,7 +157,7 @@ protected: LivePathEffectObject *lpeobj; // this boolean defaults to false, it concatenates the input path to one pwd2, - // instead of normally 'splitting' the path into continuous pwd2 paths. + // instead of normally 'splitting' the path into continuous pwd2 paths and calling doEffect_pwd2 for each. bool concatenate_before_pwd2; private: -- cgit v1.2.3 From f3756ff85a32f4b2a0771d0ac3bd78a69535395f Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 3 Jun 2011 11:44:52 +0100 Subject: Use generic headers in preparation for GTK+ 3 transition Fixed bugs: - https://launchpad.net/bugs/792263 (bzr r10252.1.1) --- src/color.h | 2 +- src/context-fns.h | 2 +- src/debug/gdk-event-latency-tracker.h | 2 +- src/debug/log-display-config.cpp | 3 +-- src/desktop-events.h | 4 ++-- src/desktop.h | 4 ++-- src/device-manager.cpp | 2 +- src/dialogs/clonetiler.h | 2 +- src/dialogs/dialog-events.h | 3 +-- src/dialogs/find.h | 2 +- src/dialogs/item-properties.cpp | 9 --------- src/dialogs/item-properties.h | 2 +- src/dialogs/object-attributes.h | 2 +- src/dialogs/spellcheck.h | 2 +- src/display/canvas-temporary-item.cpp | 2 +- src/display/grayscale.h | 2 +- src/display/nr-3dutils.h | 2 +- src/display/nr-filter-diffuselighting.h | 2 +- src/display/nr-filter-specularlighting.h | 2 +- src/display/nr-light.h | 2 +- src/display/sodipodi-ctrl.h | 2 +- src/display/sp-canvas-item.h | 4 ++-- src/display/sp-canvas.cpp | 4 +--- src/display/sp-canvas.h | 6 ++---- src/document.cpp | 2 +- src/ege-adjustment-action.cpp | 11 ----------- src/ege-adjustment-action.h | 2 +- src/ege-color-prof-tracker.cpp | 4 +--- src/ege-output-action.cpp | 4 +--- src/ege-output-action.h | 2 +- src/ege-select-one-action.cpp | 9 --------- src/ege-select-one-action.h | 3 +-- src/event-context.cpp | 3 +-- src/event-context.h | 3 +-- src/extension/effect.h | 2 +- src/extension/implementation/implementation.h | 2 +- src/extension/input.h | 2 +- src/extension/internal/pdfinput/pdf-input.cpp | 2 +- src/extension/output.h | 2 +- src/file.h | 2 +- src/help.h | 2 +- src/helper/unit-menu.cpp | 5 +---- src/helper/unit-menu.h | 2 +- src/helper/unit-tracker.cpp | 2 +- src/helper/unit-tracker.h | 3 +-- src/helper/window.cpp | 2 +- src/helper/window.h | 2 +- src/icon-size.h | 2 +- src/ink-action.cpp | 9 ++------- src/ink-action.h | 4 +--- src/ink-comboboxentry-action.cpp | 3 --- src/ink-comboboxentry-action.h | 3 +-- src/inkscape.cpp | 3 +-- src/inkview.cpp | 6 +----- src/interface.h | 2 +- src/io/sys.cpp | 2 +- src/knot.h | 2 +- src/libgdl/gdl-dock-bar.h | 2 +- src/libgdl/gdl-dock-item-grip.c | 4 +--- src/libgdl/gdl-dock-item-grip.h | 2 +- src/libgdl/gdl-dock-master.h | 2 +- src/libgdl/gdl-dock-object.h | 2 +- src/libgdl/gdl-dock-paned.c | 3 +-- src/libgdl/gdl-stock.c | 1 - src/libgdl/gdl-switcher.c | 4 ---- src/libgdl/gdl-switcher.h | 2 +- src/libgdl/gdl-tools.h | 2 +- src/libnrtype/Layout-TNG-Input.cpp | 2 +- src/live_effects/parameter/path.cpp | 2 +- src/main.cpp | 6 +----- src/modifier-fns.h | 2 +- src/select-context.h | 2 +- src/seltrans-handles.h | 2 +- src/shortcuts.cpp | 2 +- src/sp-gradient.h | 2 +- src/sp-pattern.h | 2 +- src/spiral-context.h | 2 +- src/svg-view-widget.cpp | 2 +- src/text-context.cpp | 3 +-- src/text-context.h | 2 +- src/ui/context-menu.cpp | 2 +- src/ui/context-menu.h | 2 +- src/ui/dialog/color-item.cpp | 2 +- src/ui/dialog/extensions.cpp | 2 +- src/ui/dialog/filedialogimpl-gtkmm.h | 6 +----- src/ui/dialog/glyphs.cpp | 4 +--- src/ui/dialog/inkscape-preferences.cpp | 2 +- src/ui/dialog/layers.cpp | 3 +-- src/ui/dialog/ocaldialogs.h | 4 +--- src/ui/dialog/print.h | 2 +- src/ui/dialog/swatches.cpp | 6 +----- src/ui/dialog/tile.cpp | 3 +-- src/ui/dialog/tracedialog.cpp | 2 +- src/ui/dialog/undo-history.cpp | 2 +- src/ui/view/view-widget.h | 2 +- src/ui/view/view.h | 2 +- src/ui/widget/combo-text.cpp | 2 +- src/ui/widget/panel.cpp | 2 +- src/ui/widget/selected-style.cpp | 2 +- src/ui/widget/toolbox.cpp | 2 +- src/verbs.cpp | 2 +- src/widgets/button.h | 4 +--- src/widgets/desktop-widget.h | 3 +-- src/widgets/eek-preview.h | 4 ++-- src/widgets/fill-style.cpp | 2 +- src/widgets/font-selector.cpp | 7 ------- src/widgets/font-selector.h | 2 +- src/widgets/gradient-image.h | 2 +- src/widgets/gradient-selector.cpp | 6 +----- src/widgets/gradient-selector.h | 2 +- src/widgets/gradient-toolbar.h | 2 +- src/widgets/gradient-vector.h | 2 +- src/widgets/icon.h | 2 +- src/widgets/paint-selector.cpp | 9 +-------- src/widgets/paint-selector.h | 2 +- src/widgets/ruler.h | 2 +- src/widgets/select-toolbar.cpp | 1 - src/widgets/select-toolbar.h | 3 +-- src/widgets/shrink-wrap-button.cpp | 2 +- src/widgets/sp-attribute-widget.cpp | 3 +-- src/widgets/sp-attribute-widget.h | 3 +-- src/widgets/sp-color-gtkselector.h | 2 +- src/widgets/sp-color-icc-selector.cpp | 5 ----- src/widgets/sp-color-icc-selector.h | 3 +-- src/widgets/sp-color-notebook.h | 4 +--- src/widgets/sp-color-preview.h | 2 +- src/widgets/sp-color-scales.h | 3 +-- src/widgets/sp-color-selector.h | 2 +- src/widgets/sp-color-slider.cpp | 3 +-- src/widgets/sp-color-slider.h | 2 +- src/widgets/sp-color-wheel-selector.cpp | 5 +---- src/widgets/sp-color-wheel-selector.h | 3 +-- src/widgets/sp-widget.h | 2 +- src/widgets/sp-xmlview-attr-list.h | 1 - src/widgets/sp-xmlview-content.h | 2 +- src/widgets/sp-xmlview-tree.h | 2 +- src/widgets/spinbutton-events.h | 3 +-- src/widgets/spw-utilities.h | 2 +- src/widgets/toolbox.h | 3 +-- 139 files changed, 135 insertions(+), 266 deletions(-) (limited to 'src') diff --git a/src/color.h b/src/color.h index bebeaec60..8e6b54dd1 100644 --- a/src/color.h +++ b/src/color.h @@ -15,7 +15,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include /* Useful composition macros */ diff --git a/src/context-fns.h b/src/context-fns.h index be8b4dfd5..c86640aba 100644 --- a/src/context-fns.h +++ b/src/context-fns.h @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include <2geom/forward.h> struct SPDesktop; diff --git a/src/debug/gdk-event-latency-tracker.h b/src/debug/gdk-event-latency-tracker.h index 12ebb6570..c3624e74f 100644 --- a/src/debug/gdk-event-latency-tracker.h +++ b/src/debug/gdk-event-latency-tracker.h @@ -12,7 +12,7 @@ #ifndef SEEN_INKSCAPE_DEBUG_GDK_EVENT_LATENCY_TRACKER_H #define SEEN_INKSCAPE_DEBUG_GDK_EVENT_LATENCY_TRACKER_H -#include +#include #include #include diff --git a/src/debug/log-display-config.cpp b/src/debug/log-display-config.cpp index d2821cc53..07380b3ad 100644 --- a/src/debug/log-display-config.cpp +++ b/src/debug/log-display-config.cpp @@ -10,8 +10,7 @@ */ #include -#include -#include +#include #include "debug/event-tracker.h" #include "debug/logger.h" #include "debug/simple-event.h" diff --git a/src/desktop-events.h b/src/desktop-events.h index e720cf7a0..e573fc878 100644 --- a/src/desktop-events.h +++ b/src/desktop-events.h @@ -13,8 +13,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include +#include +#include class SPDesktop; class SPDesktopWidget; diff --git a/src/desktop.h b/src/desktop.h index 6d1bcd194..2581f2859 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -27,8 +27,8 @@ #include "config.h" #endif -#include -#include +#include +#include #include #include diff --git a/src/device-manager.cpp b/src/device-manager.cpp index 2b44a8d51..5cf376cc4 100644 --- a/src/device-manager.cpp +++ b/src/device-manager.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "device-manager.h" #include "preferences.h" diff --git a/src/dialogs/clonetiler.h b/src/dialogs/clonetiler.h index bfb35cd96..899181346 100644 --- a/src/dialogs/clonetiler.h +++ b/src/dialogs/clonetiler.h @@ -12,7 +12,7 @@ #include -#include +#include void clonetiler_dialog ( void ); diff --git a/src/dialogs/dialog-events.h b/src/dialogs/dialog-events.h index 7b04d0f69..9c0a82f23 100644 --- a/src/dialogs/dialog-events.h +++ b/src/dialogs/dialog-events.h @@ -12,8 +12,7 @@ #ifndef __DIALOG_EVENTS_H__ #define __DIALOG_EVENTS_H__ -#include -#include +#include #include /* diff --git a/src/dialogs/find.h b/src/dialogs/find.h index fe5861a73..219c36bf2 100644 --- a/src/dialogs/find.h +++ b/src/dialogs/find.h @@ -12,7 +12,7 @@ #ifndef SEEN_FIND_H #define SEEN_FIND_H -#include +#include void sp_find_dialog(); diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index 94b8b1e98..54707c0aa 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -16,16 +16,7 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include "../desktop-handles.h" #include "dialog-events.h" diff --git a/src/dialogs/item-properties.h b/src/dialogs/item-properties.h index bc04608bc..7d57ae5e8 100644 --- a/src/dialogs/item-properties.h +++ b/src/dialogs/item-properties.h @@ -12,7 +12,7 @@ #define SEEN_DIALOGS_ITEM_PROPERTIES_H #include -#include +#include #include "../forward.h" GtkWidget *sp_item_widget_new (void); diff --git a/src/dialogs/object-attributes.h b/src/dialogs/object-attributes.h index ef84708c0..b490ebfa1 100644 --- a/src/dialogs/object-attributes.h +++ b/src/dialogs/object-attributes.h @@ -13,7 +13,7 @@ #define SEEN_DIALOGS_OBJECT_ATTRIBUTES_H #include -#include +#include #include "../forward.h" void sp_object_attributes_dialog (SPObject *object, const gchar *tag); diff --git a/src/dialogs/spellcheck.h b/src/dialogs/spellcheck.h index b941788ca..fe80be2cb 100644 --- a/src/dialogs/spellcheck.h +++ b/src/dialogs/spellcheck.h @@ -12,7 +12,7 @@ #ifndef SEEN_SPELLCHECK_H #define SEEN_SPELLCHECK_H -#include +#include void sp_spellcheck_dialog(); diff --git a/src/display/canvas-temporary-item.cpp b/src/display/canvas-temporary-item.cpp index ccef4d0cb..8d336f0ff 100644 --- a/src/display/canvas-temporary-item.cpp +++ b/src/display/canvas-temporary-item.cpp @@ -16,7 +16,7 @@ #include "display/canvas-temporary-item.h" -#include +#include namespace Inkscape { namespace Display { diff --git a/src/display/grayscale.h b/src/display/grayscale.h index 855c9e465..d7092687c 100644 --- a/src/display/grayscale.h +++ b/src/display/grayscale.h @@ -12,7 +12,7 @@ * Released under GNU GPL */ -#include +#include namespace Grayscale { guint32 process(guint32 rgba); diff --git a/src/display/nr-3dutils.h b/src/display/nr-3dutils.h index 56bed6ba2..e19651ac8 100644 --- a/src/display/nr-3dutils.h +++ b/src/display/nr-3dutils.h @@ -14,7 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include <2geom/forward.h> struct NRPixBlock; diff --git a/src/display/nr-filter-diffuselighting.h b/src/display/nr-filter-diffuselighting.h index 8dc7a1818..f540bf4a5 100644 --- a/src/display/nr-filter-diffuselighting.h +++ b/src/display/nr-filter-diffuselighting.h @@ -13,7 +13,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "display/nr-light-types.h" #include "display/nr-filter-primitive.h" #include "display/nr-filter-slot.h" diff --git a/src/display/nr-filter-specularlighting.h b/src/display/nr-filter-specularlighting.h index a5d29588a..7c278df89 100644 --- a/src/display/nr-filter-specularlighting.h +++ b/src/display/nr-filter-specularlighting.h @@ -13,7 +13,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "display/nr-light-types.h" #include "display/nr-filter-primitive.h" #include "display/nr-filter-slot.h" diff --git a/src/display/nr-light.h b/src/display/nr-light.h index 49130cc4e..022243bfc 100644 --- a/src/display/nr-light.h +++ b/src/display/nr-light.h @@ -8,7 +8,7 @@ * light color components (at a given point). */ -#include +#include #include "display/nr-3dutils.h" #include "display/nr-light-types.h" #include <2geom/forward.h> diff --git a/src/display/sodipodi-ctrl.h b/src/display/sodipodi-ctrl.h index a708ad41b..c3b97cbe0 100644 --- a/src/display/sodipodi-ctrl.h +++ b/src/display/sodipodi-ctrl.h @@ -7,7 +7,7 @@ * */ -#include +#include #include #include #include "sp-canvas-item.h" diff --git a/src/display/sp-canvas-item.h b/src/display/sp-canvas-item.h index cc0bdfc77..26e5aa1f6 100644 --- a/src/display/sp-canvas-item.h +++ b/src/display/sp-canvas-item.h @@ -22,8 +22,8 @@ #endif #include -#include -#include +#include +#include #include "2geom/rect.h" diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 0d450362a..ff1bf32c6 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -20,9 +20,7 @@ #include -#include -#include -#include +#include #include diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 3a0b56585..a6ddafb1e 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -28,10 +28,8 @@ #endif #include -#include -#include -#include -#include +#include +#include #include diff --git a/src/document.cpp b/src/document.cpp index c9b822ce6..b9c3fe9ff 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -37,7 +37,7 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include +#include #include #include diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index b8ee66f08..f6df395b9 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -43,18 +43,7 @@ #include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "widgets/icon.h" #include "icon-size.h" diff --git a/src/ege-adjustment-action.h b/src/ege-adjustment-action.h index b7da6a499..f63d4ed3e 100644 --- a/src/ege-adjustment-action.h +++ b/src/ege-adjustment-action.h @@ -46,7 +46,7 @@ /* Note: this file should be kept compilable as both .cpp and .c */ #include -#include +#include #include G_BEGIN_DECLS diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp index 900246595..a6fcaa126 100644 --- a/src/ege-color-prof-tracker.cpp +++ b/src/ege-color-prof-tracker.cpp @@ -41,9 +41,7 @@ #include -#include -#include -#include +#include #ifdef GDK_WINDOWING_X11 #include diff --git a/src/ege-output-action.cpp b/src/ege-output-action.cpp index 72616ce18..c1a5be694 100644 --- a/src/ege-output-action.cpp +++ b/src/ege-output-action.cpp @@ -41,9 +41,7 @@ #include -#include -#include -#include +#include #include "ege-output-action.h" diff --git a/src/ege-output-action.h b/src/ege-output-action.h index e626ccd8c..fc21c2f27 100644 --- a/src/ege-output-action.h +++ b/src/ege-output-action.h @@ -46,7 +46,7 @@ /* Note: this file should be kept compilable as both .cpp and .c */ #include -#include +#include #include G_BEGIN_DECLS diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 1c3ec1ff5..2fd45e268 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -41,16 +41,7 @@ #include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include #include "ege-select-one-action.h" diff --git a/src/ege-select-one-action.h b/src/ege-select-one-action.h index 36943b978..d605f4a67 100644 --- a/src/ege-select-one-action.h +++ b/src/ege-select-one-action.h @@ -49,8 +49,7 @@ /* Note: this file should be kept compilable as both .cpp and .c */ #include -#include -#include +#include #include G_BEGIN_DECLS diff --git a/src/event-context.cpp b/src/event-context.cpp index 828ce3d5b..5a1c7130a 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -30,8 +30,7 @@ #include #include -#include -#include +#include #include #include #include diff --git a/src/event-context.h b/src/event-context.h index 71084cb5f..b0772c23a 100644 --- a/src/event-context.h +++ b/src/event-context.h @@ -18,8 +18,7 @@ */ #include -#include -#include +#include #include "knot.h" #include "2geom/forward.h" diff --git a/src/extension/effect.h b/src/extension/effect.h index c02ce542b..28ebc5d96 100644 --- a/src/extension/effect.h +++ b/src/extension/effect.h @@ -15,7 +15,7 @@ #include #include -#include +#include #include "verbs.h" #include "prefdialog.h" diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index bf584b401..b9e417feb 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -12,7 +12,7 @@ #ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ #define __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ -#include +#include #include #include diff --git a/src/extension/input.h b/src/extension/input.h index 24cbc4896..8b198495e 100644 --- a/src/extension/input.h +++ b/src/extension/input.h @@ -16,7 +16,7 @@ #include "extension.h" #include "xml/repr.h" #include "document.h" -#include +#include namespace Inkscape { namespace Extension { diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index fc2db7e69..186f337c4 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -40,7 +40,7 @@ #include "inkscape.h" #include "dialogs/dialog-events.h" -#include +#include #include "ui/widget/spinbutton.h" namespace Inkscape { diff --git a/src/extension/output.h b/src/extension/output.h index 584fafda8..5f6785b8b 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -13,7 +13,7 @@ #ifndef INKSCAPE_EXTENSION_OUTPUT_H__ #define INKSCAPE_EXTENSION_OUTPUT_H__ -#include +#include #include "extension.h" struct SPDocument; diff --git a/src/file.h b/src/file.h index 97d1bd5f8..dec7e3f14 100644 --- a/src/file.h +++ b/src/file.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include "extension/extension-forward.h" #include "extension/system.h" diff --git a/src/help.h b/src/help.h index 35f67a714..b6c82fb51 100644 --- a/src/help.h +++ b/src/help.h @@ -14,7 +14,7 @@ */ #include -#include +#include void sp_help_about(void); void sp_help_open_tutorial(GtkMenuItem *menuitem, gpointer data); diff --git a/src/helper/unit-menu.cpp b/src/helper/unit-menu.cpp index e4ff09829..5494aaaeb 100644 --- a/src/helper/unit-menu.cpp +++ b/src/helper/unit-menu.cpp @@ -17,10 +17,7 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include -#include -#include -#include +#include #include "helper/sp-marshal.h" #include "helper/units.h" #include "helper/unit-menu.h" diff --git a/src/helper/unit-menu.h b/src/helper/unit-menu.h index b3ab8836c..795dda7b7 100644 --- a/src/helper/unit-menu.h +++ b/src/helper/unit-menu.h @@ -11,7 +11,7 @@ */ #include -#include +#include #include diff --git a/src/helper/unit-tracker.cpp b/src/helper/unit-tracker.cpp index 3f5a72e6a..609c2f292 100644 --- a/src/helper/unit-tracker.cpp +++ b/src/helper/unit-tracker.cpp @@ -10,7 +10,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "unit-tracker.h" #include "ege-select-one-action.h" diff --git a/src/helper/unit-tracker.h b/src/helper/unit-tracker.h index 0f333b2ec..a15a0a6ca 100644 --- a/src/helper/unit-tracker.h +++ b/src/helper/unit-tracker.h @@ -15,8 +15,7 @@ #include -#include -#include +#include #include "helper/units.h" diff --git a/src/helper/window.cpp b/src/helper/window.cpp index b814424e5..f4640203d 100644 --- a/src/helper/window.cpp +++ b/src/helper/window.cpp @@ -12,7 +12,7 @@ #ifdef HAVE_CONFIG_H # include #endif -#include +#include #include #include "inkscape.h" diff --git a/src/helper/window.h b/src/helper/window.h index 36b91a813..dc2c48bc0 100644 --- a/src/helper/window.h +++ b/src/helper/window.h @@ -10,7 +10,7 @@ * This code is in public domain */ -#include +#include #include /* diff --git a/src/icon-size.h b/src/icon-size.h index da2b3854d..4bb4f1df6 100644 --- a/src/icon-size.h +++ b/src/icon-size.h @@ -14,7 +14,7 @@ #include -#include +#include namespace Inkscape { diff --git a/src/ink-action.cpp b/src/ink-action.cpp index 587efdff0..d26b038f8 100644 --- a/src/ink-action.cpp +++ b/src/ink-action.cpp @@ -2,12 +2,7 @@ #include -#include -#include -#include -#include -#include -#include +#include #include "icon-size.h" #include "ink-action.h" @@ -183,7 +178,7 @@ void ink_action_set_property( GObject* obj, guint propId, const GValue *value, G } } -#include +#include static GtkWidget* ink_action_create_menu_item( GtkAction* action ) { diff --git a/src/ink-action.h b/src/ink-action.h index 7b48d40af..c957f0f5c 100644 --- a/src/ink-action.h +++ b/src/ink-action.h @@ -3,9 +3,7 @@ #include -#include -#include -#include +#include #include #include "icon-size.h" #include "attributes.h" diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index eaaf62113..49ab343c2 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -26,9 +26,6 @@ #include #include -#include -#include -#include #include "ink-comboboxentry-action.h" diff --git a/src/ink-comboboxentry-action.h b/src/ink-comboboxentry-action.h index 1a83cb053..aade3a89f 100644 --- a/src/ink-comboboxentry-action.h +++ b/src/ink-comboboxentry-action.h @@ -22,8 +22,7 @@ #include #include -#include -#include +#include #define INK_COMBOBOXENTRY_TYPE_ACTION (ink_comboboxentry_action_get_type()) diff --git a/src/inkscape.cpp b/src/inkscape.cpp index b794138ca..e90c44c82 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -40,8 +40,7 @@ using Inkscape::Extension::Internal::PrintWin32; #include #include #include -#include -#include +#include #include #include #include diff --git a/src/inkview.cpp b/src/inkview.cpp index 448aa77f1..173427aae 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -45,11 +45,7 @@ #include #include -#include -#include -#include -#include -#include +#include #include diff --git a/src/interface.h b/src/interface.h index 01732e911..a39769632 100644 --- a/src/interface.h +++ b/src/interface.h @@ -15,7 +15,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "forward.h" #include "sp-item.h" diff --git a/src/io/sys.cpp b/src/io/sys.cpp index e6c512be2..85857c2f0 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "preferences.h" #include "sys.h" diff --git a/src/knot.h b/src/knot.h index 1af2548e1..250165f79 100644 --- a/src/knot.h +++ b/src/knot.h @@ -15,7 +15,7 @@ */ #include -#include +#include #include "forward.h" #include <2geom/point.h> #include "knot-enums.h" diff --git a/src/libgdl/gdl-dock-bar.h b/src/libgdl/gdl-dock-bar.h index 22b99edd4..c6697a47c 100644 --- a/src/libgdl/gdl-dock-bar.h +++ b/src/libgdl/gdl-dock-bar.h @@ -22,7 +22,7 @@ #ifndef __GDL_DOCK_BAR_H__ #define __GDL_DOCK_BAR_H__ -#include +#include #include "libgdl/gdl-dock.h" G_BEGIN_DECLS diff --git a/src/libgdl/gdl-dock-item-grip.c b/src/libgdl/gdl-dock-item-grip.c index 86e7bc14c..6457016de 100644 --- a/src/libgdl/gdl-dock-item-grip.c +++ b/src/libgdl/gdl-dock-item-grip.c @@ -17,9 +17,7 @@ #include "gdl-i18n.h" #include #include -#include -#include -#include +#include #include "gdl-dock-item.h" #include "gdl-dock-item-grip.h" #include "gdl-stock.h" diff --git a/src/libgdl/gdl-dock-item-grip.h b/src/libgdl/gdl-dock-item-grip.h index 377ea1470..495e9381d 100644 --- a/src/libgdl/gdl-dock-item-grip.h +++ b/src/libgdl/gdl-dock-item-grip.h @@ -13,7 +13,7 @@ #ifndef _GDL_DOCK_ITEM_GRIP_H_ #define _GDL_DOCK_ITEM_GRIP_H_ -#include +#include #include "libgdl/gdl-dock-item.h" G_BEGIN_DECLS diff --git a/src/libgdl/gdl-dock-master.h b/src/libgdl/gdl-dock-master.h index 72697b484..1a10405b6 100644 --- a/src/libgdl/gdl-dock-master.h +++ b/src/libgdl/gdl-dock-master.h @@ -25,7 +25,7 @@ #define __GDL_DOCK_MASTER_H__ #include -#include +#include #include "libgdl/gdl-dock-object.h" diff --git a/src/libgdl/gdl-dock-object.h b/src/libgdl/gdl-dock-object.h index 84e5eb9a7..684bd043f 100644 --- a/src/libgdl/gdl-dock-object.h +++ b/src/libgdl/gdl-dock-object.h @@ -24,7 +24,7 @@ #ifndef __GDL_DOCK_OBJECT_H__ #define __GDL_DOCK_OBJECT_H__ -#include +#include G_BEGIN_DECLS diff --git a/src/libgdl/gdl-dock-paned.c b/src/libgdl/gdl-dock-paned.c index 268a9f673..70273c886 100644 --- a/src/libgdl/gdl-dock-paned.c +++ b/src/libgdl/gdl-dock-paned.c @@ -27,8 +27,7 @@ #include "gdl-i18n.h" #include -#include -#include +#include #include "gdl-tools.h" #include "gdl-dock-paned.h" diff --git a/src/libgdl/gdl-stock.c b/src/libgdl/gdl-stock.c index 94f825678..dc86e523b 100644 --- a/src/libgdl/gdl-stock.c +++ b/src/libgdl/gdl-stock.c @@ -24,7 +24,6 @@ #endif #include -#include #include "gdl-stock.h" #include "gdl-stock-icons.h" diff --git a/src/libgdl/gdl-switcher.c b/src/libgdl/gdl-switcher.c index 43768bbdf..c5e139e70 100644 --- a/src/libgdl/gdl-switcher.c +++ b/src/libgdl/gdl-switcher.c @@ -35,10 +35,6 @@ #include "libgdltypebuiltins.h" #include -#include -#include -#include -#include #if HAVE_GNOME #include diff --git a/src/libgdl/gdl-switcher.h b/src/libgdl/gdl-switcher.h index be4b179bf..9c33f8bbf 100644 --- a/src/libgdl/gdl-switcher.h +++ b/src/libgdl/gdl-switcher.h @@ -25,7 +25,7 @@ #ifndef _GDL_SWITCHER_H_ #define _GDL_SWITCHER_H_ -#include +#include G_BEGIN_DECLS diff --git a/src/libgdl/gdl-tools.h b/src/libgdl/gdl-tools.h index 32c2e4a41..0cfc9fb95 100644 --- a/src/libgdl/gdl-tools.h +++ b/src/libgdl/gdl-tools.h @@ -25,7 +25,7 @@ #define __GDL_TOOLS_H__ #include -#include +#include /* FIXME: Toggle this */ diff --git a/src/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp index d16c6457d..45bc0c89b 100644 --- a/src/libnrtype/Layout-TNG-Input.cpp +++ b/src/libnrtype/Layout-TNG-Input.cpp @@ -11,7 +11,7 @@ #define PANGO_ENABLE_ENGINE -#include +#include #include "Layout-TNG.h" #include "style.h" #include "svg/svg-length.h" diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index d652dfd0c..bd9748fd6 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -15,7 +15,7 @@ #include "ui/widget/point.h" #include "widgets/icon.h" -#include +#include #include "selection-chemistry.h" #include "xml/repr.h" #include "desktop.h" diff --git a/src/main.cpp b/src/main.cpp index ac0994be6..657e4c07e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ // This has to be included prior to anything that includes setjmp.h, it croaks otherwise #include -#include +#include #ifdef HAVE_IEEEFP_H #include @@ -51,10 +51,6 @@ #include #include #include -#include -#include -#include -#include #include "gc-core.h" diff --git a/src/modifier-fns.h b/src/modifier-fns.h index 8d78455e1..c1b35e948 100644 --- a/src/modifier-fns.h +++ b/src/modifier-fns.h @@ -11,7 +11,7 @@ * Hereby placed in public domain. */ -#include +#include #include inline bool diff --git a/src/select-context.h b/src/select-context.h index 377e07275..6d12558ca 100644 --- a/src/select-context.h +++ b/src/select-context.h @@ -13,7 +13,7 @@ */ #include "event-context.h" -#include +#include #define SP_TYPE_SELECT_CONTEXT (sp_select_context_get_type ()) #define SP_SELECT_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_SELECT_CONTEXT, SPSelectContext)) diff --git a/src/seltrans-handles.h b/src/seltrans-handles.h index f796a1007..53dbd3cda 100644 --- a/src/seltrans-handles.h +++ b/src/seltrans-handles.h @@ -14,7 +14,7 @@ #include "display/sodipodi-ctrl.h" #include <2geom/forward.h> -#include +#include namespace Inkscape { diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index d647d30b3..fe1d31331 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/src/sp-gradient.h b/src/sp-gradient.h index 2adb085c1..217b9f3ee 100644 --- a/src/sp-gradient.h +++ b/src/sp-gradient.h @@ -17,7 +17,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include #include "libnr/nr-matrix.h" #include "sp-paint-server.h" diff --git a/src/sp-pattern.h b/src/sp-pattern.h index fa0541698..141474277 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -13,7 +13,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "forward.h" #include "sp-item.h" diff --git a/src/spiral-context.h b/src/spiral-context.h index 29a5f41b2..906cf61df 100644 --- a/src/spiral-context.h +++ b/src/spiral-context.h @@ -15,7 +15,7 @@ * Released under GNU GPL */ -#include +#include #include #include #include "event-context.h" diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp index 777c1b496..da5ad068f 100644 --- a/src/svg-view-widget.cpp +++ b/src/svg-view-widget.cpp @@ -14,7 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "display/sp-canvas.h" #include "display/sp-canvas-group.h" #include "display/canvas-arena.h" diff --git a/src/text-context.cpp b/src/text-context.cpp index 5af2c5ebc..a7c6772e5 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -18,11 +18,10 @@ #endif #include -#include +#include #include #include #include -#include #include #include "macros.h" diff --git a/src/text-context.h b/src/text-context.h index ec1710da3..b7d1b8e69 100644 --- a/src/text-context.h +++ b/src/text-context.h @@ -17,7 +17,7 @@ /* #include */ #include #include -#include +#include #include "event-context.h" #include <2geom/point.h> diff --git a/src/ui/context-menu.cpp b/src/ui/context-menu.cpp index 05fe9a459..72e5ee63b 100644 --- a/src/ui/context-menu.cpp +++ b/src/ui/context-menu.cpp @@ -42,7 +42,7 @@ sp_object_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu) /* Implementation */ -#include +#include #include diff --git a/src/ui/context-menu.h b/src/ui/context-menu.h index 36846edc3..1f8208ebe 100644 --- a/src/ui/context-menu.h +++ b/src/ui/context-menu.h @@ -11,7 +11,7 @@ * This code is in public domain */ -#include +#include #include "forward.h" #include "sp-object.h" diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index 9f163c00c..da8393fc5 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "color-item.h" diff --git a/src/ui/dialog/extensions.cpp b/src/ui/dialog/extensions.cpp index 3c778affe..27cd15e8c 100644 --- a/src/ui/dialog/extensions.cpp +++ b/src/ui/dialog/extensions.cpp @@ -9,7 +9,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include //for GTK_RESPONSE* types +#include //for GTK_RESPONSE* types #include #include "extension/db.h" diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index af607c124..1598a04d3 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -35,11 +35,7 @@ //Temporary ugly hack //Remove this after the get_filter() calls in //show() on both classes are fixed -#include - -//Another hack -#include -#include +#include //Inkscape includes #include "extension/input.h" diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 8eef5d89b..fc0912539 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -22,9 +22,7 @@ #include #include -#include -#include -#include +#include #include "glyphs.h" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 28c59c321..ad3553b86 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include "preferences.h" #include "inkscape-preferences.h" diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 0eca5bbca..94ecf968a 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -13,8 +13,7 @@ # include #endif -#include -#include +#include #include #include #include diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 85aefade8..a7dfaa5cd 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -33,11 +33,9 @@ //Temporary ugly hack //Remove this after the get_filter() calls in //show() on both classes are fixed -#include +#include //Another hack -#include -#include #ifdef WITH_GNOME_VFS #include // gnome_vfs_initialized #include diff --git a/src/ui/dialog/print.h b/src/ui/dialog/print.h index cc27955cb..0184bc783 100644 --- a/src/ui/dialog/print.h +++ b/src/ui/dialog/print.h @@ -13,7 +13,7 @@ #include #include // GtkMM -#include // Gtk +#include // Gtk #include "desktop.h" #include "sp-item.h" diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 935fe9806..bebf14984 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -17,11 +17,7 @@ #include #include -#include //for GTK_RESPONSE* types -#include -#include -#include -#include +#include //for GTK_RESPONSE* types #include #include #include diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 3510503d3..ae17214bf 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -18,8 +18,7 @@ # include #endif -#include //for GTK_RESPONSE* types -#include +#include //for GTK_RESPONSE* types #include #include diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index 083cd0077..7fb172531 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -19,7 +19,7 @@ #include "ui/widget/spinbutton.h" #include -#include //for GTK_RESPONSE* types +#include //for GTK_RESPONSE* types #include #include "desktop.h" diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index e6f113e48..4c3446a51 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -14,7 +14,7 @@ #endif #include -#include +#include #include #include diff --git a/src/ui/view/view-widget.h b/src/ui/view/view-widget.h index 9b5e9c4a8..7bdbdefb1 100644 --- a/src/ui/view/view-widget.h +++ b/src/ui/view/view-widget.h @@ -14,7 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include namespace Inkscape { namespace UI { diff --git a/src/ui/view/view.h b/src/ui/view/view.h index e6853555f..13499a2e4 100644 --- a/src/ui/view/view.h +++ b/src/ui/view/view.h @@ -14,7 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include #include #include "message.h" diff --git a/src/ui/widget/combo-text.cpp b/src/ui/widget/combo-text.cpp index 7706f7c29..43428adb8 100644 --- a/src/ui/widget/combo-text.cpp +++ b/src/ui/widget/combo-text.cpp @@ -23,7 +23,7 @@ #endif #include "combo-text.h" -#include +#include ComboText::ComboText() : Gtk::ComboBox() diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index b3c8ce376..3e0c27587 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -22,7 +22,7 @@ #include // for Gtk::RESPONSE_* #include -#include +#include #include "panel.h" #include "icon-size.h" diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 50476dc65..ae8cd564e 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -14,7 +14,7 @@ # include #endif -#include +#include #include "selected-style.h" diff --git a/src/ui/widget/toolbox.cpp b/src/ui/widget/toolbox.cpp index e90a58b6e..5e5f43263 100644 --- a/src/ui/widget/toolbox.cpp +++ b/src/ui/widget/toolbox.cpp @@ -14,7 +14,7 @@ #endif #include -#include +#include #include "ui/widget/toolbox.h" #include "path-prefix.h" diff --git a/src/verbs.cpp b/src/verbs.cpp index 4dbe15a03..de935f700 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -29,7 +29,7 @@ #endif #include -#include +#include #include #include #include diff --git a/src/widgets/button.h b/src/widgets/button.h index f14af94d1..26191f524 100644 --- a/src/widgets/button.h +++ b/src/widgets/button.h @@ -16,9 +16,7 @@ #define SP_BUTTON(o) (GTK_CHECK_CAST ((o), SP_TYPE_BUTTON, SPButton)) #define SP_IS_BUTTON(o) (GTK_CHECK_TYPE ((o), SP_TYPE_BUTTON)) -#include -#include -#include +#include #include "helper/action.h" #include "icon-size.h" diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 53d9dd1bc..c045d6e28 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -12,8 +12,7 @@ * ? -2004 */ -#include -#include +#include #include "libnr/nr-point.h" #include "forward.h" diff --git a/src/widgets/eek-preview.h b/src/widgets/eek-preview.h index 49fe8e660..c15f25eb6 100644 --- a/src/widgets/eek-preview.h +++ b/src/widgets/eek-preview.h @@ -40,8 +40,8 @@ #ifndef SEEN_EEK_PREVIEW_H #define SEEN_EEK_PREVIEW_H -#include -#include +#include +#include G_BEGIN_DECLS diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index b4272a3a4..c6e97666a 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include "desktop.h" #include "selection.h" diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 6cc73e42f..efeaa980c 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -32,13 +32,6 @@ #include <2geom/transforms.h> #include -#include -#include -#include -#include -#include -#include -#include #include "../display/nr-plain-stuff-gdk.h" #include diff --git a/src/widgets/font-selector.h b/src/widgets/font-selector.h index 6ab2a1a12..61e607ac7 100644 --- a/src/widgets/font-selector.h +++ b/src/widgets/font-selector.h @@ -28,7 +28,7 @@ struct SPFontPreview; #define SP_IS_FONT_PREVIEW(o) (GTK_CHECK_TYPE ((o), SP_TYPE_FONT_PREVIEW)) #include -#include +#include /* SPFontSelector */ diff --git a/src/widgets/gradient-image.h b/src/widgets/gradient-image.h index 7b3854a02..a998dcff3 100644 --- a/src/widgets/gradient-image.h +++ b/src/widgets/gradient-image.h @@ -13,7 +13,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "../libnr/nr-matrix.h" class SPGradient; diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index f7a981c9f..6327e2ff2 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -16,11 +16,7 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include -#include -#include -#include -#include +#include #include "document.h" #include "../document-private.h" diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h index 860804ec6..9abbc57af 100644 --- a/src/widgets/gradient-selector.h +++ b/src/widgets/gradient-selector.h @@ -16,7 +16,7 @@ */ #include -#include +#include #include #include "sp-gradient.h" #include "sp-gradient-spread.h" diff --git a/src/widgets/gradient-toolbar.h b/src/widgets/gradient-toolbar.h index 41138724a..f1e258f6b 100644 --- a/src/widgets/gradient-toolbar.h +++ b/src/widgets/gradient-toolbar.h @@ -12,7 +12,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include struct SPDesktop; GtkWidget *sp_gradient_toolbox_new (SPDesktop *desktop); diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index 012d4e9a3..ac40aded0 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "../forward.h" #define SP_TYPE_GRADIENT_VECTOR_SELECTOR (sp_gradient_vector_selector_get_type ()) diff --git a/src/widgets/icon.h b/src/widgets/icon.h index a20fad73a..371f6ba87 100644 --- a/src/widgets/icon.h +++ b/src/widgets/icon.h @@ -22,7 +22,7 @@ #define SP_ICON(o) (GTK_CHECK_CAST ((o), SP_TYPE_ICON, SPIcon)) #define SP_IS_ICON(o) (GTK_CHECK_TYPE ((o), SP_TYPE_ICON)) -#include +#include struct SPIconClass { GtkWidgetClass parent_class; diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index f0b55cf13..610930a46 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -23,14 +23,7 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include "../sp-pattern.h" #include diff --git a/src/widgets/paint-selector.h b/src/widgets/paint-selector.h index f3aff5a68..eb3eb2008 100644 --- a/src/widgets/paint-selector.h +++ b/src/widgets/paint-selector.h @@ -27,7 +27,7 @@ class SPGradient; #define SP_IS_PAINT_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_PAINT_SELECTOR)) #define SP_IS_PAINT_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_PAINT_SELECTOR)) -#include +#include #include "../forward.h" #include diff --git a/src/widgets/ruler.h b/src/widgets/ruler.h index 7a3509325..fed3caaf0 100644 --- a/src/widgets/ruler.h +++ b/src/widgets/ruler.h @@ -13,7 +13,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include "sp-metric.h" #include #include diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index e08b4ac61..108fae1ef 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -17,7 +17,6 @@ #endif #include -#include #include "widgets/button.h" #include "widgets/spw-utilities.h" diff --git a/src/widgets/select-toolbar.h b/src/widgets/select-toolbar.h index dbab1975a..a4c42880f 100644 --- a/src/widgets/select-toolbar.h +++ b/src/widgets/select-toolbar.h @@ -14,8 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include +#include struct SPDesktop; void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); diff --git a/src/widgets/shrink-wrap-button.cpp b/src/widgets/shrink-wrap-button.cpp index d73f972d9..e0c9e3cd1 100644 --- a/src/widgets/shrink-wrap-button.cpp +++ b/src/widgets/shrink-wrap-button.cpp @@ -10,7 +10,7 @@ */ #include -#include +#include namespace Inkscape { namespace Widgets { diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp index a64a03f4e..66ccb27f2 100644 --- a/src/widgets/sp-attribute-widget.cpp +++ b/src/widgets/sp-attribute-widget.cpp @@ -9,8 +9,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include +#include #include "xml/repr.h" #include "macros.h" #include "document.h" diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index 617c5b012..647ebd6d8 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -42,8 +42,7 @@ struct SPAttributeWidgetClass; struct SPAttributeTable; struct SPAttributeTableClass; -#include -#include +#include #include diff --git a/src/widgets/sp-color-gtkselector.h b/src/widgets/sp-color-gtkselector.h index b9b2b0862..a85d94a5b 100644 --- a/src/widgets/sp-color-gtkselector.h +++ b/src/widgets/sp-color-gtkselector.h @@ -1,7 +1,7 @@ #ifndef SEEN_SP_COLOR_GTKSELECTOR_H #define SEEN_SP_COLOR_GTKSELECTOR_H -#include +#include #include "../color.h" #include "sp-color-selector.h" diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 12467041c..bf738df9a 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -2,12 +2,7 @@ # include "config.h" #endif #include -#include #include -#include -#include -#include -#include #include #include "../dialogs/dialog-events.h" #include "sp-color-icc-selector.h" diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index 9fd80c04a..f40d93189 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -2,8 +2,7 @@ #define SEEN_SP_COLOR_ICC_SELECTOR_H #include -#include -#include +#include #include "../color.h" #include "sp-color-slider.h" diff --git a/src/widgets/sp-color-notebook.h b/src/widgets/sp-color-notebook.h index 0b9b2ed87..b17612e03 100644 --- a/src/widgets/sp-color-notebook.h +++ b/src/widgets/sp-color-notebook.h @@ -12,9 +12,7 @@ * This code is in public domain */ -#include -#include -#include +#include #include "../color.h" #include "sp-color-selector.h" diff --git a/src/widgets/sp-color-preview.h b/src/widgets/sp-color-preview.h index 32572e915..731aceb70 100644 --- a/src/widgets/sp-color-preview.h +++ b/src/widgets/sp-color-preview.h @@ -13,7 +13,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +#include #include diff --git a/src/widgets/sp-color-scales.h b/src/widgets/sp-color-scales.h index 21a85a08e..b50c386e8 100644 --- a/src/widgets/sp-color-scales.h +++ b/src/widgets/sp-color-scales.h @@ -2,8 +2,7 @@ #define SEEN_SP_COLOR_SCALES_H #include -#include -#include +#include #include #include diff --git a/src/widgets/sp-color-selector.h b/src/widgets/sp-color-selector.h index 3b35140ed..2030d02ff 100644 --- a/src/widgets/sp-color-selector.h +++ b/src/widgets/sp-color-selector.h @@ -1,7 +1,7 @@ #ifndef SEEN_SP_COLOR_SELECTOR_H #define SEEN_SP_COLOR_SELECTOR_H -#include +#include #include "../color.h" #include diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index 0690caaab..09d2a87ab 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -10,8 +10,7 @@ * This code is in public domain */ -#include -#include +#include #include "sp-color-scales.h" #include "preferences.h" diff --git a/src/widgets/sp-color-slider.h b/src/widgets/sp-color-slider.h index bdeb3e4b6..8b0bcb9a9 100644 --- a/src/widgets/sp-color-slider.h +++ b/src/widgets/sp-color-slider.h @@ -12,7 +12,7 @@ * This code is in public domain */ -#include +#include #include diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 784dd23ad..147c91525 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -2,10 +2,7 @@ # include "config.h" #endif #include -#include -#include -#include -#include +#include #include #include "../dialogs/dialog-events.h" #include "sp-color-wheel-selector.h" diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h index 34a5f4cd0..6c8d2d12b 100644 --- a/src/widgets/sp-color-wheel-selector.h +++ b/src/widgets/sp-color-wheel-selector.h @@ -2,8 +2,7 @@ #define SEEN_SP_COLOR_WHEEL_SELECTOR_H #include -#include -#include +#include #include "../color.h" #include "sp-color-slider.h" diff --git a/src/widgets/sp-widget.h b/src/widgets/sp-widget.h index e9f9cfe73..ba6baf972 100644 --- a/src/widgets/sp-widget.h +++ b/src/widgets/sp-widget.h @@ -21,7 +21,7 @@ #define SP_IS_WIDGET(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_WIDGET)) #define SP_IS_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_WIDGET)) -#include +#include namespace Inkscape { class Application; diff --git a/src/widgets/sp-xmlview-attr-list.h b/src/widgets/sp-xmlview-attr-list.h index 8e7b844d0..b437cabf0 100644 --- a/src/widgets/sp-xmlview-attr-list.h +++ b/src/widgets/sp-xmlview-attr-list.h @@ -13,7 +13,6 @@ */ #include -#include #include #include "../xml/repr.h" diff --git a/src/widgets/sp-xmlview-content.h b/src/widgets/sp-xmlview-content.h index 3077b2251..7f8a6d3ef 100644 --- a/src/widgets/sp-xmlview-content.h +++ b/src/widgets/sp-xmlview-content.h @@ -16,7 +16,7 @@ #include -#include +#include #include "../xml/repr.h" #include diff --git a/src/widgets/sp-xmlview-tree.h b/src/widgets/sp-xmlview-tree.h index a5dadbb61..89f4af547 100644 --- a/src/widgets/sp-xmlview-tree.h +++ b/src/widgets/sp-xmlview-tree.h @@ -12,7 +12,7 @@ * Released under the GNU GPL; see COPYING for details */ -#include +#include #include "../xml/repr.h" #include diff --git a/src/widgets/spinbutton-events.h b/src/widgets/spinbutton-events.h index 683748d0a..46652a346 100644 --- a/src/widgets/spinbutton-events.h +++ b/src/widgets/spinbutton-events.h @@ -10,8 +10,7 @@ */ #include -#include /* GtkWidget */ -#include /* GtkObject */ +#include /* GtkWidget */ gboolean spinbutton_focus_in (GtkWidget *w, GdkEventKey *event, gpointer data); void spinbutton_undo (GtkWidget *w); diff --git a/src/widgets/spw-utilities.h b/src/widgets/spw-utilities.h index 9a387454f..443831353 100644 --- a/src/widgets/spw-utilities.h +++ b/src/widgets/spw-utilities.h @@ -19,7 +19,7 @@ */ #include -#include /* GtkWidget */ +#include /* GtkWidget */ #include namespace Gtk { diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h index a25705536..0f3ce83c5 100644 --- a/src/widgets/toolbox.h +++ b/src/widgets/toolbox.h @@ -15,8 +15,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include +#include #include #include "forward.h" -- cgit v1.2.3 From 3638efba5bec8a6afc9211aa6bbe289767d20b38 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 3 Jun 2011 19:45:55 -0700 Subject: Removed outdated/unsafe SP_DOCUMENT_DEFS macro and reduced usage of SP_ROOT() gtk type function/macro. (bzr r10254) --- src/box3d-context.cpp | 2 +- src/box3d-side.cpp | 2 +- src/desktop.cpp | 4 +- src/dialogs/clonetiler.cpp | 1 + src/dialogs/export.cpp | 7 +-- src/dialogs/find.cpp | 1 + src/dialogs/spellcheck.cpp | 1 + src/document-private.h | 2 - src/document.cpp | 62 ++++++++++++------------- src/document.h | 15 +++++- src/extension/internal/cairo-renderer.cpp | 11 ++--- src/extension/internal/filter/filter.cpp | 2 +- src/extension/internal/javafx-out.cpp | 6 +-- src/extension/internal/latex-text-renderer.cpp | 9 ++-- src/extension/internal/latex-text-renderer.h | 3 +- src/extension/internal/pdfinput/svg-builder.cpp | 10 ++-- src/extension/internal/pov-out.cpp | 3 +- src/extension/internal/svg.cpp | 1 + src/extension/param/parameter.cpp | 2 +- src/extension/patheffect.cpp | 2 +- src/file.cpp | 6 +-- src/filter-chemistry.cpp | 8 ++-- src/forward.h | 6 --- src/gradient-chemistry.cpp | 8 ++-- src/helper/stock-items.cpp | 8 ++-- src/id-clash.cpp | 1 + src/live_effects/effect.cpp | 2 +- src/live_effects/lpeobject.cpp | 2 +- src/main.cpp | 2 +- src/marker.cpp | 2 +- src/object-snapper.cpp | 1 + src/persp3d.cpp | 6 +-- src/rdf.cpp | 7 ++- src/selection-chemistry.cpp | 2 +- src/sp-clippath.cpp | 2 +- src/sp-item-group.cpp | 5 +- src/sp-mask.cpp | 2 +- src/sp-metadata.cpp | 3 +- src/sp-namedview.cpp | 5 +- src/sp-object-repr.cpp | 8 +--- src/sp-object-repr.h | 5 +- src/sp-object.cpp | 4 +- src/sp-pattern.cpp | 4 +- src/sp-root.h | 2 + src/ui/clipboard.cpp | 6 +-- src/ui/dialog/align-and-distribute.cpp | 3 +- src/ui/dialog/document-properties.cpp | 12 ++--- src/ui/dialog/find.cpp | 1 + src/ui/dialog/layers.cpp | 7 +-- src/ui/dialog/svg-fonts-dialog.cpp | 4 +- src/ui/dialog/swatches.cpp | 4 +- src/ui/widget/entity-entry.cpp | 9 ++-- src/ui/widget/page-sizer.cpp | 2 +- src/widgets/desktop-widget.cpp | 6 +-- src/widgets/gradient-selector.cpp | 2 +- src/widgets/gradient-toolbar.cpp | 4 +- src/widgets/gradient-vector.cpp | 4 +- src/widgets/stroke-style.cpp | 2 +- 58 files changed, 166 insertions(+), 147 deletions(-) (limited to 'src') diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index f23e4d883..90f1707b9 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -190,7 +190,7 @@ static void sp_box3d_context_selection_changed(Inkscape::Selection *selection, g * circumstances, after 'vacuum defs' or when a pre-0.46 file is opened). */ static void sp_box3d_context_ensure_persp_in_defs(SPDocument *document) { - SPDefs *defs = reinterpret_cast(SP_DOCUMENT_DEFS(document)); + SPDefs *defs = document->getDefs(); bool has_persp = false; for ( SPObject *child = defs->firstChild(); child; child = child->getNext() ) { diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index 0c74a8f7e..fdbe33222 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -217,7 +217,7 @@ void box3d_side_set_shape (SPShape *shape) { Box3DSide *side = SP_BOX3D_SIDE (shape); - if (!side->document->root) { + if (!side->document->getRoot()) { // avoid a warning caused by sp_document_height() (which is called from sp_item_i2d_affine() below) // when reading a file containing 3D boxes return; diff --git a/src/desktop.cpp b/src/desktop.cpp index 361ed7fea..cfd3dddd0 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -93,6 +93,8 @@ #include "widgets/desktop-widget.h" #include "box3d-context.h" #include "desktop-style.h" +#include "sp-item-group.h" +#include "sp-root.h" // TODO those includes are only for node tool quick zoom. Remove them after fixing it. #include "ui/tool/node-tool.h" @@ -713,7 +715,7 @@ SPDesktop::set_coordinate_status (Geom::Point p) { SPItem *SPDesktop::getItemFromListAtPointBottom(const GSList *list, Geom::Point const p) const { g_return_val_if_fail (doc() != NULL, NULL); - return SPDocument::getItemFromListAtPointBottom(dkey, SP_GROUP (doc()->root), list, p); + return SPDocument::getItemFromListAtPointBottom(dkey, doc()->getRoot(), list, p); } /** diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 40b5f601e..7ad0eaa14 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -46,6 +46,7 @@ #include "../verbs.h" #include "widgets/icon.h" #include "xml/repr.h" +#include "sp-root.h" using Inkscape::DocumentUndo; diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index b05f6589a..4c1ad4af1 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -54,6 +54,7 @@ #include "preferences.h" #include "verbs.h" #include "interface.h" +#include "sp-root.h" #include "extension/output.h" #include "extension/db.h" @@ -784,7 +785,7 @@ sp_export_selection_modified ( Inkscape::Application */*inkscape*/, if ( SP_ACTIVE_DESKTOP ) { SPDocument *doc; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); - Geom::OptRect bbox = SP_ITEM(doc->root)->getBboxDesktop(SPItem::RENDERING_BBOX); + Geom::OptRect bbox = doc->getRoot()->getBboxDesktop(SPItem::RENDERING_BBOX); if (bbox) { sp_export_set_area (base, bbox->min()[Geom::X], bbox->min()[Geom::Y], @@ -865,7 +866,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) /** \todo * This returns wrong values if the document has a viewBox. */ - bbox = SP_ITEM(doc->root)->getBboxDesktop(SPItem::RENDERING_BBOX); + bbox = doc->getRoot()->getBboxDesktop(SPItem::RENDERING_BBOX); /* If the drawing is valid, then we'll use it and break otherwise we drop through to the page settings */ if (bbox) { @@ -1501,7 +1502,7 @@ sp_export_detect_size(GtkObject * base) { case SELECTION_DRAWING: { SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); - Geom::OptRect bbox = SP_ITEM(doc->root)->getBboxDesktop(SPItem::RENDERING_BBOX); + Geom::OptRect bbox = doc->getRoot()->getBboxDesktop(SPItem::RENDERING_BBOX); // std::cout << "Drawing " << bbox2; if ( bbox && sp_export_bbox_equal(*bbox,current_bbox) ) { diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index c112b3531..4d392a316 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -60,6 +60,7 @@ sp_find_dialog(){ #include "../sp-image.h" #include "../sp-offset.h" #include +#include "sp-root.h" #define MIN_ONSCREEN_DISTANCE 50 diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index f72612420..ecdc0e0ca 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -40,6 +40,7 @@ #include "display/canvas-bpath.h" #include "display/curve.h" #include "document-undo.h" +#include "sp-root.h" #ifdef HAVE_ASPELL #include diff --git a/src/document-private.h b/src/document-private.h index d641679ed..c851594c3 100644 --- a/src/document-private.h +++ b/src/document-private.h @@ -29,8 +29,6 @@ // XXX only for testing! #include "console-output-undo-observer.h" -#define SP_DOCUMENT_DEFS(d) ((SPObject *) SP_ROOT(d->getRoot())->defs) - namespace Inkscape { namespace XML { class Event; diff --git a/src/document.cpp b/src/document.cpp index c9b822ce6..22cfa5663 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -214,6 +214,11 @@ SPDocument::~SPDocument() { //delete this->_whiteboard_session_manager; } +SPDefs *SPDocument::getDefs() +{ + return root->defs; +} + Persp3D * SPDocument::getCurrentPersp3D() { // Check if current_persp3d is still valid @@ -243,8 +248,7 @@ SPDocument::setCurrentPersp3D(Persp3D * const persp) { void SPDocument::getPerspectivesInDefs(std::vector &list) const { - SPDefs *defs = SP_ROOT(this->root)->defs; - for (SPObject *i = defs->firstChild(); i; i = i->getNext() ) { + for (SPObject *i = root->defs->firstChild(); i; i = i->getNext() ) { if (SP_IS_PERSP3D(i)) { list.push_back(SP_PERSP3D(i)); } @@ -348,7 +352,7 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, rroot->setAttribute("baseProfile", NULL); // creating namedview - if (!sp_item_group_get_child_by_name((SPGroup *) document->root, NULL, "sodipodi:namedview")) { + if (!sp_item_group_get_child_by_name(document->root, NULL, "sodipodi:namedview")) { // if there's none in the document already, Inkscape::XML::Node *rnew = NULL; @@ -388,13 +392,12 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, Inkscape::GC::release(rnew); } - /* Defs */ - if (!SP_ROOT(document->root)->defs) { - Inkscape::XML::Node *r; - r = rdoc->createElement("svg:defs"); + // Defs + if (!document->root->defs) { + Inkscape::XML::Node *r = rdoc->createElement("svg:defs"); rroot->addChild(r, NULL); Inkscape::GC::release(r); - g_assert(SP_ROOT(document->root)->defs); + g_assert(document->root->defs); } /* Default RDF */ @@ -520,17 +523,15 @@ gdouble SPDocument::getWidth() const g_return_val_if_fail(this->priv != NULL, 0.0); g_return_val_if_fail(this->root != NULL, 0.0); - SPRoot *root = SP_ROOT(this->root); - - if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) - return root->viewBox.x1 - root->viewBox.x0; - return root->width.computed; + gdouble result = root->width.computed; + if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { + result = root->viewBox.x1 - root->viewBox.x0; + } + return result; } void SPDocument::setWidth(gdouble width, const SPUnit *unit) { - SPRoot *root = SP_ROOT(this->root); - if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox= root->viewBox.x1 = root->viewBox.x0 + sp_units_get_pixels (width, *unit); } else { // set to width= @@ -555,8 +556,6 @@ void SPDocument::setWidth(gdouble width, const SPUnit *unit) void SPDocument::setHeight(gdouble height, const SPUnit *unit) { - SPRoot *root = SP_ROOT(this->root); - if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox= root->viewBox.y1 = root->viewBox.y0 + sp_units_get_pixels (height, *unit); } else { // set to height= @@ -584,11 +583,11 @@ gdouble SPDocument::getHeight() const g_return_val_if_fail(this->priv != NULL, 0.0); g_return_val_if_fail(this->root != NULL, 0.0); - SPRoot *root = SP_ROOT(this->root); - - if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) - return root->viewBox.y1 - root->viewBox.y0; - return root->height.computed; + gdouble result = root->height.computed; + if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { + result = root->viewBox.y1 - root->viewBox.y0; + } + return result; } Geom::Point SPDocument::getDimensions() const @@ -649,7 +648,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) Geom::Translate const tr( Geom::Point(0, old_height - rect_with_margins.height()) - to_2geom(rect_with_margins.min())); - SP_GROUP(root)->translateChildItems(tr); + root->translateChildItems(tr); if(nv) { Geom::Translate tr2(-rect_with_margins.min()); @@ -922,17 +921,16 @@ void SPDocument::requestModified() } } -void -sp_document_setup_viewport (SPDocument *doc, SPItemCtx *ctx) +void SPDocument::setupViewport(SPItemCtx *ctx) { ctx->ctx.flags = 0; ctx->i2doc = Geom::identity(); - /* Set up viewport in case svg has it defined as percentages */ - if (SP_ROOT(doc->root)->viewBox_set) { // if set, take from viewBox - ctx->vp.x0 = SP_ROOT(doc->root)->viewBox.x0; - ctx->vp.y0 = SP_ROOT(doc->root)->viewBox.y0; - ctx->vp.x1 = SP_ROOT(doc->root)->viewBox.x1; - ctx->vp.y1 = SP_ROOT(doc->root)->viewBox.y1; + // Set up viewport in case svg has it defined as percentages + if (root->viewBox_set) { // if set, take from viewBox + ctx->vp.x0 = root->viewBox.x0; + ctx->vp.y0 = root->viewBox.y0; + ctx->vp.x1 = root->viewBox.x1; + ctx->vp.y1 = root->viewBox.y1; } else { // as a last resort, set size to A4 ctx->vp.x0 = 0.0; ctx->vp.y0 = 0.0; @@ -954,7 +952,7 @@ SPDocument::_updateDocument() if (this->root->uflags || this->root->mflags) { if (this->root->uflags) { SPItemCtx ctx; - sp_document_setup_viewport (this, &ctx); + setupViewport(&ctx); bool saved = DocumentUndo::getUndoSensitive(this); DocumentUndo::setUndoSensitive(this, false); diff --git a/src/document.h b/src/document.h index 2eb5e2e09..e3c70b2c6 100644 --- a/src/document.h +++ b/src/document.h @@ -44,6 +44,7 @@ struct SPDesktop; struct SPItem; struct SPObject; struct SPGroup; +struct SPRoot; namespace Inkscape { struct Application; @@ -57,9 +58,11 @@ namespace Inkscape { } } +class SPDefs; class SP3DBox; class Persp3D; class Persp3DImpl; +class SPItemCtx; namespace Proj { class TransfMat3x4; @@ -72,6 +75,8 @@ class SPDocument : public Inkscape::GC::Managed<>, public Inkscape::GC::Finalized, public Inkscape::GC::Anchored { +// Note: multiple public and private sections is not a good practice, but happens +// in this class as transitional to fixing encapsulation: public: typedef sigc::signal IDChangedSignal; typedef sigc::signal ResourcesChangedSignal; @@ -91,7 +96,9 @@ public: Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document - SPObject *root; ///< Our SPRoot +private: + SPRoot *root; ///< Our SPRoot +public: CRCascade *style_cascade; protected: @@ -122,7 +129,7 @@ public: bool oldSignalsConnected; /** Returns our SPRoot */ - SPObject *getRoot() { return root; } + SPRoot *getRoot() { return root; } Inkscape::XML::Node *getReprRoot() { return rroot; } @@ -141,6 +148,9 @@ public: /** basename(uri) or other human-readable label for the document. */ gchar const* getName() const { return name; } + /** Return the main defs object for the document. */ + SPDefs *getDefs(); + void setCurrentPersp3D(Persp3D * const persp); inline void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; } @@ -248,6 +258,7 @@ public: private: void do_change_uri(gchar const *const filename, bool const rebase); + void setupViewport(SPItemCtx *ctx); }; struct SPUnit; diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index f5504d755..bbafd7e94 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -420,19 +420,18 @@ static void sp_symbol_render(SPItem *item, CairoRenderContext *ctx) ctx->popState(); } -static void sp_root_render(SPItem *item, CairoRenderContext *ctx) +static void sp_root_render(SPRoot *root, CairoRenderContext *ctx) { - SPRoot *root = SP_ROOT(item); CairoRenderer *renderer = ctx->getRenderer(); - if (!ctx->getCurrentState()->has_overflow && item->parent) + if (!ctx->getCurrentState()->has_overflow && root->parent) ctx->addClippingRect(root->x.computed, root->y.computed, root->width.computed, root->height.computed); ctx->pushState(); - renderer->setStateForItem(ctx, item); + renderer->setStateForItem(ctx, root); Geom::Affine tempmat (root->c2p); ctx->transform(&tempmat); - sp_group_render(item, ctx); + sp_group_render(root, ctx); ctx->popState(); } @@ -543,7 +542,7 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) if (SP_IS_ROOT(item)) { TRACE(("root\n")); - return sp_root_render(item, ctx); + return sp_root_render(SP_ROOT(item), ctx); } else if (SP_IS_SYMBOL(item)) { TRACE(("symbol\n")); return sp_symbol_render(item, ctx); diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 715278051..fb8d4de4b 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -133,7 +133,7 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d items.insert >(items.end(), selection->itemList(), NULL); Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc(); - Inkscape::XML::Node * defsrepr = SP_DOCUMENT_DEFS(document->doc())->getRepr(); + Inkscape::XML::Node * defsrepr = document->doc()->getDefs()->getRepr(); for(std::list::iterator item = items.begin(); item != items.end(); item++) { diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 750849eb1..8399d602f 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -38,7 +38,7 @@ #include "helper/geom.h" #include "helper/geom-curves.h" #include - +#include "sp-root.h" #include #include @@ -758,7 +758,7 @@ bool JavaFXOutput::doTree(SPDocument *doc) miny = bignum; maxy = -bignum; - if (!doTreeRecursive(doc, doc->root)) { + if (!doTreeRecursive(doc, doc->getRoot())) { return false; } @@ -875,7 +875,7 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) out(" content: [\n"); idindex = 0; - doBody(doc, doc->root); + doBody(doc, doc->getRoot()); if (!doTail()) { return false; diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 98142632d..cf7c48251 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -542,13 +542,10 @@ Flowing in rectangle is possible, not in arb shape. fprintf(_stream, "%s", os.str().c_str()); } -void -LaTeXTextRenderer::sp_root_render(SPItem *item) +void LaTeXTextRenderer::sp_root_render(SPRoot *root) { - SPRoot *root = SP_ROOT(item); - push_transform(root->c2p); - sp_group_render(item); + sp_group_render(root); pop_transform(); } @@ -561,7 +558,7 @@ LaTeXTextRenderer::sp_item_invoke_render(SPItem *item) } if (SP_IS_ROOT(item)) { - return sp_root_render(item); + return sp_root_render(SP_ROOT(item)); } else if (SP_IS_GROUP(item)) { return sp_group_render(item); } else if (SP_IS_USE(item)) { diff --git a/src/extension/internal/latex-text-renderer.h b/src/extension/internal/latex-text-renderer.h index 2259427d6..66055a3bc 100644 --- a/src/extension/internal/latex-text-renderer.h +++ b/src/extension/internal/latex-text-renderer.h @@ -22,6 +22,7 @@ #include class SPItem; +struct SPRoot; namespace Inkscape { namespace Extension { @@ -60,7 +61,7 @@ protected: void writePostamble(); void sp_item_invoke_render(SPItem *item); - void sp_root_render(SPItem *item); + void sp_root_render(SPRoot *item); void sp_group_render(SPItem *item); void sp_use_render(SPItem *item); void sp_text_render(SPItem *item); diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 94edf826e..dc995b7aa 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -531,7 +531,7 @@ void SvgBuilder::setClipPath(GfxState *state, bool even_odd) { clip_path->appendChild(path); Inkscape::GC::release(path); // Append clipPath to defs and get id - SP_DOCUMENT_DEFS(_doc)->getRepr()->appendChild(clip_path); + _doc->getDefs()->getRepr()->appendChild(clip_path); gchar *urltext = g_strdup_printf ("url(#%s)", clip_path->attribute("id")); Inkscape::GC::release(clip_path); _container->setAttribute("clip-path", urltext); @@ -678,7 +678,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, delete pattern_builder; // Append the pattern to defs - SP_DOCUMENT_DEFS(_doc)->getRepr()->appendChild(pattern_node); + _doc->getDefs()->getRepr()->appendChild(pattern_node); gchar *id = g_strdup(pattern_node->attribute("id")); Inkscape::GC::release(pattern_node); @@ -752,7 +752,7 @@ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for return NULL; } - Inkscape::XML::Node *defs = SP_DOCUMENT_DEFS(_doc)->getRepr(); + Inkscape::XML::Node *defs = _doc->getDefs()->getRepr(); defs->appendChild(gradient); gchar *id = g_strdup(gradient->attribute("id")); Inkscape::GC::release(gradient); @@ -1635,9 +1635,9 @@ Inkscape::XML::Node *SvgBuilder::_createMask(double width, double height) { sp_repr_set_svg_double(mask_node, "height", height); // Append mask to defs if (_is_top_level) { - SP_DOCUMENT_DEFS(_doc)->getRepr()->appendChild(mask_node); + _doc->getDefs()->getRepr()->appendChild(mask_node); Inkscape::GC::release(mask_node); - return SP_DOCUMENT_DEFS(_doc)->getRepr()->lastChild(); + return _doc->getDefs()->getRepr()->lastChild(); } else { // Work around for renderer bug when mask isn't defined in pattern static int mask_count = 0; Inkscape::XML::Node *defs = _root->firstChild(); diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 1563d04c1..382f8cbfb 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -35,6 +35,7 @@ #include "helper/geom.h" #include "helper/geom-curves.h" #include +#include "sp-root.h" #include #include @@ -485,7 +486,7 @@ bool PovOutput::doTree(SPDocument *doc) miny = bignum; maxy = -bignum; - if (!doTreeRecursive(doc, doc->root)) + if (!doTreeRecursive(doc, doc->getRoot())) return false; //## Let's make a union of all of the Shapes diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 946ff22fe..afc706e89 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -24,6 +24,7 @@ #include "extension/output.h" #include #include "xml/attribute-record.h" +#include "sp-root.h" #ifdef WITH_GNOME_VFS # include diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index fb53035a1..455fcc3bb 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -354,7 +354,7 @@ Parameter::new_child (Inkscape::XML::Node * parent) Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc) { Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::XML::Node * defs = SP_DOCUMENT_DEFS(doc)->getRepr(); + Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); Inkscape::XML::Node * params = NULL; GQuark const name_quark = g_quark_from_string("inkscape:extension-params"); diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index 09ee9be0b..6da310d30 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -42,7 +42,7 @@ PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path) return; gchar ** patheffects = g_strsplit(patheffectlist, ";", 128); - Inkscape::XML::Node * defs = SP_DOCUMENT_DEFS(doc)->getRepr(); + Inkscape::XML::Node * defs = doc->getDefs()->getRepr(); for (int i = 0; patheffects[i] != NULL && i < 128; i++) { gchar * patheffect = patheffects[i]; diff --git a/src/file.cpp b/src/file.cpp index a1fc23117..2e7e74610 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -802,7 +802,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extens } else { dialog_title = (char const *) _("Select file to save to"); } - gchar* doc_title = doc->root->title(); + gchar* doc_title = doc->getRoot()->title(); Inkscape::UI::Dialog::FileSaveDialog *saveDialog = Inkscape::UI::Dialog::FileSaveDialog::create( parentWindow, @@ -975,7 +975,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, prevent_id_clashes(doc, in_doc); - SPObject *in_defs = SP_DOCUMENT_DEFS(in_doc); + SPObject *in_defs = in_doc->getDefs(); Inkscape::XML::Node *last_def = in_defs->getRepr()->lastChild(); SPCSSAttr *style = sp_css_attr_from_object(doc->getRoot()); @@ -1051,7 +1051,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // preserve parent and viewBox transformations // c2p is identity matrix at this point unless ensureUpToDate is called doc->ensureUpToDate(); - Geom::Affine affine = SP_ROOT(doc->getRoot())->c2p * SP_ITEM(place_to_insert)->i2doc_affine().inverse(); + Geom::Affine affine = doc->getRoot()->c2p * SP_ITEM(place_to_insert)->i2doc_affine().inverse(); sp_selection_apply_affine(selection, desktop->dt2doc() * affine * desktop->doc2dt(), true, false); // move to mouse pointer diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index b2c5f3020..18a31f0d7 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -90,7 +90,7 @@ SPFilter *new_filter(SPDocument *document) { g_return_val_if_fail(document != NULL, NULL); - SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + SPDefs *defs = document->getDefs(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); @@ -187,7 +187,7 @@ new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion { g_return_val_if_fail(document != NULL, NULL); - SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + SPDefs *defs = document->getDefs(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); @@ -242,7 +242,7 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo { g_return_val_if_fail(document != NULL, NULL); - SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + SPDefs *defs = document->getDefs(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); @@ -356,7 +356,7 @@ SPFilter *modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *it // If there are more users for this filter, duplicate it if (filter->hrefcount > count_filter_hrefs(item, filter)) { Inkscape::XML::Node *repr = item->style->getFilter()->getRepr()->duplicate(xml_doc); - SPDefs *defs = reinterpret_cast(SP_DOCUMENT_DEFS(document)); + SPDefs *defs = document->getDefs(); defs->appendChild(repr); filter = SP_FILTER( document->getObjectByRepr(repr) ); diff --git a/src/forward.h b/src/forward.h index 897f3fe48..352fae6fa 100644 --- a/src/forward.h +++ b/src/forward.h @@ -52,12 +52,6 @@ class SPDocumentClass; class SPGroup; class SPGroupClass; -class SPDefs; -class SPDefsClass; - -class SPRoot; -class SPRootClass; - class SPNamedView; class SPNamedViewClass; diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 86b63855b..889e319b2 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -106,7 +106,7 @@ static SPGradient *sp_gradient_get_private_normalized(SPDocument *document, SPGr g_return_val_if_fail(SP_IS_GRADIENT(vector), NULL); g_return_val_if_fail(vector->hasStops(), NULL); - SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + SPDefs *defs = document->getDefs(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); // create a new private gradient of the requested type @@ -208,7 +208,7 @@ SPGradient *sp_gradient_fork_private_if_necessary(SPGradient *gr, SPGradient *ve } SPDocument *doc = gr->document; - SPObject *defs = SP_DOCUMENT_DEFS(doc); + SPObject *defs = doc->getDefs(); if ((gr->hasStops()) || (gr->state != SP_GRADIENT_STATE_UNKNOWN) || @@ -259,7 +259,7 @@ SPGradient *sp_gradient_fork_vector_if_necessary(SPGradient *gr) Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *repr = gr->getRepr()->duplicate(xml_doc); - SP_DOCUMENT_DEFS(doc)->getRepr()->addChild(repr, NULL); + doc->getDefs()->getRepr()->addChild(repr, NULL); SPGradient *gr_new = (SPGradient *) doc->getObjectByRepr(repr); gr_new = sp_gradient_ensure_vector_normalized (gr_new); Inkscape::GC::release(repr); @@ -1198,7 +1198,7 @@ static void addStop( Inkscape::XML::Node *parent, Glib::ustring const &color, gi */ SPGradient *sp_document_default_gradient_vector( SPDocument *document, SPColor const &color, bool singleStop ) { - SPDefs *defs = static_cast(SP_DOCUMENT_DEFS(document)); + SPDefs *defs = document->getDefs(); Inkscape::XML::Document *xml_doc = document->rdoc; Inkscape::XML::Node *repr = xml_doc->createElement("svg:linearGradient"); diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index 9f3f172ac..96454cf3a 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -69,7 +69,7 @@ static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current /* Get the marker we want */ SPObject *object = doc->getObjectById(name); if (object && SP_IS_MARKER(object)) { - SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(current_doc); + SPDefs *defs = current_doc->getDefs(); Inkscape::XML::Document *xml_doc = current_doc->getReprDoc(); Inkscape::XML::Node *mark_repr = object->getRepr()->duplicate(xml_doc); defs->getRepr()->addChild(mark_repr, NULL); @@ -113,7 +113,7 @@ sp_pattern_load_from_svg(gchar const *name, SPDocument *current_doc) /* Get the pattern we want */ SPObject *object = doc->getObjectById(name); if (object && SP_IS_PATTERN(object)) { - SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(current_doc); + SPDefs *defs = current_doc->getDefs(); Inkscape::XML::Document *xml_doc = current_doc->getReprDoc(); Inkscape::XML::Node *pat_repr = object->getRepr()->duplicate(xml_doc); defs->getRepr()->addChild(pat_repr, NULL); @@ -156,7 +156,7 @@ sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc) /* Get the gradient we want */ SPObject *object = doc->getObjectById(name); if (object && SP_IS_GRADIENT(object)) { - SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(current_doc); + SPDefs *defs = current_doc->getDefs(); Inkscape::XML::Document *xml_doc = current_doc->getReprDoc(); Inkscape::XML::Node *pat_repr = object->getRepr()->duplicate(xml_doc); defs->getRepr()->addChild(pat_repr, NULL); @@ -195,7 +195,7 @@ SPObject *get_stock_item(gchar const *urn) SPDesktop *desktop = inkscape_active_desktop(); SPDocument *doc = sp_desktop_document(desktop); - SPDefs *defs = reinterpret_cast(SP_DOCUMENT_DEFS(doc)); + SPDefs *defs = doc->getDefs(); SPObject *object = NULL; if (!strcmp(base, "marker")) { diff --git a/src/id-clash.cpp b/src/id-clash.cpp index d305b5a9f..d5740c0ba 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -25,6 +25,7 @@ #include "sp-paint-server.h" #include "xml/node.h" #include "xml/repr.h" +#include "sp-root.h" typedef enum { REF_HREF, REF_STYLE, REF_URL, REF_CLIPBOARD } ID_REF_TYPE; diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index ed0d162ac..10abef4a1 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -262,7 +262,7 @@ void Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item) Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect"); repr->setAttribute("effect", name); - SP_DOCUMENT_DEFS(doc)->getRepr()->addChild(repr, NULL); // adds to and assigns the 'id' attribute + doc->getDefs()->getRepr()->addChild(repr, NULL); // adds to and assigns the 'id' attribute const gchar * repr_id = repr->attribute("id"); Inkscape::GC::release(repr); diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 1b5ed1d49..3e4e40198 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -253,7 +253,7 @@ LivePathEffectObject *LivePathEffectObject::fork_private_if_necessary(unsigned i Inkscape::XML::Document *xml_doc = doc->getReprDoc(); Inkscape::XML::Node *dup_repr = this->getRepr()->duplicate(xml_doc); - SP_DOCUMENT_DEFS(doc)->getRepr()->addChild(dup_repr, NULL); + doc->getDefs()->getRepr()->addChild(dup_repr, NULL); LivePathEffectObject *lpeobj_new = LIVEPATHEFFECT( doc->getObjectByRepr(dup_repr) ); Inkscape::GC::release(dup_repr); diff --git a/src/main.cpp b/src/main.cpp index ac0994be6..82a4b28c0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1353,7 +1353,7 @@ sp_do_export_png(SPDocument *doc) } else if (sp_export_area_page || !(sp_export_id || sp_export_area_drawing)) { /* Export the whole page: note: Inkscape uses 'page' in all menus and dialogs, not 'canvas' */ doc->ensureUpToDate(); - Geom::Point origin (SP_ROOT(doc->root)->x.computed, SP_ROOT(doc->root)->y.computed); + Geom::Point origin(doc->getRoot()->x.computed, doc->getRoot()->y.computed); area = Geom::Rect(origin, origin + doc->getDimensions()); } diff --git a/src/marker.cpp b/src/marker.cpp index faffadd58..5dd23fb1e 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -713,7 +713,7 @@ sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destro const gchar *generate_marker(GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Affine /*transform*/, Geom::Affine move) { Inkscape::XML::Document *xml_doc = document->getReprDoc(); - Inkscape::XML::Node *defsrepr = SP_DOCUMENT_DEFS(document)->getRepr(); + Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:marker"); diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 1e2f71c95..682c26869 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -36,6 +36,7 @@ #include "sp-mask.h" #include "helper/geom-curves.h" #include "desktop.h" +#include "sp-root.h" Inkscape::ObjectSnapper::ObjectSnapper(SnapManager *sm, Geom::Coord const d) : Snapper(sm, d) diff --git a/src/persp3d.cpp b/src/persp3d.cpp index d43e6b2c5..0b346622a 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -209,7 +209,7 @@ persp3d_update(SPObject *object, SPCtx *ctx, guint flags) } Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {// if dup is given, copy the attributes over - SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + SPDefs *defs = document->getDefs(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); Inkscape::XML::Node *repr; @@ -253,7 +253,7 @@ Persp3D *persp3d_create_xml_element(SPDocument *document, Persp3DImpl *dup) {// Persp3D *persp3d_document_first_persp(SPDocument *document) { Persp3D *first = 0; - for ( SPObject *child = SP_DOCUMENT_DEFS(document)->firstChild(); child && !first; child = child->getNext() ) { + for ( SPObject *child = document->getDefs()->firstChild(); child && !first; child = child->getNext() ) { if (SP_IS_PERSP3D(child)) { first = SP_PERSP3D(child); } @@ -565,7 +565,7 @@ persp3d_print_debugging_info (Persp3D *persp) { void persp3d_print_debugging_info_all(SPDocument *document) { - for ( SPObject *child = SP_DOCUMENT_DEFS(document)->firstChild(); child; child = child->getNext() ) { + for ( SPObject *child = document->getDefs()->firstChild(); child; child = child->getNext() ) { if (SP_IS_PERSP3D(child)) { persp3d_print_debugging_info(SP_PERSP3D(child)); } diff --git a/src/rdf.cpp b/src/rdf.cpp index c9378cf53..cabbaaed3 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -18,6 +18,7 @@ #include "rdf.h" #include "sp-item-group.h" #include "inkscape.h" +#include "sp-root.h" /* Example RDF XML from various places... @@ -566,7 +567,9 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, // set document's title element to the RDF title if (!strcmp(entity.name, "title")) { SPDocument *doc = SP_ACTIVE_DOCUMENT; - if(doc && doc->root) doc->root->setTitle(text); + if (doc && doc->getRoot()) { + doc->getRoot()->setTitle(text); + } } switch (entity.datatype) { @@ -1104,7 +1107,7 @@ void RDFImpl::setDefaults( SPDocument * doc ) g_assert( doc != NULL ); // Create metadata node if it doesn't already exist - if (!sp_item_group_get_child_by_name((SPGroup *) doc->root, NULL, + if (!sp_item_group_get_child_by_name( doc->getRoot(), NULL, XML_TAG_NAME_METADATA)) { if ( !doc->getReprDoc()) { g_critical("XML doc is null."); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 67aba5218..0f756a9a3 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3234,7 +3234,7 @@ fit_canvas_to_drawing(SPDocument *doc, bool with_margins) g_return_val_if_fail(doc != NULL, false); doc->ensureUpToDate(); - SPItem const *const root = SP_ITEM(doc->root); + SPItem const *const root = doc->getRoot(); Geom::OptRect const bbox(root->getBounds(root->i2d_affine(), SPItem::RENDERING_BBOX)); if (bbox) { doc->fitToRect(*bbox, with_margins); diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index be5b9a4d1..89e140f12 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -357,7 +357,7 @@ sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view) // Create a mask element (using passed elements), add it to const gchar *SPClipPath::create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform) { - Inkscape::XML::Node *defsrepr = SP_DOCUMENT_DEFS(document)->getRepr(); + Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:clipPath"); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index a31961d2e..91342688a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -49,6 +49,7 @@ #include "sp-title.h" #include "sp-desc.h" #include "sp-switch.h" +#include "sp-defs.h" using Inkscape::DocumentUndo; @@ -345,8 +346,8 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) g_return_if_fail (SP_IS_GROUP (group)); SPDocument *doc = group->document; - SPObject *root = doc->getRoot(); - SPObject *defs = SP_OBJECT(SP_ROOT(root)->defs); + SPRoot *root = doc->getRoot(); + SPObject *defs = root->defs; SPItem *gitem = SP_ITEM (group); Inkscape::XML::Node *grepr = gitem->getRepr(); diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index 700efa572..513e52911 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -268,7 +268,7 @@ sp_mask_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML const gchar * sp_mask_create (GSList *reprs, SPDocument *document, Geom::Affine const* applyTransform) { - Inkscape::XML::Node *defsrepr = SP_DOCUMENT_DEFS(document)->getRepr(); + Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:mask"); diff --git a/src/sp-metadata.cpp b/src/sp-metadata.cpp index 21410d4fd..84dc114db 100644 --- a/src/sp-metadata.cpp +++ b/src/sp-metadata.cpp @@ -20,6 +20,7 @@ #include "document.h" #include "sp-item-group.h" +#include "sp-root.h" #define noDEBUG_METADATA #ifdef DEBUG_METADATA @@ -213,7 +214,7 @@ sp_document_metadata (SPDocument *document) g_return_val_if_fail (document != NULL, NULL); - nv = sp_item_group_get_child_by_name ((SPGroup *) document->root, NULL, + nv = sp_item_group_get_child_by_name( document->getRoot(), NULL, "metadata"); g_assert (nv != NULL); diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 001f7731f..1feb644ad 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -34,6 +34,7 @@ #include "preferences.h" #include "desktop.h" #include "conn-avoid-ref.h" // for defaultConnSpacing. +#include "sp-root.h" using Inkscape::DocumentUndo; @@ -1013,7 +1014,7 @@ SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id) { g_return_val_if_fail(document != NULL, NULL); - SPObject *nv = sp_item_group_get_child_by_name((SPGroup *) document->root, NULL, "sodipodi:namedview"); + SPObject *nv = sp_item_group_get_child_by_name(document->getRoot(), NULL, "sodipodi:namedview"); g_assert(nv != NULL); if (id == NULL) { @@ -1021,7 +1022,7 @@ SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id) } while (nv && strcmp(nv->getId(), id)) { - nv = sp_item_group_get_child_by_name((SPGroup *) document->root, nv, "sodipodi:namedview"); + nv = sp_item_group_get_child_by_name(document->getRoot(), nv, "sodipodi:namedview"); } return (SPNamedView *) nv; diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index 475a57521..a995739b1 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -89,11 +89,7 @@ static unsigned const N_NAME_TYPES = SODIPODI_TYPE + 1; static GType name_to_gtype(NameType name_type, gchar const *name); -/** - * Construct an SPRoot and all its descendents from the given repr. - */ -SPObject * -sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) +SPRoot *sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) { g_assert(document != NULL); g_assert(repr != NULL); @@ -108,7 +104,7 @@ sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) g_assert(object != NULL); object->invoke_build(document, repr, FALSE); - return object; + return SP_ROOT(object); } GType diff --git a/src/sp-object-repr.h b/src/sp-object-repr.h index 02ad3ea93..407af0bcc 100644 --- a/src/sp-object-repr.h +++ b/src/sp-object-repr.h @@ -21,7 +21,10 @@ class Node; } -SPObject * sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr); +/** + * Construct an SPRoot and all its descendents from the given repr. + */ +SPRoot *sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr); GType sp_repr_type_lookup (Inkscape::XML::Node *repr); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index c37e48983..e0b3e3201 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -1604,9 +1604,9 @@ gchar const * SPObject::getStyleProperty(gchar const *key, gchar const *def) con */ void SPObject::_requireSVGVersion(Inkscape::Version version) { for ( SPObject::ParentIterator iter=this ; iter ; ++iter ) { - SPObject *object=iter; + SPObject *object = iter; if (SP_IS_ROOT(object)) { - SPRoot *root=SP_ROOT(object); + SPRoot *root = SP_ROOT(object); if ( root->version.svg < version ) { root->version.svg = version; } diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 0b2fe8389..d7522fce8 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -469,7 +469,7 @@ SPPattern *pattern_chain(SPPattern *pattern) { SPDocument *document = pattern->document; Inkscape::XML::Document *xml_doc = document->getReprDoc(); - Inkscape::XML::Node *defsrepr = SP_DOCUMENT_DEFS(document)->getRepr(); + Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern"); repr->setAttribute("inkscape:collect", "always"); @@ -522,7 +522,7 @@ sp_pattern_transform_multiply (SPPattern *pattern, Geom::Affine postmul, bool se const gchar *pattern_tile(GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Affine transform, Geom::Affine move) { Inkscape::XML::Document *xml_doc = document->getReprDoc(); - Inkscape::XML::Node *defsrepr = SP_DOCUMENT_DEFS(document)->getRepr(); + Inkscape::XML::Node *defsrepr = document->getDefs()->getRepr(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:pattern"); repr->setAttribute("patternUnits", "userSpaceOnUse"); diff --git a/src/sp-root.h b/src/sp-root.h index ab379fb50..86b92b2b3 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -25,6 +25,8 @@ #include "enums.h" #include "sp-item-group.h" +class SPDefs; + /** \ element */ struct SPRoot : public SPGroup { struct { diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 4f4f8a022..60379a966 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -894,7 +894,7 @@ void ClipboardManagerImpl::_pasteDefs(SPDesktop *desktop, SPDocument *clipdoc) SPDocument *target_document = sp_desktop_document(desktop); Inkscape::XML::Node *root = clipdoc->getReprRoot(); Inkscape::XML::Node *defs = sp_repr_lookup_name(root, "svg:defs", 1); - Inkscape::XML::Node *target_defs = SP_DOCUMENT_DEFS(target_document)->getRepr(); + Inkscape::XML::Node *target_defs = target_document->getDefs()->getRepr(); Inkscape::XML::Document *target_xmldoc = target_document->getReprDoc(); prevent_id_clashes(clipdoc, target_document); @@ -1197,7 +1197,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) gdouble dpi = PX_PER_IN; guint32 bgcolor = 0x00000000; - Geom::Point origin (SP_ROOT(_clipboardSPDoc->root)->x.computed, SP_ROOT(_clipboardSPDoc->root)->y.computed); + Geom::Point origin (_clipboardSPDoc->getRoot()->x.computed, _clipboardSPDoc->getRoot()->y.computed); Geom::Rect area = Geom::Rect(origin, origin + _clipboardSPDoc->getDimensions()); unsigned long int width = (unsigned long int) (area.width() * dpi / PX_PER_IN + 0.5); @@ -1254,7 +1254,7 @@ void ClipboardManagerImpl::_createInternalClipboard() if ( _clipboardSPDoc == NULL ) { _clipboardSPDoc = SPDocument::createNewDoc(NULL, false, true); //g_assert( _clipboardSPDoc != NULL ); - _defs = SP_DOCUMENT_DEFS(_clipboardSPDoc)->getRepr(); + _defs = _clipboardSPDoc->getDefs()->getRepr(); _doc = _clipboardSPDoc->getReprDoc(); _root = _clipboardSPDoc->getReprRoot(); diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 81e2b64a9..a2169c0b3 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -43,6 +43,7 @@ #include "util/glib-list-iterators.h" #include "verbs.h" #include "widgets/icon.h" +#include "sp-root.h" #include "align-and-distribute.h" @@ -171,7 +172,7 @@ private : case AlignAndDistribute::DRAWING: { - Geom::OptRect b = static_cast( sp_desktop_document(desktop)->getRoot() )->getBboxDesktop(); + Geom::OptRect b = sp_desktop_document(desktop)->getRoot()->getBboxDesktop(); if (b) { mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0c001da4b..b2ca2a3a8 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -145,7 +145,7 @@ DocumentProperties::init() Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->addListener (&_repr_events, this); - Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->root->getRepr(); + Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); root->addListener (&_repr_events, this); show_all_children(); @@ -156,7 +156,7 @@ DocumentProperties::~DocumentProperties() { Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->removeListenerByData (this); - Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->root->getRepr(); + Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr(); root->removeListenerByData (this); } @@ -421,7 +421,7 @@ DocumentProperties::linkSelectedProfile() xml_doc->root()->addChild(defsRepr, NULL); } - g_assert(SP_ROOT(desktop->doc()->root)->defs); + g_assert(desktop->doc()->getDefs()); defsRepr->addChild(cprofRepr, NULL); // TODO check if this next line was sometimes needed. It being there caused an assertion. @@ -877,7 +877,7 @@ DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *docu { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener(&_repr_events, this); - Inkscape::XML::Node *root = document->root->getRepr(); + Inkscape::XML::Node *root = document->getRoot()->getRepr(); root->addListener(&_repr_events, this); update(); } @@ -887,7 +887,7 @@ DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *d { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener(&_repr_events, this); - Inkscape::XML::Node *root = sp_desktop_document(desktop)->root->getRepr(); + Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); root->addListener(&_repr_events, this); update(); } @@ -897,7 +897,7 @@ DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop { Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->removeListenerByData(this); - Inkscape::XML::Node *root = sp_desktop_document(desktop)->root->getRepr(); + Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr(); root->removeListenerByData(this); } diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index bdae14c62..aa6b4081e 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -50,6 +50,7 @@ #include "sp-use.h" #include "sp-image.h" #include "sp-offset.h" +#include "sp-root.h" #include "xml/repr.h" diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 0eca5bbca..30924ab86 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -35,6 +35,7 @@ #include "verbs.h" #include "widgets/icon.h" #include "xml/repr.h" +#include "sp-root.h" #include "layers.h" @@ -293,7 +294,7 @@ bool LayersPanel::_checkForUpdated(const Gtk::TreePath &/*path*/, const Gtk::Tre } void LayersPanel::_selectLayer( SPObject *layer ) { - if ( !layer || (_desktop && _desktop->doc() && (layer == _desktop->doc()->root)) ) { + if ( !layer || (_desktop && _desktop->doc() && (layer == _desktop->doc()->getRoot())) ) { if ( _tree.get_selection()->count_selected_rows() != 0 ) { _tree.get_selection()->unselect_all(); } @@ -328,7 +329,7 @@ void LayersPanel::_layersChanged() // g_message("_layersChanged()"); if (_desktop) { SPDocument* document = _desktop->doc(); - SPObject* root = document->root; + SPRoot* root = document->getRoot(); if ( root ) { _selectedConnection.block(); if ( _desktop->layer_manager && _desktop->layer_manager->includes( root ) ) { @@ -402,7 +403,7 @@ void LayersPanel::_pushTreeSelectionToCurrent() _desktop->layer_manager->setCurrentLayer( inTree ); } } else { - _desktop->layer_manager->setCurrentLayer( _desktop->doc()->root ); + _desktop->layer_manager->setCurrentLayer( _desktop->doc()->getRoot() ); } } } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 4d53154d8..fbca0bf10 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -794,7 +794,7 @@ SPFont *new_font(SPDocument *document) { g_return_val_if_fail(document != NULL, NULL); - SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + SPDefs *defs = document->getDefs(); Inkscape::XML::Document *xml_doc = document->getReprDoc(); @@ -911,7 +911,7 @@ SvgFontsDialog::SvgFontsDialog() _FontsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::fonts_list_button_release)); create_fonts_popup_menu(_FontsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_font)); - _defs_observer.set(SP_DOCUMENT_DEFS(sp_desktop_document(this->getDesktop()))); + _defs_observer.set(sp_desktop_document(this->getDesktop())->getDefs()); _defs_observer.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::update_fonts)); _getContents()->show_all(); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 935fe9806..0f4626126 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -858,8 +858,8 @@ void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document ) docPerPanel[panel] = document; if (!found) { sigc::connection conn1 = document->connectResourcesChanged( "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) ); - sigc::connection conn2 = SP_DOCUMENT_DEFS(document)->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) ); - sigc::connection conn3 = SP_DOCUMENT_DEFS(document)->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) ); + sigc::connection conn2 = document->getDefs()->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) ); + sigc::connection conn3 = document->getDefs()->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) ); DocTrack *dt = new DocTrack(document, conn1, conn2, conn3); docTrackings.push_back(dt); diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index e191a9360..e62eb009c 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -25,6 +25,7 @@ #include "sp-object.h" #include "rdf.h" #include "ui/widget/registry.h" +#include "sp-root.h" #include "entity-entry.h" @@ -87,8 +88,8 @@ void EntityLineEntry::update(SPDocument *doc) { const char *text = rdf_get_work_entity (doc, _entity); // If RDF title is not set, get the document's and set the RDF: - if ( !text && !strcmp(_entity->name, "title") && doc->root ) { - text = doc->root->title(); + if ( !text && !strcmp(_entity->name, "title") && doc->getRoot() ) { + text = doc->getRoot()->title(); rdf_set_work_entity(doc, _entity, text); } static_cast<Gtk::Entry*>(_packable)->set_text (text ? text : ""); @@ -133,8 +134,8 @@ void EntityMultiLineEntry::update(SPDocument *doc) { const char *text = rdf_get_work_entity (doc, _entity); // If RDF title is not set, get the document's <title> and set the RDF: - if ( !text && !strcmp(_entity->name, "title") && doc->root ) { - text = doc->root->title(); + if ( !text && !strcmp(_entity->name, "title") && doc->getRoot() ) { + text = doc->getRoot()->title(); rdf_set_work_entity(doc, _entity, text); } Gtk::ScrolledWindow *s = static_cast<Gtk::ScrolledWindow*>(_packable); diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index f306b9eea..672e1415b 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -422,7 +422,7 @@ PageSizer::setDim (double w, double h, bool changeList) // The origin for the user is in the lower left corner; this point should remain stationary when // changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this Geom::Translate const vert_offset(Geom::Point(0, (old_height - h))); - SP_GROUP(SP_ROOT(doc->root))->translateChildItems(vert_offset); + doc->getRoot()->translateChildItems(vert_offset); DocumentUndo::done(doc, SP_VERB_NONE, _("Set page size")); } diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 87ce9053f..9f0367665 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -58,6 +58,7 @@ #include "ui/widget/selected-style.h" #include "ui/uxmanager.h" #include "util/ege-appear-time-tracker.h" +#include "sp-root.h" // We're in the "widgets" directory, so no need to explicitly prefix these: #include "button.h" @@ -1888,9 +1889,8 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale) SPDocument *doc = dtw->desktop->doc(); Geom::Rect darea ( Geom::Point(-doc->getWidth(), -doc->getHeight()), Geom::Point(2 * doc->getWidth(), 2 * doc->getHeight()) ); - SPObject* root = doc->root; - SPItem* item = SP_ITEM(root); - Geom::OptRect deskarea = Geom::unify(darea, item->getBboxDesktop()); + + Geom::OptRect deskarea = Geom::unify(darea, doc->getRoot()->getBboxDesktop()); /* Canvas region we always show unconditionally */ Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64), diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index f7a981c9f..9b1664ac3 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -360,7 +360,7 @@ sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *s Inkscape::GC::release(stop); } - SP_DOCUMENT_DEFS(doc)->getRepr()->addChild(repr, NULL); + doc->getDefs()->getRepr()->addChild(repr, NULL); gr = (SPGradient *) doc->getObjectByRepr(repr); sp_gradient_vector_selector_set_gradient( diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index e7596ead4..64ed1e309 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -521,9 +521,9 @@ GtkWidget * gr_change_widget(SPDesktop *desktop) // connect to release and modified signals of the defs (i.e. when someone changes gradient) sigc::connection *release_connection = new sigc::connection(); - *release_connection = SP_DOCUMENT_DEFS(document)->connectRelease(sigc::bind<1>(sigc::ptr_fun(&gr_defs_release), widget)); + *release_connection = document->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&gr_defs_release), widget)); sigc::connection *modified_connection = new sigc::connection(); - *modified_connection = SP_DOCUMENT_DEFS(document)->connectModified(sigc::bind<2>(sigc::ptr_fun(&gr_defs_modified), widget)); + *modified_connection = document->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&gr_defs_modified), widget)); // when widget is destroyed, disconnect g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(gr_disconnect_sigc), release_connection); diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 839ddf67c..8ef0ee313 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -204,8 +204,8 @@ void sp_gradient_vector_selector_set_gradient(SPGradientVectorSelector *gvs, SPD // Connect signals if (doc) { - gvs->defs_release_connection = SP_DOCUMENT_DEFS(doc)->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_defs_release), gvs)); - gvs->defs_modified_connection = SP_DOCUMENT_DEFS(doc)->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_gvs_defs_modified), gvs)); + gvs->defs_release_connection = doc->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_defs_release), gvs)); + gvs->defs_modified_connection = doc->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_gvs_defs_modified), gvs)); } if (gr) { gvs->gradient_release_connection = gr->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_gradient_release), gvs)); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 99d8228c8..d2b280e44 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -225,7 +225,7 @@ ink_marker_list_get (SPDocument *source) return NULL; GSList *ml = NULL; - SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS (source); + SPDefs *defs = source->getDefs(); for ( SPObject *child = defs->firstChild(); child; child = child->getNext() ) { if (SP_IS_MARKER(child)) { -- cgit v1.2.3 From 884cb98ee0fbc0e883ff0a4f2bda43e2c8803312 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" <jon@joncruz.org> Date: Sat, 4 Jun 2011 15:33:05 -0700 Subject: Possible Win32 compile fix. (bzr r10256) --- src/extension/internal/emf-win32-inout.cpp | 3 ++- src/extension/internal/emf-win32-print.cpp | 3 ++- src/ui/dialog/filedialogimpl-win32.cpp | 37 ++++++++++++++++-------------- 3 files changed, 24 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index 8aa26a213..2d97174b1 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -28,6 +28,7 @@ #endif //#include "inkscape.h" +#include "sp-root.h" #include "sp-path.h" #include "style.h" //#include "color.h" @@ -126,7 +127,7 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename) context.module = mod; /* fixme: This has to go into module constructor somehow */ /* Create new arena */ - mod->base = SP_ITEM(doc->getRoot()); + mod->base = doc->getRoot(); mod->arena = NRArena::create(); mod->dkey = SPItem::display_key_new(1); mod->root = mod->base->invoke_show(mod->arena, mod->dkey, SP_ITEM_SHOW_DISPLAY); diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index 9662881fe..38db43091 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -50,6 +50,7 @@ #include "style.h" //#include "sp-paint-server.h" #include "inkscape-version.h" +#include "sp-root.h" //#include "libnrtype/FontFactory.h" //#include "libnrtype/font-instance.h" @@ -146,7 +147,7 @@ PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) d.x1 = _width; d.y1 = _height; } else { - SPItem* doc_item = SP_ITEM(doc->getRoot()); + SPItem* doc_item = doc->getRoot(); doc_item->invoke_bbox(&d, doc_item->i2d_affine(), TRUE); } diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 4f0978c05..09c3d0a52 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -43,6 +43,7 @@ #include "filedialog.h" #include "filedialogimpl-win32.h" +#include "sp-root.h" #include <zlib.h> #include <cairomm/win32_surface.h> @@ -409,7 +410,7 @@ void FileOpenDialogImplWin32::createFilterMenu() *(filterptr++) = L'\0'; _filter_count = extension_index; - _filter_index = 2; // Select the 2nd filter in the list - 2 is NOT the 3rd + _filter_index = 2; // Select the 2nd filter in the list - 2 is NOT the 3rd } void FileOpenDialogImplWin32::GetOpenFileName_thread() @@ -421,7 +422,7 @@ void FileOpenDialogImplWin32::GetOpenFileName_thread() WCHAR* current_directory_string = (WCHAR*)g_utf8_to_utf16( _current_directory.data(), _current_directory.length(), - NULL, NULL, NULL); + NULL, NULL, NULL); memset(&ofn, 0, sizeof(ofn)); @@ -962,8 +963,10 @@ bool FileOpenDialogImplWin32::set_svg_preview() g_free(utf8string); // Check the document loaded properly - if(svgDoc == NULL) return false; - if(svgDoc->root == NULL) + if (svgDoc == NULL) { + return false; + } + if (svgDoc->getRoot() == NULL) { svgDoc->doUnref(); return false; @@ -989,14 +992,14 @@ bool FileOpenDialogImplWin32::set_svg_preview() // write object bbox to area Geom::OptRect maybeArea(area); svgDoc->ensureUpToDate(); - static_cast<SPItem *>(svgDoc->root)->invoke_bbox( maybeArea, - static_cast<SPItem *>(svgDoc->root)->i2d_affine(), TRUE); + svgDoc->getRoot()->invoke_bbox( maybeArea, + svgDoc->getRoot()->i2d_affine(), TRUE); NRArena *const arena = NRArena::create(); unsigned const key = SPItem::display_key_new(1); - NRArenaItem *root = static_cast<SPItem*>(svgDoc->root)->invoke_show( + NRArenaItem *root = svgDoc->getRoot()->invoke_show( arena, key, SP_ITEM_SHOW_DISPLAY); NRGC gc(NULL); @@ -1033,7 +1036,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() // Tidy up svgDoc->doUnref(); - static_cast<SPItem*>(svgDoc->root)->invoke_hide(key); + svgDoc->getRoot()->invoke_hide(key); nr_object_unref((NRObject *) arena); // Create the GDK pixbuf @@ -1666,7 +1669,7 @@ void FileSaveDialogImplWin32::createFilterMenu() *(filterptr++) = 0; _filter_count = extension_index; - _filter_index = 1; // A value of 1 selects the 1st filter - NOT the 2nd + _filter_index = 1; // A value of 1 selects the 1st filter - NOT the 2nd } void FileSaveDialogImplWin32::GetSaveFileName_thread() @@ -1678,7 +1681,7 @@ void FileSaveDialogImplWin32::GetSaveFileName_thread() WCHAR* current_directory_string = (WCHAR*)g_utf8_to_utf16( _current_directory.data(), _current_directory.length(), - NULL, NULL, NULL); + NULL, NULL, NULL); // Copy the selected file name, converting from UTF-8 to UTF-16 memset(_path_string, 0, sizeof(_path_string)); @@ -1730,14 +1733,14 @@ FileSaveDialogImplWin32::show() _result = false; _main_loop = g_main_loop_new(g_main_context_default(), FALSE); - if(_main_loop != NULL) - { - if(Glib::Thread::create(sigc::mem_fun(*this, &FileSaveDialogImplWin32::GetSaveFileName_thread), true)) - g_main_loop_run(_main_loop); + if(_main_loop != NULL) + { + if(Glib::Thread::create(sigc::mem_fun(*this, &FileSaveDialogImplWin32::GetSaveFileName_thread), true)) + g_main_loop_run(_main_loop); - if(_result) - appendExtension(myFilename, (Inkscape::Extension::Output*)_extension); - } + if(_result) + appendExtension(myFilename, (Inkscape::Extension::Output*)_extension); + } return _result; } -- cgit v1.2.3 From f2510631aadaae48e040a1dd0f9bc8b4de6f2054 Mon Sep 17 00:00:00 2001 From: Alex Valavanis <valavanisalex@gmail.com> Date: Sun, 5 Jun 2011 14:22:18 +0100 Subject: Replace use of deprecated GtkTooltips API Fixed bugs: - https://launchpad.net/bugs/793086 (bzr r10256.1.1) --- src/dialogs/clonetiler.cpp | 203 ++++++++++++++------------------ src/dialogs/export.cpp | 8 +- src/dialogs/find.cpp | 64 +++++----- src/dialogs/item-properties.cpp | 10 +- src/dialogs/spellcheck.cpp | 18 ++- src/dialogs/text-edit.cpp | 14 +-- src/dialogs/xml-tree.cpp | 22 ++-- src/ege-adjustment-action.cpp | 7 +- src/ege-select-one-action.cpp | 4 +- src/libgdl/gdl-dock-bar.c | 11 +- src/libgdl/gdl-dock-item-grip.c | 17 +-- src/libgdl/gdl-switcher.c | 19 +-- src/widgets/button.cpp | 34 ++---- src/widgets/button.h | 6 +- src/widgets/desktop-widget.cpp | 21 ++-- src/widgets/desktop-widget.h | 2 - src/widgets/gradient-selector.cpp | 5 +- src/widgets/gradient-toolbar.cpp | 18 +-- src/widgets/gradient-vector.cpp | 5 +- src/widgets/paint-selector.cpp | 26 ++-- src/widgets/sp-color-icc-selector.cpp | 23 ++-- src/widgets/sp-color-icc-selector.h | 2 - src/widgets/sp-color-notebook.cpp | 13 +- src/widgets/sp-color-scales.cpp | 54 ++++----- src/widgets/sp-color-scales.h | 2 - src/widgets/sp-color-wheel-selector.cpp | 6 +- src/widgets/sp-color-wheel-selector.h | 2 - src/widgets/spw-utilities.cpp | 4 +- src/widgets/toolbox.cpp | 24 ++-- 29 files changed, 252 insertions(+), 392 deletions(-) (limited to 'src') diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 7ad0eaa14..2f78e4742 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -1517,12 +1517,12 @@ static void clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data) prefs->setBool(prefs_path + attr, gtk_toggle_button_get_active(tb)); } -static GtkWidget * clonetiler_checkbox(GtkTooltips *tt, const char *tip, const char *attr) +static GtkWidget * clonetiler_checkbox(const char *tip, const char *attr) { GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); GtkWidget *b = gtk_check_button_new (); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, tip, NULL); + gtk_widget_set_tooltip_text (b, tip); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool value = prefs->getBool(prefs_path + attr); @@ -1544,7 +1544,7 @@ static void clonetiler_value_changed(GtkAdjustment *adj, gpointer data) prefs->setDouble(prefs_path + pref, adj->value); } -static GtkWidget * clonetiler_spinbox(GtkTooltips *tt, const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false) +static GtkWidget * clonetiler_spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false) { GtkWidget *hb = gtk_hbox_new(FALSE, 0); @@ -1563,7 +1563,7 @@ static GtkWidget * clonetiler_spinbox(GtkTooltips *tt, const char *tip, const ch sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 0.1, 1); } - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, tip, NULL); + gtk_widget_set_tooltip_text (sb, tip); gtk_entry_set_width_chars (GTK_ENTRY (sb), 4); gtk_box_pack_start (GTK_BOX (hb), sb, FALSE, FALSE, SB_MARGIN); @@ -1834,8 +1834,6 @@ void clonetiler_dialog(void) g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd); - GtkTooltips *tt = gtk_tooltips_new(); - GtkWidget *mainbox = gtk_vbox_new(FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (mainbox), 6); gtk_container_add (GTK_CONTAINER (dlg), mainbox); @@ -1854,7 +1852,7 @@ void clonetiler_dialog(void) * http://www.clarku.edu/~djoyce/wallpaper/seventeen.html (English vocabulary); or * http://membres.lycos.fr/villemingerard/Geometri/Sym1D.htm (French vocabulary). */ - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), om, _("Select one of the 17 symmetry groups for the tiling"), NULL); + gtk_widget_set_tooltip_text (om, _("Select one of the 17 symmetry groups for the tiling")); gtk_box_pack_start (GTK_BOX (vb), om, FALSE, FALSE, SB_MARGIN); GtkWidget *m = gtk_menu_new (); @@ -1927,7 +1925,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Horizontal shift per row (in % of tile width)"), "shiftx_per_j", -10000, 10000, "%"); @@ -1935,7 +1933,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Horizontal shift per column (in % of tile width)"), "shiftx_per_i", -10000, 10000, "%"); @@ -1943,8 +1941,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the horizontal shift by this percentage"), "shiftx_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand", 0, 1000, "%"); clonetiler_table_attach (table, l, 0, 2, 4); } @@ -1960,7 +1957,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Vertical shift per row (in % of tile height)"), "shifty_per_j", -10000, 10000, "%"); @@ -1968,7 +1965,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Vertical shift per column (in % of tile height)"), "shifty_per_i", -10000, 10000, "%"); @@ -1976,7 +1973,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( _("Randomize the vertical shift by this percentage"), "shifty_rand", 0, 1000, "%"); clonetiler_table_attach (table, l, 0, 3, 4); @@ -1991,14 +1988,14 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( _("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "shifty_exp", 0, 10, "", true); clonetiler_table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( _("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "shiftx_exp", 0, 10, "", true); clonetiler_table_attach (table, l, 0, 4, 3); @@ -2013,12 +2010,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of shifts for each row"), "shifty_alternate"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate"); clonetiler_table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of shifts for each column"), "shiftx_alternate"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate"); clonetiler_table_attach (table, l, 0, 5, 3); } @@ -2031,12 +2028,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the shifts for each row"), "shifty_cumulate"); + GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate"); clonetiler_table_attach (table, l, 0, 6, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the shifts for each column"), "shiftx_cumulate"); + GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate"); clonetiler_table_attach (table, l, 0, 6, 3); } @@ -2049,12 +2046,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Exclude tile height in shift"), "shifty_excludeh"); + GtkWidget *l = clonetiler_checkbox (_("Exclude tile height in shift"), "shifty_excludeh"); clonetiler_table_attach (table, l, 0, 7, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Exclude tile width in shift"), "shiftx_excludew"); + GtkWidget *l = clonetiler_checkbox (_("Exclude tile width in shift"), "shiftx_excludew"); clonetiler_table_attach (table, l, 0, 7, 3); } @@ -2077,7 +2074,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Horizontal scale per row (in % of tile width)"), "scalex_per_j", -100, 1000, "%"); @@ -2085,7 +2082,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Horizontal scale per column (in % of tile width)"), "scalex_per_i", -100, 1000, "%"); @@ -2093,8 +2090,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the horizontal scale by this percentage"), "scalex_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand", 0, 1000, "%"); clonetiler_table_attach (table, l, 0, 2, 4); } @@ -2108,7 +2104,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Vertical scale per row (in % of tile height)"), "scaley_per_j", -100, 1000, "%"); @@ -2116,7 +2112,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Vertical scale per column (in % of tile height)"), "scaley_per_i", -100, 1000, "%"); @@ -2124,8 +2120,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the vertical scale by this percentage"), "scaley_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand", 0, 1000, "%"); clonetiler_table_attach (table, l, 0, 3, 4); } @@ -2139,15 +2134,13 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp", + GtkWidget *l = clonetiler_spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp", 0, 10, "", true); clonetiler_table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp", + GtkWidget *l = clonetiler_spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp", 0, 10, "", true); clonetiler_table_attach (table, l, 0, 4, 3); } @@ -2161,15 +2154,13 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log", + GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log", 0, 10, "", false); clonetiler_table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log", + GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log", 0, 10, "", false); clonetiler_table_attach (table, l, 0, 5, 3); } @@ -2183,12 +2174,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each row"), "scaley_alternate"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate"); clonetiler_table_attach (table, l, 0, 6, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each column"), "scalex_alternate"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate"); clonetiler_table_attach (table, l, 0, 6, 3); } @@ -2201,12 +2192,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the scales for each row"), "scaley_cumulate"); + GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each row"), "scaley_cumulate"); clonetiler_table_attach (table, l, 0, 7, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the scales for each column"), "scalex_cumulate"); + GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each column"), "scalex_cumulate"); clonetiler_table_attach (table, l, 0, 7, 3); } @@ -2229,7 +2220,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Rotate tiles by this angle for each row"), "rotate_per_j", -180, 180, "°"); @@ -2237,7 +2228,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, + GtkWidget *l = clonetiler_spinbox ( // xgettext:no-c-format _("Rotate tiles by this angle for each column"), "rotate_per_i", -180, 180, "°"); @@ -2245,8 +2236,7 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the rotation angle by this percentage"), "rotate_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the rotation angle by this percentage"), "rotate_rand", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 2, 4); } @@ -2260,12 +2250,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the rotation direction for each row"), "rotate_alternatej"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the rotation direction for each row"), "rotate_alternatej"); clonetiler_table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the rotation direction for each column"), "rotate_alternatei"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the rotation direction for each column"), "rotate_alternatei"); clonetiler_table_attach (table, l, 0, 3, 3); } @@ -2278,12 +2268,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the rotation for each row"), "rotate_cumulatej"); + GtkWidget *l = clonetiler_checkbox (_("Cumulate the rotation for each row"), "rotate_cumulatej"); clonetiler_table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the rotation for each column"), "rotate_cumulatei"); + GtkWidget *l = clonetiler_checkbox (_("Cumulate the rotation for each column"), "rotate_cumulatei"); clonetiler_table_attach (table, l, 0, 4, 3); } @@ -2307,22 +2297,19 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Blur tiles by this percentage for each row"), "blur_per_j", + GtkWidget *l = clonetiler_spinbox (_("Blur tiles by this percentage for each row"), "blur_per_j", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Blur tiles by this percentage for each column"), "blur_per_i", + GtkWidget *l = clonetiler_spinbox (_("Blur tiles by this percentage for each column"), "blur_per_i", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the tile blur by this percentage"), "blur_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the tile blur by this percentage"), "blur_rand", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 2, 4); } @@ -2336,12 +2323,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of blur change for each row"), "blur_alternatej"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of blur change for each row"), "blur_alternatej"); clonetiler_table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of blur change for each column"), "blur_alternatei"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of blur change for each column"), "blur_alternatei"); clonetiler_table_attach (table, l, 0, 3, 3); } @@ -2356,22 +2343,19 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Decrease tile opacity by this percentage for each row"), "opacity_per_j", + GtkWidget *l = clonetiler_spinbox (_("Decrease tile opacity by this percentage for each row"), "opacity_per_j", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Decrease tile opacity by this percentage for each column"), "opacity_per_i", + GtkWidget *l = clonetiler_spinbox (_("Decrease tile opacity by this percentage for each column"), "opacity_per_i", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 4, 3); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the tile opacity by this percentage"), "opacity_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the tile opacity by this percentage"), "opacity_rand", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 4, 4); } @@ -2385,12 +2369,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of opacity change for each row"), "opacity_alternatej"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of opacity change for each row"), "opacity_alternatej"); clonetiler_table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of opacity change for each column"), "opacity_alternatei"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of opacity change for each column"), "opacity_alternatei"); clonetiler_table_attach (table, l, 0, 5, 3); } } @@ -2428,22 +2412,19 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Change the tile hue by this percentage for each row"), "hue_per_j", + GtkWidget *l = clonetiler_spinbox (_("Change the tile hue by this percentage for each row"), "hue_per_j", -100, 100, "%"); clonetiler_table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Change the tile hue by this percentage for each column"), "hue_per_i", + GtkWidget *l = clonetiler_spinbox (_("Change the tile hue by this percentage for each column"), "hue_per_i", -100, 100, "%"); clonetiler_table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the tile hue by this percentage"), "hue_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the tile hue by this percentage"), "hue_rand", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 2, 4); } @@ -2458,22 +2439,19 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Change the color saturation by this percentage for each row"), "saturation_per_j", + GtkWidget *l = clonetiler_spinbox (_("Change the color saturation by this percentage for each row"), "saturation_per_j", -100, 100, "%"); clonetiler_table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Change the color saturation by this percentage for each column"), "saturation_per_i", + GtkWidget *l = clonetiler_spinbox (_("Change the color saturation by this percentage for each column"), "saturation_per_i", -100, 100, "%"); clonetiler_table_attach (table, l, 0, 3, 3); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the color saturation by this percentage"), "saturation_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the color saturation by this percentage"), "saturation_rand", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 3, 4); } @@ -2487,22 +2465,19 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Change the color lightness by this percentage for each row"), "lightness_per_j", + GtkWidget *l = clonetiler_spinbox (_("Change the color lightness by this percentage for each row"), "lightness_per_j", -100, 100, "%"); clonetiler_table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Change the color lightness by this percentage for each column"), "lightness_per_i", + GtkWidget *l = clonetiler_spinbox (_("Change the color lightness by this percentage for each column"), "lightness_per_i", -100, 100, "%"); clonetiler_table_attach (table, l, 0, 4, 3); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the color lightness by this percentage"), "lightness_rand", + GtkWidget *l = clonetiler_spinbox (_("Randomize the color lightness by this percentage"), "lightness_rand", 0, 100, "%"); clonetiler_table_attach (table, l, 0, 4, 4); } @@ -2516,12 +2491,12 @@ void clonetiler_dialog(void) } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of color changes for each row"), "color_alternatej"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of color changes for each row"), "color_alternatej"); clonetiler_table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of color changes for each column"), "color_alternatei"); + GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of color changes for each column"), "color_alternatei"); clonetiler_table_attach (table, l, 0, 5, 3); } @@ -2540,7 +2515,7 @@ void clonetiler_dialog(void) g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE)); bool old = prefs->getBool(prefs_path + "dotrace"); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("For each clone, pick a value from the drawing in that clone's location and apply it to the clone"), NULL); + gtk_widget_set_tooltip_text (b, _("For each clone, pick a value from the drawing in that clone's location and apply it to the clone")); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(b), "toggled", @@ -2566,7 +2541,7 @@ void clonetiler_dialog(void) GtkWidget* radio; { radio = gtk_radio_button_new_with_label (NULL, _("Color")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the visible color and opacity"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the visible color and opacity")); clonetiler_table_attach (table, radio, 0.0, 1, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_COLOR)); @@ -2574,7 +2549,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Opacity")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the total accumulated opacity"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the total accumulated opacity")); clonetiler_table_attach (table, radio, 0.0, 2, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_OPACITY)); @@ -2582,7 +2557,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("R")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the Red component of the color"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the Red component of the color")); clonetiler_table_attach (table, radio, 0.0, 1, 2); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_R)); @@ -2590,7 +2565,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("G")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the Green component of the color"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the Green component of the color")); clonetiler_table_attach (table, radio, 0.0, 2, 2); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_G)); @@ -2598,7 +2573,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("B")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the Blue component of the color"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the Blue component of the color")); clonetiler_table_attach (table, radio, 0.0, 3, 2); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_B)); @@ -2606,7 +2581,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the hue of the color"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the hue of the color")); clonetiler_table_attach (table, radio, 0.0, 1, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_H)); @@ -2614,7 +2589,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the saturation of the color"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the saturation of the color")); clonetiler_table_attach (table, radio, 0.0, 2, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_S)); @@ -2622,7 +2597,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the lightness of the color"), NULL); + gtk_widget_set_tooltip_text (radio, _("Pick the lightness of the color")); clonetiler_table_attach (table, radio, 0.0, 3, 3); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_L)); @@ -2646,8 +2621,7 @@ void clonetiler_dialog(void) clonetiler_table_attach (table, l, 1.0, 1, 1); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked", + GtkWidget *l = clonetiler_spinbox (_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked", -10, 10, ""); clonetiler_table_attach (table, l, 0.0, 1, 2); } @@ -2658,8 +2632,7 @@ void clonetiler_dialog(void) clonetiler_table_attach (table, l, 1.0, 1, 3); } { - GtkWidget *l = clonetiler_spinbox (tt, - _("Randomize the picked value by this percentage"), "rand_picked", + GtkWidget *l = clonetiler_spinbox (_("Randomize the picked value by this percentage"), "rand_picked", 0, 100, "%"); clonetiler_table_attach (table, l, 0.0, 1, 4); } @@ -2670,7 +2643,7 @@ void clonetiler_dialog(void) clonetiler_table_attach (table, l, 1.0, 2, 1); } { - GtkWidget *l = clonetiler_checkbox (tt, _("Invert the picked value"), "invert_picked"); + GtkWidget *l = clonetiler_checkbox (_("Invert the picked value"), "invert_picked"); clonetiler_table_attach (table, l, 0.0, 2, 2); } } @@ -2689,7 +2662,7 @@ void clonetiler_dialog(void) GtkWidget *b = gtk_check_button_new_with_label (_("Presence")); bool old = prefs->getBool(prefs_path + "pick_to_presence", true); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone is created with the probability determined by the picked value in that point"), NULL); + gtk_widget_set_tooltip_text (b, _("Each clone is created with the probability determined by the picked value in that point")); clonetiler_table_attach (table, b, 0.0, 1, 1); gtk_signal_connect(GTK_OBJECT(b), "toggled", GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_presence"); @@ -2699,7 +2672,7 @@ void clonetiler_dialog(void) GtkWidget *b = gtk_check_button_new_with_label (_("Size")); bool old = prefs->getBool(prefs_path + "pick_to_size"); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone's size is determined by the picked value in that point"), NULL); + gtk_widget_set_tooltip_text (b, _("Each clone's size is determined by the picked value in that point")); clonetiler_table_attach (table, b, 0.0, 2, 1); gtk_signal_connect(GTK_OBJECT(b), "toggled", GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_size"); @@ -2709,7 +2682,7 @@ void clonetiler_dialog(void) GtkWidget *b = gtk_check_button_new_with_label (_("Color")); bool old = prefs->getBool(prefs_path + "pick_to_color", 0); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)"), NULL); + gtk_widget_set_tooltip_text (b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)")); clonetiler_table_attach (table, b, 0.0, 1, 2); gtk_signal_connect(GTK_OBJECT(b), "toggled", GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_color"); @@ -2719,7 +2692,7 @@ void clonetiler_dialog(void) GtkWidget *b = gtk_check_button_new_with_label (_("Opacity")); bool old = prefs->getBool(prefs_path + "pick_to_opacity", 0); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone's opacity is determined by the picked value in that point"), NULL); + gtk_widget_set_tooltip_text (b, _("Each clone's opacity is determined by the picked value in that point")); clonetiler_table_attach (table, b, 0.0, 2, 2); gtk_signal_connect(GTK_OBJECT(b), "toggled", GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_opacity"); @@ -2746,7 +2719,7 @@ void clonetiler_dialog(void) int value = prefs->getInt(prefs_path + "jmax", 2); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, _("How many rows in the tiling"), NULL); + gtk_widget_set_tooltip_text (sb, _("How many rows in the tiling")); gtk_entry_set_width_chars (GTK_ENTRY (sb), 5); gtk_box_pack_start (GTK_BOX (hb), sb, TRUE, TRUE, 0); @@ -2766,7 +2739,7 @@ void clonetiler_dialog(void) int value = prefs->getInt(prefs_path + "imax", 2); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, _("How many columns in the tiling"), NULL); + gtk_widget_set_tooltip_text (sb, _("How many columns in the tiling")); gtk_entry_set_width_chars (GTK_ENTRY (sb), 5); gtk_box_pack_start (GTK_BOX (hb), sb, TRUE, TRUE, 0); @@ -2796,7 +2769,7 @@ void clonetiler_dialog(void) gtk_adjustment_set_value (GTK_ADJUSTMENT (a), units); GtkWidget *e = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0 , 2); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), e, _("Width of the rectangle to be filled"), NULL); + gtk_widget_set_tooltip_text (e, _("Width of the rectangle to be filled")); gtk_entry_set_width_chars (GTK_ENTRY (e), 5); gtk_box_pack_start (GTK_BOX (hb), e, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(a), "value_changed", @@ -2821,7 +2794,7 @@ void clonetiler_dialog(void) GtkWidget *e = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0 , 2); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), e, _("Height of the rectangle to be filled"), NULL); + gtk_widget_set_tooltip_text (e, _("Height of the rectangle to be filled")); gtk_entry_set_width_chars (GTK_ENTRY (e), 5); gtk_box_pack_start (GTK_BOX (hb), e, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(a), "value_changed", @@ -2837,7 +2810,7 @@ void clonetiler_dialog(void) GtkWidget* radio; { radio = gtk_radio_button_new_with_label (NULL, _("Rows, columns: ")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Create the specified number of rows and columns"), NULL); + gtk_widget_set_tooltip_text (radio, _("Create the specified number of rows and columns")); clonetiler_table_attach (table, radio, 0.0, 1, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_create), (gpointer) dlg); } @@ -2847,7 +2820,7 @@ void clonetiler_dialog(void) } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Width, height: ")); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Fill the specified width and height with the tiling"), NULL); + gtk_widget_set_tooltip_text (radio, _("Fill the specified width and height with the tiling")); clonetiler_table_attach (table, radio, 0.0, 2, 1); gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_fill), (gpointer) dlg); } @@ -2866,7 +2839,7 @@ void clonetiler_dialog(void) GtkWidget *b = gtk_check_button_new_with_label (_("Use saved size and position of the tile")); bool keepbbox = prefs->getBool(prefs_path + "keepbbox", true); gtk_toggle_button_set_active ((GtkToggleButton *) b, keepbbox); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Pretend that the size and position of the tile are the same as the last time you tiled it (if any), instead of using the current size"), NULL); + gtk_widget_set_tooltip_text (b, _("Pretend that the size and position of the tile are the same as the last time you tiled it (if any), instead of using the current size")); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(b), "toggled", @@ -2892,7 +2865,7 @@ void clonetiler_dialog(void) GtkWidget *l = gtk_label_new (""); gtk_label_set_markup_with_mnemonic (GTK_LABEL(l), _(" <b>_Create</b> ")); gtk_container_add (GTK_CONTAINER(b), l); - gtk_tooltips_set_tip (tt, b, _("Create and tile the clones of the selection"), NULL); + gtk_widget_set_tooltip_text (b, _("Create and tile the clones of the selection")); gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_apply), NULL); gtk_box_pack_end (GTK_BOX (hb), b, FALSE, FALSE, 0); } @@ -2908,14 +2881,14 @@ void clonetiler_dialog(void) // http://www.inkscape.org/screenshots/gallery/inkscape-0.42-CVS-tiles-unclump.png // So unclumping is the process of spreading a number of objects out more evenly. GtkWidget *b = gtk_button_new_with_mnemonic (_(" _Unclump ")); - gtk_tooltips_set_tip (tt, b, _("Spread out clones to reduce clumping; can be applied repeatedly"), NULL); + gtk_widget_set_tooltip_text (b, _("Spread out clones to reduce clumping; can be applied repeatedly")); gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_unclump), NULL); gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0); } { GtkWidget *b = gtk_button_new_with_mnemonic (_(" Re_move ")); - gtk_tooltips_set_tip (tt, b, _("Remove existing tiled clones of the selected object (siblings only)"), NULL); + gtk_widget_set_tooltip_text (b, _("Remove existing tiled clones of the selected object (siblings only)")); gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_remove), NULL); gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0); } @@ -2933,7 +2906,7 @@ void clonetiler_dialog(void) { GtkWidget *b = gtk_button_new_with_mnemonic (_(" R_eset ")); // TRANSLATORS: "change" is a noun here - gtk_tooltips_set_tip (tt, b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero"), NULL); + gtk_widget_set_tooltip_text (b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero")); gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_reset), NULL); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); } diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 4c1ad4af1..2f1299190 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -450,8 +450,6 @@ sp_export_dialog (void) g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg); - GtkTooltips *tt = gtk_tooltips_new(); - Gtk::VBox *vb = new Gtk::VBox(false, 3); vb->set_border_width(3); gtk_container_add (GTK_CONTAINER (dlg), GTK_WIDGET(vb->gobj())); @@ -625,7 +623,7 @@ sp_export_dialog (void) gtk_widget_set_sensitive(GTK_WIDGET(be), TRUE); gtk_object_set_data(GTK_OBJECT(dlg), "batch_checkbox", be); batch_box->pack_start(*Glib::wrap(be), false, false); - gtk_tooltips_set_tip(tt, be, _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)"), NULL); + gtk_widget_set_tooltip_text(be, _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)")); batch_box->show_all(); g_signal_connect(G_OBJECT(be), "toggled", GTK_SIGNAL_FUNC(batch_export_clicked), dlg); vb->pack_start(*batch_box); @@ -637,7 +635,7 @@ sp_export_dialog (void) gtk_widget_set_sensitive(GTK_WIDGET(he), TRUE); gtk_object_set_data(GTK_OBJECT(dlg), "hide_checkbox", he); hide_box->pack_start(*Glib::wrap(he), false, false); - gtk_tooltips_set_tip(tt, he, _("In the exported image, hide all objects except those that are selected"), NULL); + gtk_widget_set_tooltip_text(he, _("In the exported image, hide all objects except those that are selected")); hide_box->show_all(); vb->pack_start(*hide_box); } @@ -658,7 +656,7 @@ sp_export_dialog (void) image_label->pack_start(*l); b->add(*image_label); - gtk_tooltips_set_tip (tt, GTK_WIDGET(b->gobj()), _("Export the bitmap file with these settings"), NULL); + gtk_widget_set_tooltip_text (GTK_WIDGET(b->gobj()), _("Export the bitmap file with these settings")); gtk_signal_connect ( GTK_OBJECT (b->gobj()), "clicked", GTK_SIGNAL_FUNC (sp_export_export_clicked), dlg ); bb->pack_end(*b, false, false, 0); diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index 4d392a316..d07772406 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -412,7 +412,7 @@ sp_find_dialog_reset (GObject *, GObject *dlg) #define FIND_LABELWIDTH 80 void -sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, const gchar *id, GtkTooltips *tt, const gchar *tip) +sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, const gchar *id, const gchar *tip) { GtkWidget *hb = gtk_hbox_new (FALSE, 0); GtkWidget *l = gtk_label_new_with_mnemonic (label); @@ -424,7 +424,7 @@ sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, cons gtk_entry_set_max_length (GTK_ENTRY (tf), 64); gtk_box_pack_start (GTK_BOX (hb), tf, TRUE, TRUE, 0); gtk_object_set_data (GTK_OBJECT (dlg), id, tf); - gtk_tooltips_set_tip (tt, tf, tip, NULL); + gtk_widget_set_tooltip_text (tf, tip); g_signal_connect ( G_OBJECT (tf), "activate", G_CALLBACK (sp_find_dialog_find), dlg ); gtk_label_set_mnemonic_widget (GTK_LABEL(l), tf); @@ -432,10 +432,10 @@ sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, cons } void -sp_find_new_button (GtkWidget *dlg, GtkWidget *hb, const gchar *label, GtkTooltips *tt, const gchar *tip, void (*function) (GObject *, GObject *)) +sp_find_new_button (GtkWidget *dlg, GtkWidget *hb, const gchar *label, const gchar *tip, void (*function) (GObject *, GObject *)) { GtkWidget *b = gtk_button_new_with_mnemonic (label); - gtk_tooltips_set_tip (tt, b, tip, NULL); + gtk_widget_set_tooltip_text (b, tip); gtk_box_pack_start (GTK_BOX (hb), b, TRUE, TRUE, 0); g_signal_connect ( G_OBJECT (b), "clicked", G_CALLBACK (function), dlg ); gtk_widget_show (b); @@ -483,7 +483,7 @@ toggle_shapes (GtkToggleButton *tb, gpointer data) GtkWidget * sp_find_types_checkbox (GtkWidget *w, const gchar *data, gboolean active, - GtkTooltips *tt, const gchar *tip, + const gchar *tip, const gchar *label, void (*toggled)(GtkToggleButton *, gpointer)) { @@ -495,7 +495,7 @@ sp_find_types_checkbox (GtkWidget *w, const gchar *data, gboolean active, gtk_widget_show (b); gtk_toggle_button_set_active ((GtkToggleButton *) b, active); gtk_object_set_data (GTK_OBJECT (w), data, b); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, tip, NULL); + gtk_widget_set_tooltip_text (b, tip); if (toggled) gtk_signal_connect (GTK_OBJECT (b), "toggled", GTK_SIGNAL_FUNC (toggled), w); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); @@ -506,7 +506,7 @@ sp_find_types_checkbox (GtkWidget *w, const gchar *data, gboolean active, GtkWidget * sp_find_types_checkbox_indented (GtkWidget *w, const gchar *data, gboolean active, - GtkTooltips *tt, const gchar *tip, + const gchar *tip, const gchar *label, void (*toggled)(GtkToggleButton *, gpointer), guint indent) { @@ -520,7 +520,7 @@ sp_find_types_checkbox_indented (GtkWidget *w, const gchar *data, gboolean activ gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); } - GtkWidget *c = sp_find_types_checkbox (w, data, active, tt, tip, label, toggled); + GtkWidget *c = sp_find_types_checkbox (w, data, active, tip, label, toggled); gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); return hb; @@ -530,8 +530,6 @@ sp_find_types_checkbox_indented (GtkWidget *w, const gchar *data, gboolean activ GtkWidget * sp_find_types () { - GtkTooltips *tt = gtk_tooltips_new (); - GtkWidget *vb = gtk_vbox_new (FALSE, 4); gtk_widget_show (vb); @@ -547,7 +545,7 @@ sp_find_types () gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); } - GtkWidget *alltypes = sp_find_types_checkbox (vb, "all", TRUE, tt, _("Search in all object types"), _("All types"), toggle_alltypes); + GtkWidget *alltypes = sp_find_types_checkbox (vb, "all", TRUE, _("Search in all object types"), _("All types"), toggle_alltypes); gtk_box_pack_start (GTK_BOX (hb), alltypes, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); @@ -558,7 +556,7 @@ sp_find_types () gtk_widget_show (vb_all); { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "shapes", FALSE, tt, _("Search all shapes"), _("All shapes"), toggle_shapes, 10); + GtkWidget *c = sp_find_types_checkbox_indented (vb, "shapes", FALSE, _("Search all shapes"), _("All shapes"), toggle_shapes, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } @@ -575,22 +573,22 @@ sp_find_types () } { - GtkWidget *c = sp_find_types_checkbox (vb, "rects", FALSE, tt, _("Search rectangles"), _("Rectangles"), NULL); + GtkWidget *c = sp_find_types_checkbox (vb, "rects", FALSE, _("Search rectangles"), _("Rectangles"), NULL); gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox (vb, "ellipses", FALSE, tt, _("Search ellipses, arcs, circles"), _("Ellipses"), NULL); + GtkWidget *c = sp_find_types_checkbox (vb, "ellipses", FALSE, _("Search ellipses, arcs, circles"), _("Ellipses"), NULL); gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox (vb, "stars", FALSE, tt, _("Search stars and polygons"), _("Stars"), NULL); + GtkWidget *c = sp_find_types_checkbox (vb, "stars", FALSE, _("Search stars and polygons"), _("Stars"), NULL); gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox (vb, "spirals", FALSE, tt, _("Search spirals"), _("Spirals"), NULL); + GtkWidget *c = sp_find_types_checkbox (vb, "spirals", FALSE, _("Search spirals"), _("Spirals"), NULL); gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0); } @@ -603,34 +601,34 @@ sp_find_types () { // 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, tt, _("Search paths, lines, polylines"), _("Paths"), NULL, 10); + GtkWidget *c = sp_find_types_checkbox_indented (vb, "paths", TRUE, _("Search paths, lines, polylines"), _("Paths"), NULL, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "texts", TRUE, tt, _("Search text objects"), _("Texts"), NULL, 10); + GtkWidget *c = sp_find_types_checkbox_indented (vb, "texts", TRUE, _("Search text objects"), _("Texts"), NULL, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "groups", TRUE, tt, _("Search groups"), _("Groups"), NULL, 10); + GtkWidget *c = sp_find_types_checkbox_indented (vb, "groups", TRUE, _("Search groups"), _("Groups"), NULL, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, tt, _("Search clones"), + GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, _("Search clones"), //TRANSLATORS: "Clones" is a noun indicating type of object to find C_("Find dialog","Clones"), NULL, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "images", TRUE, tt, _("Search images"), _("Images"), NULL, 10); + GtkWidget *c = sp_find_types_checkbox_indented (vb, "images", TRUE, _("Search images"), _("Images"), NULL, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } { - GtkWidget *c = sp_find_types_checkbox_indented (vb, "offsets", TRUE, tt, _("Search offset objects"), _("Offsets"), NULL, 10); + GtkWidget *c = sp_find_types_checkbox_indented (vb, "offsets", TRUE, _("Search offset objects"), _("Offsets"), NULL, 10); gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0); } @@ -687,18 +685,16 @@ sp_find_dialog_old (void) g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg); - GtkTooltips *tt = gtk_tooltips_new (); - gtk_container_set_border_width (GTK_CONTAINER (dlg), 4); /* Toplevel vbox */ GtkWidget *vb = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (dlg), vb); - sp_find_new_searchfield (dlg, vb, _("_Text:"), "text", tt, _("Find objects by their text content (exact or partial match)")); - sp_find_new_searchfield (dlg, vb, _("_ID:"), "id", tt, _("Find objects by the value of the id attribute (exact or partial match)")); - sp_find_new_searchfield (dlg, vb, _("_Style:"), "style", tt, _("Find objects by the value of the style attribute (exact or partial match)")); - sp_find_new_searchfield (dlg, vb, _("_Attribute:"), "attr", tt ,_("Find objects by the name of an attribute (exact or partial match)")); + 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)")); gtk_widget_show_all (vb); @@ -716,7 +712,7 @@ sp_find_dialog_old (void) gtk_widget_show (b); gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE); gtk_object_set_data (GTK_OBJECT (dlg), "inselection", b); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Limit search to the current selection"), NULL); + gtk_widget_set_tooltip_text (b, _("Limit search to the current selection")); gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0); } @@ -725,7 +721,7 @@ sp_find_dialog_old (void) gtk_widget_show (b); gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE); gtk_object_set_data (GTK_OBJECT (dlg), "inlayer", b); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Limit search to the current layer"), NULL); + gtk_widget_set_tooltip_text (b, _("Limit search to the current layer")); gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0); } @@ -734,7 +730,7 @@ sp_find_dialog_old (void) gtk_widget_show (b); gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE); gtk_object_set_data (GTK_OBJECT (dlg), "includehidden", b); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Include hidden objects in search"), NULL); + gtk_widget_set_tooltip_text (b, _("Include hidden objects in search")); gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0); } @@ -743,7 +739,7 @@ sp_find_dialog_old (void) gtk_widget_show (b); gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE); gtk_object_set_data (GTK_OBJECT (dlg), "includelocked", b); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Include locked objects in search"), NULL); + gtk_widget_set_tooltip_text (b, _("Include locked objects in search")); gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0); } } @@ -754,8 +750,8 @@ sp_find_dialog_old (void) gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); // TRANSLATORS: "Clear" is a verb here - sp_find_new_button (dlg, hb, _("_Clear"), tt, _("Clear values"), sp_find_dialog_reset); - sp_find_new_button (dlg, hb, _("_Find"), tt, _("Select objects matching all of the fields you filled in"), sp_find_dialog_find); + sp_find_new_button (dlg, hb, _("_Clear"), _("Clear values"), sp_find_dialog_reset); + sp_find_new_button (dlg, hb, _("_Find"), _("Select objects matching all of the fields you filled in"), sp_find_dialog_find); } } diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index 54707c0aa..cd0cea9b5 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -89,8 +89,6 @@ sp_item_widget_new (void) GtkWidget *spw, *vb, *t, *cb, *l, *f, *tf, *pb, *int_expander, *int_label; GtkTextBuffer *desc_buffer; - GtkTooltips *tt = gtk_tooltips_new(); - /* Create container widget */ spw = sp_widget_new_global (INKSCAPE); gtk_signal_connect ( GTK_OBJECT (spw), "modify_selection", @@ -120,7 +118,7 @@ sp_item_widget_new (void) /* Create the entry box for the object id */ tf = gtk_entry_new (); - gtk_tooltips_set_tip (tt, tf, _("The id= attribute (only letters, digits, and the characters .-_: allowed)"), NULL); + gtk_widget_set_tooltip_text (tf, _("The id= attribute (only letters, digits, and the characters .-_: allowed)")); gtk_entry_set_max_length (GTK_ENTRY (tf), 64); gtk_table_attach ( GTK_TABLE (t), tf, 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -152,7 +150,7 @@ sp_item_widget_new (void) /* Create the entry box for the object label */ tf = gtk_entry_new (); - gtk_tooltips_set_tip (tt, tf, _("A freeform label for the object"), NULL); + gtk_widget_set_tooltip_text (tf, _("A freeform label for the object")); gtk_entry_set_max_length (GTK_ENTRY (tf), 256); gtk_table_attach ( GTK_TABLE (t), tf, 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -214,7 +212,7 @@ sp_item_widget_new (void) /* Hide */ cb = gtk_check_button_new_with_mnemonic (_("_Hide")); - gtk_tooltips_set_tip (tt, cb, _("Check to make the object invisible"), NULL); + gtk_widget_set_tooltip_text (cb, _("Check to make the object invisible")); gtk_table_attach ( GTK_TABLE (t), cb, 0, 1, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)0, 0, 0 ); @@ -224,7 +222,7 @@ sp_item_widget_new (void) /* Lock */ // TRANSLATORS: "Lock" is a verb here cb = gtk_check_button_new_with_mnemonic (_("L_ock")); - gtk_tooltips_set_tip (tt, cb, _("Check to make the object insensitive (not selectable by mouse)"), NULL); + gtk_widget_set_tooltip_text (cb, _("Check to make the object insensitive (not selectable by mouse)")); gtk_table_attach ( GTK_TABLE (t), cb, 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)0, 0, 0 ); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index ecdc0e0ca..47de25061 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -185,10 +185,10 @@ static gboolean sp_spellcheck_dialog_delete(GtkObject *, GdkEvent *, gpointer /* } void -sp_spellcheck_new_button (GtkWidget *dlg, GtkWidget *hb, const gchar *label, GtkTooltips *tt, const gchar *tip, void (*function) (GObject *, GObject *), const gchar *cookie) +sp_spellcheck_new_button (GtkWidget *dlg, GtkWidget *hb, const gchar *label, const gchar *tip, void (*function) (GObject *, GObject *), const gchar *cookie) { GtkWidget *b = gtk_button_new_with_mnemonic (label); - gtk_tooltips_set_tip (tt, b, tip, NULL); + gtk_widget_set_tooltip_text (b, tip); gtk_box_pack_start (GTK_BOX (hb), b, TRUE, TRUE, 0); g_signal_connect ( G_OBJECT (b), "clicked", G_CALLBACK (function), dlg ); gtk_object_set_data (GTK_OBJECT (dlg), cookie, b); @@ -926,8 +926,6 @@ sp_spellcheck_dialog (void) g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg); - GtkTooltips *tt = gtk_tooltips_new (); - gtk_container_set_border_width (GTK_CONTAINER (dlg), 4); /* Toplevel vbox */ @@ -971,18 +969,18 @@ sp_spellcheck_dialog (void) { GtkWidget *hb = gtk_hbox_new (FALSE, 0); - sp_spellcheck_new_button (dlg, hb, _("_Accept"), tt, _("Accept the chosen suggestion"), + sp_spellcheck_new_button (dlg, hb, _("_Accept"), _("Accept the chosen suggestion"), sp_spellcheck_accept, "b_accept"); - sp_spellcheck_new_button (dlg, hb, _("_Ignore once"), tt, _("Ignore this word only once"), + sp_spellcheck_new_button (dlg, hb, _("_Ignore once"), _("Ignore this word only once"), sp_spellcheck_ignore_once, "b_ignore_once"); - sp_spellcheck_new_button (dlg, hb, _("_Ignore"), tt, _("Ignore this word in this session"), + sp_spellcheck_new_button (dlg, hb, _("_Ignore"), _("Ignore this word in this session"), sp_spellcheck_ignore, "b_ignore"); gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); } { GtkWidget *hb = gtk_hbox_new (FALSE, 0); - sp_spellcheck_new_button (dlg, hb, _("A_dd to dictionary:"), tt, _("Add this word to the chosen dictionary"), + sp_spellcheck_new_button (dlg, hb, _("A_dd to dictionary:"), _("Add this word to the chosen dictionary"), sp_spellcheck_add, "b_add"); GtkComboBox *cbox = GTK_COMBO_BOX (gtk_combo_box_new_text()); gtk_combo_box_append_text (cbox, _lang); @@ -1006,9 +1004,9 @@ sp_spellcheck_dialog (void) { GtkWidget *hb = gtk_hbox_new (FALSE, 0); - sp_spellcheck_new_button (dlg, hb, _("_Stop"), tt, _("Stop the check"), + sp_spellcheck_new_button (dlg, hb, _("_Stop"), _("Stop the check"), sp_spellcheck_stop, "b_stop"); - sp_spellcheck_new_button (dlg, hb, _("_Start"), tt, _("Start the check"), + sp_spellcheck_new_button (dlg, hb, _("_Start"), _("Start the check"), sp_spellcheck_start, "b_start"); gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); } diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index d46f62d17..46d5637c3 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -188,8 +188,6 @@ sp_text_edit_dialog (void) gtk_window_set_policy (GTK_WINDOW (dlg), TRUE, TRUE, FALSE); - GtkTooltips *tt = gtk_tooltips_new(); - // box containing the notebook and the bottom buttons GtkWidget *mainvb = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (dlg), mainvb); @@ -240,7 +238,7 @@ sp_text_edit_dialog (void) // TODO - replace with Inkscape-specific call GtkWidget *px = gtk_image_new_from_stock ( GTK_STOCK_JUSTIFY_LEFT, GTK_ICON_SIZE_LARGE_TOOLBAR ); GtkWidget *b = group = gtk_radio_button_new (NULL); - gtk_tooltips_set_tip (tt, b, _("Align lines left"), NULL); + gtk_widget_set_tooltip_text (b, _("Align lines left")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (b), "toggled", G_CALLBACK (sp_text_edit_dialog_any_toggled), dlg); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE ); @@ -255,7 +253,7 @@ sp_text_edit_dialog (void) GtkWidget *px = gtk_image_new_from_stock ( GTK_STOCK_JUSTIFY_CENTER, GTK_ICON_SIZE_LARGE_TOOLBAR ); GtkWidget *b = gtk_radio_button_new (gtk_radio_button_group (GTK_RADIO_BUTTON (group))); /* TRANSLATORS: `Center' here is a verb. */ - gtk_tooltips_set_tip (tt, b, _("Center lines"), NULL); + gtk_widget_set_tooltip_text (b, _("Center lines")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (b), "toggled", G_CALLBACK (sp_text_edit_dialog_any_toggled), dlg ); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); @@ -269,7 +267,7 @@ sp_text_edit_dialog (void) // TODO - replace with Inkscape-specific call GtkWidget *px = gtk_image_new_from_stock ( GTK_STOCK_JUSTIFY_RIGHT, GTK_ICON_SIZE_LARGE_TOOLBAR ); GtkWidget *b = gtk_radio_button_new (gtk_radio_button_group (GTK_RADIO_BUTTON (group))); - gtk_tooltips_set_tip (tt, b, _("Align lines right"), NULL); + gtk_widget_set_tooltip_text (b, _("Align lines right")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (b), "toggled", G_CALLBACK (sp_text_edit_dialog_any_toggled), dlg ); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); @@ -283,7 +281,7 @@ sp_text_edit_dialog (void) // TODO - replace with Inkscape-specific call GtkWidget *px = gtk_image_new_from_stock ( GTK_STOCK_JUSTIFY_FILL, GTK_ICON_SIZE_LARGE_TOOLBAR ); GtkWidget *b = gtk_radio_button_new (gtk_radio_button_group (GTK_RADIO_BUTTON (group))); - gtk_tooltips_set_tip (tt, b, _("Justify lines"), NULL); + gtk_widget_set_tooltip_text (b, _("Justify lines")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (b), "toggled", G_CALLBACK (sp_text_edit_dialog_any_toggled), dlg ); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); @@ -305,7 +303,7 @@ sp_text_edit_dialog (void) GtkWidget *px = sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL ); GtkWidget *b = group = gtk_radio_button_new (NULL); - gtk_tooltips_set_tip (tt, b, _("Horizontal text"), NULL); + gtk_widget_set_tooltip_text (b, _("Horizontal text")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (b), "toggled", G_CALLBACK (sp_text_edit_dialog_any_toggled), dlg ); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); @@ -319,7 +317,7 @@ sp_text_edit_dialog (void) GtkWidget *px = sp_icon_new( Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_VERTICAL ); GtkWidget *b = gtk_radio_button_new (gtk_radio_button_group (GTK_RADIO_BUTTON (group))); - gtk_tooltips_set_tip (tt, b, _("Vertical text"), NULL); + gtk_widget_set_tooltip_text (b, _("Vertical text")); gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE); g_signal_connect ( G_OBJECT (b), "toggled", G_CALLBACK (sp_text_edit_dialog_any_toggled), dlg ); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (b), FALSE); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index ddb419dcd..5fd306149 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -66,7 +66,6 @@ static Inkscape::MessageStack *_message_stack = NULL; static Inkscape::MessageContext *_message_context = NULL; static sigc::connection _message_changed_connection; -static GtkTooltips *tooltips = NULL; static GtkEditable *attr_name = NULL; static GtkTextView *attr_value = NULL; static SPXMLViewTree *tree = NULL; @@ -194,9 +193,6 @@ void sp_xml_tree_dialog() GtkWidget *text_container, *attr_container, *attr_subpaned_container, *box2; GtkWidget *set_attr; - tooltips = gtk_tooltips_new(); - gtk_tooltips_enable(tooltips); - dlg = sp_window_new("", TRUE); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (x == -1000 || y == -1000) { @@ -267,8 +263,8 @@ void sp_xml_tree_dialog() gtk_paned_pack1(GTK_PANED(paned), box, FALSE, FALSE); tree = SP_XMLVIEW_TREE(sp_xmlview_tree_new(NULL, NULL, NULL)); - gtk_tooltips_set_tip( tooltips, GTK_WIDGET(tree), - _("Drag to reorder nodes"), NULL ); + gtk_widget_set_tooltip_text( GTK_WIDGET(tree), + _("Drag to reorder nodes") ); g_signal_connect( G_OBJECT(tree), "tree_select_row", G_CALLBACK(on_tree_select_row), NULL ); @@ -495,9 +491,9 @@ void sp_xml_tree_dialog() FALSE, TRUE, 0); attr_name = GTK_EDITABLE(gtk_entry_new()); - gtk_tooltips_set_tip( tooltips, GTK_WIDGET(attr_name), + gtk_widget_set_tooltip_text( GTK_WIDGET(attr_name), // TRANSLATORS: "Attribute" is a noun here - _("Attribute name"), NULL ); + _("Attribute name") ); gtk_signal_connect( GTK_OBJECT(attributes), "select_row", (GCallback) on_attr_select_row_set_name_content, @@ -515,9 +511,9 @@ void sp_xml_tree_dialog() TRUE, TRUE, 0); set_attr = gtk_button_new(); - gtk_tooltips_set_tip( tooltips, GTK_WIDGET(set_attr), + gtk_widget_set_tooltip_text( GTK_WIDGET(set_attr), // TRANSLATORS: "Set" is a verb here - _("Set attribute"), NULL ); + _("Set attribute") ); // TRANSLATORS: "Set" is a verb here GtkWidget *set_label = gtk_label_new(_("Set")); gtk_container_add(GTK_CONTAINER(set_attr), set_label); @@ -540,9 +536,9 @@ void sp_xml_tree_dialog() attr_value =(GtkTextView *) gtk_text_view_new(); gtk_text_view_set_wrap_mode((GtkTextView *) attr_value, GTK_WRAP_CHAR); - gtk_tooltips_set_tip( tooltips, GTK_WIDGET(attr_value), + gtk_widget_set_tooltip_text( GTK_WIDGET(attr_value), // TRANSLATORS: "Attribute" is a noun here - _("Attribute value"), NULL ); + _("Attribute value") ); gtk_signal_connect( GTK_OBJECT(attributes), "select_row", (GCallback) on_attr_select_row_set_value_content, attr_value ); @@ -895,8 +891,6 @@ void after_tree_move(GtkCTree */*tree*/, static void on_destroy(GtkObject */*object*/, gpointer /*data*/) { set_tree_desktop(NULL); - gtk_object_destroy(GTK_OBJECT(tooltips)); - tooltips = NULL; sp_signal_disconnect_by_data(INKSCAPE, dlg); wd.win = dlg = NULL; wd.stop = 0; diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index f6df395b9..6b0ffd1ab 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -103,7 +103,6 @@ struct _EgeAdjustmentDescr struct _EgeAdjustmentActionPrivate { GtkAdjustment* adj; - GtkTooltips* toolTips; GtkWidget* focusWidget; gdouble climbRate; guint digits; @@ -275,7 +274,6 @@ static void ege_adjustment_action_init( EgeAdjustmentAction* action ) { action->private_data = EGE_ADJUSTMENT_ACTION_GET_PRIVATE( action ); action->private_data->adj = 0; - action->private_data->toolTips = 0; action->private_data->focusWidget = 0; action->private_data->climbRate = 0.0; action->private_data->digits = 2; @@ -852,10 +850,7 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_object_get_property( G_OBJECT(action), "tooltip", &tooltip ); const gchar* tipstr = g_value_get_string( &tooltip ); if ( tipstr && *tipstr ) { - if ( !act->private_data->toolTips ) { - act->private_data->toolTips = gtk_tooltips_new(); - } - gtk_tooltips_set_tip( act->private_data->toolTips, spinbutton, tipstr, 0 ); + gtk_widget_set_tooltip_text( spinbutton, tipstr ); } g_value_unset( &tooltip ); } diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 2fd45e268..ea08f1c06 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -652,7 +652,6 @@ GtkWidget* create_tool_item( GtkAction* action ) GtkTreeIter iter; gboolean valid = FALSE; gint index = 0; - GtkTooltips* tooltips = gtk_tooltips_new(); { gchar* sss = 0; @@ -737,7 +736,7 @@ GtkWidget* create_tool_item( GtkAction* action ) sub = gtk_action_create_tool_item( GTK_ACTION(ract) ); gtk_action_connect_proxy( GTK_ACTION(ract), sub ); - gtk_tool_item_set_tooltip( GTK_TOOL_ITEM(sub), tooltips, tip, NULL ); + gtk_tool_item_set_tooltip_text( GTK_TOOL_ITEM(sub), tip ); gtk_box_pack_start( GTK_BOX(holder), sub, FALSE, FALSE, 0 ); @@ -750,7 +749,6 @@ GtkWidget* create_tool_item( GtkAction* action ) } g_object_set_data( G_OBJECT(holder), "ege-proxy_action-group", group ); - g_object_set_data( G_OBJECT(holder), "ege-tooltips", tooltips ); gtk_container_add( GTK_CONTAINER(item), holder ); } else { diff --git a/src/libgdl/gdl-dock-bar.c b/src/libgdl/gdl-dock-bar.c index c4882e7ad..37710b693 100644 --- a/src/libgdl/gdl-dock-bar.c +++ b/src/libgdl/gdl-dock-bar.c @@ -65,7 +65,6 @@ static void gdl_dock_bar_remove_item (GdlDockBar *dockbar, struct _GdlDockBarPrivate { GdlDockMaster *master; GSList *items; - GtkTooltips *tooltips; GtkOrientation orientation; GdlDockBarStyle dockbar_style; }; @@ -130,11 +129,8 @@ gdl_dock_bar_instance_init (GdlDockBar *dockbar) dockbar->_priv = g_new0 (GdlDockBarPrivate, 1); dockbar->_priv->master = NULL; dockbar->_priv->items = NULL; - dockbar->_priv->tooltips = gtk_tooltips_new (); dockbar->_priv->orientation = GTK_ORIENTATION_VERTICAL; dockbar->_priv->dockbar_style = GDL_DOCK_BAR_BOTH; - g_object_ref (dockbar->_priv->tooltips); - gtk_object_sink (GTK_OBJECT (dockbar->_priv->tooltips)); } static void @@ -208,11 +204,6 @@ gdl_dock_bar_destroy (GtkObject *object) priv->master = NULL; } - if (priv->tooltips) { - g_object_unref (priv->tooltips); - priv->tooltips = NULL; - } - dockbar->_priv = NULL; g_free (priv); @@ -334,7 +325,7 @@ gdl_dock_bar_add_item (GdlDockBar *dockbar, gtk_container_add (GTK_CONTAINER (button), box); gtk_box_pack_start (GTK_BOX (dockbar), button, FALSE, FALSE, 0); - gtk_tooltips_set_tip (priv->tooltips, button, name, name); + gtk_widget_set_tooltip_text (button, name); g_free (name); g_object_set_data (G_OBJECT (item), "GdlDockBar", dockbar); diff --git a/src/libgdl/gdl-dock-item-grip.c b/src/libgdl/gdl-dock-item-grip.c index 6457016de..de09fc150 100644 --- a/src/libgdl/gdl-dock-item-grip.c +++ b/src/libgdl/gdl-dock-item-grip.c @@ -33,7 +33,6 @@ enum { struct _GdlDockItemGripPrivate { GtkWidget *close_button; GtkWidget *iconify_button; - GtkTooltips *tooltips; gboolean icon_pixbuf_valid; GdkPixbuf *icon_pixbuf; @@ -264,11 +263,6 @@ gdl_dock_item_grip_destroy (GtkObject *object) priv->icon_pixbuf = NULL; } - if (priv->tooltips) { - g_object_unref (priv->tooltips); - priv->tooltips = NULL; - } - if (grip->item) g_signal_handlers_disconnect_by_func (grip->item, gdl_dock_item_grip_item_notify, @@ -386,13 +380,10 @@ gdl_dock_item_grip_instance_init (GdlDockItemGrip *grip) g_signal_connect (G_OBJECT (grip->_priv->iconify_button), "clicked", G_CALLBACK (gdl_dock_item_grip_iconify_clicked), grip); - grip->_priv->tooltips = gtk_tooltips_new (); - g_object_ref (grip->_priv->tooltips); - gtk_object_sink (GTK_OBJECT (grip->_priv->tooltips)); - gtk_tooltips_set_tip (grip->_priv->tooltips, grip->_priv->iconify_button, - _("Iconify"), _("Iconify this dock")); - gtk_tooltips_set_tip (grip->_priv->tooltips, grip->_priv->close_button, - _("Close"), _("Close this dock")); + gtk_widget_set_tooltip_text (grip->_priv->iconify_button, + _("Iconify")); + gtk_widget_set_tooltip_text (grip->_priv->close_button, + _("Close")); } static void diff --git a/src/libgdl/gdl-switcher.c b/src/libgdl/gdl-switcher.c index c5e139e70..aaddc6d80 100644 --- a/src/libgdl/gdl-switcher.c +++ b/src/libgdl/gdl-switcher.c @@ -74,7 +74,6 @@ typedef struct { GtkWidget *icon; GtkWidget *arrow; GtkWidget *hbox; - GtkTooltips *tooltips; int id; } Button; @@ -103,7 +102,7 @@ GDL_CLASS_BOILERPLATE (GdlSwitcher, gdl_switcher, GtkNotebook, GTK_TYPE_NOTEBOOK static Button * button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, - GtkTooltips *tooltips, GtkWidget *arrow, GtkWidget *hbox, int id) + GtkWidget *arrow, GtkWidget *hbox, int id) { Button *button = g_new (Button, 1); @@ -112,7 +111,6 @@ button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, button->icon = icon; button->arrow = arrow; button->hbox = hbox; - button->tooltips = tooltips; button->id = id; g_object_ref (button_widget); @@ -120,7 +118,6 @@ button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, g_object_ref (icon); g_object_ref (arrow); g_object_ref (hbox); - g_object_ref (tooltips); return button; } @@ -132,7 +129,6 @@ button_free (Button *button) g_object_unref (button->label); g_object_unref (button->icon); g_object_unref (button->hbox); - g_object_unref (button->tooltips); g_free (button); } @@ -750,7 +746,6 @@ gdl_switcher_add_button (GdlSwitcher *switcher, const gchar *label, GtkWidget *icon_widget; GtkWidget *label_widget; GtkWidget *arrow; - GtkTooltips *button_tooltips; button_widget = gtk_toggle_button_new (); if (switcher->priv->show) @@ -781,24 +776,19 @@ gdl_switcher_add_button (GdlSwitcher *switcher, const gchar *label, } gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5); gtk_widget_show (label_widget); - button_tooltips = gtk_tooltips_new(); - gtk_tooltips_set_tip (GTK_TOOLTIPS (button_tooltips), button_widget, - tooltips, NULL); + gtk_widget_set_tooltip_text (button_widget, tooltips); switch (INTERNAL_MODE (switcher)) { case GDL_SWITCHER_STYLE_TEXT: gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0); - gtk_tooltips_disable (button_tooltips); break; case GDL_SWITCHER_STYLE_ICON: gtk_box_pack_start (GTK_BOX (hbox), icon_widget, TRUE, TRUE, 0); - gtk_tooltips_enable (button_tooltips); break; case GDL_SWITCHER_STYLE_BOTH: default: gtk_box_pack_start (GTK_BOX (hbox), icon_widget, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), label_widget, TRUE, TRUE, 0); - gtk_tooltips_disable (button_tooltips); break; } arrow = gtk_arrow_new (GTK_ARROW_UP, GTK_SHADOW_NONE); @@ -808,7 +798,7 @@ gdl_switcher_add_button (GdlSwitcher *switcher, const gchar *label, switcher->priv->buttons = g_slist_append (switcher->priv->buttons, button_new (button_widget, label_widget, - icon_widget, button_tooltips, + icon_widget, arrow, hbox, switcher_id)); gtk_widget_set_parent (button_widget, GTK_WIDGET (switcher)); @@ -901,7 +891,6 @@ set_switcher_style_internal (GdlSwitcher *switcher, gtk_box_pack_start (GTK_BOX (button->hbox), button->label, TRUE, TRUE, 0); gtk_widget_show (button->label); - gtk_tooltips_disable (button->tooltips); } break; case GDL_SWITCHER_STYLE_ICON: @@ -914,7 +903,6 @@ set_switcher_style_internal (GdlSwitcher *switcher, } else gtk_container_child_set (GTK_CONTAINER (button->hbox), button->icon, "expand", TRUE, NULL); - gtk_tooltips_enable (button->tooltips); break; case GDL_SWITCHER_STYLE_BOTH: if (INTERNAL_MODE (switcher) @@ -929,7 +917,6 @@ set_switcher_style_internal (GdlSwitcher *switcher, button->icon, "expand", FALSE, NULL); } - gtk_tooltips_disable (button->tooltips); gtk_box_pack_start (GTK_BOX (button->hbox), button->label, TRUE, TRUE, 0); gtk_widget_show (button->label); diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index dc830d096..9676651d3 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -46,7 +46,7 @@ static void sp_button_set_doubleclick_action (SPButton *button, SPAction *action static void sp_button_action_set_active (SPAction *action, unsigned int active, void *data); static void sp_button_action_set_sensitive (SPAction *action, unsigned int sensitive, void *data); static void sp_button_action_set_shortcut (SPAction *action, unsigned int shortcut, void *data); -static void sp_button_set_composed_tooltip (GtkTooltips *tooltips, GtkWidget *widget, SPAction *action); +static void sp_button_set_composed_tooltip (GtkWidget *widget, SPAction *action); static GtkToggleButtonClass *parent_class; SPActionEventVector button_event_vector = { @@ -98,7 +98,6 @@ sp_button_init (SPButton *button) { button->action = NULL; button->doubleclick_action = NULL; - button->tooltips = NULL; gtk_container_set_border_width (GTK_CONTAINER (button), 0); @@ -116,11 +115,6 @@ sp_button_destroy (GtkObject *object) button = SP_BUTTON (object); - if (button->tooltips) { - g_object_unref (G_OBJECT (button->tooltips)); - button->tooltips = NULL; - } - if (button->action) { sp_button_set_action (button, NULL); } @@ -186,7 +180,7 @@ sp_button_perform_action (SPButton *button, gpointer /*data*/) GtkWidget * -sp_button_new( Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action, GtkTooltips *tooltips ) +sp_button_new( Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action ) { SPButton *button; @@ -194,9 +188,6 @@ sp_button_new( Inkscape::IconSize size, SPButtonType type, SPAction *action, SPA button->type = type; button->lsize = CLAMP( size, Inkscape::ICON_SIZE_MENU, Inkscape::ICON_SIZE_DECORATION ); - button->tooltips = tooltips; - - if (tooltips) g_object_ref ((GObject *) tooltips); sp_button_set_action (button, action); if (doubleclick_action) @@ -253,9 +244,7 @@ sp_button_set_action (SPButton *button, SPAction *action) } } - if (button->tooltips) { - sp_button_set_composed_tooltip (button->tooltips, (GtkWidget *) button, action); - } + sp_button_set_composed_tooltip ((GtkWidget *) button, action); } static void @@ -283,12 +272,10 @@ static void sp_button_action_set_shortcut (SPAction *action, unsigned int /*shortcut*/, void *data) { SPButton *button=SP_BUTTON (data); - if (button->tooltips) { - sp_button_set_composed_tooltip (button->tooltips, GTK_WIDGET (button), action); - } + sp_button_set_composed_tooltip (GTK_WIDGET (button), action); } -static void sp_button_set_composed_tooltip(GtkTooltips *tooltips, GtkWidget *widget, SPAction *action) +static void sp_button_set_composed_tooltip(GtkWidget *widget, SPAction *action) { if (action) { unsigned int shortcut = sp_shortcut_get_primary (action->verb); @@ -298,16 +285,16 @@ static void sp_button_set_composed_tooltip(GtkTooltips *tooltips, GtkWidget *wid gchar *key = sp_shortcut_get_label(shortcut); gchar *tip = g_strdup_printf ("%s (%s)", action->tip, key); - gtk_tooltips_set_tip(tooltips, widget, tip, NULL); + gtk_widget_set_tooltip_text(widget, tip); g_free(tip); g_free(key); } else { // action has no shortcut - gtk_tooltips_set_tip(tooltips, widget, action->tip, NULL); + gtk_widget_set_tooltip_text(widget, action->tip); } } else { // no action - gtk_tooltips_set_tip(tooltips, widget, NULL, NULL); + gtk_widget_set_tooltip_text(widget, NULL); } } @@ -316,12 +303,11 @@ sp_button_new_from_data( Inkscape::IconSize size, SPButtonType type, Inkscape::UI::View::View *view, const gchar *name, - const gchar *tip, - GtkTooltips *tooltips ) + const gchar *tip ) { GtkWidget *button; SPAction *action=sp_action_new(view, name, name, tip, name, 0); - button = sp_button_new (size, type, action, NULL, tooltips); + button = sp_button_new (size, type, action, NULL); nr_object_unref ((NRObject *) action); return button; } diff --git a/src/widgets/button.h b/src/widgets/button.h index 26191f524..19a513074 100644 --- a/src/widgets/button.h +++ b/src/widgets/button.h @@ -38,7 +38,6 @@ struct SPButton { unsigned int psize; SPAction *action; SPAction *doubleclick_action; - GtkTooltips *tooltips; }; struct SPButtonClass { @@ -49,7 +48,7 @@ struct SPButtonClass { GType sp_button_get_type (void); -GtkWidget *sp_button_new (Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action, GtkTooltips *tooltips); +GtkWidget *sp_button_new (Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action); void sp_button_toggle_set_down (SPButton *button, gboolean down); @@ -57,8 +56,7 @@ GtkWidget *sp_button_new_from_data (Inkscape::IconSize size, SPButtonType type, Inkscape::UI::View::View *view, const gchar *name, - const gchar *tip, - GtkTooltips *tooltips); + const gchar *tip); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 9f0367665..1de82a315 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -236,7 +236,7 @@ SPDesktopWidget::setMessage (Inkscape::MessageType type, const gchar *message) gdk_window_process_updates(GTK_WIDGET(sb)->window, TRUE); } - gtk_tooltips_set_tip (this->tt, this->select_status_eventbox, gtk_label_get_text (sb) , NULL); + gtk_widget_set_tooltip_text (this->select_status_eventbox, gtk_label_get_text (sb)); } Geom::Point @@ -313,7 +313,6 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->window = 0; dtw->desktop = NULL; dtw->_interaction_disabled_counter = 0; - dtw->tt = gtk_tooltips_new (); /* Main table */ dtw->vbox = gtk_vbox_new (FALSE, 0); @@ -359,7 +358,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->hruler = sp_hruler_new (); dtw->hruler_box = eventbox; sp_ruler_set_metric (GTK_RULER (dtw->hruler), SP_PT); - gtk_tooltips_set_tip (dtw->tt, dtw->hruler_box, gettext(sp_unit_get_plural (&sp_unit_get_by_id(SP_UNIT_PT))), NULL); + gtk_widget_set_tooltip_text (dtw->hruler_box, gettext(sp_unit_get_plural (&sp_unit_get_by_id(SP_UNIT_PT)))); gtk_container_add (GTK_CONTAINER (eventbox), dtw->hruler); gtk_table_attach (GTK_TABLE (canvas_tbl), eventbox, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_FILL), widget->style->xthickness, 0); g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (sp_dt_hruler_event), dtw); @@ -371,7 +370,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->vruler = sp_vruler_new (); dtw->vruler_box = eventbox; sp_ruler_set_metric (GTK_RULER (dtw->vruler), SP_PT); - gtk_tooltips_set_tip (dtw->tt, dtw->vruler_box, gettext(sp_unit_get_plural (&sp_unit_get_by_id(SP_UNIT_PT))), NULL); + gtk_widget_set_tooltip_text (dtw->vruler_box, gettext(sp_unit_get_plural (&sp_unit_get_by_id(SP_UNIT_PT)))); gtk_container_add (GTK_CONTAINER (eventbox), GTK_WIDGET (dtw->vruler)); gtk_table_attach (GTK_TABLE (canvas_tbl), eventbox, 0, 1, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_FILL), 0, widget->style->ythickness); g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (sp_dt_vruler_event), dtw); @@ -389,8 +388,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) SP_BUTTON_TYPE_TOGGLE, NULL, INKSCAPE_ICON_ZOOM_ORIGINAL, - _("Zoom drawing if window size changes"), - dtw->tt); + _("Zoom drawing if window size changes")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dtw->sticky_zoom), prefs->getBool("/options/stickyzoom/value")); gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->sticky_zoom, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (dtw->sticky_zoom), "toggled", G_CALLBACK (sp_dtw_sticky_zoom_toggled), dtw); @@ -412,8 +410,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) SP_BUTTON_TYPE_TOGGLE, NULL, INKSCAPE_ICON_COLOR_MANAGEMENT, - tip, - dtw->tt ); + tip ); #if ENABLE_LCMS { Glib::ustring current = prefs->getString("/options/displayprofile/uri"); @@ -493,7 +490,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) // zoom status spinbutton dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1); - gtk_tooltips_set_tip (dtw->tt, dtw->zoom_status, _("Zoom"), NULL); + gtk_widget_set_tooltip_text (dtw->zoom_status, _("Zoom")); gtk_widget_set_size_request (dtw->zoom_status, STATUS_ZOOM_WIDTH, -1); gtk_entry_set_width_chars (GTK_ENTRY (dtw->zoom_status), 6); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (dtw->zoom_status), FALSE); @@ -513,7 +510,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_table_attach(GTK_TABLE(dtw->coord_status), gtk_vseparator_new(), 0,1, 0,2, GTK_FILL, GTK_FILL, 0, 0); eventbox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (eventbox), dtw->coord_status); - gtk_tooltips_set_tip (dtw->tt, eventbox, _("Cursor coordinates"), NULL); + gtk_widget_set_tooltip_text (eventbox, _("Cursor coordinates")); GtkWidget *label_x = gtk_label_new(_("X:")); gtk_misc_set_alignment (GTK_MISC(label_x), 0.0, 0.5); gtk_table_attach(GTK_TABLE(dtw->coord_status), label_x, 1,2, 0,1, GTK_FILL, GTK_FILL, 0, 0); @@ -1595,8 +1592,8 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) } // children } // if aux_toolbox is a container - gtk_tooltips_set_tip(this->tt, this->hruler_box, gettext(sp_unit_get_plural (nv->doc_units)), NULL); - gtk_tooltips_set_tip(this->tt, this->vruler_box, gettext(sp_unit_get_plural (nv->doc_units)), NULL); + gtk_widget_set_tooltip_text(this->hruler_box, gettext(sp_unit_get_plural (nv->doc_units))); + gtk_widget_set_tooltip_text(this->vruler_box, gettext(sp_unit_get_plural (nv->doc_units))); sp_desktop_widget_update_rulers(this); ToolboxFactory::updateSnapToolbox(this->desktop, 0, this->snap_toolbox); diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index c045d6e28..57ba71d8f 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -69,8 +69,6 @@ struct SPDesktopWidget { sigc::connection modified_connection; - GtkTooltips *tt; - SPDesktop *desktop; Gtk::Window *window; diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index 9a907e78b..3f07e09c8 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -133,7 +133,6 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) GtkWidget *hb = gtk_hbox_new( FALSE, 0 ); sel->nonsolid.push_back(hb); gtk_box_pack_start( GTK_BOX(sel), hb, FALSE, FALSE, 0 ); - GtkTooltips *ttips = gtk_tooltips_new (); sel->add = gtk_button_new_with_label (_("Duplicate")); sel->nonsolid.push_back(sel->add); @@ -159,12 +158,12 @@ static void sp_gradient_selector_init(SPGradientSelector *sel) sel->nonsolid.push_back(sel->spread); gtk_widget_show(sel->spread); gtk_box_pack_end( GTK_BOX(hb), sel->spread, FALSE, FALSE, 0 ); - gtk_tooltips_set_tip( ttips, sel->spread, + gtk_widget_set_tooltip_text( sel->spread, // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/pservers.html#LinearGradientSpreadMethodAttribute _("Whether to fill with flat color beyond the ends of the gradient vector " "(spreadMethod=\"pad\"), or repeat the gradient in the same direction " "(spreadMethod=\"repeat\"), or repeat the gradient in alternating opposite " - "directions (spreadMethod=\"reflect\")"), NULL); + "directions (spreadMethod=\"reflect\")")); GtkWidget *m = gtk_menu_new(); GtkWidget *mi = gtk_menu_item_new_with_label(_("none")); diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 64ed1e309..10e1fb95a 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -464,8 +464,6 @@ GtkWidget * gr_change_widget(SPDesktop *desktop) SPGradientSpread spr_selected = (SPGradientSpread) INT_MAX; // meaning undefined bool spr_multi = false; - GtkTooltips *tt = gtk_tooltips_new(); - gr_read_selection (selection, ev? ev->get_drag() : 0, gr_selected, gr_multi, spr_selected, spr_multi); GtkWidget *widget = gtk_hbox_new(FALSE, FALSE); @@ -484,7 +482,7 @@ GtkWidget * gr_change_widget(SPDesktop *desktop) { GtkWidget *hb = gtk_hbox_new(FALSE, 1); GtkWidget *b = gtk_button_new_with_label(_("Edit...")); - gtk_tooltips_set_tip(tt, b, _("Edit the stops of the gradient"), NULL); + gtk_widget_set_tooltip_text(b, _("Edit the stops of the gradient")); gtk_widget_show(b); gtk_container_add(GTK_CONTAINER(hb), b); gtk_signal_connect(GTK_OBJECT(b), "clicked", GTK_SIGNAL_FUNC(gr_edit), widget); @@ -542,8 +540,6 @@ sp_gradient_toolbox_new(SPDesktop *desktop) gtk_object_set_data(GTK_OBJECT(tbl), "dtw", desktop->canvas); gtk_object_set_data(GTK_OBJECT(tbl), "desktop", desktop); - GtkTooltips *tt = gtk_tooltips_new(); - sp_toolbox_add_label(tbl, _("<b>New:</b>")); // TODO replace aux_toolbox_space(tbl, AUX_SPACING); @@ -557,8 +553,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) SP_BUTTON_TYPE_TOGGLE, NULL, INKSCAPE_ICON_PAINT_GRADIENT_LINEAR, - _("Create linear gradient"), - tt); + _("Create linear gradient") ); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_type), tbl); g_object_set_data(G_OBJECT(tbl), "linear", button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), @@ -571,8 +566,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) SP_BUTTON_TYPE_TOGGLE, NULL, INKSCAPE_ICON_PAINT_GRADIENT_RADIAL, - _("Create radial (elliptic or circular) gradient"), - tt); + _("Create radial (elliptic or circular) gradient")); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_type), tbl); g_object_set_data(G_OBJECT(tbl), "radial", button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), @@ -599,8 +593,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) SP_BUTTON_TYPE_TOGGLE, NULL, INKSCAPE_ICON_OBJECT_FILL, - _("Create gradient in the fill"), - tt); + _("Create gradient in the fill")); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_fillstroke), tbl); g_object_set_data(G_OBJECT(tbl), "fill", button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), @@ -613,8 +606,7 @@ sp_gradient_toolbox_new(SPDesktop *desktop) SP_BUTTON_TYPE_TOGGLE, NULL, INKSCAPE_ICON_OBJECT_STROKE, - _("Create gradient in the stroke"), - tt); + _("Create gradient in the stroke")); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (gr_toggle_fillstroke), tbl); g_object_set_data(G_OBJECT(tbl), "stroke", button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 8ef0ee313..9aa414ab6 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -788,7 +788,6 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s gtk_box_pack_start(GTK_BOX(vb), w, TRUE, TRUE, PAD); sp_repr_add_listener(gradient->getRepr(), &grad_edit_dia_repr_events, vb); - GtkTooltips *tt = gtk_tooltips_new(); /* Stop list */ GtkWidget *mnu = gtk_option_menu_new(); @@ -805,12 +804,12 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s GtkWidget *b = gtk_button_new_with_label(_("Add stop")); gtk_widget_show(b); gtk_container_add(GTK_CONTAINER(hb), b); - gtk_tooltips_set_tip(tt, b, _("Add another control stop to gradient"), NULL); + gtk_widget_set_tooltip_text(b, _("Add another control stop to gradient")); gtk_signal_connect(GTK_OBJECT(b), "clicked", GTK_SIGNAL_FUNC(sp_grd_ed_add_stop), vb); b = gtk_button_new_with_label(_("Delete stop")); gtk_widget_show(b); gtk_container_add(GTK_CONTAINER(hb), b); - gtk_tooltips_set_tip(tt, b, _("Delete current control stop from gradient"), NULL); + gtk_widget_set_tooltip_text(b, _("Delete current control stop from gradient")); gtk_signal_connect(GTK_OBJECT(b), "clicked", GTK_SIGNAL_FUNC(sp_grd_ed_del_stop), vb); gtk_widget_show(hb); diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 610930a46..631675ede 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -71,7 +71,7 @@ static void sp_paint_selector_class_init(SPPaintSelectorClass *klass); static void sp_paint_selector_init(SPPaintSelector *slider); static void sp_paint_selector_destroy(GtkObject *object); -static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gchar const *px, SPPaintSelector::Mode mode, GtkTooltips *tt, gchar const *tip); +static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gchar const *px, SPPaintSelector::Mode mode, gchar const *tip); static void sp_paint_selector_style_button_toggled(GtkToggleButton *tb, SPPaintSelector *psel); static void sp_paint_selector_fillrule_toggled(GtkToggleButton *tb, SPPaintSelector *psel); @@ -210,8 +210,6 @@ sp_paint_selector_class_init(SPPaintSelectorClass *klass) static void sp_paint_selector_init(SPPaintSelector *psel) { - GtkTooltips *tt = gtk_tooltips_new(); - psel->mode = static_cast<SPPaintSelector::Mode>(-1); // huh? do you mean 0xff? -- I think this means "not in the enum" /* Paint style button box */ @@ -222,19 +220,19 @@ sp_paint_selector_init(SPPaintSelector *psel) /* Buttons */ psel->none = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_NONE, - SPPaintSelector::MODE_NONE, tt, _("No paint")); + SPPaintSelector::MODE_NONE, _("No paint")); psel->solid = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_SOLID, - SPPaintSelector::MODE_COLOR_RGB, tt, _("Flat color")); + SPPaintSelector::MODE_COLOR_RGB, _("Flat color")); psel->gradient = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_GRADIENT_LINEAR, - SPPaintSelector::MODE_GRADIENT_LINEAR, tt, _("Linear gradient")); + SPPaintSelector::MODE_GRADIENT_LINEAR, _("Linear gradient")); psel->radial = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_GRADIENT_RADIAL, - SPPaintSelector::MODE_GRADIENT_RADIAL, tt, _("Radial gradient")); + SPPaintSelector::MODE_GRADIENT_RADIAL, _("Radial gradient")); psel->pattern = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_PATTERN, - SPPaintSelector::MODE_PATTERN, tt, _("Pattern")); + SPPaintSelector::MODE_PATTERN, _("Pattern")); psel->swatch = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_SWATCH, - SPPaintSelector::MODE_SWATCH, tt, _("Swatch")); + SPPaintSelector::MODE_SWATCH, _("Swatch")); psel->unset = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON_PAINT_UNKNOWN, - SPPaintSelector::MODE_UNSET, tt, _("Unset paint (make it undefined so it can be inherited)")); + SPPaintSelector::MODE_UNSET, _("Unset paint (make it undefined so it can be inherited)")); /* Fillrule */ { @@ -246,7 +244,7 @@ sp_paint_selector_init(SPPaintSelector *psel) gtk_button_set_relief(GTK_BUTTON(psel->evenodd), GTK_RELIEF_NONE); gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(psel->evenodd), FALSE); // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty - gtk_tooltips_set_tip(tt, psel->evenodd, _("Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)"), NULL); + gtk_widget_set_tooltip_text(psel->evenodd, _("Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)")); gtk_object_set_data(GTK_OBJECT(psel->evenodd), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_EVENODD)); w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_EVEN_ODD); gtk_container_add(GTK_CONTAINER(psel->evenodd), w); @@ -257,7 +255,7 @@ sp_paint_selector_init(SPPaintSelector *psel) gtk_button_set_relief(GTK_BUTTON(psel->nonzero), GTK_RELIEF_NONE); gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(psel->nonzero), FALSE); // TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty - gtk_tooltips_set_tip(tt, psel->nonzero, _("Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)"), NULL); + gtk_widget_set_tooltip_text(psel->nonzero, _("Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)")); gtk_object_set_data(GTK_OBJECT(psel->nonzero), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_NONZERO)); w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_NONZERO); gtk_container_add(GTK_CONTAINER(psel->nonzero), w); @@ -290,12 +288,12 @@ sp_paint_selector_destroy(GtkObject *object) static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gchar const *pixmap, SPPaintSelector::Mode mode, - GtkTooltips *tt, gchar const *tip) + gchar const *tip) { GtkWidget *b, *w; b = gtk_toggle_button_new(); - gtk_tooltips_set_tip(tt, b, tip, NULL); + gtk_widget_set_tooltip_text(b, tip); gtk_widget_show(b); gtk_container_set_border_width(GTK_CONTAINER(b), 0); diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 72134c48f..0bae54655 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -137,8 +137,7 @@ ColorICCSelector::ColorICCSelector( SPColorSelector* csel ) _fooMap(0), _adj(0), _sbtn(0), - _label(0), - _tt(0) + _label(0) #if ENABLE_LCMS , _profileName(""), @@ -270,8 +269,6 @@ void ColorICCSelector::init() _updating = FALSE; _dragging = FALSE; - _tt = gtk_tooltips_new(); - t = gtk_table_new (5, 3, FALSE); gtk_widget_show (t); gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 0); @@ -290,7 +287,7 @@ void ColorICCSelector::init() _fixupBtn = gtk_button_new_with_label(_("Fix")); g_signal_connect( G_OBJECT(_fixupBtn), "clicked", G_CALLBACK(_fixupHit), (gpointer)this ); gtk_widget_set_sensitive( _fixupBtn, FALSE ); - gtk_tooltips_set_tip( _tt, _fixupBtn, _("Fix RGB fallback to match icc-color() value."), NULL ); + gtk_widget_set_tooltip_text( _fixupBtn, _("Fix RGB fallback to match icc-color() value.") ); //gtk_misc_set_alignment( GTK_MISC (_fixupBtn), 1.0, 0.5 ); gtk_widget_show( _fixupBtn ); gtk_table_attach( GTK_TABLE (t), _fixupBtn, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); @@ -338,18 +335,18 @@ void ColorICCSelector::init() /* Slider */ _fooSlider[i] = sp_color_slider_new( _fooAdj[i] ); #if ENABLE_LCMS - gtk_tooltips_set_tip( _tt, _fooSlider[i], tips[i], NULL ); + gtk_widget_set_tooltip_text( _fooSlider[i], tips[i] ); #else - gtk_tooltips_set_tip( _tt, _fooSlider[i], ".", NULL ); + gtk_widget_set_tooltip_text( _fooSlider[i], "." ); #endif // ENABLE_LCMS gtk_widget_show( _fooSlider[i] ); gtk_table_attach( GTK_TABLE (t), _fooSlider[i], 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)GTK_FILL, XPAD, YPAD ); _fooBtn[i] = gtk_spin_button_new( _fooAdj[i], step, digits ); #if ENABLE_LCMS - gtk_tooltips_set_tip( _tt, _fooBtn[i], tips[i], NULL ); + gtk_widget_set_tooltip_text( _fooBtn[i], tips[i] ); #else - gtk_tooltips_set_tip( _tt, _fooBtn[i], ".", NULL ); + gtk_widget_set_tooltip_text( _fooBtn[i], "." ); #endif // ENABLE_LCMS sp_dialog_defocus_on_enter( _fooBtn[i] ); gtk_label_set_mnemonic_widget( GTK_LABEL(_fooLabel[i]), _fooBtn[i] ); @@ -381,7 +378,7 @@ void ColorICCSelector::init() /* Slider */ _slider = sp_color_slider_new (_adj); - gtk_tooltips_set_tip (_tt, _slider, _("Alpha (opacity)"), NULL); + gtk_widget_set_tooltip_text (_slider, _("Alpha (opacity)")); gtk_widget_show (_slider); gtk_table_attach (GTK_TABLE (t), _slider, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)GTK_FILL, XPAD, YPAD); @@ -393,7 +390,7 @@ void ColorICCSelector::init() /* Spinbutton */ _sbtn = gtk_spin_button_new (GTK_ADJUSTMENT (_adj), 1.0, 0); - gtk_tooltips_set_tip (_tt, _sbtn, _("Alpha (opacity)"), NULL); + gtk_widget_set_tooltip_text (_sbtn, _("Alpha (opacity)")); sp_dialog_defocus_on_enter (_sbtn); gtk_label_set_mnemonic_widget (GTK_LABEL(_label), _sbtn); gtk_widget_show (_sbtn); @@ -694,8 +691,8 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile ) for ( guint i = 0; i < _profChannelCount; i++ ) { gtk_label_set_text_with_mnemonic( GTK_LABEL(_fooLabel[i]), names[i]); - gtk_tooltips_set_tip( _tt, _fooSlider[i], tips[i], NULL ); - gtk_tooltips_set_tip( _tt, _fooBtn[i], tips[i], NULL ); + gtk_widget_set_tooltip_text( _fooSlider[i], tips[i] ); + gtk_widget_set_tooltip_text( _fooBtn[i], tips[i] ); sp_color_slider_set_colors( SP_COLOR_SLIDER(_fooSlider[i]), SPColor(0.0, 0.0, 0.0).toRGBA32(0xff), diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index f40d93189..b0efa35f4 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -66,8 +66,6 @@ protected: GtkWidget* _sbtn; /* Spinbutton */ GtkWidget* _label; /* Label */ - GtkTooltips* _tt; /* tooltip container */ - #if ENABLE_LCMS std::string _profileName; Inkscape::ColorProfile* _prof; diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 174971555..4c2c03e8a 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -203,8 +203,6 @@ void ColorNotebook::init() GType *selector_types = 0; guint selector_type_count = 0; - GtkTooltips *tt = gtk_tooltips_new (); - /* tempory hardcoding to get types loaded */ SP_TYPE_COLOR_SCALES; SP_TYPE_COLOR_WHEEL_SELECTOR; @@ -336,24 +334,21 @@ void ColorNotebook::init() _box_colormanaged = gtk_event_box_new (); GtkWidget *colormanaged = gtk_image_new_from_icon_name ("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_container_add (GTK_CONTAINER (_box_colormanaged), colormanaged); - GtkTooltips *tooltips_colormanaged = gtk_tooltips_new (); - gtk_tooltips_set_tip (tooltips_colormanaged, _box_colormanaged, _("Color Managed"), ""); + gtk_widget_set_tooltip_text (_box_colormanaged, _("Color Managed")); gtk_widget_set_sensitive (_box_colormanaged, false); gtk_box_pack_start(GTK_BOX(rgbabox), _box_colormanaged, FALSE, FALSE, 2); _box_outofgamut = gtk_event_box_new (); GtkWidget *outofgamut = gtk_image_new_from_icon_name ("out-of-gamut-icon", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_container_add (GTK_CONTAINER (_box_outofgamut), outofgamut); - GtkTooltips *tooltips_outofgamut = gtk_tooltips_new (); - gtk_tooltips_set_tip (tooltips_outofgamut, _box_outofgamut, _("Out of gamut!"), ""); + gtk_widget_set_tooltip_text (_box_outofgamut, _("Out of gamut!")); gtk_widget_set_sensitive (_box_outofgamut, false); gtk_box_pack_start(GTK_BOX(rgbabox), _box_outofgamut, FALSE, FALSE, 2); _box_toomuchink = gtk_event_box_new (); GtkWidget *toomuchink = gtk_image_new_from_icon_name ("too-much-ink-icon", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_container_add (GTK_CONTAINER (_box_toomuchink), toomuchink); - GtkTooltips *tooltips_toomuchink = gtk_tooltips_new (); - gtk_tooltips_set_tip (tooltips_toomuchink, _box_toomuchink, _("Too much ink!"), ""); + gtk_widget_set_tooltip_text (_box_toomuchink, _("Too much ink!")); gtk_widget_set_sensitive (_box_toomuchink, false); gtk_box_pack_start(GTK_BOX(rgbabox), _box_toomuchink, FALSE, FALSE, 2); @@ -368,7 +363,7 @@ void ColorNotebook::init() sp_dialog_defocus_on_enter (_rgbae); gtk_entry_set_max_length (GTK_ENTRY (_rgbae), 8); gtk_entry_set_width_chars (GTK_ENTRY (_rgbae), 8); - gtk_tooltips_set_tip (tt, _rgbae, _("Hexadecimal RGBA value of the color"), NULL); + gtk_widget_set_tooltip_text (_rgbae, _("Hexadecimal RGBA value of the color")); gtk_box_pack_start(GTK_BOX(rgbabox), _rgbae, FALSE, FALSE, 0); gtk_label_set_mnemonic_widget (GTK_LABEL(_rgbal), _rgbae); diff --git a/src/widgets/sp-color-scales.cpp b/src/widgets/sp-color-scales.cpp index fb8bb0795..001b54752 100644 --- a/src/widgets/sp-color-scales.cpp +++ b/src/widgets/sp-color-scales.cpp @@ -140,8 +140,6 @@ void ColorScales::init() _updating = FALSE; _dragging = FALSE; - _tt = gtk_tooltips_new(); - t = gtk_table_new (5, 3, FALSE); gtk_widget_show (t); gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 0); @@ -402,17 +400,17 @@ void ColorScales::setMode(SPColorScalesMode mode) case SP_COLOR_SCALES_MODE_RGB: _setRangeLimit(255.0); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_R:")); - gtk_tooltips_set_tip (_tt, _s[0], _("Red"), NULL); - gtk_tooltips_set_tip (_tt, _b[0], _("Red"), NULL); + gtk_widget_set_tooltip_text (_s[0], _("Red")); + gtk_widget_set_tooltip_text (_b[0], _("Red")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_G:")); - gtk_tooltips_set_tip (_tt, _s[1], _("Green"), NULL); - gtk_tooltips_set_tip (_tt, _b[1], _("Green"), NULL); + gtk_widget_set_tooltip_text (_s[1], _("Green")); + gtk_widget_set_tooltip_text (_b[1], _("Green")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_B:")); - gtk_tooltips_set_tip (_tt, _s[2], _("Blue"), NULL); - gtk_tooltips_set_tip (_tt, _b[2], _("Blue"), NULL); + gtk_widget_set_tooltip_text (_s[2], _("Blue")); + gtk_widget_set_tooltip_text (_b[2], _("Blue")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_A:")); - gtk_tooltips_set_tip (_tt, _s[3], _("Alpha (opacity)"), NULL); - gtk_tooltips_set_tip (_tt, _b[3], _("Alpha (opacity)"), NULL); + gtk_widget_set_tooltip_text (_s[3], _("Alpha (opacity)")); + gtk_widget_set_tooltip_text (_b[3], _("Alpha (opacity)")); sp_color_slider_set_map (SP_COLOR_SLIDER (_s[0]), NULL); gtk_widget_hide (_l[4]); gtk_widget_hide (_s[4]); @@ -428,17 +426,17 @@ void ColorScales::setMode(SPColorScalesMode mode) case SP_COLOR_SCALES_MODE_HSV: _setRangeLimit(255.0); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_H:")); - gtk_tooltips_set_tip (_tt, _s[0], _("Hue"), NULL); - gtk_tooltips_set_tip (_tt, _b[0], _("Hue"), NULL); + gtk_widget_set_tooltip_text (_s[0], _("Hue")); + gtk_widget_set_tooltip_text (_b[0], _("Hue")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_S:")); - gtk_tooltips_set_tip (_tt, _s[1], _("Saturation"), NULL); - gtk_tooltips_set_tip (_tt, _b[1], _("Saturation"), NULL); + gtk_widget_set_tooltip_text (_s[1], _("Saturation")); + gtk_widget_set_tooltip_text (_b[1], _("Saturation")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_L:")); - gtk_tooltips_set_tip (_tt, _s[2], _("Lightness"), NULL); - gtk_tooltips_set_tip (_tt, _b[2], _("Lightness"), NULL); + gtk_widget_set_tooltip_text (_s[2], _("Lightness")); + gtk_widget_set_tooltip_text (_b[2], _("Lightness")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_A:")); - gtk_tooltips_set_tip (_tt, _s[3], _("Alpha (opacity)"), NULL); - gtk_tooltips_set_tip (_tt, _b[3], _("Alpha (opacity)"), NULL); + gtk_widget_set_tooltip_text (_s[3], _("Alpha (opacity)")); + gtk_widget_set_tooltip_text (_b[3], _("Alpha (opacity)")); sp_color_slider_set_map (SP_COLOR_SLIDER (_s[0]), (guchar*)sp_color_scales_hue_map ()); gtk_widget_hide (_l[4]); gtk_widget_hide (_s[4]); @@ -456,20 +454,20 @@ void ColorScales::setMode(SPColorScalesMode mode) case SP_COLOR_SCALES_MODE_CMYK: _setRangeLimit(100.0); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[0]), _("_C:")); - gtk_tooltips_set_tip (_tt, _s[0], _("Cyan"), NULL); - gtk_tooltips_set_tip (_tt, _b[0], _("Cyan"), NULL); + gtk_widget_set_tooltip_text (_s[0], _("Cyan")); + gtk_widget_set_tooltip_text (_b[0], _("Cyan")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[1]), _("_M:")); - gtk_tooltips_set_tip (_tt, _s[1], _("Magenta"), NULL); - gtk_tooltips_set_tip (_tt, _b[1], _("Magenta"), NULL); + gtk_widget_set_tooltip_text (_s[1], _("Magenta")); + gtk_widget_set_tooltip_text (_b[1], _("Magenta")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[2]), _("_Y:")); - gtk_tooltips_set_tip (_tt, _s[2], _("Yellow"), NULL); - gtk_tooltips_set_tip (_tt, _b[2], _("Yellow"), NULL); + gtk_widget_set_tooltip_text (_s[2], _("Yellow")); + gtk_widget_set_tooltip_text (_b[2], _("Yellow")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[3]), _("_K:")); - gtk_tooltips_set_tip (_tt, _s[3], _("Black"), NULL); - gtk_tooltips_set_tip (_tt, _b[3], _("Black"), NULL); + gtk_widget_set_tooltip_text (_s[3], _("Black")); + gtk_widget_set_tooltip_text (_b[3], _("Black")); gtk_label_set_markup_with_mnemonic (GTK_LABEL (_l[4]), _("_A:")); - gtk_tooltips_set_tip (_tt, _s[4], _("Alpha (opacity)"), NULL); - gtk_tooltips_set_tip (_tt, _b[4], _("Alpha (opacity)"), NULL); + gtk_widget_set_tooltip_text (_s[4], _("Alpha (opacity)")); + gtk_widget_set_tooltip_text (_b[4], _("Alpha (opacity)")); sp_color_slider_set_map (SP_COLOR_SLIDER (_s[0]), NULL); gtk_widget_show (_l[4]); gtk_widget_show (_s[4]); diff --git a/src/widgets/sp-color-scales.h b/src/widgets/sp-color-scales.h index b50c386e8..798a920af 100644 --- a/src/widgets/sp-color-scales.h +++ b/src/widgets/sp-color-scales.h @@ -65,8 +65,6 @@ protected: GtkWidget *_b[5]; /* Spinbuttons */ GtkWidget *_l[5]; /* Labels */ - GtkTooltips *_tt; /* tooltip container */ - private: // By default, disallow copy constructor and assignment operator ColorScales(ColorScales const &obj); diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 147c91525..25ba250a7 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -152,8 +152,6 @@ void ColorWheelSelector::init() _updating = FALSE; _dragging = FALSE; - _tt = gtk_tooltips_new(); - t = gtk_table_new (5, 3, FALSE); gtk_widget_show (t); gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 0); @@ -179,7 +177,7 @@ void ColorWheelSelector::init() /* Slider */ _slider = sp_color_slider_new (_adj); - gtk_tooltips_set_tip (_tt, _slider, _("Alpha (opacity)"), NULL); + gtk_widget_set_tooltip_text (_slider, _("Alpha (opacity)")); gtk_widget_show (_slider); gtk_table_attach (GTK_TABLE (t), _slider, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)GTK_FILL, XPAD, YPAD); @@ -191,7 +189,7 @@ void ColorWheelSelector::init() /* Spinbutton */ _sbtn = gtk_spin_button_new (GTK_ADJUSTMENT (_adj), 1.0, 0); - gtk_tooltips_set_tip (_tt, _sbtn, _("Alpha (opacity)"), NULL); + gtk_widget_set_tooltip_text (_sbtn, _("Alpha (opacity)")); sp_dialog_defocus_on_enter (_sbtn); gtk_label_set_mnemonic_widget (GTK_LABEL(_label), _sbtn); gtk_widget_show (_sbtn); diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h index 6c8d2d12b..553f351a0 100644 --- a/src/widgets/sp-color-wheel-selector.h +++ b/src/widgets/sp-color-wheel-selector.h @@ -44,8 +44,6 @@ protected: GtkWidget* _sbtn; /* Spinbutton */ GtkWidget* _label; /* Label */ - GtkTooltips* _tt; /* tooltip container */ - private: // By default, disallow copy constructor and assignment operator ColorWheelSelector( const ColorWheelSelector& obj ); diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index 49e3a7495..aec1e2e11 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -92,10 +92,8 @@ GtkWidget *spw_vbox_checkbutton(GtkWidget *dialog, GtkWidget *vbox, g_assert (dialog != NULL); g_assert (vbox != NULL); - GtkTooltips *tt = gtk_tooltips_new (); - GtkWidget *b = gtk_check_button_new_with_label (label); - gtk_tooltips_set_tip(tt, b, tip, NULL); + gtk_widget_set_tooltip_text(b, tip); g_assert (b != NULL); gtk_widget_show (b); gtk_box_pack_start (GTK_BOX (vbox), b, FALSE, FALSE, 0); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 0dcecfcb1..238e5df7a 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -548,11 +548,11 @@ static void update_commands_toolbox(SPDesktop *desktop, SPEventContext *eventcon static GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick( GtkWidget *t, Inkscape::IconSize size, SPButtonType type, Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb, - Inkscape::UI::View::View *view, GtkTooltips *tt); + Inkscape::UI::View::View *view); class VerbAction : public Gtk::Action { public: - static Glib::RefPtr<VerbAction> create(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips); + static Glib::RefPtr<VerbAction> create(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view); virtual ~VerbAction(); virtual void set_active(bool active = true); @@ -570,31 +570,29 @@ private: Inkscape::Verb* verb; Inkscape::Verb* verb2; Inkscape::UI::View::View *view; - GtkTooltips *tooltips; bool active; - VerbAction(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips); + VerbAction(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view); }; -Glib::RefPtr<VerbAction> VerbAction::create(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips) +Glib::RefPtr<VerbAction> VerbAction::create(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view) { Glib::RefPtr<VerbAction> result; SPAction *action = verb->get_action(view); if ( action ) { //SPAction* action2 = verb2 ? verb2->get_action(view) : 0; - result = Glib::RefPtr<VerbAction>(new VerbAction(verb, verb2, view, tooltips)); + result = Glib::RefPtr<VerbAction>(new VerbAction(verb, verb2, view)); } return result; } -VerbAction::VerbAction(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view, GtkTooltips *tooltips) : +VerbAction::VerbAction(Inkscape::Verb* verb, Inkscape::Verb* verb2, Inkscape::UI::View::View *view) : Gtk::Action(Glib::ustring(verb->get_id()), Gtk::StockID(verb->get_image()), Glib::ustring(_(verb->get_name())), Glib::ustring(_(verb->get_tip()))), verb(verb), verb2(verb2), view(view), - tooltips(tooltips), active(false) { } @@ -624,8 +622,7 @@ Gtk::Widget* VerbAction::create_tool_item_vfunc() SP_BUTTON_TYPE_TOGGLE, verb, verb2, - view, - tooltips ); + view ); if ( active ) { sp_button_toggle_set_down( SP_BUTTON(button), active); } @@ -808,7 +805,7 @@ static void delete_prefspusher(GtkObject * /*obj*/, PrefPusher *watcher ) GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick(GtkWidget *t, Inkscape::IconSize size, SPButtonType type, Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb, - Inkscape::UI::View::View *view, GtkTooltips *tt) + Inkscape::UI::View::View *view) { SPAction *action = verb->get_action(view); if (!action) { @@ -824,7 +821,7 @@ GtkWidget * sp_toolbox_button_new_from_verb_with_doubleclick(GtkWidget *t, Inksc /* fixme: Handle sensitive/unsensitive */ /* fixme: Implement sp_button_new_from_action */ - GtkWidget *b = sp_button_new(size, type, action, doubleclick_action, tt); + GtkWidget *b = sp_button_new(size, type, action, doubleclick_action); gtk_widget_show(b); @@ -959,9 +956,8 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto } if ( !mainActions->get_action("ToolZoom") ) { - GtkTooltips *tt = gtk_tooltips_new(); for ( guint i = 0; i < G_N_ELEMENTS(tools) && tools[i].type_name; i++ ) { - Glib::RefPtr<VerbAction> va = VerbAction::create(Inkscape::Verb::get(tools[i].verb), Inkscape::Verb::get(tools[i].doubleclick_verb), view, tt); + Glib::RefPtr<VerbAction> va = VerbAction::create(Inkscape::Verb::get(tools[i].verb), Inkscape::Verb::get(tools[i].doubleclick_verb), view); if ( va ) { mainActions->add(va); if ( i == 0 ) { -- cgit v1.2.3 From 22b40932609acd551b39fd901a96cac84f994744 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" <jbc.engelen@swissonline.ch> Date: Sun, 5 Jun 2011 19:33:02 +0200 Subject: fix: latex width output to postscript big point 'bp'. Fixed bugs: - https://launchpad.net/bugs/792384 (bzr r10257) --- src/extension/internal/latex-text-renderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index cf7c48251..5d9fec905 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -10,7 +10,7 @@ * Jon A. Cruz <jon@joncruz.org> * Abhishek Sharma * - * Copyright (C) 2006-2010 Authors + * Copyright (C) 2006-2011 Authors * * Licensed under GNU GPL */ @@ -621,7 +621,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * // scaling of the image when including it in LaTeX os << " \\ifx\\svgwidth\\undefined%\n"; - os << " \\setlength{\\unitlength}{" << d->width() * PT_PER_PX << "pt}%\n"; + os << " \\setlength{\\unitlength}{" << d->width() * PT_PER_PX << "bp}%\n"; // note: 'bp' is the Postscript pt unit in LaTeX, see LP bug #792384 os << " \\ifx\\svgscale\\undefined%\n"; os << " \\relax%\n"; os << " \\else%\n"; -- cgit v1.2.3 From da2a6c9d0f013483a708cad53bb83c0d0766bd69 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Mon, 6 Jun 2011 20:21:21 -0300 Subject: Introducing our new nice measurement tool! :-D (bzr r10259) --- src/Makefile_insert | 3 +- src/measure-context.cpp | 237 +++++++++++++++++++++++++++++++++++ src/measure-context.h | 35 ++++++ src/tools-switch.cpp | 8 ++ src/tools-switch.h | 1 + src/ui/dialog/inkscape-preferences.h | 1 + src/ui/icon-names.h | 2 + src/verbs.cpp | 11 ++ src/verbs.h | 2 + src/widgets/toolbox.cpp | 15 ++- 10 files changed, 313 insertions(+), 2 deletions(-) create mode 100644 src/measure-context.cpp create mode 100644 src/measure-context.h (limited to 'src') diff --git a/src/Makefile_insert b/src/Makefile_insert index e7bf9715a..aadf9d404 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -251,7 +251,8 @@ ink_common_sources += \ vanishing-point.cpp vanishing-point.h \ verbs.cpp verbs.h \ version.cpp version.h \ - zoom-context.cpp zoom-context.h + zoom-context.cpp zoom-context.h \ + measure-context.cpp measure-context.h # Additional dependencies diff --git a/src/measure-context.cpp b/src/measure-context.cpp new file mode 100644 index 000000000..1e0339424 --- /dev/null +++ b/src/measure-context.cpp @@ -0,0 +1,237 @@ +/* + * Our nice measuring tool + * + * Authors: + * Felipe Correa da Silva Sanches <juca@members.fsf.org> + * + * Copyright (C) 2011 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + + +#include <gdk/gdkkeysyms.h> + +#include "macros.h" +#include "display/sp-ctrlline.h" +#include "display/sp-canvas-item.h" +#include "display/sp-canvas-util.h" +#include "desktop.h" +#include "pixmaps/cursor-measure.xpm" +#include "preferences.h" +#include "inkscape.h" +#include "desktop-handles.h" +#include "measure-context.h" +#include "display/canvas-text.h" + +static void sp_measure_context_class_init(SPMeasureContextClass *klass); +static void sp_measure_context_init(SPMeasureContext *measure_context); +static void sp_measure_context_setup(SPEventContext *ec); +static void sp_measure_context_finish (SPEventContext *ec); + +static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEvent *event); +static gint sp_measure_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event); + +static SPEventContextClass *parent_class; + +static gint xp = 0, yp = 0; // where drag started +static gint tolerance = 0; +static bool within_tolerance = false; +static SPCanvasItem * line = NULL; +Geom::Point start_point; +SPCanvasItem *measure_text = NULL; + +GType sp_measure_context_get_type(void) +{ + static GType type = 0; + + if (!type) { + GTypeInfo info = { + sizeof(SPMeasureContextClass), + NULL, NULL, + (GClassInitFunc) sp_measure_context_class_init, + NULL, NULL, + sizeof(SPMeasureContext), + 4, + (GInstanceInitFunc) sp_measure_context_init, + NULL, /* value_table */ + }; + type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPMeasureContext", &info, (GTypeFlags) 0); + } + + return type; +} + +static void sp_measure_context_class_init(SPMeasureContextClass *klass) +{ + SPEventContextClass *event_context_class = (SPEventContextClass *) klass; + + parent_class = (SPEventContextClass*) g_type_class_peek_parent(klass); + + event_context_class->setup = sp_measure_context_setup; + event_context_class->finish = sp_measure_context_finish; + + event_context_class->root_handler = sp_measure_context_root_handler; + event_context_class->item_handler = sp_measure_context_item_handler; +} + +static void sp_measure_context_init (SPMeasureContext *measure_context) +{ + SPEventContext *event_context = SP_EVENT_CONTEXT(measure_context); + + event_context->cursor_shape = cursor_measure_xpm; + event_context->hot_x = 3; + event_context->hot_y = 5; +} + +static void +sp_measure_context_finish (SPEventContext *ec) +{ + SPMeasureContext *mc = SP_MEASURE_CONTEXT(ec); + + ec->enableGrDrag(false); + + if (mc->grabbed) { + sp_canvas_item_ungrab(mc->grabbed, GDK_CURRENT_TIME); + mc->grabbed = NULL; + } +} + +static void sp_measure_context_setup(SPEventContext *ec) +{ + if (((SPEventContextClass *) parent_class)->setup) { + ((SPEventContextClass *) parent_class)->setup(ec); + } +} + +static gint sp_measure_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event) +{ + gint ret = FALSE; + + if (((SPEventContextClass *) parent_class)->item_handler) { + ret = ((SPEventContextClass *) parent_class)->item_handler (event_context, item, event); + } + + return ret; +} + +static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEvent *event) +{ + SPDesktop *desktop = event_context->desktop; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); + + SPMeasureContext *mc = SP_MEASURE_CONTEXT(event_context); + gint ret = FALSE; + + switch (event->type) { + case GDK_BUTTON_PRESS: + { + Geom::Point const button_w(event->button.x, event->button.y); + start_point = desktop->w2d(button_w); + if (event->button.button == 1 && !event_context->space_panning) { + // save drag origin + xp = (gint) event->button.x; + yp = (gint) event->button.y; + within_tolerance = true; + + ret = TRUE; + } + + if (!line){ + SPDesktop *desktop = inkscape_active_desktop(); + line = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLLINE, NULL); + } + + if (!measure_text){ + measure_text = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, start_point, ""); + SP_CANVASTEXT(measure_text)->rgba = 0x7f7f7fff; + sp_canvastext_set_anchor(SP_CANVASTEXT(measure_text), -1, 1);//why? + } + + sp_ctrlline_set_coords (SP_CTRLLINE(line), start_point, start_point); + sp_canvastext_set_text (SP_CANVASTEXT(measure_text), ""); + sp_canvas_item_show (line); + sp_canvas_item_show (measure_text); + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + mc->grabbed = SP_CANVAS_ITEM(desktop->acetate); + break; + } + + case GDK_MOTION_NOTIFY: + { + if (event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) { + ret = TRUE; + + if ( within_tolerance + && ( abs( (gint) event->motion.x - xp ) < tolerance ) + && ( abs( (gint) event->motion.y - yp ) < tolerance ) ) { + break; // do not drag if we're within tolerance from origin + } + // Once the user has moved farther than tolerance from the original location + // (indicating they intend to move the object, not click), then always process the + // motion notify coordinates as given (no snapping back to origin) + within_tolerance = false; + + Geom::Point const motion_w(event->motion.x, event->motion.y); + Geom::Point const motion_dt(desktop->w2d(motion_w)); + + sp_ctrlline_set_coords (SP_CTRLLINE(line), start_point[Geom::X], start_point[Geom::Y], motion_dt[Geom::X], motion_dt[Geom::Y]); + + Geom::Point measure_text_pos = (start_point + motion_dt)/2; + double length = (start_point - motion_dt).length(); + char* measure_str = (char*) malloc(sizeof(char)*20); + sprintf(measure_str, "%2f", length); + + sp_canvastext_set_coords (SP_CANVASTEXT(measure_text), desktop->dt2doc(measure_text_pos)); + sp_canvastext_set_text (SP_CANVASTEXT(measure_text), measure_str); + free(measure_str); + + gobble_motion_events(GDK_BUTTON1_MASK); + } + break; + } + + case GDK_BUTTON_RELEASE: + { + if (line){ + sp_canvas_item_hide(line); + } + + if (measure_text){ + sp_canvas_item_hide(measure_text); + } + + if (mc->grabbed) { + sp_canvas_item_ungrab(mc->grabbed, event->button.time); + mc->grabbed = NULL; + } + xp = yp = 0; + break; + } + default: + break; + } + + if (!ret) { + if (((SPEventContextClass *) parent_class)->root_handler) { + ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event); + } + } + + return ret; +} + +/* + 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 : diff --git a/src/measure-context.h b/src/measure-context.h new file mode 100644 index 000000000..f6065b3e6 --- /dev/null +++ b/src/measure-context.h @@ -0,0 +1,35 @@ +#ifndef __SP_MEASURING_CONTEXT_H__ +#define __SP_MEASURING_CONTEXT_H__ + +/* + * Our fine measuring tool + * + * Authors: + * Felipe Correa da Silva Sanches <juca@members.fsf.org> + * + * Copyright (C) 2011 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "event-context.h" + +#define SP_TYPE_MEASURE_CONTEXT (sp_measure_context_get_type ()) +#define SP_MEASURE_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_MEASURE_CONTEXT, SPMeasureContext)) +#define SP_IS_MEASURE_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_MEASURE_CONTEXT)) + +class SPMeasureContext; +class SPMeasureContextClass; + +struct SPMeasureContext { + SPEventContext event_context; + SPCanvasItem *grabbed; +}; + +struct SPMeasureContextClass { + SPEventContextClass parent_class; +}; + +GType sp_measure_context_get_type (void); + +#endif diff --git a/src/tools-switch.cpp b/src/tools-switch.cpp index 1f624cc35..42eaf4474 100644 --- a/src/tools-switch.cpp +++ b/src/tools-switch.cpp @@ -50,6 +50,7 @@ #include "sp-flowtext.h" #include "gradient-context.h" #include "zoom-context.h" +#include "measure-context.h" #include "dropper-context.h" #include "connector-context.h" #include "flood-context.h" @@ -75,6 +76,7 @@ static char const *const tool_names[] = { "/tools/text", "/tools/gradient", "/tools/zoom", + "/tools/measure", "/tools/dropper", "/tools/connector", "/tools/paintbucket", @@ -208,6 +210,12 @@ tools_switch(SPDesktop *dt, int num) inkscape_eventcontext_set(sp_desktop_event_context(dt)); dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> or <b>drag around an area</b> to zoom in, <b>Shift+click</b> to zoom out.")); break; + case TOOLS_MEASURE: + dt->set_event_context(SP_TYPE_MEASURE_CONTEXT, tool_names[num]); + dt->activate_guides(false); + inkscape_eventcontext_set(sp_desktop_event_context(dt)); + dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to measure the dimensions of objects.")); + break; case TOOLS_DROPPER: dt->set_event_context(SP_TYPE_DROPPER_CONTEXT, tool_names[num]); dt->activate_guides(false); diff --git a/src/tools-switch.h b/src/tools-switch.h index 4cc9aa93d..75c728179 100644 --- a/src/tools-switch.h +++ b/src/tools-switch.h @@ -31,6 +31,7 @@ enum { TOOLS_TEXT, TOOLS_GRADIENT, TOOLS_ZOOM, + TOOLS_MEASURE, TOOLS_DROPPER, TOOLS_CONNECTOR, TOOLS_PAINTBUCKET, diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index eede9eafe..34bf1e87a 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -46,6 +46,7 @@ enum { PREFS_PAGE_TOOLS_TWEAK, PREFS_PAGE_TOOLS_SPRAY, PREFS_PAGE_TOOLS_ZOOM, + PREFS_PAGE_TOOLS_MEASURE, PREFS_PAGE_TOOLS_SHAPES, PREFS_PAGE_TOOLS_SHAPES_RECT, PREFS_PAGE_TOOLS_SHAPES_3DBOX, diff --git a/src/ui/icon-names.h b/src/ui/icon-names.h index 2ec03c5cc..f7c16b0ed 100644 --- a/src/ui/icon-names.h +++ b/src/ui/icon-names.h @@ -556,6 +556,8 @@ "xml-text-new" #define INKSCAPE_ICON_ZOOM \ "zoom" +#define INKSCAPE_ICON_MEASURE \ + "measure" #define INKSCAPE_ICON_ZOOM_DOUBLE_SIZE \ "zoom-double-size" #define INKSCAPE_ICON_ZOOM_FIT_DRAWING \ diff --git a/src/verbs.cpp b/src/verbs.cpp index de935f700..c332cc93d 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1466,6 +1466,9 @@ ContextVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_CONTEXT_ZOOM: tools_switch(dt, TOOLS_ZOOM); break; + case SP_VERB_CONTEXT_MEASURE: + tools_switch(dt, TOOLS_MEASURE); + break; case SP_VERB_CONTEXT_DROPPER: tools_switch(dt, TOOLS_DROPPER); break; @@ -1542,6 +1545,10 @@ ContextVerb::perform(SPAction *action, void *data, void */*pdata*/) prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_ZOOM); dt->_dlg_mgr->showDialog("InkscapePreferences"); break; + case SP_VERB_CONTEXT_MEASURE_PREFS: + prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_MEASURE); + dt->_dlg_mgr->showDialog("InkscapePreferences"); + break; case SP_VERB_CONTEXT_DROPPER_PREFS: prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_DROPPER); dt->_dlg_mgr->showDialog("InkscapePreferences"); @@ -2522,6 +2529,8 @@ Verb *Verb::_base_verbs[] = { N_("Create and edit gradients"), INKSCAPE_ICON_COLOR_GRADIENT), new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"), N_("Zoom in or out"), INKSCAPE_ICON_ZOOM), + new ContextVerb(SP_VERB_CONTEXT_MEASURE, "ToolMeasure", N_("Measure"), + N_("Measurement tool"), INKSCAPE_ICON_MEASURE), new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"), N_("Pick colors from image"), INKSCAPE_ICON_COLOR_PICKER), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"), @@ -2565,6 +2574,8 @@ Verb *Verb::_base_verbs[] = { N_("Open Preferences for the Gradient tool"), NULL), new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"), N_("Open Preferences for the Zoom tool"), NULL), + new ContextVerb(SP_VERB_CONTEXT_MEASURE_PREFS, "MeasurePrefs", N_("Measure Preferences"), + N_("Open Preferences for the Measure tool"), NULL), new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"), N_("Open Preferences for the Dropper tool"), NULL), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"), diff --git a/src/verbs.h b/src/verbs.h index 0c781f0b6..de7a96797 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -165,6 +165,7 @@ enum { SP_VERB_CONTEXT_TEXT, SP_VERB_CONTEXT_GRADIENT, SP_VERB_CONTEXT_ZOOM, + SP_VERB_CONTEXT_MEASURE, SP_VERB_CONTEXT_DROPPER, SP_VERB_CONTEXT_CONNECTOR, SP_VERB_CONTEXT_PAINTBUCKET, @@ -187,6 +188,7 @@ enum { SP_VERB_CONTEXT_TEXT_PREFS, SP_VERB_CONTEXT_GRADIENT_PREFS, SP_VERB_CONTEXT_ZOOM_PREFS, + SP_VERB_CONTEXT_MEASURE_PREFS, SP_VERB_CONTEXT_DROPPER_PREFS, SP_VERB_CONTEXT_CONNECTOR_PREFS, SP_VERB_CONTEXT_PAINTBUCKET_PREFS, diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 0dcecfcb1..9c3a8346e 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -133,6 +133,7 @@ static void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainA static void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); static void sp_zoom_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); +static void sp_measure_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); static void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); static void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); static void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); @@ -174,6 +175,7 @@ static struct { { "SPTweakContext", "tweak_tool", SP_VERB_CONTEXT_TWEAK, SP_VERB_CONTEXT_TWEAK_PREFS }, { "SPSprayContext", "spray_tool", SP_VERB_CONTEXT_SPRAY, SP_VERB_CONTEXT_SPRAY_PREFS }, { "SPZoomContext", "zoom_tool", SP_VERB_CONTEXT_ZOOM, SP_VERB_CONTEXT_ZOOM_PREFS }, + { "SPMeasureContext", "measure_tool", SP_VERB_CONTEXT_MEASURE, SP_VERB_CONTEXT_MEASURE_PREFS }, { "SPRectContext", "rect_tool", SP_VERB_CONTEXT_RECT, SP_VERB_CONTEXT_RECT_PREFS }, { "Box3DContext", "3dbox_tool", SP_VERB_CONTEXT_3DBOX, SP_VERB_CONTEXT_3DBOX_PREFS }, { "SPArcContext", "arc_tool", SP_VERB_CONTEXT_ARC, SP_VERB_CONTEXT_ARC_PREFS }, @@ -212,6 +214,8 @@ static struct { SP_VERB_INVALID, 0, 0}, { "SPZoomContext", "zoom_toolbox", 0, sp_zoom_toolbox_prep, "ZoomToolbar", SP_VERB_INVALID, 0, 0}, + { "SPMeasureContext", "measure_toolbox", 0, sp_measure_toolbox_prep, "MeasureToolbar", + SP_VERB_INVALID, 0, 0}, { "SPStarContext", "star_toolbox", 0, sp_star_toolbox_prep, "StarToolbar", SP_VERB_CONTEXT_STAR_PREFS, "/tools/shapes/star", N_("Style of new stars")}, { "SPRectContext", "rect_toolbox", 0, sp_rect_toolbox_prep, "RectToolbar", @@ -361,6 +365,9 @@ static gchar const * ui_descr = " <toolitem action='ZoomNext' />" " </toolbar>" + " <toolbar name='MeasureToolbar'>" + " </toolbar>" + " <toolbar name='StarToolbar'>" " <separator />" " <toolitem action='StarStateAction' />" @@ -932,7 +939,7 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto SP_VERB_ZOOM_PAGE, SP_VERB_ZOOM_PAGE_WIDTH, SP_VERB_ZOOM_PREV, - SP_VERB_ZOOM_SELECTION, + SP_VERB_ZOOM_SELECTION }; Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small"); @@ -1627,6 +1634,11 @@ static void sp_zoom_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* /*main // no custom GtkAction setup needed } // end of sp_zoom_toolbox_prep() +static void sp_measure_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/) +{ + // no custom GtkAction setup needed +} // end of sp_measure_toolbox_prep() + void ToolboxFactory::setToolboxDesktop(GtkWidget *toolbox, SPDesktop *desktop) { sigc::connection *conn = static_cast<sigc::connection*>(g_object_get_data(G_OBJECT(toolbox), @@ -1838,6 +1850,7 @@ void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop) " <toolitem action='ToolNode' />" " <toolitem action='ToolTweak' />" " <toolitem action='ToolZoom' />" + " <toolitem action='ToolMeasure' />" " <!-- Shapes -->" " <toolitem action='ToolRect' />" -- cgit v1.2.3 From eddb7a227c8d55d166a28958a027c85c0df87471 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Mon, 6 Jun 2011 20:53:45 -0300 Subject: adding cursor for the measure tool that I forgot to commit in the previous revision. (bzr r10260) --- src/pixmaps/cursor-measure.xpm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/pixmaps/cursor-measure.xpm (limited to 'src') diff --git a/src/pixmaps/cursor-measure.xpm b/src/pixmaps/cursor-measure.xpm new file mode 100644 index 000000000..5f546e2cf --- /dev/null +++ b/src/pixmaps/cursor-measure.xpm @@ -0,0 +1,38 @@ +/* XPM */ +static char * cursor_measure_xpm[] = { +"32 32 3 1", +" c None", +". c #FFFFFF", +"+ c #000000", +" .. ", +" .++. ", +" .+..+. ", +" .+....+. ", +".+..+...+. ", +".+.+.....+. ", +" .+.......+. ", +" .+.+.....+. ", +" .+...+...+. ", +" .+.+.....+. ", +" .+.......+. ", +" .+.+.....+. ", +" .+...+...+. ", +" .+.+.....+. ", +" .+.......+. ", +" .+.+.....+. ", +" .+...+.+. ", +" .+.+.+. ", +" .+.+. ", +" .+. ", +" . ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; -- cgit v1.2.3 From 0aae946f3b68687c72f547612abe7940098a98d4 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" <jon@joncruz.org> Date: Tue, 7 Jun 2011 22:02:08 -0700 Subject: Fix const on new icon. (bzr r10262) --- src/pixmaps/cursor-measure.xpm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/pixmaps/cursor-measure.xpm b/src/pixmaps/cursor-measure.xpm index 5f546e2cf..753bfd14e 100644 --- a/src/pixmaps/cursor-measure.xpm +++ b/src/pixmaps/cursor-measure.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * cursor_measure_xpm[] = { +static char const * cursor_measure_xpm[] = { "32 32 3 1", " c None", ". c #FFFFFF", -- cgit v1.2.3 From cff58b6bd80f0fb13ab65daea0d92eafd5213ff2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" <jbc.engelen@swissonline.ch> Date: Wed, 8 Jun 2011 20:23:27 +0200 Subject: Save a copy dialog now opens in current directory if this option is set for save as... dialog. (there is also the possibility to manually change the preferences file to change this option independently from save as... dialog) Fixed bugs: - https://launchpad.net/bugs/791098 (bzr r10263) --- src/extension/system.cpp | 10 ++++++++-- src/ui/dialog/inkscape-preferences.cpp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index aa5731985..b3b64ca7d 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -590,10 +590,11 @@ Glib::ustring get_file_save_path (SPDocument *doc, FileSaveMethod method) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring path; + bool use_current_dir = true; switch (method) { case FILE_SAVE_METHOD_SAVE_AS: { - bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); + use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir", true); if (doc->getURI() && use_current_dir) { path = Glib::path_get_dirname(doc->getURI()); } else { @@ -605,7 +606,12 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { path = prefs->getString("/dialogs/save_as/path"); break; case FILE_SAVE_METHOD_SAVE_COPY: - path = prefs->getString("/dialogs/save_copy/path"); + use_current_dir = prefs->getBool("/dialogs/save_copy/use_current_dir", prefs->getBool("/dialogs/save_as/use_current_dir", true)); + if (doc->getURI() && use_current_dir) { + path = Glib::path_get_dirname(doc->getURI()); + } else { + path = prefs->getString("/dialogs/save_copy/path"); + } break; case FILE_SAVE_METHOD_INKSCAPE_SVG: if (doc->getURI()) { diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index ad3553b86..447e50831 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1203,7 +1203,7 @@ void InkscapePreferences::initPageSave() { _save_use_current_dir.init( _("Use current directory for \"Save As ...\""), "/dialogs/save_as/use_current_dir", true); _page_save.add_line( false, "", _save_use_current_dir, "", - _("When this option is on, the \"Save as...\" dialog will always open in the directory where the currently open document is; when it's off, it will open in the directory where you last saved a file using that dialog"), true); + _("When this option is on, the \"Save as...\" and \"Save a Copy\" dialogs will always open in the directory where the currently open document is; when it's off, each will open in the directory where you last saved a file using it"), true); // Autosave options -- cgit v1.2.3 From dfde4e23bca26c30ced909192947e147cf1e639e Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Thu, 9 Jun 2011 04:58:18 -0300 Subject: improving the measurement tool Now it detects intersections and displays crosses indicating them the length value displayed corresponds to the first line-segment TODO: display all segment lengths (bzr r10264) --- src/measure-context.cpp | 105 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 1e0339424..f89878f7e 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -13,16 +13,25 @@ #include <gdk/gdkkeysyms.h> #include "macros.h" +#include "display/curve.h" +#include "sp-shape.h" #include "display/sp-ctrlline.h" +#include "display/sodipodi-ctrl.h" #include "display/sp-canvas-item.h" #include "display/sp-canvas-util.h" #include "desktop.h" +#include "document.h" #include "pixmaps/cursor-measure.xpm" #include "preferences.h" #include "inkscape.h" #include "desktop-handles.h" #include "measure-context.h" #include "display/canvas-text.h" +#include "path-chemistry.h" +#include "2geom/line.h" +#include <2geom/path-intersection.h> +#include <2geom/pathvector.h> +#include <2geom/crossing.h> static void sp_measure_context_class_init(SPMeasureContextClass *klass); static void sp_measure_context_init(SPMeasureContext *measure_context); @@ -181,10 +190,100 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv sp_ctrlline_set_coords (SP_CTRLLINE(line), start_point[Geom::X], start_point[Geom::Y], motion_dt[Geom::X], motion_dt[Geom::Y]); - Geom::Point measure_text_pos = (start_point + motion_dt)/2; - double length = (start_point - motion_dt).length(); + + //our control line + Geom::PathVector line; + Geom::Path p; + p.start(desktop->dt2doc(start_point)); + p.appendNew<Geom::LineSegment>(desktop->dt2doc(motion_dt)); + line.push_back(p); + + std::vector<Geom::Point> points; + int i; + for (i=0; i<30; i++){ + points.push_back(start_point + i*(motion_dt-start_point)/30); + } + + SPDocument *doc = sp_desktop_document(desktop); + GSList *items = sp_desktop_document(desktop)->getItemsInBox(desktop->dkey, Geom::Rect(start_point, motion_dt)); + double length; +//TODO: select elements crossed by line segment: +// GSList *items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, points); + SPItem* item; + GSList *l; + int counter=0; + std::vector<Geom::Point> intersections; + for (l = items; l != NULL; l = l->next){ + item = (SPItem*) (l->data); +#if 0 +//TODO: deal with all kinds of objects: + + Inkscape::XML::Node *repr = sp_selected_item_to_curved_repr(item, 0); + + if (!repr) continue; + item = (SPItem *) doc->getObjectByRepr(repr); + if (!item) continue; + SPCurve* curve = SP_SHAPE(item)->getCurve(); +#else + SPCurve* curve = NULL; + if (SP_IS_SHAPE(item)) { + curve = SP_SHAPE(item)->getCurve(); + } +#endif + if (!curve) continue; + counter++; + + Geom::PathVector pathv = curve->get_pathvector(); + + // Find all intersections of the control-line with this shape + Geom::CrossingSet cs = Geom::crossings(line, pathv); + // Store the results as intersection points + unsigned int index = 0; + for (Geom::CrossingSet::const_iterator i = cs.begin(); i != cs.end(); i++) { + if (index >= line.size()) { + break; + } + // Reconstruct and store the points of intersection + for (Geom::Crossings::const_iterator m = (*i).begin(); m != (*i).end(); m++) { + intersections.push_back(line[index].pointAt((*m).ta)); + } + index++; + } + //g_free(repr); + } + + Geom::Point pa = start_point; + Geom::Point pb = motion_dt; + + if (intersections.size() >= 2){ + pa = desktop->doc2dt(intersections[0]); + pb = desktop->doc2dt(intersections[1]); + } + + unsigned int idx; + for (idx=0;idx<intersections.size(); idx++){ + // Display the intersection indicator (i.e. the cross) + SPCanvasItem * canvasitem = NULL; + canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (desktop), + SP_TYPE_CTRL, + "anchor", GTK_ANCHOR_CENTER, + "size", 5.0, + "stroked", TRUE, + "stroke_color", 0xff0000ff, + "mode", SP_KNOT_MODE_XOR, + "shape", SP_KNOT_SHAPE_CROSS, + NULL ); + + SP_CTRL(canvasitem)->moveto(desktop->doc2dt(intersections[idx])); + desktop->add_temporary_canvasitem(canvasitem, 100); + } + + + Geom::Point measure_text_pos = (pa + pb)/2; + + length = (pa - pb).length(); char* measure_str = (char*) malloc(sizeof(char)*20); - sprintf(measure_str, "%2f", length); + sprintf(measure_str, "%f", length); sp_canvastext_set_coords (SP_CANVASTEXT(measure_text), desktop->dt2doc(measure_text_pos)); sp_canvastext_set_text (SP_CANVASTEXT(measure_text), measure_str); -- cgit v1.2.3 From 31099efbe04b0b71835f11a077ddd6fce7010d9d Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Thu, 9 Jun 2011 22:09:54 -0300 Subject: improving measurement tool (bzr r10265) --- src/measure-context.cpp | 57 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index f89878f7e..2aeb39d5d 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -124,6 +124,11 @@ static gint sp_measure_context_item_handler(SPEventContext *event_context, SPIte return ret; } +bool GeomPointSortPredicate(const Geom::Point& p1, const Geom::Point& p2) +{ + return p1[Geom::Y] < p2[Geom::Y]; +} + static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEvent *event) { SPDesktop *desktop = event_context->desktop; @@ -199,20 +204,21 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv line.push_back(p); std::vector<Geom::Point> points; - int i; - for (i=0; i<30; i++){ - points.push_back(start_point + i*(motion_dt-start_point)/30); + double i; +#define NPOINTS 3000 + for (i=0; i<NPOINTS; i++){ + points.push_back(desktop->d2w(start_point + (i/NPOINTS)*(motion_dt-start_point))); } - SPDocument *doc = sp_desktop_document(desktop); - GSList *items = sp_desktop_document(desktop)->getItemsInBox(desktop->dkey, Geom::Rect(start_point, motion_dt)); double length; -//TODO: select elements crossed by line segment: -// GSList *items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, points); +//select elements crossed by line segment: + GSList *items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, points); SPItem* item; GSList *l; int counter=0; std::vector<Geom::Point> intersections; + intersections.push_back(desktop->dt2doc(start_point)); + for (l = items; l != NULL; l = l->next){ item = (SPItem*) (l->data); #if 0 @@ -251,15 +257,12 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } //g_free(repr); } - - Geom::Point pa = start_point; - Geom::Point pb = motion_dt; + intersections.push_back(desktop->dt2doc(motion_dt)); - if (intersections.size() >= 2){ - pa = desktop->doc2dt(intersections[0]); - pb = desktop->doc2dt(intersections[1]); - } + //sort intersections + std::sort(intersections.begin(), intersections.end(), GeomPointSortPredicate); +//TODO: make these not fade out. unsigned int idx; for (idx=0;idx<intersections.size(); idx++){ // Display the intersection indicator (i.e. the cross) @@ -267,7 +270,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (desktop), SP_TYPE_CTRL, "anchor", GTK_ANCHOR_CENTER, - "size", 5.0, + "size", 8.0, "stroked", TRUE, "stroke_color", 0xff0000ff, "mode", SP_KNOT_MODE_XOR, @@ -279,6 +282,29 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } +//TODO: make these not fade out. + Geom::Point previous_point = intersections[0]; + for (idx=1; idx < intersections.size(); idx++){ + Geom::Point measure_text_pos = (previous_point + intersections[idx])/2; + + length = (intersections[idx] - previous_point).length(); + char* measure_str = (char*) malloc(sizeof(char)*20); + sprintf(measure_str, "%f", length); + +// sp_canvastext_set_coords (SP_CANVASTEXT(measure_text), desktop->dt2doc(measure_text_pos)); +// sp_canvastext_set_text (SP_CANVASTEXT(measure_text), measure_str); + +// SPCanvasItem * canvasitem = NULL; + SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, desktop->dt2doc(measure_text_pos), measure_str); + + desktop->add_temporary_canvasitem(canvas_tooltip, 100); + + free(measure_str); + + previous_point = intersections[idx]; + } + +#if 0 Geom::Point measure_text_pos = (pa + pb)/2; length = (pa - pb).length(); @@ -288,6 +314,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv sp_canvastext_set_coords (SP_CANVASTEXT(measure_text), desktop->dt2doc(measure_text_pos)); sp_canvastext_set_text (SP_CANVASTEXT(measure_text), measure_str); free(measure_str); +#endif gobble_motion_events(GDK_BUTTON1_MASK); } -- cgit v1.2.3 From 8bfebadcfb9a99361782320eab0183410a1fdabf Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" <jon@joncruz.org> Date: Fri, 10 Jun 2011 02:46:50 -0700 Subject: Modified build to conditionally build against either libwpg 0.1.x or 0.2.x. Fixes bug #778951. Fixed bugs: - https://launchpad.net/bugs/778951 (bzr r10266) --- src/extension/internal/wpg-input.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index 70fa28967..b6425b380 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -50,8 +50,11 @@ #include "document.h" #include "libwpg/libwpg.h" +#if WITH_LIBWPG01 #include "libwpg/WPGStreamImplementation.h" - +#elif WITH_LIBWPG02 +#include "libwpd-stream/libwpd-stream.h" +#endif using namespace libwpg; @@ -62,9 +65,17 @@ namespace Internal { SPDocument * WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { +#if WITH_LIBWPG01 WPXInputStream* input = new libwpg::WPGFileStream(uri); +#elif WITH_LIBWPG02 + WPXInputStream* input = new WPXFileStream(uri); +#endif if (input->isOLEStream()) { +#if WITH_LIBWPG01 WPXInputStream* olestream = input->getDocumentOLEStream(); +#elif WITH_LIBWPG02 + WPXInputStream* olestream = input->getDocumentOLEStream("PerfectOffice_MAIN"); +#endif if (olestream) { delete input; input = olestream; @@ -79,7 +90,11 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { return NULL; } +#if WITH_LIBWPG01 libwpg::WPGString output; +#elif WITH_LIBWPG02 + WPXString output; +#endif if (!libwpg::WPGraphics::generateSVG(input, output)) { delete input; return NULL; -- cgit v1.2.3 From a5a2d9c428ceccfddd84f2ff01c3aeac4c37231a Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" <jon@joncruz.org> Date: Fri, 10 Jun 2011 21:47:26 -0700 Subject: Fix debus warnings and build errors. (bzr r10268) --- src/extension/dbus/document-interface.cpp | 172 ++++++++++++++---------------- 1 file changed, 79 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 8e22849b5..4e629a1a9 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -35,6 +35,7 @@ #include "selection.h" //selection struct #include "sp-ellipse.h" #include "sp-object.h" +#include "sp-root.h" #include "style.h" //style_write #include "file.h" //IO @@ -202,8 +203,7 @@ dbus_create_node (SPDesktop *desk, const gchar *type) * There is probably a better way to do this (use the shape tools default styles) * but I'm not sure how. */ -gchar * -finish_create_shape (DocumentInterface *object, GError **error, Inkscape::XML::Node *newNode, gchar *desc) +gchar *finish_create_shape (DocumentInterface *object, GError ** /*error*/, Inkscape::XML::Node *newNode, gchar *desc) { SPCSSAttr *style = sp_desktop_get_style(object->desk, TRUE); @@ -218,11 +218,11 @@ finish_create_shape (DocumentInterface *object, GError **error, Inkscape::XML::N object->desk->currentLayer()->appendChildRepr(newNode); object->desk->currentLayer()->updateRepr(); - if (object->updates) - - Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), 0, (gchar *)desc); - //else + if (object->updates) { + Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), 0, (gchar *)desc); + //} else { //document_interface_pause_updates(object, error); + } return strdup(newNode->attribute("id")); } @@ -285,7 +285,7 @@ document_interface_class_init (DocumentInterfaceClass *klass) static void document_interface_init (DocumentInterface *object) { - object->desk = NULL; + object->desk = NULL; } @@ -312,37 +312,34 @@ inkscape_error_quark (void) #define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } -GType -inkscape_error_get_type (void) +GType inkscape_error_get_type(void) { - static GType etype = 0; + static GType etype = 0; - if (etype == 0) - { - static const GEnumValue values[] = - { + if (etype == 0) { + static const GEnumValue values[] = + { - ENUM_ENTRY (INKSCAPE_ERROR_SELECTION, "Incompatible_Selection"), - ENUM_ENTRY (INKSCAPE_ERROR_OBJECT, "Incompatible_Object"), - ENUM_ENTRY (INKSCAPE_ERROR_VERB, "Failed_Verb"), - ENUM_ENTRY (INKSCAPE_ERROR_OTHER, "Generic_Error"), - { 0, 0, 0 } - }; + ENUM_ENTRY(INKSCAPE_ERROR_SELECTION, "Incompatible_Selection"), + ENUM_ENTRY(INKSCAPE_ERROR_OBJECT, "Incompatible_Object"), + ENUM_ENTRY(INKSCAPE_ERROR_VERB, "Failed_Verb"), + ENUM_ENTRY(INKSCAPE_ERROR_OTHER, "Generic_Error"), + { 0, 0, 0 } + }; - etype = g_enum_register_static ("InkscapeError", values); - } + etype = g_enum_register_static("InkscapeError", values); + } - return etype; + return etype; } /**************************************************************************** MISC FUNCTIONS ****************************************************************************/ -gboolean -document_interface_delete_all (DocumentInterface *object, GError **error) +gboolean document_interface_delete_all(DocumentInterface *object, GError ** /*error*/) { - sp_edit_clear_all (object->desk); + sp_edit_clear_all(object->desk); return TRUE; } @@ -523,7 +520,7 @@ document_interface_image (DocumentInterface *object, int x, int y, gchar *filena return strdup(newNode->attribute("id")); } -gchar *document_interface_node (DocumentInterface *object, gchar *type, GError **error) +gchar *document_interface_node(DocumentInterface *object, gchar *type, GError ** /*error*/) { SPDocument * doc = sp_desktop_document (object->desk); Inkscape::XML::Document *xml_doc = doc->getReprDoc(); @@ -533,10 +530,11 @@ gchar *document_interface_node (DocumentInterface *object, gchar *type, GError * object->desk->currentLayer()->appendChildRepr(newNode); object->desk->currentLayer()->updateRepr(); - if (object->updates) + if (object->updates) { Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), 0, (gchar *)"created empty node"); - //else + //} else { //document_interface_pause_updates(object, error); + } return strdup(newNode->attribute("id")); } @@ -556,26 +554,23 @@ document_interface_document_get_height (DocumentInterface *object) return sp_desktop_document(object->desk)->getHeight(); } -gchar * -document_interface_document_get_css (DocumentInterface *object, GError **error) +gchar *document_interface_document_get_css(DocumentInterface *object, GError ** /*error*/) { SPCSSAttr *current = (object->desk)->current; return sp_repr_css_write_string(current); } -gboolean -document_interface_document_merge_css (DocumentInterface *object, - gchar *stylestring, GError **error) +gboolean document_interface_document_merge_css(DocumentInterface *object, + gchar *stylestring, GError ** /*error*/) { SPCSSAttr * style = sp_repr_css_attr_new(); - sp_repr_css_attr_add_from_string (style, stylestring); - sp_desktop_set_style (object->desk, style); + sp_repr_css_attr_add_from_string(style, stylestring); + sp_desktop_set_style(object->desk, style); return TRUE; } -gboolean -document_interface_document_set_css (DocumentInterface *object, - gchar *stylestring, GError **error) +gboolean document_interface_document_set_css(DocumentInterface *object, + gchar *stylestring, GError ** /*error*/) { SPCSSAttr * style = sp_repr_css_attr_new(); sp_repr_css_attr_add_from_string (style, stylestring); @@ -808,8 +803,7 @@ document_interface_move_to_layer (DocumentInterface *object, gchar *shape, return TRUE; } -GArray * -document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape) +GArray *document_interface_get_node_coordinates(DocumentInterface * /*object*/, gchar * /*shape*/) { //FIXME: Needs lot's of work. /* @@ -855,29 +849,29 @@ document_interface_save (DocumentInterface *object, GError **error) return FALSE; } -gboolean -document_interface_load (DocumentInterface *object, - gchar *filename, GError **error) +gboolean document_interface_load(DocumentInterface *object, + gchar *filename, GError ** /*error*/) { - desktop_ensure_active (object->desk); + desktop_ensure_active(object->desk); const Glib::ustring file(filename); sp_file_open(file, NULL, TRUE, TRUE); - if (object->updates) + if (object->updates) { Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), SP_VERB_FILE_OPEN, "Opened File"); + } return TRUE; } -gboolean -document_interface_save_as (DocumentInterface *object, - const gchar *filename, GError **error) +gboolean document_interface_save_as(DocumentInterface *object, + const gchar *filename, GError ** /*error*/) { SPDocument * doc = sp_desktop_document(object->desk); #ifdef WITH_GNOME_VFS const Glib::ustring file(filename); return file_save_remote(doc, file, NULL, TRUE, TRUE); #endif - if (!doc || strlen(filename)<1) //Safety check + if (!doc || strlen(filename)<1) { //Safety check return false; + } try { Inkscape::Extension::save(NULL, doc, filename, @@ -892,12 +886,12 @@ document_interface_save_as (DocumentInterface *object, return true; } -gboolean -document_interface_mark_as_unmodified (DocumentInterface *object, GError **error) +gboolean document_interface_mark_as_unmodified(DocumentInterface *object, GError ** /*error*/) { SPDocument * doc = sp_desktop_document(object->desk); - if (doc) + if (doc) { doc->modified_since_save = FALSE; + } return TRUE; } @@ -948,8 +942,7 @@ document_interface_redo (DocumentInterface *object, GError **error) Need to make sure it plays well with verbs because they are used so much. ****************************************************************************/ -void -document_interface_pause_updates (DocumentInterface *object, GError **error) +void document_interface_pause_updates(DocumentInterface *object, GError ** /*error*/) { object->updates = FALSE; object->desk->canvas->drawing_disabled = 1; @@ -959,8 +952,7 @@ document_interface_pause_updates (DocumentInterface *object, GError **error) //sp_desktop_document(object->desk)->root->mflags = FALSE; } -void -document_interface_resume_updates (DocumentInterface *object, GError **error) +void document_interface_resume_updates(DocumentInterface *object, GError ** /*error*/) { object->updates = TRUE; object->desk->canvas->drawing_disabled = 0; @@ -973,16 +965,15 @@ document_interface_resume_updates (DocumentInterface *object, GError **error) Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions"); } -void -document_interface_update (DocumentInterface *object, GError **error) +void document_interface_update(DocumentInterface *object, GError ** /*error*/) { - sp_desktop_document(object->desk)->root->uflags = TRUE; - sp_desktop_document(object->desk)->root->mflags = TRUE; + sp_desktop_document(object->desk)->getRoot()->uflags = TRUE; + sp_desktop_document(object->desk)->getRoot()->mflags = TRUE; object->desk->enableInteraction(); sp_desktop_document(object->desk)->_updateDocument(); object->desk->disableInteraction(); - sp_desktop_document(object->desk)->root->uflags = FALSE; - sp_desktop_document(object->desk)->root->mflags = FALSE; + sp_desktop_document(object->desk)->getRoot()->uflags = FALSE; + sp_desktop_document(object->desk)->getRoot()->mflags = FALSE; //Inkscape::DocumentUndo::done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions"); } @@ -990,8 +981,7 @@ document_interface_update (DocumentInterface *object, GError **error) SELECTION FUNCTIONS FIXME: use call_verb where appropriate (once update system is tested.) ****************************************************************************/ -gboolean -document_interface_selection_get (DocumentInterface *object, char ***out, GError **error) +gboolean document_interface_selection_get(DocumentInterface *object, char ***out, GError ** /*error*/) { Inkscape::Selection * sel = sp_desktop_selection(object->desk); GSList const *oldsel = sel->list(); @@ -1034,10 +1024,9 @@ document_interface_selection_add_list (DocumentInterface *object, return TRUE; } -gboolean -document_interface_selection_set (DocumentInterface *object, char *name, GError **error) +gboolean document_interface_selection_set(DocumentInterface *object, char *name, GError ** /*error*/) { - SPDocument * doc = sp_desktop_document (object->desk); + SPDocument * doc = sp_desktop_document(object->desk); Inkscape::Selection *selection = sp_desktop_selection(object->desk); selection->set(doc->getObjectById(name)); return TRUE; @@ -1055,8 +1044,7 @@ document_interface_selection_set_list (DocumentInterface *object, return TRUE; } -gboolean -document_interface_selection_rotate (DocumentInterface *object, int angle, GError **error) +gboolean document_interface_selection_rotate(DocumentInterface *object, int angle, GError ** /*error*/) { Inkscape::Selection *selection = sp_desktop_selection(object->desk); sp_selection_rotate(selection, angle); @@ -1070,8 +1058,7 @@ document_interface_selection_delete (DocumentInterface *object, GError **error) return dbus_call_verb (object, SP_VERB_EDIT_DELETE, error); } -gboolean -document_interface_selection_clear (DocumentInterface *object, GError **error) +gboolean document_interface_selection_clear(DocumentInterface *object, GError ** /*error*/) { sp_desktop_selection(object->desk)->clear(); return TRUE; @@ -1092,10 +1079,9 @@ document_interface_select_all_in_all_layers(DocumentInterface *object, return dbus_call_verb (object, SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, error); } -gboolean -document_interface_selection_box (DocumentInterface *object, int x, int y, - int x2, int y2, gboolean replace, - GError **error) +gboolean document_interface_selection_box(DocumentInterface * /*object*/, int /*x*/, int /*y*/, + int /*x2*/, int /*y2*/, gboolean /*replace*/, + GError ** /*error*/) { //FIXME: implement. return FALSE; @@ -1156,8 +1142,7 @@ document_interface_selection_paste (DocumentInterface *object, GError **error) return dbus_call_verb (object, SP_VERB_EDIT_PASTE, error); } -gboolean -document_interface_selection_scale (DocumentInterface *object, gdouble grow, GError **error) +gboolean document_interface_selection_scale(DocumentInterface *object, gdouble grow, GError ** /*error*/) { Inkscape::Selection *selection = sp_desktop_selection(object->desk); if (!selection) @@ -1168,15 +1153,13 @@ document_interface_selection_scale (DocumentInterface *object, gdouble grow, GEr return TRUE; } -gboolean -document_interface_selection_move (DocumentInterface *object, gdouble x, gdouble y, GError **error) +gboolean document_interface_selection_move(DocumentInterface *object, gdouble x, gdouble y, GError ** /*error*/) { - sp_selection_move (object->desk, x, 0 - y); //switching coordinate systems. + sp_selection_move(object->desk, x, 0 - y); //switching coordinate systems. return TRUE; } -gboolean -document_interface_selection_move_to (DocumentInterface *object, gdouble x, gdouble y, GError **error) +gboolean document_interface_selection_move_to(DocumentInterface *object, gdouble x, gdouble y, GError ** /*error*/) { Inkscape::Selection * sel = sp_desktop_selection(object->desk); @@ -1292,13 +1275,12 @@ document_interface_selection_change_level (DocumentInterface *object, gchar *cmd LAYER FUNCTIONS ****************************************************************************/ -gchar * -document_interface_layer_new (DocumentInterface *object, GError **error) +gchar *document_interface_layer_new(DocumentInterface *object, GError ** /*error*/) { SPDesktop * dt = object->desk; SPObject *new_layer = Inkscape::create_layer(dt->currentRoot(), dt->currentLayer(), Inkscape::LPOS_BELOW); dt->setCurrentLayer(new_layer); - return g_strdup(get_name_from_object (new_layer)); + return g_strdup(get_name_from_object(new_layer)); } gboolean @@ -1314,8 +1296,7 @@ document_interface_layer_set (DocumentInterface *object, return TRUE; } -gchar ** -document_interface_layer_get_all (DocumentInterface *object) +gchar **document_interface_layer_get_all(DocumentInterface * /*object*/) { //FIXME: implement. return NULL; @@ -1348,8 +1329,13 @@ document_interface_layer_previous (DocumentInterface *object, GError **error) return dbus_call_verb (object, SP_VERB_LAYER_PREV, error); } - - - - - +/* + 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: expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : -- cgit v1.2.3 From 3a86fbe8f7ffd5782c1cb736192d4ee5a5dc6d7f Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" <jon@joncruz.org> Date: Sat, 11 Jun 2011 02:48:13 -0700 Subject: Update to win32 build defines for libwpg issue. (bzr r10269) --- src/extension/internal/wpg-input.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index b6425b380..3cd5044f7 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -49,6 +49,11 @@ #include "extension/input.h" #include "document.h" +// Take a guess and fallback to 0.1.x if no configure has run +#if !defined(WITH_LIBWPG01) && !defined(WITH_LIBWPG02) +#define WITH_LIBWPG01 1 +#endif + #include "libwpg/libwpg.h" #if WITH_LIBWPG01 #include "libwpg/WPGStreamImplementation.h" -- cgit v1.2.3 From 0ddedab9c6185028661dcaaac9f6fbca4c9e93fc Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Sun, 12 Jun 2011 18:27:29 +0000 Subject: work in progress cmake commit: - cmake now builds all files that automake does but does NOT link yet - inlcudes nasty hard coded paths and libs (will replace once linking works) (bzr r10272) --- src/2geom/CMakeLists.txt | 244 +++++------ src/CMakeLists.txt | 578 ++++++++++++++----------- src/bind/CMakeLists.txt | 11 +- src/debug/CMakeLists.txt | 23 +- src/dialogs/CMakeLists.txt | 36 +- src/display/CMakeLists.txt | 123 +++--- src/dom/CMakeLists.txt | 68 +-- src/dom/io/CMakeLists.txt | 18 +- src/dom/odf/CMakeLists.txt | 6 +- src/dom/util/CMakeLists.txt | 8 +- src/dom/work/CMakeLists.txt | 20 +- src/extension/CMakeLists.txt | 74 ++-- src/extension/dxf2svg/CMakeLists.txt | 20 +- src/extension/implementation/CMakeLists.txt | 8 +- src/extension/internal/CMakeLists.txt | 56 ++- src/extension/internal/bitmap/CMakeLists.txt | 72 +-- src/extension/internal/filter/CMakeLists.txt | 14 +- src/extension/internal/pdfinput/CMakeLists.txt | 8 +- src/extension/param/CMakeLists.txt | 23 +- src/extension/script/CMakeLists.txt | 4 +- src/filters/CMakeLists.txt | 47 +- src/helper/CMakeLists.txt | 48 +- src/io/CMakeLists.txt | 29 +- src/jabber_whiteboard/CMakeLists.txt | 42 +- src/jabber_whiteboard/dialog/CMakeLists.txt | 5 +- src/libavoid/CMakeLists.txt | 35 +- src/libcola/CMakeLists.txt | 21 +- src/libcroco/CMakeLists.txt | 63 +-- src/libgdl/CMakeLists.txt | 51 +-- src/libnr/CMakeLists.txt | 71 +-- src/libnr/testnr.cpp | 2 + src/libnrtype/CMakeLists.txt | 35 +- src/libvpsc/CMakeLists.txt | 25 +- src/livarot/CMakeLists.txt | 48 +- src/live_effects/CMakeLists.txt | 81 ++-- src/live_effects/parameter/CMakeLists.txt | 24 +- src/pedro/CMakeLists.txt | 23 +- src/svg/CMakeLists.txt | 34 +- src/trace/CMakeLists.txt | 18 +- src/trace/potrace/CMakeLists.txt | 16 +- src/ui/CMakeLists.txt | 64 ++- src/ui/cache/CMakeLists.txt | 4 +- src/ui/dialog/CMakeLists.txt | 93 ++-- src/ui/view/CMakeLists.txt | 12 +- src/ui/widget/CMakeLists.txt | 81 ++-- src/util/CMakeLists.txt | 16 +- src/widgets/CMakeLists.txt | 74 ++-- src/xml/CMakeLists.txt | 40 +- 48 files changed, 1320 insertions(+), 1196 deletions(-) (limited to 'src') diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index 3c8669a9d..91c14db8b 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -1,127 +1,127 @@ -SET(2GEOM_SRC -svg-path.h -svg-path.cpp -svg-path-parser.h -svg-path-parser.cpp - -ord.h - -#nearestpoint.cpp -nearest-point.cpp -nearest-point.h - -bezier-curve.h -circle.cpp -circle.h -curve.h -curves.h -curve-helpers.cpp -ellipse.cpp -ellipse.h -elliptical-arc.cpp -elliptical-arc.h -hvlinesegment.h -sbasis-curve.h -path.cpp -path.h -path-intersection.cpp -path-intersection.h -pathvector.cpp -pathvector.h - -forward.h - -shape.cpp -shape.h -region.cpp -region.h -crossing.h -crossing.cpp -sweep.cpp -sweep.h - -poly.cpp -poly.h -poly-dk-solve.cpp -poly-dk-solve.h -poly-laguerre-solve.cpp -poly-laguerre-solve.h - -quadtree.cpp -quadtree.h - -matrix.cpp -matrix.h -transforms.cpp -transforms.h - -point.h -point.cpp -point-l.h - -coord.h - -d2.h -d2-sbasis.h -d2-sbasis.cpp -rect.h - -piecewise.h -piecewise.cpp - -sbasis.cpp -sbasis.h -sbasis-2d.h -sbasis-2d.cpp -sbasis-geometric.cpp -sbasis-geometric.h -sbasis-math.h -sbasis-math.cpp -sbasis-poly.cpp -sbasis-poly.h -#chebyshev.cpp # requires gsl, not useful, I think -#chebyshev.h -sbasis-roots.cpp -sbasis-to-bezier.cpp -sbasis-to-bezier.h - -bezier-to-sbasis.h - -basic-intersection.h -basic-intersection.cpp -recursive-bezier-intersection.cpp - -geom.cpp -geom.h - -#utils.cpp -utils.h -exception.h -angle.h - -bezier-utils.cpp -bezier-utils.h -choose.h -circulator.h -conjugate_gradient.cpp -conjugate_gradient.h -convex-cover.cpp -convex-cover.h -solve-bezier-one-d.cpp -solve-bezier-parametric.cpp -solver.h -sturm.h -svg-elliptical-arc.cpp -svg-elliptical-arc.h - -#arc-length.cpp -#arc-length.h - -numeric/matrix.cpp +set(2GEOM_SRC + affine.cpp + basic-intersection.cpp + bezier-clipping.cpp + bezier-curve.cpp + bezier-utils.cpp + circle-circle.cpp + circle.cpp + conic_section_clipper_impl.cpp + conicsec.cpp + conjugate_gradient.cpp + convex-cover.cpp + crossing.cpp + curve.cpp + d2-sbasis.cpp + ellipse.cpp + elliptical-arc.cpp + geom.cpp + line.cpp + nearest-point.cpp + numeric/matrix.cpp + path-intersection.cpp + path.cpp + pathvector.cpp + piecewise.cpp + point.cpp + poly.cpp + quadtree.cpp + recursive-bezier-intersection.cpp + region.cpp + sbasis-2d.cpp + sbasis-geometric.cpp + sbasis-math.cpp + sbasis-poly.cpp + sbasis-roots.cpp + sbasis-to-bezier.cpp + sbasis.cpp + shape.cpp + solve-bezier-one-d.cpp + solve-bezier-parametric.cpp + svg-elliptical-arc.cpp + svg-path-parser.cpp + svg-path.cpp + sweep.cpp + transforms.cpp + utils.cpp + + affine.h + angle.h + basic-intersection.h + bezier-curve.h + bezier-to-sbasis.h + bezier-utils.h + bezier.h + choose.h + circle.h + circulator.h + concepts.h + conic_section_clipper.h + conic_section_clipper_cr.h + conic_section_clipper_impl.h + conicsec.h + conjugate_gradient.h + convex-cover.h + coord.h + crossing.h + curve.h + curves.h + d2-sbasis.h + d2.h + ellipse.h + elliptical-arc.h + exception.h + forward.h + geom.h + hvlinesegment.h + interval.h + isnan.h + line.h + linear.h + math-utils.h + nearest-point.h + ord.h + path-intersection.h + path.h + pathvector.h + piecewise.h + point-l.h + point-ops.h + point.h + poly.h + quadtree.h + ray.h + rect.h + region.h + sbasis-2d.h + sbasis-curve.h + sbasis-geometric.h + sbasis-math.h + sbasis-poly.h + sbasis-to-bezier.h + sbasis.h + shape.h + solver.h + sturm.h + svg-elliptical-arc.h + svg-path-parser.h + svg-path.h + sweep.h + transforms.h + utils.h + + numeric/fitting-model.h + numeric/fitting-tool.h + numeric/linear_system.h + numeric/matrix.h + numeric/symmetric-matrix-fs-operation.h + numeric/symmetric-matrix-fs-trace.h + numeric/symmetric-matrix-fs.h + numeric/vector.h ) # make lib for 2geom -ADD_LIBRARY(2geom STATIC ${2GEOM_SRC}) +add_library(2geom STATIC ${2GEOM_SRC}) #TARGET_LINK_LIBRARIES(2geom blas gsl) -TARGET_LINK_LIBRARIES(2geom ${INKSCAPE_LIBS}) +target_link_libraries(2geom ${INKSCAPE_LIBS}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f03f22c80..4bd93db12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,264 +1,348 @@ -IF(WIN32) - SET(ONLY_WIN - registrytool.cpp - #deptool.cpp - winmain.cpp) -ELSEIF(WIN32) - SET(ONLY_WIN) -ENDIF(WIN32) -SET(SP_SRC -sp-anchor.cpp -sp-animation.cpp -sp-clippath.cpp -sp-conn-end.cpp -sp-conn-end-pair.cpp -sp-cursor.cpp -sp-defs.cpp -sp-ellipse.cpp -sp-filter.cpp -sp-filter-primitive.cpp -sp-filter-reference.cpp -sp-flowdiv.cpp -sp-flowregion.cpp -sp-flowtext.cpp -sp-font.cpp -sp-font-face.cpp -sp-gaussian-blur.cpp -sp-glyph.cpp -sp-gradient.cpp -sp-gradient-reference.cpp -sp-guide.cpp -sp-glyph-kerning.cpp -sp-image.cpp -spiral-context.cpp -sp-item.cpp -sp-item-group.cpp -sp-item-notify-moveto.cpp -sp-item-rm-unsatisfied-cns.cpp -sp-item-transform.cpp -sp-item-update-cns.cpp -sp-line.cpp -splivarot.cpp -sp-lpe-item.cpp -sp-mask.cpp -sp-metadata.cpp -sp-metrics.cpp -sp-missing-glyph.cpp -sp-namedview.cpp -sp-object.cpp -sp-object-group.cpp -sp-object-repr.cpp -sp-offset.cpp -sp-paint-server.cpp -sp-path.cpp -sp-pattern.cpp -sp-polygon.cpp -sp-polyline.cpp -sp-rect.cpp -sp-root.cpp -sp-shape.cpp -sp-skeleton.cpp -sp-spiral.cpp -sp-star.cpp -sp-stop.cpp -sp-string.cpp -sp-style-elem.cpp -sp-switch.cpp -sp-symbol.cpp -sp-text.cpp -sp-tref.cpp -sp-tref-reference.cpp -sp-tspan.cpp -sp-use.cpp -sp-use-reference.cpp +set(SP_SRC + sp-anchor.cpp + sp-animation.cpp + sp-clippath.cpp + sp-conn-end-pair.cpp + sp-conn-end.cpp + sp-cursor.cpp + sp-defs.cpp + sp-desc.cpp + sp-ellipse.cpp + sp-filter-primitive.cpp + sp-filter-reference.cpp + sp-filter.cpp + sp-flowdiv.cpp + sp-flowregion.cpp + sp-flowtext.cpp + sp-font-face.cpp + sp-font.cpp + sp-gaussian-blur.cpp + sp-glyph-kerning.cpp + sp-glyph.cpp + sp-gradient-reference.cpp + sp-gradient.cpp + sp-guide.cpp + sp-image.cpp + sp-item-group.cpp + sp-item-notify-moveto.cpp + sp-item-rm-unsatisfied-cns.cpp + sp-item-transform.cpp + sp-item-update-cns.cpp + sp-item.cpp + sp-line.cpp + sp-lpe-item.cpp + sp-mask.cpp + sp-metadata.cpp + sp-metrics.cpp + sp-missing-glyph.cpp + sp-namedview.cpp + sp-object-group.cpp + sp-object-repr.cpp + sp-object.cpp + sp-offset.cpp + sp-paint-server.cpp + sp-path.cpp + sp-pattern.cpp + sp-polygon.cpp + sp-polyline.cpp + sp-rect.cpp + sp-root.cpp + sp-script.cpp + sp-shape.cpp + sp-skeleton.cpp + sp-spiral.cpp + sp-star.cpp + sp-stop.cpp + sp-string.cpp + sp-style-elem.cpp + sp-switch.cpp + sp-symbol.cpp + sp-text.cpp + sp-title.cpp + sp-tref-reference.cpp + sp-tref.cpp + sp-tspan.cpp + sp-use-reference.cpp + sp-use.cpp + spiral-context.cpp + splivarot.cpp ) -SET(INKSCAPE_SRC -arc-context.cpp -attributes.cpp -axis-manip.cpp -box3d-context.cpp -box3d.cpp -box3d-side.cpp -color.cpp -color-profile.cpp -composite-undo-stack-observer.cpp -common-context.cpp -conditions.cpp -conn-avoid-ref.cpp -connection-points.cpp -connector-context.cpp -console-output-undo-observer.cpp -context-fns.cpp -#deptool.cpp -desktop.cpp -desktop-events.cpp -desktop-handles.cpp -desktop-style.cpp -device-manager.cpp -dir-util.cpp -document.cpp -document-subset.cpp -document-undo.cpp -doxygen-main.cpp -draw-anchor.cpp -draw-context.cpp -dropper-context.cpp -dyna-draw-context.cpp -ege-adjustment-action.cpp -ege-color-prof-tracker.cpp -ege-output-action.cpp -ege-select-one-action.cpp -eraser-context.cpp -event-context.cpp -event-log.cpp -extension -extract-uri.cpp -file.cpp -filter-chemistry.cpp -filter-enums.cpp -fixes.cpp -flood-context.cpp -gc-anchored.cpp -gc.cpp -gc-finalized.cpp -gradient-chemistry.cpp -gradient-context.cpp -gradient-drag.cpp -guide-snapper.cpp -help.cpp -id-clash.cpp -ige-mac-menu.c -ink-action.cpp -inkscape.cpp -inkscape.rc -inkscape-stock.cpp -interface.cpp -knot.cpp -knotholder.cpp -knot-holder-entity.cpp -layer-fns.cpp -layer-manager.cpp -line-geometry.cpp -line-snapper.cpp -main-cmdlineact.cpp -main.cpp -marker.cpp -media.cpp -message-context.cpp -message-stack.cpp -mod360.cpp -node-context.cpp -nodepath.cpp -object-edit.cpp -object-hierarchy.cpp -object-snapper.cpp -path-chemistry.cpp -pencil-context.cpp -pen-context.cpp -persp3d.cpp -persp3d-reference.cpp -perspective-line.cpp -plugin.def -preferences.cpp -prefix.cpp -print.cpp -profile-manager.cpp -proj_pt.cpp -rect-context.cpp -rubberband.cpp -satisfied-guide-cns.cpp -selcue.cpp -select-context.cpp -selection-chemistry.cpp -selection.cpp -selection-describer.cpp -#selfname.tpl -seltrans.cpp -seltrans-handles.cpp -shape-editor.cpp -shortcuts.cpp -snap.cpp -snapped-line.cpp -snapped-point.cpp -snapper.cpp -star-context.cpp -style.cpp -#style-test.cpp -svg-view.cpp -svg-view-widget.cpp -text-chemistry.cpp -text-context.cpp -text-editing.cpp -tools-switch.cpp -transf_mat_3x4.cpp -tweak-context.cpp -uri.cpp -uri-references.cpp -vanishing-point.cpp -verbs.cpp -version.cpp -zoom-context.cpp -${ONLY_WIN} +set(INKSCAPE_SRC + arc-context.cpp + attributes.cpp + axis-manip.cpp + box3d-context.cpp + box3d-side.cpp + box3d.cpp + color-profile.cpp + color.cpp + common-context.cpp + composite-undo-stack-observer.cpp + conditions.cpp + conn-avoid-ref.cpp + connection-points.cpp + connector-context.cpp + console-output-undo-observer.cpp + context-fns.cpp + desktop-events.cpp + desktop-handles.cpp + desktop-style.cpp + desktop.cpp + device-manager.cpp + dir-util.cpp + document-subset.cpp + document-undo.cpp + document.cpp + doxygen-main.cpp + draw-anchor.cpp + draw-context.cpp + dropper-context.cpp + dyna-draw-context.cpp + ege-adjustment-action.cpp + ege-color-prof-tracker.cpp + ege-output-action.cpp + ege-select-one-action.cpp + eraser-context.cpp + event-context.cpp + event-log.cpp + extract-uri.cpp + file.cpp + filter-chemistry.cpp + filter-enums.cpp + fixes.cpp + flood-context.cpp + gc-anchored.cpp + gc-finalized.cpp + gc.cpp + gradient-chemistry.cpp + gradient-context.cpp + gradient-drag.cpp + graphlayout.cpp + guide-snapper.cpp + help.cpp + id-clash.cpp + ige-mac-menu.c + ink-action.cpp + ink-comboboxentry-action.cpp + inkscape-version.cpp + inkscape.cpp + inkscape.rc + inkview.cpp + inkview.rc + interface.cpp + knot-holder-entity.cpp + knot.cpp + knotholder.cpp + layer-fns.cpp + layer-manager.cpp + line-geometry.cpp + line-snapper.cpp + lpe-tool-context.cpp + main-cmdlineact.cpp + main.cpp + marker.cpp + measure-context.cpp + media.cpp + message-context.cpp + message-stack.cpp + mod360.cpp + object-edit.cpp + object-hierarchy.cpp + object-snapper.cpp + path-chemistry.cpp + pen-context.cpp + pencil-context.cpp + persp3d-reference.cpp + persp3d.cpp + perspective-line.cpp + preferences.cpp + prefix.cpp + print.cpp + profile-manager.cpp + proj_pt.cpp + rdf.cpp + rect-context.cpp + removeoverlap.cpp + resource-manager.cpp + rubberband.cpp + satisfied-guide-cns.cpp + selcue.cpp + select-context.cpp + selection-chemistry.cpp + selection-describer.cpp + selection.cpp + seltrans-handles.cpp + seltrans.cpp + shape-editor.cpp + shortcuts.cpp + snap-preferences.cpp + snap.cpp + snapped-curve.cpp + snapped-line.cpp + snapped-point.cpp + snapper.cpp + spray-context.cpp + star-context.cpp + style.cpp + svg-view-widget.cpp + svg-view.cpp + text-chemistry.cpp + text-context.cpp + text-editing.cpp + tools-switch.cpp + transf_mat_3x4.cpp + tweak-context.cpp + unclump.cpp + unicoderange.cpp + uri-references.cpp + uri.cpp + vanishing-point.cpp + verbs.cpp + version.cpp + zoom-context.cpp ) + +if(WIN32) + list(APPEND INKSCAPE_SRC + registrytool.cpp + #deptool.cpp + winmain.cpp + ) +endif() + # All folders for internal inkscape -SET(internalfolders -#algorithms -#api -bind -debug -dialogs -display -dom -extension -filters -graphlayout -helper -inkjar -io -jabber_whiteboard -live_effects -pedro -removeoverlap -svg -trace -#traits -ui -util -widgets -xml -2geom +set(internalfolders + #algorithms + #api + bind + debug + dialogs + display + dom + extension + filters + helper + io + jabber_whiteboard + live_effects + pedro + svg + trace + #traits + ui + util + widgets + xml + 2geom ) -SET(libfolders -# Directories containing lists files that describe building internal libraries -libavoid -libcola -libcroco -libgdl -libnr -libnrtype -libvpsc -livarot + +set(libfolders + # Directories containing lists files that describe building internal libraries + libavoid + libcola + libcroco + libgdl + libnr + libnrtype + libvpsc + livarot ) -SET(dirs ${internalfolders} ${libfolders} +set(dirs + ${internalfolders} + ${libfolders} ) -FOREACH(srclistsrc ${dirs}) - ADD_SUBDIRECTORY(${srclistsrc}) -ENDFOREACH(srclistsrc) +foreach(srclistsrc ${dirs}) + add_subdirectory(${srclistsrc}) +endforeach() -SET(INKSCAPE_SRC ${INKSCAPE_SRC} ${GlibOutput}) +set(INKSCAPE_SRC + ${INKSCAPE_SRC} + ${GlibOutput} +) -ADD_LIBRARY(sp STATIC ${SP_SRC}) -TARGET_LINK_LIBRARIES(sp -nr nrtype avoid cola croco gdl vpsc livarot ${internalfolders} ${INKSCAPE_LIBS} +add_library(sp STATIC ${SP_SRC}) +target_link_libraries(sp + nr + nrtype + avoid + cola + croco + gdl + vpsc + livarot + ${internalfolders} + ${INKSCAPE_LIBS} ) + # make executable for INKSCAPE -ADD_EXECUTABLE(inkscape ${INKSCAPE_SRC}) -TARGET_LINK_LIBRARIES(inkscape -nr nrtype sp avoid cola croco gdl vpsc livarot ${internalfolders} ${INKSCAPE_LIBS} +add_executable(inkscape ${INKSCAPE_SRC}) + +target_link_libraries(inkscape + nr + nrtype + sp + avoid + cola + croco + gdl + vpsc + livarot + ${internalfolders} + ${INKSCAPE_LIBS} + + + # system libs + xslt + gtkspell + gsl + gslcblas + gtkmm-2.4 + atkmm-1.6 + gdkmm-2.4 + giomm-2.4 + pangomm-1.4 + gtk-x11-2.0 + glibmm-2.4 + cairomm-1.0 + sigc-2.0 + atk-1.0 + gio-2.0 + png + X11 + xml2 + dl + gomp + popt + aspell + gnomevfs-2 + gconf-2 + pangoft2-1.0 + fontconfig + freetype + z + Magick++ + MagickCore + gc + lcms + poppler-glib + gdk-x11-2.0 + poppler + pangocairo-1.0 + gdk_pixbuf-2.0 + png14 + m + pango-1.0 + cairo + gmodule-2.0 + gobject-2.0 + gthread-2.0 + rt + glib-2.0 + ) # make executable for INKVIEW diff --git a/src/bind/CMakeLists.txt b/src/bind/CMakeLists.txt index a6b5b6883..08b7876c2 100644 --- a/src/bind/CMakeLists.txt +++ b/src/bind/CMakeLists.txt @@ -1,7 +1,6 @@ -SET(bind_SRC -dobinding.cpp -javabind.cpp +set(bind_SRC + dobinding.cpp + javabind.cpp ) -ADD_LIBRARY(bind STATIC ${bind_SRC}) -TARGET_LINK_LIBRARIES(bind -${INKSCAPE_LIBS}) \ No newline at end of file +add_library(bind STATIC ${bind_SRC}) +target_link_libraries(bind ${INKSCAPE_LIBS}) diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 26c4e6934..2dab10144 100644 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -1,12 +1,13 @@ -SET(debug_SRC -demangle.cpp -heap.cpp -log-display-config.cpp -logger.cpp -sysv-heap.cpp -timestamp.cpp -gdk-event-latency-tracker.cpp + +set(debug_SRC + demangle.cpp + heap.cpp + log-display-config.cpp + logger.cpp + sysv-heap.cpp + timestamp.cpp + gdk-event-latency-tracker.cpp ) -ADD_LIBRARY(debug STATIC ${debug_SRC}) -TARGET_LINK_LIBRARIES(debug -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(debug STATIC ${debug_SRC}) +target_link_libraries(debug 2geom ${INKSCAPE_LIBS}) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index 9bcb1cd5a..aa8f836d5 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -1,25 +1,13 @@ -SET(dialogs_SRC -clonetiler.cpp -dialog-events.cpp -export.cpp -extensions.cpp -fill-style.cpp -find.cpp -guidelinedialog.cpp -iconpreview.cpp -in-dt-coordsys.cpp -item-properties.cpp -layer-properties.cpp -layers-panel.cpp -object-attributes.cpp -rdf.cpp -sp-attribute-widget.cpp -stroke-style.cpp -swatches.cpp -text-edit.cpp -unclump.cpp -xml-tree.cpp +set(dialogs_SRC + clonetiler.cpp + dialog-events.cpp + export.cpp + find.cpp + item-properties.cpp + object-attributes.cpp + spellcheck.cpp + text-edit.cpp + xml-tree.cpp ) -ADD_LIBRARY(dialogs STATIC ${dialogs_SRC}) -TARGET_LINK_LIBRARIES(dialogs -2geom ${INKSCAPE_LIBS}) +add_library(dialogs STATIC ${dialogs_SRC}) +target_link_libraries(dialogs 2geom ${INKSCAPE_LIBS}) diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index 9fa2304be..1d3e09200 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -1,59 +1,66 @@ -SET(display_SRC -canvas-arena.cpp -canvas-axonomgrid.cpp -canvas-bpath.cpp -canvas-grid.cpp -canvas-temporary-item.cpp -canvas-temporary-item-list.cpp -curve.cpp -gnome-canvas-acetate.cpp -guideline.cpp -inkscape-cairo.cpp -nr-3dutils.cpp -nr-arena.cpp -nr-arena-glyphs.cpp -nr-arena-group.cpp -nr-arena-image.cpp -nr-arena-item.cpp -nr-arena-shape.cpp -nr-filter-blend.cpp -nr-filter-colormatrix.cpp -nr-filter-component-transfer.cpp -nr-filter-composite.cpp -nr-filter-convolve-matrix.cpp -nr-filter.cpp -nr-filter-diffuselighting.cpp -nr-filter-displacement-map.cpp -nr-filter-flood.cpp -nr-filter-gaussian.cpp -nr-filter-getalpha.cpp -nr-filter-image.cpp -nr-filter-merge.cpp -nr-filter-morphology.cpp -nr-filter-offset.cpp -nr-filter-primitive.cpp -nr-filter-skeleton.cpp -nr-filter-slot.cpp -nr-filter-specularlighting.cpp -nr-filter-tile.cpp -nr-filter-turbulence.cpp -nr-filter-units.cpp -nr-filter-utils.cpp -nr-light.cpp -nr-plain-stuff.cpp -nr-plain-stuff-gdk.cpp -nr-svgfonts.h -pixblock-scaler.cpp -pixblock-transform.cpp -snap-indicator.cpp -sodipodi-ctrl.cpp -sodipodi-ctrlrect.cpp -sp-canvas.cpp -sp-canvas-util.cpp -sp-ctrlline.cpp -sp-ctrlquadr.cpp -#testnr.cpp +set(display_SRC + canvas-arena.cpp + canvas-axonomgrid.cpp + canvas-bpath.cpp + canvas-grid.cpp + canvas-temporary-item-list.cpp + canvas-temporary-item.cpp + canvas-text.cpp + curve.cpp + gnome-canvas-acetate.cpp + grayscale.cpp + guideline.cpp + inkscape-cairo.cpp + nr-3dutils.cpp + nr-arena-glyphs.cpp + nr-arena-group.cpp + nr-arena-image.cpp + nr-arena-item.cpp + nr-arena-shape.cpp + nr-arena.cpp + nr-filter-blend.cpp + nr-filter-colormatrix.cpp + nr-filter-component-transfer.cpp + nr-filter-composite.cpp + nr-filter-convolve-matrix.cpp + nr-filter-diffuselighting.cpp + nr-filter-displacement-map.cpp + nr-filter-flood.cpp + nr-filter-gaussian.cpp + nr-filter-getalpha.cpp + nr-filter-image.cpp + nr-filter-merge.cpp + nr-filter-morphology.cpp + nr-filter-offset.cpp + nr-filter-primitive.cpp + nr-filter-skeleton.cpp + nr-filter-slot.cpp + nr-filter-specularlighting.cpp + nr-filter-tile.cpp + nr-filter-turbulence.cpp + nr-filter-units.cpp + nr-filter-utils.cpp + nr-filter.cpp + nr-light.cpp + nr-plain-stuff-gdk.cpp + nr-plain-stuff.cpp + nr-svgfonts.cpp + nr-svgfonts.h + pixblock-scaler.cpp + pixblock-transform.cpp + snap-indicator.cpp + sodipodi-ctrl.cpp + sodipodi-ctrlrect.cpp + sp-canvas-util.cpp + sp-canvas.cpp + sp-ctrlline.cpp + sp-ctrlpoint.cpp + sp-ctrlquadr.cpp ) -ADD_LIBRARY(display STATIC ${display_SRC}) -TARGET_LINK_LIBRARIES(display -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +include_directories( + "${CMAKE_SOURCE_DIR}/src" +) + +add_library(display STATIC ${display_SRC}) +target_link_libraries(display 2geom ${INKSCAPE_LIBS}) diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 7c434eb77..53609d241 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -1,38 +1,38 @@ -SET(domfolders -io -odf -util -#work +set(domfolders + io + odf + util + #work ) -FOREACH(domlistsrc ${domfolders}) - ADD_SUBDIRECTORY(${domlistsrc}) -ENDFOREACH(domlistsrc) +foreach(domlistsrc ${domfolders}) + add_subdirectory(${domlistsrc}) +endforeach() -SET(dom_SRC -cssreader.cpp -domimpl.cpp -domptr.cpp -domstring.cpp -lsimpl.cpp -prop-css2.cpp -#prop-css.cpp -#prop-svg.cpp -smilimpl.cpp -svgimpl.cpp -svgreader.cpp -ucd.cpp -uri.cpp -xmlreader.cpp -xmlwriter.cpp -xpathimpl.cpp -xpathparser.cpp -xpathtoken.cpp -${dom_io_SRC} -${dom_odf_SRC} -${dom_util_SRC} -#${dom_work_SRC} +set(dom_SRC + cssreader.cpp + domimpl.cpp + domptr.cpp + domstring.cpp + lsimpl.cpp + prop-css2.cpp + prop-css.cpp + prop-svg.cpp + smilimpl.cpp + svgimpl.cpp + svgreader.cpp + ucd.cpp + uri.cpp + xmlreader.cpp + xmlwriter.cpp + xpathimpl.cpp + xpathparser.cpp + xpathtoken.cpp + ${dom_io_SRC} + ${dom_odf_SRC} + ${dom_util_SRC} + #${dom_work_SRC} ) -ADD_LIBRARY(dom STATIC ${dom_SRC}) -TARGET_LINK_LIBRARIES(dom -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(dom STATIC ${dom_SRC}) +target_link_libraries(dom 2geom ${INKSCAPE_LIBS}) \ No newline at end of file diff --git a/src/dom/io/CMakeLists.txt b/src/dom/io/CMakeLists.txt index c8a98466d..0b0b4630d 100644 --- a/src/dom/io/CMakeLists.txt +++ b/src/dom/io/CMakeLists.txt @@ -1,11 +1,11 @@ -SET(dom_io_SRC -base64stream.cpp -bufferstream.cpp -domstream.cpp -gzipstream.cpp -httpclient.cpp -socket.cpp -stringstream.cpp -uristream.cpp +set(dom_io_SRC + base64stream.cpp + bufferstream.cpp + domstream.cpp + gzipstream.cpp + httpclient.cpp + socket.cpp + stringstream.cpp + uristream.cpp ) diff --git a/src/dom/odf/CMakeLists.txt b/src/dom/odf/CMakeLists.txt index e0cb76060..089f65fbf 100644 --- a/src/dom/odf/CMakeLists.txt +++ b/src/dom/odf/CMakeLists.txt @@ -1,5 +1,5 @@ -SET(dom_odf_SRC -odfdocument.cpp -#SvgOdg.cpp +set(dom_odf_SRC + odfdocument.cpp + #SvgOdg.cpp ) diff --git a/src/dom/util/CMakeLists.txt b/src/dom/util/CMakeLists.txt index 167e980c9..e5f583fa5 100644 --- a/src/dom/util/CMakeLists.txt +++ b/src/dom/util/CMakeLists.txt @@ -1,6 +1,6 @@ -SET(dom_util_SRC -digest.cpp -thread.cpp -ziptool.cpp +set(dom_util_SRC + digest.cpp + thread.cpp + ziptool.cpp ) diff --git a/src/dom/work/CMakeLists.txt b/src/dom/work/CMakeLists.txt index 8cd4676cf..52552c8b9 100644 --- a/src/dom/work/CMakeLists.txt +++ b/src/dom/work/CMakeLists.txt @@ -1,12 +1,12 @@ -SET(dom_work_SRC -#testdom.cpp -#testhttp.cpp -#testjs.cpp -#testodf.cpp -#testsvg.cpp -#testuri.cpp -#testxpath.cpp -#testzip.cpp -#xpathtests.cpp +set(dom_work_SRC + #testdom.cpp + #testhttp.cpp + #testjs.cpp + #testodf.cpp + #testsvg.cpp + #testuri.cpp + #testxpath.cpp + #testzip.cpp + #xpathtests.cpp ) diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index cd640d3d0..73697fbe7 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -1,41 +1,41 @@ -SET(extfolders -#dxf2svg -implementation -internal -internal/bitmap -internal/filter -internal/pdfinput -param -script +set(extfolders + #dxf2svg + implementation + internal + internal/bitmap + internal/filter + internal/pdfinput + param + script ) -FOREACH(extlistsrc ${extfolders}) - ADD_SUBDIRECTORY(${extlistsrc}) -ENDFOREACH(extlistsrc) +foreach(extlistsrc ${extfolders}) + add_subdirectory(${extlistsrc}) +endforeach() -SET(extension_SRC -db.cpp -dependency.cpp -effect.cpp -error-file.cpp -execution-env.cpp -extension.cpp -init.cpp -input.cpp -output.cpp -patheffect.cpp -prefdialog.cpp -print.cpp -system.cpp -timer.cpp -#${extension_dxf2svg_SRC} -${extension_implementation_SRC} -${extension_internal_bitmap_SRC} -${extension_internal_filter_SRC} -${extension_internal_pdfinput_SRC} -${extension_param_SRC} -${extension_script_SRC} +set(extension_SRC + db.cpp + dependency.cpp + effect.cpp + error-file.cpp + execution-env.cpp + extension.cpp + init.cpp + input.cpp + output.cpp + patheffect.cpp + prefdialog.cpp + print.cpp + system.cpp + timer.cpp + #${extension_dxf2svg_SRC} + ${extension_implementation_SRC} + ${extension_internal_bitmap_SRC} + ${extension_internal_filter_SRC} + ${extension_internal_pdfinput_SRC} + ${extension_param_SRC} + ${extension_script_SRC} ) -ADD_LIBRARY(extension STATIC ${extension_SRC}) -TARGET_LINK_LIBRARIES(extension -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(extension STATIC ${extension_SRC}) +target_link_libraries(extension 2geom ${INKSCAPE_LIBS}) diff --git a/src/extension/dxf2svg/CMakeLists.txt b/src/extension/dxf2svg/CMakeLists.txt index b755d7f44..0ff0eaec0 100644 --- a/src/extension/dxf2svg/CMakeLists.txt +++ b/src/extension/dxf2svg/CMakeLists.txt @@ -1,11 +1,11 @@ -SET(extension_dxf2svg_SRC -#aci2rgb.cpp -#entities2elements.cpp -#tables2svg_info.cpp -#blocks.cpp -#entities.cpp -#tables.cpp -#dxf2svg.cpp -#read_dxf.cpp -#test_dxf.cpp +set(extension_dxf2svg_SRC + #aci2rgb.cpp + #entities2elements.cpp + #tables2svg_info.cpp + #blocks.cpp + #entities.cpp + #tables.cpp + #dxf2svg.cpp + #read_dxf.cpp + #test_dxf.cpp ) diff --git a/src/extension/implementation/CMakeLists.txt b/src/extension/implementation/CMakeLists.txt index 87e1b2541..dcdf092c2 100644 --- a/src/extension/implementation/CMakeLists.txt +++ b/src/extension/implementation/CMakeLists.txt @@ -1,5 +1,5 @@ -SET(extension_implementation_SRC -implementation.cpp -xslt.cpp -script.cpp +set(extension_implementation_SRC + implementation.cpp + xslt.cpp + script.cpp ) diff --git a/src/extension/internal/CMakeLists.txt b/src/extension/internal/CMakeLists.txt index 8b23cb0ac..d13ec9f74 100644 --- a/src/extension/internal/CMakeLists.txt +++ b/src/extension/internal/CMakeLists.txt @@ -1,31 +1,29 @@ -IF(WIN32) -SET(EXT_INT_WIN -win32.cpp +set(extension_internal_SRC + bluredge.cpp + cairo-png-out.cpp + cairo-ps-out.cpp + cairo-render-context.cpp + cairo-renderer.cpp + cairo-renderer-pdf-out.cpp + emf-win32-inout.cpp + emf-win32-print.cpp + gdkpixbuf-input.cpp + gimpgrad.cpp + grid.cpp + latex-pstricks.cpp + latex-pstricks-out.cpp + odf.cpp + latex-text-renderer.cpp + pdf-input-cairo.cpp + pov-out.cpp + javafx-out.cpp + svg.cpp + svgz.cpp + wpg-input.cpp ) -ENDIF(WIN32) -SET(extension_internal_SRC -bluredge.cpp -cairo-png-out.cpp -cairo-ps-out.cpp -cairo-render-context.cpp -cairo-renderer.cpp -cairo-renderer-pdf-out.cpp -emf-win32-inout.cpp -emf-win32-print.cpp -gdkpixbuf-input.cpp -gimpgrad.cpp -grid.cpp -latex-pstricks.cpp -latex-pstricks-out.cpp -odf.cpp -pdfinput -latex-text-renderer.cpp -pdf-input-cairo.cpp -pov-out.cpp -javafx-out.cpp -svg.cpp -svgz.cpp -wpg-input.cpp -${EXT_INT_WIN} -) +if(WIN32) + list(APPEND extension_internal_SRC + win32.cpp + ) +endif() diff --git a/src/extension/internal/bitmap/CMakeLists.txt b/src/extension/internal/bitmap/CMakeLists.txt index 8aec17492..a273804ba 100644 --- a/src/extension/internal/bitmap/CMakeLists.txt +++ b/src/extension/internal/bitmap/CMakeLists.txt @@ -1,37 +1,37 @@ -SET(extension_internal_bitmap_SRC -adaptiveThreshold.cpp -addNoise.cpp -blur.cpp -channel.cpp -charcoal.cpp -colorize.cpp -contrast.cpp -cycleColormap.cpp -despeckle.cpp -edge.cpp -emboss.cpp -enhance.cpp -equalize.cpp -gaussianBlur.cpp -imagemagick.cpp -implode.cpp -levelChannel.cpp -level.cpp -medianFilter.cpp -modulate.cpp -negate.cpp -normalize.cpp -oilPaint.cpp -opacity.cpp -raise.cpp -reduceNoise.cpp -sample.cpp -shade.cpp -sharpen.cpp -solarize.cpp -spread.cpp -swirl.cpp -threshold.cpp -unsharpmask.cpp -wave.cpp +set(extension_internal_bitmap_SRC + adaptiveThreshold.cpp + addNoise.cpp + blur.cpp + channel.cpp + charcoal.cpp + colorize.cpp + contrast.cpp + cycleColormap.cpp + despeckle.cpp + edge.cpp + emboss.cpp + enhance.cpp + equalize.cpp + gaussianBlur.cpp + imagemagick.cpp + implode.cpp + levelChannel.cpp + level.cpp + medianFilter.cpp + modulate.cpp + negate.cpp + normalize.cpp + oilPaint.cpp + opacity.cpp + raise.cpp + reduceNoise.cpp + sample.cpp + shade.cpp + sharpen.cpp + solarize.cpp + spread.cpp + swirl.cpp + threshold.cpp + unsharpmask.cpp + wave.cpp ) diff --git a/src/extension/internal/filter/CMakeLists.txt b/src/extension/internal/filter/CMakeLists.txt index 80a14ba3a..349504f94 100644 --- a/src/extension/internal/filter/CMakeLists.txt +++ b/src/extension/internal/filter/CMakeLists.txt @@ -1,8 +1,8 @@ -SET(extension_internal_filter_SRC -drop-shadow.h -filter-all.cpp -filter.cpp -filter-file.cpp -filter.h -snow.h +set(extension_internal_filter_SRC + drop-shadow.h + filter-all.cpp + filter.cpp + filter-file.cpp + filter.h + snow.h ) diff --git a/src/extension/internal/pdfinput/CMakeLists.txt b/src/extension/internal/pdfinput/CMakeLists.txt index 9a093a065..fe31c2a7f 100644 --- a/src/extension/internal/pdfinput/CMakeLists.txt +++ b/src/extension/internal/pdfinput/CMakeLists.txt @@ -1,5 +1,5 @@ -SET(extension_internal_pdfinput_SRC -pdf-input.cpp -pdf-parser.cpp -svg-builder.cpp +set(extension_internal_pdfinput_SRC + pdf-input.cpp + pdf-parser.cpp + svg-builder.cpp ) diff --git a/src/extension/param/CMakeLists.txt b/src/extension/param/CMakeLists.txt index 2ef5d5005..b2981308e 100644 --- a/src/extension/param/CMakeLists.txt +++ b/src/extension/param/CMakeLists.txt @@ -1,14 +1,13 @@ -SET(extension_param_SRC -bool.cpp -color.cpp -description.cpp -groupheader.cpp -enum.cpp -parameter.cpp -float.cpp -int.cpp -notebook.cpp -radiobutton.cpp -string.cpp +set(extension_param_SRC + bool.cpp + color.cpp + description.cpp + enum.cpp + float.cpp + int.cpp + notebook.cpp + parameter.cpp + radiobutton.cpp + string.cpp ) diff --git a/src/extension/script/CMakeLists.txt b/src/extension/script/CMakeLists.txt index 693948508..88977164e 100644 --- a/src/extension/script/CMakeLists.txt +++ b/src/extension/script/CMakeLists.txt @@ -1,3 +1,3 @@ -SET(extension_script_SRC -InkscapeScript.cpp +set(extension_script_SRC + InkscapeScript.cpp ) diff --git a/src/filters/CMakeLists.txt b/src/filters/CMakeLists.txt index 554402d35..32819fa68 100644 --- a/src/filters/CMakeLists.txt +++ b/src/filters/CMakeLists.txt @@ -1,25 +1,24 @@ -SET(filters_SRC -blend.cpp -colormatrix.cpp -componenttransfer.cpp -componenttransfer-funcnode.cpp -composite.cpp -convolvematrix.cpp -diffuselighting.cpp -displacementmap.cpp -distantlight.cpp -flood.cpp -image.cpp -merge.cpp -mergenode.cpp -morphology.cpp -offset.cpp -pointlight.cpp -specularlighting.cpp -spotlight.cpp -tile.cpp -turbulence.cpp +set(filters_SRC + blend.cpp + colormatrix.cpp + componenttransfer.cpp + componenttransfer-funcnode.cpp + composite.cpp + convolvematrix.cpp + diffuselighting.cpp + displacementmap.cpp + distantlight.cpp + flood.cpp + image.cpp + merge.cpp + mergenode.cpp + morphology.cpp + offset.cpp + pointlight.cpp + specularlighting.cpp + spotlight.cpp + tile.cpp + turbulence.cpp ) -ADD_LIBRARY(filters STATIC ${filters_SRC}) -TARGET_LINK_LIBRARIES(filters -2geom ${INKSCAPE_LIBS}) +add_library(filters STATIC ${filters_SRC}) +target_link_libraries(filters 2geom ${INKSCAPE_LIBS}) diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index 8f42a0d5a..e2ca2336d 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -1,29 +1,31 @@ include(UseGlibMarshal) GLIB_MARSHAL(sp_marshal sp-marshal "${CMAKE_CURRENT_BINARY_DIR}/helper") -SET(GlibOutput -${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.cpp -${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.h + +set(GlibOutput + ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.cpp + ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.h ) -SET(helper_SRC -action.cpp -geom.cpp -geom-nodetype.cpp -gnome-utils.cpp -pixbuf-ops.cpp -png-write.cpp -stock-items.cpp -unit-menu.cpp -units.cpp -#units-test.cpp -unit-tracker.cpp -window.cpp -sp-marshal.list -# we generate this file and it's .h counter-part -${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.cpp -${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.h +set(helper_SRC + action.cpp + geom.cpp + geom-nodetype.cpp + gnome-utils.cpp + pixbuf-ops.cpp + png-write.cpp + stock-items.cpp + unit-menu.cpp + units.cpp + #units-test.cpp + unit-tracker.cpp + window.cpp + sp-marshal.cpp + sp-marshal.list + # we generate this file and it's .h counter-part + ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.cpp + ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.h ) -ADD_LIBRARY(helper STATIC ${helper_SRC}) -TARGET_LINK_LIBRARIES(helper -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(helper STATIC ${helper_SRC}) +target_link_libraries(helper 2geom ${INKSCAPE_LIBS}) \ No newline at end of file diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index 13b8f568b..b60830042 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -1,16 +1,15 @@ -SET(io_SRC -base64stream.cpp -ftos.cpp -gzipstream.cpp -inkscapestream.cpp -resource.cpp -simple-sax.cpp -#streamtest.cpp -stringstream.cpp -sys.cpp -uristream.cpp -xsltstream.cpp +set(io_SRC + base64stream.cpp + ftos.cpp + gzipstream.cpp + inkjar.cpp + inkscapestream.cpp + resource.cpp + simple-sax.cpp + stringstream.cpp + sys.cpp + uristream.cpp + xsltstream.cpp ) -ADD_LIBRARY(io STATIC ${io_SRC}) -TARGET_LINK_LIBRARIES(io -2geom ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(io STATIC ${io_SRC}) +target_link_libraries(io 2geom ${INKSCAPE_LIBS}) diff --git a/src/jabber_whiteboard/CMakeLists.txt b/src/jabber_whiteboard/CMakeLists.txt index 5f4dfa981..6975d06d6 100644 --- a/src/jabber_whiteboard/CMakeLists.txt +++ b/src/jabber_whiteboard/CMakeLists.txt @@ -1,23 +1,23 @@ -ADD_SUBDIRECTORY(dialog) +add_subdirectory(dialog) -SET(jabber_whiteboard_SRC -defines.cpp -empty.cpp -inkboard-document.cpp -inkboard-node.cpp -invitation-confirm-dialog.cpp -keynode.cpp -message-aggregator.cpp -message-queue.cpp -message-tags.cpp -message-utilities.cpp -#node-tracker.cpp -#node-utilities.cpp -pedrogui.cpp -session-file-selector.cpp -session-manager.cpp -${jabber_whiteboard_dialog_SRC} +set(jabber_whiteboard_SRC + defines.cpp + empty.cpp + inkboard-document.cpp + inkboard-node.cpp + invitation-confirm-dialog.cpp + keynode.cpp + message-aggregator.cpp + message-queue.cpp + message-tags.cpp + message-utilities.cpp + #node-tracker.cpp + #node-utilities.cpp + pedrogui.cpp + session-file-selector.cpp + session-manager.cpp + ${jabber_whiteboard_dialog_SRC} ) -ADD_LIBRARY(jabber_whiteboard STATIC ${jabber_whiteboard_SRC}) -TARGET_LINK_LIBRARIES(jabber_whiteboard -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(jabber_whiteboard STATIC ${jabber_whiteboard_SRC}) +target_link_libraries(jabber_whiteboard 2geom ${INKSCAPE_LIBS}) \ No newline at end of file diff --git a/src/jabber_whiteboard/dialog/CMakeLists.txt b/src/jabber_whiteboard/dialog/CMakeLists.txt index 74863aa4b..8272a61e2 100644 --- a/src/jabber_whiteboard/dialog/CMakeLists.txt +++ b/src/jabber_whiteboard/dialog/CMakeLists.txt @@ -1,3 +1,4 @@ -SET(jabber_whiteboard_dialog_SRC -choose-desktop.cpp + +set(jabber_whiteboard_dialog_SRC + choose-desktop.cpp ) diff --git a/src/libavoid/CMakeLists.txt b/src/libavoid/CMakeLists.txt index 3f408074c..b76cf1d39 100644 --- a/src/libavoid/CMakeLists.txt +++ b/src/libavoid/CMakeLists.txt @@ -1,19 +1,18 @@ -SET(libavoid_SRC -connector.cpp -geometry.cpp -graph.cpp -makepath.cpp -polyutil.cpp -region.cpp -router.cpp -shape.cpp -static.cpp -timer.cpp -vertices.cpp -visibility.cpp -orthogonal.cpp -vpsc.cpp +set(libavoid_SRC + connector.cpp + geometry.cpp + geomtypes.cpp + graph.cpp + makepath.cpp + orthogonal.cpp + router.cpp + shape.cpp + timer.cpp + vertices.cpp + viscluster.cpp + visibility.cpp + vpsc.cpp ) -ADD_LIBRARY(avoid STATIC ${libavoid_SRC}) -TARGET_LINK_LIBRARIES(avoid -${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(avoid STATIC ${libavoid_SRC}) +target_link_libraries(avoid ${INKSCAPE_LIBS}) \ No newline at end of file diff --git a/src/libcola/CMakeLists.txt b/src/libcola/CMakeLists.txt index b5f2e7f1f..19ac816b2 100644 --- a/src/libcola/CMakeLists.txt +++ b/src/libcola/CMakeLists.txt @@ -1,12 +1,11 @@ -SET(libcola_SRC -cola.cpp -conjugate_gradient.cpp -connected_components.cpp -cycle_detector.cpp -gradient_projection.cpp -shortest_paths.cpp -straightener.cpp +set(libcola_SRC + cola.cpp + conjugate_gradient.cpp + connected_components.cpp + cycle_detector.cpp + gradient_projection.cpp + shortest_paths.cpp + straightener.cpp ) -ADD_LIBRARY(cola STATIC ${libcola_SRC}) -TARGET_LINK_LIBRARIES(cola -${INKSCAPE_LIBS}) \ No newline at end of file +add_library(cola STATIC ${libcola_SRC}) +target_link_libraries(cola ${INKSCAPE_LIBS}) \ No newline at end of file diff --git a/src/libcroco/CMakeLists.txt b/src/libcroco/CMakeLists.txt index 3ca55b4b5..7e8aa9176 100644 --- a/src/libcroco/CMakeLists.txt +++ b/src/libcroco/CMakeLists.txt @@ -1,32 +1,33 @@ -SET(libcroco_SRC -cr-additional-sel.c -cr-attr-sel.c -cr-cascade.c -cr-declaration.c -cr-doc-handler.c -cr-enc-handler.c -cr-fonts.c -cr-input.c -cr-libxml-node-iface.c -cr-num.c -cr-om-parser.c -cr-parser.c -cr-parsing-location.c -cr-prop-list.c -cr-pseudo.c -cr-rgb.c -cr-selector.c -cr-sel-eng.c -cr-simple-sel.c -cr-statement.c -cr-string.c -cr-style.c -cr-stylesheet.c -cr-term.c -cr-tknzr.c -cr-token.c -cr-utils.c + +set(libcroco_SRC + cr-additional-sel.c + cr-attr-sel.c + cr-cascade.c + cr-declaration.c + cr-doc-handler.c + cr-enc-handler.c + cr-fonts.c + cr-input.c + cr-libxml-node-iface.c + cr-num.c + cr-om-parser.c + cr-parser.c + cr-parsing-location.c + cr-prop-list.c + cr-pseudo.c + cr-rgb.c + cr-selector.c + cr-sel-eng.c + cr-simple-sel.c + cr-statement.c + cr-string.c + cr-style.c + cr-stylesheet.c + cr-term.c + cr-tknzr.c + cr-token.c + cr-utils.c ) -ADD_LIBRARY(croco STATIC ${libcroco_SRC}) -TARGET_LINK_LIBRARIES(croco -${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(croco STATIC ${libcroco_SRC}) +target_link_libraries(croco ${INKSCAPE_LIBS}) diff --git a/src/libgdl/CMakeLists.txt b/src/libgdl/CMakeLists.txt index dea93e6bc..f59ec5420 100644 --- a/src/libgdl/CMakeLists.txt +++ b/src/libgdl/CMakeLists.txt @@ -1,28 +1,29 @@ -IF(WIN32) -SET(GDL_WIN -gdl-win32.c -) -ENDIF(WIN32) -SET(libgdl_SRC -gdl-dock.c -gdl-dock-bar.c -gdl-dock-item.c -gdl-dock-item-grip.c -gdl-dock-master.c -gdl-dock-notebook.c -gdl-dock-object.c -gdl-dock-paned.c -gdl-dock-placeholder.c -gdl-dock-tablabel.c -gdl-i18n.c -gdl-stock.c -gdl-switcher.c -gdl-tools.h -libgdlmarshal.c -libgdltypebuiltins.c -${GDL_WIN} +set(libgdl_SRC + gdl-dock.c + gdl-dock-bar.c + gdl-dock-item.c + gdl-dock-item-grip.c + gdl-dock-master.c + gdl-dock-notebook.c + gdl-dock-object.c + gdl-dock-paned.c + gdl-dock-placeholder.c + gdl-dock-tablabel.c + gdl-i18n.c + gdl-stock.c + gdl-switcher.c + gdl-tools.h + libgdlmarshal.c + libgdltypebuiltins.c + ${GDL_WIN} ) + +if(WIN32) + list(APPEND libgdl_SRC + gdl-win32.c + ) +endif() + ADD_LIBRARY(gdl STATIC ${libgdl_SRC}) -TARGET_LINK_LIBRARIES(gdl -${INKSCAPE_LIBS}) \ No newline at end of file +TARGET_LINK_LIBRARIES(gdl ${INKSCAPE_LIBS}) diff --git a/src/libnr/CMakeLists.txt b/src/libnr/CMakeLists.txt index 3bf483181..798eb0d11 100644 --- a/src/libnr/CMakeLists.txt +++ b/src/libnr/CMakeLists.txt @@ -1,36 +1,37 @@ -SET(libnr_SRC -#in-svg-plane-test.cpp -nr-blit.cpp -nr-compose.cpp -nr-compose-transform.cpp -nr-gradient.cpp -nr-matrix.cpp -nr-matrix-div.cpp -nr-matrix-fns.cpp -nr-matrix-rotate-ops.cpp -nr-object.cpp -nr-pixblock.cpp -nr-pixblock-line.cpp -nr-pixblock-pattern.cpp -nr-pixblock-pixel.cpp -nr-point-fns.cpp -#nr-point-fns-test.cpp -nr-rect.cpp -nr-rect-l.cpp -nr-rotate-fns.cpp -#nr-rotate-fns-test.cpp -nr-rotate-matrix-ops.cpp -nr-scale-matrix-ops.cpp -nr-scale-translate-ops.cpp -nr-translate-matrix-ops.cpp -nr-translate-rotate-ops.cpp -nr-translate-scale-ops.cpp -#nr-translate-test.cpp -nr-types.cpp -#nr-types-test.cpp -nr-values.cpp -testnr.cpp + +set(libnr_SRC + #in-svg-plane-test.cpp + nr-blit.cpp + nr-compose.cpp + nr-compose-transform.cpp + nr-gradient.cpp + nr-matrix.cpp + nr-matrix-div.cpp + nr-matrix-fns.cpp + nr-matrix-rotate-ops.cpp + nr-object.cpp + nr-pixblock.cpp + nr-pixblock-line.cpp + nr-pixblock-pattern.cpp + nr-pixblock-pixel.cpp + nr-point-fns.cpp + #nr-point-fns-test.cpp + nr-rect.cpp + nr-rect-l.cpp + nr-rotate-fns.cpp + #nr-rotate-fns-test.cpp + nr-rotate-matrix-ops.cpp + nr-scale-matrix-ops.cpp + nr-scale-translate-ops.cpp + nr-translate-matrix-ops.cpp + nr-translate-rotate-ops.cpp + nr-translate-scale-ops.cpp + #nr-translate-test.cpp + nr-types.cpp + #nr-types-test.cpp + nr-values.cpp + #testnr.cpp ) -ADD_LIBRARY(nr STATIC ${libnr_SRC}) -TARGET_LINK_LIBRARIES(nr -2geom ${INKSCAPE_LIBS}) + +add_library(nr STATIC ${libnr_SRC}) +target_link_libraries(nr 2geom ${INKSCAPE_LIBS}) diff --git a/src/libnr/testnr.cpp b/src/libnr/testnr.cpp index 12dce4c52..7ce01afab 100644 --- a/src/libnr/testnr.cpp +++ b/src/libnr/testnr.cpp @@ -9,6 +9,8 @@ * This code is in public domain */ +#include <stdio.h> + #if defined (_WIN32) || defined (__WIN32__) # include <windows.h> #include <glib.h> diff --git a/src/libnrtype/CMakeLists.txt b/src/libnrtype/CMakeLists.txt index 61ecb0091..4402e5066 100644 --- a/src/libnrtype/CMakeLists.txt +++ b/src/libnrtype/CMakeLists.txt @@ -1,19 +1,18 @@ -SET(libnrtype_SRC -FontFactory.cpp -FontInstance.cpp -font-lister.cpp -font-style-to-pos.cpp -Layout-TNG.cpp -Layout-TNG-Compute.cpp -Layout-TNG-Input.cpp -Layout-TNG-OutIter.cpp -Layout-TNG-Output.cpp -Layout-TNG-Scanline-Makers.cpp -nr-type-pos-def.cpp -nr-type-primitives.cpp -RasterFont.cpp -TextWrapper.cpp +set(libnrtype_SRC + FontFactory.cpp + FontInstance.cpp + font-lister.cpp + font-style-to-pos.cpp + Layout-TNG.cpp + Layout-TNG-Compute.cpp + Layout-TNG-Input.cpp + Layout-TNG-OutIter.cpp + Layout-TNG-Output.cpp + Layout-TNG-Scanline-Makers.cpp + nr-type-pos-def.cpp + nr-type-primitives.cpp + RasterFont.cpp + TextWrapper.cpp ) -ADD_LIBRARY(nrtype STATIC ${libnrtype_SRC}) -TARGET_LINK_LIBRARIES(nrtype -nr ${INKSCAPE_LIBS}) +add_library(nrtype STATIC ${libnrtype_SRC}) +target_link_libraries(nrtype nr ${INKSCAPE_LIBS}) diff --git a/src/libvpsc/CMakeLists.txt b/src/libvpsc/CMakeLists.txt index 4c3398b0f..57811ad0a 100644 --- a/src/libvpsc/CMakeLists.txt +++ b/src/libvpsc/CMakeLists.txt @@ -1,13 +1,14 @@ -SET(libvpsc_SRC -block.cpp -blocks.cpp -constraint.cpp -csolve_VPSC.cpp -generate-constraints.cpp -remove_rectangle_overlap.cpp -solve_VPSC.cpp -variable.cpp +set(libvpsc_SRC + block.cpp + blocks.cpp + constraint.cpp + csolve_VPSC.cpp + generate-constraints.cpp + remove_rectangle_overlap.cpp + solve_VPSC.cpp + variable.cpp + pairingheap/PairingHeap.cpp ) -ADD_LIBRARY(vpsc STATIC ${libvpsc_SRC}) -TARGET_LINK_LIBRARIES(vpsc -${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(vpsc STATIC ${libvpsc_SRC}) +target_link_libraries(vpsc ${INKSCAPE_LIBS}) diff --git a/src/livarot/CMakeLists.txt b/src/livarot/CMakeLists.txt index 6eaf84d1c..965926fb8 100644 --- a/src/livarot/CMakeLists.txt +++ b/src/livarot/CMakeLists.txt @@ -1,25 +1,25 @@ -SET(livarot_SRC -AlphaLigne.cpp -AVL.cpp -BitLigne.cpp -float-line.cpp -int-line.cpp -PathConversion.cpp -Path.cpp -PathCutting.cpp -path-description.cpp -PathOutline.cpp -PathSimplify.cpp -PathStroke.cpp -Shape.cpp -ShapeDraw.cpp -ShapeMisc.cpp -ShapeRaster.cpp -ShapeSweep.cpp -sweep-event.cpp -sweep-tree.cpp -sweep-tree-list.cpp +set(livarot_SRC + AlphaLigne.cpp + AVL.cpp + BitLigne.cpp + float-line.cpp + int-line.cpp + PathConversion.cpp + Path.cpp + PathCutting.cpp + path-description.cpp + PathOutline.cpp + PathSimplify.cpp + PathStroke.cpp + Shape.cpp + ShapeDraw.cpp + ShapeMisc.cpp + ShapeRaster.cpp + ShapeSweep.cpp + sweep-event.cpp + sweep-tree.cpp + sweep-tree-list.cpp ) -ADD_LIBRARY(livarot STATIC ${livarot_SRC}) -TARGET_LINK_LIBRARIES(nrtype -${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(livarot STATIC ${livarot_SRC}) +target_link_libraries(nrtype ${INKSCAPE_LIBS}) diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index 70e8cbaf8..42f8208ec 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -1,37 +1,48 @@ -ADD_SUBDIRECTORY(parameter) +add_subdirectory(parameter) -SET(live_effects_SRC -bezctx.cpp -effect.cpp -lpe-bendpath.cpp -lpe-boolops.cpp -lpe-circle_with_radius.cpp -lpe-constructgrid.cpp -lpe-curvestitch.cpp -lpe-envelope.cpp -lpe-gears.cpp -lpegroupbbox.cpp -lpe-interpolate.cpp -lpe-knot.cpp -lpe-rough-hatches.cpp -lpe-lattice.cpp -lpe-mirror_symmetry.cpp -lpeobject.cpp -lpeobject-reference.cpp -lpe-patternalongpath.cpp -lpe-perp_bisector.cpp -lpe-perspective_path.cpp -lpe-powerstroke.cpp -lpe-skeleton.cpp -lpe-sketch.cpp -lpe-spiro.cpp -lpe-tangent_to_curve.cpp -lpe-test-doEffect-stack.cpp -lpe-vonkoch.cpp -lpe-dynastroke.cpp -spiro.cpp -${live_effects_parameter_SRC} +set(live_effects_SRC + bezctx.cpp + effect.cpp + lpe-angle_bisector.cpp + lpe-bendpath.cpp + lpe-boolops.cpp + lpe-circle_3pts.cpp + lpe-circle_with_radius.cpp + lpe-constructgrid.cpp + lpe-copy_rotate.cpp + lpe-curvestitch.cpp + lpe-dynastroke.cpp + lpe-envelope.cpp + lpe-extrude.cpp + lpe-gears.cpp + lpe-interpolate.cpp + lpe-knot.cpp + lpe-lattice.cpp + lpe-line_segment.cpp + lpe-mirror_symmetry.cpp + lpe-offset.cpp + lpe-parallel.cpp + lpe-path_length.cpp + lpe-patternalongpath.cpp + lpe-perp_bisector.cpp + lpe-perspective_path.cpp + lpe-powerstroke.cpp + lpe-recursiveskeleton.cpp + lpe-rough-hatches.cpp + lpe-ruler.cpp + lpe-skeleton.cpp + lpe-sketch.cpp + lpe-spiro.cpp + lpe-tangent_to_curve.cpp + lpe-test-doEffect-stack.cpp + lpe-text_label.cpp + lpe-vonkoch.cpp + lpegroupbbox.cpp + lpeobject-reference.cpp + lpeobject.cpp + spiro.cpp + ${live_effects_parameter_SRC} ) -ADD_LIBRARY(live_effects STATIC ${live_effects_SRC}) -TARGET_LINK_LIBRARIES(live_effects -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(live_effects STATIC ${live_effects_SRC}) +target_link_libraries(live_effects 2geom ${INKSCAPE_LIBS}) diff --git a/src/live_effects/parameter/CMakeLists.txt b/src/live_effects/parameter/CMakeLists.txt index 8657b2bec..04a1080f4 100644 --- a/src/live_effects/parameter/CMakeLists.txt +++ b/src/live_effects/parameter/CMakeLists.txt @@ -1,13 +1,13 @@ -SET(live_effects_parameter_SRC -array.cpp -bool.cpp -parameter.cpp -path.cpp -path-reference.cpp -point.cpp -powerstrokepointarray.cpp -random.cpp -text.cpp -unit.cpp -vector.cpp +set(live_effects_parameter_SRC + array.cpp + bool.cpp + parameter.cpp + path.cpp + path-reference.cpp + point.cpp + powerstrokepointarray.cpp + random.cpp + text.cpp + unit.cpp + vector.cpp ) diff --git a/src/pedro/CMakeLists.txt b/src/pedro/CMakeLists.txt index cb9a01b2f..5595d755e 100644 --- a/src/pedro/CMakeLists.txt +++ b/src/pedro/CMakeLists.txt @@ -1,13 +1,12 @@ -SET(pedro_SRC -#empty.cpp -#geckoembed.cpp -pedroconfig.cpp -pedrodom.cpp -#pedrogui.cpp -#pedromain.cpp -pedroutil.cpp -pedroxmpp.cpp +set(pedro_SRC + #empty.cpp + #geckoembed.cpp + pedroconfig.cpp + pedrodom.cpp + #pedrogui.cpp + #pedromain.cpp + pedroutil.cpp + pedroxmpp.cpp ) -ADD_LIBRARY(pedro STATIC ${pedro_SRC}) -TARGET_LINK_LIBRARIES(pedro -${INKSCAPE_LIBS}) \ No newline at end of file +add_library(pedro STATIC ${pedro_SRC}) +target_link_libraries(pedro ${INKSCAPE_LIBS}) \ No newline at end of file diff --git a/src/svg/CMakeLists.txt b/src/svg/CMakeLists.txt index 9d5dc0b7b..b2c4b918e 100644 --- a/src/svg/CMakeLists.txt +++ b/src/svg/CMakeLists.txt @@ -1,18 +1,18 @@ -SET(svg_SRC -css-ostringstream.cpp -#ftos.cpp -itos.cpp -path-string.cpp -round.cpp -sp-svg.def -stringstream.cpp -strip-trailing-zeros.cpp -svg-affine.cpp -svg-color.cpp -svg-length.cpp -svg-path.cpp -#test-stubs.cpp +set(svg_SRC + css-ostringstream.cpp + #ftos.cpp + itos.cpp + path-string.cpp + round.cpp + sp-svg.def + stringstream.cpp + strip-trailing-zeros.cpp + svg-affine.cpp + svg-color.cpp + svg-length.cpp + svg-path.cpp + #test-stubs.cpp ) -ADD_LIBRARY(svg STATIC ${svg_SRC}) -TARGET_LINK_LIBRARIES(svg -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(svg STATIC ${svg_SRC}) +target_link_libraries(svg 2geom ${INKSCAPE_LIBS}) diff --git a/src/trace/CMakeLists.txt b/src/trace/CMakeLists.txt index 3cb378995..312ee209c 100644 --- a/src/trace/CMakeLists.txt +++ b/src/trace/CMakeLists.txt @@ -1,12 +1,12 @@ -ADD_SUBDIRECTORY(potrace) -SET(trace_SRC -filterset.cpp -imagemap.cpp -imagemap-gdk.cpp -quantize.cpp -siox.cpp -trace.cpp -${trace_potrace_SRC} +add_subdirectory(potrace) +set(trace_SRC + filterset.cpp + imagemap.cpp + imagemap-gdk.cpp + quantize.cpp + siox.cpp + trace.cpp + ${trace_potrace_SRC} ) ADD_LIBRARY(trace STATIC ${trace_SRC}) TARGET_LINK_LIBRARIES(trace diff --git a/src/trace/potrace/CMakeLists.txt b/src/trace/potrace/CMakeLists.txt index f61e8bcd1..e48d7689f 100644 --- a/src/trace/potrace/CMakeLists.txt +++ b/src/trace/potrace/CMakeLists.txt @@ -1,9 +1,9 @@ -SET(trace_potrace_SRC -curve.cpp -decompose.cpp -greymap.cpp -inkscape-potrace.cpp -potracelib.cpp -render.cpp -trace.cpp +set(trace_potrace_SRC + curve.cpp + decompose.cpp + greymap.cpp + inkscape-potrace.cpp + potracelib.cpp + render.cpp + trace.cpp ) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 01dadb7c2..28dcd1ded 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,24 +1,46 @@ -SET(uifolders -cache -dialog -view -widget +set(uifolders + cache + dialog + view + widget ) -FOREACH(uilistsrc ${uifolders}) - ADD_SUBDIRECTORY(${uilistsrc}) -ENDFOREACH(uilistsrc) +foreach(uilistsrc ${uifolders}) + add_subdirectory(${uilistsrc}) +endforeach() -SET(ui_SRC -clipboard.cpp -context-menu.cpp -previewholder.cpp -stock.cpp -stock-items.cpp -${ui_cache_SRC} -${ui_dialog_SRC} -${ui_view_SRC} -${ui_widget_SRC} +set(ui_SRC + clipboard.cpp + context-menu.cpp + previewholder.cpp + uxmanager.cpp + + tool/control-point-selection.cpp + tool/control-point.cpp + tool/curve-drag-point.cpp + tool/event-utils.cpp + tool/manipulator.cpp + tool/modifier-tracker.cpp + tool/multi-path-manipulator.cpp + tool/node-tool.cpp + tool/node.cpp + tool/path-manipulator.cpp + tool/selectable-control-point.cpp + tool/selector.cpp + tool/transform-handle-set.cpp + + ${ui_cache_SRC} + ${ui_dialog_SRC} + ${ui_view_SRC} + ${ui_widget_SRC} +) + +include_directories( + "${CMAKE_SOURCE_DIR}/src" + "${CMAKE_SOURCE_DIR}" + "${CMAKE_SOURCE_DIR}/bind/javainc" + "${CMAKE_SOURCE_DIR}/bind/javainc/linux" + "${CMAKE_SOURCE_DIR}/extension/dbus" ) -ADD_LIBRARY(ui STATIC ${ui_SRC}) -TARGET_LINK_LIBRARIES(ui -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(ui STATIC ${ui_SRC}) +target_link_libraries(ui 2geom ${INKSCAPE_LIBS}) diff --git a/src/ui/cache/CMakeLists.txt b/src/ui/cache/CMakeLists.txt index a78010196..c00410de5 100644 --- a/src/ui/cache/CMakeLists.txt +++ b/src/ui/cache/CMakeLists.txt @@ -1,3 +1,3 @@ -SET(ui_cache_SRC -svg_preview_cache.cpp +set(ui_cache_SRC + svg_preview_cache.cpp ) diff --git a/src/ui/dialog/CMakeLists.txt b/src/ui/dialog/CMakeLists.txt index 98c4a47bb..dbd34cec1 100644 --- a/src/ui/dialog/CMakeLists.txt +++ b/src/ui/dialog/CMakeLists.txt @@ -1,45 +1,52 @@ -IF(WIN32) -SET(ui_dialog_WIN32_SRC -filedialogimpl-win32.cpp -) -ELSEIF(WIN32) - SET(ui_dialog_WIN32_SRC) -ENDIF(WIN32) -SET(ui_dialog_SRC -aboutbox.cpp -align-and-distribute.cpp -color-item.cpp -debug.cpp -dialog.cpp -dialog-manager.cpp -dock-behavior.cpp -document-metadata.cpp -document-properties.cpp -extension-editor.cpp -eek-preview.cpp -ege-paint-def.cpp -filedialog.cpp -filedialogimpl-gtkmm.cpp -fill-and-stroke.cpp -filter-effects-dialog.cpp -find.cpp -floating-behavior.cpp -inkscape-preferences.cpp -input.cpp -livepatheffect-editor.cpp -memory.cpp -messages.cpp -ocaldialogs.cpp -print.cpp -scriptdialog.cpp -#session-player.cpp -tile.cpp -tracedialog.cpp -transformation.cpp -undo-history.cpp -#whiteboard-connect.cpp -#whiteboard-sharewithchat.cpp -#whiteboard-sharewithuser.cpp -${ui_dialog_WIN32_SRC} +set(ui_dialog_SRC + aboutbox.cpp + align-and-distribute.cpp + calligraphic-profile-rename.cpp + color-item.cpp + debug.cpp + desktop-tracker.cpp + dialog-manager.cpp + dialog.cpp + dock-behavior.cpp + document-metadata.cpp + document-properties.cpp + extension-editor.cpp + extensions.cpp + filedialog.cpp + filedialogimpl-gtkmm.cpp + fill-and-stroke.cpp + filter-effects-dialog.cpp + find.cpp + floating-behavior.cpp + glyphs.cpp + guides.cpp + icon-preview.cpp + inkscape-preferences.cpp + input.cpp + layer-properties.cpp + layers.cpp + livepatheffect-editor.cpp + memory.cpp + messages.cpp + ocaldialogs.cpp + print-colors-preview-dialog.cpp + print.cpp + scriptdialog.cpp + session-player.cpp + svg-fonts-dialog.cpp + swatches.cpp + tile.cpp + tracedialog.cpp + transformation.cpp + undo-history.cpp + whiteboard-connect.cpp + whiteboard-sharewithchat.cpp + whiteboard-sharewithuser.cpp ) + +if(WIN32) + list(APPEND ui_dialog_SRC + filedialogimpl-win32.cpp + ) +endif() diff --git a/src/ui/view/CMakeLists.txt b/src/ui/view/CMakeLists.txt index 5c96bc40e..c0914d887 100644 --- a/src/ui/view/CMakeLists.txt +++ b/src/ui/view/CMakeLists.txt @@ -1,10 +1,4 @@ -SET(ui_view_SRC -desktop.cpp -desktop-events.cpp -desktop-handles.cpp -desktop-style.cpp -edit.cpp -edit-widget.cpp -view.cpp -view-widget.cpp +set(ui_view_SRC + view.cpp + view-widget.cpp ) diff --git a/src/ui/widget/CMakeLists.txt b/src/ui/widget/CMakeLists.txt index ffc94c299..c81ea5e24 100644 --- a/src/ui/widget/CMakeLists.txt +++ b/src/ui/widget/CMakeLists.txt @@ -1,40 +1,43 @@ -SET(ui_widget_SRC -button.cpp -color-picker.cpp -color-preview.cpp -combo-text.cpp -dock.cpp -dock-item.cpp -entity-entry.cpp -entry.cpp -filter-effect-chooser.cpp -handlebox.cpp -icon-widget.cpp -imageicon.cpp -imagetoggler.cpp -labelled.cpp -licensor.cpp -notebook-page.cpp -object-composite-settings.cpp -page-sizer.cpp -panel.cpp -point.cpp -preferences-widget.cpp -random.cpp -registered-widget.cpp -registry.cpp -rendering-options.cpp -rotateable.cpp -ruler.cpp -scalar.cpp -scalar-unit.cpp -selected-style.cpp -spin-slider.cpp -style-subject.cpp -style-swatch.cpp -svg-canvas.cpp -tolerance-slider.cpp -toolbox.cpp -unit-menu.cpp -zoom-status.cpp +set(ui_widget_SRC + button.cpp + color-picker.cpp + color-preview.cpp + combo-text.cpp + dock-item.cpp + dock.cpp + entity-entry.cpp + entry.cpp + filter-effect-chooser.cpp + handlebox.cpp + icon-widget.cpp + imageicon.cpp + imagetoggler.cpp + labelled.cpp + layer-selector.cpp + licensor.cpp + notebook-page.cpp + object-composite-settings.cpp + page-sizer.cpp + panel.cpp + point.cpp + preferences-widget.cpp + random.cpp + registered-widget.cpp + registry.cpp + rendering-options.cpp + rotateable.cpp + ruler.cpp + scalar-unit.cpp + scalar.cpp + selected-style.cpp + spin-slider.cpp + spinbutton.cpp + style-subject.cpp + style-swatch.cpp + svg-canvas.cpp + text.cpp + tolerance-slider.cpp + toolbox.cpp + unit-menu.cpp + zoom-status.cpp ) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 18237ac75..936a5fae9 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,7 +1,11 @@ -SET(util_SRC -share.cpp -units.cpp + +set(util_SRC + ege-appear-time-tracker.cpp + ege-tags.cpp + expression-evaluator.cpp + share.cpp + units.cpp ) -ADD_LIBRARY(util STATIC ${util_SRC}) -TARGET_LINK_LIBRARIES(util -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(util STATIC ${util_SRC}) +target_link_libraries(util 2geom ${INKSCAPE_LIBS}) diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index f3c0e70fa..b698ced98 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -1,36 +1,40 @@ -SET(widgets_SRC -button.cpp -calligraphic-profile-rename.cpp -dash-selector.cpp -desktop-widget.cpp -font-selector.cpp -gradient-image.cpp -gradient-selector.cpp -gradient-toolbar.cpp -gradient-vector.cpp -icon.cpp -layer-selector.cpp -paint-selector.cpp -ruler.cpp -select-toolbar.cpp -shrink-wrap-button.cpp -sp-color-gtkselector.cpp -sp-color-icc-selector.cpp -sp-color-notebook.cpp -sp-color-preview.cpp -sp-color-scales.cpp -sp-color-selector.cpp -sp-color-slider.cpp -sp-color-wheel-selector.cpp -spinbutton-events.cpp -sp-widget.cpp -spw-utilities.cpp -sp-xmlview-attr-list.cpp -sp-xmlview-content.cpp -sp-xmlview-tree.cpp -swatch-selector.cpp -toolbox.cpp + +set(widgets_SRC + button.cpp + dash-selector.cpp + desktop-widget.cpp + eek-preview.cpp + ege-paint-def.cpp + fill-style.cpp + font-selector.cpp + gradient-image.cpp + gradient-selector.cpp + gradient-toolbar.cpp + gradient-vector.cpp + icon.cpp + paint-selector.cpp + ruler.cpp + select-toolbar.cpp + shrink-wrap-button.cpp + sp-attribute-widget.cpp + sp-color-gtkselector.cpp + sp-color-icc-selector.cpp + sp-color-notebook.cpp + sp-color-preview.cpp + sp-color-scales.cpp + sp-color-selector.cpp + sp-color-slider.cpp + sp-color-wheel-selector.cpp + sp-widget.cpp + sp-xmlview-attr-list.cpp + sp-xmlview-content.cpp + sp-xmlview-tree.cpp + spinbutton-events.cpp + spw-utilities.cpp + stroke-style.cpp + swatch-selector.cpp + toolbox.cpp ) -ADD_LIBRARY(widgets STATIC ${widgets_SRC}) -TARGET_LINK_LIBRARIES(widgets -2geom ${INKSCAPE_LIBS}) + +add_library(widgets STATIC ${widgets_SRC}) +target_link_libraries(widgets 2geom ${INKSCAPE_LIBS}) diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt index 775a4e72f..b92d82489 100644 --- a/src/xml/CMakeLists.txt +++ b/src/xml/CMakeLists.txt @@ -1,21 +1,21 @@ -SET(xml_SRC -composite-node-observer.cpp -croco-node-iface.cpp -event.cpp -log-builder.cpp -node-fns.cpp -quote.cpp -#quote-test.cpp -repr.cpp -#repr-action-test.cpp -repr-css.cpp -repr-io.cpp -repr-sorting.cpp -repr-util.cpp -simple-document.cpp -simple-node.cpp -subtree.cpp +set(xml_SRC + composite-node-observer.cpp + croco-node-iface.cpp + event.cpp + log-builder.cpp + node-fns.cpp + quote.cpp + repr.cpp + repr-css.cpp + repr-io.cpp + repr-sorting.cpp + repr-util.cpp + simple-document.cpp + simple-node.cpp + subtree.cpp + helper-observer.cpp + rebase-hrefs.cpp ) -ADD_LIBRARY(xml STATIC ${xml_SRC}) -TARGET_LINK_LIBRARIES(xml -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +add_library(xml STATIC ${xml_SRC}) +target_link_libraries(xml 2geom ${INKSCAPE_LIBS}) \ No newline at end of file -- cgit v1.2.3 From 321f115f7dad3366f2427443ce0aa725f6881f2e Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Sun, 12 Jun 2011 20:46:15 +0000 Subject: cmake: commented unused files/dirs, double checked all files compile this time (bzr r10273) --- src/2geom/CMakeLists.txt | 6 +-- src/CMakeLists.txt | 100 ++++++++++++++++++++-------------------- src/display/CMakeLists.txt | 2 +- src/dom/CMakeLists.txt | 2 +- src/dom/io/CMakeLists.txt | 2 +- src/libcola/CMakeLists.txt | 2 +- src/live_effects/CMakeLists.txt | 2 +- src/ui/dialog/CMakeLists.txt | 8 ++-- 8 files changed, 62 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index 91c14db8b..0ef925a55 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -7,8 +7,8 @@ set(2GEOM_SRC bezier-utils.cpp circle-circle.cpp circle.cpp - conic_section_clipper_impl.cpp - conicsec.cpp + # conic_section_clipper_impl.cpp + # conicsec.cpp conjugate_gradient.cpp convex-cover.cpp crossing.cpp @@ -27,7 +27,7 @@ set(2GEOM_SRC point.cpp poly.cpp quadtree.cpp - recursive-bezier-intersection.cpp + # recursive-bezier-intersection.cpp region.cpp sbasis-2d.cpp sbasis-geometric.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4bd93db12..08ea05387 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ set(SP_SRC sp-anchor.cpp - sp-animation.cpp + # sp-animation.cpp sp-clippath.cpp sp-conn-end-pair.cpp sp-conn-end.cpp @@ -50,7 +50,7 @@ set(SP_SRC sp-root.cpp sp-script.cpp sp-shape.cpp - sp-skeleton.cpp + # sp-skeleton.cpp sp-spiral.cpp sp-star.cpp sp-stop.cpp @@ -225,9 +225,9 @@ set(internalfolders filters helper io - jabber_whiteboard + # jabber_whiteboard live_effects - pedro + # pedro svg trace #traits @@ -296,52 +296,52 @@ target_link_libraries(inkscape # system libs - xslt - gtkspell - gsl - gslcblas - gtkmm-2.4 - atkmm-1.6 - gdkmm-2.4 - giomm-2.4 - pangomm-1.4 - gtk-x11-2.0 - glibmm-2.4 - cairomm-1.0 - sigc-2.0 - atk-1.0 - gio-2.0 - png - X11 - xml2 - dl - gomp - popt - aspell - gnomevfs-2 - gconf-2 - pangoft2-1.0 - fontconfig - freetype - z - Magick++ - MagickCore - gc - lcms - poppler-glib - gdk-x11-2.0 - poppler - pangocairo-1.0 - gdk_pixbuf-2.0 - png14 - m - pango-1.0 - cairo - gmodule-2.0 - gobject-2.0 - gthread-2.0 - rt - glib-2.0 + -lxslt + -lgtkspell + -lgsl + -lgslcblas + -lgtkmm-2.4 + -latkmm-1.6 + -lgdkmm-2.4 + -lgiomm-2.4 + -lpangomm-1.4 + -lgtk-x11-2.0 + -lglibmm-2.4 + -lcairomm-1.0 + -lsigc-2.0 + -latk-1.0 + -lgio-2.0 + -lpng + -lX11 + -lxml2 + -ldl + -lgomp + -lpopt + -laspell + -lgnomevfs-2 + -lgconf-2 + -lpangoft2-1.0 + -lfontconfig + -lfreetype + -lz + -lMagick++ + -lMagickCore + -lgc + -llcms + -lpoppler-glib + -lgdk-x11-2.0 + -lpoppler + -lpangocairo-1.0 + -lgdk_pixbuf-2.0 + -lpng14 + -lm + -lpango-1.0 + -lcairo + -lgmodule-2.0 + -lgobject-2.0 + -lgthread-2.0 + -lrt + -lglib-2.0 ) diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index 1d3e09200..a46ff4e84 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -33,7 +33,7 @@ set(display_SRC nr-filter-morphology.cpp nr-filter-offset.cpp nr-filter-primitive.cpp - nr-filter-skeleton.cpp + # nr-filter-skeleton.cpp nr-filter-slot.cpp nr-filter-specularlighting.cpp nr-filter-tile.cpp diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 53609d241..3648010ac 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -24,7 +24,7 @@ set(dom_SRC ucd.cpp uri.cpp xmlreader.cpp - xmlwriter.cpp + # xmlwriter.cpp xpathimpl.cpp xpathparser.cpp xpathtoken.cpp diff --git a/src/dom/io/CMakeLists.txt b/src/dom/io/CMakeLists.txt index 0b0b4630d..7b99c898f 100644 --- a/src/dom/io/CMakeLists.txt +++ b/src/dom/io/CMakeLists.txt @@ -3,7 +3,7 @@ set(dom_io_SRC bufferstream.cpp domstream.cpp gzipstream.cpp - httpclient.cpp + # httpclient.cpp socket.cpp stringstream.cpp uristream.cpp diff --git a/src/libcola/CMakeLists.txt b/src/libcola/CMakeLists.txt index 19ac816b2..43c510f13 100644 --- a/src/libcola/CMakeLists.txt +++ b/src/libcola/CMakeLists.txt @@ -2,7 +2,7 @@ set(libcola_SRC cola.cpp conjugate_gradient.cpp connected_components.cpp - cycle_detector.cpp + # cycle_detector.cpp gradient_projection.cpp shortest_paths.cpp straightener.cpp diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index 42f8208ec..0edbbc922 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -30,7 +30,7 @@ set(live_effects_SRC lpe-recursiveskeleton.cpp lpe-rough-hatches.cpp lpe-ruler.cpp - lpe-skeleton.cpp + # lpe-skeleton.cpp lpe-sketch.cpp lpe-spiro.cpp lpe-tangent_to_curve.cpp diff --git a/src/ui/dialog/CMakeLists.txt b/src/ui/dialog/CMakeLists.txt index dbd34cec1..5f2b31989 100644 --- a/src/ui/dialog/CMakeLists.txt +++ b/src/ui/dialog/CMakeLists.txt @@ -33,16 +33,16 @@ set(ui_dialog_SRC print-colors-preview-dialog.cpp print.cpp scriptdialog.cpp - session-player.cpp + # session-player.cpp svg-fonts-dialog.cpp swatches.cpp tile.cpp tracedialog.cpp transformation.cpp undo-history.cpp - whiteboard-connect.cpp - whiteboard-sharewithchat.cpp - whiteboard-sharewithuser.cpp + # whiteboard-connect.cpp + # whiteboard-sharewithchat.cpp + # whiteboard-sharewithuser.cpp ) if(WIN32) -- cgit v1.2.3 From de03354959190a2c5392d79e03dd22dc45777e41 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Sun, 12 Jun 2011 21:27:00 +0000 Subject: cmake: give all libs a _LIB suffix, workaround 'debug' being confused with cake keyword, and also dont mix up dor names with libs. (bzr r10274) --- src/2geom/CMakeLists.txt | 10 ++--- src/CMakeLists.txt | 73 ++++++++++++++++++++++++------------ src/bind/CMakeLists.txt | 4 +- src/debug/CMakeLists.txt | 4 +- src/dialogs/CMakeLists.txt | 4 +- src/display/CMakeLists.txt | 4 +- src/dom/CMakeLists.txt | 4 +- src/extension/CMakeLists.txt | 4 +- src/filters/CMakeLists.txt | 4 +- src/helper/CMakeLists.txt | 9 ++--- src/io/CMakeLists.txt | 5 ++- src/jabber_whiteboard/CMakeLists.txt | 4 +- src/libavoid/CMakeLists.txt | 4 +- src/libcola/CMakeLists.txt | 4 +- src/libcroco/CMakeLists.txt | 4 +- src/libgdl/CMakeLists.txt | 4 +- src/libnr/CMakeLists.txt | 4 +- src/libnrtype/CMakeLists.txt | 4 +- src/libvpsc/CMakeLists.txt | 4 +- src/livarot/CMakeLists.txt | 4 +- src/live_effects/CMakeLists.txt | 4 +- src/pedro/CMakeLists.txt | 4 +- src/svg/CMakeLists.txt | 4 +- src/trace/CMakeLists.txt | 7 ++-- src/ui/CMakeLists.txt | 4 +- src/util/CMakeLists.txt | 4 +- src/widgets/CMakeLists.txt | 4 +- src/xml/CMakeLists.txt | 4 +- 28 files changed, 111 insertions(+), 85 deletions(-) (limited to 'src') diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index 0ef925a55..bdb24cc59 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -1,5 +1,5 @@ -set(2GEOM_SRC +set(2geom_SRC affine.cpp basic-intersection.cpp bezier-clipping.cpp @@ -121,7 +121,7 @@ set(2GEOM_SRC numeric/vector.h ) -# make lib for 2geom -add_library(2geom STATIC ${2GEOM_SRC}) -#TARGET_LINK_LIBRARIES(2geom blas gsl) -target_link_libraries(2geom ${INKSCAPE_LIBS}) +# make lib for 2geom_LIB +add_library(2geom_LIB STATIC ${2geom_SRC}) +#TARGET_LINK_LIBRARIES(2geom_LIB blas_LIB gsl_LIB) +target_link_libraries(2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 08ea05387..fa5a5b34e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -129,8 +129,8 @@ set(INKSCAPE_SRC inkscape-version.cpp inkscape.cpp inkscape.rc - inkview.cpp - inkview.rc + # inkview.cpp + # inkview.rc interface.cpp knot-holder-entity.cpp knot.cpp @@ -264,17 +264,34 @@ set(INKSCAPE_SRC ${GlibOutput} ) -add_library(sp STATIC ${SP_SRC}) -target_link_libraries(sp - nr - nrtype - avoid - cola - croco - gdl - vpsc - livarot - ${internalfolders} +add_library(sp_LIB STATIC ${SP_SRC}) + +target_link_libraries( + sp_LIB + nr_LIB + nrtype_LIB + avoid_LIB + cola_LIB + croco_LIB + gdl_LIB + vpsc_LIB + livarot_LIB + + bind_LIB + display_LIB + dom_LIB + extension_LIB + filters_LIB + helper_LIB + io_LIB + live_effects_LIB + svg_LIB + trace_LIB + ui_LIB + widgets_LIB + xml_LIB + 2geom_LIB + ${INKSCAPE_LIBS} ) @@ -282,16 +299,15 @@ target_link_libraries(sp add_executable(inkscape ${INKSCAPE_SRC}) target_link_libraries(inkscape - nr - nrtype - sp - avoid - cola - croco - gdl - vpsc - livarot - ${internalfolders} + nr_LIB + nrtype_LIB + sp_LIB + avoid_LIB + cola_LIB + croco_LIB + gdl_LIB + vpsc_LIB + livarot_LIB ${INKSCAPE_LIBS} @@ -348,6 +364,15 @@ target_link_libraries(inkscape # make executable for INKVIEW #ADD_EXECUTABLE(inkview inkview.cpp) #TARGET_LINK_LIBRARIES(inkview -# 2geom avoid cola croco gdl nr nrtype vpsc livarot sp ${internalfolders} +# 2geom_LIB +# avoid_LIB +# cola_LIB +# croco_LIB +# gdl_LIB +# nr_LIB +# nrtype_LIB +# vpsc_LIB +# livarot_LIB +# sp_LIB #) diff --git a/src/bind/CMakeLists.txt b/src/bind/CMakeLists.txt index 08b7876c2..71bf0b602 100644 --- a/src/bind/CMakeLists.txt +++ b/src/bind/CMakeLists.txt @@ -2,5 +2,5 @@ set(bind_SRC dobinding.cpp javabind.cpp ) -add_library(bind STATIC ${bind_SRC}) -target_link_libraries(bind ${INKSCAPE_LIBS}) +add_library(bind_LIB STATIC ${bind_SRC}) +target_link_libraries(bind_LIB ${INKSCAPE_LIBS}) diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 2dab10144..6727817f9 100644 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -9,5 +9,5 @@ set(debug_SRC gdk-event-latency-tracker.cpp ) -add_library(debug STATIC ${debug_SRC}) -target_link_libraries(debug 2geom ${INKSCAPE_LIBS}) +add_library(debug_LIB STATIC ${debug_SRC}) +target_link_libraries(debug_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index aa8f836d5..d22b5750c 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -9,5 +9,5 @@ set(dialogs_SRC text-edit.cpp xml-tree.cpp ) -add_library(dialogs STATIC ${dialogs_SRC}) -target_link_libraries(dialogs 2geom ${INKSCAPE_LIBS}) +add_library(dialogs_LIB STATIC ${dialogs_SRC}) +target_link_libraries(dialogs_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index a46ff4e84..86f122297 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -62,5 +62,5 @@ include_directories( "${CMAKE_SOURCE_DIR}/src" ) -add_library(display STATIC ${display_SRC}) -target_link_libraries(display 2geom ${INKSCAPE_LIBS}) +add_library(display_LIB STATIC ${display_SRC}) +target_link_libraries(display_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 3648010ac..66571d06a 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -34,5 +34,5 @@ set(dom_SRC #${dom_work_SRC} ) -add_library(dom STATIC ${dom_SRC}) -target_link_libraries(dom 2geom ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(dom_LIB STATIC ${dom_SRC}) +target_link_libraries(dom_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 73697fbe7..47cfbe9e4 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -37,5 +37,5 @@ set(extension_SRC ${extension_script_SRC} ) -add_library(extension STATIC ${extension_SRC}) -target_link_libraries(extension 2geom ${INKSCAPE_LIBS}) +add_library(extension_LIB STATIC ${extension_SRC}) +target_link_libraries(extension_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/filters/CMakeLists.txt b/src/filters/CMakeLists.txt index 32819fa68..a1bec4642 100644 --- a/src/filters/CMakeLists.txt +++ b/src/filters/CMakeLists.txt @@ -20,5 +20,5 @@ set(filters_SRC tile.cpp turbulence.cpp ) -add_library(filters STATIC ${filters_SRC}) -target_link_libraries(filters 2geom ${INKSCAPE_LIBS}) +add_library(filters_LIB STATIC ${filters_SRC}) +target_link_libraries(filters_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index e2ca2336d..86c5eea10 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -2,7 +2,7 @@ include(UseGlibMarshal) GLIB_MARSHAL(sp_marshal sp-marshal "${CMAKE_CURRENT_BINARY_DIR}/helper") -set(GlibOutput +set(sp_marshal_SRC ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.cpp ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.h ) @@ -23,9 +23,8 @@ set(helper_SRC sp-marshal.cpp sp-marshal.list # we generate this file and it's .h counter-part - ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.cpp - ${CMAKE_CURRENT_BINARY_DIR}/sp-marshal.h + ${sp_marshal_SRC} ) -add_library(helper STATIC ${helper_SRC}) -target_link_libraries(helper 2geom ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(helper_LIB STATIC ${helper_SRC}) +target_link_libraries(helper_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index b60830042..88040744b 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -11,5 +11,6 @@ set(io_SRC uristream.cpp xsltstream.cpp ) -add_library(io STATIC ${io_SRC}) -target_link_libraries(io 2geom ${INKSCAPE_LIBS}) + +add_library(io_LIB STATIC ${io_SRC}) +target_link_libraries(io_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/jabber_whiteboard/CMakeLists.txt b/src/jabber_whiteboard/CMakeLists.txt index 6975d06d6..dbe9f1e1e 100644 --- a/src/jabber_whiteboard/CMakeLists.txt +++ b/src/jabber_whiteboard/CMakeLists.txt @@ -19,5 +19,5 @@ set(jabber_whiteboard_SRC ${jabber_whiteboard_dialog_SRC} ) -add_library(jabber_whiteboard STATIC ${jabber_whiteboard_SRC}) -target_link_libraries(jabber_whiteboard 2geom ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(jabber_whiteboard_LIB STATIC ${jabber_whiteboard_SRC}) +target_link_libraries(jabber_whiteboard_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/libavoid/CMakeLists.txt b/src/libavoid/CMakeLists.txt index b76cf1d39..6eb6bdd1d 100644 --- a/src/libavoid/CMakeLists.txt +++ b/src/libavoid/CMakeLists.txt @@ -14,5 +14,5 @@ set(libavoid_SRC vpsc.cpp ) -add_library(avoid STATIC ${libavoid_SRC}) -target_link_libraries(avoid ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(avoid_LIB STATIC ${libavoid_SRC}) +target_link_libraries(avoid_LIB ${INKSCAPE_LIBS}) diff --git a/src/libcola/CMakeLists.txt b/src/libcola/CMakeLists.txt index 43c510f13..40c92d578 100644 --- a/src/libcola/CMakeLists.txt +++ b/src/libcola/CMakeLists.txt @@ -7,5 +7,5 @@ set(libcola_SRC shortest_paths.cpp straightener.cpp ) -add_library(cola STATIC ${libcola_SRC}) -target_link_libraries(cola ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(cola_LIB STATIC ${libcola_SRC}) +target_link_libraries(cola_LIB ${INKSCAPE_LIBS}) diff --git a/src/libcroco/CMakeLists.txt b/src/libcroco/CMakeLists.txt index 7e8aa9176..3aae8eac4 100644 --- a/src/libcroco/CMakeLists.txt +++ b/src/libcroco/CMakeLists.txt @@ -29,5 +29,5 @@ set(libcroco_SRC cr-utils.c ) -add_library(croco STATIC ${libcroco_SRC}) -target_link_libraries(croco ${INKSCAPE_LIBS}) +add_library(croco_LIB STATIC ${libcroco_SRC}) +target_link_libraries(croco_LIB ${INKSCAPE_LIBS}) diff --git a/src/libgdl/CMakeLists.txt b/src/libgdl/CMakeLists.txt index f59ec5420..6411579b3 100644 --- a/src/libgdl/CMakeLists.txt +++ b/src/libgdl/CMakeLists.txt @@ -25,5 +25,5 @@ if(WIN32) ) endif() -ADD_LIBRARY(gdl STATIC ${libgdl_SRC}) -TARGET_LINK_LIBRARIES(gdl ${INKSCAPE_LIBS}) +ADD_LIBRARY(gdl_LIB STATIC ${libgdl_SRC}) +TARGET_LINK_LIBRARIES(gdl_LIB ${INKSCAPE_LIBS}) diff --git a/src/libnr/CMakeLists.txt b/src/libnr/CMakeLists.txt index 798eb0d11..28fee7b77 100644 --- a/src/libnr/CMakeLists.txt +++ b/src/libnr/CMakeLists.txt @@ -33,5 +33,5 @@ set(libnr_SRC #testnr.cpp ) -add_library(nr STATIC ${libnr_SRC}) -target_link_libraries(nr 2geom ${INKSCAPE_LIBS}) +add_library(nr_LIB STATIC ${libnr_SRC}) +target_link_libraries(nr_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/libnrtype/CMakeLists.txt b/src/libnrtype/CMakeLists.txt index 4402e5066..75bb5f57b 100644 --- a/src/libnrtype/CMakeLists.txt +++ b/src/libnrtype/CMakeLists.txt @@ -14,5 +14,5 @@ set(libnrtype_SRC RasterFont.cpp TextWrapper.cpp ) -add_library(nrtype STATIC ${libnrtype_SRC}) -target_link_libraries(nrtype nr ${INKSCAPE_LIBS}) +add_library(nrtype_LIB STATIC ${libnrtype_SRC}) +target_link_libraries(nrtype_LIB nr_LIB ${INKSCAPE_LIBS}) diff --git a/src/libvpsc/CMakeLists.txt b/src/libvpsc/CMakeLists.txt index 57811ad0a..0a91c3516 100644 --- a/src/libvpsc/CMakeLists.txt +++ b/src/libvpsc/CMakeLists.txt @@ -10,5 +10,5 @@ set(libvpsc_SRC pairingheap/PairingHeap.cpp ) -add_library(vpsc STATIC ${libvpsc_SRC}) -target_link_libraries(vpsc ${INKSCAPE_LIBS}) +add_library(vpsc_LIB STATIC ${libvpsc_SRC}) +target_link_libraries(vpsc_LIB ${INKSCAPE_LIBS}) diff --git a/src/livarot/CMakeLists.txt b/src/livarot/CMakeLists.txt index 965926fb8..d8f4ba05d 100644 --- a/src/livarot/CMakeLists.txt +++ b/src/livarot/CMakeLists.txt @@ -21,5 +21,5 @@ set(livarot_SRC sweep-tree-list.cpp ) -add_library(livarot STATIC ${livarot_SRC}) -target_link_libraries(nrtype ${INKSCAPE_LIBS}) +add_library(livarot_LIB STATIC ${livarot_SRC}) +target_link_libraries(nrtype_LIB ${INKSCAPE_LIBS}) diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index 0edbbc922..61fedbe66 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -44,5 +44,5 @@ set(live_effects_SRC ${live_effects_parameter_SRC} ) -add_library(live_effects STATIC ${live_effects_SRC}) -target_link_libraries(live_effects 2geom ${INKSCAPE_LIBS}) +add_library(live_effects_LIB STATIC ${live_effects_SRC}) +target_link_libraries(live_effects_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/pedro/CMakeLists.txt b/src/pedro/CMakeLists.txt index 5595d755e..4de3592db 100644 --- a/src/pedro/CMakeLists.txt +++ b/src/pedro/CMakeLists.txt @@ -8,5 +8,5 @@ set(pedro_SRC pedroutil.cpp pedroxmpp.cpp ) -add_library(pedro STATIC ${pedro_SRC}) -target_link_libraries(pedro ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(pedro_LIB STATIC ${pedro_SRC}) +target_link_libraries(pedro_LIB ${INKSCAPE_LIBS}) diff --git a/src/svg/CMakeLists.txt b/src/svg/CMakeLists.txt index b2c4b918e..4501983bb 100644 --- a/src/svg/CMakeLists.txt +++ b/src/svg/CMakeLists.txt @@ -14,5 +14,5 @@ set(svg_SRC #test-stubs.cpp ) -add_library(svg STATIC ${svg_SRC}) -target_link_libraries(svg 2geom ${INKSCAPE_LIBS}) +add_library(svg_LIB STATIC ${svg_SRC}) +target_link_libraries(svg_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/trace/CMakeLists.txt b/src/trace/CMakeLists.txt index 312ee209c..d3bdcb6b1 100644 --- a/src/trace/CMakeLists.txt +++ b/src/trace/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(potrace) + set(trace_SRC filterset.cpp imagemap.cpp @@ -8,6 +9,6 @@ set(trace_SRC trace.cpp ${trace_potrace_SRC} ) -ADD_LIBRARY(trace STATIC ${trace_SRC}) -TARGET_LINK_LIBRARIES(trace -2geom ${INKSCAPE_LIBS}) \ No newline at end of file + +ADD_LIBRARY(trace_LIB STATIC ${trace_SRC}) +TARGET_LINK_LIBRARIES(trace_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 28dcd1ded..5fa882f1a 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -42,5 +42,5 @@ include_directories( "${CMAKE_SOURCE_DIR}/extension/dbus" ) -add_library(ui STATIC ${ui_SRC}) -target_link_libraries(ui 2geom ${INKSCAPE_LIBS}) +add_library(ui_LIB STATIC ${ui_SRC}) +target_link_libraries(ui_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 936a5fae9..330d49662 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -7,5 +7,5 @@ set(util_SRC units.cpp ) -add_library(util STATIC ${util_SRC}) -target_link_libraries(util 2geom ${INKSCAPE_LIBS}) +add_library(util_LIB STATIC ${util_SRC}) +target_link_libraries(util_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index b698ced98..4c622fbec 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -36,5 +36,5 @@ set(widgets_SRC toolbox.cpp ) -add_library(widgets STATIC ${widgets_SRC}) -target_link_libraries(widgets 2geom ${INKSCAPE_LIBS}) +add_library(widgets_LIB STATIC ${widgets_SRC}) +target_link_libraries(widgets_LIB 2geom_LIB ${INKSCAPE_LIBS}) diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt index b92d82489..1aafe2d21 100644 --- a/src/xml/CMakeLists.txt +++ b/src/xml/CMakeLists.txt @@ -17,5 +17,5 @@ set(xml_SRC rebase-hrefs.cpp ) -add_library(xml STATIC ${xml_SRC}) -target_link_libraries(xml 2geom ${INKSCAPE_LIBS}) \ No newline at end of file +add_library(xml_LIB STATIC ${xml_SRC}) +target_link_libraries(xml_LIB 2geom_LIB ${INKSCAPE_LIBS}) -- cgit v1.2.3 From 7172735786c43c2305a92ffd4e5d285d11f88f7f Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 00:19:17 +0000 Subject: cmake: turns out my recent commits (which I undid) were not incorrect, variables were set in subdirectories then used in the parent directory, where they were still unset. Fixing this broke the build because some files in the subdir were not compiling. (bzr r10276) --- src/2geom/CMakeLists.txt | 4 +- src/CMakeLists.txt | 56 +++++------ src/bind/CMakeLists.txt | 5 +- src/debug/CMakeLists.txt | 3 +- src/dialogs/CMakeLists.txt | 5 +- src/display/CMakeLists.txt | 4 +- src/dom/CMakeLists.txt | 46 +++++---- src/dom/io/CMakeLists.txt | 11 --- src/dom/odf/CMakeLists.txt | 5 - src/dom/util/CMakeLists.txt | 6 -- src/dom/work/CMakeLists.txt | 12 --- src/extension/CMakeLists.txt | 123 ++++++++++++++++++++----- src/extension/dxf2svg/CMakeLists.txt | 11 --- src/extension/implementation/CMakeLists.txt | 5 - src/extension/internal/CMakeLists.txt | 29 ------ src/extension/internal/bitmap/CMakeLists.txt | 37 -------- src/extension/internal/filter/CMakeLists.txt | 8 -- src/extension/internal/pdfinput/CMakeLists.txt | 5 - src/extension/param/CMakeLists.txt | 13 --- src/extension/script/CMakeLists.txt | 3 - src/filters/CMakeLists.txt | 5 +- src/helper/CMakeLists.txt | 4 +- src/io/CMakeLists.txt | 4 +- src/jabber_whiteboard/CMakeLists.txt | 7 +- src/jabber_whiteboard/dialog/CMakeLists.txt | 4 - src/libavoid/CMakeLists.txt | 4 +- src/libcola/CMakeLists.txt | 5 +- src/libcroco/CMakeLists.txt | 3 +- src/libgdl/CMakeLists.txt | 4 +- src/libnr/CMakeLists.txt | 3 +- src/libnrtype/CMakeLists.txt | 5 +- src/libvpsc/CMakeLists.txt | 4 +- src/livarot/CMakeLists.txt | 4 +- src/live_effects/CMakeLists.txt | 17 +++- src/live_effects/parameter/CMakeLists.txt | 13 --- src/pedro/CMakeLists.txt | 5 +- src/svg/CMakeLists.txt | 4 +- src/trace/CMakeLists.txt | 13 ++- src/trace/potrace/CMakeLists.txt | 9 -- src/ui/CMakeLists.txt | 114 +++++++++++++++++++---- src/ui/cache/CMakeLists.txt | 3 - src/ui/dialog/CMakeLists.txt | 52 ----------- src/ui/view/CMakeLists.txt | 4 - src/ui/widget/CMakeLists.txt | 43 --------- src/util/CMakeLists.txt | 3 +- src/widgets/CMakeLists.txt | 3 +- src/xml/CMakeLists.txt | 4 +- 47 files changed, 318 insertions(+), 416 deletions(-) delete mode 100644 src/dom/io/CMakeLists.txt delete mode 100644 src/dom/odf/CMakeLists.txt delete mode 100644 src/dom/util/CMakeLists.txt delete mode 100644 src/dom/work/CMakeLists.txt delete mode 100644 src/extension/dxf2svg/CMakeLists.txt delete mode 100644 src/extension/implementation/CMakeLists.txt delete mode 100644 src/extension/internal/CMakeLists.txt delete mode 100644 src/extension/internal/bitmap/CMakeLists.txt delete mode 100644 src/extension/internal/filter/CMakeLists.txt delete mode 100644 src/extension/internal/pdfinput/CMakeLists.txt delete mode 100644 src/extension/param/CMakeLists.txt delete mode 100644 src/extension/script/CMakeLists.txt delete mode 100644 src/jabber_whiteboard/dialog/CMakeLists.txt delete mode 100644 src/live_effects/parameter/CMakeLists.txt delete mode 100644 src/trace/potrace/CMakeLists.txt delete mode 100644 src/ui/cache/CMakeLists.txt delete mode 100644 src/ui/dialog/CMakeLists.txt delete mode 100644 src/ui/view/CMakeLists.txt delete mode 100644 src/ui/widget/CMakeLists.txt (limited to 'src') diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index bdb24cc59..6c6001c4b 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -122,6 +122,4 @@ set(2geom_SRC ) # make lib for 2geom_LIB -add_library(2geom_LIB STATIC ${2geom_SRC}) -#TARGET_LINK_LIBRARIES(2geom_LIB blas_LIB gsl_LIB) -target_link_libraries(2geom_LIB ${INKSCAPE_LIBS}) +add_library(2geom_LIB ${2geom_SRC}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fa5a5b34e..de6175134 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ -set(SP_SRC +set(sp_SRC sp-anchor.cpp # sp-animation.cpp sp-clippath.cpp @@ -69,7 +69,7 @@ set(SP_SRC splivarot.cpp ) -set(INKSCAPE_SRC +set(inkscape_SRC arc-context.cpp attributes.cpp axis-manip.cpp @@ -205,7 +205,7 @@ set(INKSCAPE_SRC ) if(WIN32) - list(APPEND INKSCAPE_SRC + list(APPEND inkscape_SRC registrytool.cpp #deptool.cpp winmain.cpp @@ -259,55 +259,47 @@ foreach(srclistsrc ${dirs}) add_subdirectory(${srclistsrc}) endforeach() -set(INKSCAPE_SRC - ${INKSCAPE_SRC} +set(inkscape_SRC + ${inkscape_SRC} ${GlibOutput} ) -add_library(sp_LIB STATIC ${SP_SRC}) +add_library(sp_LIB ${sp_SRC}) -target_link_libraries( - sp_LIB - nr_LIB - nrtype_LIB - avoid_LIB - cola_LIB +# make executable for INKSCAPE +add_executable(inkscape ${inkscape_SRC}) + +target_link_libraries(inkscape + # order from automake + dom_LIB croco_LIB + avoid_LIB gdl_LIB + cola_LIB vpsc_LIB livarot_LIB + 2geom_LIB + # guessing these ones + ui_LIB bind_LIB + debug_LIB + dialogs_LIB display_LIB - dom_LIB extension_LIB filters_LIB helper_LIB io_LIB - live_effects_LIB + nr_LIB + nrtype_LIB + sp_LIB svg_LIB trace_LIB - ui_LIB + util_LIB widgets_LIB xml_LIB - 2geom_LIB - - ${INKSCAPE_LIBS} -) - -# make executable for INKSCAPE -add_executable(inkscape ${INKSCAPE_SRC}) + live_effects_LIB -target_link_libraries(inkscape - nr_LIB - nrtype_LIB - sp_LIB - avoid_LIB - cola_LIB - croco_LIB - gdl_LIB - vpsc_LIB - livarot_LIB ${INKSCAPE_LIBS} diff --git a/src/bind/CMakeLists.txt b/src/bind/CMakeLists.txt index 71bf0b602..d0f7c7ca0 100644 --- a/src/bind/CMakeLists.txt +++ b/src/bind/CMakeLists.txt @@ -1,6 +1,7 @@ + set(bind_SRC dobinding.cpp javabind.cpp ) -add_library(bind_LIB STATIC ${bind_SRC}) -target_link_libraries(bind_LIB ${INKSCAPE_LIBS}) + +add_library(bind_LIB ${bind_SRC}) diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 6727817f9..0c5760366 100644 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -9,5 +9,4 @@ set(debug_SRC gdk-event-latency-tracker.cpp ) -add_library(debug_LIB STATIC ${debug_SRC}) -target_link_libraries(debug_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(debug_LIB ${debug_SRC}) diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index d22b5750c..bd6942ca6 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -1,3 +1,4 @@ + set(dialogs_SRC clonetiler.cpp dialog-events.cpp @@ -9,5 +10,5 @@ set(dialogs_SRC text-edit.cpp xml-tree.cpp ) -add_library(dialogs_LIB STATIC ${dialogs_SRC}) -target_link_libraries(dialogs_LIB 2geom_LIB ${INKSCAPE_LIBS}) + +add_library(dialogs_LIB ${dialogs_SRC}) diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index 86f122297..ff0b7eac1 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -1,3 +1,4 @@ + set(display_SRC canvas-arena.cpp canvas-axonomgrid.cpp @@ -62,5 +63,4 @@ include_directories( "${CMAKE_SOURCE_DIR}/src" ) -add_library(display_LIB STATIC ${display_SRC}) -target_link_libraries(display_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(display_LIB ${display_SRC}) diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 66571d06a..5a3ebebf8 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -1,13 +1,3 @@ -set(domfolders - io - odf - util - #work -) - -foreach(domlistsrc ${domfolders}) - add_subdirectory(${domlistsrc}) -endforeach() set(dom_SRC cssreader.cpp @@ -28,11 +18,35 @@ set(dom_SRC xpathimpl.cpp xpathparser.cpp xpathtoken.cpp - ${dom_io_SRC} - ${dom_odf_SRC} - ${dom_util_SRC} - #${dom_work_SRC} + + io/base64stream.cpp + io/bufferstream.cpp + io/domstream.cpp + io/gzipstream.cpp + # io/httpclient.cpp + io/socket.cpp + io/stringstream.cpp + io/uristream.cpp + + odf/odfdocument.cpp + #odf/SvgOdg.cpp + + util/digest.cpp + util/thread.cpp + util/ziptool.cpp + + # # Dont use any of them. + # work/svg2.cpp + # work/testdom.cpp + # work/testhttp.cpp + # work/testjs.cpp + # work/testodf.cpp + # work/testsvg.cpp + # work/testuri.cpp + # work/testxpath.cpp + # work/testzip.cpp + # work/xpathtests.cpp + ) -add_library(dom_LIB STATIC ${dom_SRC}) -target_link_libraries(dom_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(dom_LIB ${dom_SRC}) diff --git a/src/dom/io/CMakeLists.txt b/src/dom/io/CMakeLists.txt deleted file mode 100644 index 7b99c898f..000000000 --- a/src/dom/io/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(dom_io_SRC - base64stream.cpp - bufferstream.cpp - domstream.cpp - gzipstream.cpp - # httpclient.cpp - socket.cpp - stringstream.cpp - uristream.cpp -) - diff --git a/src/dom/odf/CMakeLists.txt b/src/dom/odf/CMakeLists.txt deleted file mode 100644 index 089f65fbf..000000000 --- a/src/dom/odf/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(dom_odf_SRC - odfdocument.cpp - #SvgOdg.cpp -) - diff --git a/src/dom/util/CMakeLists.txt b/src/dom/util/CMakeLists.txt deleted file mode 100644 index e5f583fa5..000000000 --- a/src/dom/util/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(dom_util_SRC - digest.cpp - thread.cpp - ziptool.cpp -) - diff --git a/src/dom/work/CMakeLists.txt b/src/dom/work/CMakeLists.txt deleted file mode 100644 index 52552c8b9..000000000 --- a/src/dom/work/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(dom_work_SRC - #testdom.cpp - #testhttp.cpp - #testjs.cpp - #testodf.cpp - #testsvg.cpp - #testuri.cpp - #testxpath.cpp - #testzip.cpp - #xpathtests.cpp -) - diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 47cfbe9e4..3d8777e3a 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -1,17 +1,3 @@ -set(extfolders - #dxf2svg - implementation - internal - internal/bitmap - internal/filter - internal/pdfinput - param - script -) - -foreach(extlistsrc ${extfolders}) - add_subdirectory(${extlistsrc}) -endforeach() set(extension_SRC db.cpp @@ -28,14 +14,105 @@ set(extension_SRC print.cpp system.cpp timer.cpp - #${extension_dxf2svg_SRC} - ${extension_implementation_SRC} - ${extension_internal_bitmap_SRC} - ${extension_internal_filter_SRC} - ${extension_internal_pdfinput_SRC} - ${extension_param_SRC} - ${extension_script_SRC} + + implementation/implementation.cpp + implementation/xslt.cpp + implementation/script.cpp + + param/bool.cpp + param/color.cpp + param/description.cpp + param/enum.cpp + param/float.cpp + param/int.cpp + param/notebook.cpp + param/parameter.cpp + param/radiobutton.cpp + param/string.cpp + + internal/bluredge.cpp + internal/cairo-png-out.cpp + internal/cairo-ps-out.cpp + # internal/cairo-render-context.cpp # XXX MUST GET THIS WORKING + # internal/cairo-renderer.cpp # XXX MUST GET THIS WORKING + internal/cairo-renderer-pdf-out.cpp + internal/emf-win32-inout.cpp + internal/emf-win32-print.cpp + internal/gdkpixbuf-input.cpp + internal/gimpgrad.cpp + internal/grid.cpp + internal/latex-pstricks.cpp + # internal/latex-pstricks-out.cpp # XXX MUST GET THIS WORKING + internal/odf.cpp + internal/latex-text-renderer.cpp + internal/pdf-input-cairo.cpp + internal/pov-out.cpp + internal/javafx-out.cpp + internal/svg.cpp + internal/svgz.cpp + internal/wpg-input.cpp + + internal/bitmap/adaptiveThreshold.cpp + internal/bitmap/addNoise.cpp + internal/bitmap/blur.cpp + internal/bitmap/channel.cpp + internal/bitmap/charcoal.cpp + internal/bitmap/colorize.cpp + internal/bitmap/contrast.cpp + internal/bitmap/cycleColormap.cpp + internal/bitmap/despeckle.cpp + internal/bitmap/edge.cpp + internal/bitmap/emboss.cpp + internal/bitmap/enhance.cpp + internal/bitmap/equalize.cpp + internal/bitmap/gaussianBlur.cpp + internal/bitmap/imagemagick.cpp + internal/bitmap/implode.cpp + internal/bitmap/level.cpp + internal/bitmap/levelChannel.cpp + internal/bitmap/medianFilter.cpp + internal/bitmap/modulate.cpp + internal/bitmap/negate.cpp + internal/bitmap/normalize.cpp + internal/bitmap/oilPaint.cpp + internal/bitmap/opacity.cpp + internal/bitmap/raise.cpp + internal/bitmap/reduceNoise.cpp + internal/bitmap/sample.cpp + internal/bitmap/shade.cpp + internal/bitmap/sharpen.cpp + internal/bitmap/solarize.cpp + internal/bitmap/spread.cpp + internal/bitmap/swirl.cpp + internal/bitmap/threshold.cpp + internal/bitmap/unsharpmask.cpp + internal/bitmap/wave.cpp + + internal/filter/filter-all.cpp + internal/filter/filter-file.cpp + internal/filter/filter.cpp + + internal/pdfinput/pdf-input.cpp + internal/pdfinput/pdf-parser.cpp + internal/pdfinput/svg-builder.cpp + + script/InkscapeScript.cpp + + # dxf2svg/aci2rgb.cpp + # dxf2svg/entities2elements.cpp + # dxf2svg/tables2svg_info.cpp + # dxf2svg/blocks.cpp + # dxf2svg/entities.cpp + # dxf2svg/tables.cpp + # dxf2svg/dxf2svg.cpp + # dxf2svg/read_dxf.cpp + # dxf2svg/test_dxf.cpp ) -add_library(extension_LIB STATIC ${extension_SRC}) -target_link_libraries(extension_LIB 2geom_LIB ${INKSCAPE_LIBS}) +if(WIN32) + list(APPEND extension_SRC + win32.cpp + ) +endif() + +add_library(extension_LIB ${extension_SRC}) diff --git a/src/extension/dxf2svg/CMakeLists.txt b/src/extension/dxf2svg/CMakeLists.txt deleted file mode 100644 index 0ff0eaec0..000000000 --- a/src/extension/dxf2svg/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(extension_dxf2svg_SRC - #aci2rgb.cpp - #entities2elements.cpp - #tables2svg_info.cpp - #blocks.cpp - #entities.cpp - #tables.cpp - #dxf2svg.cpp - #read_dxf.cpp - #test_dxf.cpp -) diff --git a/src/extension/implementation/CMakeLists.txt b/src/extension/implementation/CMakeLists.txt deleted file mode 100644 index dcdf092c2..000000000 --- a/src/extension/implementation/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(extension_implementation_SRC - implementation.cpp - xslt.cpp - script.cpp -) diff --git a/src/extension/internal/CMakeLists.txt b/src/extension/internal/CMakeLists.txt deleted file mode 100644 index d13ec9f74..000000000 --- a/src/extension/internal/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -set(extension_internal_SRC - bluredge.cpp - cairo-png-out.cpp - cairo-ps-out.cpp - cairo-render-context.cpp - cairo-renderer.cpp - cairo-renderer-pdf-out.cpp - emf-win32-inout.cpp - emf-win32-print.cpp - gdkpixbuf-input.cpp - gimpgrad.cpp - grid.cpp - latex-pstricks.cpp - latex-pstricks-out.cpp - odf.cpp - latex-text-renderer.cpp - pdf-input-cairo.cpp - pov-out.cpp - javafx-out.cpp - svg.cpp - svgz.cpp - wpg-input.cpp -) - -if(WIN32) - list(APPEND extension_internal_SRC - win32.cpp - ) -endif() diff --git a/src/extension/internal/bitmap/CMakeLists.txt b/src/extension/internal/bitmap/CMakeLists.txt deleted file mode 100644 index a273804ba..000000000 --- a/src/extension/internal/bitmap/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -set(extension_internal_bitmap_SRC - adaptiveThreshold.cpp - addNoise.cpp - blur.cpp - channel.cpp - charcoal.cpp - colorize.cpp - contrast.cpp - cycleColormap.cpp - despeckle.cpp - edge.cpp - emboss.cpp - enhance.cpp - equalize.cpp - gaussianBlur.cpp - imagemagick.cpp - implode.cpp - levelChannel.cpp - level.cpp - medianFilter.cpp - modulate.cpp - negate.cpp - normalize.cpp - oilPaint.cpp - opacity.cpp - raise.cpp - reduceNoise.cpp - sample.cpp - shade.cpp - sharpen.cpp - solarize.cpp - spread.cpp - swirl.cpp - threshold.cpp - unsharpmask.cpp - wave.cpp -) diff --git a/src/extension/internal/filter/CMakeLists.txt b/src/extension/internal/filter/CMakeLists.txt deleted file mode 100644 index 349504f94..000000000 --- a/src/extension/internal/filter/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -set(extension_internal_filter_SRC - drop-shadow.h - filter-all.cpp - filter.cpp - filter-file.cpp - filter.h - snow.h -) diff --git a/src/extension/internal/pdfinput/CMakeLists.txt b/src/extension/internal/pdfinput/CMakeLists.txt deleted file mode 100644 index fe31c2a7f..000000000 --- a/src/extension/internal/pdfinput/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(extension_internal_pdfinput_SRC - pdf-input.cpp - pdf-parser.cpp - svg-builder.cpp -) diff --git a/src/extension/param/CMakeLists.txt b/src/extension/param/CMakeLists.txt deleted file mode 100644 index b2981308e..000000000 --- a/src/extension/param/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(extension_param_SRC - bool.cpp - color.cpp - description.cpp - enum.cpp - float.cpp - int.cpp - notebook.cpp - parameter.cpp - radiobutton.cpp - string.cpp -) - diff --git a/src/extension/script/CMakeLists.txt b/src/extension/script/CMakeLists.txt deleted file mode 100644 index 88977164e..000000000 --- a/src/extension/script/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -set(extension_script_SRC - InkscapeScript.cpp -) diff --git a/src/filters/CMakeLists.txt b/src/filters/CMakeLists.txt index a1bec4642..ed64fe764 100644 --- a/src/filters/CMakeLists.txt +++ b/src/filters/CMakeLists.txt @@ -1,3 +1,4 @@ + set(filters_SRC blend.cpp colormatrix.cpp @@ -20,5 +21,5 @@ set(filters_SRC tile.cpp turbulence.cpp ) -add_library(filters_LIB STATIC ${filters_SRC}) -target_link_libraries(filters_LIB 2geom_LIB ${INKSCAPE_LIBS}) + +add_library(filters_LIB ${filters_SRC}) diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index 86c5eea10..3f1567cce 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -1,3 +1,4 @@ + include(UseGlibMarshal) GLIB_MARSHAL(sp_marshal sp-marshal "${CMAKE_CURRENT_BINARY_DIR}/helper") @@ -26,5 +27,4 @@ set(helper_SRC ${sp_marshal_SRC} ) -add_library(helper_LIB STATIC ${helper_SRC}) -target_link_libraries(helper_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(helper_LIB ${helper_SRC}) diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index 88040744b..06a5f869a 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -1,3 +1,4 @@ + set(io_SRC base64stream.cpp ftos.cpp @@ -12,5 +13,4 @@ set(io_SRC xsltstream.cpp ) -add_library(io_LIB STATIC ${io_SRC}) -target_link_libraries(io_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(io_LIB ${io_SRC}) diff --git a/src/jabber_whiteboard/CMakeLists.txt b/src/jabber_whiteboard/CMakeLists.txt index dbe9f1e1e..2e1ef311b 100644 --- a/src/jabber_whiteboard/CMakeLists.txt +++ b/src/jabber_whiteboard/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(dialog) set(jabber_whiteboard_SRC defines.cpp @@ -16,8 +15,8 @@ set(jabber_whiteboard_SRC pedrogui.cpp session-file-selector.cpp session-manager.cpp - ${jabber_whiteboard_dialog_SRC} + + dialog/choose-desktop.cpp ) -add_library(jabber_whiteboard_LIB STATIC ${jabber_whiteboard_SRC}) -target_link_libraries(jabber_whiteboard_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(jabber_whiteboard_LIB ${jabber_whiteboard_SRC}) diff --git a/src/jabber_whiteboard/dialog/CMakeLists.txt b/src/jabber_whiteboard/dialog/CMakeLists.txt deleted file mode 100644 index 8272a61e2..000000000 --- a/src/jabber_whiteboard/dialog/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ - -set(jabber_whiteboard_dialog_SRC - choose-desktop.cpp -) diff --git a/src/libavoid/CMakeLists.txt b/src/libavoid/CMakeLists.txt index 6eb6bdd1d..04b7375b1 100644 --- a/src/libavoid/CMakeLists.txt +++ b/src/libavoid/CMakeLists.txt @@ -1,3 +1,4 @@ + set(libavoid_SRC connector.cpp geometry.cpp @@ -14,5 +15,4 @@ set(libavoid_SRC vpsc.cpp ) -add_library(avoid_LIB STATIC ${libavoid_SRC}) -target_link_libraries(avoid_LIB ${INKSCAPE_LIBS}) +add_library(avoid_LIB ${libavoid_SRC}) diff --git a/src/libcola/CMakeLists.txt b/src/libcola/CMakeLists.txt index 40c92d578..032bffb54 100644 --- a/src/libcola/CMakeLists.txt +++ b/src/libcola/CMakeLists.txt @@ -1,3 +1,4 @@ + set(libcola_SRC cola.cpp conjugate_gradient.cpp @@ -7,5 +8,5 @@ set(libcola_SRC shortest_paths.cpp straightener.cpp ) -add_library(cola_LIB STATIC ${libcola_SRC}) -target_link_libraries(cola_LIB ${INKSCAPE_LIBS}) + +add_library(cola_LIB ${libcola_SRC}) diff --git a/src/libcroco/CMakeLists.txt b/src/libcroco/CMakeLists.txt index 3aae8eac4..c4676c504 100644 --- a/src/libcroco/CMakeLists.txt +++ b/src/libcroco/CMakeLists.txt @@ -29,5 +29,4 @@ set(libcroco_SRC cr-utils.c ) -add_library(croco_LIB STATIC ${libcroco_SRC}) -target_link_libraries(croco_LIB ${INKSCAPE_LIBS}) +add_library(croco_LIB ${libcroco_SRC}) diff --git a/src/libgdl/CMakeLists.txt b/src/libgdl/CMakeLists.txt index 6411579b3..cf550107a 100644 --- a/src/libgdl/CMakeLists.txt +++ b/src/libgdl/CMakeLists.txt @@ -16,7 +16,6 @@ set(libgdl_SRC gdl-tools.h libgdlmarshal.c libgdltypebuiltins.c - ${GDL_WIN} ) if(WIN32) @@ -25,5 +24,4 @@ if(WIN32) ) endif() -ADD_LIBRARY(gdl_LIB STATIC ${libgdl_SRC}) -TARGET_LINK_LIBRARIES(gdl_LIB ${INKSCAPE_LIBS}) +add_library(gdl_LIB ${libgdl_SRC}) diff --git a/src/libnr/CMakeLists.txt b/src/libnr/CMakeLists.txt index 28fee7b77..6895e4dbd 100644 --- a/src/libnr/CMakeLists.txt +++ b/src/libnr/CMakeLists.txt @@ -33,5 +33,4 @@ set(libnr_SRC #testnr.cpp ) -add_library(nr_LIB STATIC ${libnr_SRC}) -target_link_libraries(nr_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(nr_LIB ${libnr_SRC}) diff --git a/src/libnrtype/CMakeLists.txt b/src/libnrtype/CMakeLists.txt index 75bb5f57b..069b68bd3 100644 --- a/src/libnrtype/CMakeLists.txt +++ b/src/libnrtype/CMakeLists.txt @@ -1,3 +1,4 @@ + set(libnrtype_SRC FontFactory.cpp FontInstance.cpp @@ -14,5 +15,5 @@ set(libnrtype_SRC RasterFont.cpp TextWrapper.cpp ) -add_library(nrtype_LIB STATIC ${libnrtype_SRC}) -target_link_libraries(nrtype_LIB nr_LIB ${INKSCAPE_LIBS}) + +add_library(nrtype_LIB ${libnrtype_SRC}) diff --git a/src/libvpsc/CMakeLists.txt b/src/libvpsc/CMakeLists.txt index 0a91c3516..ebc1e79d6 100644 --- a/src/libvpsc/CMakeLists.txt +++ b/src/libvpsc/CMakeLists.txt @@ -1,3 +1,4 @@ + set(libvpsc_SRC block.cpp blocks.cpp @@ -10,5 +11,4 @@ set(libvpsc_SRC pairingheap/PairingHeap.cpp ) -add_library(vpsc_LIB STATIC ${libvpsc_SRC}) -target_link_libraries(vpsc_LIB ${INKSCAPE_LIBS}) +add_library(vpsc_LIB ${libvpsc_SRC}) diff --git a/src/livarot/CMakeLists.txt b/src/livarot/CMakeLists.txt index d8f4ba05d..51bb9530e 100644 --- a/src/livarot/CMakeLists.txt +++ b/src/livarot/CMakeLists.txt @@ -1,3 +1,4 @@ + set(livarot_SRC AlphaLigne.cpp AVL.cpp @@ -21,5 +22,4 @@ set(livarot_SRC sweep-tree-list.cpp ) -add_library(livarot_LIB STATIC ${livarot_SRC}) -target_link_libraries(nrtype_LIB ${INKSCAPE_LIBS}) +add_library(livarot_LIB ${livarot_SRC}) diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index 61fedbe66..51f8d957c 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(parameter) set(live_effects_SRC bezctx.cpp @@ -41,8 +40,18 @@ set(live_effects_SRC lpeobject-reference.cpp lpeobject.cpp spiro.cpp - ${live_effects_parameter_SRC} + + parameter/array.cpp + parameter/bool.cpp + parameter/parameter.cpp + parameter/path.cpp + parameter/path-reference.cpp + parameter/point.cpp + parameter/powerstrokepointarray.cpp + parameter/random.cpp + parameter/text.cpp + parameter/unit.cpp + parameter/vector.cpp ) -add_library(live_effects_LIB STATIC ${live_effects_SRC}) -target_link_libraries(live_effects_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(live_effects_LIB ${live_effects_SRC}) diff --git a/src/live_effects/parameter/CMakeLists.txt b/src/live_effects/parameter/CMakeLists.txt deleted file mode 100644 index 04a1080f4..000000000 --- a/src/live_effects/parameter/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(live_effects_parameter_SRC - array.cpp - bool.cpp - parameter.cpp - path.cpp - path-reference.cpp - point.cpp - powerstrokepointarray.cpp - random.cpp - text.cpp - unit.cpp - vector.cpp -) diff --git a/src/pedro/CMakeLists.txt b/src/pedro/CMakeLists.txt index 4de3592db..8a952f950 100644 --- a/src/pedro/CMakeLists.txt +++ b/src/pedro/CMakeLists.txt @@ -1,3 +1,4 @@ + set(pedro_SRC #empty.cpp #geckoembed.cpp @@ -8,5 +9,5 @@ set(pedro_SRC pedroutil.cpp pedroxmpp.cpp ) -add_library(pedro_LIB STATIC ${pedro_SRC}) -target_link_libraries(pedro_LIB ${INKSCAPE_LIBS}) + +add_library(pedro_LIB ${pedro_SRC}) diff --git a/src/svg/CMakeLists.txt b/src/svg/CMakeLists.txt index 4501983bb..1d96f5ac7 100644 --- a/src/svg/CMakeLists.txt +++ b/src/svg/CMakeLists.txt @@ -1,3 +1,4 @@ + set(svg_SRC css-ostringstream.cpp #ftos.cpp @@ -14,5 +15,4 @@ set(svg_SRC #test-stubs.cpp ) -add_library(svg_LIB STATIC ${svg_SRC}) -target_link_libraries(svg_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(svg_LIB ${svg_SRC}) diff --git a/src/trace/CMakeLists.txt b/src/trace/CMakeLists.txt index d3bdcb6b1..84aab77e2 100644 --- a/src/trace/CMakeLists.txt +++ b/src/trace/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(potrace) set(trace_SRC filterset.cpp @@ -7,8 +6,14 @@ set(trace_SRC quantize.cpp siox.cpp trace.cpp - ${trace_potrace_SRC} + + potrace/curve.cpp + potrace/decompose.cpp + potrace/greymap.cpp + potrace/inkscape-potrace.cpp + potrace/potracelib.cpp + potrace/render.cpp + potrace/trace.cpp ) -ADD_LIBRARY(trace_LIB STATIC ${trace_SRC}) -TARGET_LINK_LIBRARIES(trace_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(trace_LIB ${trace_SRC}) diff --git a/src/trace/potrace/CMakeLists.txt b/src/trace/potrace/CMakeLists.txt deleted file mode 100644 index e48d7689f..000000000 --- a/src/trace/potrace/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(trace_potrace_SRC - curve.cpp - decompose.cpp - greymap.cpp - inkscape-potrace.cpp - potracelib.cpp - render.cpp - trace.cpp -) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 5fa882f1a..7c0f18a65 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,12 +1,3 @@ -set(uifolders - cache - dialog - view - widget -) -foreach(uilistsrc ${uifolders}) - add_subdirectory(${uilistsrc}) -endforeach() set(ui_SRC clipboard.cpp @@ -14,6 +5,8 @@ set(ui_SRC previewholder.cpp uxmanager.cpp + cache/svg_preview_cache.cpp + tool/control-point-selection.cpp tool/control-point.cpp tool/curve-drag-point.cpp @@ -27,13 +20,103 @@ set(ui_SRC tool/selectable-control-point.cpp tool/selector.cpp tool/transform-handle-set.cpp - - ${ui_cache_SRC} - ${ui_dialog_SRC} - ${ui_view_SRC} - ${ui_widget_SRC} + + dialog/aboutbox.cpp + dialog/align-and-distribute.cpp + dialog/calligraphic-profile-rename.cpp + dialog/color-item.cpp + dialog/debug.cpp + dialog/desktop-tracker.cpp + dialog/dialog-manager.cpp + dialog/dialog.cpp + dialog/dock-behavior.cpp + dialog/document-metadata.cpp + dialog/document-properties.cpp + dialog/extension-editor.cpp + dialog/extensions.cpp + dialog/filedialog.cpp + dialog/filedialogimpl-gtkmm.cpp + dialog/fill-and-stroke.cpp + dialog/filter-effects-dialog.cpp + dialog/find.cpp + dialog/floating-behavior.cpp + dialog/glyphs.cpp + dialog/guides.cpp + dialog/icon-preview.cpp + dialog/inkscape-preferences.cpp + dialog/input.cpp + dialog/layer-properties.cpp + dialog/layers.cpp + dialog/livepatheffect-editor.cpp + dialog/memory.cpp + dialog/messages.cpp + dialog/ocaldialogs.cpp + dialog/print-colors-preview-dialog.cpp + dialog/print.cpp + dialog/scriptdialog.cpp + # dialog/session-player.cpp + dialog/svg-fonts-dialog.cpp + dialog/swatches.cpp + dialog/tile.cpp + dialog/tracedialog.cpp + dialog/transformation.cpp + dialog/undo-history.cpp + # dialog/whiteboard-connect.cpp + # dialog/whiteboard-sharewithchat.cpp + # dialog/whiteboard-sharewithuser.cpp + + widget/button.cpp + widget/color-picker.cpp + widget/color-preview.cpp + widget/combo-text.cpp + widget/dock-item.cpp + widget/dock.cpp + widget/entity-entry.cpp + widget/entry.cpp + widget/filter-effect-chooser.cpp + widget/handlebox.cpp + widget/icon-widget.cpp + widget/imageicon.cpp + widget/imagetoggler.cpp + widget/labelled.cpp + widget/layer-selector.cpp + widget/licensor.cpp + widget/notebook-page.cpp + widget/object-composite-settings.cpp + widget/page-sizer.cpp + widget/panel.cpp + widget/point.cpp + widget/preferences-widget.cpp + widget/random.cpp + widget/registered-widget.cpp + widget/registry.cpp + widget/rendering-options.cpp + widget/rotateable.cpp + widget/ruler.cpp + widget/scalar-unit.cpp + widget/scalar.cpp + widget/selected-style.cpp + widget/spin-slider.cpp + widget/spinbutton.cpp + widget/style-subject.cpp + widget/style-swatch.cpp + widget/svg-canvas.cpp + widget/text.cpp + widget/tolerance-slider.cpp + widget/toolbox.cpp + widget/unit-menu.cpp + widget/zoom-status.cpp + + view/view.cpp + view/view-widget.cpp ) +if(WIN32) + list(APPEND ui_SRC + dialog/filedialogimpl-win32.cpp + ) +endif() + include_directories( "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}" @@ -42,5 +125,4 @@ include_directories( "${CMAKE_SOURCE_DIR}/extension/dbus" ) -add_library(ui_LIB STATIC ${ui_SRC}) -target_link_libraries(ui_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(ui_LIB ${ui_SRC}) diff --git a/src/ui/cache/CMakeLists.txt b/src/ui/cache/CMakeLists.txt deleted file mode 100644 index c00410de5..000000000 --- a/src/ui/cache/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -set(ui_cache_SRC - svg_preview_cache.cpp -) diff --git a/src/ui/dialog/CMakeLists.txt b/src/ui/dialog/CMakeLists.txt deleted file mode 100644 index 5f2b31989..000000000 --- a/src/ui/dialog/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ - -set(ui_dialog_SRC - aboutbox.cpp - align-and-distribute.cpp - calligraphic-profile-rename.cpp - color-item.cpp - debug.cpp - desktop-tracker.cpp - dialog-manager.cpp - dialog.cpp - dock-behavior.cpp - document-metadata.cpp - document-properties.cpp - extension-editor.cpp - extensions.cpp - filedialog.cpp - filedialogimpl-gtkmm.cpp - fill-and-stroke.cpp - filter-effects-dialog.cpp - find.cpp - floating-behavior.cpp - glyphs.cpp - guides.cpp - icon-preview.cpp - inkscape-preferences.cpp - input.cpp - layer-properties.cpp - layers.cpp - livepatheffect-editor.cpp - memory.cpp - messages.cpp - ocaldialogs.cpp - print-colors-preview-dialog.cpp - print.cpp - scriptdialog.cpp - # session-player.cpp - svg-fonts-dialog.cpp - swatches.cpp - tile.cpp - tracedialog.cpp - transformation.cpp - undo-history.cpp - # whiteboard-connect.cpp - # whiteboard-sharewithchat.cpp - # whiteboard-sharewithuser.cpp -) - -if(WIN32) - list(APPEND ui_dialog_SRC - filedialogimpl-win32.cpp - ) -endif() diff --git a/src/ui/view/CMakeLists.txt b/src/ui/view/CMakeLists.txt deleted file mode 100644 index c0914d887..000000000 --- a/src/ui/view/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(ui_view_SRC - view.cpp - view-widget.cpp -) diff --git a/src/ui/widget/CMakeLists.txt b/src/ui/widget/CMakeLists.txt deleted file mode 100644 index c81ea5e24..000000000 --- a/src/ui/widget/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -set(ui_widget_SRC - button.cpp - color-picker.cpp - color-preview.cpp - combo-text.cpp - dock-item.cpp - dock.cpp - entity-entry.cpp - entry.cpp - filter-effect-chooser.cpp - handlebox.cpp - icon-widget.cpp - imageicon.cpp - imagetoggler.cpp - labelled.cpp - layer-selector.cpp - licensor.cpp - notebook-page.cpp - object-composite-settings.cpp - page-sizer.cpp - panel.cpp - point.cpp - preferences-widget.cpp - random.cpp - registered-widget.cpp - registry.cpp - rendering-options.cpp - rotateable.cpp - ruler.cpp - scalar-unit.cpp - scalar.cpp - selected-style.cpp - spin-slider.cpp - spinbutton.cpp - style-subject.cpp - style-swatch.cpp - svg-canvas.cpp - text.cpp - tolerance-slider.cpp - toolbox.cpp - unit-menu.cpp - zoom-status.cpp -) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 330d49662..a5aed5be2 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -7,5 +7,4 @@ set(util_SRC units.cpp ) -add_library(util_LIB STATIC ${util_SRC}) -target_link_libraries(util_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(util_LIB ${util_SRC}) diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 4c622fbec..c4f820e52 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -36,5 +36,4 @@ set(widgets_SRC toolbox.cpp ) -add_library(widgets_LIB STATIC ${widgets_SRC}) -target_link_libraries(widgets_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(widgets_LIB ${widgets_SRC}) diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt index 1aafe2d21..353c96998 100644 --- a/src/xml/CMakeLists.txt +++ b/src/xml/CMakeLists.txt @@ -1,3 +1,4 @@ + set(xml_SRC composite-node-observer.cpp croco-node-iface.cpp @@ -17,5 +18,4 @@ set(xml_SRC rebase-hrefs.cpp ) -add_library(xml_LIB STATIC ${xml_SRC}) -target_link_libraries(xml_LIB 2geom_LIB ${INKSCAPE_LIBS}) +add_library(xml_LIB ${xml_SRC}) -- cgit v1.2.3 From 9a8e6cfdc2f8052638e6816e0ffdd36e1b253a6c Mon Sep 17 00:00:00 2001 From: Alex Valavanis <valavanisalex@gmail.com> Date: Sun, 12 Jun 2011 18:23:46 +0100 Subject: Replace deprecated GTK_WIDGET_(UN)SET_FLAGS macros (bzr r10277.1.1) --- src/dialogs/text-edit.cpp | 3 ++- src/dialogs/xml-tree.cpp | 7 +++---- src/display/sp-canvas.cpp | 12 +++++------- src/libgdl/gdl-dock-item-grip.c | 6 +++--- src/libgdl/gdl-dock-item.c | 10 +++++----- src/libgdl/gdl-dock-placeholder.c | 5 +++-- src/libgdl/gdl-dock-tablabel.c | 2 +- src/libgdl/gdl-dock.c | 2 +- src/libgdl/gdl-switcher.c | 2 +- src/widgets/button.cpp | 4 ++-- src/widgets/desktop-widget.cpp | 6 +++--- src/widgets/eek-preview.cpp | 4 ++-- src/widgets/gradient-image.cpp | 2 +- src/widgets/sp-color-preview.cpp | 2 +- src/widgets/sp-color-slider.cpp | 4 ++-- 15 files changed, 35 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index 46d5637c3..0533a2a35 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -441,7 +441,8 @@ sp_text_edit_dialog (void) { GtkWidget *b = gtk_button_new_from_stock (GTK_STOCK_APPLY); - GTK_WIDGET_SET_FLAGS (b, GTK_CAN_DEFAULT | GTK_HAS_DEFAULT); + gtk_widget_set_can_default (b, TRUE); + gtk_widget_grab_default (b); g_signal_connect ( G_OBJECT (b), "clicked", G_CALLBACK (sp_text_edit_dialog_apply), dlg ); gtk_box_pack_end ( GTK_BOX (hb), b, FALSE, FALSE, 0 ); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index 5fd306149..78e7d3dcf 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -1339,8 +1339,7 @@ void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/) gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); cancel = gtk_button_new_with_label(_("Cancel")); - GTK_WIDGET_SET_FLAGS( GTK_WIDGET(cancel), - GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( GTK_WIDGET(cancel), TRUE ); gtk_signal_connect_object( GTK_OBJECT(cancel), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(window) ); @@ -1356,8 +1355,8 @@ void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/) gtk_signal_connect_object( GTK_OBJECT(create), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(window) ); - GTK_WIDGET_SET_FLAGS( GTK_WIDGET(create), - GTK_CAN_DEFAULT | GTK_RECEIVES_DEFAULT ); + gtk_widget_set_can_default( GTK_WIDGET(create), TRUE ); + gtk_widget_set_receives_default( GTK_WIDGET(create), TRUE ); gtk_container_add(GTK_CONTAINER(bbox), create); gtk_widget_show_all(GTK_WIDGET(window)); diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index ff1bf32c6..ad2a45eea 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1020,9 +1020,9 @@ sp_canvas_class_init (SPCanvasClass *klass) static void sp_canvas_init (SPCanvas *canvas) { - GTK_WIDGET_UNSET_FLAGS (canvas, GTK_NO_WINDOW); - GTK_WIDGET_UNSET_FLAGS (canvas, GTK_DOUBLE_BUFFERED); - GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS); + gtk_widget_set_has_window (GTK_WIDGET (canvas), TRUE); + gtk_widget_set_double_buffered (GTK_WIDGET (canvas), FALSE); + gtk_widget_set_can_focus (GTK_WIDGET (canvas), TRUE); canvas->pick_event.type = GDK_LEAVE_NOTIFY; canvas->pick_event.crossing.x = 0; @@ -1176,7 +1176,7 @@ sp_canvas_realize (GtkWidget *widget) widget->style = gtk_style_attach (widget->style, widget->window); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); canvas->pixmap_gc = gdk_gc_new (SP_CANVAS_WINDOW (canvas)); } @@ -2022,7 +2022,7 @@ sp_canvas_crossing (GtkWidget *widget, GdkEventCrossing *event) static gint sp_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) { - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); + gtk_widget_grab_focus (widget); SPCanvas *canvas = SP_CANVAS (widget); @@ -2039,8 +2039,6 @@ sp_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) static gint sp_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) { - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - SPCanvas *canvas = SP_CANVAS (widget); if (canvas->focused_item) diff --git a/src/libgdl/gdl-dock-item-grip.c b/src/libgdl/gdl-dock-item-grip.c index de09fc150..3c6b4ac17 100644 --- a/src/libgdl/gdl-dock-item-grip.c +++ b/src/libgdl/gdl-dock-item-grip.c @@ -341,7 +341,7 @@ gdl_dock_item_grip_instance_init (GdlDockItemGrip *grip) { GtkWidget *image; - GTK_WIDGET_SET_FLAGS (grip, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (grip), FALSE); grip->_priv = g_new0 (GdlDockItemGripPrivate, 1); grip->_priv->icon_pixbuf_valid = FALSE; @@ -352,7 +352,7 @@ gdl_dock_item_grip_instance_init (GdlDockItemGrip *grip) grip->_priv->close_button = gtk_button_new (); gtk_widget_pop_composite_child (); - GTK_WIDGET_UNSET_FLAGS (grip->_priv->close_button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (grip->_priv->close_button, FALSE); gtk_widget_set_parent (grip->_priv->close_button, GTK_WIDGET (grip)); gtk_button_set_relief (GTK_BUTTON (grip->_priv->close_button), GTK_RELIEF_NONE); gtk_widget_show (grip->_priv->close_button); @@ -368,7 +368,7 @@ gdl_dock_item_grip_instance_init (GdlDockItemGrip *grip) grip->_priv->iconify_button = gtk_button_new (); gtk_widget_pop_composite_child (); - GTK_WIDGET_UNSET_FLAGS (grip->_priv->iconify_button, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (grip->_priv->iconify_button, FALSE); gtk_widget_set_parent (grip->_priv->iconify_button, GTK_WIDGET (grip)); gtk_button_set_relief (GTK_BUTTON (grip->_priv->iconify_button), GTK_RELIEF_NONE); gtk_widget_show (grip->_priv->iconify_button); diff --git a/src/libgdl/gdl-dock-item.c b/src/libgdl/gdl-dock-item.c index 01a777bad..862b90c0c 100644 --- a/src/libgdl/gdl-dock-item.c +++ b/src/libgdl/gdl-dock-item.c @@ -426,8 +426,8 @@ gdl_dock_item_class_init (GdlDockItemClass *klass) static void gdl_dock_item_instance_init (GdlDockItem *item) { - GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (item), GTK_NO_WINDOW); - GTK_WIDGET_SET_FLAGS (GTK_WIDGET (item), GTK_CAN_FOCUS); + gtk_widget_set_has_window (GTK_WIDGET (item), TRUE); + gtk_widget_set_can_focus (GTK_WIDGET (item), TRUE); item->child = NULL; @@ -836,7 +836,7 @@ gdl_dock_item_map (GtkWidget *widget) g_return_if_fail (widget != NULL); g_return_if_fail (GDL_IS_DOCK_ITEM (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); + gtk_widget_set_mapped (widget, TRUE); item = GDL_DOCK_ITEM (widget); @@ -861,7 +861,7 @@ gdl_dock_item_unmap (GtkWidget *widget) g_return_if_fail (widget != NULL); g_return_if_fail (GDL_IS_DOCK_ITEM (widget)); - GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED); + gtk_widget_set_mapped (widget, FALSE); item = GDL_DOCK_ITEM (widget); @@ -883,7 +883,7 @@ gdl_dock_item_realize (GtkWidget *widget) item = GDL_DOCK_ITEM (widget); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); /* widget window */ attributes.x = widget->allocation.x; diff --git a/src/libgdl/gdl-dock-placeholder.c b/src/libgdl/gdl-dock-placeholder.c index cd900a21d..e1785ae83 100644 --- a/src/libgdl/gdl-dock-placeholder.c +++ b/src/libgdl/gdl-dock-placeholder.c @@ -215,8 +215,9 @@ gdl_dock_placeholder_class_init (GdlDockPlaceholderClass *klass) static void gdl_dock_placeholder_instance_init (GdlDockPlaceholder *ph) { - GTK_WIDGET_SET_FLAGS (ph, GTK_NO_WINDOW); - GTK_WIDGET_UNSET_FLAGS (ph, GTK_CAN_FOCUS); + gtk_widget_set_has_window (GTK_WIDGET (ph), FALSE); + + gtk_widget_set_can_focus (GTK_WIDGET (ph), FALSE); ph->_priv = g_new0 (GdlDockPlaceholderPrivate, 1); } diff --git a/src/libgdl/gdl-dock-tablabel.c b/src/libgdl/gdl-dock-tablabel.c index bd755893b..adba98b0d 100644 --- a/src/libgdl/gdl-dock-tablabel.c +++ b/src/libgdl/gdl-dock-tablabel.c @@ -550,7 +550,7 @@ gdl_dock_tablabel_realize (GtkWidget *widget) widget->style = gtk_style_attach (widget->style, widget->window); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); } static void diff --git a/src/libgdl/gdl-dock.c b/src/libgdl/gdl-dock.c index 7c74791db..da0f8c5e3 100644 --- a/src/libgdl/gdl-dock.c +++ b/src/libgdl/gdl-dock.c @@ -260,7 +260,7 @@ gdl_dock_class_init (GdlDockClass *klass) static void gdl_dock_instance_init (GdlDock *dock) { - GTK_WIDGET_SET_FLAGS (GTK_WIDGET (dock), GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (dock), FALSE); dock->root = NULL; dock->_priv = g_new0 (GdlDockPrivate, 1); diff --git a/src/libgdl/gdl-switcher.c b/src/libgdl/gdl-switcher.c index aaddc6d80..65e8b98fe 100644 --- a/src/libgdl/gdl-switcher.c +++ b/src/libgdl/gdl-switcher.c @@ -707,7 +707,7 @@ gdl_switcher_instance_init (GdlSwitcher *switcher) { GdlSwitcherPrivate *priv; - GTK_WIDGET_SET_FLAGS (switcher, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (switcher), FALSE); priv = g_new0 (GdlSwitcherPrivate, 1); switcher->priv = priv; diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index 9676651d3..e0b3a0fb9 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -101,8 +101,8 @@ sp_button_init (SPButton *button) gtk_container_set_border_width (GTK_CONTAINER (button), 0); - GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (button), GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT); + gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE); + gtk_widget_set_can_default (GTK_WIDGET (button), FALSE); g_signal_connect_after (G_OBJECT (button), "clicked", G_CALLBACK (sp_button_perform_action), NULL); g_signal_connect_after (G_OBJECT (button), "event", G_CALLBACK (sp_button_process_event), NULL); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 1de82a315..d5ec5deff 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -440,7 +440,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) #if ENABLE_LCMS dtw->canvas->enable_cms_display_adj = prefs->getBool("/options/displayprofile/enable"); #endif // ENABLE_LCMS - GTK_WIDGET_SET_FLAGS (GTK_WIDGET (dtw->canvas), GTK_CAN_FOCUS); + gtk_widget_set_can_focus (GTK_WIDGET (dtw->canvas), TRUE); style = gtk_style_copy (GTK_WIDGET (dtw->canvas)->style); style->bg[GTK_STATE_NORMAL] = style->white; gtk_widget_set_style (GTK_WIDGET (dtw->canvas), style); @@ -889,7 +889,7 @@ SPDesktopWidget::shutdown() "If you close without saving, your changes will be discarded."), doc->getName()); // fix for bug 1767940: - GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), GTK_CAN_FOCUS); + gtk_widget_set_can_focus(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), FALSE); GtkWidget *close_button; close_button = gtk_button_new_with_mnemonic(_("Close _without saving")); @@ -945,7 +945,7 @@ SPDesktopWidget::shutdown() "Do you want to save this file as Inkscape SVG?"), doc->getName() ? doc->getName() : "Unnamed"); // fix for bug 1767940: - GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), GTK_CAN_FOCUS); + gtk_widget_set_can_focus(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), FALSE); GtkWidget *close_button; close_button = gtk_button_new_with_mnemonic(_("Close _without saving")); diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp index 8fefbe75c..816c4bf50 100644 --- a/src/widgets/eek-preview.cpp +++ b/src/widgets/eek-preview.cpp @@ -684,8 +684,8 @@ void eek_preview_set_details( EekPreview* preview, PreviewStyle prevstyle, ViewT static void eek_preview_init( EekPreview *preview ) { GtkWidget* widg = GTK_WIDGET(preview); - GTK_WIDGET_SET_FLAGS( widg, GTK_CAN_FOCUS ); - GTK_WIDGET_SET_FLAGS( widg, GTK_RECEIVES_DEFAULT ); + gtk_widget_set_can_focus( widg, TRUE ); + gtk_widget_set_receives_default( widg, TRUE ); gtk_widget_set_sensitive( widg, TRUE ); diff --git a/src/widgets/gradient-image.cpp b/src/widgets/gradient-image.cpp index 11d2d528a..62a063755 100644 --- a/src/widgets/gradient-image.cpp +++ b/src/widgets/gradient-image.cpp @@ -86,7 +86,7 @@ sp_gradient_image_class_init (SPGradientImageClass *klass) static void sp_gradient_image_init (SPGradientImage *image) { - GTK_WIDGET_SET_FLAGS (image, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (image), FALSE); image->gradient = NULL; image->px = NULL; diff --git a/src/widgets/sp-color-preview.cpp b/src/widgets/sp-color-preview.cpp index 5c8154709..aad850b7c 100644 --- a/src/widgets/sp-color-preview.cpp +++ b/src/widgets/sp-color-preview.cpp @@ -74,7 +74,7 @@ sp_color_preview_class_init (SPColorPreviewClass *klass) static void sp_color_preview_init (SPColorPreview *image) { - GTK_WIDGET_SET_FLAGS (image, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (image), FALSE); image->rgba = 0xffffffff; } diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index 09d2a87ab..2d0789ec4 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -131,7 +131,7 @@ static void sp_color_slider_init (SPColorSlider *slider) { /* We are widget with window */ - GTK_WIDGET_UNSET_FLAGS (slider, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET(slider), TRUE); slider->dragging = FALSE; @@ -186,7 +186,7 @@ sp_color_slider_realize (GtkWidget *widget) slider = SP_COLOR_SLIDER (widget); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; -- cgit v1.2.3 From 2c5f1ac093f8d674dae8fc1cae88862d02468356 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 02:33:03 +0000 Subject: cmake: now builds without having most of the source listed in 1 file. (bzr r10278) --- src/CMakeLists.txt | 60 ++++++++++-------------------------- src/bind/CMakeLists.txt | 3 +- src/debug/CMakeLists.txt | 3 +- src/dialogs/CMakeLists.txt | 3 +- src/display/CMakeLists.txt | 7 ++--- src/extension/CMakeLists.txt | 11 ++++--- src/filters/CMakeLists.txt | 3 +- src/helper/CMakeLists.txt | 3 +- src/io/CMakeLists.txt | 3 +- src/jabber_whiteboard/CMakeLists.txt | 3 +- src/libnr/CMakeLists.txt | 4 +-- src/libnrtype/CMakeLists.txt | 4 +-- src/live_effects/CMakeLists.txt | 3 +- src/pedro/CMakeLists.txt | 3 +- src/svg/CMakeLists.txt | 3 +- src/trace/CMakeLists.txt | 3 +- src/ui/CMakeLists.txt | 11 ++----- src/util/CMakeLists.txt | 3 +- src/widgets/CMakeLists.txt | 3 +- src/xml/CMakeLists.txt | 3 +- 20 files changed, 59 insertions(+), 80 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de6175134..72644b416 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -129,8 +129,6 @@ set(inkscape_SRC inkscape-version.cpp inkscape.cpp inkscape.rc - # inkview.cpp - # inkview.rc interface.cpp knot-holder-entity.cpp knot.cpp @@ -141,7 +139,6 @@ set(inkscape_SRC line-snapper.cpp lpe-tool-context.cpp main-cmdlineact.cpp - main.cpp marker.cpp measure-context.cpp media.cpp @@ -214,8 +211,6 @@ endif() # All folders for internal inkscape set(internalfolders - #algorithms - #api bind debug dialogs @@ -230,7 +225,6 @@ set(internalfolders # pedro svg trace - #traits ui util widgets @@ -244,10 +238,10 @@ set(libfolders libcola libcroco libgdl - libnr - libnrtype libvpsc livarot + libnr + libnrtype ) set(dirs @@ -259,18 +253,28 @@ foreach(srclistsrc ${dirs}) add_subdirectory(${srclistsrc}) endforeach() +get_property(inkscape_global_SRC GLOBAL PROPERTY inkscape_global_SRC) + set(inkscape_SRC + ${inkscape_global_SRC} ${inkscape_SRC} - ${GlibOutput} ) add_library(sp_LIB ${sp_SRC}) +add_library(inkscape_LIB ${inkscape_SRC}) # make executable for INKSCAPE -add_executable(inkscape ${inkscape_SRC}) +add_executable(inkscape main.cpp) target_link_libraries(inkscape # order from automake + sp_LIB + inkscape_LIB + sp_LIB # annoying, we need both! + + nr_LIB + nrtype_LIB + dom_LIB croco_LIB avoid_LIB @@ -280,26 +284,6 @@ target_link_libraries(inkscape livarot_LIB 2geom_LIB - # guessing these ones - ui_LIB - bind_LIB - debug_LIB - dialogs_LIB - display_LIB - extension_LIB - filters_LIB - helper_LIB - io_LIB - nr_LIB - nrtype_LIB - sp_LIB - svg_LIB - trace_LIB - util_LIB - widgets_LIB - xml_LIB - live_effects_LIB - ${INKSCAPE_LIBS} @@ -353,18 +337,8 @@ target_link_libraries(inkscape ) +# TODO # make executable for INKVIEW -#ADD_EXECUTABLE(inkview inkview.cpp) -#TARGET_LINK_LIBRARIES(inkview -# 2geom_LIB -# avoid_LIB -# cola_LIB -# croco_LIB -# gdl_LIB -# nr_LIB -# nrtype_LIB -# vpsc_LIB -# livarot_LIB -# sp_LIB -#) +#add_executable(inkview inkview.cpp) +# ... diff --git a/src/bind/CMakeLists.txt b/src/bind/CMakeLists.txt index d0f7c7ca0..8a98e20a3 100644 --- a/src/bind/CMakeLists.txt +++ b/src/bind/CMakeLists.txt @@ -4,4 +4,5 @@ set(bind_SRC javabind.cpp ) -add_library(bind_LIB ${bind_SRC}) +# add_library(bind_LIB ${bind_SRC}) +add_inkscape_source("${bind_SRC}") diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 0c5760366..9039d52bb 100644 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -9,4 +9,5 @@ set(debug_SRC gdk-event-latency-tracker.cpp ) -add_library(debug_LIB ${debug_SRC}) +# add_library(debug_LIB ${debug_SRC}) +add_inkscape_source("${debug_SRC}") diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index bd6942ca6..f2d05a02b 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -11,4 +11,5 @@ set(dialogs_SRC xml-tree.cpp ) -add_library(dialogs_LIB ${dialogs_SRC}) +# add_library(dialogs_LIB ${dialogs_SRC}) +add_inkscape_source("${dialogs_SRC}") diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index ff0b7eac1..056067ea4 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -59,8 +59,5 @@ set(display_SRC sp-ctrlquadr.cpp ) -include_directories( - "${CMAKE_SOURCE_DIR}/src" -) - -add_library(display_LIB ${display_SRC}) +# add_library(display_LIB ${display_SRC}) +add_inkscape_source("${display_SRC}") diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 3d8777e3a..b2550361f 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -29,12 +29,12 @@ set(extension_SRC param/parameter.cpp param/radiobutton.cpp param/string.cpp - + internal/bluredge.cpp internal/cairo-png-out.cpp internal/cairo-ps-out.cpp - # internal/cairo-render-context.cpp # XXX MUST GET THIS WORKING - # internal/cairo-renderer.cpp # XXX MUST GET THIS WORKING + internal/cairo-render-context.cpp + internal/cairo-renderer.cpp internal/cairo-renderer-pdf-out.cpp internal/emf-win32-inout.cpp internal/emf-win32-print.cpp @@ -42,7 +42,7 @@ set(extension_SRC internal/gimpgrad.cpp internal/grid.cpp internal/latex-pstricks.cpp - # internal/latex-pstricks-out.cpp # XXX MUST GET THIS WORKING + internal/latex-pstricks-out.cpp internal/odf.cpp internal/latex-text-renderer.cpp internal/pdf-input-cairo.cpp @@ -115,4 +115,5 @@ if(WIN32) ) endif() -add_library(extension_LIB ${extension_SRC}) +# add_library(extension_LIB ${extension_SRC}) +add_inkscape_source("${extension_SRC}") diff --git a/src/filters/CMakeLists.txt b/src/filters/CMakeLists.txt index ed64fe764..8016553c8 100644 --- a/src/filters/CMakeLists.txt +++ b/src/filters/CMakeLists.txt @@ -22,4 +22,5 @@ set(filters_SRC turbulence.cpp ) -add_library(filters_LIB ${filters_SRC}) +#add_library(filters_LIB ${filters_SRC}) +add_inkscape_source("${filters_SRC}") diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index 3f1567cce..b4786ff54 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -27,4 +27,5 @@ set(helper_SRC ${sp_marshal_SRC} ) -add_library(helper_LIB ${helper_SRC}) +# add_library(helper_LIB ${helper_SRC}) +add_inkscape_source("${helper_SRC}") diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index 06a5f869a..e9bff2bc2 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -13,4 +13,5 @@ set(io_SRC xsltstream.cpp ) -add_library(io_LIB ${io_SRC}) +# add_library(io_LIB ${io_SRC}) +add_inkscape_source("${io_SRC}") diff --git a/src/jabber_whiteboard/CMakeLists.txt b/src/jabber_whiteboard/CMakeLists.txt index 2e1ef311b..62de25d70 100644 --- a/src/jabber_whiteboard/CMakeLists.txt +++ b/src/jabber_whiteboard/CMakeLists.txt @@ -19,4 +19,5 @@ set(jabber_whiteboard_SRC dialog/choose-desktop.cpp ) -add_library(jabber_whiteboard_LIB ${jabber_whiteboard_SRC}) +# add_library(jabber_whiteboard_LIB ${jabber_whiteboard_SRC}) +add_inkscape_source("${jabber_whiteboard_SRC}") diff --git a/src/libnr/CMakeLists.txt b/src/libnr/CMakeLists.txt index 6895e4dbd..0d3202636 100644 --- a/src/libnr/CMakeLists.txt +++ b/src/libnr/CMakeLists.txt @@ -1,5 +1,5 @@ -set(libnr_SRC +set(nr_SRC #in-svg-plane-test.cpp nr-blit.cpp nr-compose.cpp @@ -33,4 +33,4 @@ set(libnr_SRC #testnr.cpp ) -add_library(nr_LIB ${libnr_SRC}) +add_library(nr_LIB ${nr_SRC}) diff --git a/src/libnrtype/CMakeLists.txt b/src/libnrtype/CMakeLists.txt index 069b68bd3..d5f9b846f 100644 --- a/src/libnrtype/CMakeLists.txt +++ b/src/libnrtype/CMakeLists.txt @@ -1,5 +1,5 @@ -set(libnrtype_SRC +set(nrtype_SRC FontFactory.cpp FontInstance.cpp font-lister.cpp @@ -16,4 +16,4 @@ set(libnrtype_SRC TextWrapper.cpp ) -add_library(nrtype_LIB ${libnrtype_SRC}) +add_library(nrtype_LIB ${nrtype_SRC}) diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index 51f8d957c..148ea92f7 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -54,4 +54,5 @@ set(live_effects_SRC parameter/vector.cpp ) -add_library(live_effects_LIB ${live_effects_SRC}) +# add_library(live_effects_LIB ${live_effects_SRC}) +add_inkscape_source("${live_effects_SRC}") diff --git a/src/pedro/CMakeLists.txt b/src/pedro/CMakeLists.txt index 8a952f950..7dce5b755 100644 --- a/src/pedro/CMakeLists.txt +++ b/src/pedro/CMakeLists.txt @@ -10,4 +10,5 @@ set(pedro_SRC pedroxmpp.cpp ) -add_library(pedro_LIB ${pedro_SRC}) +# add_library(pedro_LIB ${pedro_SRC}) +add_inkscape_source("${pedro_SRC}") diff --git a/src/svg/CMakeLists.txt b/src/svg/CMakeLists.txt index 1d96f5ac7..8c1f0058e 100644 --- a/src/svg/CMakeLists.txt +++ b/src/svg/CMakeLists.txt @@ -15,4 +15,5 @@ set(svg_SRC #test-stubs.cpp ) -add_library(svg_LIB ${svg_SRC}) +# add_library(svg_LIB ${svg_SRC}) +add_inkscape_source("${svg_SRC}") diff --git a/src/trace/CMakeLists.txt b/src/trace/CMakeLists.txt index 84aab77e2..3f712a314 100644 --- a/src/trace/CMakeLists.txt +++ b/src/trace/CMakeLists.txt @@ -16,4 +16,5 @@ set(trace_SRC potrace/trace.cpp ) -add_library(trace_LIB ${trace_SRC}) +# add_library(trace_LIB ${trace_SRC}) +add_inkscape_source("${trace_SRC}") diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 7c0f18a65..bf9ddb4c8 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -117,12 +117,5 @@ if(WIN32) ) endif() -include_directories( - "${CMAKE_SOURCE_DIR}/src" - "${CMAKE_SOURCE_DIR}" - "${CMAKE_SOURCE_DIR}/bind/javainc" - "${CMAKE_SOURCE_DIR}/bind/javainc/linux" - "${CMAKE_SOURCE_DIR}/extension/dbus" -) - -add_library(ui_LIB ${ui_SRC}) +# add_library(ui_LIB ${ui_SRC}) +add_inkscape_source("${ui_SRC}") diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index a5aed5be2..ca90272ae 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -7,4 +7,5 @@ set(util_SRC units.cpp ) -add_library(util_LIB ${util_SRC}) +# add_library(util_LIB ${util_SRC}) +add_inkscape_source("${util_SRC}") diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index c4f820e52..09d2d6303 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -36,4 +36,5 @@ set(widgets_SRC toolbox.cpp ) -add_library(widgets_LIB ${widgets_SRC}) +# add_library(widgets_LIB ${widgets_SRC}) +add_inkscape_source("${widgets_SRC}") diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt index 353c96998..3cca53fd8 100644 --- a/src/xml/CMakeLists.txt +++ b/src/xml/CMakeLists.txt @@ -18,4 +18,5 @@ set(xml_SRC rebase-hrefs.cpp ) -add_library(xml_LIB ${xml_SRC}) +# add_library(xml_LIB ${xml_SRC}) +add_inkscape_source("${xml_SRC}") -- cgit v1.2.3 From b7a4f23ed217a36eaaefe8f707bcc1b968d1e562 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 05:39:42 +0000 Subject: cmake: - group source/headers per library (for some IDE's) - include headers with source listing (also for IDE's) - remove unneeded Find modules (bzr r10281) --- src/2geom/CMakeLists.txt | 2 +- src/CMakeLists.txt | 410 +++++++++++++++++++++++++++-------- src/bind/CMakeLists.txt | 12 +- src/debug/CMakeLists.txt | 17 +- src/dialogs/CMakeLists.txt | 15 +- src/display/CMakeLists.txt | 69 +++++- src/dom/CMakeLists.txt | 49 ++++- src/extension/CMakeLists.txt | 107 ++++++++- src/filters/CMakeLists.txt | 40 +++- src/helper/CMakeLists.txt | 26 ++- src/io/CMakeLists.txt | 17 +- src/jabber_whiteboard/CMakeLists.txt | 23 +- src/libavoid/CMakeLists.txt | 21 +- src/libcola/CMakeLists.txt | 13 +- src/libcroco/CMakeLists.txt | 32 ++- src/libgdl/CMakeLists.txt | 24 +- src/libnr/CMakeLists.txt | 77 ++++++- src/libnrtype/CMakeLists.txt | 23 +- src/libvpsc/CMakeLists.txt | 17 +- src/livarot/CMakeLists.txt | 18 +- src/live_effects/CMakeLists.txt | 59 ++++- src/pedro/CMakeLists.txt | 2 +- src/svg/CMakeLists.txt | 21 +- src/trace/CMakeLists.txt | 25 ++- src/ui/CMakeLists.txt | 128 ++++++++++- src/util/CMakeLists.txt | 32 ++- src/widgets/CMakeLists.txt | 39 +++- src/xml/CMakeLists.txt | 33 ++- 28 files changed, 1231 insertions(+), 120 deletions(-) (limited to 'src') diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt index 6c6001c4b..c04718e79 100644 --- a/src/2geom/CMakeLists.txt +++ b/src/2geom/CMakeLists.txt @@ -122,4 +122,4 @@ set(2geom_SRC ) # make lib for 2geom_LIB -add_library(2geom_LIB ${2geom_SRC}) +add_inkscape_lib(2geom_LIB "${2geom_SRC}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72644b416..718c92b4b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,12 @@ +# ----------------------------------------------------------------------------- +# Define the main source +# ----------------------------------------------------------------------------- + +set(main_SRC + main.cpp +) + set(sp_SRC sp-anchor.cpp # sp-animation.cpp @@ -67,6 +75,91 @@ set(sp_SRC sp-use.cpp spiral-context.cpp splivarot.cpp + + sp-anchor.h + sp-animation.h + sp-clippath.h + sp-conn-end-pair.h + sp-conn-end.h + sp-cursor.h + sp-defs.h + sp-desc.h + sp-ellipse.h + sp-filter-fns.h + sp-filter-primitive.h + sp-filter-reference.h + sp-filter-units.h + sp-filter.h + sp-flowdiv.h + sp-flowregion.h + sp-flowtext.h + sp-font-face.h + sp-font.h + sp-gaussian-blur-fns.h + sp-gaussian-blur.h + sp-glyph-kerning.h + sp-glyph.h + sp-gradient-fns.h + sp-gradient-reference.h + sp-gradient-spread.h + sp-gradient-test.h + sp-gradient-units.h + sp-gradient-vector.h + sp-gradient.h + sp-guide-attachment.h + sp-guide-constraint.h + sp-guide.h + sp-image.h + sp-item-group.h + sp-item-notify-moveto.h + sp-item-rm-unsatisfied-cns.h + sp-item-transform.h + sp-item-update-cns.h + sp-item.h + sp-line.h + sp-linear-gradient-fns.h + sp-linear-gradient.h + sp-lpe-item.h + sp-marker-loc.h + sp-mask.h + sp-metadata.h + sp-metric.h + sp-metrics.h + sp-missing-glyph.h + sp-namedview.h + sp-object-group.h + sp-object-repr.h + sp-object.h + sp-offset.h + sp-paint-server-reference.h + sp-paint-server.h + sp-path.h + sp-pattern.h + sp-polygon.h + sp-polyline.h + sp-radial-gradient-fns.h + sp-radial-gradient.h + sp-rect.h + sp-root.h + sp-script.h + sp-shape.h + # sp-skeleton.h + sp-spiral.h + sp-star.h + sp-stop.h + sp-string.h + sp-style-elem-test.h + sp-style-elem.h + sp-switch.h + sp-symbol.h + sp-text.h + sp-textpath.h + sp-title.h + sp-tref-reference.h + sp-tref.h + sp-tspan.h + sp-use-reference.h + sp-use.h ) set(inkscape_SRC @@ -199,6 +292,194 @@ set(inkscape_SRC verbs.cpp version.cpp zoom-context.cpp + + + # ------- + # Headers + MultiPrinter.h + PylogFormatter.h + TRPIFormatter.h + approx-equal.h + arc-context.h + attributes-test.h + attributes.h + axis-manip.h + bad-uri-exception.h + box3d-context.h + box3d-side.h + box3d.h + color-profile-fns.h + color-profile-test.h + color-profile.h + color-rgba.h + color.h + common-context.h + composite-undo-stack-observer.h + conditions.h + conn-avoid-ref.h + connection-points.h + connection-pool.h + connector-context.h + console-output-undo-observer.h + context-fns.h + decimal-round.h + desktop-events.h + desktop-handles.h + desktop-style.h + desktop.h + device-manager.h + dir-util-test.h + dir-util.h + document-private.h + document-subset.h + document-undo.h + document.h + draw-anchor.h + draw-context.h + dropper-context.h + dyna-draw-context.h + ege-adjustment-action.h + ege-color-prof-tracker.h + ege-output-action.h + ege-select-one-action.h + enums.h + eraser-context.h + event-context.h + event-log.h + event.h + extract-uri-test.h + extract-uri.h + file.h + fill-or-stroke.h + filter-chemistry.h + filter-enums.h + flood-context.h + forward.h + gc-alloc.h + gc-allocator.h + gc-anchored.h + gc-core.h + gc-finalized.h + gc-managed.h + gc-soft-ptr.h + gradient-chemistry.h + gradient-context.h + gradient-drag.h + graphlayout.h + guide-snapper.h + help.h + helper-fns.h + icon-size.h + id-clash.h + ige-mac-menu.h + ink-action.h + ink-comboboxentry-action.h + inkscape-private.h + inkscape-version.h + inkscape.h + interface.h + isinf.h + isnormal.h + knot-enums.h + knot-holder-entity.h + knot.h + knotholder.h + layer-fns.h + layer-manager.h + line-geometry.h + line-snapper.h + lpe-tool-context.h + macros.h + main-cmdlineact.h + marker-test.h + marker.h + measure-context.h + media.h + memeq.h + menus-skeleton.h + message-context.h + message-stack.h + message.h + mod360-test.h + mod360.h + modifier-fns.h + number-opt-number.h + object-edit.h + object-hierarchy.h + object-snapper.h + path-chemistry.h + path-prefix.h + pen-context.h + pencil-context.h + persp3d-reference.h + persp3d.h + perspective-line.h + preferences-skeleton.h + preferences-test.h + preferences.h + prefix.h + print.h + profile-manager.h + proj_pt.h + rdf.h + rect-context.h + registrytool.h + remove-last.h + removeoverlap.h + require-config.h + resource-manager.h + round-test.h + round.h + rubberband.h + satisfied-guide-cns.h + selcue.h + select-context.h + selection-chemistry.h + selection-describer.h + selection.h + seltrans-handles.h + seltrans.h + shape-editor.h + shortcuts.h + snap-candidate.h + snap-enums.h + snap-preferences.h + snap.h + snapped-curve.h + snapped-line.h + snapped-point.h + snapper.h + spiral-context.h + splivarot.h + spray-context.h + star-context.h + streq.h + strneq.h + style-test.h + style.h + svg-profile.h + svg-view-widget.h + svg-view.h + syseq.h + test-helpers.h + text-chemistry.h + text-context.h + text-editing.h + text-tag-attributes.h + tools-switch.h + transf_mat_3x4.h + tweak-context.h + unclump.h + undo-stack-observer.h + unicoderange.h + unit-constants.h + uri-references.h + uri.h + vanishing-point.h + verbs-test.h + verbs.h + version.h + zoom-context.h ) if(WIN32) @@ -209,49 +490,44 @@ if(WIN32) ) endif() + +# ----------------------------------------------------------------------------- +# Load in subdirectories +# ----------------------------------------------------------------------------- + # All folders for internal inkscape -set(internalfolders - bind - debug - dialogs - display - dom - extension - filters - helper - io - # jabber_whiteboard - live_effects - # pedro - svg - trace - ui - util - widgets - xml - 2geom -) +# these call add_inkscape_source +add_subdirectory(bind) +add_subdirectory(debug) +add_subdirectory(dialogs) +add_subdirectory(display) +add_subdirectory(dom) +add_subdirectory(extension) +add_subdirectory(filters) +add_subdirectory(helper) +add_subdirectory(io) +# add_subdirectory(jabber_whiteboard) +add_subdirectory(live_effects) +# add_subdirectory(pedro) +add_subdirectory(svg) +add_subdirectory(trace) +add_subdirectory(ui) +add_subdirectory(util) +add_subdirectory(widgets) +add_subdirectory(xml) +add_subdirectory(2geom) -set(libfolders - # Directories containing lists files that describe building internal libraries - libavoid - libcola - libcroco - libgdl - libvpsc - livarot - libnr - libnrtype -) -set(dirs - ${internalfolders} - ${libfolders} -) +# Directories containing lists files that describe building internal libraries +add_subdirectory(libavoid) +add_subdirectory(libcola) +add_subdirectory(libcroco) +add_subdirectory(libgdl) +add_subdirectory(libvpsc) +add_subdirectory(livarot) +add_subdirectory(libnr) +add_subdirectory(libnrtype) -foreach(srclistsrc ${dirs}) - add_subdirectory(${srclistsrc}) -endforeach() get_property(inkscape_global_SRC GLOBAL PROPERTY inkscape_global_SRC) @@ -260,11 +536,15 @@ set(inkscape_SRC ${inkscape_SRC} ) -add_library(sp_LIB ${sp_SRC}) -add_library(inkscape_LIB ${inkscape_SRC}) + +# ----------------------------------------------------------------------------- +# Setup the executable +# ----------------------------------------------------------------------------- +add_inkscape_lib(sp_LIB "${sp_SRC}") +add_inkscape_lib(inkscape_LIB "${inkscape_SRC}") # make executable for INKSCAPE -add_executable(inkscape main.cpp) +add_executable(inkscape ${main_SRC}) target_link_libraries(inkscape # order from automake @@ -285,56 +565,16 @@ target_link_libraries(inkscape 2geom_LIB ${INKSCAPE_LIBS} - - + # system libs - -lxslt - -lgtkspell - -lgsl - -lgslcblas + -lgsl # needed + -lgslcblas # needed -lgtkmm-2.4 - -latkmm-1.6 -lgdkmm-2.4 - -lgiomm-2.4 -lpangomm-1.4 - -lgtk-x11-2.0 - -lglibmm-2.4 - -lcairomm-1.0 -lsigc-2.0 - -latk-1.0 - -lgio-2.0 - -lpng - -lX11 - -lxml2 - -ldl - -lgomp - -lpopt - -laspell - -lgnomevfs-2 - -lgconf-2 - -lpangoft2-1.0 - -lfontconfig - -lfreetype - -lz -lMagick++ -lMagickCore - -lgc - -llcms - -lpoppler-glib - -lgdk-x11-2.0 - -lpoppler - -lpangocairo-1.0 - -lgdk_pixbuf-2.0 - -lpng14 - -lm - -lpango-1.0 - -lcairo - -lgmodule-2.0 - -lgobject-2.0 - -lgthread-2.0 - -lrt - -lglib-2.0 - ) # TODO diff --git a/src/bind/CMakeLists.txt b/src/bind/CMakeLists.txt index 8a98e20a3..9b6abad4f 100644 --- a/src/bind/CMakeLists.txt +++ b/src/bind/CMakeLists.txt @@ -2,7 +2,17 @@ set(bind_SRC dobinding.cpp javabind.cpp + + + # ------- + # Headers + javabind-private.h + javabind.h + javainc/jni.h + javainc/linux/jni_md.h + javainc/solaris/jni_md.h + javainc/win32/jni_md.h ) -# add_library(bind_LIB ${bind_SRC}) +# add_inkscape_lib(bind_LIB "${bind_SRC}") add_inkscape_source("${bind_SRC}") diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 9039d52bb..5c0354fce 100644 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -7,7 +7,22 @@ set(debug_SRC sysv-heap.cpp timestamp.cpp gdk-event-latency-tracker.cpp + + + # ------ + # Header + demangle.h + event-tracker.h + event.h + gc-heap.h + gdk-event-latency-tracker.h + heap.h + log-display-config.h + logger.h + simple-event.h + sysv-heap.h + timestamp.h ) -# add_library(debug_LIB ${debug_SRC}) +# add_inkscape_lib(debug_LIB "${debug_SRC}") add_inkscape_source("${debug_SRC}") diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt index f2d05a02b..6586b78af 100644 --- a/src/dialogs/CMakeLists.txt +++ b/src/dialogs/CMakeLists.txt @@ -9,7 +9,20 @@ set(dialogs_SRC spellcheck.cpp text-edit.cpp xml-tree.cpp + + + # ------- + # Headers + clonetiler.h + dialog-events.h + export.h + find.h + item-properties.h + object-attributes.h + spellcheck.h + text-edit.h + xml-tree.h ) -# add_library(dialogs_LIB ${dialogs_SRC}) +# add_inkscape_lib(dialogs_LIB "${dialogs_SRC}") add_inkscape_source("${dialogs_SRC}") diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index 056067ea4..30643550f 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -57,7 +57,74 @@ set(display_SRC sp-ctrlline.cpp sp-ctrlpoint.cpp sp-ctrlquadr.cpp + + + # ------- + # Headers + canvas-arena.h + canvas-axonomgrid.h + canvas-bpath.h + canvas-grid.h + canvas-temporary-item-list.h + canvas-temporary-item.h + canvas-text.h + curve-test.h + curve.h + gnome-canvas-acetate.h + grayscale.h + guideline.h + inkscape-cairo.h + nr-3dutils.h + nr-arena-forward.h + nr-arena-glyphs.h + nr-arena-group.h + nr-arena-image.h + nr-arena-item.h + nr-arena-shape.h + nr-arena.h + nr-filter-blend.h + nr-filter-colormatrix.h + nr-filter-component-transfer.h + nr-filter-composite.h + nr-filter-convolve-matrix.h + nr-filter-diffuselighting.h + nr-filter-displacement-map.h + nr-filter-flood.h + nr-filter-gaussian.h + nr-filter-getalpha.h + nr-filter-image.h + nr-filter-merge.h + nr-filter-morphology.h + nr-filter-offset.h + nr-filter-pixops.h + nr-filter-primitive.h + nr-filter-skeleton.h + nr-filter-slot.h + nr-filter-specularlighting.h + nr-filter-tile.h + nr-filter-turbulence.h + nr-filter-types.h + nr-filter-units.h + nr-filter-utils.h + nr-filter.h + nr-light-types.h + nr-light.h + nr-plain-stuff-gdk.h + nr-plain-stuff.h + pixblock-scaler.h + pixblock-transform.h + rendermode.h + snap-indicator.h + sodipodi-ctrl.h + sodipodi-ctrlrect.h + sp-canvas-group.h + sp-canvas-item.h + sp-canvas-util.h + sp-canvas.h + sp-ctrlline.h + sp-ctrlpoint.h + sp-ctrlquadr.h ) -# add_library(display_LIB ${display_SRC}) +# add_inkscape_lib(display_LIB "${display_SRC}") add_inkscape_source("${display_SRC}") diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 5a3ebebf8..dbaa1a763 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -47,6 +47,53 @@ set(dom_SRC # work/testzip.cpp # work/xpathtests.cpp + + + # ------- + # Headers + css.h + cssreader.h + dom.h + domimpl.h + domptr.h + domstring.h + events.h + ls.h + lsimpl.h + smil.h + smilimpl.h + stylesheets.h + svg.h + svg2.h + svgimpl.h + svgreader.h + svgtypes.h + traversal.h + ucd.h + uri.h + views-level3.h + views.h + xmlreader.h + xmlwriter.h + xpath.h + xpathimpl.h + xpathparser.h + xpathtoken.h + + odf/odfdocument.h + + io/base64stream.h + io/bufferstream.h + io/domstream.h + io/gzipstream.h + io/httpclient.h + io/socket.h + io/stringstream.h + io/uristream.h + + util/digest.h + util/thread.h + util/ziptool.h ) -add_library(dom_LIB ${dom_SRC}) +add_inkscape_lib(dom_LIB "${dom_SRC}") diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index b2550361f..8a58ae2be 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -107,6 +107,111 @@ set(extension_SRC # dxf2svg/dxf2svg.cpp # dxf2svg/read_dxf.cpp # dxf2svg/test_dxf.cpp + + + # ------ + # Header + db.h + dependency.h + effect.h + error-file.h + execution-env.h + extension-forward.h + extension.h + init.h + input.h + output.h + param/bool.h + param/color.h + param/description.h + param/enum.h + param/float.h + param/int.h + param/notebook.h + param/parameter.h + param/radiobutton.h + param/string.h + patheffect.h + prefdialog.h + print.h + system.h + timer.h + + implementation/implementation.h + implementation/script.h + implementation/xslt.h + + internal/bitmap/adaptiveThreshold.h + internal/bitmap/addNoise.h + internal/bitmap/blur.h + internal/bitmap/channel.h + internal/bitmap/charcoal.h + internal/bitmap/colorize.h + internal/bitmap/contrast.h + internal/bitmap/cycleColormap.h + internal/bitmap/despeckle.h + internal/bitmap/edge.h + internal/bitmap/emboss.h + internal/bitmap/enhance.h + internal/bitmap/equalize.h + internal/bitmap/gaussianBlur.h + internal/bitmap/imagemagick.h + internal/bitmap/implode.h + internal/bitmap/level.h + internal/bitmap/levelChannel.h + internal/bitmap/medianFilter.h + internal/bitmap/modulate.h + internal/bitmap/negate.h + internal/bitmap/normalize.h + internal/bitmap/oilPaint.h + internal/bitmap/opacity.h + internal/bitmap/raise.h + internal/bitmap/reduceNoise.h + internal/bitmap/sample.h + internal/bitmap/shade.h + internal/bitmap/sharpen.h + internal/bitmap/solarize.h + internal/bitmap/spread.h + internal/bitmap/swirl.h + internal/bitmap/threshold.h + internal/bitmap/unsharpmask.h + internal/bitmap/wave.h + internal/bluredge.h + internal/cairo-png-out.h + internal/cairo-ps-out.h + internal/cairo-render-context.h + internal/cairo-renderer-pdf-out.h + internal/cairo-renderer.h + internal/clear-n_.h + internal/emf-win32-inout.h + internal/emf-win32-print.h + internal/filter/abc.h + internal/filter/color.h + internal/filter/drop-shadow.h + internal/filter/experimental.h + internal/filter/filter.h + internal/filter/morphology.h + internal/filter/shadows.h + internal/filter/snow.h + internal/gdkpixbuf-input.h + internal/gimpgrad.h + internal/grid.h + internal/javafx-out.h + internal/latex-pstricks-out.h + internal/latex-pstricks.h + internal/latex-text-renderer.h + internal/odf.h + internal/pdf-input-cairo.h + internal/pdfinput/pdf-input.h + internal/pdfinput/pdf-parser.h + internal/pdfinput/svg-builder.h + internal/pov-out.h + internal/svg.h + internal/svgz.h + internal/win32.h + internal/wpg-input.h + + script/InkscapeScript.h ) if(WIN32) @@ -115,5 +220,5 @@ if(WIN32) ) endif() -# add_library(extension_LIB ${extension_SRC}) +# add_inkscape_lib(extension_LIB "${extension_SRC}") add_inkscape_source("${extension_SRC}") diff --git a/src/filters/CMakeLists.txt b/src/filters/CMakeLists.txt index 8016553c8..72e0bba78 100644 --- a/src/filters/CMakeLists.txt +++ b/src/filters/CMakeLists.txt @@ -20,7 +20,45 @@ set(filters_SRC spotlight.cpp tile.cpp turbulence.cpp + + # ------- + # Headers + blend-fns.h + blend.h + colormatrix-fns.h + colormatrix.h + componenttransfer-fns.h + componenttransfer-funcnode.h + componenttransfer.h + composite-fns.h + composite.h + convolvematrix-fns.h + convolvematrix.h + diffuselighting-fns.h + diffuselighting.h + displacementmap-fns.h + displacementmap.h + distantlight.h + flood-fns.h + flood.h + image-fns.h + image.h + merge-fns.h + merge.h + mergenode.h + morphology-fns.h + morphology.h + offset-fns.h + offset.h + pointlight.h + specularlighting-fns.h + specularlighting.h + spotlight.h + tile-fns.h + tile.h + turbulence-fns.h + turbulence.h ) -#add_library(filters_LIB ${filters_SRC}) +# add_inkscape_lib(filters_LIB "${filters_SRC}"") add_inkscape_source("${filters_SRC}") diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index b4786ff54..f1069e986 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -21,11 +21,31 @@ set(helper_SRC #units-test.cpp unit-tracker.cpp window.cpp - sp-marshal.cpp - sp-marshal.list + # we generate this file and it's .h counter-part ${sp_marshal_SRC} + + + # ------- + # Headers + action.h + geom-curves.h + geom-nodetype.h + geom.h + gnome-utils.h + helper-forward.h + pixbuf-ops.h + png-write.h + recthull.h + sp-marshal.h + stlport.h + stock-items.h + unit-menu.h + unit-tracker.h + units-test.h + units.h + window.h ) -# add_library(helper_LIB ${helper_SRC}) +# add_inkscape_lib(helper_LIB "${helper_SRC}") add_inkscape_source("${helper_SRC}") diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index e9bff2bc2..c5606779e 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -11,7 +11,22 @@ set(io_SRC sys.cpp uristream.cpp xsltstream.cpp + + + # ------- + # Headers + base64stream.h + ftos.h + gzipstream.h + inkjar.h + inkscapestream.h + resource.h + simple-sax.h + stringstream.h + sys.h + uristream.h + xsltstream.h ) -# add_library(io_LIB ${io_SRC}) +# add_inkscape_lib(io_LIB "${io_SRC}") add_inkscape_source("${io_SRC}") diff --git a/src/jabber_whiteboard/CMakeLists.txt b/src/jabber_whiteboard/CMakeLists.txt index 62de25d70..b91bdf141 100644 --- a/src/jabber_whiteboard/CMakeLists.txt +++ b/src/jabber_whiteboard/CMakeLists.txt @@ -17,7 +17,28 @@ set(jabber_whiteboard_SRC session-manager.cpp dialog/choose-desktop.cpp + + + # ------- + # Headers + defines.h + dialog/choose-desktop.h + inkboard-document.h + invitation-confirm-dialog.h + keynode.h + message-aggregator.h + message-node.h + message-queue.h + message-tags.h + message-utilities.h + message-verifier.h + node-tracker.h + node-utilities.h + pedrogui.h + session-file-selector.h + session-manager.h + tracker-node.h ) -# add_library(jabber_whiteboard_LIB ${jabber_whiteboard_SRC}) +# add_inkscape_lib(jabber_whiteboard_LIB "${jabber_whiteboard_SRC}") add_inkscape_source("${jabber_whiteboard_SRC}") diff --git a/src/libavoid/CMakeLists.txt b/src/libavoid/CMakeLists.txt index 04b7375b1..de067833b 100644 --- a/src/libavoid/CMakeLists.txt +++ b/src/libavoid/CMakeLists.txt @@ -13,6 +13,25 @@ set(libavoid_SRC viscluster.cpp visibility.cpp vpsc.cpp + + # ------- + # Headers + assertions.h + connector.h + debug.h + geometry.h + geomtypes.h + graph.h + libavoid.h + makepath.h + orthogonal.h + router.h + shape.h + timer.h + vertices.h + viscluster.h + visibility.h + vpsc.h ) -add_library(avoid_LIB ${libavoid_SRC}) +add_inkscape_lib(avoid_LIB "${libavoid_SRC}") diff --git a/src/libcola/CMakeLists.txt b/src/libcola/CMakeLists.txt index 032bffb54..c89ffc692 100644 --- a/src/libcola/CMakeLists.txt +++ b/src/libcola/CMakeLists.txt @@ -7,6 +7,17 @@ set(libcola_SRC gradient_projection.cpp shortest_paths.cpp straightener.cpp + + + # ------- + # Headers + cola.h + conjugate_gradient.h + # cycle_detector.h + defs.h + gradient_projection.h + shortest_paths.h + straightener.h ) -add_library(cola_LIB ${libcola_SRC}) +add_inkscape_lib(cola_LIB "${libcola_SRC}") diff --git a/src/libcroco/CMakeLists.txt b/src/libcroco/CMakeLists.txt index c4676c504..890f58825 100644 --- a/src/libcroco/CMakeLists.txt +++ b/src/libcroco/CMakeLists.txt @@ -27,6 +27,36 @@ set(libcroco_SRC cr-tknzr.c cr-token.c cr-utils.c + + cr-additional-sel.h + cr-attr-sel.h + cr-cascade.h + cr-declaration.h + cr-doc-handler.h + cr-enc-handler.h + cr-fonts.h + cr-input.h + cr-libxml-node-iface.h + cr-node-iface.h + cr-num.h + cr-om-parser.h + cr-parser.h + cr-parsing-location.h + cr-prop-list.h + cr-pseudo.h + cr-rgb.h + cr-sel-eng.h + cr-selector.h + cr-simple-sel.h + cr-statement.h + cr-string.h + cr-style.h + cr-stylesheet.h + cr-term.h + cr-tknzr.h + cr-token.h + cr-utils.h + libcroco.h ) -add_library(croco_LIB ${libcroco_SRC}) +add_inkscape_lib(croco_LIB "${libcroco_SRC}") diff --git a/src/libgdl/CMakeLists.txt b/src/libgdl/CMakeLists.txt index cf550107a..befb6edb7 100644 --- a/src/libgdl/CMakeLists.txt +++ b/src/libgdl/CMakeLists.txt @@ -16,12 +16,34 @@ set(libgdl_SRC gdl-tools.h libgdlmarshal.c libgdltypebuiltins.c + + + # ------- + # Headers + gdl-dock-bar.h + gdl-dock-item-grip.h + gdl-dock-item.h + gdl-dock-master.h + gdl-dock-notebook.h + gdl-dock-object.h + gdl-dock-paned.h + gdl-dock-placeholder.h + gdl-dock-tablabel.h + gdl-dock.h + gdl-i18n.h + gdl-stock-icons.h + gdl-stock.h + gdl-switcher.h + libgdl.h + libgdlmarshal.h + libgdltypebuiltins.h ) if(WIN32) list(APPEND libgdl_SRC gdl-win32.c + gdl-win32.h ) endif() -add_library(gdl_LIB ${libgdl_SRC}) +add_inkscape_lib(gdl_LIB "${libgdl_SRC}") diff --git a/src/libnr/CMakeLists.txt b/src/libnr/CMakeLists.txt index 0d3202636..994c5d348 100644 --- a/src/libnr/CMakeLists.txt +++ b/src/libnr/CMakeLists.txt @@ -1,6 +1,6 @@ set(nr_SRC - #in-svg-plane-test.cpp + # in-svg-plane-test.cpp nr-blit.cpp nr-compose.cpp nr-compose-transform.cpp @@ -15,11 +15,11 @@ set(nr_SRC nr-pixblock-pattern.cpp nr-pixblock-pixel.cpp nr-point-fns.cpp - #nr-point-fns-test.cpp + # nr-point-fns-test.cpp nr-rect.cpp nr-rect-l.cpp nr-rotate-fns.cpp - #nr-rotate-fns-test.cpp + # nr-rotate-fns-test.cpp nr-rotate-matrix-ops.cpp nr-scale-matrix-ops.cpp nr-scale-translate-ops.cpp @@ -28,9 +28,74 @@ set(nr_SRC nr-translate-scale-ops.cpp #nr-translate-test.cpp nr-types.cpp - #nr-types-test.cpp + # nr-types-test.cpp nr-values.cpp - #testnr.cpp + # testnr.cpp + + # ------- + # Headers + # in-svg-plane-test.h + in-svg-plane.h + nr-blit.h + nr-compose-reference.h + nr-compose-test.h + nr-compose-transform.h + nr-compose.h + nr-convert2geom.h + nr-convex-hull-ops.h + nr-convex-hull.h + nr-coord.h + nr-dim2.h + nr-forward.h + nr-gradient.h + nr-i-coord.h + nr-macros.h + nr-matrix-div.h + nr-matrix-fns.h + nr-matrix-ops.h + nr-matrix-rotate-ops.h + nr-matrix-scale-ops.h + nr-matrix-test.h + nr-matrix-translate-ops.h + nr-matrix.h + nr-maybe.h + nr-object.h + nr-path-code.h + nr-pixblock-line.h + nr-pixblock-pattern.h + nr-pixblock-pixel.h + nr-pixblock.h + nr-pixops.h + # nr-point-fns-test.h + nr-point-fns.h + nr-point-l.h + nr-point-matrix-ops.h + nr-point-ops.h + nr-point.h + nr-rect-l.h + nr-rect-ops.h + nr-rect.h + nr-render.h + nr-rotate-fns-test.h + nr-rotate-fns.h + nr-rotate-matrix-ops.h + nr-rotate-ops.h + nr-rotate-test.h + nr-rotate.h + nr-scale-matrix-ops.h + nr-scale-ops.h + nr-scale-test.h + nr-scale-translate-ops.h + nr-scale.h + nr-translate-matrix-ops.h + nr-translate-ops.h + nr-translate-rotate-ops.h + nr-translate-scale-ops.h + # nr-translate-test.h + nr-translate.h + # nr-types-test.h + nr-types.h + nr-values.h ) -add_library(nr_LIB ${nr_SRC}) +add_inkscape_lib(nr_LIB "${nr_SRC}") diff --git a/src/libnrtype/CMakeLists.txt b/src/libnrtype/CMakeLists.txt index d5f9b846f..835665761 100644 --- a/src/libnrtype/CMakeLists.txt +++ b/src/libnrtype/CMakeLists.txt @@ -14,6 +14,27 @@ set(nrtype_SRC nr-type-primitives.cpp RasterFont.cpp TextWrapper.cpp + + FontFactory.h + Layout-TNG-Scanline-Maker.h + Layout-TNG.h + RasterFont.h + TextWrapper.h + boundary-type.h + font-glyph.h + font-instance.h + font-lister.h + font-style-to-pos.h + font-style.h + nr-type-pos-def.h + nr-type-primitives.h + nrtype-forward.h + one-box.h + one-glyph.h + one-para.h + raster-glyph.h + raster-position.h + text-boundary.h ) -add_library(nrtype_LIB ${nrtype_SRC}) +add_inkscape_lib(nrtype_LIB "${nrtype_SRC}") diff --git a/src/libvpsc/CMakeLists.txt b/src/libvpsc/CMakeLists.txt index ebc1e79d6..8db059b5d 100644 --- a/src/libvpsc/CMakeLists.txt +++ b/src/libvpsc/CMakeLists.txt @@ -9,6 +9,21 @@ set(libvpsc_SRC solve_VPSC.cpp variable.cpp pairingheap/PairingHeap.cpp + + + # ------- + # Headers + block.h + blocks.h + constraint.h + csolve_VPSC.h + generate-constraints.h + pairingheap/PairingHeap.h + pairingheap/dsexceptions.h + placement_SolveVPSC.h + remove_rectangle_overlap.h + solve_VPSC.h + variable.h ) -add_library(vpsc_LIB ${libvpsc_SRC}) +add_inkscape_lib(vpsc_LIB "${libvpsc_SRC}") diff --git a/src/livarot/CMakeLists.txt b/src/livarot/CMakeLists.txt index 51bb9530e..1890bd1a7 100644 --- a/src/livarot/CMakeLists.txt +++ b/src/livarot/CMakeLists.txt @@ -20,6 +20,22 @@ set(livarot_SRC sweep-event.cpp sweep-tree.cpp sweep-tree-list.cpp + + AVL.h + AlphaLigne.h + BitLigne.h + Livarot.h + LivarotDefs.h + Path.h + Shape.h + float-line.h + int-line.h + livarot-forward.h + path-description.h + sweep-event-queue.h + sweep-event.h + sweep-tree-list.h + sweep-tree.h ) -add_library(livarot_LIB ${livarot_SRC}) +add_inkscape_lib(livarot_LIB "${livarot_SRC}") diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index 148ea92f7..3bca16715 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -52,7 +52,64 @@ set(live_effects_SRC parameter/text.cpp parameter/unit.cpp parameter/vector.cpp + + # ------- + # Headers + bezctx.h + bezctx_intf.h + effect-enum.h + effect.h + lpe-angle_bisector.h + lpe-bendpath.h + lpe-boolops.h + lpe-circle_3pts.h + lpe-circle_with_radius.h + lpe-constructgrid.h + lpe-copy_rotate.h + lpe-curvestitch.h + lpe-dynastroke.h + lpe-envelope.h + lpe-extrude.h + lpe-gears.h + lpe-interpolate.h + lpe-knot.h + lpe-lattice.h + lpe-line_segment.h + lpe-mirror_symmetry.h + lpe-offset.h + lpe-parallel.h + lpe-path_length.h + lpe-patternalongpath.h + lpe-perp_bisector.h + lpe-perspective_path.h + lpe-powerstroke.h + lpe-recursiveskeleton.h + lpe-rough-hatches.h + lpe-ruler.h + lpe-skeleton.h + lpe-sketch.h + lpe-spiro.h + lpe-tangent_to_curve.h + lpe-test-doEffect-stack.h + lpe-text_label.h + lpe-vonkoch.h + lpegroupbbox.h + lpeobject-reference.h + lpeobject.h + parameter/array.h + parameter/bool.h + parameter/enum.h + parameter/parameter.h + parameter/path-reference.h + parameter/path.h + parameter/point.h + parameter/powerstrokepointarray.h + parameter/random.h + parameter/text.h + parameter/unit.h + parameter/vector.h + spiro.h ) -# add_library(live_effects_LIB ${live_effects_SRC}) +# add_inkscape_lib(live_effects_LIB "${live_effects_SRC}") add_inkscape_source("${live_effects_SRC}") diff --git a/src/pedro/CMakeLists.txt b/src/pedro/CMakeLists.txt index 7dce5b755..c51090067 100644 --- a/src/pedro/CMakeLists.txt +++ b/src/pedro/CMakeLists.txt @@ -10,5 +10,5 @@ set(pedro_SRC pedroxmpp.cpp ) -# add_library(pedro_LIB ${pedro_SRC}) +# add_inkscape_lib(pedro_LIB "${pedro_SRC}") add_inkscape_source("${pedro_SRC}") diff --git a/src/svg/CMakeLists.txt b/src/svg/CMakeLists.txt index 8c1f0058e..9a721969a 100644 --- a/src/svg/CMakeLists.txt +++ b/src/svg/CMakeLists.txt @@ -12,8 +12,25 @@ set(svg_SRC svg-color.cpp svg-length.cpp svg-path.cpp - #test-stubs.cpp + # test-stubs.cpp + + css-ostringstream-test.h + css-ostringstream.h + path-string.h + stringstream-test.h + stringstream.h + strip-trailing-zeros.h + svg-affine-test.h + svg-color-test.h + svg-color.h + svg-icc-color.h + svg-length-test.h + svg-length.h + svg-path-geom-test.h + svg.h + # test-stubs.h + ) -# add_library(svg_LIB ${svg_SRC}) +# add_inkscape_lib(svg_LIB "${svg_SRC}") add_inkscape_source("${svg_SRC}") diff --git a/src/trace/CMakeLists.txt b/src/trace/CMakeLists.txt index 3f712a314..958907df6 100644 --- a/src/trace/CMakeLists.txt +++ b/src/trace/CMakeLists.txt @@ -14,7 +14,30 @@ set(trace_SRC potrace/potracelib.cpp potrace/render.cpp potrace/trace.cpp + + + # ------- + # Headers + filterset.h + imagemap-gdk.h + imagemap.h + pool.h + quantize.h + siox.h + trace.h + + potrace/auxiliary.h + potrace/bitmap.h + potrace/curve.h + potrace/decompose.h + potrace/greymap.h + potrace/inkscape-potrace.h + potrace/lists.h + potrace/potracelib.h + potrace/progress.h + potrace/render.h + potrace/trace.h ) -# add_library(trace_LIB ${trace_SRC}) +# add_inkscape_lib(trace_LIB "${trace_SRC}") add_inkscape_source("${trace_SRC}") diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index bf9ddb4c8..30b72437f 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -109,6 +109,132 @@ set(ui_SRC view/view.cpp view/view-widget.cpp + + + # ------- + # Headers + clipboard.h + context-menu.h + icon-names.h + previewable.h + previewfillable.h + previewholder.h + uxmanager.h + + cache/svg_preview_cache.h + + dialog/aboutbox.h + dialog/align-and-distribute.h + dialog/behavior.h + dialog/calligraphic-profile-rename.h + dialog/color-item.h + dialog/debug.h + dialog/desktop-tracker.h + dialog/dialog-manager.h + dialog/dialog.h + dialog/dock-behavior.h + dialog/document-metadata.h + dialog/document-properties.h + dialog/extension-editor.h + dialog/extensions.h + dialog/filedialog.h + dialog/filedialogimpl-gtkmm.h + dialog/filedialogimpl-win32.h + dialog/fill-and-stroke.h + dialog/filter-effects-dialog.h + dialog/find.h + dialog/floating-behavior.h + dialog/glyphs.h + dialog/guides.h + dialog/icon-preview.h + dialog/inkscape-preferences.h + dialog/input.h + dialog/layer-properties.h + dialog/layers.h + dialog/livepatheffect-editor.h + dialog/memory.h + dialog/messages.h + dialog/ocaldialogs.h + dialog/panel-dialog.h + dialog/print-colors-preview-dialog.h + dialog/print.h + dialog/scriptdialog.h + dialog/session-player.h + dialog/svg-fonts-dialog.h + dialog/swatches.h + dialog/tile.h + dialog/tracedialog.h + dialog/transformation.h + dialog/undo-history.h + dialog/whiteboard-connect.h + dialog/whiteboard-sharewithchat.h + dialog/whiteboard-sharewithuser.h + + tool/commit-events.h + tool/control-point-selection.h + tool/control-point.h + tool/curve-drag-point.h + tool/event-utils.h + tool/manipulator.h + tool/modifier-tracker.h + tool/multi-path-manipulator.h + tool/node-tool.h + tool/node-types.h + tool/node.h + tool/path-manipulator.h + tool/selectable-control-point.h + tool/selector.h + tool/shape-record.h + tool/transform-handle-set.h + + view/edit-widget-interface.h + view/view-widget.h + view/view.h + + widget/attr-widget.h + widget/button.h + widget/color-picker.h + widget/color-preview.h + widget/combo-enums.h + widget/combo-text.h + widget/dock-item.h + widget/dock.h + widget/entity-entry.h + widget/entry.h + widget/filter-effect-chooser.h + widget/handlebox.h + widget/icon-widget.h + widget/imageicon.h + widget/imagetoggler.h + widget/labelled.h + widget/layer-selector.h + widget/licensor.h + widget/notebook-page.h + widget/object-composite-settings.h + widget/page-sizer.h + widget/panel.h + widget/point.h + widget/preferences-widget.h + widget/random.h + widget/registered-enums.h + widget/registered-widget.h + widget/registry.h + widget/rendering-options.h + widget/rotateable.h + widget/ruler.h + widget/scalar-unit.h + widget/scalar.h + widget/selected-style.h + widget/spin-slider.h + widget/spinbutton.h + widget/style-subject.h + widget/style-swatch.h + widget/svg-canvas.h + widget/text.h + widget/tolerance-slider.h + widget/toolbox.h + widget/unit-menu.h + widget/zoom-status.h ) if(WIN32) @@ -117,5 +243,5 @@ if(WIN32) ) endif() -# add_library(ui_LIB ${ui_SRC}) +# add_inkscape_lib(ui_LIB "${ui_SRC}") add_inkscape_source("${ui_SRC}") diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index ca90272ae..5c8411437 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -5,7 +5,37 @@ set(util_SRC expression-evaluator.cpp share.cpp units.cpp + + accumulators.h + compose.hpp + copy.h + ege-appear-time-tracker.h + ege-tags.h + enums.h + expression-evaluator.h + filter-list.h + find-if-before.h + find-last-if.h + fixed_point.h + format.h + forward-pointer-iterator.h + function.h + glib-list-iterators.h + list-container-test.h + list-container.h + list-copy.h + list.h + longest-common-suffix.h + map-list.h + mathfns.h + reference.h + reverse-list.h + share.h + tuple.h + ucompose.hpp + units.h + unordered-containers.h ) -# add_library(util_LIB ${util_SRC}) +# add_inkscape_lib(util_LIB "${util_SRC}") add_inkscape_source("${util_SRC}") diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 09d2d6303..d9e05f06a 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -34,7 +34,44 @@ set(widgets_SRC stroke-style.cpp swatch-selector.cpp toolbox.cpp + + button.h + dash-selector.h + desktop-widget.h + eek-preview.h + ege-paint-def.h + fill-n-stroke-factory.h + fill-style.h + font-selector.h + gradient-image.h + gradient-selector.h + gradient-toolbar.h + gradient-vector.h + icon.h + paint-selector.h + ruler.h + select-toolbar.h + shrink-wrap-button.h + sp-attribute-widget.h + sp-color-gtkselector.h + sp-color-icc-selector.h + sp-color-notebook.h + sp-color-preview.h + sp-color-scales.h + sp-color-selector.h + sp-color-slider.h + sp-color-wheel-selector.h + sp-widget.h + sp-xmlview-attr-list.h + sp-xmlview-content.h + sp-xmlview-tree.h + spinbutton-events.h + spw-utilities.h + stroke-style.h + swatch-selector.h + toolbox.h + widget-sizes.h ) -# add_library(widgets_LIB ${widgets_SRC}) +# add_inkscape_lib(widgets_LIB "${widgets_SRC}") add_inkscape_source("${widgets_SRC}") diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt index 3cca53fd8..d7a0e197d 100644 --- a/src/xml/CMakeLists.txt +++ b/src/xml/CMakeLists.txt @@ -16,7 +16,38 @@ set(xml_SRC subtree.cpp helper-observer.cpp rebase-hrefs.cpp + + attribute-record.h + comment-node.h + composite-node-observer.h + croco-node-iface.h + document.h + element-node.h + event-fns.h + event.h + helper-observer.h + invalid-operation-exception.h + log-builder.h + node-event-vector.h + node-fns.h + node-iterators.h + node-observer.h + node.h + pi-node.h + quote-test.h + quote.h + rebase-hrefs-test.h + rebase-hrefs.h + repr-action-test.h + repr-sorting.h + repr.h + simple-document.h + simple-node.h + sp-css-attr.h + subtree.h + text-node.h + xml-forward.h ) -# add_library(xml_LIB ${xml_SRC}) +# add_inkscape_lib(xml_LIB "${xml_SRC}") add_inkscape_source("${xml_SRC}") -- cgit v1.2.3 From c049136141351920600d1bbd1f330a46a04b1210 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 06:38:36 +0000 Subject: cmake: basic install target (bzr r10282) --- src/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 718c92b4b..3e7fe3a11 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -582,3 +582,50 @@ target_link_libraries(inkscape #add_executable(inkview inkview.cpp) # ... + +# ----------------------------------------------------------------------------- +# Installation +# ----------------------------------------------------------------------------- + +if(UNIX) + # TODO: man, locale, icons + + # message after building. + add_custom_command( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${CMAKE_INSTALL_PREFIX}' + ) + + install( + PROGRAMS inkscape + DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + ) + + install( + FILES ${CMAKE_SOURCE_DIR}/inkscape.desktop + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications + ) + + install( + DIRECTORY + ${CMAKE_SOURCE_DIR}/share/clipart + ${CMAKE_SOURCE_DIR}/share/examples + ${CMAKE_SOURCE_DIR}/share/extensions + ${CMAKE_SOURCE_DIR}/share/filters + ${CMAKE_SOURCE_DIR}/share/fonts + ${CMAKE_SOURCE_DIR}/share/gradients + ${CMAKE_SOURCE_DIR}/share/icons + ${CMAKE_SOURCE_DIR}/share/keys + ${CMAKE_SOURCE_DIR}/share/markers + ${CMAKE_SOURCE_DIR}/share/palettes + ${CMAKE_SOURCE_DIR}/share/patterns + ${CMAKE_SOURCE_DIR}/share/screens + ${CMAKE_SOURCE_DIR}/share/templates + ${CMAKE_SOURCE_DIR}/share/tutorials + ${CMAKE_SOURCE_DIR}/share/ui + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/inkscape + ) + +else() + # TODO, WIN32/APPLE +endif() -- cgit v1.2.3 From a1f1e29a8a207ea7ef4be583a050778cf2875217 Mon Sep 17 00:00:00 2001 From: Alex Valavanis <valavanisalex@gmail.com> Date: Mon, 13 Jun 2011 01:28:49 +0100 Subject: Replace deprecated GtkSignal (bzr r10282.1.1) --- src/connector-context.cpp | 8 +-- src/dialogs/clonetiler.cpp | 102 ++++++++++++++-------------- src/dialogs/export.cpp | 18 ++--- src/dialogs/find.cpp | 8 +-- src/dialogs/item-properties.cpp | 22 +++--- src/dialogs/spellcheck.cpp | 6 +- src/dialogs/text-edit.cpp | 6 +- src/dialogs/xml-tree.cpp | 38 +++++------ src/display/canvas-arena.cpp | 9 +-- src/display/sp-canvas.cpp | 2 +- src/helper/unit-menu.cpp | 4 +- src/knot.cpp | 4 +- src/ui/context-menu.cpp | 34 +++++----- src/ui/dialog/guides.cpp | 12 ++-- src/widgets/desktop-widget.cpp | 6 +- src/widgets/font-selector.cpp | 13 ++-- src/widgets/gradient-selector.cpp | 44 ++++++------ src/widgets/gradient-toolbar.cpp | 2 +- src/widgets/gradient-vector.cpp | 33 ++++----- src/widgets/paint-selector.cpp | 114 +++++++++++++++++--------------- src/widgets/select-toolbar.cpp | 8 +-- src/widgets/sp-color-icc-selector.cpp | 28 ++++---- src/widgets/sp-color-notebook.cpp | 16 ++--- src/widgets/sp-color-scales.cpp | 16 ++--- src/widgets/sp-color-selector.cpp | 52 ++++++++------- src/widgets/sp-color-slider.cpp | 66 +++++++++--------- src/widgets/sp-color-wheel-selector.cpp | 28 ++++---- src/widgets/sp-widget.cpp | 44 ++++++------ src/widgets/toolbox.cpp | 4 +- 29 files changed, 386 insertions(+), 361 deletions(-) (limited to 'src') diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 27e052499..251b41066 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -1640,8 +1640,8 @@ static void cc_active_shape_add_knot(SPDesktop* desktop, SPItem* item, Connectio knot->_event_handler_id); knot->_event_handler_id = 0; - gtk_signal_connect(GTK_OBJECT(knot->item), "event", - GTK_SIGNAL_FUNC(cc_generic_knot_handler), knot); + g_signal_connect(G_OBJECT(knot->item), "event", + G_CALLBACK(cc_generic_knot_handler), knot); sp_knot_set_position(knot, item->avoidRef->getConnectionPointPos(cp.type, cp.id) * desktop->doc2dt(), 0); sp_knot_show(knot); cphandles[knot] = cp; @@ -1826,8 +1826,8 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) knot->_event_handler_id); knot->_event_handler_id = 0; - gtk_signal_connect(GTK_OBJECT(knot->item), "event", - GTK_SIGNAL_FUNC(cc_generic_knot_handler), knot); + g_signal_connect(G_OBJECT(knot->item), "event", + G_CALLBACK(cc_generic_knot_handler), knot); cc->endpt_handle[i] = knot; } diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 2f78e4742..0cfa1d3c9 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -1529,8 +1529,8 @@ static GtkWidget * clonetiler_checkbox(const char *tip, const char *attr) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(b), value); gtk_box_pack_end (GTK_BOX (hb), b, FALSE, TRUE, 0); - gtk_signal_connect ( GTK_OBJECT (b), "clicked", - GTK_SIGNAL_FUNC (clonetiler_checkbox_toggled), (gpointer) attr); + g_signal_connect ( G_OBJECT (b), "clicked", + G_CALLBACK (clonetiler_checkbox_toggled), (gpointer) attr); g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE)); @@ -1570,8 +1570,8 @@ static GtkWidget * clonetiler_spinbox(const char *tip, const char *attr, double Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double value = prefs->getDoubleLimited(prefs_path + attr, exponent? 1.0 : 0.0, lower, upper); gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value); - gtk_signal_connect(GTK_OBJECT(a), "value_changed", - GTK_SIGNAL_FUNC(clonetiler_value_changed), (gpointer) attr); + g_signal_connect(G_OBJECT(a), "value_changed", + G_CALLBACK(clonetiler_value_changed), (gpointer) attr); if (exponent) { g_object_set_data (G_OBJECT(sb), "oneable", GINT_TO_POINTER(TRUE)); @@ -1824,10 +1824,10 @@ void clonetiler_dialog(void) wd.stop = 0; - gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg); + g_signal_connect ( G_OBJECT (dlg), "event", G_CALLBACK (sp_dialog_event_handler), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (clonetiler_dialog_destroy), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (clonetiler_dialog_delete), dlg); + g_signal_connect ( G_OBJECT (dlg), "destroy", G_CALLBACK (clonetiler_dialog_destroy), dlg); + g_signal_connect ( G_OBJECT (dlg), "delete_event", G_CALLBACK (clonetiler_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (clonetiler_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); @@ -1894,8 +1894,8 @@ void clonetiler_dialog(void) GtkWidget *item = gtk_menu_item_new (); gtk_container_add (GTK_CONTAINER (item), l); - gtk_signal_connect ( GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (clonetiler_symgroup_changed), + g_signal_connect ( G_OBJECT (item), "activate", + G_CALLBACK (clonetiler_symgroup_changed), GINT_TO_POINTER (sg.group) ); gtk_menu_append (GTK_MENU (m), item); @@ -2518,8 +2518,8 @@ void clonetiler_dialog(void) gtk_widget_set_tooltip_text (b, _("For each clone, pick a value from the drawing in that clone's location and apply it to the clone")); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(b), "toggled", - GTK_SIGNAL_FUNC(clonetiler_do_pick_toggled), dlg); + g_signal_connect(G_OBJECT(b), "toggled", + G_CALLBACK(clonetiler_do_pick_toggled), dlg); } { @@ -2543,64 +2543,64 @@ void clonetiler_dialog(void) radio = gtk_radio_button_new_with_label (NULL, _("Color")); gtk_widget_set_tooltip_text (radio, _("Pick the visible color and opacity")); clonetiler_table_attach (table, radio, 0.0, 1, 1); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_COLOR)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_COLOR)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Opacity")); gtk_widget_set_tooltip_text (radio, _("Pick the total accumulated opacity")); clonetiler_table_attach (table, radio, 0.0, 2, 1); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_OPACITY)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_OPACITY)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("R")); gtk_widget_set_tooltip_text (radio, _("Pick the Red component of the color")); clonetiler_table_attach (table, radio, 0.0, 1, 2); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_R)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_R)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_R); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("G")); gtk_widget_set_tooltip_text (radio, _("Pick the Green component of the color")); clonetiler_table_attach (table, radio, 0.0, 2, 2); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_G)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_G)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_G); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("B")); gtk_widget_set_tooltip_text (radio, _("Pick the Blue component of the color")); clonetiler_table_attach (table, radio, 0.0, 3, 2); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_B)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_B)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_B); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H")); gtk_widget_set_tooltip_text (radio, _("Pick the hue of the color")); clonetiler_table_attach (table, radio, 0.0, 1, 3); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_H)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_H)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_H); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S")); gtk_widget_set_tooltip_text (radio, _("Pick the saturation of the color")); clonetiler_table_attach (table, radio, 0.0, 2, 3); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_S)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_S)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_S); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L")); gtk_widget_set_tooltip_text (radio, _("Pick the lightness of the color")); clonetiler_table_attach (table, radio, 0.0, 3, 3); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", - GTK_SIGNAL_FUNC (clonetiler_pick_switched), GINT_TO_POINTER(PICK_L)); + g_signal_connect (G_OBJECT (radio), "toggled", + G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_L)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_L); } @@ -2664,8 +2664,8 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone is created with the probability determined by the picked value in that point")); clonetiler_table_attach (table, b, 0.0, 1, 1); - gtk_signal_connect(GTK_OBJECT(b), "toggled", - GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_presence"); + g_signal_connect(G_OBJECT(b), "toggled", + G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_presence"); } { @@ -2674,8 +2674,8 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone's size is determined by the picked value in that point")); clonetiler_table_attach (table, b, 0.0, 2, 1); - gtk_signal_connect(GTK_OBJECT(b), "toggled", - GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_size"); + g_signal_connect(G_OBJECT(b), "toggled", + G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_size"); } { @@ -2684,8 +2684,8 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)")); clonetiler_table_attach (table, b, 0.0, 1, 2); - gtk_signal_connect(GTK_OBJECT(b), "toggled", - GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_color"); + g_signal_connect(G_OBJECT(b), "toggled", + G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_color"); } { @@ -2694,8 +2694,8 @@ void clonetiler_dialog(void) gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone's opacity is determined by the picked value in that point")); clonetiler_table_attach (table, b, 0.0, 2, 2); - gtk_signal_connect(GTK_OBJECT(b), "toggled", - GTK_SIGNAL_FUNC(clonetiler_pick_to), (gpointer) "pick_to_opacity"); + g_signal_connect(G_OBJECT(b), "toggled", + G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_opacity"); } } gtk_widget_set_sensitive (vvb, prefs->getBool(prefs_path + "dotrace")); @@ -2723,8 +2723,8 @@ void clonetiler_dialog(void) gtk_entry_set_width_chars (GTK_ENTRY (sb), 5); gtk_box_pack_start (GTK_BOX (hb), sb, TRUE, TRUE, 0); - gtk_signal_connect(GTK_OBJECT(a), "value_changed", - GTK_SIGNAL_FUNC(clonetiler_xy_changed), (gpointer) "jmax"); + g_signal_connect(G_OBJECT(a), "value_changed", + G_CALLBACK(clonetiler_xy_changed), (gpointer) "jmax"); } { @@ -2743,8 +2743,8 @@ void clonetiler_dialog(void) gtk_entry_set_width_chars (GTK_ENTRY (sb), 5); gtk_box_pack_start (GTK_BOX (hb), sb, TRUE, TRUE, 0); - gtk_signal_connect(GTK_OBJECT(a), "value_changed", - GTK_SIGNAL_FUNC(clonetiler_xy_changed), (gpointer) "imax"); + g_signal_connect(G_OBJECT(a), "value_changed", + G_CALLBACK(clonetiler_xy_changed), (gpointer) "imax"); } clonetiler_table_attach (table, hb, 0.0, 1, 2); @@ -2772,8 +2772,8 @@ void clonetiler_dialog(void) gtk_widget_set_tooltip_text (e, _("Width of the rectangle to be filled")); gtk_entry_set_width_chars (GTK_ENTRY (e), 5); gtk_box_pack_start (GTK_BOX (hb), e, TRUE, TRUE, 0); - gtk_signal_connect(GTK_OBJECT(a), "value_changed", - GTK_SIGNAL_FUNC(clonetiler_fill_width_changed), u); + g_signal_connect(G_OBJECT(a), "value_changed", + G_CALLBACK(clonetiler_fill_width_changed), u); } { GtkWidget *l = gtk_label_new (""); @@ -2797,8 +2797,8 @@ void clonetiler_dialog(void) gtk_widget_set_tooltip_text (e, _("Height of the rectangle to be filled")); gtk_entry_set_width_chars (GTK_ENTRY (e), 5); gtk_box_pack_start (GTK_BOX (hb), e, TRUE, TRUE, 0); - gtk_signal_connect(GTK_OBJECT(a), "value_changed", - GTK_SIGNAL_FUNC(clonetiler_fill_height_changed), u); + g_signal_connect(G_OBJECT(a), "value_changed", + G_CALLBACK(clonetiler_fill_height_changed), u); } gtk_box_pack_start (GTK_BOX (hb), u, TRUE, TRUE, 0); @@ -2812,7 +2812,7 @@ void clonetiler_dialog(void) radio = gtk_radio_button_new_with_label (NULL, _("Rows, columns: ")); gtk_widget_set_tooltip_text (radio, _("Create the specified number of rows and columns")); clonetiler_table_attach (table, radio, 0.0, 1, 1); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_create), (gpointer) dlg); + g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_create), (gpointer) dlg); } if (!prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); @@ -2822,7 +2822,7 @@ void clonetiler_dialog(void) radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Width, height: ")); gtk_widget_set_tooltip_text (radio, _("Fill the specified width and height with the tiling")); clonetiler_table_attach (table, radio, 0.0, 2, 1); - gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_fill), (gpointer) dlg); + g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_fill), (gpointer) dlg); } if (prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); @@ -2842,8 +2842,8 @@ void clonetiler_dialog(void) gtk_widget_set_tooltip_text (b, _("Pretend that the size and position of the tile are the same as the last time you tiled it (if any), instead of using the current size")); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(b), "toggled", - GTK_SIGNAL_FUNC(clonetiler_keep_bbox_toggled), NULL); + g_signal_connect(G_OBJECT(b), "toggled", + G_CALLBACK(clonetiler_keep_bbox_toggled), NULL); } // Statusbar @@ -2866,7 +2866,7 @@ void clonetiler_dialog(void) gtk_label_set_markup_with_mnemonic (GTK_LABEL(l), _(" <b>_Create</b> ")); gtk_container_add (GTK_CONTAINER(b), l); gtk_widget_set_tooltip_text (b, _("Create and tile the clones of the selection")); - gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_apply), NULL); + g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_apply), NULL); gtk_box_pack_end (GTK_BOX (hb), b, FALSE, FALSE, 0); } @@ -2882,14 +2882,14 @@ void clonetiler_dialog(void) // So unclumping is the process of spreading a number of objects out more evenly. GtkWidget *b = gtk_button_new_with_mnemonic (_(" _Unclump ")); gtk_widget_set_tooltip_text (b, _("Spread out clones to reduce clumping; can be applied repeatedly")); - gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_unclump), NULL); + g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_unclump), NULL); gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0); } { GtkWidget *b = gtk_button_new_with_mnemonic (_(" Re_move ")); gtk_widget_set_tooltip_text (b, _("Remove existing tiled clones of the selected object (siblings only)")); - gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_remove), NULL); + g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_remove), NULL); gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0); } @@ -2907,7 +2907,7 @@ void clonetiler_dialog(void) GtkWidget *b = gtk_button_new_with_mnemonic (_(" R_eset ")); // TRANSLATORS: "change" is a noun here gtk_widget_set_tooltip_text (b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero")); - gtk_signal_connect (GTK_OBJECT (b), "clicked", GTK_SIGNAL_FUNC (clonetiler_reset), NULL); + g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_reset), NULL); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); } } diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 2f1299190..b076c0f96 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -262,7 +262,7 @@ sp_export_spinbutton_new ( gchar const *key, float val, float min, float max, } if (cb) - gtk_signal_connect (adj, "value_changed", cb, dlg); + g_signal_connect (adj, "value_changed", cb, dlg); return; } // end of sp_export_spinbutton_new() @@ -299,8 +299,8 @@ sp_export_dialog_area_box (GtkWidget * dlg) b->set_data("key", GINT_TO_POINTER(i)); gtk_object_set_data (GTK_OBJECT (dlg), selection_names[i], b->gobj()); togglebox->pack_start(*b, false, true, 0); - gtk_signal_connect ( GTK_OBJECT (b->gobj()), "clicked", - GTK_SIGNAL_FUNC (sp_export_area_toggled), dlg ); + g_signal_connect ( G_OBJECT (b->gobj()), "clicked", + G_CALLBACK (sp_export_area_toggled), dlg ); } g_signal_connect ( G_OBJECT (INKSCAPE), "change_selection", @@ -432,13 +432,13 @@ sp_export_dialog (void) g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd); - gtk_signal_connect ( GTK_OBJECT (dlg), "event", - GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg); + g_signal_connect ( G_OBJECT (dlg), "event", + G_CALLBACK (sp_dialog_event_handler), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", + g_signal_connect ( G_OBJECT (dlg), "destroy", G_CALLBACK (sp_export_dialog_destroy), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", + g_signal_connect ( G_OBJECT (dlg), "delete_event", G_CALLBACK (sp_export_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", @@ -657,8 +657,8 @@ sp_export_dialog (void) b->add(*image_label); gtk_widget_set_tooltip_text (GTK_WIDGET(b->gobj()), _("Export the bitmap file with these settings")); - gtk_signal_connect ( GTK_OBJECT (b->gobj()), "clicked", - GTK_SIGNAL_FUNC (sp_export_export_clicked), dlg ); + g_signal_connect ( G_OBJECT (b->gobj()), "clicked", + G_CALLBACK (sp_export_export_clicked), dlg ); bb->pack_end(*b, false, false, 0); } diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index d07772406..62c551523 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -497,7 +497,7 @@ sp_find_types_checkbox (GtkWidget *w, const gchar *data, gboolean active, gtk_object_set_data (GTK_OBJECT (w), data, b); gtk_widget_set_tooltip_text (b, tip); if (toggled) - gtk_signal_connect (GTK_OBJECT (b), "toggled", GTK_SIGNAL_FUNC (toggled), w); + g_signal_connect (G_OBJECT (b), "toggled", G_CALLBACK (toggled), w); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); } @@ -676,10 +676,10 @@ sp_find_dialog_old (void) wd.stop = 0; g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd ); - gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg); + g_signal_connect ( G_OBJECT (dlg), "event", G_CALLBACK (sp_dialog_event_handler), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (sp_find_dialog_destroy), NULL ); - gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (sp_find_dialog_delete), dlg); + g_signal_connect ( G_OBJECT (dlg), "destroy", G_CALLBACK (sp_find_dialog_destroy), NULL ); + g_signal_connect ( G_OBJECT (dlg), "delete_event", G_CALLBACK (sp_find_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (sp_find_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index cd0cea9b5..cd56c2da4 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -91,11 +91,11 @@ sp_item_widget_new (void) /* Create container widget */ spw = sp_widget_new_global (INKSCAPE); - gtk_signal_connect ( GTK_OBJECT (spw), "modify_selection", - GTK_SIGNAL_FUNC (sp_item_widget_modify_selection), + g_signal_connect ( G_OBJECT (spw), "modify_selection", + G_CALLBACK (sp_item_widget_modify_selection), spw ); - gtk_signal_connect ( GTK_OBJECT (spw), "change_selection", - GTK_SIGNAL_FUNC (sp_item_widget_change_selection), + g_signal_connect ( G_OBJECT (spw), "change_selection", + G_CALLBACK (sp_item_widget_change_selection), spw ); vb = gtk_vbox_new (FALSE, 0); @@ -136,8 +136,8 @@ sp_item_widget_new (void) gtk_table_attach ( GTK_TABLE (t), pb, 2, 3, 0, 1, (GtkAttachOptions)( GTK_SHRINK | GTK_FILL ), (GtkAttachOptions)0, 0, 0 ); - gtk_signal_connect ( GTK_OBJECT (pb), "clicked", - GTK_SIGNAL_FUNC (sp_item_widget_label_changed), + g_signal_connect ( G_OBJECT (pb), "clicked", + G_CALLBACK (sp_item_widget_label_changed), spw ); /* Create the label for the object label */ @@ -226,8 +226,8 @@ sp_item_widget_new (void) gtk_table_attach ( GTK_TABLE (t), cb, 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions)0, 0, 0 ); - gtk_signal_connect ( GTK_OBJECT (cb), "toggled", - GTK_SIGNAL_FUNC (sp_item_widget_sensitivity_toggled), + g_signal_connect ( G_OBJECT (cb), "toggled", + G_CALLBACK (sp_item_widget_sensitivity_toggled), spw ); gtk_object_set_data (GTK_OBJECT (spw), "sensitive", cb); @@ -525,9 +525,9 @@ sp_item_dialog (void) wd.stop = 0; g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd); - gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (sp_item_dialog_destroy), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (sp_item_dialog_delete), dlg); + g_signal_connect ( G_OBJECT (dlg), "event", G_CALLBACK (sp_dialog_event_handler), dlg); + g_signal_connect ( G_OBJECT (dlg), "destroy", G_CALLBACK (sp_item_dialog_destroy), dlg); + g_signal_connect ( G_OBJECT (dlg), "delete_event", G_CALLBACK (sp_item_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (sp_item_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 47de25061..1d475a5c3 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -917,10 +917,10 @@ sp_spellcheck_dialog (void) g_signal_connect( G_OBJECT(INKSCAPE), "deactivate_desktop", G_CALLBACK( spellcheck_desktop_deactivated ), NULL); - gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg); + g_signal_connect ( G_OBJECT (dlg), "event", G_CALLBACK (sp_dialog_event_handler), dlg); - gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (sp_spellcheck_dialog_destroy), NULL ); - gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (sp_spellcheck_dialog_delete), dlg); + g_signal_connect ( G_OBJECT (dlg), "destroy", G_CALLBACK (sp_spellcheck_dialog_destroy), NULL ); + g_signal_connect ( G_OBJECT (dlg), "delete_event", G_CALLBACK (sp_spellcheck_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (sp_spellcheck_dialog_delete), dlg); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg); diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index 0533a2a35..2e49cae8f 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -177,10 +177,10 @@ sp_text_edit_dialog (void) wd.stop = 0; g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd ); - gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg ); + g_signal_connect ( G_OBJECT (dlg), "event", G_CALLBACK (sp_dialog_event_handler), dlg ); - gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (sp_text_edit_dialog_destroy), dlg ); - gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (sp_text_edit_dialog_delete), dlg ); + g_signal_connect ( G_OBJECT (dlg), "destroy", G_CALLBACK (sp_text_edit_dialog_destroy), dlg ); + g_signal_connect ( G_OBJECT (dlg), "delete_event", G_CALLBACK (sp_text_edit_dialog_delete), dlg ); g_signal_connect ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (sp_text_edit_dialog_delete), dlg ); g_signal_connect ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg ); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index 78e7d3dcf..c50c07e80 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -221,10 +221,10 @@ void sp_xml_tree_dialog() wd.stop = 0; g_signal_connect ( G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(sp_transientize_callback), &wd ); - gtk_signal_connect( GTK_OBJECT(dlg), "event", GTK_SIGNAL_FUNC(sp_dialog_event_handler), dlg ); + g_signal_connect( G_OBJECT(dlg), "event", G_CALLBACK(sp_dialog_event_handler), dlg ); - gtk_signal_connect( GTK_OBJECT(dlg), "destroy", G_CALLBACK(on_destroy), dlg); - gtk_signal_connect( GTK_OBJECT(dlg), "delete_event", G_CALLBACK(on_delete), dlg); + g_signal_connect( G_OBJECT(dlg), "destroy", G_CALLBACK(on_destroy), dlg); + g_signal_connect( G_OBJECT(dlg), "delete_event", G_CALLBACK(on_delete), dlg); g_signal_connect ( G_OBJECT(INKSCAPE), "shut_down", G_CALLBACK(on_delete), dlg); g_signal_connect ( G_OBJECT(INKSCAPE), "dialogs_hide", G_CALLBACK(sp_dialog_hide), dlg); @@ -495,15 +495,15 @@ void sp_xml_tree_dialog() // TRANSLATORS: "Attribute" is a noun here _("Attribute name") ); - gtk_signal_connect( GTK_OBJECT(attributes), "select_row", + g_signal_connect( G_OBJECT(attributes), "select_row", (GCallback) on_attr_select_row_set_name_content, attr_name); - gtk_signal_connect( GTK_OBJECT(attributes), "unselect_row", + g_signal_connect( G_OBJECT(attributes), "unselect_row", (GCallback) on_attr_unselect_row_clear_text, attr_name); - gtk_signal_connect( GTK_OBJECT(tree), "tree_unselect_row", + g_signal_connect( G_OBJECT(tree), "tree_unselect_row", (GCallback) on_tree_unselect_row_clear_text, attr_name); @@ -518,9 +518,9 @@ void sp_xml_tree_dialog() GtkWidget *set_label = gtk_label_new(_("Set")); gtk_container_add(GTK_CONTAINER(set_attr), set_label); - gtk_signal_connect( GTK_OBJECT(set_attr), "clicked", + g_signal_connect( G_OBJECT(set_attr), "clicked", (GCallback) cmd_set_attr, NULL); - gtk_signal_connect( GTK_OBJECT(attr_name), "changed", + g_signal_connect( G_OBJECT(attr_name), "changed", (GCallback) on_editable_changed_enable_if_valid_xml_name, set_attr ); gtk_widget_set_sensitive(GTK_WIDGET(set_attr), FALSE); @@ -539,13 +539,13 @@ void sp_xml_tree_dialog() gtk_widget_set_tooltip_text( GTK_WIDGET(attr_value), // TRANSLATORS: "Attribute" is a noun here _("Attribute value") ); - gtk_signal_connect( GTK_OBJECT(attributes), "select_row", + g_signal_connect( G_OBJECT(attributes), "select_row", (GCallback) on_attr_select_row_set_value_content, attr_value ); - gtk_signal_connect( GTK_OBJECT(attributes), "unselect_row", + g_signal_connect( G_OBJECT(attributes), "unselect_row", (GCallback) on_attr_unselect_row_clear_text, attr_value ); - gtk_signal_connect( GTK_OBJECT(tree), "tree_unselect_row", + g_signal_connect( G_OBJECT(tree), "tree_unselect_row", (GCallback) on_tree_unselect_row_clear_text, attr_value ); gtk_text_view_set_editable(attr_value, TRUE); @@ -1321,8 +1321,8 @@ void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/) gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(dlg)); gtk_window_set_modal(GTK_WINDOW(window), TRUE); - gtk_signal_connect(GTK_OBJECT(window), "destroy", gtk_main_quit, NULL); - gtk_signal_connect(GTK_OBJECT(window), "key-press-event", G_CALLBACK(quit_on_esc), window); + g_signal_connect(G_OBJECT(window), "destroy", gtk_main_quit, NULL); + g_signal_connect(G_OBJECT(window), "key-press-event", G_CALLBACK(quit_on_esc), window); vbox = gtk_vbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(window), vbox); @@ -1340,21 +1340,21 @@ void cmd_new_element_node(GtkObject */*object*/, gpointer /*data*/) cancel = gtk_button_new_with_label(_("Cancel")); gtk_widget_set_can_default( GTK_WIDGET(cancel), TRUE ); - gtk_signal_connect_object( GTK_OBJECT(cancel), "clicked", + g_signal_connect_swapped( G_OBJECT(cancel), "clicked", G_CALLBACK(gtk_widget_destroy), - GTK_OBJECT(window) ); + G_OBJECT(window) ); gtk_container_add(GTK_CONTAINER(bbox), cancel); create = gtk_button_new_with_label(_("Create")); gtk_widget_set_sensitive(GTK_WIDGET(create), FALSE); - gtk_signal_connect( GTK_OBJECT(entry), "changed", + g_signal_connect( G_OBJECT(entry), "changed", G_CALLBACK(on_editable_changed_enable_if_valid_xml_name), create ); - gtk_signal_connect( GTK_OBJECT(create), "clicked", + g_signal_connect( G_OBJECT(create), "clicked", G_CALLBACK(on_clicked_get_editable_text), &name ); - gtk_signal_connect_object( GTK_OBJECT(create), "clicked", + g_signal_connect_swapped( G_OBJECT(create), "clicked", G_CALLBACK(gtk_widget_destroy), - GTK_OBJECT(window) ); + G_OBJECT(window) ); gtk_widget_set_can_default( GTK_WIDGET(create), TRUE ); gtk_widget_set_receives_default( GTK_WIDGET(create), TRUE ); gtk_container_add(GTK_CONTAINER(bbox), create); diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index 5975db9cc..8436a3b99 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -77,10 +77,11 @@ sp_canvas_arena_class_init (SPCanvasArenaClass *klass) parent_class = (SPCanvasItemClass*)gtk_type_class (SP_TYPE_CANVAS_ITEM); - signals[ARENA_EVENT] = gtk_signal_new ("arena_event", - GTK_RUN_LAST, - GTK_CLASS_TYPE(object_class), + signals[ARENA_EVENT] = g_signal_new ("arena_event", + G_TYPE_FROM_CLASS(object_class), + G_SIGNAL_RUN_LAST, ((glong)((guint8*)&(klass->arena_event) - (guint8*)klass)), + NULL, NULL, sp_marshal_INT__POINTER_POINTER, GTK_TYPE_INT, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER); @@ -329,7 +330,7 @@ sp_canvas_arena_send_event (SPCanvasArena *arena, GdkEvent *event) gint ret = FALSE; /* Send event to arena */ - gtk_signal_emit (GTK_OBJECT (arena), signals[ARENA_EVENT], arena->active, event, &ret); + g_signal_emit (G_OBJECT (arena), signals[ARENA_EVENT], 0, arena->active, event, &ret); return ret; } diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index ad2a45eea..20c21a8c3 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1360,7 +1360,7 @@ emit_event (SPCanvas *canvas, GdkEvent *event) while (item && !finished) { gtk_object_ref (GTK_OBJECT (item)); - gtk_signal_emit (GTK_OBJECT (item), item_signals[ITEM_EVENT], &ev, &finished); + g_signal_emit (G_OBJECT (item), item_signals[ITEM_EVENT], 0, &ev, &finished); SPCanvasItem *parent = item->parent; gtk_object_unref (GTK_OBJECT (item)); item = parent; diff --git a/src/helper/unit-menu.cpp b/src/helper/unit-menu.cpp index 5494aaaeb..bcc8589e2 100644 --- a/src/helper/unit-menu.cpp +++ b/src/helper/unit-menu.cpp @@ -205,7 +205,7 @@ spus_unit_activate(GtkWidget *widget, SPUnitSelector *us) /* when the base changes, signal all the adjustments to get them * to recalculate */ for (GSList *l = us->adjustments; l != NULL; l = g_slist_next(l)) { - gtk_signal_emit_by_name(GTK_OBJECT(l->data), "value_changed"); + g_signal_emit_by_name(G_OBJECT(l->data), "value_changed"); } } @@ -233,7 +233,7 @@ spus_rebuild_menu(SPUnitSelector *us) GtkWidget *i = gtk_menu_item_new_with_label( u->abbr ); gtk_object_set_data(GTK_OBJECT(i), "unit", (gpointer) u); - gtk_signal_connect(GTK_OBJECT(i), "activate", GTK_SIGNAL_FUNC(spus_unit_activate), us); + g_signal_connect(G_OBJECT(i), "activate", G_CALLBACK(spus_unit_activate), us); sp_set_font_size_smaller (i); diff --git a/src/knot.cpp b/src/knot.cpp index 28c991fde..638b31007 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -489,8 +489,8 @@ SPKnot *sp_knot_new(SPDesktop *desktop, const gchar *tip) "mode", SP_KNOT_MODE_XOR, NULL); - knot->_event_handler_id = gtk_signal_connect(GTK_OBJECT(knot->item), "event", - GTK_SIGNAL_FUNC(sp_knot_handler), knot); + knot->_event_handler_id = g_signal_connect(G_OBJECT(knot->item), "event", + G_CALLBACK(sp_knot_handler), knot); return knot; } diff --git a/src/ui/context-menu.cpp b/src/ui/context-menu.cpp index 72e5ee63b..a45b8ceaa 100644 --- a/src/ui/context-menu.cpp +++ b/src/ui/context-menu.cpp @@ -111,7 +111,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Item dialog */ w = gtk_menu_item_new_with_mnemonic(_("_Object Properties...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_item_properties), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_item_properties), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Separator */ @@ -124,21 +124,21 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) gtk_widget_set_sensitive(w, FALSE); } else { gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_item_select_this), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_item_select_this), item); } gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Create link */ w = gtk_menu_item_new_with_mnemonic(_("_Create Link")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_item_create_link), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_item_create_link), item); gtk_widget_set_sensitive(w, !SP_IS_ANCHOR(item)); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Set mask */ w = gtk_menu_item_new_with_mnemonic(_("Set Mask")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_set_mask), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_set_mask), item); if ((item && item->mask_ref && item->mask_ref->getObject()) || (item->clip_ref && item->clip_ref->getObject())) { gtk_widget_set_sensitive(w, FALSE); } else { @@ -149,7 +149,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Release mask */ w = gtk_menu_item_new_with_mnemonic(_("Release Mask")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_release_mask), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_release_mask), item); if (item && item->mask_ref && item->mask_ref->getObject()) { gtk_widget_set_sensitive(w, TRUE); } else { @@ -160,7 +160,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Set Clip */ w = gtk_menu_item_new_with_mnemonic(_("Set _Clip")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_set_clip), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_set_clip), item); if ((item && item->mask_ref && item->mask_ref->getObject()) || (item->clip_ref && item->clip_ref->getObject())) { gtk_widget_set_sensitive(w, FALSE); } else { @@ -171,7 +171,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Release Clip */ w = gtk_menu_item_new_with_mnemonic(_("Release C_lip")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_release_clip), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_release_clip), item); if (item && item->clip_ref && item->clip_ref->getObject()) { gtk_widget_set_sensitive(w, TRUE); } else { @@ -312,7 +312,7 @@ sp_group_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu) /* "Ungroup" */ w = gtk_menu_item_new_with_mnemonic(_("_Ungroup")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_item_group_ungroup_activate), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_item_group_ungroup_activate), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(menu), w); } @@ -352,18 +352,18 @@ sp_anchor_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Link dialog */ w = gtk_menu_item_new_with_mnemonic(_("Link _Properties...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_properties), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_anchor_link_properties), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Select item */ w = gtk_menu_item_new_with_mnemonic(_("_Follow Link")); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_follow), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_anchor_link_follow), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Reset transformations */ w = gtk_menu_item_new_with_mnemonic(_("_Remove Link")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_remove), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_anchor_link_remove), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); } @@ -411,13 +411,13 @@ sp_image_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Link dialog */ w = gtk_menu_item_new_with_mnemonic(_("Image _Properties...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_image_image_properties), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_image_image_properties), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); w = gtk_menu_item_new_with_mnemonic(_("Edit Externally...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_image_image_edit), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_image_image_edit), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); Inkscape::XML::Node *ir = object->getRepr(); @@ -534,7 +534,7 @@ sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Item dialog */ w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_fill_settings), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_fill_settings), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); } @@ -590,21 +590,21 @@ sp_text_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m) /* Fill and Stroke dialog */ w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_fill_settings), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_fill_settings), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Edit Text dialog */ w = gtk_menu_item_new_with_mnemonic(_("_Text and Font...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_text_settings), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_text_settings), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); /* Spellcheck dialog */ w = gtk_menu_item_new_with_mnemonic(_("Check Spellin_g...")); gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop); - gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_spellcheck_settings), item); + g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(sp_spellcheck_settings), item); gtk_widget_show(w); gtk_menu_append(GTK_MENU(m), w); } diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 12aeddecc..da517ba1a 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -215,12 +215,12 @@ void GuidelinePropertiesDialog::_setup() { _relative_toggle.set_active(_relative_toggle_status); // don't know what this exactly does, but it results in that the dialog closes when entering a value and pressing enter (see LP bug 484187) - gtk_signal_connect_object(GTK_OBJECT(_spin_button_x.getWidget()->gobj()), "activate", - GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); - gtk_signal_connect_object(GTK_OBJECT(_spin_button_y.getWidget()->gobj()), "activate", - GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); - gtk_signal_connect_object(GTK_OBJECT(_spin_angle.getWidget()->gobj()), "activate", - GTK_SIGNAL_FUNC(gtk_window_activate_default), gobj()); + g_signal_connect_swapped(G_OBJECT(_spin_button_x.getWidget()->gobj()), "activate", + G_CALLBACK(gtk_window_activate_default), gobj()); + g_signal_connect_swapped(G_OBJECT(_spin_button_y.getWidget()->gobj()), "activate", + G_CALLBACK(gtk_window_activate_default), gobj()); + g_signal_connect_swapped(G_OBJECT(_spin_angle.getWidget()->gobj()), "activate", + G_CALLBACK(gtk_window_activate_default), gobj()); // dialog diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index d5ec5deff..69b27d6e4 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -498,8 +498,8 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) g_signal_connect (G_OBJECT (dtw->zoom_status), "input", G_CALLBACK (sp_dtw_zoom_input), dtw); g_signal_connect (G_OBJECT (dtw->zoom_status), "output", G_CALLBACK (sp_dtw_zoom_output), dtw); gtk_object_set_data (GTK_OBJECT (dtw->zoom_status), "dtw", dtw->canvas); - gtk_signal_connect (GTK_OBJECT (dtw->zoom_status), "focus-in-event", GTK_SIGNAL_FUNC (spinbutton_focus_in), dtw->zoom_status); - gtk_signal_connect (GTK_OBJECT (dtw->zoom_status), "key-press-event", GTK_SIGNAL_FUNC (spinbutton_keypress), dtw->zoom_status); + g_signal_connect (G_OBJECT (dtw->zoom_status), "focus-in-event", G_CALLBACK (spinbutton_focus_in), dtw->zoom_status); + g_signal_connect (G_OBJECT (dtw->zoom_status), "key-press-event", G_CALLBACK (spinbutton_keypress), dtw->zoom_status); dtw->zoom_update = g_signal_connect (G_OBJECT (dtw->zoom_status), "value_changed", G_CALLBACK (sp_dtw_zoom_value_changed), dtw); dtw->zoom_update = g_signal_connect (G_OBJECT (dtw->zoom_status), "populate_popup", G_CALLBACK (sp_dtw_zoom_populate_popup), dtw); @@ -599,7 +599,7 @@ sp_desktop_widget_destroy (GtkObject *object) } g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK(sp_dtw_zoom_input), dtw); g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK(sp_dtw_zoom_output), dtw); - gtk_signal_disconnect_by_data (GTK_OBJECT (dtw->zoom_status), dtw->zoom_status); + g_signal_handlers_disconnect_matched (G_OBJECT (dtw->zoom_status), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, dtw->zoom_status); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK (sp_dtw_zoom_value_changed), dtw); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK (sp_dtw_zoom_populate_popup), dtw); g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->canvas), (gpointer) G_CALLBACK (sp_desktop_widget_event), dtw); diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index efeaa980c..f493c393a 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -130,12 +130,13 @@ static void sp_font_selector_class_init(SPFontSelectorClass *c) fs_parent_class = (GtkHBoxClass* )gtk_type_class(GTK_TYPE_HBOX); - fs_signals[FONT_SET] = gtk_signal_new ("font_set", - GTK_RUN_FIRST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPFontSelectorClass, font_set), + fs_signals[FONT_SET] = g_signal_new ("font_set", + G_TYPE_FROM_CLASS(object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SPFontSelectorClass, font_set), + NULL, NULL, gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, + G_TYPE_NONE, 1, GTK_TYPE_POINTER); object_class->destroy = sp_font_selector_destroy; @@ -388,7 +389,7 @@ static void sp_font_selector_emit_set (SPFontSelector *fsel) fsel->font->Unref(); } fsel->font = font; - gtk_signal_emit(GTK_OBJECT(fsel), fs_signals[FONT_SET], fsel->font); + g_signal_emit(G_OBJECT(fsel), fs_signals[FONT_SET], 0, fsel->font); } fsel->fontsize_dirty = false; if (font) { diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index 3f07e09c8..a3110ed5b 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -85,30 +85,34 @@ sp_gradient_selector_class_init (SPGradientSelectorClass *klass) parent_class = (GtkVBoxClass*)gtk_type_class (GTK_TYPE_VBOX); - signals[GRABBED] = gtk_signal_new ("grabbed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPGradientSelectorClass, grabbed), + signals[GRABBED] = g_signal_new ("grabbed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPGradientSelectorClass, grabbed), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - signals[DRAGGED] = gtk_signal_new ("dragged", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPGradientSelectorClass, dragged), + G_TYPE_NONE, 0); + signals[DRAGGED] = g_signal_new ("dragged", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPGradientSelectorClass, dragged), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - signals[RELEASED] = gtk_signal_new ("released", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPGradientSelectorClass, released), + G_TYPE_NONE, 0); + signals[RELEASED] = g_signal_new ("released", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPGradientSelectorClass, released), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - signals[CHANGED] = gtk_signal_new ("changed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPGradientSelectorClass, changed), + G_TYPE_NONE, 0); + signals[CHANGED] = g_signal_new ("changed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPGradientSelectorClass, changed), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + G_TYPE_NONE, 0); object_class->destroy = sp_gradient_selector_destroy; } diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index 10e1fb95a..9186044de 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -485,7 +485,7 @@ GtkWidget * gr_change_widget(SPDesktop *desktop) gtk_widget_set_tooltip_text(b, _("Edit the stops of the gradient")); gtk_widget_show(b); gtk_container_add(GTK_CONTAINER(hb), b); - gtk_signal_connect(GTK_OBJECT(b), "clicked", GTK_SIGNAL_FUNC(gr_edit), widget); + g_signal_connect(G_OBJECT(b), "clicked", G_CALLBACK(gr_edit), widget); gtk_box_pack_start (GTK_BOX(buttons), hb, FALSE, FALSE, 0); } diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 9aa414ab6..bc29bc974 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -104,13 +104,14 @@ static void sp_gradient_vector_selector_class_init(SPGradientVectorSelectorClass parent_class = static_cast<GtkVBoxClass*>(gtk_type_class(GTK_TYPE_VBOX)); - signals[VECTOR_SET] = gtk_signal_new( "vector_set", - GTK_RUN_LAST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPGradientVectorSelectorClass, vector_set), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); + signals[VECTOR_SET] = g_signal_new( "vector_set", + G_TYPE_FROM_CLASS(object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(SPGradientVectorSelectorClass, vector_set), + NULL, NULL, + gtk_marshal_NONE__POINTER, + G_TYPE_NONE, 1, + GTK_TYPE_POINTER); object_class->destroy = sp_gradient_vector_selector_destroy; } @@ -793,7 +794,7 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s GtkWidget *mnu = gtk_option_menu_new(); /* Create new menu widget */ update_stop_list(GTK_WIDGET(mnu), gradient, NULL); - gtk_signal_connect(GTK_OBJECT(mnu), "changed", GTK_SIGNAL_FUNC(sp_grad_edit_select), vb); + g_signal_connect(G_OBJECT(mnu), "changed", G_CALLBACK(sp_grad_edit_select), vb); gtk_widget_show(mnu); gtk_object_set_data(GTK_OBJECT(vb), "stopmenu", mnu); gtk_box_pack_start(GTK_BOX(vb), mnu, FALSE, FALSE, 0); @@ -805,12 +806,12 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s gtk_widget_show(b); gtk_container_add(GTK_CONTAINER(hb), b); gtk_widget_set_tooltip_text(b, _("Add another control stop to gradient")); - gtk_signal_connect(GTK_OBJECT(b), "clicked", GTK_SIGNAL_FUNC(sp_grd_ed_add_stop), vb); + g_signal_connect(G_OBJECT(b), "clicked", G_CALLBACK(sp_grd_ed_add_stop), vb); b = gtk_button_new_with_label(_("Delete stop")); gtk_widget_show(b); gtk_container_add(GTK_CONTAINER(hb), b); gtk_widget_set_tooltip_text(b, _("Delete current control stop from gradient")); - gtk_signal_connect(GTK_OBJECT(b), "clicked", GTK_SIGNAL_FUNC(sp_grd_ed_del_stop), vb); + g_signal_connect(G_OBJECT(b), "clicked", G_CALLBACK(sp_grd_ed_del_stop), vb); gtk_widget_show(hb); gtk_box_pack_start(GTK_BOX(vb),hb, FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS); @@ -857,10 +858,10 @@ static GtkWidget * sp_gradient_vector_widget_new(SPGradient *gradient, SPStop *s /* Signals */ - gtk_signal_connect(GTK_OBJECT(Offset_adj), "value_changed", - GTK_SIGNAL_FUNC(offadjustmentChanged), vb); + g_signal_connect(G_OBJECT(Offset_adj), "value_changed", + G_CALLBACK(offadjustmentChanged), vb); - // gtk_signal_connect(GTK_OBJECT(slider), "changed", GTK_SIGNAL_FUNC(offsliderChanged), vb); + // g_signal_connect(G_OBJECT(slider), "changed", G_CALLBACK(offsliderChanged), vb); gtk_widget_show(hb); gtk_box_pack_start(GTK_BOX(vb), hb, FALSE, FALSE, PAD); @@ -924,9 +925,9 @@ GtkWidget * sp_gradient_vector_editor_new(SPGradient *gradient, SPStop *stop) wd.win = dlg; wd.stop = 0; g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(sp_transientize_callback), &wd); - gtk_signal_connect(GTK_OBJECT(dlg), "event", GTK_SIGNAL_FUNC(sp_dialog_event_handler), dlg); - gtk_signal_connect(GTK_OBJECT(dlg), "destroy", G_CALLBACK(sp_gradient_vector_dialog_destroy), dlg); - gtk_signal_connect(GTK_OBJECT(dlg), "delete_event", G_CALLBACK(sp_gradient_vector_dialog_delete), dlg); + g_signal_connect(G_OBJECT(dlg), "event", G_CALLBACK(sp_dialog_event_handler), dlg); + g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(sp_gradient_vector_dialog_destroy), dlg); + g_signal_connect(G_OBJECT(dlg), "delete_event", G_CALLBACK(sp_gradient_vector_dialog_delete), dlg); g_signal_connect(G_OBJECT(INKSCAPE), "shut_down", G_CALLBACK(sp_gradient_vector_dialog_delete), dlg); g_signal_connect( G_OBJECT(INKSCAPE), "dialogs_hide", G_CALLBACK(sp_dialog_hide), dlg ); g_signal_connect( G_OBJECT(INKSCAPE), "dialogs_unhide", G_CALLBACK(sp_dialog_unhide), dlg ); diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 631675ede..642837e61 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -164,42 +164,48 @@ sp_paint_selector_class_init(SPPaintSelectorClass *klass) parent_class = (GtkVBoxClass*)gtk_type_class(GTK_TYPE_VBOX); - psel_signals[MODE_CHANGED] = gtk_signal_new("mode_changed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPPaintSelectorClass, mode_changed), + psel_signals[MODE_CHANGED] = g_signal_new("mode_changed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPPaintSelectorClass, mode_changed), + NULL, NULL, gtk_marshal_NONE__UINT, - GTK_TYPE_NONE, 1, GTK_TYPE_UINT); - psel_signals[GRABBED] = gtk_signal_new("grabbed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPPaintSelectorClass, grabbed), + G_TYPE_NONE, 1, GTK_TYPE_UINT); + psel_signals[GRABBED] = g_signal_new("grabbed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPPaintSelectorClass, grabbed), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - psel_signals[DRAGGED] = gtk_signal_new("dragged", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPPaintSelectorClass, dragged), + G_TYPE_NONE, 0); + psel_signals[DRAGGED] = g_signal_new("dragged", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPPaintSelectorClass, dragged), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - psel_signals[RELEASED] = gtk_signal_new("released", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPPaintSelectorClass, released), + G_TYPE_NONE, 0); + psel_signals[RELEASED] = g_signal_new("released", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPPaintSelectorClass, released), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - psel_signals[CHANGED] = gtk_signal_new("changed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPPaintSelectorClass, changed), + G_TYPE_NONE, 0); + psel_signals[CHANGED] = g_signal_new("changed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPPaintSelectorClass, changed), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - psel_signals[FILLRULE_CHANGED] = gtk_signal_new("fillrule_changed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPPaintSelectorClass, fillrule_changed), + G_TYPE_NONE, 0); + psel_signals[FILLRULE_CHANGED] = g_signal_new("fillrule_changed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPPaintSelectorClass, fillrule_changed), + NULL, NULL, gtk_marshal_NONE__UINT, - GTK_TYPE_NONE, 1, GTK_TYPE_UINT); + G_TYPE_NONE, 1, GTK_TYPE_UINT); object_class->destroy = sp_paint_selector_destroy; } @@ -249,7 +255,7 @@ sp_paint_selector_init(SPPaintSelector *psel) w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_EVEN_ODD); gtk_container_add(GTK_CONTAINER(psel->evenodd), w); gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->evenodd, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(psel->evenodd), "toggled", GTK_SIGNAL_FUNC(sp_paint_selector_fillrule_toggled), psel); + g_signal_connect(G_OBJECT(psel->evenodd), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel); psel->nonzero = gtk_radio_button_new(gtk_radio_button_group(GTK_RADIO_BUTTON(psel->evenodd))); gtk_button_set_relief(GTK_BUTTON(psel->nonzero), GTK_RELIEF_NONE); @@ -260,7 +266,7 @@ sp_paint_selector_init(SPPaintSelector *psel) w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON_FILL_RULE_NONZERO); gtk_container_add(GTK_CONTAINER(psel->nonzero), w); gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->nonzero, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(psel->nonzero), "toggled", GTK_SIGNAL_FUNC(sp_paint_selector_fillrule_toggled), psel); + g_signal_connect(G_OBJECT(psel->nonzero), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel); } /* Frame */ @@ -308,7 +314,7 @@ static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gtk_container_add(GTK_CONTAINER(b), w); gtk_box_pack_start(GTK_BOX(psel->style), b, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(b), "toggled", GTK_SIGNAL_FUNC(sp_paint_selector_style_button_toggled), psel); + g_signal_connect(G_OBJECT(b), "toggled", G_CALLBACK(sp_paint_selector_style_button_toggled), psel); return b; } @@ -326,7 +332,7 @@ sp_paint_selector_fillrule_toggled(GtkToggleButton *tb, SPPaintSelector *psel) { if (!psel->update && gtk_toggle_button_get_active(tb)) { SPPaintSelector::FillRule fr = static_cast<SPPaintSelector::FillRule>(GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(tb), "mode"))); - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[FILLRULE_CHANGED], fr); + g_signal_emit(G_OBJECT(psel), psel_signals[FILLRULE_CHANGED], 0, fr); } } @@ -397,7 +403,7 @@ void SPPaintSelector::setMode(Mode mode) break; } this->mode = mode; - gtk_signal_emit(GTK_OBJECT(this), psel_signals[MODE_CHANGED], this->mode); + g_signal_emit(G_OBJECT(this), psel_signals[MODE_CHANGED], 0, this->mode); update = FALSE; } } @@ -610,17 +616,17 @@ sp_paint_selector_set_mode_none(SPPaintSelector *psel) static void sp_paint_selector_color_grabbed(SPColorSelector * /*csel*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[GRABBED]); + g_signal_emit(G_OBJECT(psel), psel_signals[GRABBED], 0); } static void sp_paint_selector_color_dragged(SPColorSelector * /*csel*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[DRAGGED]); + g_signal_emit(G_OBJECT(psel), psel_signals[DRAGGED], 0); } static void sp_paint_selector_color_released(SPColorSelector * /*csel*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[RELEASED]); + g_signal_emit(G_OBJECT(psel), psel_signals[RELEASED], 0); } static void @@ -628,7 +634,7 @@ sp_paint_selector_color_changed(SPColorSelector *csel, SPPaintSelector *psel) { csel->base->getColorAlpha( psel->color, psel->alpha ); - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[CHANGED]); + g_signal_emit(G_OBJECT(psel), psel_signals[CHANGED], 0); } static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode /*mode*/) @@ -654,10 +660,10 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec gtk_widget_show(csel); gtk_object_set_data(GTK_OBJECT(vb), "color-selector", csel); gtk_box_pack_start(GTK_BOX(vb), csel, TRUE, TRUE, 0); - gtk_signal_connect(GTK_OBJECT(csel), "grabbed", GTK_SIGNAL_FUNC(sp_paint_selector_color_grabbed), psel); - gtk_signal_connect(GTK_OBJECT(csel), "dragged", GTK_SIGNAL_FUNC(sp_paint_selector_color_dragged), psel); - gtk_signal_connect(GTK_OBJECT(csel), "released", GTK_SIGNAL_FUNC(sp_paint_selector_color_released), psel); - gtk_signal_connect(GTK_OBJECT(csel), "changed", GTK_SIGNAL_FUNC(sp_paint_selector_color_changed), psel); + g_signal_connect(G_OBJECT(csel), "grabbed", G_CALLBACK(sp_paint_selector_color_grabbed), psel); + g_signal_connect(G_OBJECT(csel), "dragged", G_CALLBACK(sp_paint_selector_color_dragged), psel); + g_signal_connect(G_OBJECT(csel), "released", G_CALLBACK(sp_paint_selector_color_released), psel); + g_signal_connect(G_OBJECT(csel), "changed", G_CALLBACK(sp_paint_selector_color_changed), psel); /* Pack everything to frame */ gtk_container_add(GTK_CONTAINER(psel->frame), vb); psel->selector = vb; @@ -677,22 +683,22 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec static void sp_paint_selector_gradient_grabbed(SPColorSelector * /*csel*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[GRABBED]); + g_signal_emit(G_OBJECT(psel), psel_signals[GRABBED], 0); } static void sp_paint_selector_gradient_dragged(SPColorSelector * /*csel*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[DRAGGED]); + g_signal_emit(G_OBJECT(psel), psel_signals[DRAGGED], 0); } static void sp_paint_selector_gradient_released(SPColorSelector * /*csel*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[RELEASED]); + g_signal_emit(G_OBJECT(psel), psel_signals[RELEASED], 0); } static void sp_paint_selector_gradient_changed(SPColorSelector * /*csel*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[CHANGED]); + g_signal_emit(G_OBJECT(psel), psel_signals[CHANGED], 0); } static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelector::Mode mode) @@ -716,10 +722,10 @@ static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSe /* Create new gradient selector */ gsel = sp_gradient_selector_new(); gtk_widget_show(gsel); - gtk_signal_connect(GTK_OBJECT(gsel), "grabbed", GTK_SIGNAL_FUNC(sp_paint_selector_gradient_grabbed), psel); - gtk_signal_connect(GTK_OBJECT(gsel), "dragged", GTK_SIGNAL_FUNC(sp_paint_selector_gradient_dragged), psel); - gtk_signal_connect(GTK_OBJECT(gsel), "released", GTK_SIGNAL_FUNC(sp_paint_selector_gradient_released), psel); - gtk_signal_connect(GTK_OBJECT(gsel), "changed", GTK_SIGNAL_FUNC(sp_paint_selector_gradient_changed), psel); + g_signal_connect(G_OBJECT(gsel), "grabbed", G_CALLBACK(sp_paint_selector_gradient_grabbed), psel); + g_signal_connect(G_OBJECT(gsel), "dragged", G_CALLBACK(sp_paint_selector_gradient_dragged), psel); + g_signal_connect(G_OBJECT(gsel), "released", G_CALLBACK(sp_paint_selector_gradient_released), psel); + g_signal_connect(G_OBJECT(gsel), "changed", G_CALLBACK(sp_paint_selector_gradient_changed), psel); /* Pack everything to frame */ gtk_container_add(GTK_CONTAINER(psel->frame), gsel); psel->selector = gsel; @@ -760,7 +766,7 @@ static void sp_psel_pattern_destroy(GtkWidget *widget, SPPaintSelector * /*psel* static void sp_psel_pattern_change(GtkWidget * /*widget*/, SPPaintSelector *psel) { - gtk_signal_emit(GTK_OBJECT(psel), psel_signals[CHANGED]); + g_signal_emit(G_OBJECT(psel), psel_signals[CHANGED], 0); } @@ -991,8 +997,8 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel GtkWidget *mnu = gtk_option_menu_new(); ink_pattern_menu(mnu); - gtk_signal_connect(GTK_OBJECT(mnu), "changed", GTK_SIGNAL_FUNC(sp_psel_pattern_change), psel); - gtk_signal_connect(GTK_OBJECT(mnu), "destroy", GTK_SIGNAL_FUNC(sp_psel_pattern_destroy), psel); + g_signal_connect(G_OBJECT(mnu), "changed", G_CALLBACK(sp_psel_pattern_change), psel); + g_signal_connect(G_OBJECT(mnu), "destroy", G_CALLBACK(sp_psel_pattern_destroy), psel); gtk_object_set_data(GTK_OBJECT(psel), "patternmenu", mnu); g_object_ref( G_OBJECT(mnu)); diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 108fae1ef..7012badf8 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -295,7 +295,7 @@ static EgeAdjustmentAction * create_adjustment_action( gchar const *name, g_object_set( act, "short_label", Q_(shortLabel), NULL ); } - gtk_signal_connect( GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(sp_object_layout_any_value_changed), spw ); + g_signal_connect( G_OBJECT(adj), "value_changed", G_CALLBACK(sp_object_layout_any_value_changed), spw ); if ( focusTarget ) { ege_adjustment_action_set_focuswidget( act, focusTarget ); } @@ -398,7 +398,7 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi InkAction* inky = ink_action_new( verb->get_id(), verb->get_name(), verb->get_tip(), verb->get_image(), size ); act = GTK_ACTION(inky); - g_signal_connect( G_OBJECT(inky), "activate", GTK_SIGNAL_FUNC(trigger_sp_action), targetAction ); + g_signal_connect( G_OBJECT(inky), "activate", G_CALLBACK(trigger_sp_action), targetAction ); Inkscape::queueIconPrerender( verb->get_image(), size ); @@ -518,8 +518,8 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb g_object_set_data( G_OBJECT(spw), "contextActions", contextActions ); // Force update when selection changes. - gtk_signal_connect(GTK_OBJECT(spw), "modify_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_modify_selection), desktop); - gtk_signal_connect(GTK_OBJECT(spw), "change_selection", GTK_SIGNAL_FUNC(sp_selection_layout_widget_change_selection), desktop); + g_signal_connect(G_OBJECT(spw), "modify_selection", G_CALLBACK(sp_selection_layout_widget_modify_selection), desktop); + g_signal_connect(G_OBJECT(spw), "change_selection", G_CALLBACK(sp_selection_layout_widget_change_selection), desktop); // Update now. sp_selection_layout_widget_update(SP_WIDGET(spw), SP_ACTIVE_DESKTOP ? sp_desktop_selection(SP_ACTIVE_DESKTOP) : NULL); diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 0bae54655..3a2c7fbed 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -358,11 +358,11 @@ void ColorICCSelector::init() /* Signals */ - gtk_signal_connect( GTK_OBJECT( _fooAdj[i] ), "value_changed", GTK_SIGNAL_FUNC( _adjustmentChanged ), _csel ); + g_signal_connect( G_OBJECT( _fooAdj[i] ), "value_changed", G_CALLBACK( _adjustmentChanged ), _csel ); - gtk_signal_connect( GTK_OBJECT( _fooSlider[i] ), "grabbed", GTK_SIGNAL_FUNC( _sliderGrabbed ), _csel ); - gtk_signal_connect( GTK_OBJECT( _fooSlider[i] ), "released", GTK_SIGNAL_FUNC( _sliderReleased ), _csel ); - gtk_signal_connect( GTK_OBJECT( _fooSlider[i] ), "changed", GTK_SIGNAL_FUNC( _sliderChanged ), _csel ); + g_signal_connect( G_OBJECT( _fooSlider[i] ), "grabbed", G_CALLBACK( _sliderGrabbed ), _csel ); + g_signal_connect( G_OBJECT( _fooSlider[i] ), "released", G_CALLBACK( _sliderReleased ), _csel ); + g_signal_connect( G_OBJECT( _fooSlider[i] ), "changed", G_CALLBACK( _sliderChanged ), _csel ); row++; } @@ -397,15 +397,15 @@ void ColorICCSelector::init() gtk_table_attach (GTK_TABLE (t), _sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); /* Signals */ - gtk_signal_connect (GTK_OBJECT (_adj), "value_changed", - GTK_SIGNAL_FUNC (_adjustmentChanged), _csel); - - gtk_signal_connect (GTK_OBJECT (_slider), "grabbed", - GTK_SIGNAL_FUNC (_sliderGrabbed), _csel); - gtk_signal_connect (GTK_OBJECT (_slider), "released", - GTK_SIGNAL_FUNC (_sliderReleased), _csel); - gtk_signal_connect (GTK_OBJECT (_slider), "changed", - GTK_SIGNAL_FUNC (_sliderChanged), _csel); + g_signal_connect (G_OBJECT (_adj), "value_changed", + G_CALLBACK (_adjustmentChanged), _csel); + + g_signal_connect (G_OBJECT (_slider), "grabbed", + G_CALLBACK (_sliderGrabbed), _csel); + g_signal_connect (G_OBJECT (_slider), "released", + G_CALLBACK (_sliderReleased), _csel); + g_signal_connect (G_OBJECT (_slider), "changed", + G_CALLBACK (_sliderChanged), _csel); } static void @@ -700,7 +700,7 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile ) SPColor(1.0, 1.0, 1.0).toRGBA32(0xff) ); /* _fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( val, 0.0, _fooScales[i], step, page, page ) ); - gtk_signal_connect( GTK_OBJECT( _fooAdj[i] ), "value_changed", GTK_SIGNAL_FUNC( _adjustmentChanged ), _csel ); + g_signal_connect( G_OBJECT( _fooAdj[i] ), "value_changed", G_CALLBACK( _adjustmentChanged ), _csel ); sp_color_slider_set_adjustment( SP_COLOR_SLIDER(_fooSlider[i]), _fooAdj[i] ); gtk_spin_button_set_adjustment( GTK_SPIN_BUTTON(_fooBtn[i]), _fooAdj[i] ); diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 4c2c03e8a..06e990dfb 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -318,7 +318,7 @@ void ColorNotebook::init() // but first fix it so it remembers its settings in prefs and does not take that much space (entire vertical column!) //gtk_table_attach (GTK_TABLE (table), align, 2, 3, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); - gtk_signal_connect_object(GTK_OBJECT(_btn), "event", GTK_SIGNAL_FUNC (sp_color_notebook_menu_handler), GTK_OBJECT(_csel)); + g_signal_connect_swapped(G_OBJECT(_btn), "event", G_CALLBACK (sp_color_notebook_menu_handler), G_OBJECT(_csel)); if ( !found ) { gtk_widget_set_sensitive (_btn, FALSE); @@ -383,10 +383,10 @@ void ColorNotebook::init() gtk_table_attach (GTK_TABLE (table), _p, 2, 3, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); #endif - _switchId = g_signal_connect(GTK_OBJECT (_book), "switch-page", - GTK_SIGNAL_FUNC (sp_color_notebook_switch_page), SP_COLOR_NOTEBOOK(_csel)); + _switchId = g_signal_connect(G_OBJECT (_book), "switch-page", + G_CALLBACK (sp_color_notebook_switch_page), SP_COLOR_NOTEBOOK(_csel)); - _entryId = gtk_signal_connect (GTK_OBJECT (_rgbae), "changed", GTK_SIGNAL_FUNC (ColorNotebook::_rgbaEntryChangedHook), _csel); + _entryId = g_signal_connect (G_OBJECT (_rgbae), "changed", G_CALLBACK (ColorNotebook::_rgbaEntryChangedHook), _csel); } static void @@ -648,10 +648,10 @@ GtkWidget* ColorNotebook::addPage(GType page_type, guint submode) // g_message( "Hitting up for tab for '%s'", str ); tab_label = gtk_label_new(_(str)); gtk_notebook_append_page( GTK_NOTEBOOK (_book), page, tab_label ); - gtk_signal_connect (GTK_OBJECT (page), "grabbed", GTK_SIGNAL_FUNC (_entryGrabbed), _csel); - gtk_signal_connect (GTK_OBJECT (page), "dragged", GTK_SIGNAL_FUNC (_entryDragged), _csel); - gtk_signal_connect (GTK_OBJECT (page), "released", GTK_SIGNAL_FUNC (_entryReleased), _csel); - gtk_signal_connect (GTK_OBJECT (page), "changed", GTK_SIGNAL_FUNC (_entryChanged), _csel); + g_signal_connect (G_OBJECT (page), "grabbed", G_CALLBACK (_entryGrabbed), _csel); + g_signal_connect (G_OBJECT (page), "dragged", G_CALLBACK (_entryDragged), _csel); + g_signal_connect (G_OBJECT (page), "released", G_CALLBACK (_entryReleased), _csel); + g_signal_connect (G_OBJECT (page), "changed", G_CALLBACK (_entryChanged), _csel); } return page; diff --git a/src/widgets/sp-color-scales.cpp b/src/widgets/sp-color-scales.cpp index 001b54752..25162dead 100644 --- a/src/widgets/sp-color-scales.cpp +++ b/src/widgets/sp-color-scales.cpp @@ -168,14 +168,14 @@ void ColorScales::init() /* Attach channel value to adjustment */ gtk_object_set_data (GTK_OBJECT (_a[i]), "channel", GINT_TO_POINTER (i)); /* Signals */ - gtk_signal_connect (GTK_OBJECT (_a[i]), "value_changed", - GTK_SIGNAL_FUNC (_adjustmentAnyChanged), _csel); - gtk_signal_connect (GTK_OBJECT (_s[i]), "grabbed", - GTK_SIGNAL_FUNC (_sliderAnyGrabbed), _csel); - gtk_signal_connect (GTK_OBJECT (_s[i]), "released", - GTK_SIGNAL_FUNC (_sliderAnyReleased), _csel); - gtk_signal_connect (GTK_OBJECT (_s[i]), "changed", - GTK_SIGNAL_FUNC (_sliderAnyChanged), _csel); + g_signal_connect (G_OBJECT (_a[i]), "value_changed", + G_CALLBACK (_adjustmentAnyChanged), _csel); + g_signal_connect (G_OBJECT (_s[i]), "grabbed", + G_CALLBACK (_sliderAnyGrabbed), _csel); + g_signal_connect (G_OBJECT (_s[i]), "released", + G_CALLBACK (_sliderAnyReleased), _csel); + g_signal_connect (G_OBJECT (_s[i]), "changed", + G_CALLBACK (_sliderAnyChanged), _csel); } /* Initial mode is none, so it works */ diff --git a/src/widgets/sp-color-selector.cpp b/src/widgets/sp-color-selector.cpp index 794cbdb42..bf3564d2e 100644 --- a/src/widgets/sp-color-selector.cpp +++ b/src/widgets/sp-color-selector.cpp @@ -70,28 +70,32 @@ void sp_color_selector_class_init( SPColorSelectorClass *klass ) parent_class = GTK_VBOX_CLASS( gtk_type_class(GTK_TYPE_VBOX) ); - csel_signals[GRABBED] = gtk_signal_new( "grabbed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPColorSelectorClass, grabbed), + csel_signals[GRABBED] = g_signal_new( "grabbed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPColorSelectorClass, grabbed), + NULL, NULL, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0 ); - csel_signals[DRAGGED] = gtk_signal_new( "dragged", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPColorSelectorClass, dragged), + csel_signals[DRAGGED] = g_signal_new( "dragged", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPColorSelectorClass, dragged), + NULL, NULL, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0 ); - csel_signals[RELEASED] = gtk_signal_new( "released", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPColorSelectorClass, released), + csel_signals[RELEASED] = g_signal_new( "released", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPColorSelectorClass, released), + NULL, NULL, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0 ); - csel_signals[CHANGED] = gtk_signal_new( "changed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET(SPColorSelectorClass, changed), + csel_signals[CHANGED] = g_signal_new( "changed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET(SPColorSelectorClass, changed), + NULL, NULL, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0 ); @@ -111,7 +115,7 @@ void sp_color_selector_init( SPColorSelector *csel ) { csel->base->init(); } -/* gtk_signal_connect(GTK_OBJECT(csel->rgbae), "changed", GTK_SIGNAL_FUNC(sp_color_selector_rgba_entry_changed), csel); */ +/* g_signal_connect(G_OBJECT(csel->rgbae), "changed", G_CALLBACK(sp_color_selector_rgba_entry_changed), csel); */ } void sp_color_selector_destroy( GtkObject *object ) @@ -230,7 +234,7 @@ void ColorSelector::setColorAlpha( const SPColor& color, gfloat alpha, bool emit _colorChanged(); if (emit) { - gtk_signal_emit(GTK_OBJECT(_csel), csel_signals[CHANGED]); + g_signal_emit(G_OBJECT(_csel), csel_signals[CHANGED], 0); } #ifdef DUMP_CHANGE_INFO } else { @@ -248,7 +252,7 @@ void ColorSelector::_grabbed() "GRABBED", FOO_NAME(_csel)); #endif - gtk_signal_emit(GTK_OBJECT(_csel), csel_signals[GRABBED]); + g_signal_emit(G_OBJECT(_csel), csel_signals[GRABBED], 0); } void ColorSelector::_released() @@ -259,8 +263,8 @@ void ColorSelector::_released() "RELEASED", FOO_NAME(_csel)); #endif - gtk_signal_emit(GTK_OBJECT(_csel), csel_signals[RELEASED]); - gtk_signal_emit(GTK_OBJECT(_csel), csel_signals[CHANGED]); + g_signal_emit(G_OBJECT(_csel), csel_signals[RELEASED], 0); + g_signal_emit(G_OBJECT(_csel), csel_signals[CHANGED], 0); } // Called from subclasses to update color and broadcast if needed @@ -288,7 +292,7 @@ void ColorSelector::_updateInternals( const SPColor& color, gfloat alpha, gboole "GRABBED", color.toRGBA32( alpha ), (color.icc?color.icc->colorProfile.c_str():"<null>"), FOO_NAME(_csel)); #endif - gtk_signal_emit(GTK_OBJECT(_csel), csel_signals[GRABBED]); + g_signal_emit(G_OBJECT(_csel), csel_signals[GRABBED], 0); } else if ( released ) { @@ -297,7 +301,7 @@ void ColorSelector::_updateInternals( const SPColor& color, gfloat alpha, gboole "RELEASED", color.toRGBA32( alpha ), (color.icc?color.icc->colorProfile.c_str():"<null>"), FOO_NAME(_csel)); #endif - gtk_signal_emit(GTK_OBJECT(_csel), csel_signals[RELEASED]); + g_signal_emit(G_OBJECT(_csel), csel_signals[RELEASED], 0); } if ( colorDifferent || released ) @@ -307,7 +311,7 @@ void ColorSelector::_updateInternals( const SPColor& color, gfloat alpha, gboole (_held ? "CHANGED" : "DRAGGED" ), color.toRGBA32( alpha ), (color.icc?color.icc->colorProfile.c_str():"<null>"), FOO_NAME(_csel)); #endif - gtk_signal_emit(GTK_OBJECT(_csel), csel_signals[_held ? CHANGED : DRAGGED]); + g_signal_emit(G_OBJECT(_csel), csel_signals[_held ? CHANGED : DRAGGED], 0); } } diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index 2d0789ec4..efea69590 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -87,30 +87,34 @@ sp_color_slider_class_init (SPColorSliderClass *klass) parent_class = (GtkWidgetClass*)gtk_type_class (GTK_TYPE_WIDGET); - slider_signals[GRABBED] = gtk_signal_new ("grabbed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPColorSliderClass, grabbed), + slider_signals[GRABBED] = g_signal_new ("grabbed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPColorSliderClass, grabbed), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - slider_signals[DRAGGED] = gtk_signal_new ("dragged", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPColorSliderClass, dragged), + G_TYPE_NONE, 0); + slider_signals[DRAGGED] = g_signal_new ("dragged", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPColorSliderClass, dragged), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - slider_signals[RELEASED] = gtk_signal_new ("released", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPColorSliderClass, released), + G_TYPE_NONE, 0); + slider_signals[RELEASED] = g_signal_new ("released", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPColorSliderClass, released), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - slider_signals[CHANGED] = gtk_signal_new ("changed", - (GtkSignalRunType)(GTK_RUN_FIRST | GTK_RUN_NO_RECURSE), - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPColorSliderClass, changed), + G_TYPE_NONE, 0); + slider_signals[CHANGED] = g_signal_new ("changed", + G_TYPE_FROM_CLASS(object_class), + (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE), + G_STRUCT_OFFSET (SPColorSliderClass, changed), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + G_TYPE_NONE, 0); object_class->destroy = sp_color_slider_destroy; @@ -168,7 +172,7 @@ sp_color_slider_destroy (GtkObject *object) slider = SP_COLOR_SLIDER (object); if (slider->adjustment) { - gtk_signal_disconnect_by_data (GTK_OBJECT (slider->adjustment), slider); + g_signal_handlers_disconnect_matched (G_OBJECT (slider->adjustment), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, slider); gtk_object_unref (GTK_OBJECT (slider->adjustment)); slider->adjustment = NULL; } @@ -265,11 +269,11 @@ sp_color_slider_button_press (GtkWidget *widget, GdkEventButton *event) gint cx, cw; cx = widget->style->xthickness; cw = widget->allocation.width - 2 * cx; - gtk_signal_emit (GTK_OBJECT (slider), slider_signals[GRABBED]); + g_signal_emit (G_OBJECT (slider), slider_signals[GRABBED], 0); slider->dragging = TRUE; slider->oldvalue = slider->value; ColorScales::setScaled( slider->adjustment, CLAMP ((gfloat) (event->x - cx) / cw, 0.0, 1.0) ); - gtk_signal_emit (GTK_OBJECT (slider), slider_signals[DRAGGED]); + g_signal_emit (G_OBJECT (slider), slider_signals[DRAGGED], 0); gdk_pointer_grab (widget->window, FALSE, (GdkEventMask)(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK), @@ -289,8 +293,8 @@ sp_color_slider_button_release (GtkWidget *widget, GdkEventButton *event) if (event->button == 1) { gdk_pointer_ungrab (event->time); slider->dragging = FALSE; - gtk_signal_emit (GTK_OBJECT (slider), slider_signals[RELEASED]); - if (slider->value != slider->oldvalue) gtk_signal_emit (GTK_OBJECT (slider), slider_signals[CHANGED]); + g_signal_emit (G_OBJECT (slider), slider_signals[RELEASED], 0); + if (slider->value != slider->oldvalue) g_signal_emit (G_OBJECT (slider), slider_signals[CHANGED], 0); } return FALSE; @@ -308,7 +312,7 @@ sp_color_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event) cx = widget->style->xthickness; cw = widget->allocation.width - 2 * cx; ColorScales::setScaled( slider->adjustment, CLAMP ((gfloat) (event->x - cx) / cw, 0.0, 1.0) ); - gtk_signal_emit (GTK_OBJECT (slider), slider_signals[DRAGGED]); + g_signal_emit (G_OBJECT (slider), slider_signals[DRAGGED], 0); } return FALSE; @@ -340,7 +344,7 @@ void sp_color_slider_set_adjustment(SPColorSlider *slider, GtkAdjustment *adjust if (slider->adjustment != adjustment) { if (slider->adjustment) { - gtk_signal_disconnect_by_data (GTK_OBJECT (slider->adjustment), slider); + g_signal_handlers_disconnect_matched (G_OBJECT (slider->adjustment), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, slider); gtk_object_unref (GTK_OBJECT (slider->adjustment)); } @@ -348,10 +352,10 @@ void sp_color_slider_set_adjustment(SPColorSlider *slider, GtkAdjustment *adjust gtk_object_ref (GTK_OBJECT (adjustment)); gtk_object_sink (GTK_OBJECT (adjustment)); - gtk_signal_connect (GTK_OBJECT (adjustment), "changed", - GTK_SIGNAL_FUNC (sp_color_slider_adjustment_changed), slider); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (sp_color_slider_adjustment_value_changed), slider); + g_signal_connect (G_OBJECT (adjustment), "changed", + G_CALLBACK (sp_color_slider_adjustment_changed), slider); + g_signal_connect (G_OBJECT (adjustment), "value_changed", + G_CALLBACK (sp_color_slider_adjustment_value_changed), slider); slider->value = ColorScales::getScaled( adjustment ); diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 25ba250a7..4bbda79a6 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -196,25 +196,25 @@ void ColorWheelSelector::init() gtk_table_attach (GTK_TABLE (t), _sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); /* Signals */ - gtk_signal_connect (GTK_OBJECT (_adj), "value_changed", - GTK_SIGNAL_FUNC (_adjustmentChanged), _csel); + g_signal_connect (G_OBJECT (_adj), "value_changed", + G_CALLBACK (_adjustmentChanged), _csel); - gtk_signal_connect (GTK_OBJECT (_slider), "grabbed", - GTK_SIGNAL_FUNC (_sliderGrabbed), _csel); - gtk_signal_connect (GTK_OBJECT (_slider), "released", - GTK_SIGNAL_FUNC (_sliderReleased), _csel); - gtk_signal_connect (GTK_OBJECT (_slider), "changed", - GTK_SIGNAL_FUNC (_sliderChanged), _csel); + g_signal_connect (G_OBJECT (_slider), "grabbed", + G_CALLBACK (_sliderGrabbed), _csel); + g_signal_connect (G_OBJECT (_slider), "released", + G_CALLBACK (_sliderReleased), _csel); + g_signal_connect (G_OBJECT (_slider), "changed", + G_CALLBACK (_sliderChanged), _csel); - gtk_signal_connect( GTK_OBJECT(_wheel), "changed", - GTK_SIGNAL_FUNC(_wheelChanged), _csel ); + g_signal_connect( G_OBJECT(_wheel), "changed", + G_CALLBACK (_wheelChanged), _csel ); // GTK does not automatically scale the color wheel, so we have to add that in: - gtk_signal_connect( GTK_OBJECT(_wheel), "size-allocate", - GTK_SIGNAL_FUNC(handleWheelAllocation), _csel ); - gtk_signal_connect( GTK_OBJECT(_wheel), "style-set", - GTK_SIGNAL_FUNC(handleWheelStyleSet), _csel ); + g_signal_connect( G_OBJECT (_wheel), "size-allocate", + G_CALLBACK (handleWheelAllocation), _csel ); + g_signal_connect( G_OBJECT (_wheel), "style-set", + G_CALLBACK (handleWheelStyleSet), _csel ); } static void diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp index f694c461c..fd20d8e17 100644 --- a/src/widgets/sp-widget.cpp +++ b/src/widgets/sp-widget.cpp @@ -78,32 +78,36 @@ sp_widget_class_init (SPWidgetClass *klass) object_class->destroy = sp_widget_destroy; - signals[CONSTRUCT] = gtk_signal_new ("construct", - GTK_RUN_FIRST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPWidgetClass, construct), + signals[CONSTRUCT] = g_signal_new ("construct", + G_TYPE_FROM_CLASS(object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (SPWidgetClass, construct), + NULL, NULL, gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - signals[CHANGE_SELECTION] = gtk_signal_new ("change_selection", - GTK_RUN_FIRST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPWidgetClass, change_selection), + G_TYPE_NONE, 0); + signals[CHANGE_SELECTION] = g_signal_new ("change_selection", + G_TYPE_FROM_CLASS(object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (SPWidgetClass, change_selection), + NULL, NULL, gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, + G_TYPE_NONE, 1, GTK_TYPE_POINTER); - signals[MODIFY_SELECTION] = gtk_signal_new ("modify_selection", - GTK_RUN_FIRST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPWidgetClass, modify_selection), + signals[MODIFY_SELECTION] = g_signal_new ("modify_selection", + G_TYPE_FROM_CLASS(object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (SPWidgetClass, modify_selection), + NULL, NULL, gtk_marshal_NONE__POINTER_UINT, - GTK_TYPE_NONE, 2, + G_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_UINT); - signals[SET_SELECTION] = gtk_signal_new ("set_selection", - GTK_RUN_FIRST, - GTK_CLASS_TYPE(object_class), - GTK_SIGNAL_OFFSET (SPWidgetClass, set_selection), + signals[SET_SELECTION] = g_signal_new ("set_selection", + G_TYPE_FROM_CLASS(object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (SPWidgetClass, set_selection), + NULL, NULL, gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, + G_TYPE_NONE, 1, GTK_TYPE_POINTER); widget_class->show = sp_widget_show; diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 7f1548df4..f248e22af 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -885,7 +885,7 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi act = GTK_ACTION(inky); gtk_action_set_sensitive( act, targetAction->sensitive ); - g_signal_connect( G_OBJECT(inky), "activate", GTK_SIGNAL_FUNC(trigger_sp_action), targetAction ); + g_signal_connect( G_OBJECT(inky), "activate", G_CALLBACK(trigger_sp_action), targetAction ); SPAction*rebound = dynamic_cast<SPAction *>( nr_object_ref( dynamic_cast<NRObject *>(targetAction) ) ); nr_active_object_add_listener( (NRActiveObject *)rebound, (NRObjectEventVector *)&action_event_vector, sizeof(SPActionEventVector), inky ); @@ -1089,7 +1089,7 @@ static EgeAdjustmentAction * create_adjustment_action( gchar const *name, sp_unit_selector_add_adjustment( SP_UNIT_SELECTOR(us), adj ); } - gtk_signal_connect( GTK_OBJECT(adj), "value-changed", GTK_SIGNAL_FUNC(callback), dataKludge ); + g_signal_connect( G_OBJECT(adj), "value-changed", G_CALLBACK(callback), dataKludge ); EgeAdjustmentAction* act = ege_adjustment_action_new( adj, name, label, tooltip, 0, climb, digits ); if ( shortLabel ) { -- cgit v1.2.3 From 68519ec20c94cc0a9c00134a5139ed0517a61659 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Sun, 12 Jun 2011 23:07:23 -0300 Subject: more improvements in the measurement tool: * select elements crossed by the line segment drawn with the tool * allow user to select font size for the length labels (in the toolbar) * use temporary canvas items (bzr r10284) --- src/measure-context.cpp | 76 +++++++++++++++++++------------------------------ src/widgets/toolbox.cpp | 30 +++++++++++++++++-- 2 files changed, 58 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 2aeb39d5d..6870786f2 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -48,7 +48,7 @@ static gint tolerance = 0; static bool within_tolerance = false; static SPCanvasItem * line = NULL; Geom::Point start_point; -SPCanvasItem *measure_text = NULL; +std::vector<Inkscape::Display::TemporaryItem*> measure_tmp_items; GType sp_measure_context_get_type(void) { @@ -157,16 +157,8 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv line = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLLINE, NULL); } - if (!measure_text){ - measure_text = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, start_point, ""); - SP_CANVASTEXT(measure_text)->rgba = 0x7f7f7fff; - sp_canvastext_set_anchor(SP_CANVASTEXT(measure_text), -1, 1);//why? - } - sp_ctrlline_set_coords (SP_CTRLLINE(line), start_point, start_point); - sp_canvastext_set_text (SP_CANVASTEXT(measure_text), ""); sp_canvas_item_show (line); - sp_canvas_item_show (measure_text); sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, @@ -195,23 +187,23 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv sp_ctrlline_set_coords (SP_CTRLLINE(line), start_point[Geom::X], start_point[Geom::Y], motion_dt[Geom::X], motion_dt[Geom::Y]); - - //our control line - Geom::PathVector line; + Geom::PathVector lineseg; Geom::Path p; p.start(desktop->dt2doc(start_point)); p.appendNew<Geom::LineSegment>(desktop->dt2doc(motion_dt)); - line.push_back(p); + lineseg.push_back(p); + +//TODO: calculate NPOINTS +//800 seems to be a good value for 800x600 resolution +#define NPOINTS 800 std::vector<Geom::Point> points; double i; -#define NPOINTS 3000 for (i=0; i<NPOINTS; i++){ points.push_back(desktop->d2w(start_point + (i/NPOINTS)*(motion_dt-start_point))); } - double length; -//select elements crossed by line segment: + //select elements crossed by line segment: GSList *items = sp_desktop_document(desktop)->getItemsAtPoints(desktop->dkey, points); SPItem* item; GSList *l; @@ -242,16 +234,16 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv Geom::PathVector pathv = curve->get_pathvector(); // Find all intersections of the control-line with this shape - Geom::CrossingSet cs = Geom::crossings(line, pathv); + Geom::CrossingSet cs = Geom::crossings(lineseg, pathv); // Store the results as intersection points unsigned int index = 0; for (Geom::CrossingSet::const_iterator i = cs.begin(); i != cs.end(); i++) { - if (index >= line.size()) { + if (index >= lineseg.size()) { break; } // Reconstruct and store the points of intersection for (Geom::Crossings::const_iterator m = (*i).begin(); m != (*i).end(); m++) { - intersections.push_back(line[index].pointAt((*m).ta)); + intersections.push_back(lineseg[index].pointAt((*m).ta)); } index++; } @@ -262,8 +254,12 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv //sort intersections std::sort(intersections.begin(), intersections.end(), GeomPointSortPredicate); -//TODO: make these not fade out. unsigned int idx; + for (idx=0; idx<measure_tmp_items.size(); idx++){ + desktop->remove_temporary_canvasitem(measure_tmp_items[idx]); + } + measure_tmp_items.clear(); + for (idx=0;idx<intersections.size(); idx++){ // Display the intersection indicator (i.e. the cross) SPCanvasItem * canvasitem = NULL; @@ -278,44 +274,30 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv NULL ); SP_CTRL(canvasitem)->moveto(desktop->doc2dt(intersections[idx])); - desktop->add_temporary_canvasitem(canvasitem, 100); - } + measure_tmp_items.push_back(desktop->add_temporary_canvasitem(canvasitem, 0)); + } -//TODO: make these not fade out. Geom::Point previous_point = intersections[0]; for (idx=1; idx < intersections.size(); idx++){ Geom::Point measure_text_pos = (previous_point + intersections[idx])/2; +//TODO: shift label a few pixels in the y coordinate - length = (intersections[idx] - previous_point).length(); char* measure_str = (char*) malloc(sizeof(char)*20); - sprintf(measure_str, "%f", length); - -// sp_canvastext_set_coords (SP_CANVASTEXT(measure_text), desktop->dt2doc(measure_text_pos)); -// sp_canvastext_set_text (SP_CANVASTEXT(measure_text), measure_str); - -// SPCanvasItem * canvasitem = NULL; + sprintf(measure_str, "%.2f", (intersections[idx] - previous_point).length()); SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, desktop->dt2doc(measure_text_pos), measure_str); - desktop->add_temporary_canvasitem(canvas_tooltip, 100); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + double fontsize = prefs->getInt("/tools/measure/fontsize"); - free(measure_str); + //TODO: get font size option from toolbar + sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); + measure_tmp_items.push_back(desktop->add_temporary_canvasitem(canvas_tooltip, 0)); + free(measure_str); previous_point = intersections[idx]; } -#if 0 - Geom::Point measure_text_pos = (pa + pb)/2; - - length = (pa - pb).length(); - char* measure_str = (char*) malloc(sizeof(char)*20); - sprintf(measure_str, "%f", length); - - sp_canvastext_set_coords (SP_CANVASTEXT(measure_text), desktop->dt2doc(measure_text_pos)); - sp_canvastext_set_text (SP_CANVASTEXT(measure_text), measure_str); - free(measure_str); -#endif - gobble_motion_events(GDK_BUTTON1_MASK); } break; @@ -327,9 +309,11 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv sp_canvas_item_hide(line); } - if (measure_text){ - sp_canvas_item_hide(measure_text); + unsigned int idx; + for (idx=0; idx<measure_tmp_items.size(); idx++){ + desktop->remove_temporary_canvasitem(measure_tmp_items[idx]); } + measure_tmp_items.clear(); if (mc->grabbed) { sp_canvas_item_ungrab(mc->grabbed, event->button.time); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index f248e22af..122c014eb 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -366,6 +366,7 @@ static gchar const * ui_descr = " </toolbar>" " <toolbar name='MeasureToolbar'>" + " <toolitem action='MeasureFontSizeAction' />" " </toolbar>" " <toolbar name='StarToolbar'>" @@ -1630,9 +1631,34 @@ static void sp_zoom_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* /*main // no custom GtkAction setup needed } // end of sp_zoom_toolbox_prep() -static void sp_measure_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/) +static void +sp_measure_fontsize_value_changed(GtkAdjustment *adj, GObject *tbl) { - // no custom GtkAction setup needed + SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); + + if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(Glib::ustring("/tools/measure/fontsize"), adj->value); + } +} + + +static void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObject* holder) +{ + EgeAdjustmentAction* eact = 0; + + /* Font Size */ + { + eact = create_adjustment_action( "MeasureFontSizeAction", + _("Font Size"), _("Font Size:"), + _("The font size to be used in the measurement labels"), + "/tools/measure/fontsize", 0.0, + GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL, + 10, 36, 1.0, 4.0, + 0, 0, 0, + sp_measure_fontsize_value_changed); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + } } // end of sp_measure_toolbox_prep() void ToolboxFactory::setToolboxDesktop(GtkWidget *toolbox, SPDesktop *desktop) -- cgit v1.2.3 From c718dcbf1e9dda3371caab929c428cbd2bebc12b Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 13:07:17 +0000 Subject: ignore ./CMakeLists.txt.user (qtcreator stores settings here) also correction to windows path. (bzr r10286) --- src/extension/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 8a58ae2be..2c3c9ab83 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -216,7 +216,8 @@ set(extension_SRC if(WIN32) list(APPEND extension_SRC - win32.cpp + internal/win32.cpp + internal/win32.h ) endif() -- cgit v1.2.3 From 222476b91dd4f70d8d1f5580435d381b81ce9773 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Mon, 13 Jun 2011 01:32:05 -0300 Subject: display angle info in the measurement tool (bzr r10288) --- src/measure-context.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 6870786f2..5560be335 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -193,6 +193,10 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv p.appendNew<Geom::LineSegment>(desktop->dt2doc(motion_dt)); lineseg.push_back(p); + double deltax = motion_dt[Geom::X] - start_point[Geom::X]; + double deltay = motion_dt[Geom::Y] - start_point[Geom::Y]; + double angle = atan2(deltay, deltax); + //TODO: calculate NPOINTS //800 seems to be a good value for 800x600 resolution #define NPOINTS 800 @@ -278,6 +282,9 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + double fontsize = prefs->getInt("/tools/measure/fontsize"); + Geom::Point previous_point = intersections[0]; for (idx=1; idx < intersections.size(); idx++){ Geom::Point measure_text_pos = (previous_point + intersections[idx])/2; @@ -287,10 +294,6 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv sprintf(measure_str, "%.2f", (intersections[idx] - previous_point).length()); SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, desktop->dt2doc(measure_text_pos), measure_str); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double fontsize = prefs->getInt("/tools/measure/fontsize"); - - //TODO: get font size option from toolbar sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); measure_tmp_items.push_back(desktop->add_temporary_canvasitem(canvas_tooltip, 0)); @@ -298,6 +301,14 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv previous_point = intersections[idx]; } + char* angle_str = (char*) malloc(sizeof(char)*20); + sprintf(angle_str, "%.2f degrees", angle * 180/3.1415 ); + SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, motion_dt + desktop->w2d(Geom::Point(50,0)), angle_str); + sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); + + measure_tmp_items.push_back(desktop->add_temporary_canvasitem(canvas_tooltip, 0)); + free(angle_str); + gobble_motion_events(GDK_BUTTON1_MASK); } break; -- cgit v1.2.3 From eceeca65839d5e61234c235d5a6df0e360707862 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 15:24:52 +0000 Subject: cmake: The cmake files were using the inkscape-version.cpp file generated by autoconfigure. now generate our own. Also remove bad include. (bzr r10289) --- src/CMakeLists.txt | 31 +++++++++++++++++++++++++++++-- src/helper/CMakeLists.txt | 1 - 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e7fe3a11..7fa4e86e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -219,7 +219,6 @@ set(inkscape_SRC ige-mac-menu.c ink-action.cpp ink-comboboxentry-action.cpp - inkscape-version.cpp inkscape.cpp inkscape.rc interface.cpp @@ -491,6 +490,33 @@ if(WIN32) endif() +# ----------------------------------------------------------------------------- +# Generate version file +# ----------------------------------------------------------------------------- + +# a custom target that is always built +add_custom_target( + inkscape_version ALL + DEPENDS ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp) + +# creates inkscape-version.cpp using cmake script +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp + COMMAND ${CMAKE_COMMAND} + -DINKSCAPE_SOURCE_DIR=${CMAKE_SOURCE_DIR} + -DINKSCAPE_BINARY_DIR=${CMAKE_BINARY_DIR} + -P ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake) + +# buildinfo.h is a generated file +set_source_files_properties( + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp + PROPERTIES GENERATED TRUE) + +list(APPEND inkscape_SRC + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp +) + + # ----------------------------------------------------------------------------- # Load in subdirectories # ----------------------------------------------------------------------------- @@ -536,7 +562,6 @@ set(inkscape_SRC ${inkscape_SRC} ) - # ----------------------------------------------------------------------------- # Setup the executable # ----------------------------------------------------------------------------- @@ -546,6 +571,8 @@ add_inkscape_lib(inkscape_LIB "${inkscape_SRC}") # make executable for INKSCAPE add_executable(inkscape ${main_SRC}) +add_dependencies(inkscape inkscape_version) + target_link_libraries(inkscape # order from automake sp_LIB diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt index f1069e986..8137487e2 100644 --- a/src/helper/CMakeLists.txt +++ b/src/helper/CMakeLists.txt @@ -37,7 +37,6 @@ set(helper_SRC pixbuf-ops.h png-write.h recthull.h - sp-marshal.h stlport.h stock-items.h unit-menu.h -- cgit v1.2.3 From 1984c1b1d1d964c3e7033be169995ca57bc0cb2a Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Mon, 13 Jun 2011 03:44:14 -0300 Subject: =?UTF-8?q?using=20"=C2=B0"=20instead=20of=20"degrees"=20for=20lab?= =?UTF-8?q?eling=20angles=20in=20the=20measure=20tool=20Also=20adding=20pa?= =?UTF-8?q?rentheses=20to=20the=20angle=20lable=20in=20order=20to=20make?= =?UTF-8?q?=20it=20clearly=20distinguishable=20in=20comparison=20to=20the?= =?UTF-8?q?=20length=20labels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r10291) --- src/measure-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 5560be335..56ffc1ff6 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -302,7 +302,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } char* angle_str = (char*) malloc(sizeof(char)*20); - sprintf(angle_str, "%.2f degrees", angle * 180/3.1415 ); + sprintf(angle_str, "(%.2f °)", angle * 180/3.1415 ); SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, motion_dt + desktop->w2d(Geom::Point(50,0)), angle_str); sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); -- cgit v1.2.3 From bfb465bd2809f84f6ebc52cae091d840e8ad8bb2 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Mon, 13 Jun 2011 03:53:04 -0300 Subject: using green color instead of parentheses to differentiate the angle label in the measure tool (bzr r10292) --- src/measure-context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 56ffc1ff6..c8046049e 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -302,9 +302,10 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } char* angle_str = (char*) malloc(sizeof(char)*20); - sprintf(angle_str, "(%.2f °)", angle * 180/3.1415 ); + sprintf(angle_str, "%.2f °", angle * 180/3.1415 ); SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, motion_dt + desktop->w2d(Geom::Point(50,0)), angle_str); sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); + sp_canvastext_set_rgba32 (SP_CANVASTEXT(canvas_tooltip), 0x337f33ff, 0xffffffff); measure_tmp_items.push_back(desktop->add_temporary_canvasitem(canvas_tooltip, 0)); free(angle_str); -- cgit v1.2.3 From b7ca7be174c5b81b147d68425f1fa275fa154dd7 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Mon, 13 Jun 2011 04:13:27 -0300 Subject: fixing the measure tool cursor to have a crosshair just like all other drawing tools fixes bug #796446 (bzr r10293) --- src/measure-context.cpp | 4 +-- src/pixmaps/cursor-measure.xpm | 58 +++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index c8046049e..371ac3356 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -89,8 +89,8 @@ static void sp_measure_context_init (SPMeasureContext *measure_context) SPEventContext *event_context = SP_EVENT_CONTEXT(measure_context); event_context->cursor_shape = cursor_measure_xpm; - event_context->hot_x = 3; - event_context->hot_y = 5; + event_context->hot_x = 4; + event_context->hot_y = 4; } static void diff --git a/src/pixmaps/cursor-measure.xpm b/src/pixmaps/cursor-measure.xpm index 753bfd14e..2a28579c6 100644 --- a/src/pixmaps/cursor-measure.xpm +++ b/src/pixmaps/cursor-measure.xpm @@ -1,37 +1,37 @@ /* XPM */ -static char const * cursor_measure_xpm[] = { +static char const *cursor_measure_xpm[] = { "32 32 3 1", " c None", ". c #FFFFFF", "+ c #000000", -" .. ", -" .++. ", -" .+..+. ", -" .+....+. ", -".+..+...+. ", -".+.+.....+. ", -" .+.......+. ", -" .+.+.....+. ", -" .+...+...+. ", -" .+.+.....+. ", -" .+.......+. ", -" .+.+.....+. ", -" .+...+...+. ", -" .+.+.....+. ", -" .+.......+. ", -" .+.+.....+. ", -" .+...+.+. ", -" .+.+.+. ", -" .+.+. ", -" .+. ", -" . ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", +" ... ", +" .+. ", +" .+. ", +"....+.... ", +".+++ +++. ", +"....+.... ", +" .+. ", +" .+. .. ", +" ... .++. ", +" .+..+. ", +" .+....+. ", +" .+..+...+. ", +" .+.+.....+. ", +" .+.......+. ", +" .+.+.....+. ", +" .+...+...+. ", +" .+.+.....+. ", +" .+.......+. ", +" .+.+.....+. ", +" .+...+...+. ", +" .+.+.....+. ", +" .+.......+. ", +" .+.+.....+. ", +" .+...+.+. ", +" .+.+.+. ", +" .+.+. ", +" .+. ", +" . ", " ", " ", " ", -- cgit v1.2.3 From ab46fa7f924696faa9e4876d685006ed669ae34d Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 18:13:23 +0000 Subject: cmake: - remove hard coded include and libraries. - remove gtk/imagemagic modules (use cmakes). (bzr r10294) --- src/CMakeLists.txt | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7fa4e86e8..afb65f955 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -592,16 +592,6 @@ target_link_libraries(inkscape 2geom_LIB ${INKSCAPE_LIBS} - - # system libs - -lgsl # needed - -lgslcblas # needed - -lgtkmm-2.4 - -lgdkmm-2.4 - -lpangomm-1.4 - -lsigc-2.0 - -lMagick++ - -lMagickCore ) # TODO -- cgit v1.2.3 From a36b851b6d1ef714b228474af87e1307be1cdce9 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Mon, 13 Jun 2011 05:25:08 -0300 Subject: adding preferences page for Measure Tool with option (enabled by default) to ignore first and last points when calculating/displaying distances (bzr r10295) --- src/measure-context.cpp | 22 +++++++++++++++++----- src/ui/dialog/inkscape-preferences.cpp | 6 ++++++ src/ui/dialog/inkscape-preferences.h | 2 ++ 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 371ac3356..a4e81475e 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -213,7 +213,12 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv GSList *l; int counter=0; std::vector<Geom::Point> intersections; - intersections.push_back(desktop->dt2doc(start_point)); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool ignore_1st_and_last = prefs->getBool("/tools/measure/ignore_1st_and_last", true); + + if (!ignore_1st_and_last){ + intersections.push_back(desktop->dt2doc(start_point)); + } for (l = items; l != NULL; l = l->next){ item = (SPItem*) (l->data); @@ -253,10 +258,15 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } //g_free(repr); } - intersections.push_back(desktop->dt2doc(motion_dt)); + + if (!ignore_1st_and_last){ + intersections.push_back(desktop->dt2doc(motion_dt)); + } //sort intersections - std::sort(intersections.begin(), intersections.end(), GeomPointSortPredicate); + if (intersections.size()>2){ + std::sort(intersections.begin(), intersections.end(), GeomPointSortPredicate); + } unsigned int idx; for (idx=0; idx<measure_tmp_items.size(); idx++){ @@ -282,10 +292,12 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double fontsize = prefs->getInt("/tools/measure/fontsize"); - Geom::Point previous_point = intersections[0]; + Geom::Point previous_point; + if (intersections.size()>0) + previous_point = intersections[0]; + for (idx=1; idx < intersections.size(); idx++){ Geom::Point measure_text_pos = (previous_point + intersections[idx])/2; //TODO: shift label a few pixels in the y coordinate diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 447e50831..b8b86fac1 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -480,6 +480,12 @@ void InkscapePreferences::initPageTools() AddSelcueCheckbox(_page_zoom, "/tools/zoom", true); AddGradientCheckbox(_page_zoom, "/tools/zoom", false); + //Measure + this->AddPage(_page_measure, _("Measure"), iter_tools, PREFS_PAGE_TOOLS_MEASURE); + PrefCheckButton* cb = Gtk::manage( new PrefCheckButton); + cb->init ( _("Ignore first and last points"), "/tools/measure/ignore_1st_and_last", true); + _page_measure.add_line( false, "", *cb, "", _("The beggining and end of the measurement tool's control line will not be considered for calculating lengths. Only lengths between actual curve intersections will be displayed.")); + //Shapes Gtk::TreeModel::iterator iter_shapes = this->AddPage(_page_shapes, _("Shapes"), iter_tools, PREFS_PAGE_TOOLS_SHAPES); _path_shapes = _page_list.get_model()->get_path(iter_shapes); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 34bf1e87a..9e51fbf0a 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -141,6 +141,7 @@ protected: UI::Widget::DialogPage _page_tweak; UI::Widget::DialogPage _page_spray; UI::Widget::DialogPage _page_zoom; + UI::Widget::DialogPage _page_measure; UI::Widget::DialogPage _page_shapes; UI::Widget::DialogPage _page_pencil; UI::Widget::DialogPage _page_pen; @@ -372,6 +373,7 @@ protected: static void AddSelcueCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value); static void AddGradientCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value); static void AddConvertGuidesCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value); + static void AddFirstAndLastCheckbox(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, bool def_value); static void AddDotSizeSpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value); static void AddNewObjectsStyle(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL); -- cgit v1.2.3 From 5f20daab880e8b496faf8a00aa3707ba3beb3b1a Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 18:35:43 +0000 Subject: cmake: fix for install target (bzr r10296) --- src/CMakeLists.txt | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index afb65f955..d048eaa87 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -599,50 +599,3 @@ target_link_libraries(inkscape #add_executable(inkview inkview.cpp) # ... - -# ----------------------------------------------------------------------------- -# Installation -# ----------------------------------------------------------------------------- - -if(UNIX) - # TODO: man, locale, icons - - # message after building. - add_custom_command( - TARGET blender POST_BUILD MAIN_DEPENDENCY blender - COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${CMAKE_INSTALL_PREFIX}' - ) - - install( - PROGRAMS inkscape - DESTINATION ${CMAKE_INSTALL_PREFIX}/bin - ) - - install( - FILES ${CMAKE_SOURCE_DIR}/inkscape.desktop - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications - ) - - install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/share/clipart - ${CMAKE_SOURCE_DIR}/share/examples - ${CMAKE_SOURCE_DIR}/share/extensions - ${CMAKE_SOURCE_DIR}/share/filters - ${CMAKE_SOURCE_DIR}/share/fonts - ${CMAKE_SOURCE_DIR}/share/gradients - ${CMAKE_SOURCE_DIR}/share/icons - ${CMAKE_SOURCE_DIR}/share/keys - ${CMAKE_SOURCE_DIR}/share/markers - ${CMAKE_SOURCE_DIR}/share/palettes - ${CMAKE_SOURCE_DIR}/share/patterns - ${CMAKE_SOURCE_DIR}/share/screens - ${CMAKE_SOURCE_DIR}/share/templates - ${CMAKE_SOURCE_DIR}/share/tutorials - ${CMAKE_SOURCE_DIR}/share/ui - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/inkscape - ) - -else() - # TODO, WIN32/APPLE -endif() -- cgit v1.2.3 From 4f20cb327f420917d761b0fa41e50cb9d4eb1a19 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Mon, 13 Jun 2011 21:59:45 +0000 Subject: cmake: - added option WITH_DBUS (currently uses hard coded paths) - remove duplicate version variable. (bzr r10297) --- src/extension/CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 2c3c9ab83..8a1ba37dc 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -221,5 +221,22 @@ if(WIN32) ) endif() +if(WITH_DBUS) + list(APPEND extension_SRC + dbus/application-interface.cpp + dbus/dbus-init.cpp + dbus/document-interface.cpp + + # ------ + # Header + dbus/application-interface.h + dbus/dbus-init.h + dbus/document-interface.h + dbus/wrapper/inkscape-dbus-wrapper.h + ) + + include_directories(dbus) +endif() + # add_inkscape_lib(extension_LIB "${extension_SRC}") add_inkscape_source("${extension_SRC}") -- cgit v1.2.3 From d8f262a5fba55b24449ffa312bdcda3623e10ac8 Mon Sep 17 00:00:00 2001 From: Josh Andler <scislac@gmail.com> Date: Tue, 14 Jun 2011 10:58:01 -0700 Subject: patch for 771738, 635469, 700298, 705382, 716057 by Gellule (bzr r10301) --- src/libavoid/orthogonal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libavoid/orthogonal.cpp b/src/libavoid/orthogonal.cpp index 4a7b0af2d..e0a30b246 100644 --- a/src/libavoid/orthogonal.cpp +++ b/src/libavoid/orthogonal.cpp @@ -1731,7 +1731,7 @@ static void buildOrthogonalChannelInfo(Router *router, Polygon& displayRoute = (*curr)->displayRoute(); // Determine all line segments that we are interested in shifting. // We don't consider the first or last segment of a path. - for (size_t i = 1; i < displayRoute.size(); ++i) + for (size_t i = 1; i < displayRoute.size()-1; ++i) { if (displayRoute.ps[i - 1][dim] == displayRoute.ps[i][dim]) { -- cgit v1.2.3 From c64a07e4e76524cebf777837cdf78b8e3de9092a Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Tue, 14 Jun 2011 17:28:34 -0300 Subject: toggle units in the measure tool (bzr r10302) --- src/measure-context.cpp | 12 +++++++++--- src/widgets/toolbox.cpp | 21 ++++++++++++++++++++- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index a4e81475e..78bfb1cee 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -11,7 +11,7 @@ #include <gdk/gdkkeysyms.h> - +#include "helper/units.h" #include "macros.h" #include "display/curve.h" #include "sp-shape.h" @@ -292,6 +292,9 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } + SPUnitId unitid = static_cast<SPUnitId>(prefs->getInt("/tools/measure/unitid", SP_UNIT_PX)); + SPUnit unit = sp_unit_get_by_id(unitid); + double fontsize = prefs->getInt("/tools/measure/fontsize"); Geom::Point previous_point; @@ -302,8 +305,11 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv Geom::Point measure_text_pos = (previous_point + intersections[idx])/2; //TODO: shift label a few pixels in the y coordinate + double lengthval = (intersections[idx] - previous_point).length(); + sp_convert_distance(&lengthval, &sp_unit_get_by_id(SP_UNIT_PX), &unit); + char* measure_str = (char*) malloc(sizeof(char)*20); - sprintf(measure_str, "%.2f", (intersections[idx] - previous_point).length()); + sprintf(measure_str, "%.2f %s", lengthval, unit.abbr); SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, desktop->dt2doc(measure_text_pos), measure_str); sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); @@ -315,7 +321,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv char* angle_str = (char*) malloc(sizeof(char)*20); sprintf(angle_str, "%.2f °", angle * 180/3.1415 ); - SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, motion_dt + desktop->w2d(Geom::Point(50,0)), angle_str); + SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, motion_dt + desktop->w2d(Geom::Point(5*fontsize,0)), angle_str); sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); sp_canvastext_set_rgba32 (SP_CANVASTEXT(canvas_tooltip), 0x337f33ff, 0xffffffff); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 122c014eb..30fb753de 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -367,6 +367,7 @@ static gchar const * ui_descr = " <toolbar name='MeasureToolbar'>" " <toolitem action='MeasureFontSizeAction' />" + " <toolitem action='MeasureUnitsAction' />" " </toolbar>" " <toolbar name='StarToolbar'>" @@ -1642,10 +1643,21 @@ sp_measure_fontsize_value_changed(GtkAdjustment *adj, GObject *tbl) } } +static void measure_unit_changed(GtkAction* /*act*/, GObject* tbl) +{ + UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(tbl, "tracker")); + SPUnit const *unit = tracker->getActiveUnit(); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt("/tools/measure/unitid", unit->unit_id); +} static void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObject* holder) { - EgeAdjustmentAction* eact = 0; + UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE ); + tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units ); + g_object_set_data( holder, "tracker", tracker ); + + EgeAdjustmentAction *eact = 0; /* Font Size */ { @@ -1659,6 +1671,13 @@ static void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainAct sp_measure_fontsize_value_changed); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } + + // add the units menu + { + GtkAction* act = tracker->createAction( "MeasureUnitsAction", _("Units"), _("Units:") ); + g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(measure_unit_changed), (GObject*)holder ); + gtk_action_group_add_action( mainActions, act ); + } } // end of sp_measure_toolbox_prep() void ToolboxFactory::setToolboxDesktop(GtkWidget *toolbox, SPDesktop *desktop) -- cgit v1.2.3 From 14d03386c171fca906cb3e08e713a85c091f94c4 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" <jbc.engelen@swissonline.ch> Date: Tue, 14 Jun 2011 23:30:29 +0200 Subject: shift+ctrl dragging a guideline: fix to snap to angles with original angle as offset, like rotating normal objects (bzr r10303) --- src/desktop-events.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index b7b7529a1..a0ceb77e3 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -17,6 +17,7 @@ #include <map> #include <string> #include <2geom/line.h> +#include <2geom/angle.h> #include <glibmm/i18n.h> #include "desktop.h" @@ -314,16 +315,18 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) case SP_DRAG_ROTATE: { Geom::Point pt = motion_dt - guide->point_on_line; - double angle = std::atan2(pt[Geom::Y], pt[Geom::X]); + Geom::Angle angle(pt); if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); if (snaps) { - double sections = floor(angle * snaps / M_PI + .5); - angle = (M_PI / snaps) * sections; + Geom::Angle orig_angle(guide->normal_to_line); + Geom::Angle snap_angle = angle - orig_angle; + double sections = floor(snap_angle.radians0() * snaps / M_PI + .5); + angle = (M_PI / snaps) * sections + orig_angle.radians0(); } } - sp_guide_set_normal(*guide, Geom::Point(1,0) * Geom::Rotate(angle + M_PI_2), false); + sp_guide_set_normal(*guide, Geom::Point::polar(angle).cw(), false); break; } case SP_DRAG_MOVE_ORIGIN: @@ -380,16 +383,18 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) case SP_DRAG_ROTATE: { Geom::Point pt = event_dt - guide->point_on_line; - double angle = std::atan2(pt[Geom::Y], pt[Geom::X]); - if (event->motion.state & GDK_CONTROL_MASK) { + Geom::Angle angle(pt); + if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); if (snaps) { - double sections = floor(angle * snaps / M_PI + .5); - angle = (M_PI / snaps) * sections; + Geom::Angle orig_angle(guide->normal_to_line); + Geom::Angle snap_angle = angle - orig_angle; + double sections = floor(snap_angle.radians0() * snaps / M_PI + .5); + angle = (M_PI / snaps) * sections + orig_angle.radians0(); } } - sp_guide_set_normal(*guide, Geom::Point(1,0) * Geom::Rotate(angle + M_PI_2), true); + sp_guide_set_normal(*guide, Geom::Point::polar(angle).cw(), true); break; } case SP_DRAG_MOVE_ORIGIN: -- cgit v1.2.3 From c8fae874884858fb54c05015c72f6f551591d0f9 Mon Sep 17 00:00:00 2001 From: Alex Valavanis <valavanisalex@gmail.com> Date: Tue, 14 Jun 2011 22:34:06 +0100 Subject: Remove deprecated glib macro wrappers (bzr r10302.1.1) --- src/arc-context.h | 8 ++++---- src/box3d-context.h | 8 ++++---- src/common-context.h | 8 ++++---- src/display/canvas-arena.h | 8 ++++---- src/display/canvas-bpath.h | 8 ++++---- src/display/canvas-grid.h | 8 ++++---- src/display/canvas-text.h | 4 ++-- src/display/gnome-canvas-acetate.h | 8 ++++---- src/display/guideline.h | 4 ++-- src/display/sodipodi-ctrl.h | 8 ++++---- src/display/sodipodi-ctrlrect.h | 8 ++++---- src/display/sp-canvas-group.h | 4 ++-- src/display/sp-canvas-item.h | 6 +++--- src/display/sp-canvas.h | 4 ++-- src/display/sp-ctrlline.h | 4 ++-- src/display/sp-ctrlpoint.h | 4 ++-- src/display/sp-ctrlquadr.h | 4 ++-- src/draw-context.h | 8 ++++---- src/dropper-context.h | 4 ++-- src/dyna-draw-context.h | 8 ++++---- src/eraser-context.h | 8 ++++---- src/flood-context.h | 8 ++++---- src/gradient-context.h | 8 ++++---- src/helper/unit-menu.h | 8 ++++---- src/inkscape-private.h | 8 ++++---- src/libgdl/gdl-dock-bar.h | 10 +++++----- src/libgdl/gdl-dock-item-grip.h | 10 +++++----- src/libgdl/gdl-dock-item.h | 10 +++++----- src/libgdl/gdl-dock-master.h | 10 +++++----- src/libgdl/gdl-dock-notebook.h | 10 +++++----- src/libgdl/gdl-dock-object.h | 10 +++++----- src/libgdl/gdl-dock-paned.h | 10 +++++----- src/libgdl/gdl-dock-placeholder.h | 10 +++++----- src/libgdl/gdl-dock-tablabel.h | 10 +++++----- src/libgdl/gdl-dock.h | 10 +++++----- src/lpe-tool-context.h | 8 ++++---- src/measure-context.h | 4 ++-- src/rect-context.h | 8 ++++---- src/select-context.h | 8 ++++---- src/sp-pattern.h | 8 ++++---- src/spiral-context.h | 8 ++++---- src/spray-context.h | 8 ++++---- src/star-context.h | 8 ++++---- src/svg-view-widget.h | 8 ++++---- src/text-context.h | 8 ++++---- src/tweak-context.h | 8 ++++---- src/ui/tool/node-tool.h | 8 ++++---- src/ui/view/view-widget.h | 8 ++++---- src/widgets/button.h | 4 ++-- src/widgets/desktop-widget.h | 8 ++++---- src/widgets/font-selector.h | 8 ++++---- src/widgets/gradient-image.h | 8 ++++---- src/widgets/gradient-selector.h | 8 ++++---- src/widgets/gradient-vector.h | 8 ++++---- src/widgets/icon.h | 4 ++-- src/widgets/paint-selector.h | 8 ++++---- src/widgets/ruler.h | 12 ++++++------ src/widgets/sp-attribute-widget.h | 16 ++++++++-------- src/widgets/sp-color-gtkselector.h | 8 ++++---- src/widgets/sp-color-icc-selector.h | 8 ++++---- src/widgets/sp-color-notebook.h | 8 ++++---- src/widgets/sp-color-preview.h | 8 ++++---- src/widgets/sp-color-scales.h | 8 ++++---- src/widgets/sp-color-selector.h | 8 ++++---- src/widgets/sp-color-slider.h | 8 ++++---- src/widgets/sp-color-wheel-selector.h | 8 ++++---- src/widgets/sp-widget.h | 8 ++++---- src/widgets/sp-xmlview-attr-list.h | 6 +++--- src/widgets/sp-xmlview-content.h | 6 +++--- src/widgets/sp-xmlview-tree.h | 6 +++--- src/zoom-context.h | 4 ++-- 71 files changed, 272 insertions(+), 272 deletions(-) (limited to 'src') diff --git a/src/arc-context.h b/src/arc-context.h index 3ed4478ba..ddce10801 100644 --- a/src/arc-context.h +++ b/src/arc-context.h @@ -22,10 +22,10 @@ #include "event-context.h" #define SP_TYPE_ARC_CONTEXT (sp_arc_context_get_type()) -#define SP_ARC_CONTEXT(obj) (GTK_CHECK_CAST((obj), SP_TYPE_ARC_CONTEXT, SPArcContext)) -#define SP_ARC_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), SP_TYPE_ARC_CONTEXT, SPArcContextClass)) -#define SP_IS_ARC_CONTEXT(obj) (GTK_CHECK_TYPE((obj), SP_TYPE_ARC_CONTEXT)) -#define SP_IS_ARC_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), SP_TYPE_ARC_CONTEXT)) +#define SP_ARC_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_ARC_CONTEXT, SPArcContext)) +#define SP_ARC_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_ARC_CONTEXT, SPArcContextClass)) +#define SP_IS_ARC_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_ARC_CONTEXT)) +#define SP_IS_ARC_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_ARC_CONTEXT)) class SPArcContext; class SPArcContextClass; diff --git a/src/box3d-context.h b/src/box3d-context.h index 4b8435d74..74d244423 100644 --- a/src/box3d-context.h +++ b/src/box3d-context.h @@ -22,10 +22,10 @@ #include "vanishing-point.h" #define SP_TYPE_BOX3D_CONTEXT (sp_box3d_context_get_type ()) -#define SP_BOX3D_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_BOX3D_CONTEXT, Box3DContext)) -#define SP_BOX3D_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D_CONTEXT, Box3DContextClass)) -#define SP_IS_BOX3D_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_BOX3D_CONTEXT)) -#define SP_IS_BOX3D_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D_CONTEXT)) +#define SP_BOX3D_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_BOX3D_CONTEXT, Box3DContext)) +#define SP_BOX3D_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_BOX3D_CONTEXT, Box3DContextClass)) +#define SP_IS_BOX3D_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_BOX3D_CONTEXT)) +#define SP_IS_BOX3D_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_BOX3D_CONTEXT)) class Box3DContext; class Box3DContextClass; diff --git a/src/common-context.h b/src/common-context.h index 74b6bbaef..ae0f398b2 100644 --- a/src/common-context.h +++ b/src/common-context.h @@ -24,10 +24,10 @@ #include <2geom/point.h> #define SP_TYPE_COMMON_CONTEXT (sp_common_context_get_type()) -#define SP_COMMON_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_COMMON_CONTEXT, SPCommonContext)) -#define SP_COMMON_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_COMMON_CONTEXT, SPCommonContextClass)) -#define SP_IS_COMMON_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_COMMON_CONTEXT)) -#define SP_IS_COMMON_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_COMMON_CONTEXT)) +#define SP_COMMON_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_COMMON_CONTEXT, SPCommonContext)) +#define SP_COMMON_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_COMMON_CONTEXT, SPCommonContextClass)) +#define SP_IS_COMMON_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_COMMON_CONTEXT)) +#define SP_IS_COMMON_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_COMMON_CONTEXT)) class SPCommonContext; class SPCommonContextClass; diff --git a/src/display/canvas-arena.h b/src/display/canvas-arena.h index 7267583f0..90be5f9e3 100644 --- a/src/display/canvas-arena.h +++ b/src/display/canvas-arena.h @@ -19,10 +19,10 @@ G_BEGIN_DECLS #define SP_TYPE_CANVAS_ARENA (sp_canvas_arena_get_type ()) -#define SP_CANVAS_ARENA(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_CANVAS_ARENA, SPCanvasArena)) -#define SP_CANVAS_ARENA_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_CANVAS_ARENA, SPCanvasArenaClass)) -#define SP_IS_CANVAS_ARENA(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CANVAS_ARENA)) -#define SP_IS_CANVAS_ARENA_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_CANVAS_ARENA)) +#define SP_CANVAS_ARENA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CANVAS_ARENA, SPCanvasArena)) +#define SP_CANVAS_ARENA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CANVAS_ARENA, SPCanvasArenaClass)) +#define SP_IS_CANVAS_ARENA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CANVAS_ARENA)) +#define SP_IS_CANVAS_ARENA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CANVAS_ARENA)) typedef struct _SPCanvasArena SPCanvasArena; typedef struct _SPCanvasArenaClass SPCanvasArenaClass; diff --git a/src/display/canvas-bpath.h b/src/display/canvas-bpath.h index 7f8b75dfe..ad19797c2 100644 --- a/src/display/canvas-bpath.h +++ b/src/display/canvas-bpath.h @@ -25,10 +25,10 @@ struct SPCanvasGroup; struct SPCurve; #define SP_TYPE_CANVAS_BPATH (sp_canvas_bpath_get_type ()) -#define SP_CANVAS_BPATH(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_CANVAS_BPATH, SPCanvasBPath)) -#define SP_CANVAS_BPATH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_CANVAS_BPATH, SPCanvasBPathClass)) -#define SP_IS_CANVAS_BPATH(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CANVAS_BPATH)) -#define SP_IS_CANVAS_BPATH_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_CANVAS_BPATH)) +#define SP_CANVAS_BPATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CANVAS_BPATH, SPCanvasBPath)) +#define SP_CANVAS_BPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CANVAS_BPATH, SPCanvasBPathClass)) +#define SP_IS_CANVAS_BPATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CANVAS_BPATH)) +#define SP_IS_CANVAS_BPATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CANVAS_BPATH)) #define bpath_liv diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index f386fe05e..f42fecad7 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -39,10 +39,10 @@ enum GridType { #define GRID_MAXTYPENR 1 #define INKSCAPE_TYPE_GRID_CANVASITEM (Inkscape::grid_canvasitem_get_type ()) -#define INKSCAPE_GRID_CANVASITEM(obj) (GTK_CHECK_CAST ((obj), INKSCAPE_TYPE_GRID_CANVASITEM, GridCanvasItem)) -#define INKSCAPE_GRID_CANVASITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), INKSCAPE_TYPE_GRID_CANVASITEM, GridCanvasItem)) -#define INKSCAPE_IS_GRID_CANVASITEM(obj) (GTK_CHECK_TYPE ((obj), INKSCAPE_TYPE_GRID_CANVASITEM)) -#define INKSCAPE_IS_GRID_CANVASITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), INKSCAPE_TYPE_GRID_CANVASITEM)) +#define INKSCAPE_GRID_CANVASITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INKSCAPE_TYPE_GRID_CANVASITEM, GridCanvasItem)) +#define INKSCAPE_GRID_CANVASITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INKSCAPE_TYPE_GRID_CANVASITEM, GridCanvasItem)) +#define INKSCAPE_IS_GRID_CANVASITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INKSCAPE_TYPE_GRID_CANVASITEM)) +#define INKSCAPE_IS_GRID_CANVASITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INKSCAPE_TYPE_GRID_CANVASITEM)) class CanvasGrid; diff --git a/src/display/canvas-text.h b/src/display/canvas-text.h index 9a6a93eb4..a621e655c 100644 --- a/src/display/canvas-text.h +++ b/src/display/canvas-text.h @@ -20,8 +20,8 @@ struct SPItem; struct SPDesktop; #define SP_TYPE_CANVASTEXT (sp_canvastext_get_type ()) -#define SP_CANVASTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_CANVASTEXT, SPCanvasText)) -#define SP_IS_CANVASTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CANVASTEXT)) +#define SP_CANVASTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CANVASTEXT, SPCanvasText)) +#define SP_IS_CANVASTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CANVASTEXT)) struct SPCanvasText : public SPCanvasItem { SPItem *item; // the item to which this line belongs in some sense; may be NULL for some users diff --git a/src/display/gnome-canvas-acetate.h b/src/display/gnome-canvas-acetate.h index 8c284291c..756c663ca 100644 --- a/src/display/gnome-canvas-acetate.h +++ b/src/display/gnome-canvas-acetate.h @@ -20,10 +20,10 @@ #define GNOME_TYPE_CANVAS_ACETATE (sp_canvas_acetate_get_type ()) -#define SP_CANVAS_ACETATE(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_ACETATE, SPCanvasAcetate)) -#define SP_CANVAS_ACETATE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_ACETATE, SPCanvasAcetateClass)) -#define GNOME_IS_CANVAS_ACETATE(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_ACETATE)) -#define GNOME_IS_CANVAS_ACETATE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_ACETATE)) +#define SP_CANVAS_ACETATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_ACETATE, SPCanvasAcetate)) +#define SP_CANVAS_ACETATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_ACETATE, SPCanvasAcetateClass)) +#define GNOME_IS_CANVAS_ACETATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_ACETATE)) +#define GNOME_IS_CANVAS_ACETATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_ACETATE)) struct SPCanvasAcetate { diff --git a/src/display/guideline.h b/src/display/guideline.h index dfc3b7007..a3966f76f 100644 --- a/src/display/guideline.h +++ b/src/display/guideline.h @@ -18,8 +18,8 @@ #include "sp-canvas-item.h" #define SP_TYPE_GUIDELINE (sp_guideline_get_type()) -#define SP_GUIDELINE(o) (GTK_CHECK_CAST((o), SP_TYPE_GUIDELINE, SPGuideLine)) -#define SP_IS_GUIDELINE(o) (GTK_CHECK_TYPE((o), SP_TYPE_GUIDELINE)) +#define SP_GUIDELINE(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_GUIDELINE, SPGuideLine)) +#define SP_IS_GUIDELINE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_GUIDELINE)) class SPCtrlPoint; diff --git a/src/display/sodipodi-ctrl.h b/src/display/sodipodi-ctrl.h index c3b97cbe0..71061b450 100644 --- a/src/display/sodipodi-ctrl.h +++ b/src/display/sodipodi-ctrl.h @@ -14,10 +14,10 @@ #define SP_TYPE_CTRL (sp_ctrl_get_type ()) -#define SP_CTRL(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_CTRL, SPCtrl)) -#define SP_CTRL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_CTRL, SPCtrlClass)) -#define SP_IS_CTRL(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CTRL)) -#define SP_IS_CTRL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_CTRL)) +#define SP_CTRL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRL, SPCtrl)) +#define SP_CTRL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_CTRL, SPCtrlClass)) +#define SP_IS_CTRL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRL)) +#define SP_IS_CTRL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CTRL)) typedef enum { SP_CTRL_SHAPE_SQUARE, diff --git a/src/display/sodipodi-ctrlrect.h b/src/display/sodipodi-ctrlrect.h index 2ba73a4c9..945deabc4 100644 --- a/src/display/sodipodi-ctrlrect.h +++ b/src/display/sodipodi-ctrlrect.h @@ -23,10 +23,10 @@ struct SPCanvasBuf; #define SP_TYPE_CTRLRECT (sp_ctrlrect_get_type ()) -#define SP_CTRLRECT(obj) (GTK_CHECK_CAST((obj), SP_TYPE_CTRLRECT, CtrlRect)) -#define SP_CTRLRECT_CLASS(c) (GTK_CHECK_CLASS_CAST((c), SP_TYPE_CTRLRECT, SPCtrlRectClass)) -#define SP_IS_CTRLRECT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CTRLRECT)) -#define SP_IS_CTRLRECT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_CTRLRECT)) +#define SP_CTRLRECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CTRLRECT, CtrlRect)) +#define SP_CTRLRECT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST((c), SP_TYPE_CTRLRECT, SPCtrlRectClass)) +#define SP_IS_CTRLRECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLRECT)) +#define SP_IS_CTRLRECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CTRLRECT)) class CtrlRect : public SPCanvasItem { diff --git a/src/display/sp-canvas-group.h b/src/display/sp-canvas-group.h index 10bf0fa6c..354d389b7 100644 --- a/src/display/sp-canvas-group.h +++ b/src/display/sp-canvas-group.h @@ -24,8 +24,8 @@ #include <glib-object.h> #define SP_TYPE_CANVAS_GROUP (sp_canvas_group_get_type()) -#define SP_CANVAS_GROUP(obj) (GTK_CHECK_CAST((obj), SP_TYPE_CANVAS_GROUP, SPCanvasGroup)) -#define SP_IS_CANVAS_GROUP(obj) (GTK_CHECK_TYPE((obj), SP_TYPE_CANVAS_GROUP)) +#define SP_CANVAS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CANVAS_GROUP, SPCanvasGroup)) +#define SP_IS_CANVAS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CANVAS_GROUP)) GType sp_canvas_group_get_type(); diff --git a/src/display/sp-canvas-item.h b/src/display/sp-canvas-item.h index 26e5aa1f6..f62dc34a7 100644 --- a/src/display/sp-canvas-item.h +++ b/src/display/sp-canvas-item.h @@ -36,9 +36,9 @@ struct SPCanvasGroup; typedef struct _SPCanvasItemClass SPCanvasItemClass; #define SP_TYPE_CANVAS_ITEM (sp_canvas_item_get_type()) -#define SP_CANVAS_ITEM(obj) (GTK_CHECK_CAST((obj), SP_TYPE_CANVAS_ITEM, SPCanvasItem)) -#define SP_IS_CANVAS_ITEM(obj) (GTK_CHECK_TYPE((obj), SP_TYPE_CANVAS_ITEM)) -#define SP_CANVAS_ITEM_GET_CLASS(o) (GTK_CHECK_GET_CLASS((o), SP_TYPE_CANVAS_ITEM, SPCanvasItemClass)) +#define SP_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CANVAS_ITEM, SPCanvasItem)) +#define SP_IS_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CANVAS_ITEM)) +#define SP_CANVAS_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), SP_TYPE_CANVAS_ITEM, SPCanvasItemClass)) GType sp_canvas_item_get_type(); diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index a6ddafb1e..e151911dc 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -41,8 +41,8 @@ G_BEGIN_DECLS #define SP_TYPE_CANVAS sp_canvas_get_type() -#define SP_CANVAS(obj) (GTK_CHECK_CAST((obj), SP_TYPE_CANVAS, SPCanvas)) -#define SP_IS_CANVAS(obj) (GTK_CHECK_TYPE((obj), SP_TYPE_CANVAS)) +#define SP_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CANVAS, SPCanvas)) +#define SP_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CANVAS)) GType sp_canvas_get_type(); diff --git a/src/display/sp-ctrlline.h b/src/display/sp-ctrlline.h index e69c478fb..eeed7e75d 100644 --- a/src/display/sp-ctrlline.h +++ b/src/display/sp-ctrlline.h @@ -19,8 +19,8 @@ struct SPItem; #define SP_TYPE_CTRLLINE (sp_ctrlline_get_type ()) -#define SP_CTRLLINE(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_CTRLLINE, SPCtrlLine)) -#define SP_IS_CTRLLINE(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CTRLLINE)) +#define SP_CTRLLINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRLLINE, SPCtrlLine)) +#define SP_IS_CTRLLINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLLINE)) struct SPCtrlLine : public SPCanvasItem{ SPItem *item; // the item to which this line belongs in some sense; may be NULL for some users diff --git a/src/display/sp-ctrlpoint.h b/src/display/sp-ctrlpoint.h index b98d48f67..907f74bf8 100644 --- a/src/display/sp-ctrlpoint.h +++ b/src/display/sp-ctrlpoint.h @@ -17,8 +17,8 @@ struct SPItem; #define SP_TYPE_CTRLPOINT (sp_ctrlpoint_get_type ()) -#define SP_CTRLPOINT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_CTRLPOINT, SPCtrlPoint)) -#define SP_IS_CTRLPOINT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CTRLPOINT)) +#define SP_CTRLPOINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRLPOINT, SPCtrlPoint)) +#define SP_IS_CTRLPOINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLPOINT)) struct SPCtrlPoint : public SPCanvasItem { SPItem *item; // the item to which this line belongs in some sense; may be NULL for some users diff --git a/src/display/sp-ctrlquadr.h b/src/display/sp-ctrlquadr.h index f3c1ced45..9fdfd29b3 100644 --- a/src/display/sp-ctrlquadr.h +++ b/src/display/sp-ctrlquadr.h @@ -17,8 +17,8 @@ #define SP_TYPE_CTRLQUADR (sp_ctrlquadr_get_type ()) -#define SP_CTRLQUADR(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_CTRLQUADR, SPCtrlQuadr)) -#define SP_IS_CTRLQUADR(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_CTRLQUADR)) +#define SP_CTRLQUADR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRLQUADR, SPCtrlQuadr)) +#define SP_IS_CTRLQUADR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLQUADR)) struct SPCtrlQuadr; struct SPCtrlQuadrClass; diff --git a/src/draw-context.h b/src/draw-context.h index 3cad8da06..4266bdea4 100644 --- a/src/draw-context.h +++ b/src/draw-context.h @@ -24,10 +24,10 @@ /* Freehand context */ #define SP_TYPE_DRAW_CONTEXT (sp_draw_context_get_type()) -#define SP_DRAW_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_DRAW_CONTEXT, SPDrawContext)) -#define SP_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_DRAW_CONTEXT, SPDrawContextClass)) -#define SP_IS_DRAW_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_DRAW_CONTEXT)) -#define SP_IS_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_DRAW_CONTEXT)) +#define SP_DRAW_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_DRAW_CONTEXT, SPDrawContext)) +#define SP_DRAW_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_DRAW_CONTEXT, SPDrawContextClass)) +#define SP_IS_DRAW_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_DRAW_CONTEXT)) +#define SP_IS_DRAW_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_DRAW_CONTEXT)) struct SPDrawAnchor; namespace Inkscape diff --git a/src/dropper-context.h b/src/dropper-context.h index f2d18a507..22c6a1cf3 100644 --- a/src/dropper-context.h +++ b/src/dropper-context.h @@ -15,8 +15,8 @@ #include "event-context.h" #define SP_TYPE_DROPPER_CONTEXT (sp_dropper_context_get_type ()) -#define SP_DROPPER_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_DROPPER_CONTEXT, SPDropperContext)) -#define SP_IS_DROPPER_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_DROPPER_CONTEXT)) +#define SP_DROPPER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DROPPER_CONTEXT, SPDropperContext)) +#define SP_IS_DROPPER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_DROPPER_CONTEXT)) class SPDropperContext; class SPDropperContextClass; diff --git a/src/dyna-draw-context.h b/src/dyna-draw-context.h index 9a736a3fc..af63bf653 100644 --- a/src/dyna-draw-context.h +++ b/src/dyna-draw-context.h @@ -22,10 +22,10 @@ #include "splivarot.h" #define SP_TYPE_DYNA_DRAW_CONTEXT (sp_dyna_draw_context_get_type()) -#define SP_DYNA_DRAW_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_DYNA_DRAW_CONTEXT, SPDynaDrawContext)) -#define SP_DYNA_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_DYNA_DRAW_CONTEXT, SPDynaDrawContextClass)) -#define SP_IS_DYNA_DRAW_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_DYNA_DRAW_CONTEXT)) -#define SP_IS_DYNA_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_DYNA_DRAW_CONTEXT)) +#define SP_DYNA_DRAW_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_DYNA_DRAW_CONTEXT, SPDynaDrawContext)) +#define SP_DYNA_DRAW_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_DYNA_DRAW_CONTEXT, SPDynaDrawContextClass)) +#define SP_IS_DYNA_DRAW_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_DYNA_DRAW_CONTEXT)) +#define SP_IS_DYNA_DRAW_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_DYNA_DRAW_CONTEXT)) class SPDynaDrawContext; class SPDynaDrawContextClass; diff --git a/src/eraser-context.h b/src/eraser-context.h index a581acd94..68ed04ad5 100644 --- a/src/eraser-context.h +++ b/src/eraser-context.h @@ -22,10 +22,10 @@ #include "common-context.h" #define SP_TYPE_ERASER_CONTEXT (sp_eraser_context_get_type()) -#define SP_ERASER_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_ERASER_CONTEXT, SPEraserContext)) -#define SP_ERASER_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_ERASER_CONTEXT, SPEraserContextClass)) -#define SP_IS_ERASER_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_ERASER_CONTEXT)) -#define SP_IS_ERASER_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_ERASER_CONTEXT)) +#define SP_ERASER_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_ERASER_CONTEXT, SPEraserContext)) +#define SP_ERASER_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_ERASER_CONTEXT, SPEraserContextClass)) +#define SP_IS_ERASER_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_ERASER_CONTEXT)) +#define SP_IS_ERASER_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_ERASER_CONTEXT)) class SPEraserContext; class SPEraserContextClass; diff --git a/src/flood-context.h b/src/flood-context.h index d9da96010..6847c19be 100644 --- a/src/flood-context.h +++ b/src/flood-context.h @@ -19,10 +19,10 @@ #include "helper/units.h" #define SP_TYPE_FLOOD_CONTEXT (sp_flood_context_get_type ()) -#define SP_FLOOD_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_FLOOD_CONTEXT, SPFloodContext)) -#define SP_FLOOD_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_FLOOD_CONTEXT, SPFloodContextClass)) -#define SP_IS_FLOOD_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_FLOOD_CONTEXT)) -#define SP_IS_FLOOD_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_FLOOD_CONTEXT)) +#define SP_FLOOD_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_FLOOD_CONTEXT, SPFloodContext)) +#define SP_FLOOD_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_FLOOD_CONTEXT, SPFloodContextClass)) +#define SP_IS_FLOOD_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_FLOOD_CONTEXT)) +#define SP_IS_FLOOD_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_FLOOD_CONTEXT)) #define FLOOD_COLOR_CHANNEL_R 1 #define FLOOD_COLOR_CHANNEL_G 2 diff --git a/src/gradient-context.h b/src/gradient-context.h index 3bb9efa15..1ed14cf3f 100644 --- a/src/gradient-context.h +++ b/src/gradient-context.h @@ -20,10 +20,10 @@ #include "event-context.h" #define SP_TYPE_GRADIENT_CONTEXT (sp_gradient_context_get_type()) -#define SP_GRADIENT_CONTEXT(obj) (GTK_CHECK_CAST((obj), SP_TYPE_GRADIENT_CONTEXT, SPGradientContext)) -#define SP_GRADIENT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), SP_TYPE_GRADIENT_CONTEXT, SPGradientContextClass)) -#define SP_IS_GRADIENT_CONTEXT(obj) (GTK_CHECK_TYPE((obj), SP_TYPE_GRADIENT_CONTEXT)) -#define SP_IS_GRADIENT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), SP_TYPE_GRADIENT_CONTEXT)) +#define SP_GRADIENT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_GRADIENT_CONTEXT, SPGradientContext)) +#define SP_GRADIENT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_GRADIENT_CONTEXT, SPGradientContextClass)) +#define SP_IS_GRADIENT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_GRADIENT_CONTEXT)) +#define SP_IS_GRADIENT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_GRADIENT_CONTEXT)) class SPGradientContext; class SPGradientContextClass; diff --git a/src/helper/unit-menu.h b/src/helper/unit-menu.h index 795dda7b7..919873c58 100644 --- a/src/helper/unit-menu.h +++ b/src/helper/unit-menu.h @@ -19,10 +19,10 @@ /* Unit selector Widget */ #define SP_TYPE_UNIT_SELECTOR (sp_unit_selector_get_type()) -#define SP_UNIT_SELECTOR(o) (GTK_CHECK_CAST((o), SP_TYPE_UNIT_SELECTOR, SPUnitSelector)) -#define SP_UNIT_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_UNIT_SELECTOR, SPUnitSelectorClass)) -#define SP_IS_UNIT_SELECTOR(o) (GTK_CHECK_TYPE((o), SP_TYPE_UNIT_SELECTOR)) -#define SP_IS_UNIT_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_UNIT_SELECTOR)) +#define SP_UNIT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_UNIT_SELECTOR, SPUnitSelector)) +#define SP_UNIT_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_UNIT_SELECTOR, SPUnitSelectorClass)) +#define SP_IS_UNIT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_UNIT_SELECTOR)) +#define SP_IS_UNIT_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_UNIT_SELECTOR)) GType sp_unit_selector_get_type(void); diff --git a/src/inkscape-private.h b/src/inkscape-private.h index 2cb83ae76..a6643b989 100644 --- a/src/inkscape-private.h +++ b/src/inkscape-private.h @@ -14,10 +14,10 @@ */ #define SP_TYPE_INKSCAPE (inkscape_get_type ()) -#define SP_INKSCAPE(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_INKSCAPE, Inkscape)) -#define SP_INKSCAPE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_INKSCAPE, InkscapeClass)) -#define SP_IS_INKSCAPE(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_INKSCAPE)) -#define SP_IS_INKSCAPE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_INKSCAPE)) +#define SP_INKSCAPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_INKSCAPE, Inkscape)) +#define SP_INKSCAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_INKSCAPE, InkscapeClass)) +#define SP_IS_INKSCAPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_INKSCAPE)) +#define SP_IS_INKSCAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_INKSCAPE)) #include "forward.h" #include "inkscape.h" diff --git a/src/libgdl/gdl-dock-bar.h b/src/libgdl/gdl-dock-bar.h index c6697a47c..798dded20 100644 --- a/src/libgdl/gdl-dock-bar.h +++ b/src/libgdl/gdl-dock-bar.h @@ -29,11 +29,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_BAR (gdl_dock_bar_get_type ()) -#define GDL_DOCK_BAR(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_BAR, GdlDockBar)) -#define GDL_DOCK_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_BAR, GdlDockBarClass)) -#define GDL_IS_DOCK_BAR(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_BAR)) -#define GDL_IS_DOCK_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_BAR)) -#define GDL_DOCK_BAR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_BAR, GdlDockBarClass)) +#define GDL_DOCK_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_BAR, GdlDockBar)) +#define GDL_DOCK_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_BAR, GdlDockBarClass)) +#define GDL_IS_DOCK_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_BAR)) +#define GDL_IS_DOCK_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_BAR)) +#define GDL_DOCK_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_BAR, GdlDockBarClass)) /* data types & structures */ typedef struct _GdlDockBar GdlDockBar; diff --git a/src/libgdl/gdl-dock-item-grip.h b/src/libgdl/gdl-dock-item-grip.h index 495e9381d..4dfdd7ab3 100644 --- a/src/libgdl/gdl-dock-item-grip.h +++ b/src/libgdl/gdl-dock-item-grip.h @@ -20,15 +20,15 @@ G_BEGIN_DECLS #define GDL_TYPE_DOCK_ITEM_GRIP (gdl_dock_item_grip_get_type()) #define GDL_DOCK_ITEM_GRIP(obj) \ - (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_ITEM_GRIP, GdlDockItemGrip)) + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_ITEM_GRIP, GdlDockItemGrip)) #define GDL_DOCK_ITEM_GRIP_CLASS(klass) \ - (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_ITEM_GRIP, GdlDockItemGripClass)) + (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_ITEM_GRIP, GdlDockItemGripClass)) #define GDL_IS_DOCK_ITEM_GRIP(obj) \ - (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_ITEM_GRIP)) + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_ITEM_GRIP)) #define GDL_IS_DOCK_ITEM_GRIP_CLASS(klass) \ - (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_ITEM_GRIP)) + (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_ITEM_GRIP)) #define GDL_DOCK_ITEM_GRIP_GET_CLASS(obj) \ - (GTK_CHECK_GET_CLASS ((obj), GDL_TYPE_DOCK_ITEM_GRIP, GdlDockItemGripClass)) + (G_TYPE_INSTANCE_GET_CLASS ((obj), GDL_TYPE_DOCK_ITEM_GRIP, GdlDockItemGripClass)) typedef struct _GdlDockItemGrip GdlDockItemGrip; typedef struct _GdlDockItemGripClass GdlDockItemGripClass; diff --git a/src/libgdl/gdl-dock-item.h b/src/libgdl/gdl-dock-item.h index 17484ad04..6c0029d13 100644 --- a/src/libgdl/gdl-dock-item.h +++ b/src/libgdl/gdl-dock-item.h @@ -36,11 +36,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_ITEM (gdl_dock_item_get_type ()) -#define GDL_DOCK_ITEM(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_ITEM, GdlDockItem)) -#define GDL_DOCK_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_ITEM, GdlDockItemClass)) -#define GDL_IS_DOCK_ITEM(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_ITEM)) -#define GDL_IS_DOCK_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_ITEM)) -#define GDL_DOCK_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_ITEM, GdlDockItemClass)) +#define GDL_DOCK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_ITEM, GdlDockItem)) +#define GDL_DOCK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_ITEM, GdlDockItemClass)) +#define GDL_IS_DOCK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_ITEM)) +#define GDL_IS_DOCK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_ITEM)) +#define GDL_DOCK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_ITEM, GdlDockItemClass)) /* data types & structures */ typedef enum { diff --git a/src/libgdl/gdl-dock-master.h b/src/libgdl/gdl-dock-master.h index 1a10405b6..3268e68b5 100644 --- a/src/libgdl/gdl-dock-master.h +++ b/src/libgdl/gdl-dock-master.h @@ -33,11 +33,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_MASTER (gdl_dock_master_get_type ()) -#define GDL_DOCK_MASTER(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_MASTER, GdlDockMaster)) -#define GDL_DOCK_MASTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_MASTER, GdlDockMasterClass)) -#define GDL_IS_DOCK_MASTER(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_MASTER)) -#define GDL_IS_DOCK_MASTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_MASTER)) -#define GDL_DOCK_MASTER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_MASTER, GdlDockMasterClass)) +#define GDL_DOCK_MASTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_MASTER, GdlDockMaster)) +#define GDL_DOCK_MASTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_MASTER, GdlDockMasterClass)) +#define GDL_IS_DOCK_MASTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_MASTER)) +#define GDL_IS_DOCK_MASTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_MASTER)) +#define GDL_DOCK_MASTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_MASTER, GdlDockMasterClass)) /* data types & structures */ typedef struct _GdlDockMaster GdlDockMaster; diff --git a/src/libgdl/gdl-dock-notebook.h b/src/libgdl/gdl-dock-notebook.h index 105da6c8c..063f53642 100644 --- a/src/libgdl/gdl-dock-notebook.h +++ b/src/libgdl/gdl-dock-notebook.h @@ -28,11 +28,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_NOTEBOOK (gdl_dock_notebook_get_type ()) -#define GDL_DOCK_NOTEBOOK(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_NOTEBOOK, GdlDockNotebook)) -#define GDL_DOCK_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_NOTEBOOK, GdlDockNotebookClass)) -#define GDL_IS_DOCK_NOTEBOOK(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_NOTEBOOK)) -#define GDL_IS_DOCK_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_NOTEBOOK)) -#define GDL_DOCK_NOTEBOOK_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_NOTEBOOK, GdlDockNotebookClass)) +#define GDL_DOCK_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_NOTEBOOK, GdlDockNotebook)) +#define GDL_DOCK_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_NOTEBOOK, GdlDockNotebookClass)) +#define GDL_IS_DOCK_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_NOTEBOOK)) +#define GDL_IS_DOCK_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_NOTEBOOK)) +#define GDL_DOCK_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_NOTEBOOK, GdlDockNotebookClass)) /* data types & structures */ typedef struct _GdlDockNotebook GdlDockNotebook; diff --git a/src/libgdl/gdl-dock-object.h b/src/libgdl/gdl-dock-object.h index 684bd043f..6ac36a44c 100644 --- a/src/libgdl/gdl-dock-object.h +++ b/src/libgdl/gdl-dock-object.h @@ -30,11 +30,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_OBJECT (gdl_dock_object_get_type ()) -#define GDL_DOCK_OBJECT(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_OBJECT, GdlDockObject)) -#define GDL_DOCK_OBJECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_OBJECT, GdlDockObjectClass)) -#define GDL_IS_DOCK_OBJECT(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_OBJECT)) -#define GDL_IS_DOCK_OBJECT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_OBJECT)) -#define GDL_DOCK_OBJECT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_OBJECT, GdlDockObjectClass)) +#define GDL_DOCK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_OBJECT, GdlDockObject)) +#define GDL_DOCK_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_OBJECT, GdlDockObjectClass)) +#define GDL_IS_DOCK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_OBJECT)) +#define GDL_IS_DOCK_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_OBJECT)) +#define GDL_DOCK_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_OBJECT, GdlDockObjectClass)) /* data types & structures */ typedef enum { diff --git a/src/libgdl/gdl-dock-paned.h b/src/libgdl/gdl-dock-paned.h index 208c9c422..06b496491 100644 --- a/src/libgdl/gdl-dock-paned.h +++ b/src/libgdl/gdl-dock-paned.h @@ -30,11 +30,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_PANED (gdl_dock_paned_get_type ()) -#define GDL_DOCK_PANED(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_PANED, GdlDockPaned)) -#define GDL_DOCK_PANED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_PANED, GdlDockPanedClass)) -#define GDL_IS_DOCK_PANED(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_PANED)) -#define GDL_IS_DOCK_PANED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_PANED)) -#define GDL_DOCK_PANED_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GDL_TYE_DOCK_PANED, GdlDockPanedClass)) +#define GDL_DOCK_PANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_PANED, GdlDockPaned)) +#define GDL_DOCK_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_PANED, GdlDockPanedClass)) +#define GDL_IS_DOCK_PANED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_PANED)) +#define GDL_IS_DOCK_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_PANED)) +#define GDL_DOCK_PANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDL_TYE_DOCK_PANED, GdlDockPanedClass)) /* data types & structures */ typedef struct _GdlDockPaned GdlDockPaned; diff --git a/src/libgdl/gdl-dock-placeholder.h b/src/libgdl/gdl-dock-placeholder.h index 4a7035b82..aeb55da67 100644 --- a/src/libgdl/gdl-dock-placeholder.h +++ b/src/libgdl/gdl-dock-placeholder.h @@ -30,11 +30,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_PLACEHOLDER (gdl_dock_placeholder_get_type ()) -#define GDL_DOCK_PLACEHOLDER(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_PLACEHOLDER, GdlDockPlaceholder)) -#define GDL_DOCK_PLACEHOLDER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_PLACEHOLDER, GdlDockPlaceholderClass)) -#define GDL_IS_DOCK_PLACEHOLDER(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_PLACEHOLDER)) -#define GDL_IS_DOCK_PLACEHOLDER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_PLACEHOLDER)) -#define GDL_DOCK_PLACEHOLDER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_PLACEHOLDER, GdlDockPlaceholderClass)) +#define GDL_DOCK_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_PLACEHOLDER, GdlDockPlaceholder)) +#define GDL_DOCK_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_PLACEHOLDER, GdlDockPlaceholderClass)) +#define GDL_IS_DOCK_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_PLACEHOLDER)) +#define GDL_IS_DOCK_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_PLACEHOLDER)) +#define GDL_DOCK_PLACEHOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_PLACEHOLDER, GdlDockPlaceholderClass)) /* data types & structures */ typedef struct _GdlDockPlaceholder GdlDockPlaceholder; diff --git a/src/libgdl/gdl-dock-tablabel.h b/src/libgdl/gdl-dock-tablabel.h index 8cf3470eb..b78c1c5c7 100644 --- a/src/libgdl/gdl-dock-tablabel.h +++ b/src/libgdl/gdl-dock-tablabel.h @@ -32,11 +32,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK_TABLABEL (gdl_dock_tablabel_get_type ()) -#define GDL_DOCK_TABLABEL(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_TABLABEL, GdlDockTablabel)) -#define GDL_DOCK_TABLABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_TABLABEL, GdlDockTablabelClass)) -#define GDL_IS_DOCK_TABLABEL(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_TABLABEL)) -#define GDL_IS_DOCK_TABLABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_TABLABEL)) -#define GDL_DOCK_TABLABEL_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_TABLABEL, GdlDockTablabelClass)) +#define GDL_DOCK_TABLABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK_TABLABEL, GdlDockTablabel)) +#define GDL_DOCK_TABLABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_TABLABEL, GdlDockTablabelClass)) +#define GDL_IS_DOCK_TABLABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK_TABLABEL)) +#define GDL_IS_DOCK_TABLABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_TABLABEL)) +#define GDL_DOCK_TABLABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_TABLABEL, GdlDockTablabelClass)) /* data types & structures */ typedef struct _GdlDockTablabel GdlDockTablabel; diff --git a/src/libgdl/gdl-dock.h b/src/libgdl/gdl-dock.h index 7508feef7..2259d395d 100644 --- a/src/libgdl/gdl-dock.h +++ b/src/libgdl/gdl-dock.h @@ -31,11 +31,11 @@ G_BEGIN_DECLS /* standard macros */ #define GDL_TYPE_DOCK (gdl_dock_get_type ()) -#define GDL_DOCK(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK, GdlDock)) -#define GDL_DOCK_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK, GdlDockClass)) -#define GDL_IS_DOCK(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK)) -#define GDL_IS_DOCK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK)) -#define GDL_DOCK_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK, GdlDockClass)) +#define GDL_DOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_DOCK, GdlDock)) +#define GDL_DOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK, GdlDockClass)) +#define GDL_IS_DOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_DOCK)) +#define GDL_IS_DOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK)) +#define GDL_DOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK, GdlDockClass)) /* data types & structures */ typedef struct _GdlDock GdlDock; diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h index 478989e0b..12e4b3838 100644 --- a/src/lpe-tool-context.h +++ b/src/lpe-tool-context.h @@ -19,10 +19,10 @@ #include "helper/units.h" #define SP_TYPE_LPETOOL_CONTEXT (sp_lpetool_context_get_type()) -#define SP_LPETOOL_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_LPETOOL_CONTEXT, SPLPEToolContext)) -#define SP_LPETOOL_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_LPETOOL_CONTEXT, SPLPEToolContextClass)) -#define SP_IS_LPETOOL_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_LPETOOL_CONTEXT)) -#define SP_IS_LPETOOL_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_LPETOOL_CONTEXT)) +#define SP_LPETOOL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_LPETOOL_CONTEXT, SPLPEToolContext)) +#define SP_LPETOOL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_LPETOOL_CONTEXT, SPLPEToolContextClass)) +#define SP_IS_LPETOOL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_LPETOOL_CONTEXT)) +#define SP_IS_LPETOOL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_LPETOOL_CONTEXT)) class SPLPEToolContext; class SPLPEToolContextClass; diff --git a/src/measure-context.h b/src/measure-context.h index f6065b3e6..24cdf5ac8 100644 --- a/src/measure-context.h +++ b/src/measure-context.h @@ -15,8 +15,8 @@ #include "event-context.h" #define SP_TYPE_MEASURE_CONTEXT (sp_measure_context_get_type ()) -#define SP_MEASURE_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_MEASURE_CONTEXT, SPMeasureContext)) -#define SP_IS_MEASURE_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_MEASURE_CONTEXT)) +#define SP_MEASURE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_MEASURE_CONTEXT, SPMeasureContext)) +#define SP_IS_MEASURE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_MEASURE_CONTEXT)) class SPMeasureContext; class SPMeasureContextClass; diff --git a/src/rect-context.h b/src/rect-context.h index 54f790c68..db7cd605b 100644 --- a/src/rect-context.h +++ b/src/rect-context.h @@ -20,10 +20,10 @@ #include "libnr/nr-point.h" #define SP_TYPE_RECT_CONTEXT (sp_rect_context_get_type ()) -#define SP_RECT_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_RECT_CONTEXT, SPRectContext)) -#define SP_RECT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_RECT_CONTEXT, SPRectContextClass)) -#define SP_IS_RECT_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_RECT_CONTEXT)) -#define SP_IS_RECT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_RECT_CONTEXT)) +#define SP_RECT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_RECT_CONTEXT, SPRectContext)) +#define SP_RECT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_RECT_CONTEXT, SPRectContextClass)) +#define SP_IS_RECT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_RECT_CONTEXT)) +#define SP_IS_RECT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_RECT_CONTEXT)) class SPRectContext; class SPRectContextClass; diff --git a/src/select-context.h b/src/select-context.h index 6d12558ca..934892d40 100644 --- a/src/select-context.h +++ b/src/select-context.h @@ -16,10 +16,10 @@ #include <gtk/gtk.h> #define SP_TYPE_SELECT_CONTEXT (sp_select_context_get_type ()) -#define SP_SELECT_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_SELECT_CONTEXT, SPSelectContext)) -#define SP_SELECT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_SELECT_CONTEXT, SPSelectContextClass)) -#define SP_IS_SELECT_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_SELECT_CONTEXT)) -#define SP_IS_SELECT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_SELECT_CONTEXT)) +#define SP_SELECT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SELECT_CONTEXT, SPSelectContext)) +#define SP_SELECT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SELECT_CONTEXT, SPSelectContextClass)) +#define SP_IS_SELECT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SELECT_CONTEXT)) +#define SP_IS_SELECT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SELECT_CONTEXT)) struct SPCanvasItem; class SPSelectContext; diff --git a/src/sp-pattern.h b/src/sp-pattern.h index 141474277..64544b3dc 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -18,10 +18,10 @@ #include "forward.h" #include "sp-item.h" #define SP_TYPE_PATTERN (sp_pattern_get_type ()) -#define SP_PATTERN(o) (GTK_CHECK_CAST ((o), SP_TYPE_PATTERN, SPPattern)) -#define SP_PATTERN_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_PATTERN, SPPatternClass)) -#define SP_IS_PATTERN(o) (GTK_CHECK_TYPE ((o), SP_TYPE_PATTERN)) -#define SP_IS_PATTERN_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_PATTERN)) +#define SP_PATTERN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_PATTERN, SPPattern)) +#define SP_PATTERN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_PATTERN, SPPatternClass)) +#define SP_IS_PATTERN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_PATTERN)) +#define SP_IS_PATTERN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_PATTERN)) GType sp_pattern_get_type (void); diff --git a/src/spiral-context.h b/src/spiral-context.h index 906cf61df..6d689c49c 100644 --- a/src/spiral-context.h +++ b/src/spiral-context.h @@ -22,10 +22,10 @@ #include "libnr/nr-point.h" #define SP_TYPE_SPIRAL_CONTEXT (sp_spiral_context_get_type ()) -#define SP_SPIRAL_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_SPIRAL_CONTEXT, SPSpiralContext)) -#define SP_SPIRAL_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_SPIRAL_CONTEXT, SPSpiralContextClass)) -#define SP_IS_SPIRAL_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_SPIRAL_CONTEXT)) -#define SP_IS_SPIRAL_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_SPIRAL_CONTEXT)) +#define SP_SPIRAL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SPIRAL_CONTEXT, SPSpiralContext)) +#define SP_SPIRAL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SPIRAL_CONTEXT, SPSpiralContextClass)) +#define SP_IS_SPIRAL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SPIRAL_CONTEXT)) +#define SP_IS_SPIRAL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SPIRAL_CONTEXT)) class SPSpiralContext; class SPSpiralContextClass; diff --git a/src/spray-context.h b/src/spray-context.h index c485a6a96..f6d9a9c0b 100644 --- a/src/spray-context.h +++ b/src/spray-context.h @@ -24,10 +24,10 @@ #include "ui/dialog/dialog.h" #define SP_TYPE_SPRAY_CONTEXT (sp_spray_context_get_type()) -#define SP_SPRAY_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_SPRAY_CONTEXT, SPSprayContext)) -#define SP_SPRAY_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_SPRAY_CONTEXT, SPSprayContextClass)) -#define SP_IS_SPRAY_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_SPRAY_CONTEXT)) -#define SP_IS_SPRAY_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_SPRAY_CONTEXT)) +#define SP_SPRAY_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_SPRAY_CONTEXT, SPSprayContext)) +#define SP_SPRAY_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_SPRAY_CONTEXT, SPSprayContextClass)) +#define SP_IS_SPRAY_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_SPRAY_CONTEXT)) +#define SP_IS_SPRAY_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_SPRAY_CONTEXT)) class SPSprayContext; class SPSprayContextClass; diff --git a/src/star-context.h b/src/star-context.h index 3bc8ca386..b66e2dd15 100644 --- a/src/star-context.h +++ b/src/star-context.h @@ -20,10 +20,10 @@ #include "libnr/nr-point.h" #define SP_TYPE_STAR_CONTEXT (sp_star_context_get_type ()) -#define SP_STAR_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_STAR_CONTEXT, SPStarContext)) -#define SP_STAR_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_STAR_CONTEXT, SPStarContextClass)) -#define SP_IS_STAR_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_STAR_CONTEXT)) -#define SP_IS_STAR_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_STAR_CONTEXT)) +#define SP_STAR_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_STAR_CONTEXT, SPStarContext)) +#define SP_STAR_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_STAR_CONTEXT, SPStarContextClass)) +#define SP_IS_STAR_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_STAR_CONTEXT)) +#define SP_IS_STAR_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_STAR_CONTEXT)) class SPStarContext; class SPStarContextClass; diff --git a/src/svg-view-widget.h b/src/svg-view-widget.h index e732841c7..1a8697fdf 100644 --- a/src/svg-view-widget.h +++ b/src/svg-view-widget.h @@ -22,10 +22,10 @@ class SPSVGSPViewWidget; class SPSVGSPViewWidgetClass; #define SP_TYPE_SVG_VIEW_WIDGET (sp_svg_view_widget_get_type ()) -#define SP_SVG_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_SVG_VIEW_WIDGET, SPSVGSPViewWidget)) -#define SP_SVG_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_SVG_VIEW_WIDGET, SPSVGSPViewWidgetClass)) -#define SP_IS_SVG_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_SVG_VIEW_WIDGET)) -#define SP_IS_SVG_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_SVG_VIEW_WIDGET)) +#define SP_SVG_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SVG_VIEW_WIDGET, SPSVGSPViewWidget)) +#define SP_SVG_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SVG_VIEW_WIDGET, SPSVGSPViewWidgetClass)) +#define SP_IS_SVG_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SVG_VIEW_WIDGET)) +#define SP_IS_SVG_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SVG_VIEW_WIDGET)) GtkType sp_svg_view_widget_get_type (void); diff --git a/src/text-context.h b/src/text-context.h index b7d1b8e69..0d7a93ef0 100644 --- a/src/text-context.h +++ b/src/text-context.h @@ -24,10 +24,10 @@ #include "libnrtype/Layout-TNG.h" #define SP_TYPE_TEXT_CONTEXT (sp_text_context_get_type ()) -#define SP_TEXT_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_TEXT_CONTEXT, SPTextContext)) -#define SP_TEXT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_TEXT_CONTEXT, SPTextContextClass)) -#define SP_IS_TEXT_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_TEXT_CONTEXT)) -#define SP_IS_TEXT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_TEXT_CONTEXT)) +#define SP_TEXT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_TEXT_CONTEXT, SPTextContext)) +#define SP_TEXT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_TEXT_CONTEXT, SPTextContextClass)) +#define SP_IS_TEXT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_TEXT_CONTEXT)) +#define SP_IS_TEXT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_TEXT_CONTEXT)) class SPTextContext; class SPTextContextClass; diff --git a/src/tweak-context.h b/src/tweak-context.h index 542254b91..5fbd078ef 100644 --- a/src/tweak-context.h +++ b/src/tweak-context.h @@ -16,10 +16,10 @@ #include <libnr/nr-point.h> #define SP_TYPE_TWEAK_CONTEXT (sp_tweak_context_get_type()) -#define SP_TWEAK_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_TWEAK_CONTEXT, SPTweakContext)) -#define SP_TWEAK_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_TWEAK_CONTEXT, SPTweakContextClass)) -#define SP_IS_TWEAK_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_TWEAK_CONTEXT)) -#define SP_IS_TWEAK_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_TWEAK_CONTEXT)) +#define SP_TWEAK_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_TWEAK_CONTEXT, SPTweakContext)) +#define SP_TWEAK_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_TWEAK_CONTEXT, SPTweakContextClass)) +#define SP_IS_TWEAK_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_TWEAK_CONTEXT)) +#define SP_IS_TWEAK_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_TWEAK_CONTEXT)) class SPTweakContext; class SPTweakContextClass; diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index d005a0bdf..218e697b7 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -21,10 +21,10 @@ #include "ui/tool/node-types.h" #define INK_TYPE_NODE_TOOL (ink_node_tool_get_type ()) -#define INK_NODE_TOOL(obj) (GTK_CHECK_CAST ((obj), INK_TYPE_NODE_TOOL, InkNodeTool)) -#define INK_NODE_TOOL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), INK_TYPE_NODE_TOOL, InkNodeToolClass)) -#define INK_IS_NODE_TOOL(obj) (GTK_CHECK_TYPE ((obj), INK_TYPE_NODE_TOOL)) -#define INK_IS_NODE_TOOL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), INK_TYPE_NODE_TOOL)) +#define INK_NODE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INK_TYPE_NODE_TOOL, InkNodeTool)) +#define INK_NODE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INK_TYPE_NODE_TOOL, InkNodeToolClass)) +#define INK_IS_NODE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INK_TYPE_NODE_TOOL)) +#define INK_IS_NODE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INK_TYPE_NODE_TOOL)) class InkNodeTool; class InkNodeToolClass; diff --git a/src/ui/view/view-widget.h b/src/ui/view/view-widget.h index 7bdbdefb1..f216c8e27 100644 --- a/src/ui/view/view-widget.h +++ b/src/ui/view/view-widget.h @@ -25,10 +25,10 @@ class SPViewWidget; class SPNamedView; #define SP_TYPE_VIEW_WIDGET (sp_view_widget_get_type ()) -#define SP_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_VIEW_WIDGET, SPViewWidget)) -#define SP_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_VIEW_WIDGET, SPViewWidgetClass)) -#define SP_IS_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_VIEW_WIDGET)) -#define SP_IS_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_VIEW_WIDGET)) +#define SP_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_VIEW_WIDGET, SPViewWidget)) +#define SP_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_VIEW_WIDGET, SPViewWidgetClass)) +#define SP_IS_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_VIEW_WIDGET)) +#define SP_IS_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_VIEW_WIDGET)) #define SP_VIEW_WIDGET_VIEW(w) (SP_VIEW_WIDGET (w)->view) #define SP_VIEW_WIDGET_DOCUMENT(w) (SP_VIEW_WIDGET (w)->view ? ((SPViewWidget *) (w))->view->doc : NULL) diff --git a/src/widgets/button.h b/src/widgets/button.h index 19a513074..759096443 100644 --- a/src/widgets/button.h +++ b/src/widgets/button.h @@ -13,8 +13,8 @@ */ #define SP_TYPE_BUTTON (sp_button_get_type ()) -#define SP_BUTTON(o) (GTK_CHECK_CAST ((o), SP_TYPE_BUTTON, SPButton)) -#define SP_IS_BUTTON(o) (GTK_CHECK_TYPE ((o), SP_TYPE_BUTTON)) +#define SP_BUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_BUTTON, SPButton)) +#define SP_IS_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_BUTTON)) #include <gtk/gtk.h> diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 57ba71d8f..6c5af0aac 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -30,10 +30,10 @@ struct SPCanvas; #define SP_TYPE_DESKTOP_WIDGET SPDesktopWidget::getType() -#define SP_DESKTOP_WIDGET(o) (GTK_CHECK_CAST ((o), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidget)) -#define SP_DESKTOP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidgetClass)) -#define SP_IS_DESKTOP_WIDGET(o) (GTK_CHECK_TYPE ((o), SP_TYPE_DESKTOP_WIDGET)) -#define SP_IS_DESKTOP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_DESKTOP_WIDGET)) +#define SP_DESKTOP_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidget)) +#define SP_DESKTOP_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_DESKTOP_WIDGET, SPDesktopWidgetClass)) +#define SP_IS_DESKTOP_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_DESKTOP_WIDGET)) +#define SP_IS_DESKTOP_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_DESKTOP_WIDGET)) void sp_desktop_widget_destroy (SPDesktopWidget* dtw); diff --git a/src/widgets/font-selector.h b/src/widgets/font-selector.h index 61e607ac7..41a671bae 100644 --- a/src/widgets/font-selector.h +++ b/src/widgets/font-selector.h @@ -20,12 +20,12 @@ struct SPFontSelector; struct SPFontPreview; #define SP_TYPE_FONT_SELECTOR (sp_font_selector_get_type ()) -#define SP_FONT_SELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_FONT_SELECTOR, SPFontSelector)) -#define SP_IS_FONT_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_FONT_SELECTOR)) +#define SP_FONT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_FONT_SELECTOR, SPFontSelector)) +#define SP_IS_FONT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_FONT_SELECTOR)) #define SP_TYPE_FONT_PREVIEW (sp_font_preview_get_type ()) -#define SP_FONT_PREVIEW(o) (GTK_CHECK_CAST ((o), SP_TYPE_FONT_PREVIEW, SPFontPreview)) -#define SP_IS_FONT_PREVIEW(o) (GTK_CHECK_TYPE ((o), SP_TYPE_FONT_PREVIEW)) +#define SP_FONT_PREVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_FONT_PREVIEW, SPFontPreview)) +#define SP_IS_FONT_PREVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_FONT_PREVIEW)) #include <libnrtype/nrtype-forward.h> #include <gtk/gtk.h> diff --git a/src/widgets/gradient-image.h b/src/widgets/gradient-image.h index a998dcff3..0f911d4ef 100644 --- a/src/widgets/gradient-image.h +++ b/src/widgets/gradient-image.h @@ -23,10 +23,10 @@ class SPGradient; #include <sigc++/connection.h> #define SP_TYPE_GRADIENT_IMAGE (sp_gradient_image_get_type ()) -#define SP_GRADIENT_IMAGE(o) (GTK_CHECK_CAST ((o), SP_TYPE_GRADIENT_IMAGE, SPGradientImage)) -#define SP_GRADIENT_IMAGE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_GRADIENT_IMAGE, SPGradientImageClass)) -#define SP_IS_GRADIENT_IMAGE(o) (GTK_CHECK_TYPE ((o), SP_TYPE_GRADIENT_IMAGE)) -#define SP_IS_GRADIENT_IMAGE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_GRADIENT_IMAGE)) +#define SP_GRADIENT_IMAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_GRADIENT_IMAGE, SPGradientImage)) +#define SP_GRADIENT_IMAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_GRADIENT_IMAGE, SPGradientImageClass)) +#define SP_IS_GRADIENT_IMAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_GRADIENT_IMAGE)) +#define SP_IS_GRADIENT_IMAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_GRADIENT_IMAGE)) struct SPGradientImage { GtkWidget widget; diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h index 9abbc57af..d957f7baf 100644 --- a/src/widgets/gradient-selector.h +++ b/src/widgets/gradient-selector.h @@ -25,10 +25,10 @@ class SPGradient; #define SP_TYPE_GRADIENT_SELECTOR (sp_gradient_selector_get_type ()) -#define SP_GRADIENT_SELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_GRADIENT_SELECTOR, SPGradientSelector)) -#define SP_GRADIENT_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_GRADIENT_SELECTOR, SPGradientSelectorClass)) -#define SP_IS_GRADIENT_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_GRADIENT_SELECTOR)) -#define SP_IS_GRADIENT_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_GRADIENT_SELECTOR)) +#define SP_GRADIENT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_GRADIENT_SELECTOR, SPGradientSelector)) +#define SP_GRADIENT_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_GRADIENT_SELECTOR, SPGradientSelectorClass)) +#define SP_IS_GRADIENT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_GRADIENT_SELECTOR)) +#define SP_IS_GRADIENT_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_GRADIENT_SELECTOR)) diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index ac40aded0..6b165aca2 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -24,10 +24,10 @@ #include "../forward.h" #define SP_TYPE_GRADIENT_VECTOR_SELECTOR (sp_gradient_vector_selector_get_type ()) -#define SP_GRADIENT_VECTOR_SELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_GRADIENT_VECTOR_SELECTOR, SPGradientVectorSelector)) -#define SP_GRADIENT_VECTOR_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_GRADIENT_VECTOR_SELECTOR, SPGradientVectorSelectorClass)) -#define SP_IS_GRADIENT_VECTOR_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_GRADIENT_VECTOR_SELECTOR)) -#define SP_IS_GRADIENT_VECTOR_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_GRADIENT_VECTOR_SELECTOR)) +#define SP_GRADIENT_VECTOR_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_GRADIENT_VECTOR_SELECTOR, SPGradientVectorSelector)) +#define SP_GRADIENT_VECTOR_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_GRADIENT_VECTOR_SELECTOR, SPGradientVectorSelectorClass)) +#define SP_IS_GRADIENT_VECTOR_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_GRADIENT_VECTOR_SELECTOR)) +#define SP_IS_GRADIENT_VECTOR_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_GRADIENT_VECTOR_SELECTOR)) struct SPGradientVectorSelector { GtkVBox vbox; diff --git a/src/widgets/icon.h b/src/widgets/icon.h index 371f6ba87..f04d2f8da 100644 --- a/src/widgets/icon.h +++ b/src/widgets/icon.h @@ -19,8 +19,8 @@ #include "icon-size.h" #define SP_TYPE_ICON SPIcon::getType() -#define SP_ICON(o) (GTK_CHECK_CAST ((o), SP_TYPE_ICON, SPIcon)) -#define SP_IS_ICON(o) (GTK_CHECK_TYPE ((o), SP_TYPE_ICON)) +#define SP_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_ICON, SPIcon)) +#define SP_IS_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_ICON)) #include <gtk/gtk.h> diff --git a/src/widgets/paint-selector.h b/src/widgets/paint-selector.h index eb3eb2008..c0e44683b 100644 --- a/src/widgets/paint-selector.h +++ b/src/widgets/paint-selector.h @@ -22,10 +22,10 @@ class SPGradient; #define SP_TYPE_PAINT_SELECTOR (sp_paint_selector_get_type ()) -#define SP_PAINT_SELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_PAINT_SELECTOR, SPPaintSelector)) -#define SP_PAINT_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_PAINT_SELECTOR, SPPaintSelectorClass)) -#define SP_IS_PAINT_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_PAINT_SELECTOR)) -#define SP_IS_PAINT_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_PAINT_SELECTOR)) +#define SP_PAINT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_PAINT_SELECTOR, SPPaintSelector)) +#define SP_PAINT_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_PAINT_SELECTOR, SPPaintSelectorClass)) +#define SP_IS_PAINT_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_PAINT_SELECTOR)) +#define SP_IS_PAINT_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_PAINT_SELECTOR)) #include <gtk/gtk.h> diff --git a/src/widgets/ruler.h b/src/widgets/ruler.h index fed3caaf0..3c55b39c4 100644 --- a/src/widgets/ruler.h +++ b/src/widgets/ruler.h @@ -22,9 +22,9 @@ void sp_ruler_set_metric (GtkRuler * ruler, SPMetric metric); -#define SP_HRULER(obj) GTK_CHECK_CAST (obj, sp_hruler_get_type (), SPHRuler) -#define SP_HRULER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, sp_hruler_get_type (), SPHRulerClass) -#define SP_IS_HRULER(obj) GTK_CHECK_TYPE (obj, sp_hruler_get_type ()) +#define SP_HRULER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, sp_hruler_get_type (), SPHRuler) +#define SP_HRULER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, sp_hruler_get_type (), SPHRulerClass) +#define SP_IS_HRULER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, sp_hruler_get_type ()) struct SPHRuler @@ -47,9 +47,9 @@ GtkWidget* sp_hruler_new (void); -#define SP_VRULER(obj) GTK_CHECK_CAST (obj, sp_vruler_get_type (), SPVRuler) -#define SP_VRULER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, sp_vruler_get_type (), SPVRulerClass) -#define SP_IS_VRULER(obj) GTK_CHECK_TYPE (obj, sp_vruler_get_type ()) +#define SP_VRULER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, sp_vruler_get_type (), SPVRuler) +#define SP_VRULER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, sp_vruler_get_type (), SPVRulerClass) +#define SP_IS_VRULER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, sp_vruler_get_type ()) struct SPVRuler diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index 647ebd6d8..5d23e6754 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -18,16 +18,16 @@ #include <sigc++/connection.h> #define SP_TYPE_ATTRIBUTE_WIDGET (sp_attribute_widget_get_type ()) -#define SP_ATTRIBUTE_WIDGET(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_ATTRIBUTE_WIDGET, SPAttributeWidget)) -#define SP_ATTRIBUTE_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_ATTRIBUTE_WIDGET, SPAttributeWidgetClass)) -#define SP_IS_ATTRIBUTE_WIDGET(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_ATTRIBUTE_WIDGET)) -#define SP_IS_ATTRIBUTE_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_ATTRIBUTE_WIDGET)) +#define SP_ATTRIBUTE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ATTRIBUTE_WIDGET, SPAttributeWidget)) +#define SP_ATTRIBUTE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_ATTRIBUTE_WIDGET, SPAttributeWidgetClass)) +#define SP_IS_ATTRIBUTE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ATTRIBUTE_WIDGET)) +#define SP_IS_ATTRIBUTE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_ATTRIBUTE_WIDGET)) #define SP_TYPE_ATTRIBUTE_TABLE (sp_attribute_table_get_type ()) -#define SP_ATTRIBUTE_TABLE(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_ATTRIBUTE_TABLE, SPAttributeTable)) -#define SP_ATTRIBUTE_TABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_ATTRIBUTE_TABLE, SPAttributeTableClass)) -#define SP_IS_ATTRIBUTE_TABLE(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_ATTRIBUTE_TABLE)) -#define SP_IS_ATTRIBUTE_TABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_ATTRIBUTE_TABLE)) +#define SP_ATTRIBUTE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ATTRIBUTE_TABLE, SPAttributeTable)) +#define SP_ATTRIBUTE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_ATTRIBUTE_TABLE, SPAttributeTableClass)) +#define SP_IS_ATTRIBUTE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ATTRIBUTE_TABLE)) +#define SP_IS_ATTRIBUTE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_ATTRIBUTE_TABLE)) namespace Inkscape { namespace XML { diff --git a/src/widgets/sp-color-gtkselector.h b/src/widgets/sp-color-gtkselector.h index a85d94a5b..3142406c1 100644 --- a/src/widgets/sp-color-gtkselector.h +++ b/src/widgets/sp-color-gtkselector.h @@ -33,10 +33,10 @@ protected: #define SP_TYPE_COLOR_GTKSELECTOR (sp_color_gtkselector_get_type ()) -#define SP_COLOR_GTKSELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_COLOR_GTKSELECTOR, SPColorGtkselector)) -#define SP_COLOR_GTKSELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_GTKSELECTOR, SPColorGtkselectorClass)) -#define SP_IS_COLOR_GTKSELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_COLOR_GTKSELECTOR)) -#define SP_IS_COLOR_GTKSELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_GTKSELECTOR)) +#define SP_COLOR_GTKSELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_GTKSELECTOR, SPColorGtkselector)) +#define SP_COLOR_GTKSELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_GTKSELECTOR, SPColorGtkselectorClass)) +#define SP_IS_COLOR_GTKSELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_GTKSELECTOR)) +#define SP_IS_COLOR_GTKSELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_GTKSELECTOR)) struct SPColorGtkselector { SPColorSelector base; diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index b0efa35f4..9238e3f68 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -82,10 +82,10 @@ private: #define SP_TYPE_COLOR_ICC_SELECTOR (sp_color_icc_selector_get_type ()) -#define SP_COLOR_ICC_SELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelector)) -#define SP_COLOR_ICC_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelectorClass)) -#define SP_IS_COLOR_ICC_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_COLOR_ICC_SELECTOR)) -#define SP_IS_COLOR_ICC_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_ICC_SELECTOR)) +#define SP_COLOR_ICC_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelector)) +#define SP_COLOR_ICC_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_ICC_SELECTOR, SPColorICCSelectorClass)) +#define SP_IS_COLOR_ICC_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_ICC_SELECTOR)) +#define SP_IS_COLOR_ICC_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_ICC_SELECTOR)) struct SPColorICCSelector { SPColorSelector parent; diff --git a/src/widgets/sp-color-notebook.h b/src/widgets/sp-color-notebook.h index b17612e03..8d2988636 100644 --- a/src/widgets/sp-color-notebook.h +++ b/src/widgets/sp-color-notebook.h @@ -76,10 +76,10 @@ private: #define SP_TYPE_COLOR_NOTEBOOK (sp_color_notebook_get_type ()) -#define SP_COLOR_NOTEBOOK(o) (GTK_CHECK_CAST ((o), SP_TYPE_COLOR_NOTEBOOK, SPColorNotebook)) -#define SP_COLOR_NOTEBOOK_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_NOTEBOOK, SPColorNotebookClass)) -#define SP_IS_COLOR_NOTEBOOK(o) (GTK_CHECK_TYPE ((o), SP_TYPE_COLOR_NOTEBOOK)) -#define SP_IS_COLOR_NOTEBOOK_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_NOTEBOOK)) +#define SP_COLOR_NOTEBOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_NOTEBOOK, SPColorNotebook)) +#define SP_COLOR_NOTEBOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_NOTEBOOK, SPColorNotebookClass)) +#define SP_IS_COLOR_NOTEBOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_NOTEBOOK)) +#define SP_IS_COLOR_NOTEBOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_NOTEBOOK)) struct SPColorNotebook { SPColorSelector parent; /* Parent */ diff --git a/src/widgets/sp-color-preview.h b/src/widgets/sp-color-preview.h index 731aceb70..43abdf11f 100644 --- a/src/widgets/sp-color-preview.h +++ b/src/widgets/sp-color-preview.h @@ -20,10 +20,10 @@ #define SP_TYPE_COLOR_PREVIEW (sp_color_preview_get_type ()) -#define SP_COLOR_PREVIEW(o) (GTK_CHECK_CAST ((o), SP_TYPE_COLOR_PREVIEW, SPColorPreview)) -#define SP_COLOR_PREVIEW_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_PREVIEW, SPColorPreviewClass)) -#define SP_IS_COLOR_PREVIEW(o) (GTK_CHECK_TYPE ((o), SP_TYPE_COLOR_PREVIEW)) -#define SP_IS_COLOR_PREVIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_PREVIEW)) +#define SP_COLOR_PREVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_PREVIEW, SPColorPreview)) +#define SP_COLOR_PREVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_PREVIEW, SPColorPreviewClass)) +#define SP_IS_COLOR_PREVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_PREVIEW)) +#define SP_IS_COLOR_PREVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_PREVIEW)) struct SPColorPreview { GtkWidget widget; diff --git a/src/widgets/sp-color-scales.h b/src/widgets/sp-color-scales.h index 798a920af..8ffe5e7a8 100644 --- a/src/widgets/sp-color-scales.h +++ b/src/widgets/sp-color-scales.h @@ -74,10 +74,10 @@ private: #define SP_TYPE_COLOR_SCALES (sp_color_scales_get_type()) -#define SP_COLOR_SCALES(o) (GTK_CHECK_CAST((o), SP_TYPE_COLOR_SCALES, SPColorScales)) -#define SP_COLOR_SCALES_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_COLOR_SCALES, SPColorScalesClass)) -#define SP_IS_COLOR_SCALES(o) (GTK_CHECK_TYPE((o), SP_TYPE_COLOR_SCALES)) -#define SP_IS_COLOR_SCALES_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_COLOR_SCALES)) +#define SP_COLOR_SCALES(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_COLOR_SCALES, SPColorScales)) +#define SP_COLOR_SCALES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_COLOR_SCALES, SPColorScalesClass)) +#define SP_IS_COLOR_SCALES(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_COLOR_SCALES)) +#define SP_IS_COLOR_SCALES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_COLOR_SCALES)) struct SPColorScales { SPColorSelector parent; diff --git a/src/widgets/sp-color-selector.h b/src/widgets/sp-color-selector.h index 2030d02ff..c27cad45f 100644 --- a/src/widgets/sp-color-selector.h +++ b/src/widgets/sp-color-selector.h @@ -58,10 +58,10 @@ private: #define SP_TYPE_COLOR_SELECTOR (sp_color_selector_get_type ()) -#define SP_COLOR_SELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_COLOR_SELECTOR, SPColorSelector)) -#define SP_COLOR_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_SELECTOR, SPColorSelectorClass)) -#define SP_IS_COLOR_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_COLOR_SELECTOR)) -#define SP_IS_COLOR_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_SELECTOR)) +#define SP_COLOR_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_SELECTOR, SPColorSelector)) +#define SP_COLOR_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_SELECTOR, SPColorSelectorClass)) +#define SP_IS_COLOR_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_SELECTOR)) +#define SP_IS_COLOR_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_SELECTOR)) #define SP_COLOR_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SP_TYPE_COLOR_SELECTOR, SPColorSelectorClass)) struct SPColorSelector { diff --git a/src/widgets/sp-color-slider.h b/src/widgets/sp-color-slider.h index 8b0bcb9a9..b8cfaf869 100644 --- a/src/widgets/sp-color-slider.h +++ b/src/widgets/sp-color-slider.h @@ -22,10 +22,10 @@ struct SPColorSlider; struct SPColorSliderClass; #define SP_TYPE_COLOR_SLIDER (sp_color_slider_get_type ()) -#define SP_COLOR_SLIDER(o) (GTK_CHECK_CAST ((o), SP_TYPE_COLOR_SLIDER, SPColorSlider)) -#define SP_COLOR_SLIDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_SLIDER, SPColorSliderClass)) -#define SP_IS_COLOR_SLIDER(o) (GTK_CHECK_TYPE ((o), SP_TYPE_COLOR_SLIDER)) -#define SP_IS_COLOR_SLIDER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_SLIDER)) +#define SP_COLOR_SLIDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_SLIDER, SPColorSlider)) +#define SP_COLOR_SLIDER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_SLIDER, SPColorSliderClass)) +#define SP_IS_COLOR_SLIDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_SLIDER)) +#define SP_IS_COLOR_SLIDER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_SLIDER)) struct SPColorSlider { GtkWidget widget; diff --git a/src/widgets/sp-color-wheel-selector.h b/src/widgets/sp-color-wheel-selector.h index 553f351a0..d8bcb730b 100644 --- a/src/widgets/sp-color-wheel-selector.h +++ b/src/widgets/sp-color-wheel-selector.h @@ -53,10 +53,10 @@ private: #define SP_TYPE_COLOR_WHEEL_SELECTOR (sp_color_wheel_selector_get_type ()) -#define SP_COLOR_WHEEL_SELECTOR(o) (GTK_CHECK_CAST ((o), SP_TYPE_COLOR_WHEEL_SELECTOR, SPColorWheelSelector)) -#define SP_COLOR_WHEEL_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_WHEEL_SELECTOR, SPColorWheelSelectorClass)) -#define SP_IS_COLOR_WHEEL_SELECTOR(o) (GTK_CHECK_TYPE ((o), SP_TYPE_COLOR_WHEEL_SELECTOR)) -#define SP_IS_COLOR_WHEEL_SELECTOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_WHEEL_SELECTOR)) +#define SP_COLOR_WHEEL_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_COLOR_WHEEL_SELECTOR, SPColorWheelSelector)) +#define SP_COLOR_WHEEL_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SP_TYPE_COLOR_WHEEL_SELECTOR, SPColorWheelSelectorClass)) +#define SP_IS_COLOR_WHEEL_SELECTOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_COLOR_WHEEL_SELECTOR)) +#define SP_IS_COLOR_WHEEL_SELECTOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_COLOR_WHEEL_SELECTOR)) struct SPColorWheelSelector { SPColorSelector parent; diff --git a/src/widgets/sp-widget.h b/src/widgets/sp-widget.h index ba6baf972..decd9c056 100644 --- a/src/widgets/sp-widget.h +++ b/src/widgets/sp-widget.h @@ -16,10 +16,10 @@ #include <glib.h> #define SP_TYPE_WIDGET (sp_widget_get_type ()) -#define SP_WIDGET(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_WIDGET, SPWidget)) -#define SP_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_WIDGET, SPWidgetClass)) -#define SP_IS_WIDGET(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_WIDGET)) -#define SP_IS_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_WIDGET)) +#define SP_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_WIDGET, SPWidget)) +#define SP_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_WIDGET, SPWidgetClass)) +#define SP_IS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_WIDGET)) +#define SP_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_WIDGET)) #include <gtk/gtk.h> diff --git a/src/widgets/sp-xmlview-attr-list.h b/src/widgets/sp-xmlview-attr-list.h index b437cabf0..de79c7a37 100644 --- a/src/widgets/sp-xmlview-attr-list.h +++ b/src/widgets/sp-xmlview-attr-list.h @@ -20,9 +20,9 @@ #define SP_TYPE_XMLVIEW_ATTR_LIST (sp_xmlview_attr_list_get_type ()) -#define SP_XMLVIEW_ATTR_LIST(o) (GTK_CHECK_CAST ((o), SP_TYPE_XMLVIEW_ATTR_LIST, SPXMLViewAttrList)) -#define SP_IS_XMLVIEW_ATTR_LIST(o) (GTK_CHECK_TYPE ((o), SP_TYPE_XMLVIEW_ATTR_LIST)) -#define SP_XMLVIEW_ATTR_LIST_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_XMLVIEW_ATTR_LIST)) +#define SP_XMLVIEW_ATTR_LIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_ATTR_LIST, SPXMLViewAttrList)) +#define SP_IS_XMLVIEW_ATTR_LIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_XMLVIEW_ATTR_LIST)) +#define SP_XMLVIEW_ATTR_LIST_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_XMLVIEW_ATTR_LIST)) struct SPXMLViewAttrList { diff --git a/src/widgets/sp-xmlview-content.h b/src/widgets/sp-xmlview-content.h index 7f8a6d3ef..fe26891d0 100644 --- a/src/widgets/sp-xmlview-content.h +++ b/src/widgets/sp-xmlview-content.h @@ -24,9 +24,9 @@ #define SP_TYPE_XMLVIEW_CONTENT (sp_xmlview_content_get_type ()) -#define SP_XMLVIEW_CONTENT(o) (GTK_CHECK_CAST ((o), SP_TYPE_XMLVIEW_CONTENT, SPXMLViewContent)) -#define SP_IS_XMLVIEW_CONTENT(o) (GTK_CHECK_TYPE ((o), SP_TYPE_XMLVIEW_CONTENT)) -#define SP_XMLVIEW_CONTENT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_XMLVIEW_CONTENT)) +#define SP_XMLVIEW_CONTENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_CONTENT, SPXMLViewContent)) +#define SP_IS_XMLVIEW_CONTENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_XMLVIEW_CONTENT)) +#define SP_XMLVIEW_CONTENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_XMLVIEW_CONTENT)) struct SPXMLViewContent { diff --git a/src/widgets/sp-xmlview-tree.h b/src/widgets/sp-xmlview-tree.h index 89f4af547..2b04e79eb 100644 --- a/src/widgets/sp-xmlview-tree.h +++ b/src/widgets/sp-xmlview-tree.h @@ -20,9 +20,9 @@ #define SP_TYPE_XMLVIEW_TREE (sp_xmlview_tree_get_type ()) -#define SP_XMLVIEW_TREE(o) (GTK_CHECK_CAST ((o), SP_TYPE_XMLVIEW_TREE, SPXMLViewTree)) -#define SP_IS_XMLVIEW_TREE(o) (GTK_CHECK_TYPE ((o), SP_TYPE_XMLVIEW_TREE)) -#define SP_XMLVIEW_TREE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), SP_TYPE_XMLVIEW_TREE)) +#define SP_XMLVIEW_TREE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_XMLVIEW_TREE, SPXMLViewTree)) +#define SP_IS_XMLVIEW_TREE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_XMLVIEW_TREE)) +#define SP_XMLVIEW_TREE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SP_TYPE_XMLVIEW_TREE)) struct SPXMLViewTree; struct SPXMLViewTreeClass; diff --git a/src/zoom-context.h b/src/zoom-context.h index 133267135..e36dc3fbe 100644 --- a/src/zoom-context.h +++ b/src/zoom-context.h @@ -16,8 +16,8 @@ #include "event-context.h" #define SP_TYPE_ZOOM_CONTEXT (sp_zoom_context_get_type ()) -#define SP_ZOOM_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_ZOOM_CONTEXT, SPZoomContext)) -#define SP_IS_ZOOM_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_ZOOM_CONTEXT)) +#define SP_ZOOM_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ZOOM_CONTEXT, SPZoomContext)) +#define SP_IS_ZOOM_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ZOOM_CONTEXT)) class SPZoomContext; class SPZoomContextClass; -- cgit v1.2.3 From 2402528197627887e374dd2a4269dfdeb19acc58 Mon Sep 17 00:00:00 2001 From: Alex Valavanis <valavanisalex@gmail.com> Date: Wed, 15 Jun 2011 01:13:10 +0100 Subject: Clean up deprecated GTK_WIDGET API (bzr r10302.1.2) --- src/display/sp-canvas.cpp | 14 +++++++------- src/ege-color-prof-tracker.cpp | 2 +- src/extension/execution-env.cpp | 2 +- src/ige-mac-menu.c | 4 ++-- src/libgdl/gdl-dock-bar.c | 16 ++++++++-------- src/libgdl/gdl-dock-item-grip.c | 4 ++-- src/libgdl/gdl-dock-item.c | 36 ++++++++++++++++++------------------ src/libgdl/gdl-dock-tablabel.c | 6 +++--- src/libgdl/gdl-dock.c | 26 +++++++++++++------------- src/text-context.cpp | 2 +- src/ui/widget/dock-item.cpp | 2 +- src/widgets/desktop-widget.cpp | 16 ++++++++-------- src/widgets/eek-preview.cpp | 10 +++++----- src/widgets/font-selector.cpp | 8 ++++---- src/widgets/gradient-image.cpp | 6 +++--- src/widgets/icon.cpp | 10 +++++----- src/widgets/ruler.cpp | 4 ++-- src/widgets/sp-color-preview.cpp | 6 +++--- src/widgets/sp-color-slider.cpp | 4 ++-- src/widgets/sp-widget.cpp | 4 ++-- src/widgets/toolbox.cpp | 8 ++++---- 21 files changed, 95 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 20c21a8c3..e2220282d 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -537,7 +537,7 @@ sp_canvas_item_grab (SPCanvasItem *item, guint event_mask, GdkCursor *cursor, gu { g_return_val_if_fail (item != NULL, -1); g_return_val_if_fail (SP_IS_CANVAS_ITEM (item), -1); - g_return_val_if_fail (GTK_WIDGET_MAPPED (item->canvas), -1); + g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)), -1); if (item->canvas->grabbed_item) return -1; @@ -628,7 +628,7 @@ sp_canvas_item_grab_focus (SPCanvasItem *item) { g_return_if_fail (item != NULL); g_return_if_fail (SP_IS_CANVAS_ITEM (item)); - g_return_if_fail (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (item->canvas))); + g_return_if_fail (gtk_widget_get_can_focus (GTK_WIDGET (item->canvas))); SPCanvasItem *focused_item = item->canvas->focused_item; @@ -1241,7 +1241,7 @@ sp_canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation) widget->allocation = *allocation; - if (GTK_WIDGET_REALIZED (widget)) { + if (gtk_widget_get_realized (widget)) { gdk_window_move_resize (widget->window, widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height); @@ -1967,7 +1967,7 @@ sp_canvas_expose (GtkWidget *widget, GdkEventExpose *event) { SPCanvas *canvas = SP_CANVAS (widget); - if (!GTK_WIDGET_DRAWABLE (widget) || + if (!gtk_widget_is_drawable (widget) || (event->window != SP_CANVAS_WINDOW (canvas))) return FALSE; @@ -2121,7 +2121,7 @@ do_update (SPCanvas *canvas) } /* Paint if able to */ - if (GTK_WIDGET_DRAWABLE (canvas)) { + if (gtk_widget_is_drawable ( GTK_WIDGET (canvas))) { return paint (canvas); } @@ -2205,7 +2205,7 @@ sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear, // scrolling without zoom; redraw only the newly exposed areas if ((dx != 0) || (dy != 0)) { canvas->is_scrolling = is_scrolling; - if (GTK_WIDGET_REALIZED (canvas)) { + if (gtk_widget_get_realized (GTK_WIDGET (canvas))) { gdk_window_scroll (SP_CANVAS_WINDOW (canvas), -dx, -dy); } } @@ -2254,7 +2254,7 @@ sp_canvas_request_redraw (SPCanvas *canvas, int x0, int y0, int x1, int y1) g_return_if_fail (canvas != NULL); g_return_if_fail (SP_IS_CANVAS (canvas)); - if (!GTK_WIDGET_DRAWABLE (canvas)) return; + if (!gtk_widget_is_drawable ( GTK_WIDGET (canvas))) return; if ((x0 >= x1) || (y0 >= y1)) return; bbox.x0 = x0; diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp index a6fcaa126..6aeb554f9 100644 --- a/src/ege-color-prof-tracker.cpp +++ b/src/ege-color-prof-tracker.cpp @@ -448,7 +448,7 @@ void target_hierarchy_changed_cb(GtkWidget* widget, GtkWidget* prev_top, gpointe { if ( !prev_top && gtk_widget_get_toplevel(widget) ) { GtkWidget* top = gtk_widget_get_toplevel(widget); - if ( GTK_WIDGET_TOPLEVEL(top) ) { + if ( gtk_widget_is_toplevel(top) ) { GtkWindow* win = GTK_WINDOW(top); g_signal_connect( G_OBJECT(win), "event-after", G_CALLBACK( event_after_cb ), user_data ); g_object_weak_ref( G_OBJECT(win), window_finalized, user_data ); diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index a2550024a..b05685902 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -128,7 +128,7 @@ ExecutionEnv::createWorkingDialog (void) { SPDesktop *desktop = (SPDesktop *)_doc; GtkWidget *toplevel = gtk_widget_get_toplevel(&(desktop->canvas->widget)); - if (!toplevel || !GTK_WIDGET_TOPLEVEL (toplevel)) + if (!toplevel || !gtk_widget_is_toplevel (toplevel)) return; Gtk::Window *window = Glib::wrap(GTK_WINDOW(toplevel), false); diff --git a/src/ige-mac-menu.c b/src/ige-mac-menu.c index 29915d980..132817dea 100644 --- a/src/ige-mac-menu.c +++ b/src/ige-mac-menu.c @@ -667,10 +667,10 @@ sync_menu_shell (GtkMenuShell *menu_shell, if (GTK_IS_SEPARATOR_MENU_ITEM (menu_item)) attributes |= kMenuItemAttrSeparator; - if (!GTK_WIDGET_IS_SENSITIVE (menu_item)) + if (!gtk_widget_is_sensitive (menu_item)) attributes |= kMenuItemAttrDisabled; - if (!GTK_WIDGET_VISIBLE (menu_item)) + if (!gtk_widget_get_visible (menu_item)) attributes |= kMenuItemAttrHidden; InsertMenuItemTextWithCFString (carbon_menu, cfstr, diff --git a/src/libgdl/gdl-dock-bar.c b/src/libgdl/gdl-dock-bar.c index 37710b693..1e694eec5 100644 --- a/src/libgdl/gdl-dock-bar.c +++ b/src/libgdl/gdl-dock-bar.c @@ -481,7 +481,7 @@ static void gdl_dock_bar_size_vrequest (GtkWidget *widget, child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { gtk_widget_size_request (child->widget, &child_requisition); @@ -539,7 +539,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { nvis_children += 1; if (child->expand) @@ -577,7 +577,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, child = children->data; children = children->next; - if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget)) + if ((child->pack == GTK_PACK_START) && gtk_widget_get_visible (child->widget)) { if (box->homogeneous) { @@ -636,7 +636,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, child = children->data; children = children->next; - if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget)) + if ((child->pack == GTK_PACK_END) && gtk_widget_get_visible (child->widget)) { GtkRequisition child_requisition; gtk_widget_get_child_requisition (child->widget, &child_requisition); @@ -706,7 +706,7 @@ static void gdl_dock_bar_size_hrequest (GtkWidget *widget, child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { GtkRequisition child_requisition; @@ -768,7 +768,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { nvis_children += 1; if (child->expand) @@ -806,7 +806,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, child = children->data; children = children->next; - if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget)) + if ((child->pack == GTK_PACK_START) && gtk_widget_get_visible (child->widget)) { if (box->homogeneous) { @@ -869,7 +869,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, child = children->data; children = children->next; - if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget)) + if ((child->pack == GTK_PACK_END) && gtk_widget_get_visible (child->widget)) { GtkRequisition child_requisition; gtk_widget_get_child_requisition (child->widget, &child_requisition); diff --git a/src/libgdl/gdl-dock-item-grip.c b/src/libgdl/gdl-dock-item-grip.c index 3c6b4ac17..c51b782b3 100644 --- a/src/libgdl/gdl-dock-item-grip.c +++ b/src/libgdl/gdl-dock-item-grip.c @@ -59,10 +59,10 @@ gdl_dock_item_grip_get_title_area (GdlDockItemGrip *grip, alloc_height = MAX (grip->_priv->close_button->allocation.height, alloc_height); alloc_height = MAX (grip->_priv->iconify_button->allocation.height, alloc_height); - if (GTK_WIDGET_VISIBLE (grip->_priv->close_button)) { + if (gtk_widget_get_visible (grip->_priv->close_button)) { area->width -= grip->_priv->close_button->allocation.width; } - if (GTK_WIDGET_VISIBLE (grip->_priv->iconify_button)) { + if (gtk_widget_get_visible (grip->_priv->iconify_button)) { area->width -= grip->_priv->iconify_button->allocation.width; } diff --git a/src/libgdl/gdl-dock-item.c b/src/libgdl/gdl-dock-item.c index 862b90c0c..b0d97a06d 100644 --- a/src/libgdl/gdl-dock-item.c +++ b/src/libgdl/gdl-dock-item.c @@ -644,7 +644,7 @@ gdl_dock_item_remove (GtkContainer *container, item = GDL_DOCK_ITEM (container); if (item->_priv && widget == item->_priv->grip) { - gboolean grip_was_visible = GTK_WIDGET_VISIBLE (widget); + gboolean grip_was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (widget); item->_priv->grip = NULL; if (grip_was_visible) @@ -658,7 +658,7 @@ gdl_dock_item_remove (GtkContainer *container, g_return_if_fail (item->child == widget); - was_visible = GTK_WIDGET_VISIBLE (widget); + was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (widget); item->child = NULL; @@ -781,14 +781,14 @@ gdl_dock_item_size_allocate (GtkWidget *widget, item->_priv->preferred_height = -1; item->_priv->preferred_width = -1; - if (GTK_WIDGET_REALIZED (widget)) + if (gtk_widget_get_realized (widget)) gdk_window_move_resize (widget->window, widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height); - if (item->child && GTK_WIDGET_VISIBLE (item->child)) { + if (item->child && gtk_widget_get_visible (item->child)) { GtkAllocation child_allocation; int border_width; @@ -843,13 +843,13 @@ gdl_dock_item_map (GtkWidget *widget) gdk_window_show (widget->window); if (item->child - && GTK_WIDGET_VISIBLE (item->child) - && !GTK_WIDGET_MAPPED (item->child)) + && gtk_widget_get_visible (item->child) + && !gtk_widget_get_mapped (item->child)) gtk_widget_map (item->child); if (item->_priv->grip - && GTK_WIDGET_VISIBLE (item->_priv->grip) - && !GTK_WIDGET_MAPPED (item->_priv->grip)) + && gtk_widget_get_visible (item->_priv->grip) + && !gtk_widget_get_mapped (item->_priv->grip)) gtk_widget_map (item->_priv->grip); } @@ -906,7 +906,7 @@ gdl_dock_item_realize (GtkWidget *widget) widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, - GTK_WIDGET_STATE (item)); + gtk_widget_get_state (GTK_WIDGET(item))); gdk_window_set_back_pixmap (widget->window, NULL, TRUE); if (item->child) @@ -923,10 +923,10 @@ gdl_dock_item_style_set (GtkWidget *widget, g_return_if_fail (widget != NULL); g_return_if_fail (GDL_IS_DOCK_ITEM (widget)); - if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_NO_WINDOW (widget)) { + if (gtk_widget_get_realized (widget) && gtk_widget_get_has_window (widget)) { gtk_style_set_background (widget->style, widget->window, widget->state); - if (GTK_WIDGET_DRAWABLE (widget)) + if (gtk_widget_is_drawable (widget)) gdk_window_clear (widget->window); } } @@ -941,7 +941,7 @@ gdl_dock_item_paint (GtkWidget *widget, gtk_paint_box (widget->style, widget->window, - GTK_WIDGET_STATE (widget), + gtk_widget_get_state (widget), GTK_SHADOW_NONE, &event->area, widget, "dockitem", @@ -956,7 +956,7 @@ gdl_dock_item_expose (GtkWidget *widget, g_return_val_if_fail (GDL_IS_DOCK_ITEM (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_DRAWABLE (widget) && event->window == widget->window) { + if (gtk_widget_is_drawable (widget) && event->window == widget->window) { gdl_dock_item_paint (widget, event); GDL_CALL_PARENT_GBOOLEAN(GTK_WIDGET_CLASS, expose_event, (widget,event)); } @@ -1426,7 +1426,7 @@ gdl_dock_item_dock (GdlDockObject *object, gtk_container_add (GTK_CONTAINER (parent), GTK_WIDGET (new_parent)); /* show automatic object */ - if (GTK_WIDGET_VISIBLE (object)) + if (gtk_widget_get_visible (GTK_WIDGET (object))) gtk_widget_show (GTK_WIDGET (new_parent)); /* use extra docking parameter */ @@ -1506,7 +1506,7 @@ gdl_dock_item_drag_start (GdlDockItem *item) { GdkCursor *fleur; - if (!GTK_WIDGET_REALIZED (item)) + if (!gtk_widget_get_realized (GTK_WIDGET (item))) gtk_widget_realize (GTK_WIDGET (item)); GDL_DOCK_ITEM_SET_FLAGS (item, GDL_DOCK_IN_DRAG); @@ -1632,7 +1632,7 @@ gdl_dock_item_real_set_orientation (GdlDockItem *item, { item->orientation = orientation; - if (GTK_WIDGET_DRAWABLE (item)) + if (gtk_widget_is_drawable (GTK_WIDGET (item))) gtk_widget_queue_draw (GTK_WIDGET (item)); gtk_widget_queue_resize (GTK_WIDGET (item)); } @@ -2030,8 +2030,8 @@ gdl_dock_item_or_child_has_focus (GdlDockItem *item) item_child = GTK_CONTAINER (item_child)->focus_child) ; item_or_child_has_focus = - (GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (item)) || - (GTK_IS_WIDGET (item_child) && GTK_WIDGET_HAS_FOCUS (item_child))); + (gtk_widget_has_focus (GTK_WIDGET (item)) || + (GTK_IS_WIDGET (item_child) && gtk_widget_has_focus (item_child))); return item_or_child_has_focus; } diff --git a/src/libgdl/gdl-dock-tablabel.c b/src/libgdl/gdl-dock-tablabel.c index adba98b0d..790bf7612 100644 --- a/src/libgdl/gdl-dock-tablabel.c +++ b/src/libgdl/gdl-dock-tablabel.c @@ -324,14 +324,14 @@ gdl_dock_tablabel_size_allocate (GtkWidget *widget, widget->allocation = *allocation; - if (GTK_WIDGET_REALIZED (widget)) + if (gtk_widget_get_realized (widget)) gdk_window_move_resize (tablabel->event_window, allocation->x, allocation->y, allocation->width, allocation->height); - if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { + if (bin->child && gtk_widget_get_visible (bin->child)) { GtkAllocation child_allocation; child_allocation.x = widget->allocation.x + border_width; @@ -386,7 +386,7 @@ gdl_dock_tablabel_expose (GtkWidget *widget, g_return_val_if_fail (GDL_IS_DOCK_TABLABEL (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) { + if (gtk_widget_get_visible (widget) && gtk_widget_get_mapped (widget)) { GDL_CALL_PARENT_GBOOLEAN(GTK_WIDGET_CLASS, expose_event, (widget,event)); gdl_dock_tablabel_paint (widget, event); }; diff --git a/src/libgdl/gdl-dock.c b/src/libgdl/gdl-dock.c index da0f8c5e3..c366ed69b 100644 --- a/src/libgdl/gdl-dock.c +++ b/src/libgdl/gdl-dock.c @@ -561,7 +561,7 @@ gdl_dock_size_request (GtkWidget *widget, border_width = container->border_width; /* make request to root */ - if (dock->root && GTK_WIDGET_VISIBLE (dock->root)) + if (dock->root && gtk_widget_get_visible (dock->root)) gtk_widget_size_request (GTK_WIDGET (dock->root), requisition); else { requisition->width = 0; @@ -597,7 +597,7 @@ gdl_dock_size_allocate (GtkWidget *widget, allocation->width = MAX (1, allocation->width - 2 * border_width); allocation->height = MAX (1, allocation->height - 2 * border_width); - if (dock->root && GTK_WIDGET_VISIBLE (dock->root)) + if (dock->root && gtk_widget_get_visible (dock->root)) gtk_widget_size_allocate (GTK_WIDGET (dock->root), allocation); } @@ -616,7 +616,7 @@ gdl_dock_map (GtkWidget *widget) if (dock->root) { child = GTK_WIDGET (dock->root); - if (GTK_WIDGET_VISIBLE (child) && !GTK_WIDGET_MAPPED (child)) + if (gtk_widget_get_visible (child) && !gtk_widget_get_mapped (child)) gtk_widget_map (child); } } @@ -636,7 +636,7 @@ gdl_dock_unmap (GtkWidget *widget) if (dock->root) { child = GTK_WIDGET (dock->root); - if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_MAPPED (child)) + if (gtk_widget_get_visible (child) && gtk_widget_get_mapped (child)) gtk_widget_unmap (child); } @@ -720,14 +720,14 @@ gdl_dock_remove (GtkContainer *container, g_return_if_fail (widget != NULL); dock = GDL_DOCK (container); - was_visible = GTK_WIDGET_VISIBLE (widget); + was_visible = gtk_widget_get_visible (widget); if (GTK_WIDGET (dock->root) == widget) { dock->root = NULL; GDL_DOCK_OBJECT_UNSET_FLAGS (widget, GDL_DOCK_ATTACHED); gtk_widget_unparent (widget); - if (was_visible && GTK_WIDGET_VISIBLE (GTK_WIDGET (container))) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (dock)); } } @@ -927,15 +927,15 @@ gdl_dock_dock (GdlDockObject *object, /* Realize the item (create its corresponding GdkWindow) when GdlDock has been realized. */ - if (GTK_WIDGET_REALIZED (dock)) + if (gtk_widget_get_realized (dock)) gtk_widget_realize (widget); /* Map the widget if it's visible and the parent is visible and has been mapped. This is done to make sure that the GdkWindow is visible. */ - if (GTK_WIDGET_VISIBLE (dock) && - GTK_WIDGET_VISIBLE (widget)) { - if (GTK_WIDGET_MAPPED (dock)) + if (gtk_widget_get_visible (dock) && + gtk_widget_get_visible (widget)) { + if (gtk_widget_get_mapped (dock)) gtk_widget_map (widget); /* Make the widget resize. */ @@ -1258,9 +1258,9 @@ gdl_dock_add_floating_item (GdlDock *dock, "floaty", y, NULL)); - if (GTK_WIDGET_VISIBLE (dock)) { + if (gtk_widget_get_visible (dock)) { gtk_widget_show (GTK_WIDGET (new_dock)); - if (GTK_WIDGET_MAPPED (dock)) + if (gtk_widget_get_mapped (dock)) gtk_widget_map (GTK_WIDGET (new_dock)); /* Make the widget resize. */ @@ -1335,7 +1335,7 @@ gdl_dock_xor_rect (GdlDock *dock, widget = GTK_WIDGET (dock); if (!dock->_priv->xor_gc) { - if (GTK_WIDGET_REALIZED (widget)) { + if (gtk_widget_get_realized (widget)) { GdkGCValues values; values.function = GDK_INVERT; diff --git a/src/text-context.cpp b/src/text-context.cpp index a7c6772e5..b709d4d24 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -234,7 +234,7 @@ sp_text_context_setup(SPEventContext *ec) g_signal_connect(G_OBJECT(canvas), "focus_out_event", G_CALLBACK(sptc_focus_out), tc); g_signal_connect(G_OBJECT(tc->imc), "commit", G_CALLBACK(sptc_commit), tc); - if (GTK_WIDGET_HAS_FOCUS(canvas)) { + if (gtk_widget_has_focus(canvas)) { sptc_focus_in(canvas, NULL, tc); } } diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 72a20c385..87f4d0840 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -262,7 +262,7 @@ DockItem::present() void DockItem::grab_focus() { - if (GTK_WIDGET_REALIZED (_gdl_dock_item)) { + if (gtk_widget_get_realized (_gdl_dock_item)) { // make sure the window we're in is present Gtk::Widget *toplevel = getWidget().get_toplevel(); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 69b27d6e4..0d890fa86 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -213,7 +213,7 @@ void CMSPrefWatcher::_setCmsSensitive(bool enabled) #if ENABLE_LCMS for ( std::list<SPDesktopWidget*>::iterator it = _widget_list.begin(); it != _widget_list.end(); ++it ) { SPDesktopWidget *dtw = *it; - if ( GTK_WIDGET_SENSITIVE( dtw->cms_adjust ) != enabled ) { + if ( gtk_widget_get_sensitive( dtw->cms_adjust ) != enabled ) { cms_adjust_set_sensitive( dtw, enabled ); } } @@ -231,7 +231,7 @@ SPDesktopWidget::setMessage (Inkscape::MessageType type, const gchar *message) gtk_label_set_markup (sb, message ? message : ""); // make sure the important messages are displayed immediately! - if (type == Inkscape::IMMEDIATE_MESSAGE && GTK_WIDGET_DRAWABLE (GTK_WIDGET(sb))) { + if (type == Inkscape::IMMEDIATE_MESSAGE && gtk_widget_is_drawable (GTK_WIDGET(sb))) { gtk_widget_queue_draw(GTK_WIDGET(sb)); gdk_window_process_updates(GTK_WIDGET(sb)->window, TRUE); } @@ -697,7 +697,7 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) return; } - if (GTK_WIDGET_REALIZED (widget)) { + if (gtk_widget_get_realized (widget)) { Geom::Rect const area = dtw->desktop->get_display_area(); double zoom = dtw->desktop->current_zoom(); @@ -1077,7 +1077,7 @@ SPDesktopWidget::letZoomGrabFocus() void SPDesktopWidget::getWindowGeometry (gint &x, gint &y, gint &w, gint &h) { - gboolean vis = GTK_WIDGET_VISIBLE (this); + gboolean vis = gtk_widget_get_visible (GTK_WIDGET(this)); (void)vis; // TODO figure out why it is here but not used. Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window"); @@ -1803,7 +1803,7 @@ void sp_desktop_widget_toggle_rulers (SPDesktopWidget *dtw) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (GTK_WIDGET_VISIBLE (dtw->hruler)) { + if (gtk_widget_get_visible (dtw->hruler)) { gtk_widget_hide_all (dtw->hruler); gtk_widget_hide_all (dtw->vruler); prefs->setBool(dtw->desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", false); @@ -1818,7 +1818,7 @@ void sp_desktop_widget_toggle_scrollbars (SPDesktopWidget *dtw) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (GTK_WIDGET_VISIBLE (dtw->hscrollbar)) { + if (gtk_widget_get_visible (dtw->hscrollbar)) { gtk_widget_hide_all (dtw->hscrollbar); gtk_widget_hide_all (dtw->vscrollbar_box); gtk_widget_hide_all( dtw->cms_adjust ); @@ -1834,7 +1834,7 @@ sp_desktop_widget_toggle_scrollbars (SPDesktopWidget *dtw) void sp_desktop_widget_toggle_color_prof_adj( SPDesktopWidget *dtw ) { - if ( GTK_WIDGET_SENSITIVE( dtw->cms_adjust ) ) { + if ( gtk_widget_get_sensitive( dtw->cms_adjust ) ) { if ( SP_BUTTON_IS_DOWN(dtw->cms_adjust) ) { sp_button_toggle_set_down( SP_BUTTON(dtw->cms_adjust), FALSE ); } else { @@ -1848,7 +1848,7 @@ void sp_spw_toggle_menubar (SPDesktopWidget *dtw, bool is_fullscreen) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - if (GTK_WIDGET_VISIBLE (dtw->menubar)) { + if (gtk_widget_get_visible (dtw->menubar)) { gtk_widget_hide_all (dtw->menubar); prefs->setBool(is_fullscreen ? "/fullscreen/menu/state" : "/window/menu/state", false); } else { diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp index 816c4bf50..1ca656ae1 100644 --- a/src/widgets/eek-preview.cpp +++ b/src/widgets/eek-preview.cpp @@ -192,7 +192,7 @@ static guint eek_preview_signals[LAST_SIGNAL] = { 0 }; gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) { -/* g_message("Exposed!!! %s", GTK_WIDGET_HAS_FOCUS(widget) ? "XXX" : "---" ); */ +/* g_message("Exposed!!! %s", gtk_widget_has_focus(widget) ? "XXX" : "---" ); */ gint insetX = 0; gint insetY = 0; @@ -218,13 +218,13 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) } */ - if ( GTK_WIDGET_DRAWABLE( widget ) ) { + if ( gtk_widget_is_drawable( widget ) ) { GtkStyle* style = gtk_widget_get_style( widget ); if ( insetX > 0 || insetY > 0 ) { gtk_paint_flat_box( style, widget->window, - (GtkStateType)GTK_WIDGET_STATE(widget), + (GtkStateType)gtk_widget_get_state(widget), GTK_SHADOW_NONE, NULL, widget, @@ -379,7 +379,7 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) } - if ( GTK_WIDGET_HAS_FOCUS(widget) ) { + if ( gtk_widget_has_focus(widget) ) { gtk_paint_focus( style, widget->window, GTK_STATE_NORMAL, @@ -437,7 +437,7 @@ static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton* if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { EekPreview* preview = EEK_PREVIEW(widget); - if ( preview->_takesFocus && !GTK_WIDGET_HAS_FOCUS(widget) ) { + if ( preview->_takesFocus && !gtk_widget_has_focus(widget) ) { gtk_widget_grab_focus(widget); } diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index f493c393a..8c6afeb4c 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -620,7 +620,7 @@ static gint sp_font_preview_expose(GtkWidget *widget, GdkEventExpose *event) { SPFontPreview *fprev = SP_FONT_PREVIEW(widget); - if (GTK_WIDGET_DRAWABLE (widget)) { + if (gtk_widget_is_drawable (widget)) { if (fprev->rfont) { int glyphs[SPFP_MAX_LEN]; @@ -811,13 +811,13 @@ void sp_font_preview_set_font(SPFontPreview *fprev, font_instance *font, SPFontS fprev->rfont = fprev->font->RasterFont(flip, 0); } - if (GTK_WIDGET_DRAWABLE (fprev)) gtk_widget_queue_draw (GTK_WIDGET (fprev)); + if (gtk_widget_is_drawable (GTK_WIDGET (fprev))) gtk_widget_queue_draw (GTK_WIDGET (fprev)); } void sp_font_preview_set_rgba32(SPFontPreview *fprev, guint32 rgba) { fprev->rgba = rgba; - if (GTK_WIDGET_DRAWABLE (fprev)) { + if (gtk_widget_is_drawable (GTK_WIDGET (fprev))) { gtk_widget_queue_draw (GTK_WIDGET (fprev)); } } @@ -830,7 +830,7 @@ void sp_font_preview_set_phrase(SPFontPreview *fprev, const gchar *phrase) } else { fprev->phrase = NULL; } - if (GTK_WIDGET_DRAWABLE(fprev)) { + if (gtk_widget_is_drawable( GTK_WIDGET (fprev))) { gtk_widget_queue_draw (GTK_WIDGET (fprev)); } } diff --git a/src/widgets/gradient-image.cpp b/src/widgets/gradient-image.cpp index 62a063755..f3a471bfc 100644 --- a/src/widgets/gradient-image.cpp +++ b/src/widgets/gradient-image.cpp @@ -165,7 +165,7 @@ sp_gradient_image_size_allocate (GtkWidget *widget, GtkAllocation *allocation) widget->allocation = *allocation; - if (GTK_WIDGET_REALIZED (widget)) { + if (gtk_widget_get_realized (widget)) { g_free (image->px); image->px = g_new (guchar, 3 * VBLOCK * allocation->width); } @@ -180,7 +180,7 @@ sp_gradient_image_expose (GtkWidget *widget, GdkEventExpose *event) image = SP_GRADIENT_IMAGE (widget); - if (GTK_WIDGET_DRAWABLE (widget)) { + if (gtk_widget_is_drawable (widget)) { gint x0, y0, x1, y1; x0 = MAX (event->area.x, widget->allocation.x); y0 = MAX (event->area.y, widget->allocation.y); @@ -288,7 +288,7 @@ sp_gradient_image_update (SPGradientImage *image) nr_pixblock_release (&pb); } - if (GTK_WIDGET_DRAWABLE (image)) { + if (gtk_widget_is_drawable (GTK_WIDGET (image))) { gtk_widget_queue_draw (GTK_WIDGET (image)); } } diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index c2634f6a1..b1d5c73bb 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -176,7 +176,7 @@ void IconImpl::classInit(SPIconClass *klass) void IconImpl::init(SPIcon *icon) { - GTK_WIDGET_FLAGS(icon) |= GTK_NO_WINDOW; + gtk_widget_set_has_window (GTK_WIDGET (icon), FALSE); icon->lsize = Inkscape::ICON_SIZE_BUTTON; icon->psize = 0; icon->name = 0; @@ -224,14 +224,14 @@ void IconImpl::sizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { widget->allocation = *allocation; - if (GTK_WIDGET_DRAWABLE(widget)) { + if (gtk_widget_is_drawable(widget)) { gtk_widget_queue_draw(widget); } } int IconImpl::expose(GtkWidget *widget, GdkEventExpose *event) { - if ( GTK_WIDGET_DRAWABLE(widget) ) { + if ( gtk_widget_is_drawable(widget) ) { SPIcon *icon = SP_ICON(widget); if ( !icon->pb ) { fetchPixbuf( icon ); @@ -995,13 +995,13 @@ void IconImpl::paint(SPIcon *icon, GdkRectangle const */*area*/) bool unref_image = false; /* copied from the expose function of GtkImage */ - if (GTK_WIDGET_STATE (icon) != GTK_STATE_NORMAL && image) { + if (gtk_widget_get_state (GTK_WIDGET(icon)) != GTK_STATE_NORMAL && image) { GtkIconSource *source = gtk_icon_source_new(); gtk_icon_source_set_pixbuf(source, icon->pb); gtk_icon_source_set_size(source, GTK_ICON_SIZE_SMALL_TOOLBAR); // note: this is boilerplate and not used gtk_icon_source_set_size_wildcarded(source, FALSE); image = gtk_style_render_icon (widget.style, source, gtk_widget_get_direction(&widget), - (GtkStateType) GTK_WIDGET_STATE(&widget), (GtkIconSize)-1, &widget, "gtk-image"); + (GtkStateType) gtk_widget_get_state(&widget), (GtkIconSize)-1, &widget, "gtk-image"); gtk_icon_source_free(source); unref_image = true; } diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index dd0336413..704d395f7 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -246,7 +246,7 @@ sp_ruler_common_draw_ticks (GtkRuler *ruler) g_return_if_fail (ruler != NULL); - if (!GTK_WIDGET_DRAWABLE (ruler)) + if (!gtk_widget_is_drawable (GTK_WIDGET (ruler))) return; g_object_get(G_OBJECT(ruler), "orientation", &orientation, NULL); @@ -425,6 +425,6 @@ sp_ruler_set_metric (GtkRuler *ruler, ruler->metric = const_cast<GtkRulerMetric *>(&sp_ruler_metrics[metric]); - if (GTK_WIDGET_DRAWABLE (ruler)) + if (gtk_widget_is_drawable (GTK_WIDGET (ruler))) gtk_widget_queue_draw (GTK_WIDGET (ruler)); } diff --git a/src/widgets/sp-color-preview.cpp b/src/widgets/sp-color-preview.cpp index aad850b7c..433301f85 100644 --- a/src/widgets/sp-color-preview.cpp +++ b/src/widgets/sp-color-preview.cpp @@ -110,7 +110,7 @@ sp_color_preview_size_allocate (GtkWidget *widget, GtkAllocation *allocation) widget->allocation = *allocation; - if (GTK_WIDGET_DRAWABLE (image)) { + if (gtk_widget_is_drawable (GTK_WIDGET (image))) { gtk_widget_queue_draw (GTK_WIDGET (image)); } } @@ -122,7 +122,7 @@ sp_color_preview_expose (GtkWidget *widget, GdkEventExpose *event) cp = SP_COLOR_PREVIEW (widget); - if (GTK_WIDGET_DRAWABLE (widget)) { + if (gtk_widget_is_drawable (widget)) { sp_color_preview_paint (cp, &event->area); } @@ -146,7 +146,7 @@ sp_color_preview_set_rgba32 (SPColorPreview *cp, guint32 rgba) { cp->rgba = rgba; - if (GTK_WIDGET_DRAWABLE (cp)) { + if (gtk_widget_is_drawable (GTK_WIDGET (cp))) { gtk_widget_queue_draw (GTK_WIDGET (cp)); } } diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp index efea69590..7b365bc73 100644 --- a/src/widgets/sp-color-slider.cpp +++ b/src/widgets/sp-color-slider.cpp @@ -235,7 +235,7 @@ sp_color_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation) widget->allocation = *allocation; - if (GTK_WIDGET_REALIZED (widget)) { + if (gtk_widget_get_realized (widget)) { /* Resize GdkWindow */ gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height); } @@ -248,7 +248,7 @@ sp_color_slider_expose (GtkWidget *widget, GdkEventExpose *event) slider = SP_COLOR_SLIDER (widget); - if (GTK_WIDGET_DRAWABLE (widget)) { + if (gtk_widget_is_drawable (widget)) { gint width, height; width = widget->allocation.width; height = widget->allocation.height; diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp index fd20d8e17..d5877db99 100644 --- a/src/widgets/sp-widget.cpp +++ b/src/widgets/sp-widget.cpp @@ -188,7 +188,7 @@ sp_widget_expose (GtkWidget *widget, GdkEventExpose *event) gtk_container_propagate_expose (GTK_CONTAINER(widget), bin->child, event); } /* - if ((bin->child) && (GTK_WIDGET_NO_WINDOW (bin->child))) { + if ((bin->child) && (!gtk_widget_get_has_window (bin->child))) { GdkEventExpose ce; ce = *event; gtk_widget_event (bin->child, (GdkEvent *) &ce); @@ -237,7 +237,7 @@ sp_widget_construct_global (SPWidget *spw, Inkscape::Application *inkscape) g_return_val_if_fail (!spw->inkscape, NULL); spw->inkscape = inkscape; - if (GTK_WIDGET_VISIBLE (spw)) { + if (gtk_widget_get_visible (GTK_WIDGET(spw))) { g_signal_connect (G_OBJECT (inkscape), "modify_selection", G_CALLBACK (sp_widget_modify_selection), spw); g_signal_connect (G_OBJECT (inkscape), "change_selection", G_CALLBACK (sp_widget_change_selection), spw); g_signal_connect (G_OBJECT (inkscape), "set_selection", G_CALLBACK (sp_widget_set_selection), spw); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 30fb753de..67c15139f 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1794,7 +1794,7 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati { #if DUMP_DETAILS g_message("Set orientation for %p to be %d", toolbox, orientation); - GType type = GTK_WIDGET_TYPE(toolbox); + GType type = G_OBJECT_TYPE(toolbox); g_message(" [%s]", g_type_name(type)); g_message(" %p", g_object_get_data(G_OBJECT(toolbox), BAR_ID_KEY)); #endif @@ -1809,7 +1809,7 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati GtkWidget* child = gtk_bin_get_child(GTK_BIN(toolbox)); if (child) { #if DUMP_DETAILS - GType type2 = GTK_WIDGET_TYPE(child); + GType type2 = G_OBJECT_TYPE(child); g_message(" child [%s]", g_type_name(type2)); #endif // DUMP_DETAILS @@ -1823,7 +1823,7 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati for (GList* curr = children; curr; curr = g_list_next(curr)) { GtkWidget* child2 = GTK_WIDGET(curr->data); #if DUMP_DETAILS - GType type3 = GTK_WIDGET_TYPE(child2); + GType type3 = G_OBJECT_TYPE(child2); g_message(" child2 [%s]", g_type_name(type3)); #endif // DUMP_DETAILS @@ -1833,7 +1833,7 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati for (GList* curr2 = children2; curr2; curr2 = g_list_next(curr2)) { GtkWidget* child3 = GTK_WIDGET(curr2->data); #if DUMP_DETAILS - GType type4 = GTK_WIDGET_TYPE(child3); + GType type4 = G_OBJECT_TYPE(child3); g_message(" child3 [%s]", g_type_name(type4)); #endif // DUMP_DETAILS if (GTK_IS_TOOLBAR(child3)) { -- cgit v1.2.3 From 4294089d059618544c060911e2eb9663ee76c666 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" <jbc.engelen@swissonline.ch> Date: Wed, 15 Jun 2011 20:40:46 +0200 Subject: add preference for relative guideline rotation snapping (see rev 10303) (bzr r10307) --- src/desktop-events.cpp | 28 ++++++++++++++++++++-------- src/ui/dialog/inkscape-preferences.cpp | 5 ++++- src/ui/dialog/inkscape-preferences.h | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index a0ceb77e3..eb2b3a093 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -319,11 +319,17 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); + bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false)); if (snaps) { - Geom::Angle orig_angle(guide->normal_to_line); - Geom::Angle snap_angle = angle - orig_angle; - double sections = floor(snap_angle.radians0() * snaps / M_PI + .5); - angle = (M_PI / snaps) * sections + orig_angle.radians0(); + if (relative_snaps) { + Geom::Angle orig_angle(guide->normal_to_line); + Geom::Angle snap_angle = angle - orig_angle; + double sections = floor(snap_angle.radians0() * snaps / M_PI + .5); + angle = (M_PI / snaps) * sections + orig_angle.radians0(); + } else { + double sections = floor(angle.radians0() * snaps / M_PI + .5); + angle = (M_PI / snaps) * sections; + } } } sp_guide_set_normal(*guide, Geom::Point::polar(angle).cw(), false); @@ -387,11 +393,17 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); + bool const relative_snaps = abs(prefs->getBool("/options/relativeguiderotationsnap/value", false)); if (snaps) { - Geom::Angle orig_angle(guide->normal_to_line); - Geom::Angle snap_angle = angle - orig_angle; - double sections = floor(snap_angle.radians0() * snaps / M_PI + .5); - angle = (M_PI / snaps) * sections + orig_angle.radians0(); + if (relative_snaps) { + Geom::Angle orig_angle(guide->normal_to_line); + Geom::Angle snap_angle = angle - orig_angle; + double sections = floor(snap_angle.radians0() * snaps / M_PI + .5); + angle = (M_PI / snaps) * sections + orig_angle.radians0(); + } else { + double sections = floor(angle.radians0() * snaps / M_PI + .5); + angle = (M_PI / snaps) * sections; + } } } sp_guide_set_normal(*guide, Geom::Point::polar(angle).cw(), true); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index b8b86fac1..52c434961 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -7,7 +7,7 @@ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> * Bruno Dilly <bruno.dilly@gmail.com> * - * Copyright (C) 2004-2007 Authors + * Copyright (C) 2004-2011 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -270,6 +270,9 @@ void InkscapePreferences::initPageSteps() _steps_rot_snap.init("/options/rotationsnapsperpi/value", labels, values, num_items, 12); _page_steps.add_line( false, _("Rotation snaps every:"), _steps_rot_snap, _("degrees"), _("Rotating with Ctrl pressed snaps every that much degrees; also, pressing [ or ] rotates by this amount"), false); + _steps_rot_relative.init ( _("Relative snapping of guideline angles"), "/options/relativeguiderotationsnap/value", false); + _page_steps.add_line( false, "", _steps_rot_relative, "", + _("When on, the snap angles when rotating a guideline will be relative to the original angle")); _steps_zoom.init ( "/options/zoomincrement/value", 101.0, 500.0, 1.0, 1.0, 1.414213562, true, true); _page_steps.add_line( false, _("Zoom in/out by:"), _steps_zoom, _("%"), _("Zoom tool click, +/- keys, and middle click zoom in and out by this multiplier"), false); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 9e51fbf0a..13851e525 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -179,6 +179,7 @@ protected: UI::Widget::PrefCheckButton _snap_mouse_pointer; UI::Widget::PrefCombo _steps_rot_snap; + UI::Widget::PrefCheckButton _steps_rot_relative; UI::Widget::PrefCheckButton _steps_compass; UI::Widget::PrefSpinUnit _steps_arrow; UI::Widget::PrefSpinUnit _steps_scale; -- cgit v1.2.3 From ae9ad270fbb639dd75682e4c808ec656ef9dee6a Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" <jon@joncruz.org> Date: Wed, 15 Jun 2011 23:38:26 -0700 Subject: Fix i18n macro include. (bzr r10309) --- src/widgets/ege-paint-def.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/ege-paint-def.cpp b/src/widgets/ege-paint-def.cpp index 2fc6927df..9eb54b039 100644 --- a/src/widgets/ege-paint-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -50,6 +50,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <glibmm/i18n.h> #include <glibmm/stringutils.h> #if !defined(_) -- cgit v1.2.3 From 2b8e47a2b1d32186fd64d7bababa4481bff2ad01 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" <jon@joncruz.org> Date: Wed, 15 Jun 2011 23:48:54 -0700 Subject: Conditionalize compilation of image magick sources in cmake. (bzr r10310) --- src/extension/CMakeLists.txt | 155 +++++++++++++++++++++++-------------------- 1 file changed, 82 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 8a1ba37dc..60de65416 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -50,43 +50,6 @@ set(extension_SRC internal/javafx-out.cpp internal/svg.cpp internal/svgz.cpp - internal/wpg-input.cpp - - internal/bitmap/adaptiveThreshold.cpp - internal/bitmap/addNoise.cpp - internal/bitmap/blur.cpp - internal/bitmap/channel.cpp - internal/bitmap/charcoal.cpp - internal/bitmap/colorize.cpp - internal/bitmap/contrast.cpp - internal/bitmap/cycleColormap.cpp - internal/bitmap/despeckle.cpp - internal/bitmap/edge.cpp - internal/bitmap/emboss.cpp - internal/bitmap/enhance.cpp - internal/bitmap/equalize.cpp - internal/bitmap/gaussianBlur.cpp - internal/bitmap/imagemagick.cpp - internal/bitmap/implode.cpp - internal/bitmap/level.cpp - internal/bitmap/levelChannel.cpp - internal/bitmap/medianFilter.cpp - internal/bitmap/modulate.cpp - internal/bitmap/negate.cpp - internal/bitmap/normalize.cpp - internal/bitmap/oilPaint.cpp - internal/bitmap/opacity.cpp - internal/bitmap/raise.cpp - internal/bitmap/reduceNoise.cpp - internal/bitmap/sample.cpp - internal/bitmap/shade.cpp - internal/bitmap/sharpen.cpp - internal/bitmap/solarize.cpp - internal/bitmap/spread.cpp - internal/bitmap/swirl.cpp - internal/bitmap/threshold.cpp - internal/bitmap/unsharpmask.cpp - internal/bitmap/wave.cpp internal/filter/filter-all.cpp internal/filter/filter-file.cpp @@ -141,41 +104,6 @@ set(extension_SRC implementation/script.h implementation/xslt.h - internal/bitmap/adaptiveThreshold.h - internal/bitmap/addNoise.h - internal/bitmap/blur.h - internal/bitmap/channel.h - internal/bitmap/charcoal.h - internal/bitmap/colorize.h - internal/bitmap/contrast.h - internal/bitmap/cycleColormap.h - internal/bitmap/despeckle.h - internal/bitmap/edge.h - internal/bitmap/emboss.h - internal/bitmap/enhance.h - internal/bitmap/equalize.h - internal/bitmap/gaussianBlur.h - internal/bitmap/imagemagick.h - internal/bitmap/implode.h - internal/bitmap/level.h - internal/bitmap/levelChannel.h - internal/bitmap/medianFilter.h - internal/bitmap/modulate.h - internal/bitmap/negate.h - internal/bitmap/normalize.h - internal/bitmap/oilPaint.h - internal/bitmap/opacity.h - internal/bitmap/raise.h - internal/bitmap/reduceNoise.h - internal/bitmap/sample.h - internal/bitmap/shade.h - internal/bitmap/sharpen.h - internal/bitmap/solarize.h - internal/bitmap/spread.h - internal/bitmap/swirl.h - internal/bitmap/threshold.h - internal/bitmap/unsharpmask.h - internal/bitmap/wave.h internal/bluredge.h internal/cairo-png-out.h internal/cairo-ps-out.h @@ -209,7 +137,6 @@ set(extension_SRC internal/svg.h internal/svgz.h internal/win32.h - internal/wpg-input.h script/InkscapeScript.h ) @@ -221,6 +148,88 @@ if(WIN32) ) endif() +if(LibWPG_FOUND) + list(APPEND extension_SRC + internal/wpg-input.cpp + internal/wpg-input.h + ) +endif() + +if(ImageMagick_FOUND) + list(APPEND extension_SRC + internal/bitmap/adaptiveThreshold.cpp + internal/bitmap/adaptiveThreshold.h + internal/bitmap/addNoise.cpp + internal/bitmap/addNoise.h + internal/bitmap/blur.cpp + internal/bitmap/blur.h + internal/bitmap/channel.cpp + internal/bitmap/channel.h + internal/bitmap/charcoal.cpp + internal/bitmap/charcoal.h + internal/bitmap/colorize.cpp + internal/bitmap/colorize.h + internal/bitmap/contrast.cpp + internal/bitmap/contrast.h + internal/bitmap/cycleColormap.cpp + internal/bitmap/cycleColormap.h + internal/bitmap/despeckle.cpp + internal/bitmap/despeckle.h + internal/bitmap/edge.cpp + internal/bitmap/edge.h + internal/bitmap/emboss.cpp + internal/bitmap/emboss.h + internal/bitmap/enhance.cpp + internal/bitmap/enhance.h + internal/bitmap/equalize.cpp + internal/bitmap/equalize.h + internal/bitmap/gaussianBlur.cpp + internal/bitmap/gaussianBlur.h + internal/bitmap/imagemagick.cpp + internal/bitmap/imagemagick.h + internal/bitmap/implode.cpp + internal/bitmap/implode.h + internal/bitmap/level.cpp + internal/bitmap/level.h + internal/bitmap/levelChannel.cpp + internal/bitmap/levelChannel.h + internal/bitmap/medianFilter.cpp + internal/bitmap/medianFilter.h + internal/bitmap/modulate.cpp + internal/bitmap/modulate.h + internal/bitmap/negate.cpp + internal/bitmap/negate.h + internal/bitmap/normalize.cpp + internal/bitmap/normalize.h + internal/bitmap/oilPaint.cpp + internal/bitmap/oilPaint.h + internal/bitmap/opacity.cpp + internal/bitmap/opacity.h + internal/bitmap/raise.cpp + internal/bitmap/raise.h + internal/bitmap/reduceNoise.cpp + internal/bitmap/reduceNoise.h + internal/bitmap/sample.cpp + internal/bitmap/sample.h + internal/bitmap/shade.cpp + internal/bitmap/shade.h + internal/bitmap/sharpen.cpp + internal/bitmap/sharpen.h + internal/bitmap/solarize.cpp + internal/bitmap/solarize.h + internal/bitmap/spread.cpp + internal/bitmap/spread.h + internal/bitmap/swirl.cpp + internal/bitmap/swirl.h + internal/bitmap/threshold.cpp + internal/bitmap/threshold.h + internal/bitmap/unsharpmask.cpp + internal/bitmap/unsharpmask.h + internal/bitmap/wave.cpp + internal/bitmap/wave.h + ) +endif() + if(WITH_DBUS) list(APPEND extension_SRC dbus/application-interface.cpp -- cgit v1.2.3 From fb4410db05004e20de5c86a56a0b9b330ad3f81e Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Fri, 17 Jun 2011 02:37:18 -0300 Subject: patch reviewed and accepted from fernandolbastos@gmail.com (GSoC student) Split scripting ui in the document properties dialog to have one tab for embedded scripts and one for external scripts. (bzr r10312) --- src/ui/dialog/document-properties.cpp | 29 +++++++++++++++++++++-------- src/ui/dialog/document-properties.h | 5 +++++ 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index b2ca2a3a8..528f036a2 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -88,6 +88,7 @@ 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), //--------------------------------------------------------------- _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), @@ -584,27 +585,36 @@ DocumentProperties::build_scripting() { _page_scripting.show(); + _page_scripting.set_spacing (4); + _page_scripting.pack_start(_scripting_notebook, true, true); + + _scripting_notebook.append_page(_page_external_scripts, _("External scripts")); + _scripting_notebook.append_page(_page_embedded_scripts, _("Embedded scripts")); + + _page_external_scripts.show(); + _page_embedded_scripts.show(); + Gtk::Label *label_script= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); label_script->set_markup (_("<b>External script files:</b>")); _add_btn.set_label(_("Add")); - _page_scripting.set_spacing(4); + _page_external_scripts.set_spacing(4); gint row = 0; label_script->set_alignment(0.0); - _page_scripting.table().attach(*label_script, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts.table().attach(*label_script, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_scripting.table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts.table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_scripting.table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts.table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - _page_scripting.table().attach(_script_entry, 0, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_scripting.table().attach(_add_btn, 2, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts.table().attach(_script_entry, 0, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + _page_external_scripts.table().attach(_add_btn, 2, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; //# Set up the External Scripts box @@ -675,8 +685,11 @@ void DocumentProperties::removeExternalScript(){ if (name == script->xlinkhref){ //XML Tree being used directly here while it shouldn't be. - sp_repr_unparent(obj->getRepr()); - DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + sp_repr_unparent(repr); + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); + } } current = g_slist_next(current); } diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index b88f0db26..55070d2e2 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -82,6 +82,11 @@ protected: UI::Widget::NotebookPage _page_snap; UI::Widget::NotebookPage _page_cms; UI::Widget::NotebookPage _page_scripting; + + Gtk::Notebook _scripting_notebook; + UI::Widget::NotebookPage _page_external_scripts; + UI::Widget::NotebookPage _page_embedded_scripts; + Gtk::VBox _grids_vbox; UI::Widget::Registry _wr; -- cgit v1.2.3 From 2f9696ca1493513b67e35229b18d15f1fbbda0f1 Mon Sep 17 00:00:00 2001 From: Ivan Mas??r <helix84@centrum.sk> Date: Fri, 17 Jun 2011 10:21:05 +0200 Subject: * [INTL:sk] Slovak translation update * fix typo (bzr r10313) --- src/extension/internal/filter/experimental.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/internal/filter/experimental.h b/src/extension/internal/filter/experimental.h index 8d260f62e..f60a6b414 100755 --- a/src/extension/internal/filter/experimental.h +++ b/src/extension/internal/filter/experimental.h @@ -335,7 +335,7 @@ public: "<param name=\"simply\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.6</param>\n" "<param name=\"clean\" gui-text=\"" N_("Clean-up:") "\" type=\"int\" appearance=\"full\" min=\"1\" max=\"500\">10</param>\n" "<param name=\"erase\" gui-text=\"" N_("Erase:") "\" type=\"float\" appearance=\"full\" min=\"0\" max=\"60\">0</param>\n" - "<param name=\"transluscent\" gui-text=\"" N_("Transluscent") "\" type=\"boolean\" >false</param>\n" + "<param name=\"translucent\" gui-text=\"" N_("Translucent") "\" type=\"boolean\" >false</param>\n" "<_param name=\"smoothheader\" type=\"description\" appearance=\"header\">Smoothness</_param>\n" "<param name=\"smooth\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.6</param>\n" "<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" appearance=\"full\" min=\"1\" max=\"50\">6</param>\n" -- cgit v1.2.3 From 637e36780dacfed78c322064e322f247bd764fd1 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Sat, 18 Jun 2011 05:51:28 -0300 Subject: user interface for selecting colors of guidelines (bzr r10315) --- src/sp-guide.cpp | 17 +++++++++++++++++ src/sp-guide.h | 1 + src/ui/dialog/guides.cpp | 16 ++++++++++++++++ src/ui/dialog/guides.h | 3 +++ 4 files changed, 37 insertions(+) (limited to 'src') diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 584a6a366..19b64eb1a 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -412,6 +412,23 @@ void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool */ } +void sp_guide_set_color(SPGuide &guide, const unsigned char r, const unsigned char g, const unsigned char b, bool const commit) +{ + g_assert(SP_IS_GUIDE(&guide)); + guide.color = (r << 24) | (g << 16) | (b << 8) | 0x7f; + + if (guide.views){ + sp_guideline_set_color(SP_GUIDELINE(guide.views->data), guide.color); + } + + if (commit){ + std::ostringstream os; + os << "rgb(" << r << "," << g << "," << b << ")"; + //XML Tree being used directly while it shouldn't be + guide.getRepr()->setAttribute("inkscape:color", os.str().c_str()); + } +} + void sp_guide_set_label(SPGuide &guide, const char* label, bool const commit) { g_assert(SP_IS_GUIDE(&guide)); diff --git a/src/sp-guide.h b/src/sp-guide.h index a164fda84..8cf9c7dc2 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -64,6 +64,7 @@ void sp_guide_create_guides_around_page(SPDesktop *dt); void sp_guide_moveto(SPGuide &guide, Geom::Point const point_on_line, bool const commit); void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool const commit); void sp_guide_set_label(SPGuide &guide, const char* label, bool const commit); +void sp_guide_set_color(SPGuide &guide, const unsigned char r, const unsigned char g, const unsigned char b, bool const commit); void sp_guide_remove(SPGuide *guide); char *sp_guide_description(SPGuide const *guide, const bool verbose = true); diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index da517ba1a..3e324ca67 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -63,6 +63,14 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) { dialog.run(); } +void GuidelinePropertiesDialog::_colorChanged() +{ + const Gdk::Color c = _color.get_color(); + char r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257; + //TODO: why 257? verify this! + sp_guide_set_color(*_guide, r, g, b, true); +} + void GuidelinePropertiesDialog::_modeChanged() { _mode = !_relative_toggle.get_active(); @@ -177,6 +185,11 @@ void GuidelinePropertiesDialog::_setup() { _layout_table.attach(_label_entry, 1, 3, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + _layout_table.attach(_color, + 1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + _color.signal_color_set().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_colorChanged)); + + // unitmenus /* fixme: We should allow percents here too, as percents of the canvas size */ _unit_menu.setUnitType(UNIT_TYPE_LINEAR); @@ -254,6 +267,9 @@ void GuidelinePropertiesDialog::_setup() { // init name entry _label_entry.getEntry()->set_text(_guide->label ? _guide->label : ""); + Gdk::Color c; + c.set_rgb_p(((_guide->color>>24)&0xff) / 255.0, ((_guide->color>>16)&0xff) / 255.0, ((_guide->color>>8)&0xff) / 255.0); + _color.set_color(c); _modeChanged(); // sets values of spinboxes. diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index efef0142b..88d0310b9 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -20,6 +20,7 @@ #include <gtkmm/label.h> #include <gtkmm/stock.h> #include <gtkmm/adjustment.h> +#include <gtkmm/colorbutton.h> #include "ui/widget/button.h" #include "ui/widget/spinbutton.h" #include "ui/widget/unit-menu.h" @@ -57,6 +58,7 @@ protected: void _response(gint response); void _modeChanged(); + void _colorChanged(); private: GuidelinePropertiesDialog(GuidelinePropertiesDialog const &); // no copy @@ -73,6 +75,7 @@ private: Inkscape::UI::Widget::ScalarUnit _spin_button_x; Inkscape::UI::Widget::ScalarUnit _spin_button_y; Inkscape::UI::Widget::Entry _label_entry; + Gtk::ColorButton _color; Inkscape::UI::Widget::ScalarUnit _spin_angle; static Glib::ustring _angle_unit_status; // remember the status of the _relative_toggle_status button across instances -- cgit v1.2.3 From 3c97d4754f895c7c72733689122d4ba5cd03498e Mon Sep 17 00:00:00 2001 From: Kris De Gussem <kris.degussem@gmail.com> Date: Sat, 18 Jun 2011 12:41:38 +0200 Subject: UI fix / mnemonics (bzr r10317) --- src/ui/dialog/guides.cpp | 8 ++++---- src/ui/dialog/inkscape-preferences.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 3e324ca67..542fed5bb 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -40,10 +40,10 @@ namespace Dialogs { GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop) : _desktop(desktop), _guide(guide), _relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")), - _spin_button_x(_("X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), - _spin_button_y(_("Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), - _label_entry(_("Label:"), _("Optionally give this guideline a name")), - _spin_angle(_("Angle:"), "", UNIT_TYPE_RADIAL), + _spin_button_x(_("_X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), + _spin_button_y(_("_Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), + _label_entry(_("_Label:"), _("Optionally give this guideline a name")), + _spin_angle(_("_Angle:"), "", UNIT_TYPE_RADIAL), _mode(true), _oldpos(0.,0.), _oldangle(0.0) { } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 52c434961..3c272e691 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -487,7 +487,7 @@ void InkscapePreferences::initPageTools() this->AddPage(_page_measure, _("Measure"), iter_tools, PREFS_PAGE_TOOLS_MEASURE); PrefCheckButton* cb = Gtk::manage( new PrefCheckButton); cb->init ( _("Ignore first and last points"), "/tools/measure/ignore_1st_and_last", true); - _page_measure.add_line( false, "", *cb, "", _("The beggining and end of the measurement tool's control line will not be considered for calculating lengths. Only lengths between actual curve intersections will be displayed.")); + _page_measure.add_line( false, "", *cb, "", _("The start and end of the measurement tool's control line will not be considered for calculating lengths. Only lengths between actual curve intersections will be displayed.")); //Shapes Gtk::TreeModel::iterator iter_shapes = this->AddPage(_page_shapes, _("Shapes"), iter_tools, PREFS_PAGE_TOOLS_SHAPES); -- cgit v1.2.3 From 2fc19c4d9d209ed32560c558487954b94755b7f1 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Sat, 18 Jun 2011 21:19:11 -0300 Subject: Patch sent by Fernando Lucchesi (GSoC student) and modified by me. Interface for editing content of embedded scripts. (bzr r10318) --- src/ui/dialog/document-properties.cpp | 242 +++++++++++++++++++++++++++++++--- src/ui/dialog/document-properties.h | 27 +++- src/verbs.h | 3 + 3 files changed, 251 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 528f036a2..4434e3bd6 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -460,6 +460,13 @@ void DocumentProperties::external_scripts_list_button_release(GdkEventButton* ev } } +void DocumentProperties::embedded_scripts_list_button_release(GdkEventButton* event) +{ + if((event->type == GDK_BUTTON_RELEASE) && (event->button == 3)) { + _EmbeddedScriptsContextMenu.popup(event->button, event->time); + } +} + void DocumentProperties::linked_profiles_list_button_release(GdkEventButton* event) { if((event->type == GDK_BUTTON_RELEASE) && (event->button == 3)) { @@ -477,7 +484,7 @@ void DocumentProperties::cms_create_popup_menu(Gtk::Widget& parent, sigc::slot<v } -void DocumentProperties::scripting_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem) +void DocumentProperties::external_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem) { Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); _ExternalScriptsContextMenu.append(*mi); @@ -486,6 +493,15 @@ void DocumentProperties::scripting_create_popup_menu(Gtk::Widget& parent, sigc:: _ExternalScriptsContextMenu.accelerate(parent); } +void DocumentProperties::embedded_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem) +{ + Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + _EmbeddedScriptsContextMenu.append(*mi); + mi->signal_activate().connect(rem); + mi->show(); + _EmbeddedScriptsContextMenu.accelerate(parent); +} + void DocumentProperties::removeSelectedProfile(){ Glib::ustring name; if(_LinkedProfilesList.get_selection()) { @@ -591,26 +607,26 @@ DocumentProperties::build_scripting() _scripting_notebook.append_page(_page_external_scripts, _("External scripts")); _scripting_notebook.append_page(_page_embedded_scripts, _("Embedded scripts")); + //# External scripts tab _page_external_scripts.show(); - _page_embedded_scripts.show(); - - Gtk::Label *label_script= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); - label_script->set_markup (_("<b>External script files:</b>")); + + Gtk::Label *label_external= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); + label_external->set_markup (_("<b>External script files:</b>")); _add_btn.set_label(_("Add")); _page_external_scripts.set_spacing(4); gint row = 0; - label_script->set_alignment(0.0); - _page_external_scripts.table().attach(*label_script, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + label_external->set_alignment(0.0); + _page_external_scripts.table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; _page_external_scripts.table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; - Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); - spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - _page_external_scripts.table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox()); + spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); + _page_external_scripts.table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); row++; _page_external_scripts.table().attach(_script_entry, 0, 2, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); @@ -624,7 +640,58 @@ DocumentProperties::build_scripting() _ExternalScriptsList.set_headers_visible(true); // TODO restore? _ExternalScriptsList.set_fixed_height_mode(true); - populate_external_scripts_box(); + + //# Embedded scripts tab + _page_embedded_scripts.show(); + + Gtk::Label *label_embedded= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); + label_embedded->set_markup (_("<b>Embedded script files:</b>")); + + _new_btn.set_label(_("New")); + + _page_embedded_scripts.set_spacing(4); + row = 0; + + label_embedded->set_alignment(0.0); + _page_embedded_scripts.table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + row++; + _page_embedded_scripts.table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + row++; + + Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); + spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); + _page_embedded_scripts.table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + row++; + + _page_embedded_scripts.table().attach(_new_btn, 2, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + row++; + + //# Set up the Embedded Scripts box + _EmbeddedScriptsListStore = Gtk::ListStore::create(_EmbeddedScriptsListColumns); + _EmbeddedScriptsList.set_model(_EmbeddedScriptsListStore); + _EmbeddedScriptsList.append_column(_("Script id"), _EmbeddedScriptsListColumns.idColumn); + _EmbeddedScriptsList.set_headers_visible(true); +// TODO restore? _EmbeddedScriptsList.set_fixed_height_mode(true); + + //# Set up the Embedded Scripts content box + Gtk::Label *label_embedded_content= manage (new Gtk::Label("", Gtk::ALIGN_LEFT)); + label_embedded_content->set_markup (_("<b>Content:</b>")); + + label_embedded_content->set_alignment(0.0); + _page_embedded_scripts.table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + row++; + + _page_embedded_scripts.table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); + + _EmbeddedContentScroller.add(_EmbeddedContent); + _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); + _EmbeddedContentScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + _EmbeddedContentScroller.set_size_request(-1, -1); + + _EmbeddedScriptsList.signal_cursor_changed().connect(sigc::mem_fun(*this, &DocumentProperties::changeEmbeddedScript)); + _EmbeddedContent.get_buffer()->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::editEmbeddedScript)); + + populate_script_lists(); _ExternalScriptsListScroller.add(_ExternalScriptsList); _ExternalScriptsListScroller.set_shadow_type(Gtk::SHADOW_IN); @@ -633,17 +700,28 @@ DocumentProperties::build_scripting() _add_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addExternalScript)); + _EmbeddedScriptsListScroller.add(_EmbeddedScriptsList); + _EmbeddedScriptsListScroller.set_shadow_type(Gtk::SHADOW_IN); + _EmbeddedScriptsListScroller.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS); + _EmbeddedScriptsListScroller.set_size_request(-1, 90); + + _new_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addEmbeddedScript)); + + #if ENABLE_LCMS _ExternalScriptsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::external_scripts_list_button_release)); - scripting_create_popup_menu(_ExternalScriptsList, sigc::mem_fun(*this, &DocumentProperties::removeExternalScript)); + external_create_popup_menu(_ExternalScriptsList, sigc::mem_fun(*this, &DocumentProperties::removeExternalScript)); + + _EmbeddedScriptsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::embedded_scripts_list_button_release)); + embedded_create_popup_menu(_EmbeddedScriptsList, sigc::mem_fun(*this, &DocumentProperties::removeEmbeddedScript)); #endif // ENABLE_LCMS //TODO: review this observers code: const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); if (current) { - _ext_scripts_observer.set(SP_OBJECT(current->data)->parent); + _scripts_observer.set(SP_OBJECT(current->data)->parent); } - _ext_scripts_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_external_scripts_box)); + _scripts_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_script_lists)); } @@ -662,7 +740,24 @@ void DocumentProperties::addExternalScript(){ // inform the document, so we can undo DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, _("Add external script...")); - populate_external_scripts_box(); + populate_script_lists(); + } +} + +void DocumentProperties::addEmbeddedScript(){ + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (!desktop){ + g_warning("No active desktop"); + } else { + Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); + Inkscape::XML::Node *scriptRepr = xml_doc->createElement("svg:script"); + + xml_doc->root()->addChild(scriptRepr, NULL); + + // inform the document, so we can undo + DocumentUndo::done(desktop->doc(), SP_VERB_EDIT_ADD_EMBEDDED_SCRIPT, _("Add embedded script...")); + + populate_script_lists(); } } @@ -688,20 +783,126 @@ void DocumentProperties::removeExternalScript(){ Inkscape::XML::Node *repr = obj->getRepr(); if (repr){ sp_repr_unparent(repr); + + // inform the document, so we can undo DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); } } current = g_slist_next(current); } - populate_external_scripts_box(); + populate_script_lists(); +} + +void DocumentProperties::removeEmbeddedScript(){ + Glib::ustring id; + if(_EmbeddedScriptsList.get_selection()) { + Gtk::TreeModel::iterator i = _EmbeddedScriptsList.get_selection()->get_selected(); + + if(i){ + id = (*i)[_EmbeddedScriptsListColumns.idColumn]; + } else { + return; + } + } + + const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); + while ( current ) { + SPObject* obj = SP_OBJECT(current->data); + if (id == obj->getId()){ + + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + sp_repr_unparent(repr); + + // inform the document, so we can undo + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script")); + } + } + current = g_slist_next(current); + } + + populate_script_lists(); +} + +void DocumentProperties::changeEmbeddedScript(){ + Glib::ustring id; + if(_EmbeddedScriptsList.get_selection()) { + Gtk::TreeModel::iterator i = _EmbeddedScriptsList.get_selection()->get_selected(); + + if(i){ + id = (*i)[_EmbeddedScriptsListColumns.idColumn]; + } else { + return; + } + } + + bool voidscript=true; + const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); + while ( current ) { + SPObject* obj = SP_OBJECT(current->data); + if (id == obj->getId()){ + + //XML Tree being used directly here while it shouldn't be. + SPObject* child = obj->firstChild(); + //TODO: shouldnt we get all children instead of simply the first child? + + if (child && child->getRepr()){ + const gchar* content = child->getRepr()->content(); + if (content){ + voidscript=false; + _EmbeddedContent.get_buffer()->set_text(content); + } + } + } + current = g_slist_next(current); + } + + if (voidscript) + _EmbeddedContent.get_buffer()->set_text(""); +} + +void DocumentProperties::editEmbeddedScript(){ + Glib::ustring id; + if(_EmbeddedScriptsList.get_selection()) { + Gtk::TreeModel::iterator i = _EmbeddedScriptsList.get_selection()->get_selected(); + + if(i){ + id = (*i)[_EmbeddedScriptsListColumns.idColumn]; + } else { + return; + } + } + + Inkscape::XML::Document *xml_doc = SP_ACTIVE_DOCUMENT->getReprDoc(); + const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); + while ( current ) { + SPObject* obj = SP_OBJECT(current->data); + if (id == obj->getId()){ + + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *repr = obj->getRepr(); + if (repr){ + SPObject *child; + while (NULL != (child = obj->firstChild())) child->deleteObject(); + obj->appendChildRepr(xml_doc->createTextNode(_EmbeddedContent.get_buffer()->get_text().c_str())); + //TODO repr->set_content(_EmbeddedContent.get_buffer()->get_text()); + + // inform the document, so we can undo + DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_EMBEDDED_SCRIPT, _("Edit embedded script")); + } + } + current = g_slist_next(current); + } } -void DocumentProperties::populate_external_scripts_box(){ +void DocumentProperties::populate_script_lists(){ _ExternalScriptsListStore->clear(); + _EmbeddedScriptsListStore->clear(); const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); - if (current) _ext_scripts_observer.set(SP_OBJECT(current->data)->parent); + if (current) _scripts_observer.set(SP_OBJECT(current->data)->parent); while ( current ) { SPObject* obj = SP_OBJECT(current->data); SPScript* script = (SPScript*) obj; @@ -710,6 +911,11 @@ void DocumentProperties::populate_external_scripts_box(){ Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append()); row[_ExternalScriptsListColumns.filenameColumn] = script->xlinkhref; } + else // Embedded scripts + { + Gtk::TreeModel::Row row = *(_EmbeddedScriptsListStore->append()); + row[_EmbeddedScriptsListColumns.idColumn] = obj->getId(); + } current = g_slist_next(current); } diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 55070d2e2..69729f2da 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -64,16 +64,22 @@ protected: #endif // ENABLE_LCMS void external_scripts_list_button_release(GdkEventButton* event); - void populate_external_scripts_box(); + void embedded_scripts_list_button_release(GdkEventButton* event); + void populate_script_lists(); void addExternalScript(); + void addEmbeddedScript(); void removeExternalScript(); - void scripting_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem); + void removeEmbeddedScript(); + void changeEmbeddedScript(); + void editEmbeddedScript(); + void external_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem); + void embedded_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem); void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop); - Inkscape::XML::SignalObserver _emb_profiles_observer, _ext_scripts_observer; + Inkscape::XML::SignalObserver _emb_profiles_observer, _scripts_observer; Gtk::Tooltips _tt; Gtk::Notebook _notebook; @@ -127,6 +133,7 @@ protected: //--------------------------------------------------------------- Gtk::Button _add_btn; + Gtk::Button _new_btn; class ExternalScriptsColumns : public Gtk::TreeModel::ColumnRecord { public: @@ -135,11 +142,25 @@ protected: Gtk::TreeModelColumn<Glib::ustring> filenameColumn; }; ExternalScriptsColumns _ExternalScriptsListColumns; + class EmbeddedScriptsColumns : public Gtk::TreeModel::ColumnRecord + { + public: + EmbeddedScriptsColumns() + { add(idColumn); } + Gtk::TreeModelColumn<Glib::ustring> idColumn; + }; + EmbeddedScriptsColumns _EmbeddedScriptsListColumns; Glib::RefPtr<Gtk::ListStore> _ExternalScriptsListStore; + Glib::RefPtr<Gtk::ListStore> _EmbeddedScriptsListStore; Gtk::TreeView _ExternalScriptsList; + Gtk::TreeView _EmbeddedScriptsList; Gtk::ScrolledWindow _ExternalScriptsListScroller; + Gtk::ScrolledWindow _EmbeddedScriptsListScroller; Gtk::Menu _ExternalScriptsContextMenu; + Gtk::Menu _EmbeddedScriptsContextMenu; Gtk::Entry _script_entry; + Gtk::TextView _EmbeddedContent; + Gtk::ScrolledWindow _EmbeddedContentScroller; //--------------------------------------------------------------- Gtk::Notebook _grids_notebook; diff --git a/src/verbs.h b/src/verbs.h index de7a96797..dd5c4db35 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -289,7 +289,10 @@ enum { SP_VERB_EDIT_REMOVE_COLOR_PROFILE, /*Scripting*/ SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, + SP_VERB_EDIT_ADD_EMBEDDED_SCRIPT, + SP_VERB_EDIT_EMBEDDED_SCRIPT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, + SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, /* Footer */ SP_VERB_LAST }; -- cgit v1.2.3 From ac1f4a1f7b4c9263d2ab490b8f346c5ef0a4b716 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Sat, 18 Jun 2011 22:47:52 -0300 Subject: I am not sure if it is possible to have a script element with more than a single childnode. Since we are not handling that, this is a warning to be displayed if we even encounter a file with more than one child for one of its script element nodes (bzr r10319) --- src/ui/dialog/document-properties.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 4434e3bd6..569dd2311 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -844,6 +844,15 @@ void DocumentProperties::changeEmbeddedScript(){ SPObject* obj = SP_OBJECT(current->data); if (id == obj->getId()){ + int count=0; + for ( SPObject *child = obj->children ; child; child = child->next ) + { + count++; + } + + if (count>1) + g_warning("TODO: Found a script element with multiple (%d) child nodes! We must implement support for that!", count); + //XML Tree being used directly here while it shouldn't be. SPObject* child = obj->firstChild(); //TODO: shouldnt we get all children instead of simply the first child? -- cgit v1.2.3 From 8e814a1af48de1e92387c76f50f1af319507bfba Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches <juca@members.fsf.org> Date: Sun, 19 Jun 2011 03:49:11 -0300 Subject: fix bug 796451: Measure tools should support rotation constraint (bzr r10320) --- src/measure-context.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 78bfb1cee..8920facb9 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -26,6 +26,7 @@ #include "inkscape.h" #include "desktop-handles.h" #include "measure-context.h" +#include "draw-context.h" #include "display/canvas-text.h" #include "path-chemistry.h" #include "2geom/line.h" @@ -184,17 +185,21 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv Geom::Point const motion_w(event->motion.x, event->motion.y); Geom::Point const motion_dt(desktop->w2d(motion_w)); + Geom::Point end_point = motion_dt; - sp_ctrlline_set_coords (SP_CTRLLINE(line), start_point[Geom::X], start_point[Geom::Y], motion_dt[Geom::X], motion_dt[Geom::Y]); + if (event->motion.state & GDK_CONTROL_MASK) + spdc_endpoint_snap_rotation(event_context, end_point, start_point, event->motion.state); + + sp_ctrlline_set_coords (SP_CTRLLINE(line), start_point[Geom::X], start_point[Geom::Y], end_point[Geom::X], end_point[Geom::Y]); Geom::PathVector lineseg; Geom::Path p; p.start(desktop->dt2doc(start_point)); - p.appendNew<Geom::LineSegment>(desktop->dt2doc(motion_dt)); + p.appendNew<Geom::LineSegment>(desktop->dt2doc(end_point)); lineseg.push_back(p); - double deltax = motion_dt[Geom::X] - start_point[Geom::X]; - double deltay = motion_dt[Geom::Y] - start_point[Geom::Y]; + double deltax = end_point[Geom::X] - start_point[Geom::X]; + double deltay = end_point[Geom::Y] - start_point[Geom::Y]; double angle = atan2(deltay, deltax); //TODO: calculate NPOINTS @@ -204,7 +209,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv std::vector<Geom::Point> points; double i; for (i=0; i<NPOINTS; i++){ - points.push_back(desktop->d2w(start_point + (i/NPOINTS)*(motion_dt-start_point))); + points.push_back(desktop->d2w(start_point + (i/NPOINTS)*(end_point-start_point))); } //select elements crossed by line segment: @@ -260,7 +265,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } if (!ignore_1st_and_last){ - intersections.push_back(desktop->dt2doc(motion_dt)); + intersections.push_back(desktop->dt2doc(end_point)); } //sort intersections @@ -321,7 +326,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv char* angle_str = (char*) malloc(sizeof(char)*20); sprintf(angle_str, "%.2f °", angle * 180/3.1415 ); - SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, motion_dt + desktop->w2d(Geom::Point(5*fontsize,0)), angle_str); + SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, end_point + desktop->w2d(Geom::Point(5*fontsize,0)), angle_str); sp_canvastext_set_fontsize (SP_CANVASTEXT(canvas_tooltip), fontsize); sp_canvastext_set_rgba32 (SP_CANVASTEXT(canvas_tooltip), 0x337f33ff, 0xffffffff); -- cgit v1.2.3