forked from AuroraMiddleware/gtk
inspector: add slider for adjusting the font scale
https://bugzilla.gnome.org/show_bug.cgi?id=761435
This commit is contained in:
parent
826f729b6f
commit
72346cb209
@ -27,6 +27,7 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtkswitch.h"
|
||||
#include "gtkscale.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkcssproviderprivate.h"
|
||||
|
||||
@ -48,8 +49,10 @@ struct _GtkInspectorVisualPrivate
|
||||
GtkWidget *font_button;
|
||||
GtkWidget *hidpi_spin;
|
||||
GtkWidget *animation_switch;
|
||||
GtkWidget *font_scale_scale;
|
||||
GtkAdjustment *scale_adjustment;
|
||||
GtkAdjustment *cursor_size_adjustment;
|
||||
GtkAdjustment *font_scale_adjustment;
|
||||
|
||||
GtkWidget *debug_box;
|
||||
GtkWidget *rendering_mode_combo;
|
||||
@ -130,6 +133,16 @@ redraw_everything (void)
|
||||
g_list_free (toplevels);
|
||||
}
|
||||
|
||||
static void
|
||||
font_scale_changed (GtkAdjustment *adjustment)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = gtk_adjustment_get_value (adjustment);
|
||||
g_object_set (gtk_settings_get_default (), "gtk-xft-dpi",
|
||||
(gint)(factor * 96 * 1024), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
updates_activate (GtkSwitch *sw)
|
||||
{
|
||||
@ -491,6 +504,16 @@ init_font (GtkInspectorVisual *vis)
|
||||
G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE);
|
||||
}
|
||||
|
||||
static void
|
||||
init_font_scale (GtkInspectorVisual *vis)
|
||||
{
|
||||
gtk_scale_add_mark (GTK_SCALE (vis->priv->font_scale_scale), 1.0, GTK_POS_TOP, NULL);
|
||||
/* There is no backend agnostic way to get the default value, so use 1.0 */
|
||||
gtk_adjustment_set_value (vis->priv->font_scale_adjustment, 1.0);
|
||||
g_signal_connect (vis->priv->font_scale_adjustment, "value-changed",
|
||||
G_CALLBACK (font_scale_changed), NULL);
|
||||
}
|
||||
|
||||
#if defined (GDK_WINDOWING_X11)
|
||||
static void
|
||||
scale_changed (GtkAdjustment *adjustment, GtkInspectorVisual *vis)
|
||||
@ -715,6 +738,7 @@ gtk_inspector_visual_init (GtkInspectorVisual *vis)
|
||||
init_cursors (vis);
|
||||
init_cursor_size (vis);
|
||||
init_font (vis);
|
||||
init_font_scale (vis);
|
||||
init_scale (vis);
|
||||
init_rendering_mode (vis);
|
||||
init_updates (vis);
|
||||
@ -771,6 +795,8 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, software_gl_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, software_surface_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, texture_rectangle_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_scale);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_adjustment);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, updates_activate);
|
||||
gtk_widget_class_bind_template_callback (widget_class, direction_changed);
|
||||
|
@ -6,6 +6,12 @@
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">1</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="font_scale_adjustment">
|
||||
<property name="lower">0.5</property>
|
||||
<property name="upper">2</property>
|
||||
<property name="step-increment">0.01</property>
|
||||
<property name="page-increment">0.01</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="cursor_size_adjustment">
|
||||
<property name="lower">24</property>
|
||||
<property name="upper">64</property>
|
||||
@ -235,6 +241,41 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="visible">True</property>
|
||||
<property name="activatable">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="font_scale_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Font Scale</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="font_scale_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="adjustment">font_scale_adjustment</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="visible">True</property>
|
||||
@ -785,6 +826,7 @@
|
||||
<widget name="icon_combo"/>
|
||||
<widget name="cursor_combo"/>
|
||||
<widget name="font_button"/>
|
||||
<widget name="font_scale_scale"/>
|
||||
<widget name="direction_combo"/>
|
||||
<widget name="rendering_mode_combo"/>
|
||||
<widget name="gl_combo"/>
|
||||
|
Loading…
Reference in New Issue
Block a user