More work on XIM input and register drawing.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3428 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-01-10 10:24:03 +00:00
parent 2472116f80
commit a092a2e7cf
7 changed files with 79 additions and 48 deletions

View File

@@ -4026,10 +4026,15 @@ xaccSRGetCellBorderHandler (VirtualLocation virt_loc,
if (cursor_class == CURSOR_CLASS_SPLIT)
{
borders->top = MIN (borders->top, CELL_BORDER_LINE_LIGHT);
borders->bottom = MIN (borders->bottom, CELL_BORDER_LINE_LIGHT);
borders->top = CELL_BORDER_LINE_LIGHT;
borders->bottom = CELL_BORDER_LINE_LIGHT;
borders->left = MIN (borders->left, CELL_BORDER_LINE_LIGHT);
borders->right = MIN (borders->right, CELL_BORDER_LINE_LIGHT);
if (virt_loc.phys_col_offset == vcell->cellblock->start_col)
borders->left = CELL_BORDER_LINE_LIGHT;
if (virt_loc.phys_col_offset == vcell->cellblock->stop_col)
borders->right = CELL_BORDER_LINE_LIGHT;
}
}

View File

@@ -65,27 +65,27 @@
#include <g-wrap-runtime-guile.h>
/** PROTOTYPES ******************************************************/
static void gnc_configure_date_format_cb(void *);
static void gnc_configure_date_format_cb(gpointer);
static void gnc_configure_date_format(void);
static void gnc_configure_account_separator_cb(void *);
static void gnc_configure_account_separator_cb(gpointer);
static void gnc_configure_account_separator(void);
static void gnc_configure_register_colors_cb(void *);
static void gnc_configure_register_colors_cb(gpointer);
static void gnc_configure_register_colors(void);
static void gnc_configure_register_borders_cb(void *);
static void gnc_configure_register_borders_cb(gpointer);
static void gnc_configure_register_borders(void);
static void gnc_configure_reverse_balance_cb(void *);
static void gnc_configure_reverse_balance_cb(gpointer);
static void gnc_configure_reverse_balance(void);
static void gnc_configure_auto_raise_cb(void *);
static void gnc_configure_auto_raise_cb(gpointer);
static void gnc_configure_auto_raise(void);
static void gnc_configure_negative_color_cb(void *);
static void gnc_configure_negative_color_cb(gpointer);
static void gnc_configure_negative_color(void);
static void gnc_configure_auto_decimal_cb(void *);
static void gnc_configure_auto_decimal_cb(gpointer);
static void gnc_configure_auto_decimal(void);
static void gnc_configure_auto_decimal_places_cb(void *);
static void gnc_configure_auto_decimal_places_cb(gpointer);
static void gnc_configure_auto_decimal_places(void);
static void gnc_configure_register_font_cb(void *);
static void gnc_configure_register_font_cb(gpointer);
static void gnc_configure_register_font(void);
static void gnc_configure_register_hint_font_cb(void *);
static void gnc_configure_register_hint_font_cb(gpointer);
static void gnc_configure_register_hint_font(void);
/** GLOBALS *********************************************************/
@@ -772,7 +772,7 @@ gnc_configure_reverse_balance(void)
* Returns: Nothing
*/
static void
gnc_configure_auto_decimal_cb(void *not_used)
gnc_configure_auto_decimal_cb(gpointer not_used)
{
gnc_configure_auto_decimal();
}
@@ -863,7 +863,7 @@ gnc_configure_register_font(void)
* Returns: Nothing
*/
static void
gnc_configure_register_hint_font_cb(void *not_used)
gnc_configure_register_hint_font_cb(gpointer not_used)
{
gnc_configure_register_hint_font();
}

View File

@@ -173,13 +173,13 @@ gnucash_cursor_configure (GnucashCursor *cursor)
"GnomeCanvasGroup::y", (double)y,
NULL);
cursor->w = w;
cursor->h = h + 1;
item->x1 = cursor->x = x;
item->y1 = cursor->y = y;
cursor->w = w;
cursor->h = h;
item->x2 = x + w;
item->y2 = y + h;
item->y2 = y + h + 1;
item = cursor->cursor[GNUCASH_CURSOR_BLOCK];
block_cursor = GNUCASH_ITEM_CURSOR (item);
@@ -190,12 +190,12 @@ gnucash_cursor_configure (GnucashCursor *cursor)
gnome_canvas_item_i2w (item, &wx, &wy);
gnome_canvas_w2c (canvas, wx, wy, &block_cursor->x, &block_cursor->y);
block_cursor->w = w;
block_cursor->h = h;
block_cursor->h = h + 1;
item->x1 = block_cursor->x;
item->y1 = block_cursor->y;
item->x2 = block_cursor->x + w;
item->y2 = block_cursor->y + h;
item->y2 = block_cursor->y + h + 1;
item = cursor->cursor[GNUCASH_CURSOR_CELL];
cell_cursor = GNUCASH_ITEM_CURSOR(item);
@@ -242,9 +242,9 @@ gnucash_item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gdk_gc_set_foreground (cursor->gc, &gn_black);
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
dx + 1, dy, dw - 2, dh);
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
dx, dy, dw, dh);
dx, dy, dw, dh - 1);
gdk_draw_line (drawable, cursor->gc,
dx, dy + dh, dx + dw, dy + dh);
break;
@@ -259,8 +259,6 @@ gnucash_item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gdk_gc_set_foreground (cursor->gc, &gn_black);
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
dx+1, dy+1, dw-2, dh-2);
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
dx, dy, dw, dh);
}

View File

@@ -457,6 +457,7 @@ draw_cell (GnucashGrid *grid,
y_offset = ((height / 2) +
(((font->ascent + font->descent) / 2) - font->descent));
y_offset++;
switch (gnc_table_get_align (table, virt_loc))
{

View File

@@ -54,8 +54,8 @@ gnucash_header_update (GnomeCanvasItem *item, double *affine,
item->x1 = 0;
item->y1 = 0;
item->x2 = INT_MAX/2 -1;
item->y2 = INT_MAX/2 -1;
item->x2 = (INT_MAX / 2) - 1;
item->y2 = (INT_MAX / 2) - 1;
}
@@ -89,8 +89,8 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
bg_color = gnucash_color_argb_to_gdk (argb);
/* Assume all cells have the same color */
gdk_gc_set_foreground(header->gc, bg_color);
gdk_draw_rectangle(drawable, header->gc, TRUE, 0, 0, width, height);
gdk_gc_set_foreground (header->gc, bg_color);
gdk_draw_rectangle (drawable, header->gc, TRUE, 0, 0, width, height);
gdk_gc_set_line_attributes (header->gc, 1, GDK_LINE_SOLID, -1, -1);
gdk_gc_set_foreground (header->gc, &gn_black);
@@ -98,9 +98,9 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
style->dimensions->width,
style->dimensions->height);
gdk_draw_line (drawable, header->gc, -x,
style->dimensions->height - 1,
style->dimensions->height + 1,
style->dimensions->width - 1,
style->dimensions->height - 1);
style->dimensions->height + 1);
gdk_gc_set_line_attributes (header->gc, 1, GDK_LINE_SOLID, -1, -1);
gdk_gc_set_background (header->gc, &gn_white);
@@ -144,6 +144,7 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
y_offset = ((h / 2) +
(((font->ascent + font->descent) / 2) -
font->descent));
y_offset++;
switch (gnc_table_get_align (table, virt_loc)) {
default:
@@ -278,7 +279,7 @@ gnucash_header_reconfigure (GnucashHeader *header)
sheet->width = header->style->dimensions->width;
w = header->style->dimensions->width;
h = header->style->dimensions->height;
h = header->style->dimensions->height + 2;
if (header->height != h || header->width != w ||
header->style != old_style) {

View File

@@ -168,18 +168,18 @@ item_edit_draw_info(ItemEdit *item_edit, int x, int y, TextDrawInfo *info)
info->bg_color2 = &gn_dark_gray;
info->fg_color2 = &gn_white;
editable = GTK_EDITABLE(item_edit->editor);
editable = GTK_EDITABLE (item_edit->editor);
cursor_pos = editable->current_pos;
start_pos = MIN(editable->selection_start_pos,
editable->selection_end_pos);
end_pos = MAX(editable->selection_start_pos,
editable->selection_end_pos);
start_pos = MIN (editable->selection_start_pos,
editable->selection_end_pos);
end_pos = MAX (editable->selection_start_pos,
editable->selection_end_pos);
text = gtk_entry_get_text(GTK_ENTRY (item_edit->editor));
text_len = strlen(text);
text = gtk_entry_get_text (GTK_ENTRY (item_edit->editor));
text_len = strlen (text);
info->all_text = g_new0(GdkWChar, text_len + 1);
text_len = gdk_mbstowcs(info->all_text, text, text_len);
info->all_text = g_new0 (GdkWChar, text_len + 1);
text_len = gdk_mbstowcs (info->all_text, text, text_len);
info->total_len = text_len;
info->text_1 = info->all_text;
@@ -237,6 +237,7 @@ item_edit_draw_info(ItemEdit *item_edit, int x, int y, TextDrawInfo *info)
info->text_y = (dy + (hd / 2) +
(((info->font->ascent + info->font->descent) / 2)
- info->font->descent));
info->text_y++;
info->cursor_x = info->text_x1 + pre_cursor_width;
info->cursor_y1 = info->text_y - info->font->ascent;
@@ -420,16 +421,13 @@ item_edit_realize (GnomeCanvasItem *item)
if (GNOME_CANVAS_ITEM_CLASS (item_edit_parent_class)->realize)
(*GNOME_CANVAS_ITEM_CLASS
(item_edit_parent_class)->realize)(item);
(item_edit_parent_class)->realize) (item);
item_edit = ITEM_EDIT (item);
window = GTK_WIDGET (canvas)->window;
item_edit->gc = gdk_gc_new (window);
if (gdk_im_ready ())
g_warning ("xim ready");
#ifdef USE_XIM
if (gdk_im_ready () &&
(item_edit->ic_attr = gdk_ic_attr_new ()) != NULL)
@@ -515,6 +513,33 @@ item_edit_realize (GnomeCanvasItem *item)
}
static void
item_edit_unrealize (GnomeCanvasItem *item)
{
ItemEdit *item_edit;
item_edit = ITEM_EDIT (item);
#ifdef USE_XIM
if (item_edit->ic)
{
gdk_ic_destroy (item_edit->ic);
item_edit->ic = NULL;
}
if (item_edit->ic_attr)
{
gdk_ic_attr_destroy (item_edit->ic_attr);
item_edit->ic_attr = NULL;
}
#endif
if (GNOME_CANVAS_ITEM_CLASS (item_edit_parent_class)->unrealize)
(*GNOME_CANVAS_ITEM_CLASS
(item_edit_parent_class)->unrealize) (item);
}
/*
* Instance initialization
*/
@@ -1077,6 +1102,7 @@ item_edit_class_init (ItemEditClass *item_edit_class)
item_class->point = item_edit_point;
item_class->event = item_edit_event;
item_class->realize = item_edit_realize;
item_class->unrealize = item_edit_unrealize;
}

View File

@@ -315,7 +315,7 @@ transaction.") #t))
(gnc:make-color-option
(N_ "Register Colors") (N_ "Primary active color")
"d" (N_ "The background color for the current register row")
(list #xff #xf7 #xba 0)
(list #xff #xf0 #x99 0)
255
#f))
@@ -339,7 +339,7 @@ transaction.") #t))
(gnc:make-color-option
(N_ "Register Colors") (N_ "Split active color")
"g" (N_ "The background color for the current split row in the register")
(list #xff #xf2 #xab 0)
(list #xff #xf0 #x99 0)
255
#f))