mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix drawing bug.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3429 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
a092a2e7cf
commit
4c8b980884
@ -729,7 +729,7 @@ moveCombo (BasicCell *bcell, VirtualLocation virt_loc)
|
||||
combo_disconnect_signals ((ComboCell *) bcell);
|
||||
|
||||
item_edit_set_popup (box->item_edit, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL);
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
box->list_popped = FALSE;
|
||||
}
|
||||
@ -767,6 +767,13 @@ popup_post_show (GnomeCanvasItem *item,
|
||||
gnc_item_list_show_selected (GNC_ITEM_LIST (item));
|
||||
}
|
||||
|
||||
static int
|
||||
popup_get_width (GnomeCanvasItem *item,
|
||||
gpointer user_data)
|
||||
{
|
||||
return GTK_WIDGET (GNC_ITEM_LIST (item)->clist)->allocation.width;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
enterCombo (BasicCell *bcell,
|
||||
int *cursor_position,
|
||||
@ -786,7 +793,8 @@ enterCombo (BasicCell *bcell,
|
||||
item_edit_set_popup (box->item_edit,
|
||||
GNOME_CANVAS_ITEM (box->item_list),
|
||||
get_popup_height, popup_autosize,
|
||||
popup_set_focus, popup_post_show, NULL);
|
||||
popup_set_focus, popup_post_show,
|
||||
popup_get_width, NULL);
|
||||
|
||||
block_list_signals (cell);
|
||||
gnc_item_list_select (box->item_list, bcell->value);
|
||||
@ -810,8 +818,8 @@ leaveCombo (BasicCell *bcell)
|
||||
|
||||
combo_disconnect_signals ((ComboCell *) bcell);
|
||||
|
||||
item_edit_set_popup (box->item_edit, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
item_edit_set_popup (box->item_edit, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
box->list_popped = FALSE;
|
||||
|
||||
|
@ -761,7 +761,8 @@ moveDate (BasicCell *bcell, VirtualLocation virt_loc)
|
||||
|
||||
date_picker_disconnect_signals ((DateCell *) bcell);
|
||||
|
||||
item_edit_set_popup (box->item_edit, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
item_edit_set_popup (box->item_edit, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
box->calendar_popped = FALSE;
|
||||
}
|
||||
@ -802,7 +803,8 @@ enterDate (BasicCell *bcell,
|
||||
PopBox *box = bcell->gui_private;
|
||||
|
||||
item_edit_set_popup (box->item_edit, GNOME_CANVAS_ITEM (box->date_picker),
|
||||
get_popup_height, NULL, popup_set_focus, NULL, NULL);
|
||||
get_popup_height, NULL, popup_set_focus,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
block_picker_signals (cell);
|
||||
gnc_date_picker_set_date (box->date_picker,
|
||||
@ -825,7 +827,8 @@ leaveDate (BasicCell *bcell)
|
||||
|
||||
date_picker_disconnect_signals ((DateCell *) bcell);
|
||||
|
||||
item_edit_set_popup (box->item_edit, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
item_edit_set_popup (box->item_edit, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
box->calendar_popped = FALSE;
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ item_edit_configure (ItemEdit *item_edit)
|
||||
|
||||
if (!gnc_table_is_popup (item_edit->sheet->table, item_edit->virt_loc))
|
||||
item_edit_set_popup (item_edit, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
||||
item_edit_update (GNOME_CANVAS_ITEM(item_edit), NULL, NULL, 0);
|
||||
}
|
||||
@ -1228,7 +1228,9 @@ item_edit_show_popup (ItemEdit *item_edit)
|
||||
gint y_offset;
|
||||
gint popup_x, popup_y;
|
||||
gint popup_height;
|
||||
gint popup_max_width;
|
||||
gint view_height;
|
||||
gint view_width;
|
||||
gint up_height;
|
||||
gint down_height;
|
||||
|
||||
@ -1239,7 +1241,10 @@ item_edit_show_popup (ItemEdit *item_edit)
|
||||
return;
|
||||
|
||||
sheet = item_edit->sheet;
|
||||
|
||||
view_height = GTK_WIDGET (sheet)->allocation.height;
|
||||
view_width = GTK_WIDGET (sheet)->allocation.width;
|
||||
|
||||
gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), NULL, &y_offset);
|
||||
item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h);
|
||||
|
||||
@ -1261,6 +1266,8 @@ item_edit_show_popup (ItemEdit *item_edit)
|
||||
popup_height = down_height;
|
||||
}
|
||||
|
||||
popup_max_width = view_width - popup_x;
|
||||
|
||||
if (item_edit->get_popup_height)
|
||||
popup_height = item_edit->get_popup_height
|
||||
(item_edit->popup_item, popup_height, h,
|
||||
@ -1300,6 +1307,25 @@ item_edit_show_popup (ItemEdit *item_edit)
|
||||
if (item_edit->popup_post_show)
|
||||
item_edit->popup_post_show (item_edit->popup_item,
|
||||
item_edit->popup_user_data);
|
||||
|
||||
if (item_edit->popup_get_width)
|
||||
{
|
||||
int popup_width;
|
||||
|
||||
popup_width = item_edit->popup_get_width
|
||||
(item_edit->popup_item,
|
||||
item_edit->popup_user_data);
|
||||
|
||||
if (popup_width > popup_max_width)
|
||||
{
|
||||
popup_x -= popup_width - popup_max_width;
|
||||
popup_x = MAX (0, popup_x);
|
||||
|
||||
gnome_canvas_item_set (item_edit->popup_item,
|
||||
"x", (gdouble) popup_x,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1330,6 +1356,7 @@ item_edit_set_popup (ItemEdit *item_edit,
|
||||
PopupAutosize popup_autosize,
|
||||
PopupSetFocus popup_set_focus,
|
||||
PopupPostShow popup_post_show,
|
||||
PopupGetWidth popup_get_width,
|
||||
gpointer popup_user_data)
|
||||
{
|
||||
g_return_if_fail (IS_ITEM_EDIT(item_edit));
|
||||
@ -1344,6 +1371,7 @@ item_edit_set_popup (ItemEdit *item_edit,
|
||||
item_edit->popup_autosize = popup_autosize;
|
||||
item_edit->popup_set_focus = popup_set_focus;
|
||||
item_edit->popup_post_show = popup_post_show;
|
||||
item_edit->popup_get_width = popup_get_width;
|
||||
item_edit->popup_user_data = popup_user_data;
|
||||
|
||||
if (item_edit->is_popup)
|
||||
|
@ -46,6 +46,8 @@ typedef void (*PopupSetFocus) (GnomeCanvasItem *item,
|
||||
typedef void (*PopupPostShow) (GnomeCanvasItem *item,
|
||||
gpointer user_data);
|
||||
|
||||
typedef int (*PopupGetWidth) (GnomeCanvasItem *item,
|
||||
gpointer user_data);
|
||||
|
||||
typedef struct _PopupToggle PopupToggle;
|
||||
struct _PopupToggle
|
||||
@ -86,6 +88,7 @@ typedef struct
|
||||
PopupAutosize popup_autosize;
|
||||
PopupSetFocus popup_set_focus;
|
||||
PopupPostShow popup_post_show;
|
||||
PopupGetWidth popup_get_width;
|
||||
gpointer popup_user_data;
|
||||
|
||||
GdkGC *gc;
|
||||
@ -122,6 +125,7 @@ void item_edit_set_popup (ItemEdit *item_edit,
|
||||
PopupAutosize popup_autosize,
|
||||
PopupSetFocus popup_set_focus,
|
||||
PopupPostShow popup_post_show,
|
||||
PopupGetWidth popup_get_width,
|
||||
gpointer popup_user_data);
|
||||
|
||||
void item_edit_show_popup (ItemEdit *item_edit);
|
||||
|
@ -147,19 +147,6 @@ gnc_item_list_autosize(GNCItemList *item_list)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
item_edit_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
||||
{
|
||||
/* GNCItemList *item_list = GNC_ITEM_LIST(object); */
|
||||
|
||||
switch (arg_id)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnc_item_list_init(GNCItemList *item_list)
|
||||
{
|
||||
@ -264,8 +251,6 @@ gnc_item_list_class_init(GNCItemListClass *item_list_class)
|
||||
|
||||
object_class = GTK_OBJECT_CLASS(item_list_class);
|
||||
|
||||
object_class->set_arg = item_edit_set_arg;
|
||||
|
||||
gnc_item_list_signals[SELECT_ITEM] =
|
||||
gtk_signal_new("select_item",
|
||||
GTK_RUN_LAST,
|
||||
|
Loading…
Reference in New Issue
Block a user