mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix some run time warnings. Tweak the pango layout code so all the
register bits are visible. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gnucash-gnome2-dev@9089 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -227,7 +227,6 @@ gnc_date_picker_new (GnomeCanvasGroup *parent)
|
||||
"x", -10000.0,
|
||||
"y", -10000.0,
|
||||
NULL);
|
||||
gtk_widget_realize( hbox );
|
||||
gtk_widget_show_all( hbox );
|
||||
|
||||
gtk_widget_size_request (calendar, &requisition);
|
||||
|
||||
@@ -453,6 +453,7 @@ draw_cell (GnucashGrid *grid,
|
||||
text = gnc_table_get_entry (table, virt_loc);
|
||||
|
||||
layout = gtk_widget_create_pango_layout (GTK_WIDGET (grid->sheet), text);
|
||||
pango_layout_set_width (layout, (width - 2 * CELL_HPADDING) * PANGO_SCALE);
|
||||
context = pango_layout_get_context (layout);
|
||||
font = pango_font_description_copy (pango_context_get_font_description (context));
|
||||
|
||||
@@ -461,6 +462,8 @@ draw_cell (GnucashGrid *grid,
|
||||
|
||||
gdk_gc_set_foreground (grid->gc, fg_color);
|
||||
|
||||
/* If this is the currently open transaction and
|
||||
there is no text in this cell */
|
||||
if ((table->current_cursor_loc.vcell_loc.virt_row ==
|
||||
virt_loc.vcell_loc.virt_row) &&
|
||||
(!text || strlen(text) == 0)) {
|
||||
@@ -468,8 +471,9 @@ draw_cell (GnucashGrid *grid,
|
||||
gdk_gc_set_foreground (grid->gc, &gn_light_gray);
|
||||
text = gnc_table_get_label (table, virt_loc);
|
||||
pango_layout_set_text (layout, text, strlen (text));
|
||||
}
|
||||
|
||||
} else {
|
||||
pango_font_description_set_style (font, PANGO_STYLE_NORMAL);
|
||||
}
|
||||
pango_context_set_font_description (context, font);
|
||||
pango_font_description_free (font);
|
||||
|
||||
@@ -498,7 +502,7 @@ draw_cell (GnucashGrid *grid,
|
||||
}
|
||||
|
||||
rect.x = x + CELL_HPADDING;
|
||||
rect.y = y + 1;
|
||||
rect.y = y + CELL_VPADDING;
|
||||
rect.width = MAX (0, width - (2 * CELL_HPADDING));
|
||||
rect.height = height - 2;
|
||||
|
||||
@@ -507,7 +511,7 @@ draw_cell (GnucashGrid *grid,
|
||||
gdk_draw_layout (drawable,
|
||||
grid->gc,
|
||||
x + CELL_HPADDING,
|
||||
y + CELL_HPADDING,
|
||||
y + 1,
|
||||
layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
|
||||
@@ -194,7 +194,7 @@ gnc_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
gdk_draw_layout (drawable,
|
||||
header->gc,
|
||||
xpaint + CELL_HPADDING,
|
||||
ypaint + CELL_HPADDING,
|
||||
ypaint + 1,
|
||||
layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
|
||||
@@ -195,6 +195,23 @@ gnc_item_edit_draw_info (GncItemEdit *item_edit, int x, int y, TextDrawInfo *inf
|
||||
info->text_rect.y = dy + 1;
|
||||
info->text_rect.width = wd - toggle_space;
|
||||
info->text_rect.height = hd - 2;
|
||||
pango_layout_set_width (info->layout, (wd - toggle_space - 2 * CELL_HPADDING) * PANGO_SCALE);
|
||||
|
||||
switch (gnc_table_get_align (table, item_edit->virt_loc))
|
||||
{
|
||||
default:
|
||||
case CELL_ALIGN_LEFT:
|
||||
pango_layout_set_alignment (info->layout, PANGO_ALIGN_LEFT);
|
||||
break;
|
||||
|
||||
case CELL_ALIGN_RIGHT:
|
||||
pango_layout_set_alignment (info->layout, PANGO_ALIGN_RIGHT);
|
||||
break;
|
||||
|
||||
case CELL_ALIGN_CENTER:
|
||||
pango_layout_set_alignment (info->layout, PANGO_ALIGN_CENTER);
|
||||
break;
|
||||
}
|
||||
|
||||
pango_layout_get_cursor_pos (info->layout, cursor_pos, NULL, &strong_pos);
|
||||
info->cursor = &strong_pos;
|
||||
@@ -254,8 +271,8 @@ gnc_item_edit_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
|
||||
gdk_draw_layout (drawable,
|
||||
item_edit->gc,
|
||||
info.text_rect.x,
|
||||
info.text_rect.y,
|
||||
info.text_rect.x + CELL_HPADDING,
|
||||
info.text_rect.y + 1,
|
||||
info.layout);
|
||||
|
||||
gdk_draw_line (drawable, item_edit->gc, info.cursor->x, info.cursor->y,
|
||||
|
||||
@@ -50,10 +50,18 @@ static guint gnc_item_list_signals[LAST_SIGNAL];
|
||||
void
|
||||
gnc_item_list_clear (GncItemList *item_list)
|
||||
{
|
||||
GtkTreeSelection* selection;
|
||||
|
||||
g_return_if_fail(IS_GNC_ITEM_LIST(item_list));
|
||||
g_return_if_fail(item_list->list_store != NULL);
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (item_list->tree_view));
|
||||
|
||||
g_signal_handlers_block_matched (G_OBJECT (selection), G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, item_list);
|
||||
gtk_list_store_clear (item_list->list_store);
|
||||
g_signal_handlers_unblock_matched (G_OBJECT (selection), G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, item_list);
|
||||
}
|
||||
|
||||
|
||||
@@ -369,7 +377,10 @@ gnc_item_list_new(GnomeCanvasGroup *parent)
|
||||
g_signal_connect_after (G_OBJECT(frame), "button_press_event",
|
||||
G_CALLBACK (gnc_item_list_button_event), item_list);
|
||||
|
||||
g_signal_connect (G_OBJECT (list_store), "key_press_event",
|
||||
g_signal_connect (G_OBJECT (tree_view), "button_press_event",
|
||||
G_CALLBACK (gnc_item_list_key_event), item_list);
|
||||
|
||||
g_signal_connect (G_OBJECT (tree_view), "key_press_event",
|
||||
G_CALLBACK (gnc_item_list_key_event), item_list);
|
||||
|
||||
g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view))), "changed",
|
||||
|
||||
@@ -155,6 +155,7 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
/* GdkFont *font = GNUCASH_GRID(sheet->grid)->normal_font; */
|
||||
CellDimensions *cd;
|
||||
int row, col;
|
||||
gint default_height = 0, max_height = -1;
|
||||
PangoLayout *layout;
|
||||
|
||||
/* g_return_if_fail (font != NULL); */
|
||||
@@ -176,8 +177,11 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
|
||||
|
||||
cell = gnc_cellblock_get_cell (cursor, row, col);
|
||||
if (!cell)
|
||||
if (!cell) {
|
||||
if (cd->pixel_height == 0)
|
||||
cd->pixel_height = default_height;
|
||||
continue;
|
||||
}
|
||||
|
||||
text = cell->sample_text;
|
||||
if (text)
|
||||
@@ -198,6 +202,13 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
cd->pixel_height = (2 * CELL_VPADDING);
|
||||
}
|
||||
|
||||
if (default_height == 0)
|
||||
default_height = cd->pixel_height;
|
||||
if (max_height < 0)
|
||||
max_height = cd->pixel_height;
|
||||
else
|
||||
max_height = MAX(max_height, cd->pixel_height);
|
||||
|
||||
if (cd->pixel_width > 0)
|
||||
continue;
|
||||
|
||||
@@ -209,7 +220,7 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
|
||||
}
|
||||
|
||||
cd = g_table_index (dimensions->cell_dimensions, row, 0);
|
||||
dimensions->height += cd->pixel_height;
|
||||
dimensions->height += max_height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user