summaryrefslogtreecommitdiffstats
path: root/src/widgets/text-toolbar.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2016-08-12 04:11:03 +0000
committerTed Gould <ted@gould.cx>2016-08-12 04:11:03 +0000
commitff848ebc9919d158c3ec3d7420e72b6aca99a3ea (patch)
tree030ab171865d0ed7f6bae3ef68315639cdb2622b /src/widgets/text-toolbar.cpp
parentMerging 0.92.x branch (diff)
parentCloneTiler: Further C++ification (diff)
downloadinkscape-ff848ebc9919d158c3ec3d7420e72b6aca99a3ea.tar.gz
inkscape-ff848ebc9919d158c3ec3d7420e72b6aca99a3ea.zip
Merge trunk
(bzr r14950.1.20)
Diffstat (limited to 'src/widgets/text-toolbar.cpp')
-rw-r--r--src/widgets/text-toolbar.cpp49
1 files changed, 15 insertions, 34 deletions
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index 23acb74af..0160bcac7 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -25,7 +25,7 @@
*/
#ifdef HAVE_CONFIG_H
-# include "config.h"
+#include <config.h>
#endif
#include "libnrtype/font-lister.h"
@@ -38,12 +38,11 @@
#include "document.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "widgets/ink-comboboxentry-action.h"
#include "inkscape.h"
-#include "preferences.h"
#include "selection-chemistry.h"
-#include "selection.h"
#include "sp-flowtext.h"
#include "sp-root.h"
#include "sp-text.h"
@@ -53,11 +52,8 @@
#include "toolbox.h"
#include "ui/icon-names.h"
#include "ui/tools/text-tool.h"
-#include "ui/tools/tool-base.h"
#include "ui/widget/unit-tracker.h"
-#include "util/units.h"
#include "verbs.h"
-#include "xml/repr.h"
using Inkscape::DocumentUndo;
using Inkscape::UI::ToolboxFactory;
@@ -378,8 +374,8 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl )
// move the x of all texts to preserve the same bbox
Inkscape::Selection *selection = desktop->getSelection();
- std::vector<SPItem*> itemlist=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end(); ++i){
+ auto itemlist= selection->items();
+ for(auto i=itemlist.begin();i!=itemlist.end(); ++i){
if (SP_IS_TEXT(*i)) {
SPItem *item = *i;
@@ -560,8 +556,8 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl )
// Only need to save for undo if a text item has been changed.
Inkscape::Selection *selection = desktop->getSelection();
bool modmade = false;
- std::vector<SPItem*> itemlist=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end(); ++i){
+ auto itemlist= selection->items();
+ for(auto i=itemlist.begin();i!=itemlist.end(); ++i){
if (SP_IS_TEXT (*i)) {
modmade = true;
}
@@ -625,7 +621,7 @@ static void sp_text_lineheight_unit_changed( gpointer /* */, GObject *tbl )
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
Inkscape::Selection *selection = desktop->getSelection();
- std::vector<SPItem*> itemlist=selection->itemList();
+ auto itemlist = selection->items();
// Convert between units
if ((unit->abbr == "" || unit->abbr == "em") && old_unit == SP_CSS_UNIT_EX) {
@@ -644,7 +640,7 @@ static void sp_text_lineheight_unit_changed( gpointer /* */, GObject *tbl )
// Convert absolute to relative... for the moment use average font-size
double font_size = 0;
int count = 0;
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end(); ++i){
+ for(auto i=itemlist.begin();i!=itemlist.end(); ++i){
if (SP_IS_TEXT (*i)) {
double doc_scale = Geom::Affine((*i)->i2dt_affine()).descrim();
font_size += (*i)->style->font_size.computed * doc_scale;
@@ -673,7 +669,7 @@ static void sp_text_lineheight_unit_changed( gpointer /* */, GObject *tbl )
// Convert relative to absolute... for the moment use average font-size
double font_size = 0;
int count = 0;
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end(); ++i){
+ for(auto i=itemlist.begin();i!=itemlist.end(); ++i){
if (SP_IS_TEXT (*i)) {
double doc_scale = Geom::Affine((*i)->i2dt_affine()).descrim();
font_size += (*i)->style->font_size.computed * doc_scale;
@@ -716,7 +712,7 @@ static void sp_text_lineheight_unit_changed( gpointer /* */, GObject *tbl )
// Only need to save for undo if a text item has been changed.
bool modmade = false;
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end(); ++i){
+ for(auto i=itemlist.begin();i!=itemlist.end(); ++i){
if (SP_IS_TEXT (*i)) {
modmade = true;
}
@@ -1120,8 +1116,8 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Only flowed text can be justified, only normal text can be kerned...
// Find out if we have flowed text now so we can use it several places
gboolean isFlow = false;
- std::vector<SPItem*> itemlist=SP_ACTIVE_DESKTOP->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end(); ++i){
+ auto itemlist= SP_ACTIVE_DESKTOP->getSelection()->items();
+ for(auto i=itemlist.begin();i!=itemlist.end(); ++i){
// const gchar* id = reinterpret_cast<SPItem *>(items->data)->getId();
// std::cout << " " << id << std::endl;
if( SP_IS_FLOWTEXT(*i)) {
@@ -1562,8 +1558,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
g_object_set_data( holder, "TextFontFamilyAction", act );
// Change style of drop-down from menu to list
-#if GTK_CHECK_VERSION(3,0,0)
- GtkCssProvider *css_provider = gtk_css_provider_new();
+ auto css_provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(css_provider,
"#TextFontFamilyAction_combobox {\n"
" -GtkComboBox-appears-as-list: true;\n"
@@ -1574,24 +1569,10 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
"}\n",
-1, NULL);
- GdkScreen *screen = gdk_screen_get_default();
+ auto screen = gdk_screen_get_default();
gtk_style_context_add_provider_for_screen(screen,
GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
-#else
- gtk_rc_parse_string (
- "style \"dropdown-as-list-style\"\n"
- "{\n"
- " GtkComboBox::appears-as-list = 1\n"
- "}\n"
- "widget \"*.TextFontFamilyAction_combobox\" style \"dropdown-as-list-style\""
- "style \"fontfamily-separator-style\"\n"
- "{\n"
- " GtkWidget::wide-separators = 1\n"
- " GtkWidget::separator-height = 6\n"
- "}\n"
- "widget \"*gtk-combobox-popup-window.GtkScrolledWindow.GtkTreeView\" style \"fontfamily-separator-style\"");
-#endif
}
/* Font size */