From 7ffbbe3692d4bf0f8b5919939881021eb2c907fb Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 26 Jan 2000 00:53:50 +0000 Subject: Handle shift-tab properly now. 2000-01-25 Christopher James Lahey * widgets/e-reflow.c, widgets/e-minicard.c: Handle shift-tab properly now. * widgets/e-minicard-label.c: Reindented some areas. * widgets/test-reflow.c: Use e-canvas. Set the back pixmap to NULL for the canvas so that scrolling won't flash grey. * widgets/e-canvas.c, widgets/e-canvas.h: These subclass GnomeCanvas to work around a few bugs so that evolution will work well with old versions of gnome-libs. * widgets/Makefile.am: Added e-canvas.c and e-canvas.h. * addressbook/contact-editor/contact-editor.glade: Not much change. Mostly internal reorganization by glade itself. svn path=/trunk/; revision=1638 --- ChangeLog | 19 + addressbook/contact-editor/contact-editor.glade | 785 +++++++++++---------- .../gui/contact-editor/contact-editor.glade | 785 +++++++++++---------- addressbook/gui/minicard/e-minicard-label.c | 32 +- addressbook/gui/minicard/e-minicard.c | 4 +- addressbook/gui/minicard/e-reflow.c | 4 +- addressbook/gui/minicard/test-reflow.c | 4 +- addressbook/gui/widgets/e-minicard-label.c | 32 +- addressbook/gui/widgets/e-minicard.c | 4 +- addressbook/gui/widgets/test-reflow.c | 4 +- e-util/e-canvas.c | 233 ++++++ e-util/e-canvas.h | 66 ++ widgets/Makefile.am | 2 + widgets/e-canvas.c | 233 ++++++ widgets/e-canvas.h | 66 ++ widgets/e-minicard-label.c | 32 +- widgets/e-minicard.c | 4 +- widgets/e-minicard/e-minicard-label.c | 32 +- widgets/e-minicard/e-minicard.c | 4 +- widgets/e-minicard/e-reflow.c | 4 +- widgets/e-minicard/test-reflow.c | 4 +- widgets/e-reflow.c | 4 +- widgets/e-reflow/e-reflow.c | 4 +- widgets/misc/e-canvas.c | 233 ++++++ widgets/misc/e-canvas.h | 66 ++ widgets/misc/e-reflow.c | 4 +- widgets/test-reflow.c | 4 +- 27 files changed, 1805 insertions(+), 863 deletions(-) create mode 100644 e-util/e-canvas.c create mode 100644 e-util/e-canvas.h create mode 100644 widgets/e-canvas.c create mode 100644 widgets/e-canvas.h create mode 100644 widgets/misc/e-canvas.c create mode 100644 widgets/misc/e-canvas.h diff --git a/ChangeLog b/ChangeLog index 73125b6094..3d547c5687 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2000-01-25 Christopher James Lahey + + * widgets/e-reflow.c, widgets/e-minicard.c: Handle shift-tab + properly now. + + * widgets/e-minicard-label.c: Reindented some areas. + + * widgets/test-reflow.c: Use e-canvas. Set the back pixmap to + NULL for the canvas so that scrolling won't flash grey. + + * widgets/e-canvas.c, widgets/e-canvas.h: These subclass + GnomeCanvas to work around a few bugs so that evolution will work + well with old versions of gnome-libs. + + * widgets/Makefile.am: Added e-canvas.c and e-canvas.h. + + * addressbook/contact-editor/contact-editor.glade: Not much + change. Mostly internal reorganization by glade itself. + 2000-01-25 Christopher James Lahey * addressbook/printing/smallbook.ecps: Example contact printing diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade index 87251a6f6f..24f98decac 100644 --- a/addressbook/contact-editor/contact-editor.glade +++ b/addressbook/contact-editor/contact-editor.glade @@ -4,23 +4,11 @@ Contact-editor contact-editor - - src - pixmaps - C - True - True True False False False False - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h True e-contact-editor-strings.h @@ -32,6 +20,7 @@ Contact Editor GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE + False False True False @@ -47,7 +36,6 @@ 2 2 False - 5 GtkTable @@ -62,6 +50,11 @@ GtkEntry entry-phone1 + True + True + True + 0 + 7 8 @@ -76,16 +69,16 @@ True False - True - True - True - 0 - GtkEntry entry-phone2 + True + True + True + 0 + 7 8 @@ -100,16 +93,16 @@ True False - True - True - True - 0 - GtkEntry entry-phone3 + True + True + True + 0 + 7 8 @@ -124,16 +117,16 @@ True False - True - True - True - 0 - GtkEntry entry-phone4 + True + True + True + 0 + 7 8 @@ -148,16 +141,16 @@ True False - True - True - True - 0 - GtkEntry entry-fullname + True + True + True + 0 + 3 4 @@ -172,16 +165,16 @@ True False - True - True - True - 0 - GtkEntry entry-web + True + True + True + 0 + 3 4 @@ -196,16 +189,18 @@ True False - True - True - True - 0 - GtkLabel label-phone3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 5 6 @@ -220,18 +215,18 @@ True True - + + + + GtkLabel + label-phone2 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label-phone2 5 6 @@ -246,18 +241,18 @@ True True - + + + + GtkLabel + label-phone1 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label-phone1 5 6 @@ -272,18 +267,18 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkLabel label-phone4 + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 5 6 @@ -298,18 +293,16 @@ True True - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 GtkText text-address + 1 + 1 + True + True + 7 8 @@ -324,16 +317,18 @@ True True - 1 - 1 - True - True - GtkLabel label-email1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 1 2 @@ -348,18 +343,13 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkButton button-fullname + True + 1 3 @@ -374,13 +364,18 @@ True True - True - GtkAccelLabel accellabel-jobtitle + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 1 3 @@ -395,18 +390,18 @@ True True - + + + + GtkAccelLabel + accellabel-company + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkAccelLabel - accellabel-company 1 3 @@ -421,18 +416,18 @@ True True - + + + + GtkAccelLabel + accellabel-fileas + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkAccelLabel - accellabel-fileas 1 3 @@ -447,18 +442,18 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkAccelLabel accellabel-web + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 1 3 @@ -473,18 +468,13 @@ True True - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 GtkHBox hbox5 + False + 0 0 8 @@ -499,43 +489,43 @@ True True - False - 0 GtkText text-comments + True + True + 0 True True - True - True - GtkVScrollbar vscrollbar-comments + GTK_UPDATE_CONTINUOUS + 0 + 0 + 0 + 0 + 0 + 0 0 False False - GTK_UPDATE_CONTINUOUS - 0 - 0 - 0 - 0 - 0 - 0 GtkHBox hbox3 + False + 6 0 8 @@ -550,67 +540,69 @@ True True - False - 6 GtkButton button-contacts + True + 0 False False - True - GtkEntry entry-contacts - - 0 - True - True - True True True 0 + + 0 + True + True + GtkButton button-categories + True + 0 False False - True - GtkEntry entry-categories - - 0 - False - False - True True True 0 + + 0 + False + False + GtkAlignment alignment2 + 0 + 0 + 0 + 0 7 8 @@ -625,10 +617,6 @@ True True - 0 - 0 - 0 - 0 GtkCheckButton @@ -643,6 +631,8 @@ GtkButton button-address + True + 5 7 @@ -657,13 +647,16 @@ True True - True - GtkEntry entry-jobtitle + True + True + True + 0 + 3 4 @@ -678,16 +671,16 @@ True False - True - True - True - 0 - GtkEntry entry-company + True + True + True + 0 + 3 4 @@ -702,16 +695,18 @@ True False - True - True - True - 0 - GtkCombo combo-fileas + True + False + True + True + True + False + 3 4 @@ -726,16 +721,24 @@ True False - True - True - True - False - + + + GtkEntry + GtkCombo:entry + entry14 + True + True + True + 0 + + GtkHBox hbox4 + False + 4 3 4 @@ -750,22 +753,20 @@ True False - False - 4 GtkEntry entry-email1 - - 0 - True - True - True True True 0 + + 0 + True + True + @@ -786,6 +787,10 @@ GtkAlignment alignment3 + 1 + 0.5 + 0 + 1 2 3 @@ -800,10 +805,6 @@ True True - 1 - 0.5 - 0 - 1 GtkButton @@ -819,6 +820,10 @@ GtkAlignment alignment4 + 1 + 0.5 + 0 + 1 6 7 @@ -833,10 +838,6 @@ True True - 1 - 0.5 - 0 - 1 GtkButton @@ -852,6 +853,10 @@ GtkAlignment alignment5 + 1 + 0.5 + 0 + 0 6 7 @@ -866,10 +871,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -885,6 +886,10 @@ GtkAlignment alignment7 + 1 + 0.5 + 0 + 0 6 7 @@ -899,10 +904,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -918,6 +919,10 @@ GtkAlignment alignment8 + 1 + 0.5 + 0 + 0 6 7 @@ -932,10 +937,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -951,6 +952,13 @@ GtkLabel label-address1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 5 6 @@ -965,13 +973,6 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 @@ -1034,6 +1035,10 @@ GtkAlignment alignment6 + 1 + 0.5 + 0 + 0 6 7 @@ -1048,10 +1053,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -1091,6 +1092,13 @@ GtkLabel label21 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 1 2 @@ -1105,18 +1113,18 @@ True True - + + + + GtkLabel + label22 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label22 1 2 @@ -1131,18 +1139,18 @@ True True - + + + + GtkLabel + label23 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label23 1 2 @@ -1157,18 +1165,18 @@ True True - + + + + GtkLabel + label24 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label24 1 2 @@ -1183,18 +1191,18 @@ True True - + + + + GtkLabel + label25 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label25 1 2 @@ -1209,18 +1217,18 @@ True True - + + + + GtkLabel + label26 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label26 1 2 @@ -1235,18 +1243,18 @@ True True - + + + + GtkLabel + label27 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label27 1 2 @@ -1261,18 +1269,18 @@ True True - + + + + GtkLabel + label28 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label28 1 2 @@ -1287,18 +1295,18 @@ True True - + + + + GtkLabel + label31 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label31 3 4 @@ -1313,18 +1321,18 @@ True True - + + + + GtkLabel + label30 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label30 3 4 @@ -1339,18 +1347,18 @@ True True - + + + + GtkLabel + label29 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label29 3 4 @@ -1365,18 +1373,18 @@ True True - + + + + GtkLabel + label32 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label32 3 4 @@ -1391,18 +1399,16 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkEntry entry4 + True + True + True + 0 + 2 3 @@ -1417,16 +1423,16 @@ True False - True - True - True - 0 - GtkEntry entry5 + True + True + True + 0 + 2 3 @@ -1441,16 +1447,16 @@ True False - True - True - True - 0 - GtkEntry entry6 + True + True + True + 0 + 2 3 @@ -1465,16 +1471,16 @@ True False - True - True - True - 0 - GtkEntry entry7 + True + True + True + 0 + 2 3 @@ -1489,16 +1495,16 @@ True False - True - True - True - 0 - GtkEntry entry8 + True + True + True + 0 + 2 3 @@ -1513,16 +1519,16 @@ True False - True - True - True - 0 - GtkEntry entry9 + True + True + True + 0 + 2 6 @@ -1537,16 +1543,16 @@ True False - True - True - True - 0 - GtkEntry entry10 + True + True + True + 0 + 2 5 @@ -1561,16 +1567,16 @@ True False - True - True - True - 0 - GtkEntry entry11 + True + True + True + 0 + 2 6 @@ -1585,16 +1591,16 @@ True False - True - True - True - 0 - GnomeDateEdit dateedit2 + False + False + False + 7 + 19 4 6 @@ -1609,16 +1615,16 @@ True False - False - False - False - 7 - 19 GnomeDateEdit dateedit1 + False + False + False + 7 + 19 4 6 @@ -1633,16 +1639,16 @@ True False - False - False - False - 7 - 19 GtkEntry entry13 + True + True + True + 0 + 4 6 @@ -1657,16 +1663,16 @@ True False - True - True - True - 0 - GtkEntry entry12 + True + True + True + 0 + 4 6 @@ -1681,16 +1687,13 @@ True False - True - True - True - 0 - GtkButton button-callnow + True + 5 6 @@ -1705,13 +1708,13 @@ True True - True - GtkHBox hbox7 + False + 6 0 6 @@ -1726,17 +1729,10 @@ True True - False - 6 GtkLabel label33 - - 0 - False - False - GTK_JUSTIFY_CENTER False @@ -1744,6 +1740,11 @@ 0.5 0 2 + + 0 + False + False + @@ -1760,6 +1761,8 @@ GtkHBox hbox8 + False + 6 0 6 @@ -1774,17 +1777,10 @@ True True - False - 6 GtkLabel label34 - - 0 - False - False - GTK_JUSTIFY_CENTER False @@ -1792,6 +1788,11 @@ 0.5 0 2 + + 0 + False + False + @@ -1907,41 +1908,49 @@ GnomeDialog dialog2 False - False - False + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False False False False + False + False GtkVBox GnomeDialog:vbox dialog-vbox2 + False + 8 4 True True - False - 8 GtkTable table2 - - 0 - True - True - 2 2 False 0 0 + + 0 + True + True + GtkEntry entry2 + True + True + True + 0 + 0 2 @@ -1956,16 +1965,13 @@ True False - True - True - True - 0 - GtkVBox vbox1 + False + 0 1 2 @@ -1980,37 +1986,40 @@ True True - False - 0 GtkButton button31 + True + 0 False False - True - GtkButton button32 + True + 0 False False - True - GtkScrolledWindow scrolledwindow1 + 200 + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS 0 1 @@ -2025,11 +2034,6 @@ True True - 200 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS GtkCList @@ -2061,18 +2065,18 @@ GtkHButtonBox GnomeDialog:action_area dialog-action_area2 - - 0 - False - True - GTK_PACK_END - GTK_BUTTONBOX_END 8 85 27 7 0 + + 0 + False + True + GTK_PACK_END + GtkButton @@ -2106,36 +2110,39 @@ dialog-add-phone False New phone type - False - False + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False False False False + False + False GtkVBox GnomeDialog:vbox vbox2 + False + 8 4 True True - False - 8 GtkFrame frame-add-phone 4 + + 0 + GTK_SHADOW_ETCHED_IN 0 True True - - 0 - GTK_SHADOW_ETCHED_IN GtkAlignment @@ -2162,18 +2169,18 @@ GtkHButtonBox GnomeDialog:action_area hbuttonbox1 - - 0 - False - True - GTK_PACK_END - GTK_BUTTONBOX_END 8 85 27 7 0 + + 0 + False + True + GTK_PACK_END + GtkButton diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade index 87251a6f6f..24f98decac 100644 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ b/addressbook/gui/contact-editor/contact-editor.glade @@ -4,23 +4,11 @@ Contact-editor contact-editor - - src - pixmaps - C - True - True True False False False False - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h True e-contact-editor-strings.h @@ -32,6 +20,7 @@ Contact Editor GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE + False False True False @@ -47,7 +36,6 @@ 2 2 False - 5 GtkTable @@ -62,6 +50,11 @@ GtkEntry entry-phone1 + True + True + True + 0 + 7 8 @@ -76,16 +69,16 @@ True False - True - True - True - 0 - GtkEntry entry-phone2 + True + True + True + 0 + 7 8 @@ -100,16 +93,16 @@ True False - True - True - True - 0 - GtkEntry entry-phone3 + True + True + True + 0 + 7 8 @@ -124,16 +117,16 @@ True False - True - True - True - 0 - GtkEntry entry-phone4 + True + True + True + 0 + 7 8 @@ -148,16 +141,16 @@ True False - True - True - True - 0 - GtkEntry entry-fullname + True + True + True + 0 + 3 4 @@ -172,16 +165,16 @@ True False - True - True - True - 0 - GtkEntry entry-web + True + True + True + 0 + 3 4 @@ -196,16 +189,18 @@ True False - True - True - True - 0 - GtkLabel label-phone3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 5 6 @@ -220,18 +215,18 @@ True True - + + + + GtkLabel + label-phone2 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label-phone2 5 6 @@ -246,18 +241,18 @@ True True - + + + + GtkLabel + label-phone1 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label-phone1 5 6 @@ -272,18 +267,18 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkLabel label-phone4 + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 5 6 @@ -298,18 +293,16 @@ True True - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 GtkText text-address + 1 + 1 + True + True + 7 8 @@ -324,16 +317,18 @@ True True - 1 - 1 - True - True - GtkLabel label-email1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 1 2 @@ -348,18 +343,13 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkButton button-fullname + True + 1 3 @@ -374,13 +364,18 @@ True True - True - GtkAccelLabel accellabel-jobtitle + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 1 3 @@ -395,18 +390,18 @@ True True - + + + + GtkAccelLabel + accellabel-company + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkAccelLabel - accellabel-company 1 3 @@ -421,18 +416,18 @@ True True - + + + + GtkAccelLabel + accellabel-fileas + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkAccelLabel - accellabel-fileas 1 3 @@ -447,18 +442,18 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkAccelLabel accellabel-web + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 1 3 @@ -473,18 +468,13 @@ True True - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 GtkHBox hbox5 + False + 0 0 8 @@ -499,43 +489,43 @@ True True - False - 0 GtkText text-comments + True + True + 0 True True - True - True - GtkVScrollbar vscrollbar-comments + GTK_UPDATE_CONTINUOUS + 0 + 0 + 0 + 0 + 0 + 0 0 False False - GTK_UPDATE_CONTINUOUS - 0 - 0 - 0 - 0 - 0 - 0 GtkHBox hbox3 + False + 6 0 8 @@ -550,67 +540,69 @@ True True - False - 6 GtkButton button-contacts + True + 0 False False - True - GtkEntry entry-contacts - - 0 - True - True - True True True 0 + + 0 + True + True + GtkButton button-categories + True + 0 False False - True - GtkEntry entry-categories - - 0 - False - False - True True True 0 + + 0 + False + False + GtkAlignment alignment2 + 0 + 0 + 0 + 0 7 8 @@ -625,10 +617,6 @@ True True - 0 - 0 - 0 - 0 GtkCheckButton @@ -643,6 +631,8 @@ GtkButton button-address + True + 5 7 @@ -657,13 +647,16 @@ True True - True - GtkEntry entry-jobtitle + True + True + True + 0 + 3 4 @@ -678,16 +671,16 @@ True False - True - True - True - 0 - GtkEntry entry-company + True + True + True + 0 + 3 4 @@ -702,16 +695,18 @@ True False - True - True - True - 0 - GtkCombo combo-fileas + True + False + True + True + True + False + 3 4 @@ -726,16 +721,24 @@ True False - True - True - True - False - + + + GtkEntry + GtkCombo:entry + entry14 + True + True + True + 0 + + GtkHBox hbox4 + False + 4 3 4 @@ -750,22 +753,20 @@ True False - False - 4 GtkEntry entry-email1 - - 0 - True - True - True True True 0 + + 0 + True + True + @@ -786,6 +787,10 @@ GtkAlignment alignment3 + 1 + 0.5 + 0 + 1 2 3 @@ -800,10 +805,6 @@ True True - 1 - 0.5 - 0 - 1 GtkButton @@ -819,6 +820,10 @@ GtkAlignment alignment4 + 1 + 0.5 + 0 + 1 6 7 @@ -833,10 +838,6 @@ True True - 1 - 0.5 - 0 - 1 GtkButton @@ -852,6 +853,10 @@ GtkAlignment alignment5 + 1 + 0.5 + 0 + 0 6 7 @@ -866,10 +871,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -885,6 +886,10 @@ GtkAlignment alignment7 + 1 + 0.5 + 0 + 0 6 7 @@ -899,10 +904,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -918,6 +919,10 @@ GtkAlignment alignment8 + 1 + 0.5 + 0 + 0 6 7 @@ -932,10 +937,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -951,6 +952,13 @@ GtkLabel label-address1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 5 6 @@ -965,13 +973,6 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 @@ -1034,6 +1035,10 @@ GtkAlignment alignment6 + 1 + 0.5 + 0 + 0 6 7 @@ -1048,10 +1053,6 @@ True True - 1 - 0.5 - 0 - 0 GtkButton @@ -1091,6 +1092,13 @@ GtkLabel label21 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 1 2 @@ -1105,18 +1113,18 @@ True True - + + + + GtkLabel + label22 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label22 1 2 @@ -1131,18 +1139,18 @@ True True - + + + + GtkLabel + label23 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label23 1 2 @@ -1157,18 +1165,18 @@ True True - + + + + GtkLabel + label24 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label24 1 2 @@ -1183,18 +1191,18 @@ True True - + + + + GtkLabel + label25 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label25 1 2 @@ -1209,18 +1217,18 @@ True True - + + + + GtkLabel + label26 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label26 1 2 @@ -1235,18 +1243,18 @@ True True - + + + + GtkLabel + label27 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label27 1 2 @@ -1261,18 +1269,18 @@ True True - + + + + GtkLabel + label28 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label28 1 2 @@ -1287,18 +1295,18 @@ True True - + + + + GtkLabel + label31 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label31 3 4 @@ -1313,18 +1321,18 @@ True True - + + + + GtkLabel + label30 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label30 3 4 @@ -1339,18 +1347,18 @@ True True - + + + + GtkLabel + label29 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label29 3 4 @@ -1365,18 +1373,18 @@ True True - + + + + GtkLabel + label32 + GTK_JUSTIFY_CENTER False 0 0.5 0 0 - - - - GtkLabel - label32 3 4 @@ -1391,18 +1399,16 @@ True True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 GtkEntry entry4 + True + True + True + 0 + 2 3 @@ -1417,16 +1423,16 @@ True False - True - True - True - 0 - GtkEntry entry5 + True + True + True + 0 + 2 3 @@ -1441,16 +1447,16 @@ True False - True - True - True - 0 - GtkEntry entry6 + True + True + True + 0 + 2 3 @@ -1465,16 +1471,16 @@ True False - True - True - True - 0 - GtkEntry entry7 + True + True + True + 0 + 2 3 @@ -1489,16 +1495,16 @@ True False - True - True - True - 0 - GtkEntry entry8 + True + True + True + 0 + 2 3 @@ -1513,16 +1519,16 @@ True False - True - True - True - 0 - GtkEntry entry9 + True + True + True + 0 + 2 6 @@ -1537,16 +1543,16 @@ True False - True - True - True - 0 - GtkEntry entry10 + True + True + True + 0 + 2 5 @@ -1561,16 +1567,16 @@ True False - True - True - True - 0 - GtkEntry entry11 + True + True + True + 0 + 2 6 @@ -1585,16 +1591,16 @@ True False - True - True - True - 0 - GnomeDateEdit dateedit2 + False + False + False + 7 + 19 4 6 @@ -1609,16 +1615,16 @@ True False - False - False - False - 7 - 19 GnomeDateEdit dateedit1 + False + False + False + 7 + 19 4 6 @@ -1633,16 +1639,16 @@ True False - False - False - False - 7 - 19 GtkEntry entry13 + True + True + True + 0 + 4 6 @@ -1657,16 +1663,16 @@ True False - True - True - True - 0 - GtkEntry entry12 + True + True + True + 0 + 4 6 @@ -1681,16 +1687,13 @@ True False - True - True - True - 0 - GtkButton button-callnow + True + 5 6 @@ -1705,13 +1708,13 @@ True True - True - GtkHBox hbox7 + False + 6 0 6 @@ -1726,17 +1729,10 @@ True True - False - 6 GtkLabel label33 - - 0 - False - False - GTK_JUSTIFY_CENTER False @@ -1744,6 +1740,11 @@ 0.5 0 2 + + 0 + False + False + @@ -1760,6 +1761,8 @@ GtkHBox hbox8 + False + 6 0 6 @@ -1774,17 +1777,10 @@ True True - False - 6 GtkLabel label34 - - 0 - False - False - GTK_JUSTIFY_CENTER False @@ -1792,6 +1788,11 @@ 0.5 0 2 + + 0 + False + False + @@ -1907,41 +1908,49 @@ GnomeDialog dialog2 False - False - False + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False False False False + False + False GtkVBox GnomeDialog:vbox dialog-vbox2 + False + 8 4 True True - False - 8 GtkTable table2 - - 0 - True - True - 2 2 False 0 0 + + 0 + True + True + GtkEntry entry2 + True + True + True + 0 + 0 2 @@ -1956,16 +1965,13 @@ True False - True - True - True - 0 - GtkVBox vbox1 + False + 0 1 2 @@ -1980,37 +1986,40 @@ True True - False - 0 GtkButton button31 + True + 0 False False - True - GtkButton button32 + True + 0 False False - True - GtkScrolledWindow scrolledwindow1 + 200 + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS 0 1 @@ -2025,11 +2034,6 @@ True True - 200 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS GtkCList @@ -2061,18 +2065,18 @@ GtkHButtonBox GnomeDialog:action_area dialog-action_area2 - - 0 - False - True - GTK_PACK_END - GTK_BUTTONBOX_END 8 85 27 7 0 + + 0 + False + True + GTK_PACK_END + GtkButton @@ -2106,36 +2110,39 @@ dialog-add-phone False New phone type - False - False + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False False False False + False + False GtkVBox GnomeDialog:vbox vbox2 + False + 8 4 True True - False - 8 GtkFrame frame-add-phone 4 + + 0 + GTK_SHADOW_ETCHED_IN 0 True True - - 0 - GTK_SHADOW_ETCHED_IN GtkAlignment @@ -2162,18 +2169,18 @@ GtkHButtonBox GnomeDialog:action_area hbuttonbox1 - - 0 - False - True - GTK_PACK_END - GTK_BUTTONBOX_END 8 85 27 7 0 + + 0 + False + True + GTK_PACK_END + GtkButton diff --git a/addressbook/gui/minicard/e-minicard-label.c b/addressbook/gui/minicard/e-minicard-label.c index 7e32acad59..0c4078f69f 100644 --- a/addressbook/gui/minicard/e-minicard-label.c +++ b/addressbook/gui/minicard/e-minicard-label.c @@ -188,26 +188,22 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_BOOL (*arg) = e_minicard_label->has_focus; break; case ARG_FIELD: - if ( e_minicard_label->field ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); - break; + if ( e_minicard_label->field ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); + break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); - break; + if ( e_minicard_label->fieldname ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); + break; default: - arg->type = GTK_TYPE_INVALID; - break; + arg->type = GTK_TYPE_INVALID; + break; } } diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c index f656d98b40..b6de4b2d0c 100644 --- a/addressbook/gui/minicard/e-minicard.c +++ b/addressbook/gui/minicard/e-minicard.c @@ -357,7 +357,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) } break; case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_minicard->fields; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/addressbook/gui/minicard/e-reflow.c b/addressbook/gui/minicard/e-reflow.c index e9ff1b6eaa..41be2ec533 100644 --- a/addressbook/gui/minicard/e-reflow.c +++ b/addressbook/gui/minicard/e-reflow.c @@ -238,7 +238,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) switch( event->type ) { case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_reflow->items; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/addressbook/gui/minicard/test-reflow.c b/addressbook/gui/minicard/test-reflow.c index 067e520754..9efc2722dd 100644 --- a/addressbook/gui/minicard/test-reflow.c +++ b/addressbook/gui/minicard/test-reflow.c @@ -20,6 +20,7 @@ #include "config.h" #include +#include "e-canvas.h" #include "e-reflow.h" #include "e-minicard.h" @@ -99,7 +100,7 @@ int main( int argc, char *argv[] ) vbox = gtk_vbox_new(FALSE, 0); - canvas = gnome_canvas_new(); + canvas = e_canvas_new(); rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), gnome_canvas_rect_get_type(), "x1", (double) 0, @@ -147,6 +148,7 @@ int main( int argc, char *argv[] ) ( gpointer ) app ); gtk_widget_show_all( app ); + gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); gtk_main(); diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c index 7e32acad59..0c4078f69f 100644 --- a/addressbook/gui/widgets/e-minicard-label.c +++ b/addressbook/gui/widgets/e-minicard-label.c @@ -188,26 +188,22 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_BOOL (*arg) = e_minicard_label->has_focus; break; case ARG_FIELD: - if ( e_minicard_label->field ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); - break; + if ( e_minicard_label->field ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); + break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); - break; + if ( e_minicard_label->fieldname ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); + break; default: - arg->type = GTK_TYPE_INVALID; - break; + arg->type = GTK_TYPE_INVALID; + break; } } diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index f656d98b40..b6de4b2d0c 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -357,7 +357,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) } break; case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_minicard->fields; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c index 067e520754..9efc2722dd 100644 --- a/addressbook/gui/widgets/test-reflow.c +++ b/addressbook/gui/widgets/test-reflow.c @@ -20,6 +20,7 @@ #include "config.h" #include +#include "e-canvas.h" #include "e-reflow.h" #include "e-minicard.h" @@ -99,7 +100,7 @@ int main( int argc, char *argv[] ) vbox = gtk_vbox_new(FALSE, 0); - canvas = gnome_canvas_new(); + canvas = e_canvas_new(); rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), gnome_canvas_rect_get_type(), "x1", (double) 0, @@ -147,6 +148,7 @@ int main( int argc, char *argv[] ) ( gpointer ) app ); gtk_widget_show_all( app ); + gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); gtk_main(); diff --git a/e-util/e-canvas.c b/e-util/e-canvas.c new file mode 100644 index 0000000000..74af105b36 --- /dev/null +++ b/e-util/e-canvas.c @@ -0,0 +1,233 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-canvas.c + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "e-canvas.h" +static void e_canvas_init (ECanvas *card); +static void e_canvas_class_init (ECanvasClass *klass); +static gint e_canvas_key (GtkWidget *widget, + GdkEventKey *event); + +static int emit_event (GnomeCanvas *canvas, GdkEvent *event); + +static GnomeCanvasClass *parent_class = NULL; + +GtkType +e_canvas_get_type (void) +{ + static GtkType canvas_type = 0; + + if (!canvas_type) + { + static const GtkTypeInfo canvas_info = + { + "ECanvas", + sizeof (ECanvas), + sizeof (ECanvasClass), + (GtkClassInitFunc) e_canvas_class_init, + (GtkObjectInitFunc) e_canvas_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + canvas_type = gtk_type_unique (gnome_canvas_get_type (), &canvas_info); + } + + return canvas_type; +} + +static void +e_canvas_class_init (ECanvasClass *klass) +{ + GtkObjectClass *object_class; + GnomeCanvasClass *canvas_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass*) klass; + canvas_class = (GnomeCanvasClass *) klass; + widget_class = (GtkWidgetClass *) klass; + + parent_class = gtk_type_class (gnome_canvas_get_type ()); + + widget_class->key_press_event = e_canvas_key; + widget_class->key_release_event = e_canvas_key; +} + +static void +e_canvas_init (ECanvas *canvas) +{ +} + +GtkWidget * +e_canvas_new() +{ + return GTK_WIDGET (gtk_type_new (e_canvas_get_type ())); +} + + +/* Returns whether the item is an inferior of or is equal to the parent. */ +static int +is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) +{ + for (; item; item = item->parent) + if (item == parent) + return TRUE; + + return FALSE; +} + +/* Emits an event for an item in the canvas, be it the current item, grabbed + * item, or focused item, as appropriate. + */ +static int +emit_event (GnomeCanvas *canvas, GdkEvent *event) +{ + GdkEvent ev; + gint finished; + GnomeCanvasItem *item; + GnomeCanvasItem *parent; + guint mask; + + /* Perform checks for grabbed items */ + + if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item)) + return FALSE; + + if (canvas->grabbed_item) { + switch (event->type) { + case GDK_ENTER_NOTIFY: + mask = GDK_ENTER_NOTIFY_MASK; + break; + + case GDK_LEAVE_NOTIFY: + mask = GDK_LEAVE_NOTIFY_MASK; + break; + + case GDK_MOTION_NOTIFY: + mask = GDK_POINTER_MOTION_MASK; + break; + + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + mask = GDK_BUTTON_PRESS_MASK; + break; + + case GDK_BUTTON_RELEASE: + mask = GDK_BUTTON_RELEASE_MASK; + break; + + case GDK_KEY_PRESS: + mask = GDK_KEY_PRESS_MASK; + break; + + case GDK_KEY_RELEASE: + mask = GDK_KEY_RELEASE_MASK; + break; + + default: + mask = 0; + break; + } + + if (!(mask & canvas->grabbed_event_mask)) + return FALSE; + } + + /* Convert to world coordinates -- we have two cases because of diferent + * offsets of the fields in the event structures. + */ + + ev = *event; + + switch (ev.type) { + case GDK_ENTER_NOTIFY: + case GDK_LEAVE_NOTIFY: + gnome_canvas_window_to_world (canvas, + ev.crossing.x, ev.crossing.y, + &ev.crossing.x, &ev.crossing.y); + break; + + case GDK_MOTION_NOTIFY: + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + gnome_canvas_window_to_world (canvas, + ev.motion.x, ev.motion.y, + &ev.motion.x, &ev.motion.y); + break; + + default: + break; + } + + /* Choose where we send the event */ + + item = canvas->current_item; + + if (canvas->focused_item + && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) + item = canvas->focused_item; + + /* The event is propagated up the hierarchy (for if someone connected to + * a group instead of a leaf event), and emission is stopped if a + * handler returns TRUE, just like for GtkWidget events. + */ + + finished = FALSE; + + while (item && !finished) { + gtk_object_ref (GTK_OBJECT (item)); + + gtk_signal_emit_by_name (GTK_OBJECT (item), "event", + &ev, + &finished); + + if (GTK_OBJECT_DESTROYED (item)) + finished = TRUE; + + parent = item->parent; + gtk_object_unref (GTK_OBJECT (item)); + + item = parent; + } + + return finished; +} + +/* Key event handler for the canvas */ +static gint +e_canvas_key (GtkWidget *widget, GdkEventKey *event) +{ + GnomeCanvas *canvas; + + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + canvas = GNOME_CANVAS (widget); + + return emit_event (canvas, (GdkEvent *) event); +} + diff --git a/e-util/e-canvas.h b/e-util/e-canvas.h new file mode 100644 index 0000000000..06c3625f3a --- /dev/null +++ b/e-util/e-canvas.h @@ -0,0 +1,66 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* e-canvas.h + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __E_CANVAS_H__ +#define __E_CANVAS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +/* ECanvas - A class derived from canvas for the purpose of adding + * evolution specific canvas hacks. + */ + +#define E_CANVAS_TYPE (e_canvas_get_type ()) +#define E_CANVAS(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_TYPE, ECanvas)) +#define E_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass)) +#define E_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_TYPE)) +#define E_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE)) + + +typedef struct _ECanvas ECanvas; +typedef struct _ECanvasClass ECanvasClass; + +struct _ECanvas +{ + GnomeCanvas parent; + + /* item specific fields */ +}; + +struct _ECanvasClass +{ + GnomeCanvasClass parent_class; +}; + + +GtkType e_canvas_get_type (void); +GtkWidget *e_canvas_new (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __E_CANVAS_H__ */ diff --git a/widgets/Makefile.am b/widgets/Makefile.am index 1e2016ef3c..e2659cac03 100644 --- a/widgets/Makefile.am +++ b/widgets/Makefile.am @@ -11,6 +11,8 @@ noinst_LIBRARIES = \ libevolutionwidgets.a libevolutionwidgets_a_SOURCES = \ + e-canvas.c \ + e-canvas.h \ e-canvas-utils.c \ e-canvas-utils.h \ e-cursors.c \ diff --git a/widgets/e-canvas.c b/widgets/e-canvas.c new file mode 100644 index 0000000000..74af105b36 --- /dev/null +++ b/widgets/e-canvas.c @@ -0,0 +1,233 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-canvas.c + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "e-canvas.h" +static void e_canvas_init (ECanvas *card); +static void e_canvas_class_init (ECanvasClass *klass); +static gint e_canvas_key (GtkWidget *widget, + GdkEventKey *event); + +static int emit_event (GnomeCanvas *canvas, GdkEvent *event); + +static GnomeCanvasClass *parent_class = NULL; + +GtkType +e_canvas_get_type (void) +{ + static GtkType canvas_type = 0; + + if (!canvas_type) + { + static const GtkTypeInfo canvas_info = + { + "ECanvas", + sizeof (ECanvas), + sizeof (ECanvasClass), + (GtkClassInitFunc) e_canvas_class_init, + (GtkObjectInitFunc) e_canvas_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + canvas_type = gtk_type_unique (gnome_canvas_get_type (), &canvas_info); + } + + return canvas_type; +} + +static void +e_canvas_class_init (ECanvasClass *klass) +{ + GtkObjectClass *object_class; + GnomeCanvasClass *canvas_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass*) klass; + canvas_class = (GnomeCanvasClass *) klass; + widget_class = (GtkWidgetClass *) klass; + + parent_class = gtk_type_class (gnome_canvas_get_type ()); + + widget_class->key_press_event = e_canvas_key; + widget_class->key_release_event = e_canvas_key; +} + +static void +e_canvas_init (ECanvas *canvas) +{ +} + +GtkWidget * +e_canvas_new() +{ + return GTK_WIDGET (gtk_type_new (e_canvas_get_type ())); +} + + +/* Returns whether the item is an inferior of or is equal to the parent. */ +static int +is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) +{ + for (; item; item = item->parent) + if (item == parent) + return TRUE; + + return FALSE; +} + +/* Emits an event for an item in the canvas, be it the current item, grabbed + * item, or focused item, as appropriate. + */ +static int +emit_event (GnomeCanvas *canvas, GdkEvent *event) +{ + GdkEvent ev; + gint finished; + GnomeCanvasItem *item; + GnomeCanvasItem *parent; + guint mask; + + /* Perform checks for grabbed items */ + + if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item)) + return FALSE; + + if (canvas->grabbed_item) { + switch (event->type) { + case GDK_ENTER_NOTIFY: + mask = GDK_ENTER_NOTIFY_MASK; + break; + + case GDK_LEAVE_NOTIFY: + mask = GDK_LEAVE_NOTIFY_MASK; + break; + + case GDK_MOTION_NOTIFY: + mask = GDK_POINTER_MOTION_MASK; + break; + + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + mask = GDK_BUTTON_PRESS_MASK; + break; + + case GDK_BUTTON_RELEASE: + mask = GDK_BUTTON_RELEASE_MASK; + break; + + case GDK_KEY_PRESS: + mask = GDK_KEY_PRESS_MASK; + break; + + case GDK_KEY_RELEASE: + mask = GDK_KEY_RELEASE_MASK; + break; + + default: + mask = 0; + break; + } + + if (!(mask & canvas->grabbed_event_mask)) + return FALSE; + } + + /* Convert to world coordinates -- we have two cases because of diferent + * offsets of the fields in the event structures. + */ + + ev = *event; + + switch (ev.type) { + case GDK_ENTER_NOTIFY: + case GDK_LEAVE_NOTIFY: + gnome_canvas_window_to_world (canvas, + ev.crossing.x, ev.crossing.y, + &ev.crossing.x, &ev.crossing.y); + break; + + case GDK_MOTION_NOTIFY: + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + gnome_canvas_window_to_world (canvas, + ev.motion.x, ev.motion.y, + &ev.motion.x, &ev.motion.y); + break; + + default: + break; + } + + /* Choose where we send the event */ + + item = canvas->current_item; + + if (canvas->focused_item + && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) + item = canvas->focused_item; + + /* The event is propagated up the hierarchy (for if someone connected to + * a group instead of a leaf event), and emission is stopped if a + * handler returns TRUE, just like for GtkWidget events. + */ + + finished = FALSE; + + while (item && !finished) { + gtk_object_ref (GTK_OBJECT (item)); + + gtk_signal_emit_by_name (GTK_OBJECT (item), "event", + &ev, + &finished); + + if (GTK_OBJECT_DESTROYED (item)) + finished = TRUE; + + parent = item->parent; + gtk_object_unref (GTK_OBJECT (item)); + + item = parent; + } + + return finished; +} + +/* Key event handler for the canvas */ +static gint +e_canvas_key (GtkWidget *widget, GdkEventKey *event) +{ + GnomeCanvas *canvas; + + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + canvas = GNOME_CANVAS (widget); + + return emit_event (canvas, (GdkEvent *) event); +} + diff --git a/widgets/e-canvas.h b/widgets/e-canvas.h new file mode 100644 index 0000000000..06c3625f3a --- /dev/null +++ b/widgets/e-canvas.h @@ -0,0 +1,66 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* e-canvas.h + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __E_CANVAS_H__ +#define __E_CANVAS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +/* ECanvas - A class derived from canvas for the purpose of adding + * evolution specific canvas hacks. + */ + +#define E_CANVAS_TYPE (e_canvas_get_type ()) +#define E_CANVAS(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_TYPE, ECanvas)) +#define E_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass)) +#define E_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_TYPE)) +#define E_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE)) + + +typedef struct _ECanvas ECanvas; +typedef struct _ECanvasClass ECanvasClass; + +struct _ECanvas +{ + GnomeCanvas parent; + + /* item specific fields */ +}; + +struct _ECanvasClass +{ + GnomeCanvasClass parent_class; +}; + + +GtkType e_canvas_get_type (void); +GtkWidget *e_canvas_new (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __E_CANVAS_H__ */ diff --git a/widgets/e-minicard-label.c b/widgets/e-minicard-label.c index 7e32acad59..0c4078f69f 100644 --- a/widgets/e-minicard-label.c +++ b/widgets/e-minicard-label.c @@ -188,26 +188,22 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_BOOL (*arg) = e_minicard_label->has_focus; break; case ARG_FIELD: - if ( e_minicard_label->field ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); - break; + if ( e_minicard_label->field ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); + break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); - break; + if ( e_minicard_label->fieldname ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); + break; default: - arg->type = GTK_TYPE_INVALID; - break; + arg->type = GTK_TYPE_INVALID; + break; } } diff --git a/widgets/e-minicard.c b/widgets/e-minicard.c index f656d98b40..b6de4b2d0c 100644 --- a/widgets/e-minicard.c +++ b/widgets/e-minicard.c @@ -357,7 +357,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) } break; case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_minicard->fields; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/widgets/e-minicard/e-minicard-label.c b/widgets/e-minicard/e-minicard-label.c index 7e32acad59..0c4078f69f 100644 --- a/widgets/e-minicard/e-minicard-label.c +++ b/widgets/e-minicard/e-minicard-label.c @@ -188,26 +188,22 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_BOOL (*arg) = e_minicard_label->has_focus; break; case ARG_FIELD: - if ( e_minicard_label->field ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); - break; + if ( e_minicard_label->field ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); + break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } - else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); - break; + if ( e_minicard_label->fieldname ) { + gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + } else + GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); + break; default: - arg->type = GTK_TYPE_INVALID; - break; + arg->type = GTK_TYPE_INVALID; + break; } } diff --git a/widgets/e-minicard/e-minicard.c b/widgets/e-minicard/e-minicard.c index f656d98b40..b6de4b2d0c 100644 --- a/widgets/e-minicard/e-minicard.c +++ b/widgets/e-minicard/e-minicard.c @@ -357,7 +357,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) } break; case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_minicard->fields; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/widgets/e-minicard/e-reflow.c b/widgets/e-minicard/e-reflow.c index e9ff1b6eaa..41be2ec533 100644 --- a/widgets/e-minicard/e-reflow.c +++ b/widgets/e-minicard/e-reflow.c @@ -238,7 +238,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) switch( event->type ) { case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_reflow->items; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/widgets/e-minicard/test-reflow.c b/widgets/e-minicard/test-reflow.c index 067e520754..9efc2722dd 100644 --- a/widgets/e-minicard/test-reflow.c +++ b/widgets/e-minicard/test-reflow.c @@ -20,6 +20,7 @@ #include "config.h" #include +#include "e-canvas.h" #include "e-reflow.h" #include "e-minicard.h" @@ -99,7 +100,7 @@ int main( int argc, char *argv[] ) vbox = gtk_vbox_new(FALSE, 0); - canvas = gnome_canvas_new(); + canvas = e_canvas_new(); rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), gnome_canvas_rect_get_type(), "x1", (double) 0, @@ -147,6 +148,7 @@ int main( int argc, char *argv[] ) ( gpointer ) app ); gtk_widget_show_all( app ); + gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); gtk_main(); diff --git a/widgets/e-reflow.c b/widgets/e-reflow.c index e9ff1b6eaa..41be2ec533 100644 --- a/widgets/e-reflow.c +++ b/widgets/e-reflow.c @@ -238,7 +238,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) switch( event->type ) { case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_reflow->items; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/widgets/e-reflow/e-reflow.c b/widgets/e-reflow/e-reflow.c index e9ff1b6eaa..41be2ec533 100644 --- a/widgets/e-reflow/e-reflow.c +++ b/widgets/e-reflow/e-reflow.c @@ -238,7 +238,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) switch( event->type ) { case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_reflow->items; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c new file mode 100644 index 0000000000..74af105b36 --- /dev/null +++ b/widgets/misc/e-canvas.c @@ -0,0 +1,233 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-canvas.c + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "e-canvas.h" +static void e_canvas_init (ECanvas *card); +static void e_canvas_class_init (ECanvasClass *klass); +static gint e_canvas_key (GtkWidget *widget, + GdkEventKey *event); + +static int emit_event (GnomeCanvas *canvas, GdkEvent *event); + +static GnomeCanvasClass *parent_class = NULL; + +GtkType +e_canvas_get_type (void) +{ + static GtkType canvas_type = 0; + + if (!canvas_type) + { + static const GtkTypeInfo canvas_info = + { + "ECanvas", + sizeof (ECanvas), + sizeof (ECanvasClass), + (GtkClassInitFunc) e_canvas_class_init, + (GtkObjectInitFunc) e_canvas_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + canvas_type = gtk_type_unique (gnome_canvas_get_type (), &canvas_info); + } + + return canvas_type; +} + +static void +e_canvas_class_init (ECanvasClass *klass) +{ + GtkObjectClass *object_class; + GnomeCanvasClass *canvas_class; + GtkWidgetClass *widget_class; + + object_class = (GtkObjectClass*) klass; + canvas_class = (GnomeCanvasClass *) klass; + widget_class = (GtkWidgetClass *) klass; + + parent_class = gtk_type_class (gnome_canvas_get_type ()); + + widget_class->key_press_event = e_canvas_key; + widget_class->key_release_event = e_canvas_key; +} + +static void +e_canvas_init (ECanvas *canvas) +{ +} + +GtkWidget * +e_canvas_new() +{ + return GTK_WIDGET (gtk_type_new (e_canvas_get_type ())); +} + + +/* Returns whether the item is an inferior of or is equal to the parent. */ +static int +is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) +{ + for (; item; item = item->parent) + if (item == parent) + return TRUE; + + return FALSE; +} + +/* Emits an event for an item in the canvas, be it the current item, grabbed + * item, or focused item, as appropriate. + */ +static int +emit_event (GnomeCanvas *canvas, GdkEvent *event) +{ + GdkEvent ev; + gint finished; + GnomeCanvasItem *item; + GnomeCanvasItem *parent; + guint mask; + + /* Perform checks for grabbed items */ + + if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item)) + return FALSE; + + if (canvas->grabbed_item) { + switch (event->type) { + case GDK_ENTER_NOTIFY: + mask = GDK_ENTER_NOTIFY_MASK; + break; + + case GDK_LEAVE_NOTIFY: + mask = GDK_LEAVE_NOTIFY_MASK; + break; + + case GDK_MOTION_NOTIFY: + mask = GDK_POINTER_MOTION_MASK; + break; + + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + mask = GDK_BUTTON_PRESS_MASK; + break; + + case GDK_BUTTON_RELEASE: + mask = GDK_BUTTON_RELEASE_MASK; + break; + + case GDK_KEY_PRESS: + mask = GDK_KEY_PRESS_MASK; + break; + + case GDK_KEY_RELEASE: + mask = GDK_KEY_RELEASE_MASK; + break; + + default: + mask = 0; + break; + } + + if (!(mask & canvas->grabbed_event_mask)) + return FALSE; + } + + /* Convert to world coordinates -- we have two cases because of diferent + * offsets of the fields in the event structures. + */ + + ev = *event; + + switch (ev.type) { + case GDK_ENTER_NOTIFY: + case GDK_LEAVE_NOTIFY: + gnome_canvas_window_to_world (canvas, + ev.crossing.x, ev.crossing.y, + &ev.crossing.x, &ev.crossing.y); + break; + + case GDK_MOTION_NOTIFY: + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + gnome_canvas_window_to_world (canvas, + ev.motion.x, ev.motion.y, + &ev.motion.x, &ev.motion.y); + break; + + default: + break; + } + + /* Choose where we send the event */ + + item = canvas->current_item; + + if (canvas->focused_item + && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) + item = canvas->focused_item; + + /* The event is propagated up the hierarchy (for if someone connected to + * a group instead of a leaf event), and emission is stopped if a + * handler returns TRUE, just like for GtkWidget events. + */ + + finished = FALSE; + + while (item && !finished) { + gtk_object_ref (GTK_OBJECT (item)); + + gtk_signal_emit_by_name (GTK_OBJECT (item), "event", + &ev, + &finished); + + if (GTK_OBJECT_DESTROYED (item)) + finished = TRUE; + + parent = item->parent; + gtk_object_unref (GTK_OBJECT (item)); + + item = parent; + } + + return finished; +} + +/* Key event handler for the canvas */ +static gint +e_canvas_key (GtkWidget *widget, GdkEventKey *event) +{ + GnomeCanvas *canvas; + + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + + canvas = GNOME_CANVAS (widget); + + return emit_event (canvas, (GdkEvent *) event); +} + diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h new file mode 100644 index 0000000000..06c3625f3a --- /dev/null +++ b/widgets/misc/e-canvas.h @@ -0,0 +1,66 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* e-canvas.h + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#ifndef __E_CANVAS_H__ +#define __E_CANVAS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +/* ECanvas - A class derived from canvas for the purpose of adding + * evolution specific canvas hacks. + */ + +#define E_CANVAS_TYPE (e_canvas_get_type ()) +#define E_CANVAS(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_TYPE, ECanvas)) +#define E_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass)) +#define E_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_TYPE)) +#define E_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE)) + + +typedef struct _ECanvas ECanvas; +typedef struct _ECanvasClass ECanvasClass; + +struct _ECanvas +{ + GnomeCanvas parent; + + /* item specific fields */ +}; + +struct _ECanvasClass +{ + GnomeCanvasClass parent_class; +}; + + +GtkType e_canvas_get_type (void); +GtkWidget *e_canvas_new (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __E_CANVAS_H__ */ diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c index e9ff1b6eaa..41be2ec533 100644 --- a/widgets/misc/e-reflow.c +++ b/widgets/misc/e-reflow.c @@ -238,7 +238,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) switch( event->type ) { case GDK_KEY_PRESS: - if (event->key.length == 1 && event->key.string[0] == '\t') { + if (event->key.keyval == GDK_Tab || + event->key.keyval == GDK_KP_Tab || + event->key.keyval == GDK_ISO_Left_Tab) { GList *list; for (list = e_reflow->items; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); diff --git a/widgets/test-reflow.c b/widgets/test-reflow.c index 067e520754..9efc2722dd 100644 --- a/widgets/test-reflow.c +++ b/widgets/test-reflow.c @@ -20,6 +20,7 @@ #include "config.h" #include +#include "e-canvas.h" #include "e-reflow.h" #include "e-minicard.h" @@ -99,7 +100,7 @@ int main( int argc, char *argv[] ) vbox = gtk_vbox_new(FALSE, 0); - canvas = gnome_canvas_new(); + canvas = e_canvas_new(); rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), gnome_canvas_rect_get_type(), "x1", (double) 0, @@ -147,6 +148,7 @@ int main( int argc, char *argv[] ) ( gpointer ) app ); gtk_widget_show_all( app ); + gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); gtk_main(); -- cgit v1.2.3