diff options
| author | Jan Lingscheid <jan.linscheid@auticon.de> | 2017-09-12 08:13:54 +0000 |
|---|---|---|
| committer | Jan Lingscheid <jan.lingscheid@auticon.de> | 2017-09-21 05:46:25 +0000 |
| commit | 36863a0e699b5a7cba346bca8a26e729be5a2f87 (patch) | |
| tree | aed4f939d2e0d5f6bd550fee0bb27f8dd719a285 /src | |
| parent | Remove unused GString in ui/tools/box3d-tool.cpp (diff) | |
| download | inkscape-36863a0e699b5a7cba346bca8a26e729be5a2f87.tar.gz inkscape-36863a0e699b5a7cba346bca8a26e729be5a2f87.zip | |
Remove remaining usage of GString in ui/tools/*
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/tools/arc-tool.cpp | 11 | ||||
| -rw-r--r-- | src/ui/tools/pen-tool.cpp | 5 | ||||
| -rw-r--r-- | src/ui/tools/rect-tool.cpp | 23 | ||||
| -rw-r--r-- | src/ui/tools/star-tool.cpp | 6 | ||||
| -rw-r--r-- | src/ui/tools/text-tool.cpp | 10 |
5 files changed, 25 insertions, 30 deletions
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index b501962fb..9ad42c842 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -385,8 +385,8 @@ void ArcTool::drag(Geom::Point pt, guint state) { Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px"); Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px"); - GString *xs = g_string_new(rdimx_q.string(desktop->namedview->display_units).c_str()); - GString *ys = g_string_new(rdimy_q.string(desktop->namedview->display_units).c_str()); + Glib::ustring xs = rdimx_q.string(desktop->namedview->display_units); + Glib::ustring ys = rdimy_q.string(desktop->namedview->display_units); if (state & GDK_CONTROL_MASK) { int ratio_x, ratio_y; @@ -399,13 +399,10 @@ void ArcTool::drag(Geom::Point pt, guint state) { ratio_y = (int) rint (rdimy / rdimx); } - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str, ratio_x, ratio_y); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str(), ratio_x, ratio_y); } else { - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Ellipse</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str()); } - - g_string_free(xs, FALSE); - g_string_free(ys, FALSE); } void ArcTool::finishItem() { diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 77cb5b6f8..0db5c3954 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1291,7 +1291,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t Geom::Point rel = p - this->p[pc_point_to_compare]; Inkscape::Util::Quantity q = Inkscape::Util::Quantity(Geom::L2(rel), "px"); - GString *dist = g_string_new(q.string(desktop->namedview->display_units).c_str()); + Glib::ustring dist = q.string(desktop->namedview->display_units); double angle = atan2(rel[Geom::Y], rel[Geom::X]) * 180 / M_PI; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/options/compassangledisplay/value", 0) != 0) { @@ -1301,8 +1301,7 @@ void PenTool::_setAngleDistanceStatusMessage(Geom::Point const p, int pc_point_t } } - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, message, angle, dist->str); - g_string_free(dist, false); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, message, angle, dist.c_str()); } // this function changes the colors red, green and blue making them transparent or not, depending on if spiro is being used. diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 9ebf51e76..c04f44877 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -397,8 +397,8 @@ void RectTool::drag(Geom::Point const pt, guint state) { Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px"); Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px"); - GString *xs = g_string_new(rdimx_q.string(desktop->namedview->display_units).c_str()); - GString *ys = g_string_new(rdimy_q.string(desktop->namedview->display_units).c_str()); + Glib::ustring xs = rdimx_q.string(desktop->namedview->display_units); + Glib::ustring ys = rdimy_q.string(desktop->namedview->display_units); if (state & GDK_CONTROL_MASK) { int ratio_x, ratio_y; @@ -421,20 +421,25 @@ void RectTool::drag(Geom::Point const pt, guint state) { } if (!is_golden_ratio) { - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str, ratio_x, ratio_y); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("<b>Rectangle</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"), + xs.c_str(), ys.c_str(), ratio_x, ratio_y); } else { if (ratio_y == 1) { - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("<b>Rectangle</b>: %s × %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"), + xs.c_str(), ys.c_str()); } else { - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"), xs->str, ys->str); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("<b>Rectangle</b>: %s × %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"), + xs.c_str(), ys.c_str()); } } } else { - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Rectangle</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"), xs->str, ys->str); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, + _("<b>Rectangle</b>: %s × %s; with <b>Ctrl</b> to make square or integer-ratio rectangle; with <b>Shift</b> to draw around the starting point"), + xs.c_str(), ys.c_str()); } - - g_string_free(xs, FALSE); - g_string_free(ys, FALSE); } void RectTool::finishItem() { diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index 32f0e6d92..05a1f8f7c 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -389,14 +389,12 @@ void StarTool::drag(Geom::Point p, guint state) /* status text */ Inkscape::Util::Quantity q = Inkscape::Util::Quantity(r1, "px"); - GString *rads = g_string_new(q.string(desktop->namedview->display_units).c_str()); + Glib::ustring rads = q.string(desktop->namedview->display_units); this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, ( this->isflatsided? _("<b>Polygon</b>: radius %s, angle %5g°; with <b>Ctrl</b> to snap angle") : _("<b>Star</b>: radius %s, angle %5g°; with <b>Ctrl</b> to snap angle") ), - rads->str, sp_round((arg1) * 180 / M_PI, 0.0001)); - - g_string_free(rads, FALSE); + rads.c_str(), sp_round((arg1) * 180 / M_PI, 0.0001)); } void StarTool::finishItem() { diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 9091b455e..ee48c2348 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -575,13 +575,9 @@ bool TextTool::root_handler(GdkEvent* event) { // status text Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(fabs((p - this->p0)[Geom::X]), "px"); Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(fabs((p - this->p0)[Geom::Y]), "px"); - GString *xs = g_string_new(x_q.string(desktop->namedview->display_units).c_str()); - GString *ys = g_string_new(y_q.string(desktop->namedview->display_units).c_str()); - this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s × %s"), xs->str, ys->str); - - g_string_free(xs, FALSE); - g_string_free(ys, FALSE); - + Glib::ustring xs = x_q.string(desktop->namedview->display_units); + Glib::ustring ys = y_q.string(desktop->namedview->display_units); + this->message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s × %s"), xs.c_str(), ys.c_str()); } else if (!this->sp_event_context_knot_mouseover()) { SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); |
