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);
|
combo_disconnect_signals ((ComboCell *) bcell);
|
||||||
|
|
||||||
item_edit_set_popup (box->item_edit, NULL, NULL,
|
item_edit_set_popup (box->item_edit, NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
box->list_popped = FALSE;
|
box->list_popped = FALSE;
|
||||||
}
|
}
|
||||||
@ -767,6 +767,13 @@ popup_post_show (GnomeCanvasItem *item,
|
|||||||
gnc_item_list_show_selected (GNC_ITEM_LIST (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
|
static gboolean
|
||||||
enterCombo (BasicCell *bcell,
|
enterCombo (BasicCell *bcell,
|
||||||
int *cursor_position,
|
int *cursor_position,
|
||||||
@ -786,7 +793,8 @@ enterCombo (BasicCell *bcell,
|
|||||||
item_edit_set_popup (box->item_edit,
|
item_edit_set_popup (box->item_edit,
|
||||||
GNOME_CANVAS_ITEM (box->item_list),
|
GNOME_CANVAS_ITEM (box->item_list),
|
||||||
get_popup_height, popup_autosize,
|
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);
|
block_list_signals (cell);
|
||||||
gnc_item_list_select (box->item_list, bcell->value);
|
gnc_item_list_select (box->item_list, bcell->value);
|
||||||
@ -810,8 +818,8 @@ leaveCombo (BasicCell *bcell)
|
|||||||
|
|
||||||
combo_disconnect_signals ((ComboCell *) bcell);
|
combo_disconnect_signals ((ComboCell *) bcell);
|
||||||
|
|
||||||
item_edit_set_popup (box->item_edit, NULL, NULL, NULL,
|
item_edit_set_popup (box->item_edit, NULL, NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
box->list_popped = FALSE;
|
box->list_popped = FALSE;
|
||||||
|
|
||||||
|
@ -761,7 +761,8 @@ moveDate (BasicCell *bcell, VirtualLocation virt_loc)
|
|||||||
|
|
||||||
date_picker_disconnect_signals ((DateCell *) 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;
|
box->calendar_popped = FALSE;
|
||||||
}
|
}
|
||||||
@ -802,7 +803,8 @@ enterDate (BasicCell *bcell,
|
|||||||
PopBox *box = bcell->gui_private;
|
PopBox *box = bcell->gui_private;
|
||||||
|
|
||||||
item_edit_set_popup (box->item_edit, GNOME_CANVAS_ITEM (box->date_picker),
|
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);
|
block_picker_signals (cell);
|
||||||
gnc_date_picker_set_date (box->date_picker,
|
gnc_date_picker_set_date (box->date_picker,
|
||||||
@ -825,7 +827,8 @@ leaveDate (BasicCell *bcell)
|
|||||||
|
|
||||||
date_picker_disconnect_signals ((DateCell *) 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;
|
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))
|
if (!gnc_table_is_popup (item_edit->sheet->table, item_edit->virt_loc))
|
||||||
item_edit_set_popup (item_edit, NULL, NULL, NULL,
|
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);
|
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 y_offset;
|
||||||
gint popup_x, popup_y;
|
gint popup_x, popup_y;
|
||||||
gint popup_height;
|
gint popup_height;
|
||||||
|
gint popup_max_width;
|
||||||
gint view_height;
|
gint view_height;
|
||||||
|
gint view_width;
|
||||||
gint up_height;
|
gint up_height;
|
||||||
gint down_height;
|
gint down_height;
|
||||||
|
|
||||||
@ -1239,7 +1241,10 @@ item_edit_show_popup (ItemEdit *item_edit)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
sheet = item_edit->sheet;
|
sheet = item_edit->sheet;
|
||||||
|
|
||||||
view_height = GTK_WIDGET (sheet)->allocation.height;
|
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);
|
gnome_canvas_get_scroll_offsets (GNOME_CANVAS(sheet), NULL, &y_offset);
|
||||||
item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h);
|
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_height = down_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
popup_max_width = view_width - popup_x;
|
||||||
|
|
||||||
if (item_edit->get_popup_height)
|
if (item_edit->get_popup_height)
|
||||||
popup_height = item_edit->get_popup_height
|
popup_height = item_edit->get_popup_height
|
||||||
(item_edit->popup_item, popup_height, h,
|
(item_edit->popup_item, popup_height, h,
|
||||||
@ -1294,12 +1301,31 @@ item_edit_show_popup (ItemEdit *item_edit)
|
|||||||
item_edit->popup_user_data);
|
item_edit->popup_user_data);
|
||||||
|
|
||||||
/* Make sure the popup gets shown/sized correctly */
|
/* Make sure the popup gets shown/sized correctly */
|
||||||
while (gtk_events_pending())
|
while (gtk_events_pending ())
|
||||||
gtk_main_iteration();
|
gtk_main_iteration ();
|
||||||
|
|
||||||
if (item_edit->popup_post_show)
|
if (item_edit->popup_post_show)
|
||||||
item_edit->popup_post_show (item_edit->popup_item,
|
item_edit->popup_post_show (item_edit->popup_item,
|
||||||
item_edit->popup_user_data);
|
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,
|
PopupAutosize popup_autosize,
|
||||||
PopupSetFocus popup_set_focus,
|
PopupSetFocus popup_set_focus,
|
||||||
PopupPostShow popup_post_show,
|
PopupPostShow popup_post_show,
|
||||||
|
PopupGetWidth popup_get_width,
|
||||||
gpointer popup_user_data)
|
gpointer popup_user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (IS_ITEM_EDIT(item_edit));
|
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_autosize = popup_autosize;
|
||||||
item_edit->popup_set_focus = popup_set_focus;
|
item_edit->popup_set_focus = popup_set_focus;
|
||||||
item_edit->popup_post_show = popup_post_show;
|
item_edit->popup_post_show = popup_post_show;
|
||||||
|
item_edit->popup_get_width = popup_get_width;
|
||||||
item_edit->popup_user_data = popup_user_data;
|
item_edit->popup_user_data = popup_user_data;
|
||||||
|
|
||||||
if (item_edit->is_popup)
|
if (item_edit->is_popup)
|
||||||
@ -1378,7 +1406,7 @@ item_edit_selection_clear (ItemEdit *item_edit,
|
|||||||
|
|
||||||
/* Let the selection handling code know that the selection
|
/* Let the selection handling code know that the selection
|
||||||
* has been changed, since we've overriden the default handler */
|
* has been changed, since we've overriden the default handler */
|
||||||
if (!gtk_selection_clear(GTK_WIDGET(item_edit->sheet), event))
|
if (!gtk_selection_clear (GTK_WIDGET(item_edit->sheet), event))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (event->selection == GDK_SELECTION_PRIMARY)
|
if (event->selection == GDK_SELECTION_PRIMARY)
|
||||||
@ -1391,7 +1419,7 @@ item_edit_selection_clear (ItemEdit *item_edit,
|
|||||||
}
|
}
|
||||||
else if (event->selection == clipboard_atom)
|
else if (event->selection == clipboard_atom)
|
||||||
{
|
{
|
||||||
g_free(item_edit->clipboard);
|
g_free (item_edit->clipboard);
|
||||||
item_edit->clipboard = NULL;
|
item_edit->clipboard = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ typedef void (*PopupSetFocus) (GnomeCanvasItem *item,
|
|||||||
typedef void (*PopupPostShow) (GnomeCanvasItem *item,
|
typedef void (*PopupPostShow) (GnomeCanvasItem *item,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
typedef int (*PopupGetWidth) (GnomeCanvasItem *item,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
typedef struct _PopupToggle PopupToggle;
|
typedef struct _PopupToggle PopupToggle;
|
||||||
struct _PopupToggle
|
struct _PopupToggle
|
||||||
@ -86,6 +88,7 @@ typedef struct
|
|||||||
PopupAutosize popup_autosize;
|
PopupAutosize popup_autosize;
|
||||||
PopupSetFocus popup_set_focus;
|
PopupSetFocus popup_set_focus;
|
||||||
PopupPostShow popup_post_show;
|
PopupPostShow popup_post_show;
|
||||||
|
PopupGetWidth popup_get_width;
|
||||||
gpointer popup_user_data;
|
gpointer popup_user_data;
|
||||||
|
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
@ -122,6 +125,7 @@ void item_edit_set_popup (ItemEdit *item_edit,
|
|||||||
PopupAutosize popup_autosize,
|
PopupAutosize popup_autosize,
|
||||||
PopupSetFocus popup_set_focus,
|
PopupSetFocus popup_set_focus,
|
||||||
PopupPostShow popup_post_show,
|
PopupPostShow popup_post_show,
|
||||||
|
PopupGetWidth popup_get_width,
|
||||||
gpointer popup_user_data);
|
gpointer popup_user_data);
|
||||||
|
|
||||||
void item_edit_show_popup (ItemEdit *item_edit);
|
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
|
static void
|
||||||
gnc_item_list_init(GNCItemList *item_list)
|
gnc_item_list_init(GNCItemList *item_list)
|
||||||
{
|
{
|
||||||
@ -260,12 +247,10 @@ gnc_item_list_class_init(GNCItemListClass *item_list_class)
|
|||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
|
|
||||||
gnc_item_list_parent_class =
|
gnc_item_list_parent_class =
|
||||||
gtk_type_class(gnome_canvas_widget_get_type());
|
gtk_type_class (gnome_canvas_widget_get_type ());
|
||||||
|
|
||||||
object_class = GTK_OBJECT_CLASS(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] =
|
gnc_item_list_signals[SELECT_ITEM] =
|
||||||
gtk_signal_new("select_item",
|
gtk_signal_new("select_item",
|
||||||
GTK_RUN_LAST,
|
GTK_RUN_LAST,
|
||||||
|
@ -41,17 +41,17 @@ GtkType gnc_item_list_get_type (void);
|
|||||||
|
|
||||||
GnomeCanvasItem *gnc_item_list_new (GnomeCanvasGroup *parent);
|
GnomeCanvasItem *gnc_item_list_new (GnomeCanvasGroup *parent);
|
||||||
|
|
||||||
void gnc_item_list_clear(GNCItemList *item_list);
|
void gnc_item_list_clear (GNCItemList *item_list);
|
||||||
|
|
||||||
void gnc_item_list_append(GNCItemList *item_list, char *string);
|
void gnc_item_list_append (GNCItemList *item_list, char *string);
|
||||||
|
|
||||||
void gnc_item_list_select(GNCItemList *item_list, const char *string);
|
void gnc_item_list_select (GNCItemList *item_list, const char *string);
|
||||||
|
|
||||||
void gnc_item_list_show_selected(GNCItemList *item_list);
|
void gnc_item_list_show_selected (GNCItemList *item_list);
|
||||||
|
|
||||||
void gnc_item_list_sort(GNCItemList *item_list);
|
void gnc_item_list_sort (GNCItemList *item_list);
|
||||||
|
|
||||||
void gnc_item_list_autosize(GNCItemList *item_list);
|
void gnc_item_list_autosize (GNCItemList *item_list);
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
Loading…
Reference in New Issue
Block a user