summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-11-03 23:01:10 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-11-03 23:01:10 +0000
commit25d3dc9c6df60f0b31bd500411e593ddfa86cc98 (patch)
tree3b515ef63418892908badac9deb2e4e6da6ce88e /src
parentInkscape::URI API enhancements (diff)
downloadinkscape-25d3dc9c6df60f0b31bd500411e593ddfa86cc98.tar.gz
inkscape-25d3dc9c6df60f0b31bd500411e593ddfa86cc98.zip
Use monospace digits font in messages and spinbuttons
Diffstat (limited to 'src')
-rw-r--r--src/inkscape.cpp15
-rw-r--r--src/ui/widget/selected-style.cpp55
-rw-r--r--src/ui/widget/selected-style.h2
-rw-r--r--src/widgets/desktop-widget.cpp10
4 files changed, 50 insertions, 32 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 6a6310b3d..256ee0c44 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -389,6 +389,21 @@ Application::add_style_sheet()
css_str += colornamed;
css_str += ";}";
}
+ GtkSettings *settings = gtk_settings_get_default();
+ const gchar *gtk_font_name = "";
+ if (settings) {
+ g_object_get(settings, "gtk-font-name", &gtk_font_name, NULL);
+ }
+ if (!strncmp(gtk_font_name, "Cantarell", 9)) {
+ css_str += "#monoStrokeWidth,";
+ css_str += "#fillEmptySpace,";
+ css_str += "#SelectStatus,";
+ css_str += "#CoordinateStatusX,";
+ css_str += "#CoordinateStatusY,";
+ css_str += "#DesktopMainTable spinbutton{";
+ css_str += " font-family: sans-serif";
+ css_str += "}"; // we also can add to * but seems to me Cantarell looks better for oter places
+ }
// From 3.16, throws an error which we must catch.
try {
provider->load_from_data(css_str);
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 0fc19e282..a16dcc26b 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -116,32 +116,26 @@ static guint nui_drop_target_entries = G_N_ELEMENTS(ui_drop_target_entries);
static Dialog::FillAndStroke *get_fill_and_stroke_panel(SPDesktop *desktop);
SelectedStyle::SelectedStyle(bool /*layout*/)
- :
- current_stroke_width(0),
-
- _sw_unit(nullptr),
-
- _desktop (nullptr),
- _table(),
- _fill_label (_("Fill:")),
- _stroke_label (_("Stroke:")),
- _opacity_label (_("O:")),
-
- _fill_place(this, SS_FILL),
- _stroke_place(this, SS_STROKE),
-
- _fill_flag_place (),
- _stroke_flag_place (),
-
- _opacity_place (),
- _opacity_adjustment(Gtk::Adjustment::create(100, 0.0, 100, 1.0, 10.0)),
- _opacity_sb (0.02, 0),
-
- _stroke (),
- _stroke_width_place(this),
- _stroke_width (""),
-
- _opacity_blocked (false)
+ : current_stroke_width(0)
+ , _sw_unit(nullptr)
+ , _desktop(nullptr)
+ , _table()
+ , _fill_label(_("Fill:"))
+ , _stroke_label(_("Stroke:"))
+ , _opacity_label(_("O:"))
+ , _fill_place(this, SS_FILL)
+ , _stroke_place(this, SS_STROKE)
+ , _fill_flag_place()
+ , _stroke_flag_place()
+ , _opacity_place()
+ , _opacity_adjustment(Gtk::Adjustment::create(100, 0.0, 100, 1.0, 10.0))
+ , _opacity_sb(0.02, 0)
+ , _fill()
+ , _stroke()
+ , _stroke_width_place(this)
+ , _stroke_width("")
+ , _fill_empty_space("")
+ , _opacity_blocked(false)
{
set_name("SelectedStyle");
_drop[0] = _drop[1] = nullptr;
@@ -159,6 +153,9 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_opacity_label.set_valign(Gtk::ALIGN_CENTER);
_opacity_label.set_margin_top(0);
_opacity_label.set_margin_bottom(0);
+ _stroke_width.set_name("monoStrokeWidth");
+ _fill_empty_space.set_name("fillEmptySpace");
+
#if GTK_CHECK_VERSION(3,12,0)
_fill_label.set_margin_start(0);
@@ -371,6 +368,8 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_fill_place.add(_na[SS_FILL]);
_fill_place.set_tooltip_text(__na[SS_FILL]);
+ _fill.pack_start(_fill_place, Gtk::PACK_SHRINK);
+ _fill.pack_start(_fill_empty_space, Gtk::PACK_SHRINK);
_stroke_place.add(_na[SS_STROKE]);
_stroke_place.set_tooltip_text(__na[SS_STROKE]);
@@ -390,7 +389,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
_table.attach(_fill_flag_place, 1, 0, 1, 1);
_table.attach(_stroke_flag_place, 1, 1, 1, 1);
- _table.attach(_fill_place, 2, 0, 1, 1);
+ _table.attach(_fill, 2, 0, 1, 1);
_table.attach(_stroke, 2, 1, 1, 1);
_opacity_place.add(_opacity_label);
@@ -1097,7 +1096,7 @@ SelectedStyle::update()
{
gchar *str = g_strdup_printf(" %#.3g", w);
- if (str[strlen(str)-1] == ',') {
+ if (str[strlen(str) - 1] == ',' || str[strlen(str) - 1] == '.') {
str[strlen(str)-1] = '\0';
}
_stroke_width.set_markup(str);
diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h
index f65680242..490f4290a 100644
--- a/src/ui/widget/selected-style.h
+++ b/src/ui/widget/selected-style.h
@@ -191,9 +191,11 @@ protected:
Gtk::Label _multiple[2];
Glib::ustring __multiple[2];
+ Gtk::HBox _fill;
Gtk::HBox _stroke;
RotateableStrokeWidth _stroke_width_place;
Gtk::Label _stroke_width;
+ Gtk::Label _fill_empty_space;
Glib::ustring _paintserver_id[2];
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 1b717f351..dade7c85d 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -668,8 +668,10 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
gtk_grid_attach(GTK_GRID(dtw->coord_status), label_y, 1, 1, 1, 1);
dtw->coord_status_x = gtk_label_new(nullptr);
dtw->coord_status_y = gtk_label_new(nullptr);
- gtk_label_set_markup( GTK_LABEL(dtw->coord_status_x), "<tt> 0.00 </tt>" );
- gtk_label_set_markup( GTK_LABEL(dtw->coord_status_y), "<tt> 0.00 </tt>" );
+ gtk_widget_set_name(dtw->coord_status_x, "CoordinateStatusX");
+ gtk_widget_set_name(dtw->coord_status_y, "CoordinateStatusY");
+ gtk_label_set_markup(GTK_LABEL(dtw->coord_status_x), " 0.00 ");
+ gtk_label_set_markup(GTK_LABEL(dtw->coord_status_y), " 0.00 ");
auto label_z = gtk_label_new(_("Z:"));
gtk_widget_set_name(label_z, "ZLabel");
@@ -1273,11 +1275,11 @@ void
SPDesktopWidget::setCoordinateStatus(Geom::Point p)
{
gchar *cstr;
- cstr = g_strdup_printf("<tt>%7.2f </tt>", dt2r * p[Geom::X]);
+ cstr = g_strdup_printf("%7.2f", dt2r * p[Geom::X]);
gtk_label_set_markup( GTK_LABEL(this->coord_status_x), cstr );
g_free(cstr);
- cstr = g_strdup_printf("<tt>%7.2f </tt>", dt2r * p[Geom::Y]);
+ cstr = g_strdup_printf("%7.2f", dt2r * p[Geom::Y]);
gtk_label_set_markup( GTK_LABEL(this->coord_status_y), cstr );
g_free(cstr);
}