summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ui/CMakeLists.txt2
-rw-r--r--src/ui/widget/dash-selector.cpp (renamed from src/widgets/dash-selector.cpp)35
-rw-r--r--src/ui/widget/dash-selector.h (renamed from src/widgets/dash-selector.h)13
-rw-r--r--src/widgets/CMakeLists.txt2
-rwxr-xr-xsrc/widgets/stroke-style.cpp7
-rw-r--r--src/widgets/stroke-style.h6
6 files changed, 40 insertions, 25 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index f0c0b2fe3..d95a5e748 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -157,6 +157,7 @@ set(ui_SRC
widget/color-scales.cpp
widget/color-slider.cpp
widget/color-wheel-selector.cpp
+ widget/dash-selector.cpp
widget/dock-item.cpp
widget/dock.cpp
widget/entity-entry.cpp
@@ -380,6 +381,7 @@ set(ui_SRC
widget/color-slider.h
widget/color-wheel-selector.h
widget/combo-enums.h
+ widget/dash-selector.h
widget/dock-item.h
widget/dock.h
widget/entity-entry.h
diff --git a/src/widgets/dash-selector.cpp b/src/ui/widget/dash-selector.cpp
index 16520bbf4..59149fb7c 100644
--- a/src/widgets/dash-selector.cpp
+++ b/src/ui/widget/dash-selector.cpp
@@ -30,7 +30,11 @@
#include "ui/dialog-events.h"
#include "ui/widget/spinbutton.h"
-gchar const *const SPDashSelector::_prefs_path = "/palette/dashes";
+namespace Inkscape {
+namespace UI {
+namespace Widget {
+
+gchar const *const DashSelector::_prefs_path = "/palette/dashes";
static double dash_0[] = {-1.0};
static double dash_1_1[] = {1.0, 1.0, -1.0};
@@ -44,7 +48,7 @@ static double *builtin_dashes[] = {dash_0, dash_1_1, dash_2_1, dash_4_1, dash_1_
static double **dashes = nullptr;
-SPDashSelector::SPDashSelector()
+DashSelector::DashSelector()
: preview_width(80),
preview_height(16),
preview_lineheight(2)
@@ -55,15 +59,15 @@ SPDashSelector::SPDashSelector()
dash_store = Gtk::ListStore::create(dash_columns);
dash_combo.set_model(dash_store);
dash_combo.pack_start(image_renderer);
- dash_combo.set_cell_data_func(image_renderer, sigc::mem_fun(*this, &SPDashSelector::prepareImageRenderer));
+ dash_combo.set_cell_data_func(image_renderer, sigc::mem_fun(*this, &DashSelector::prepareImageRenderer));
dash_combo.set_tooltip_text(_("Dash pattern"));
dash_combo.set_name("dashCombo");
dash_combo.show();
- dash_combo.signal_changed().connect( sigc::mem_fun(*this, &SPDashSelector::on_selection) );
+ dash_combo.signal_changed().connect( sigc::mem_fun(*this, &DashSelector::on_selection) );
this->pack_start(dash_combo, false, false, 0);
offset = Gtk::Adjustment::create(0.0, 0.0, 10.0, 0.1, 1.0, 0.0);
- offset->signal_value_changed().connect(sigc::mem_fun(*this, &SPDashSelector::offset_value_changed));
+ offset->signal_value_changed().connect(sigc::mem_fun(*this, &DashSelector::offset_value_changed));
auto sb = new Inkscape::UI::Widget::SpinButton(offset, 0.1, 2);
sb->set_tooltip_text(_("Pattern offset"));
sp_dialog_defocus_on_enter_cpp(sb);
@@ -88,18 +92,18 @@ SPDashSelector::SPDashSelector()
this->set_data("pattern", dashes[0]);
}
-SPDashSelector::~SPDashSelector() {
+DashSelector::~DashSelector() {
// FIXME: for some reason this doesn't get called; does the call to manage() in
// sp_stroke_style_line_widget_new() not processed correctly?
}
-void SPDashSelector::prepareImageRenderer( Gtk::TreeModel::const_iterator const &row ) {
+void DashSelector::prepareImageRenderer( Gtk::TreeModel::const_iterator const &row ) {
Glib::RefPtr<Gdk::Pixbuf> pixbuf = (*row)[dash_columns.pixbuf];
image_renderer.property_pixbuf() = pixbuf;
}
-void SPDashSelector::init_dashes() {
+void DashSelector::init_dashes() {
if (!dashes) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -145,7 +149,7 @@ void SPDashSelector::init_dashes() {
}
}
-void SPDashSelector::set_dash (int ndash, double *dash, double o)
+void DashSelector::set_dash (int ndash, double *dash, double o)
{
int pos = -1; // Allows custom patterns to remain unscathed by this.
int count = 0; // will hold the NULL terminator at the end of the dashes list
@@ -199,7 +203,7 @@ void SPDashSelector::set_dash (int ndash, double *dash, double o)
}
}
-void SPDashSelector::get_dash(int *ndash, double **dash, double *off)
+void DashSelector::get_dash(int *ndash, double **dash, double *off)
{
double *pattern = (double*) this->get_data("pattern");
@@ -229,7 +233,7 @@ void SPDashSelector::get_dash(int *ndash, double **dash, double *off)
/**
* Fill a pixbuf with the dash pattern using standard cairo drawing
*/
-GdkPixbuf* SPDashSelector::sp_dash_to_pixbuf(double *pattern)
+GdkPixbuf* DashSelector::sp_dash_to_pixbuf(double *pattern)
{
int n_dashes;
for (n_dashes = 0; pattern[n_dashes] >= 0.0; n_dashes ++) ;
@@ -255,7 +259,7 @@ GdkPixbuf* SPDashSelector::sp_dash_to_pixbuf(double *pattern)
/**
* Fill a pixbuf with a text label using standard cairo drawing
*/
-GdkPixbuf* SPDashSelector::sp_text_to_pixbuf(char *text)
+GdkPixbuf* DashSelector::sp_text_to_pixbuf(char *text)
{
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, preview_width, preview_height);
cairo_t *ct = cairo_create(s);
@@ -275,7 +279,7 @@ GdkPixbuf* SPDashSelector::sp_text_to_pixbuf(char *text)
return pixbuf;
}
-void SPDashSelector::on_selection ()
+void DashSelector::on_selection ()
{
double *pattern = dash_combo.get_active()->get_value(dash_columns.dash);
this->set_data ("pattern", pattern);
@@ -283,10 +287,13 @@ void SPDashSelector::on_selection ()
changed_signal.emit();
}
-void SPDashSelector::offset_value_changed()
+void DashSelector::offset_value_changed()
{
changed_signal.emit();
}
+} // namespace Widget
+} // namespace UI
+} // namespace Inkscape
/*
Local Variables:
diff --git a/src/widgets/dash-selector.h b/src/ui/widget/dash-selector.h
index 485f8abed..449392acc 100644
--- a/src/widgets/dash-selector.h
+++ b/src/ui/widget/dash-selector.h
@@ -17,14 +17,17 @@
#include <sigc++/signal.h>
+namespace Inkscape {
+namespace UI {
+namespace Widget {
/**
* Class that wraps a combobox and spinbutton for selecting dash patterns.
*/
-class SPDashSelector : public Gtk::HBox {
+class DashSelector : public Gtk::HBox {
public:
- SPDashSelector();
- ~SPDashSelector() override;
+ DashSelector();
+ ~DashSelector() override;
/**
* Get and set methods for dashes
@@ -91,6 +94,10 @@ private:
};
+} // namespace Widget
+} // namespace UI
+} // namespace Inkscape
+
#endif // SEEN_SP_DASH_SELECTOR_NEW_H
/*
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 184a25812..4bd1504f7 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -3,7 +3,6 @@ add_subdirectory(gimp)
set(widgets_SRC
button.cpp
- dash-selector.cpp
desktop-widget.cpp
eek-preview.cpp
ege-adjustment-action.cpp
@@ -33,7 +32,6 @@ set(widgets_SRC
# -------
# Headers
button.h
- dash-selector.h
desktop-widget.h
eek-preview.h
ege-adjustment-action.h
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 46559f83a..7dee458f4 100755
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -30,6 +30,7 @@
#include "svg/svg-color.h"
#include "ui/icon-loader.h"
+#include "ui/widget/dash-selector.h"
#include "ui/widget/unit-menu.h"
#include "widgets/style-utils.h"
@@ -214,9 +215,9 @@ StrokeStyle::StrokeStyle() :
spw_label(table, _("Dashes:"), 0, i, nullptr); //no mnemonic for now
//decide what to do:
// implement a set_mnemonic_source function in the
- // SPDashSelector class, so that we do not have to
+ // Inkscape::UI::Widget::DashSelector class, so that we do not have to
// expose any of the underlying widgets?
- dashSelector = Gtk::manage(new SPDashSelector);
+ dashSelector = Gtk::manage(new Inkscape::UI::Widget::DashSelector);
dashSelector->show();
dashSelector->set_hexpand();
@@ -735,7 +736,7 @@ StrokeStyle::getItemColorForMarker(SPItem *item, Inkscape::PaintTarget fill_or_s
* Sets selector widgets' dash style from an SPStyle object.
*/
void
-StrokeStyle::setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style)
+StrokeStyle::setDashSelectorFromStyle(Inkscape::UI::Widget::DashSelector *dsel, SPStyle *style)
{
if (!style->stroke_dasharray.values.empty()) {
double d[64];
diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h
index 88331a5bf..aca20718b 100644
--- a/src/widgets/stroke-style.h
+++ b/src/widgets/stroke-style.h
@@ -50,7 +50,6 @@
#include "ui/icon-names.h"
#include "ui/widget/spinbutton.h"
-#include "widgets/dash-selector.h"
#include "widgets/paint-selector.h"
#include "widgets/sp-widget.h"
#include "widgets/spw-utilities.h"
@@ -69,6 +68,7 @@ namespace Inkscape {
}
namespace UI {
namespace Widget {
+ class DashSelector;
class UnitMenu;
}
}
@@ -143,7 +143,7 @@ private:
void updateLine();
void updateAllMarkers(std::vector<SPItem*> const &objects, bool skip_undo = false);
void updateMarkerHist(SPMarkerLoc const which);
- void setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style);
+ void setDashSelectorFromStyle(Inkscape::UI::Widget::DashSelector *dsel, SPStyle *style);
void setJoinType (unsigned const jointype);
void setCapType (unsigned const captype);
void setPaintOrder (gchar const *paint_order);
@@ -195,7 +195,7 @@ private:
StrokeStyleButton *paintOrderMFS;
StrokeStyleButton *paintOrderSMF;
StrokeStyleButton *paintOrderMSF;
- SPDashSelector *dashSelector;
+ Inkscape::UI::Widget::DashSelector *dashSelector;
gboolean update;
SPDesktop *desktop;