Lines Matching refs:ruler

2  * Customized ruler class for inkscape.  Note that this is a fork of
35 #include "ruler.h"
84 #define SP_RULER_GET_PRIVATE(ruler) \
85 G_TYPE_INSTANCE_GET_PRIVATE (ruler, SP_TYPE_RULER, SPRulerPrivate)
147 static void sp_ruler_draw_ticks (SPRuler *ruler);
148 static GdkRectangle sp_ruler_get_pos_rect (SPRuler *ruler,
151 static void sp_ruler_queue_pos_redraw (SPRuler *ruler);
152 static void sp_ruler_draw_pos (SPRuler *ruler,
154 static void sp_ruler_make_pixmap (SPRuler *ruler);
172 gtk_widget_class_set_css_name (widget_class, "ruler-widget");
202 _("The orientation of the ruler"),
212 _("Unit of the ruler"),
220 _("Lower limit of ruler"),
230 _("Upper limit of ruler"),
240 _("Position of mark on the ruler"),
250 _("Maximum size of the ruler"),
266 sp_ruler_init (SPRuler *ruler)
268 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
270 gtk_widget_set_has_window (GTK_WIDGET (ruler), FALSE);
294 SPRuler *ruler = SP_RULER (object);
295 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
298 sp_ruler_remove_track_widget (ruler, GTK_WIDGET(priv->track_widgets->data));
312 * @ruler: the SPRuler
313 * @lower: the lower limit of the ruler
314 * @upper: the upper limit of the ruler
315 * @max_size: the maximum size of the ruler used when calculating the space to
318 * This sets the range of the ruler.
321 sp_ruler_set_range (SPRuler *ruler,
328 g_return_if_fail (SP_IS_RULER (ruler));
330 priv = SP_RULER_GET_PRIVATE (ruler);
332 g_object_freeze_notify (G_OBJECT (ruler));
336 g_object_notify (G_OBJECT (ruler), "lower");
341 g_object_notify (G_OBJECT (ruler), "upper");
346 g_object_notify (G_OBJECT (ruler), "max-size");
348 g_object_thaw_notify (G_OBJECT (ruler));
351 gtk_widget_queue_draw (GTK_WIDGET (ruler));
356 * @ruler: a #SPRuler
357 * @lower: (allow-none): location to store lower limit of the ruler, or %NULL
358 * @upper: (allow-none): location to store upper limit of the ruler, or %NULL
359 * @max_size: location to store the maximum size of the ruler used when calculating
366 sp_ruler_get_range (SPRuler *ruler,
373 g_return_if_fail (SP_IS_RULER (ruler));
375 priv = SP_RULER_GET_PRIVATE (ruler);
391 SPRuler *ruler = SP_RULER (object);
392 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
398 gtk_widget_queue_resize (GTK_WIDGET (ruler));
402 sp_ruler_set_unit (ruler, unit_table.getUnit(g_value_get_string (value)));
406 sp_ruler_set_range (ruler,
412 sp_ruler_set_range (ruler,
419 sp_ruler_set_position (ruler, g_value_get_double (value));
423 sp_ruler_set_range (ruler,
441 SPRuler *ruler = SP_RULER (object);
442 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
474 SPRuler *ruler = SP_RULER (widget);
475 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
505 gdk_window_set_user_data (priv->input_window, ruler);
507 sp_ruler_make_pixmap (ruler);
513 SPRuler *ruler = SP_RULER (widget);
514 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
565 SPRuler *ruler = SP_RULER(widget);
566 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
584 sp_ruler_make_pixmap (ruler);
712 SPRuler *ruler = SP_RULER (widget);
713 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
715 sp_ruler_draw_ticks (ruler);
720 sp_ruler_draw_pos (ruler, cr);
726 sp_ruler_make_pixmap (SPRuler *ruler)
728 GtkWidget *widget = GTK_WIDGET (ruler);
729 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
747 sp_ruler_draw_pos (SPRuler *ruler,
750 GtkWidget *widget = GTK_WIDGET (ruler);
760 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
766 pos_rect = sp_ruler_get_pos_rect (ruler, sp_ruler_get_position (ruler));
804 * @orientation: the ruler's orientation
806 * Creates a new ruler.
819 sp_ruler_update_position (SPRuler *ruler,
823 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
828 gtk_widget_get_allocation (GTK_WIDGET (ruler), &allocation);
829 sp_ruler_get_range (ruler, &lower, &upper, NULL);
833 sp_ruler_set_position (ruler,
839 sp_ruler_set_position (ruler,
916 SPRuler *ruler)
929 if (gtk_widget_translate_coordinates (widget, GTK_WIDGET (ruler),
933 sp_ruler_update_position (ruler, ruler_x, ruler_y);
940 sp_ruler_add_track_widget (SPRuler *ruler,
945 g_return_if_fail (SP_IS_RULER (ruler));
946 g_return_if_fail (GTK_IS_WIDGET (ruler));
948 priv = SP_RULER_GET_PRIVATE (ruler);
956 ruler);
959 ruler);
964 * @ruler: an #SPRuler
967 * Removes a previously added track widget from the ruler. See
971 sp_ruler_remove_track_widget (SPRuler *ruler,
976 g_return_if_fail (SP_IS_RULER (ruler));
977 g_return_if_fail (GTK_IS_WIDGET (ruler));
979 priv = SP_RULER_GET_PRIVATE (ruler);
987 ruler);
990 ruler);
995 * @ruler: a #SPRuler
996 * @unit: the #SPMetric to set the ruler to
998 * This sets the unit of the ruler.
1001 sp_ruler_set_unit (SPRuler *ruler,
1004 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
1006 g_return_if_fail (SP_IS_RULER (ruler));
1011 g_object_notify(G_OBJECT(ruler), "unit");
1014 gtk_widget_queue_draw (GTK_WIDGET (ruler));
1020 * @ruler: a #SPRuler
1022 * Return value: the unit currently used in the @ruler widget.
1025 sp_ruler_get_unit (SPRuler *ruler)
1027 return SP_RULER_GET_PRIVATE (ruler)->unit;
1032 * @ruler: a #SPRuler
1033 * @position: the position to set the ruler to
1035 * This sets the position of the ruler.
1038 sp_ruler_set_position (SPRuler *ruler,
1043 g_return_if_fail (SP_IS_RULER (ruler));
1045 priv = SP_RULER_GET_PRIVATE (ruler);
1053 g_object_notify (G_OBJECT (ruler), "position");
1055 rect = sp_ruler_get_pos_rect (ruler, priv->position);
1073 sp_ruler_queue_pos_redraw (ruler);
1080 ruler, NULL);
1087 * @ruler: a #SPRuler
1089 * Return value: the current position of the @ruler widget.
1092 sp_ruler_get_position (SPRuler *ruler)
1094 g_return_val_if_fail (SP_IS_RULER (ruler), 0.0);
1096 return SP_RULER_GET_PRIVATE (ruler)->position;
1103 SPRuler *ruler = SP_RULER(widget);
1105 sp_ruler_update_position (ruler, event->x, event->y);
1111 sp_ruler_draw_ticks (SPRuler *ruler)
1113 GtkWidget *widget = GTK_WIDGET (ruler);
1126 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
1132 gdouble lower, upper; /* Upper and lower limits, in ruler units */
1236 sp_ruler_get_range (ruler, &lower, &upper, &max_size);
1244 * Use the maximum extents of the ruler to determine the largest
1247 * leaves sufficient room for drawing the ruler.
1257 /* Inkscape change to ruler: Use a 1,2,4,8... scale for inches
1259 if (*sp_ruler_get_unit (ruler) == *unit_table.getUnit("in"))
1269 unit = sp_ruler_get_unit (ruler);
1311 // and jitter will be apparent (upon redrawing some of the lines on the ruler might jump a
1408 sp_ruler_get_pos_rect (SPRuler *ruler,
1411 GtkWidget *widget = GTK_WIDGET (ruler);
1412 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
1459 sp_ruler_get_range (ruler, &lower, &upper, NULL);
1485 SPRuler *ruler = (SPRuler *)data;
1486 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
1488 sp_ruler_queue_pos_redraw (ruler);
1497 sp_ruler_queue_pos_redraw (SPRuler *ruler)
1499 SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
1500 const GdkRectangle rect = sp_ruler_get_pos_rect (ruler, priv->position);
1502 gtk_widget_queue_draw_area (GTK_WIDGET(ruler),
1510 gtk_widget_queue_draw_area (GTK_WIDGET(ruler),