summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5ab694c)
* src/gtk/gtkshruler.c
Move the ruler to GTK2
Patch by Alfons
+2005-01-04 [colin] 0.9.13cvs25.6
+
+ * src/gtk/gtkshruler.c
+ Move the ruler to GTK2
+ Patch by Alfons
+
2005-01-03 [colin] 0.9.13cvs25.5
* src/compose.c
2005-01-03 [colin] 0.9.13cvs25.5
* src/compose.c
( cvs diff -u -r 1.382.2.81 -r 1.382.2.82 src/compose.c; cvs diff -u -r 1.10.2.8 -r 1.10.2.9 src/prefs_gtk.c; cvs diff -u -r 1.12.2.4 -r 1.12.2.5 src/prefs_template.c; cvs diff -u -r 1.96.2.37 -r 1.96.2.38 src/textview.c; ) > 0.9.13cvs25.3.patchset
( cvs diff -u -r 1.36.2.18 -r 1.36.2.19 src/common/utils.c; cvs diff -u -r 1.20.2.12 -r 1.20.2.13 src/common/utils.h; cvs diff -u -r 1.12.2.13 -r 1.12.2.14 src/gtk/prefswindow.c; ) > 0.9.13cvs25.4.patchset
( cvs diff -u -r 1.382.2.82 -r 1.382.2.83 src/compose.c; ) > 0.9.13cvs25.5.patchset
( cvs diff -u -r 1.382.2.81 -r 1.382.2.82 src/compose.c; cvs diff -u -r 1.10.2.8 -r 1.10.2.9 src/prefs_gtk.c; cvs diff -u -r 1.12.2.4 -r 1.12.2.5 src/prefs_template.c; cvs diff -u -r 1.96.2.37 -r 1.96.2.38 src/textview.c; ) > 0.9.13cvs25.3.patchset
( cvs diff -u -r 1.36.2.18 -r 1.36.2.19 src/common/utils.c; cvs diff -u -r 1.20.2.12 -r 1.20.2.13 src/common/utils.h; cvs diff -u -r 1.12.2.13 -r 1.12.2.14 src/gtk/prefswindow.c; ) > 0.9.13cvs25.4.patchset
( cvs diff -u -r 1.382.2.82 -r 1.382.2.83 src/compose.c; ) > 0.9.13cvs25.5.patchset
+( cvs diff -u -r 1.1.4.2 -r 1.1.4.3 src/gtk/gtkshruler.c; ) > 0.9.13cvs25.6.patchset
BINARY_AGE=0
EXTRA_VERSION=25
EXTRA_RELEASE=
BINARY_AGE=0
EXTRA_VERSION=25
EXTRA_RELEASE=
if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
{
GtkWidget *widget;
GdkGC *gc, *bg_gc;
{
GtkWidget *widget;
GdkGC *gc, *bg_gc;
gint i;
gint width, height;
gint xthickness;
gint i;
gint width, height;
gint xthickness;
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
- font = gtk_style_get_font(widget->style);
xthickness = widget->style->xthickness;
ythickness = widget->style->ythickness;
xthickness = widget->style->xthickness;
ythickness = widget->style->ythickness;
#endif
/* assume ruler->max_size has the char width */
#endif
/* assume ruler->max_size has the char width */
- /* i is increment of char_width, pos is label number */
+ /* i is increment of char_width, pos is label number
+ * y position is based on height of widget itself
+ */
for ( i = 0, pos = 0; i < widget->allocation.width - xthickness; i += ruler->max_size, pos++ ) {
for ( i = 0, pos = 0; i < widget->allocation.width - xthickness; i += ruler->max_size, pos++ ) {
- int length = ythickness / 2;
+ int length = height / 4;
- if ( pos % 10 == 0 ) length = ( 4 * ythickness );
- else if (pos % 5 == 0 ) length = ( 2 * ythickness );
+ if ( pos % 10 == 0 ) length = ( 3 * height / 4 );
+ else if (pos % 5 == 0 ) length = ( height / 2 );
gdk_draw_line(ruler->backing_store, gc,
gdk_draw_line(ruler->backing_store, gc,
- i, height + ythickness,
i, height - length);
if ( pos % 10 == 0 ) {
i, height - length);
if ( pos % 10 == 0 ) {
+ gchar buf[8];
+ PangoLayout *layout;
+
- sprintf(buf, "%d", (int) pos);
- gdk_draw_string(ruler->backing_store, font, gc,
- i + 2, ythickness + font->ascent - 1,
- buf);
+ g_snprintf(buf, sizeof buf, "%d", pos);
+
+ layout = gtk_widget_create_pango_layout
+ (GTK_WIDGET(ruler), buf);
+
+ gdk_draw_layout(ruler->backing_store, gc, i + 2,
+ (height / 12),
+ layout);
+
+ g_object_unref(layout);