diff options
author | nobody <nobody@localhost> | 2001-04-16 17:30:54 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2001-04-16 17:30:54 +0800 |
commit | f9ea6ed16a12b9a280737789980b55f87205d05f (patch) | |
tree | aaa46c1cf6c9a87e8f291ef7673bd9463803e8c9 /notes | |
parent | 75a16468d369f58587f27ab4655fbe1c1091fc95 (diff) | |
download | gsoc2013-evolution-GNOME-VFS_1_0_1.tar gsoc2013-evolution-GNOME-VFS_1_0_1.tar.gz gsoc2013-evolution-GNOME-VFS_1_0_1.tar.bz2 gsoc2013-evolution-GNOME-VFS_1_0_1.tar.lz gsoc2013-evolution-GNOME-VFS_1_0_1.tar.xz gsoc2013-evolution-GNOME-VFS_1_0_1.tar.zst gsoc2013-evolution-GNOME-VFS_1_0_1.zip |
This commit was manufactured by cvs2svn to create tagGNOME-VFS_1_0_1
'GNOME-VFS_1_0_1'.
svn path=/tags/GNOME-VFS_1_0_1/; revision=9347
Diffstat (limited to 'notes')
-rw-r--r-- | notes/.cvsignore | 4 | ||||
-rw-r--r-- | notes/GNOME_Evolution_Notes.oaf.in | 54 | ||||
-rw-r--r-- | notes/Makefile.am | 35 | ||||
-rw-r--r-- | notes/component-factory.c | 155 | ||||
-rw-r--r-- | notes/component-factory.h | 7 | ||||
-rw-r--r-- | notes/e-bevel-button-util.c | 189 | ||||
-rw-r--r-- | notes/e-bevel-button-util.h | 12 | ||||
-rw-r--r-- | notes/e-bevel-button.c | 175 | ||||
-rw-r--r-- | notes/e-bevel-button.h | 37 | ||||
-rw-r--r-- | notes/e-note.c | 382 | ||||
-rw-r--r-- | notes/e-note.h | 37 | ||||
-rw-r--r-- | notes/main.c | 52 | ||||
-rw-r--r-- | notes/test-notes.c | 34 |
13 files changed, 0 insertions, 1173 deletions
diff --git a/notes/.cvsignore b/notes/.cvsignore deleted file mode 100644 index 02b0523973..0000000000 --- a/notes/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -.deps -.libs diff --git a/notes/GNOME_Evolution_Notes.oaf.in b/notes/GNOME_Evolution_Notes.oaf.in deleted file mode 100644 index d65cb45412..0000000000 --- a/notes/GNOME_Evolution_Notes.oaf.in +++ /dev/null @@ -1,54 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Notes_controlFactory" - type="exe" - location="evolution-notes"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the Notes control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Notes_control" - type="factory" - location="OAFIID:GNOME_Evolution_Notes_controlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="A sample Bonobo control which displays an addressbook."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Notes_shellComponentFactory" - type="exe" - location="evolution-notes"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the Evolution notes component."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Notes_shellComponent" - type="factory" - location="OAFIID:GNOME_Evolution_Notes_shellComponentFactory"> - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution component for handling mail."/> - -</oaf_server> - -</oaf_info> diff --git a/notes/Makefile.am b/notes/Makefile.am deleted file mode 100644 index 42b06c241a..0000000000 --- a/notes/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -noinst_PROGRAMS = notes-test - -INCLUDES = \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/shell \ - -I$(top_srcdir)/widgets/e-text \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - $(EXTRA_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DG_LOG_DOMAIN=\"evolution-notes\" - -notes_test_SOURCES = \ - e-bevel-button.c \ - e-bevel-button.h \ - e-bevel-button-util.c \ - e-bevel-button-util.h \ - e-note.c \ - e-note.h \ - test-notes.c - -oafdir = $(datadir)/oaf -oaf_in_files = GNOME_Evolution_Notes.oaf.in -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -@XML_I18N_MERGE_OAF_RULE@ - -notes_test_LDADD = \ - $(BONOBO_HTML_GNOME_LIBS) \ - $(EXTRA_GNOME_LIBS) - -EXTRA_DIST= $(oaf_in_files) $(oaf_DATA) diff --git a/notes/component-factory.c b/notes/component-factory.c deleted file mode 100644 index 48b81f4071..0000000000 --- a/notes/component-factory.c +++ /dev/null @@ -1,155 +0,0 @@ -#include <config.h> - -#include <gnome.h> -#include <bonobo.h> - -#include "Evolution.h" -#include "evolution-storage.h" - -#include "evolution-shell-component.h" - -#include "e-util/e-gui-utils.h" - -#define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Notes_shellComponentFactory" - -static const EvolutionShellComponentFolderType folder_types[] = { - { "notes", "evolution-notes.png" }, - { NULL, NULL } -}; - -static void -new_note_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - g_print ("new note!\n"); -} - -static GnomeUIInfo gnome_toolbar [] = { - GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new note"), new_note_cb, GNOME_STOCK_PIXMAP_NEW), - GNOMEUIINFO_END -}; - -#ifdef THIS_NEEDS_UPDATING_FOR_NEW_BONOBOS - -static void -control_deactivate (BonoboControl *control, BonoboUIComponent *uih) -{ - bonobo_ui_handler_dock_remove (uih, "/Toolbar"); -} - -static void -control_activate (BonoboControl *control, BonoboUIComponent *uih) -{ - Bonobo_UIContainer remote_uih; - GtkWidget *toolbar, *toolbar_frame; - BonoboControl *toolbar_control ; - - remote_uih = bonobo_control_get_remote_ui_handler (control); - bonobo_ui_handler_set_container (uih, remote_uih); - bonobo_object_release_unref (remote_uih, NULL); - - toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, - GTK_TOOLBAR_BOTH); - - gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), - gnome_toolbar, - NULL, NULL); - - toolbar_frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (toolbar_frame), GTK_SHADOW_OUT); - gtk_container_add (GTK_CONTAINER (toolbar_frame), toolbar); - gtk_widget_show (toolbar_frame); - - gtk_widget_show_all (toolbar_frame); - - toolbar_control = bonobo_control_new (toolbar_frame); - bonobo_ui_handler_dock_add ( - uih, "/Toolbar", - bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)), - GNOME_DOCK_ITEM_BEH_EXCLUSIVE, - GNOME_DOCK_TOP, - 1, 1, 0); -} - - -static void -control_activate_cb (BonoboControl *control, - gboolean activate) -{ - BonoboUIComponent *uih; - - uih = bonobo_control_get_ui_handler (control); - g_assert (uih); - - if (activate) - control_activate (control, uih); - else - control_deactivate (control, uih); -} -#endif - -static BonoboControl * -create_view (EvolutionShellComponent *shell_component, - const char *physical_uri, - void *closure) -{ - BonoboControl * control; - - control = notes_factory_new_control (); - -#ifdef THIS_CODE_IS_TOTALY_DEAD - gtk_signal_connect (GTK_OBJECT (control), "activate", - control_activate_cb, NULL); -#endif - - - return control; -} - -static void -owner_set_cb (EvolutionShellComponent *shell_component, - EvolutionShellClient shell_client, - gpointer user_data) -{ - g_print ("evolution-notes: Yeeeh! We have an owner!\n"); /* FIXME */ -} - -static void -owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) -{ - g_print ("No owner anymore\n"); -} - -/* The factory function */ -static BonoboObject * -notes_component_factory (BonoboGenericFactory *factory, - void *closure) -{ - EvolutionShellComponent *shell_component; - - shell_component = evolution_shell_component_new (folder_types, create_view, NULL); - - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", - GTK_SIGNAL_FUNC (owner_set_cb), NULL); - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", - GTK_SIGNAL_FUNC (owner_unset_cb), NULL); - - return BONOBO_OBJECT (shell_component); -} - - -void -component_factory_init (void) -{ - static BonoboGenericFactory *factory = NULL; - - if (factory != NULL) - return; - - factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, notes_component_factory, NULL); - - if (factory == NULL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Cannot initialize Evolution's notes component.")); - exit (1); - } -} diff --git a/notes/component-factory.h b/notes/component-factory.h deleted file mode 100644 index 9535ccc4ae..0000000000 --- a/notes/component-factory.h +++ /dev/null @@ -1,7 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -#ifndef COMPONENT_FACTORY_H -#define COMPONENT_FACTORY_H - -void component_factory_init (void); - -#endif diff --git a/notes/e-bevel-button-util.c b/notes/e-bevel-button-util.c deleted file mode 100644 index cfa01f71a2..0000000000 --- a/notes/e-bevel-button-util.c +++ /dev/null @@ -1,189 +0,0 @@ -#include <gtk/gtk.h> -#include "e-bevel-button-util.h" - -static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b); -static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s); - -void -e_bevel_button_util_shade (GdkColor *a, - GdkColor *b, - gdouble k) -{ - gdouble red; - gdouble green; - gdouble blue; - - red = (gdouble) a->red / 65535.0; - green = (gdouble) a->green / 65535.0; - blue = (gdouble) a->blue / 65535.0; - - rgb_to_hls (&red, &green, &blue); - - green *= k; - if (green > 1.0) - green = 1.0; - else if (green < 0.0) - green = 0.0; - - blue *= k; - if (blue > 1.0) - blue = 1.0; - else if (blue < 0.0) - blue = 0.0; - - hls_to_rgb (&red, &green, &blue); - - b->red = red * 65535.0; - b->green = green * 65535.0; - b->blue = blue * 65535.0; -} - -static void -rgb_to_hls (gdouble *r, - gdouble *g, - gdouble *b) -{ - gdouble min; - gdouble max; - gdouble red; - gdouble green; - gdouble blue; - gdouble h, l, s; - gdouble delta; - - red = *r; - green = *g; - blue = *b; - - if (red > green) - { - if (red > blue) - max = red; - else - max = blue; - - if (green < blue) - min = green; - else - min = blue; - } - else - { - if (green > blue) - max = green; - else - max = blue; - - if (red < blue) - min = red; - else - min = blue; - } - - l = (max + min) / 2; - s = 0; - h = 0; - - if (max != min) - { - if (l <= 0.5) - s = (max - min) / (max + min); - else - s = (max - min) / (2 - max - min); - - delta = max -min; - if (red == max) - h = (green - blue) / delta; - else if (green == max) - h = 2 + (blue - red) / delta; - else if (blue == max) - h = 4 + (red - green) / delta; - - h *= 60; - if (h < 0.0) - h += 360; - } - - *r = h; - *g = l; - *b = s; -} - -static void -hls_to_rgb (gdouble *h, - gdouble *l, - gdouble *s) -{ - gdouble hue; - gdouble lightness; - gdouble saturation; - gdouble m1, m2; - gdouble r, g, b; - - lightness = *l; - saturation = *s; - - if (lightness <= 0.5) - m2 = lightness * (1 + saturation); - else - m2 = lightness + saturation - lightness * saturation; - m1 = 2 * lightness - m2; - - if (saturation == 0) - { - *h = lightness; - *l = lightness; - *s = lightness; - } - else - { - hue = *h + 120; - while (hue > 360) - hue -= 360; - while (hue < 0) - hue += 360; - - if (hue < 60) - r = m1 + (m2 - m1) * hue / 60; - else if (hue < 180) - r = m2; - else if (hue < 240) - r = m1 + (m2 - m1) * (240 - hue) / 60; - else - r = m1; - - hue = *h; - while (hue > 360) - hue -= 360; - while (hue < 0) - hue += 360; - - if (hue < 60) - g = m1 + (m2 - m1) * hue / 60; - else if (hue < 180) - g = m2; - else if (hue < 240) - g = m1 + (m2 - m1) * (240 - hue) / 60; - else - g = m1; - - hue = *h - 120; - while (hue > 360) - hue -= 360; - while (hue < 0) - hue += 360; - - if (hue < 60) - b = m1 + (m2 - m1) * hue / 60; - else if (hue < 180) - b = m2; - else if (hue < 240) - b = m1 + (m2 - m1) * (240 - hue) / 60; - else - b = m1; - - *h = r; - *l = g; - *s = b; - } -} diff --git a/notes/e-bevel-button-util.h b/notes/e-bevel-button-util.h deleted file mode 100644 index 759a9025cc..0000000000 --- a/notes/e-bevel-button-util.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __E_BEVEL_BUTTON_UTIL_H__ -#define __E_BEVEL_BUTTON_UTIL_H__ - -#define LIGHTNESS_MULT 1.3 -#define DARKNESS_MULT 0.7 - -void -e_bevel_button_util_shade (GdkColor *a, - GdkColor *b, - gdouble k); - -#endif /* __E_BEVEL_BUTTON_UTIL_H__ */ diff --git a/notes/e-bevel-button.c b/notes/e-bevel-button.c deleted file mode 100644 index 1d96d88531..0000000000 --- a/notes/e-bevel-button.c +++ /dev/null @@ -1,175 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -#include <config.h> -#include <gtk/gtkbutton.h> - -#include <gal/util/e-util.h> - -#include "e-bevel-button.h" -#include "e-bevel-button-util.h" - -#define PARENT_TYPE GTK_TYPE_BUTTON - -static GtkButtonClass *parent_class = NULL; - -struct _EBevelButtonPrivate { - GdkColor base_color; - GdkColor dark_color; - GdkColor light_color; - GdkGC *gc; -}; - -static void -e_bevel_button_paint (GtkWidget *widget, GdkRectangle *area) -{ - EBevelButton *button; - - button = E_BEVEL_BUTTON (widget); - - if (GTK_WIDGET_DRAWABLE (widget)) { - gdk_window_set_back_pixmap (widget->window, NULL, TRUE); - gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height); - - gdk_gc_set_foreground (button->priv->gc, &button->priv->base_color); - gdk_draw_rectangle (widget->window, - button->priv->gc, - TRUE, - 0, 0, - widget->allocation.width, widget->allocation.height); - - if (GTK_BUTTON (button)->in_button) { - gdk_gc_set_foreground (button->priv->gc, - GTK_BUTTON (button)->button_down ? - &button->priv->dark_color : - &button->priv->light_color); - gdk_draw_line (widget->window, button->priv->gc, - 0, 0, 0, widget->allocation.height - 2); - gdk_draw_line (widget->window, button->priv->gc, - 0, 0, widget->allocation.width - 2, 0); - - gdk_gc_set_foreground (button->priv->gc, - GTK_BUTTON (button)->button_down ? - &button->priv->light_color : - &button->priv->dark_color); - gdk_draw_line (widget->window, button->priv->gc, - widget->allocation.width - 1 , 1, - widget->allocation.width - 1, widget->allocation.height - 1); - gdk_draw_line (widget->window, button->priv->gc, - 1, widget->allocation.height - 1, - widget->allocation.width - 1, widget->allocation.height - 1); - } - } -} - -static gint -e_bevel_button_expose (GtkWidget *widget, GdkEventExpose *event) -{ - GtkBin *bin; - GdkEventExpose child_event; - - if (GTK_WIDGET_DRAWABLE (widget)) { - bin = GTK_BIN (widget); - - e_bevel_button_paint (widget, &event->area); - - child_event = *event; - if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) && - gtk_widget_intersect (bin->child, &event->area, &child_event.area)) - gtk_widget_event (bin->child, (GdkEvent*) &child_event); - } - - return FALSE; -} - -static void -e_bevel_button_draw (GtkWidget *widget, GdkRectangle *area) -{ - GdkRectangle child_area; - GdkRectangle tmp_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_BEVEL_BUTTON (widget)); - g_return_if_fail (area != NULL); - - if (GTK_WIDGET_DRAWABLE (widget)) { - tmp_area = *area; - tmp_area.x -= GTK_CONTAINER (widget)->border_width; - tmp_area.y -= GTK_CONTAINER (widget)->border_width; - - e_bevel_button_paint (widget, &tmp_area); - - if (GTK_BIN (widget)->child && gtk_widget_intersect (GTK_BIN (widget)->child, &tmp_area, &child_area)) - gtk_widget_draw (GTK_BIN (widget)->child, &child_area); - } -} - -static void -e_bevel_button_realize (GtkWidget *widget) -{ - EBevelButton *button = E_BEVEL_BUTTON (widget); - - GTK_WIDGET_CLASS (parent_class)->realize (widget); - - button->priv->gc = gdk_gc_new (widget->window); - - gdk_color_parse ("#d0d888", &button->priv->base_color); - e_bevel_button_util_shade (&button->priv->base_color, - &button->priv->light_color, - LIGHTNESS_MULT); - e_bevel_button_util_shade (&button->priv->base_color, - &button->priv->dark_color, - DARKNESS_MULT); - gdk_colormap_alloc_color (gdk_rgb_get_cmap (), &button->priv->base_color, FALSE, TRUE); - gdk_colormap_alloc_color (gdk_rgb_get_cmap (), &button->priv->light_color, FALSE, TRUE); - gdk_colormap_alloc_color (gdk_rgb_get_cmap (), &button->priv->dark_color, FALSE, TRUE); -} - -static void -e_bevel_button_class_init (EBevelButtonClass *klass) -{ - GtkWidgetClass *widget_class; - - widget_class = (GtkWidgetClass *)klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - widget_class->draw = e_bevel_button_draw; - widget_class->expose_event = e_bevel_button_expose; - widget_class->realize = e_bevel_button_realize; -} - -static void -e_bevel_button_init (EBevelButton *button) -{ - EBevelButtonPrivate *priv; - - GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS); - - priv = g_new (EBevelButtonPrivate, 1); - - button->priv = priv; -} - -GtkWidget * -e_bevel_button_new (void) -{ - EBevelButton *button; - - button = gtk_type_new (E_TYPE_BEVEL_BUTTON); - - return GTK_WIDGET (button); -} - -E_MAKE_TYPE (e_bevel_button, "EBevelButton", EBevelButton, e_bevel_button_class_init, e_bevel_button_init, PARENT_TYPE); - - - - - - - - - - - - diff --git a/notes/e-bevel-button.h b/notes/e-bevel-button.h deleted file mode 100644 index 333c317b43..0000000000 --- a/notes/e-bevel-button.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -#ifndef __E_BEVEL_BUTTON_H__ -#define __E_BEVEL_BUTTON_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkbutton.h> - -#define E_TYPE_BEVEL_BUTTON (e_bevel_button_get_type ()) -#define E_BEVEL_BUTTON(obj) (GTK_CHECK_CAST ((obj), E_TYPE_BEVEL_BUTTON, EBevelButton)) -#define E_BEVEL_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_BEVEL_BUTTON, EBevelButtonClass)) -#define E_IS_BEVEL_BUTTON(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_BEVEL_BUTTON)) -#define E_IS_BEVEL_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_BEVEL_BUTTON)) - -typedef struct _EBevelButton EBevelButton; -typedef struct _EBevelButtonPrivate EBevelButtonPrivate; -typedef struct _EBevelButtonClass EBevelButtonClass; - -struct _EBevelButton { - GtkButton parent; - - EBevelButtonPrivate *priv; -}; - -struct _EBevelButtonClass { - GtkButtonClass parent_class; -}; - -GtkType e_bevel_button_get_type (void); - -GtkWidget *e_bevel_button_new (void); -void e_bevel_button_set_base_color (EBevelButton *button, GdkColor *color); - -#endif /* __E_BEVEL_BUTTON_H__ */ - diff --git a/notes/e-note.c b/notes/e-note.c deleted file mode 100644 index 642fd1178a..0000000000 --- a/notes/e-note.c +++ /dev/null @@ -1,382 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -#include <config.h> -#include <gnome.h> -#include <gdk/gdkx.h> - -#include <gal/widgets/e-canvas.h> -#include <gal/widgets/e-canvas-utils.h> -#include <gal/util/e-util.h> -#include <gal/e-text/e-text.h> - -#include "e-note.h" -#include "e-bevel-button.h" -#include "e-bevel-button-util.h" - -#define PARENT_TYPE GTK_TYPE_WINDOW - -enum { - E_NOTE_TEXT_CHANGED, - E_NOTE_LAST_SIGNAL -}; - -static guint e_note_signals [E_NOTE_LAST_SIGNAL] = { 0 }; - -static GtkWindowClass *parent_class = NULL; - -struct _ENotePrivate { - GtkWidget *canvas; - - GnomeCanvasItem *frame; - GnomeCanvasItem *rect; - - GnomeCanvasItem *text_item; - - GnomeCanvasItem *move_button; - GnomeCanvasItem *close_button; - GnomeCanvasItem *resize_button; - - /* Used for moving and resizing */ - gint press_x, press_y; - gint resize_width, resize_height; - gboolean in_drag; -}; - -static void -e_note_text_changed (ETextModel *model, gpointer data) -{ - gtk_signal_emit (GTK_OBJECT (data), - e_note_signals [E_NOTE_TEXT_CHANGED]); -} - -static gint -e_note_resize_button_changed (GtkWidget *widget, GdkEventButton *event, gpointer data) -{ - ENote *note = E_NOTE (data); - - if (event->type == GDK_BUTTON_PRESS) { - note->priv->press_x = event->x_root; - note->priv->press_y = event->y_root; - - gdk_window_get_geometry (GTK_WIDGET (note)->window, NULL, NULL, - ¬e->priv->resize_width, ¬e->priv->resize_height, NULL); - - gdk_pointer_grab (widget->window, - FALSE, - (GDK_BUTTON1_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_RELEASE_MASK), - NULL, - NULL, - GDK_CURRENT_TIME); - note->priv->in_drag = TRUE; - - } - else { - if (note->priv->in_drag) { - if (event->window != widget->window) - return FALSE; - - gdk_pointer_ungrab (GDK_CURRENT_TIME); - note->priv->in_drag = FALSE; - } - } - - return TRUE; -} - -static gint -e_note_resize_motion_event (GtkWidget *widget, GdkEventMotion *event, gpointer data) -{ - GtkWidget *window = GTK_WIDGET (data); - ENote *note = E_NOTE (data); - gint new_x, new_y; - gint width, height; - - if (note->priv->in_drag) { - gdk_window_get_pointer (GDK_ROOT_PARENT (), &new_x, &new_y, NULL); - - width = note->priv->resize_width + new_x - note->priv->press_x; - if (width < 60) - width = 60; - - height = note->priv->resize_height + new_y - note->priv->press_y; - if (height < 60) - height = 60; - - gdk_window_resize (window->window, width, height); - - return TRUE; - } - - return FALSE; -} - -static gint -e_note_move_button_changed (GtkWidget *widget, GdkEventButton *event, gpointer data) -{ - ENote *note = E_NOTE (data); - - if (event->button != 1) - return FALSE; - - if (event->type == GDK_BUTTON_PRESS) { - gint root_x, root_y; - - gdk_window_get_origin (widget->window, &root_x, &root_y); - note->priv->press_x = root_x - event->x_root; - note->priv->press_y = root_y - event->y_root; - - gdk_pointer_grab (widget->window, - FALSE, - (GDK_BUTTON1_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_RELEASE_MASK), - NULL, - NULL, - GDK_CURRENT_TIME); - - note->priv->in_drag = TRUE; - } - else { - if (note->priv->in_drag) { - if (event->window != widget->window) - return FALSE; - - gdk_pointer_ungrab (GDK_CURRENT_TIME); - note->priv->in_drag = FALSE; - } - } - - return TRUE; -} - -static gint -e_note_move_motion_event (GtkWidget *widget, GdkEventMotion *event, gpointer data) -{ - gint new_x, new_y; - ENote *note = E_NOTE (data); - GtkWidget *window = GTK_WIDGET (data); - - if (note->priv->in_drag) { - gdk_window_get_pointer (GDK_ROOT_PARENT (), &new_x, &new_y, NULL); - - new_x += note->priv->press_x; - new_y += note->priv->press_y; - - gdk_window_move (window->window, new_x, new_y); - } - - return TRUE; -} - -static void -e_note_canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer data) -{ - ENote *note; - gdouble height; - - note = E_NOTE (data); - - gnome_canvas_item_set (note->priv->text_item, - "width", (gdouble) allocation->width - 10, - NULL); - gtk_object_get (GTK_OBJECT (note->priv->text_item), - "height", &height, - NULL); - height = MAX (height, allocation->height); - gnome_canvas_set_scroll_region (GNOME_CANVAS (note->priv->canvas), 0, 0, - allocation->width, height); - gnome_canvas_item_set (note->priv->frame, - "x2", (gdouble) allocation->width - 1, - "y2", (gdouble) allocation->height - 1, - NULL); - gnome_canvas_item_set (note->priv->rect, - "x2", (gdouble) allocation->width - 1, - "y2", (gdouble) allocation->height - 1, - NULL); - gnome_canvas_item_set (note->priv->move_button, - "width", (gdouble) allocation->width - 29, - NULL); - gnome_canvas_item_set (note->priv->resize_button, - "x", (gdouble) allocation->width - 23, - "y", (gdouble) allocation->height - 23, - NULL); - gnome_canvas_item_set (note->priv->close_button, - "x", (gdouble) allocation->width - 23, - NULL); -} - -static void -e_note_realize (GtkWidget *widget) -{ - GTK_WIDGET_CLASS (parent_class)->realize (widget); - - gdk_window_set_decorations (widget->window, 0); -} - -static void -e_note_class_init (ENoteClass *klass) -{ - GtkWidgetClass *widget_class; - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *)klass; - widget_class = (GtkWidgetClass *)klass; - parent_class = gtk_type_class (PARENT_TYPE); - - widget_class->realize = e_note_realize; - - e_note_signals [E_NOTE_TEXT_CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ENoteClass, text_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_note_signals, E_NOTE_LAST_SIGNAL); -} - -static void -e_note_init (ENote *note) -{ - ENotePrivate *priv; - GtkWidget *button; - - priv = g_new (ENotePrivate, 1); - - note->priv = priv; - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - priv->canvas = e_canvas_new (); - - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - - gtk_signal_connect (GTK_OBJECT (priv->canvas), "size_allocate", - GTK_SIGNAL_FUNC (e_note_canvas_size_allocate), note); - gtk_widget_show (priv->canvas); - gtk_container_add (GTK_CONTAINER (note), priv->canvas); - - priv->rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (priv->canvas)), - gnome_canvas_rect_get_type (), - "x1", 0.0, - "y1", 0.0, - "x2", 100.0, - "y2", 100.0, - "fill_color_rgba", 0xf5ffa0ff, - NULL); - priv->frame = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (priv->canvas)), - gnome_canvas_rect_get_type (), - "x1", 0.0, - "y1", 0.0, - "x2", 100.0, - "y2", 100.0, - "outline_color", "black", - NULL); - - priv->text_item = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (priv->canvas)), - e_text_get_type (), - "text", "", - "font_gdk", priv->canvas->style->font, - "fill_color", "black", - "anchor", GTK_ANCHOR_NW, - "clip", TRUE, - "editable", TRUE, - "line_wrap", TRUE, - "width", 150.0, - NULL); - e_canvas_item_move_absolute(priv->text_item, - 5.0, 25.0); - - gtk_signal_connect (GTK_OBJECT (E_TEXT (priv->text_item)->model), "changed", - GTK_SIGNAL_FUNC (e_note_text_changed), note); - - button = e_bevel_button_new (); - gtk_signal_connect (GTK_OBJECT (button), "button_press_event", - GTK_SIGNAL_FUNC (e_note_move_button_changed), note); - gtk_signal_connect (GTK_OBJECT (button), "button_release_event", - GTK_SIGNAL_FUNC (e_note_move_button_changed), note); - gtk_signal_connect (GTK_OBJECT (button), "motion_notify_event", - GTK_SIGNAL_FUNC (e_note_move_motion_event), note); - gtk_widget_show (button); - priv->move_button = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (priv->canvas)), - gnome_canvas_widget_get_type (), - "widget", button, - "x", 3.0, - "y", 3.0, - "width", 20.0, - "height", 20.0, - NULL); - button = e_bevel_button_new (); - gtk_widget_show (button); - priv->close_button = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (priv->canvas)), - gnome_canvas_widget_get_type (), - "widget", button, - "x", 3.0, - "y", 3.0, - "width", 20.0, - "height", 20.0, - NULL); - - button = e_bevel_button_new (); - gtk_signal_connect (GTK_OBJECT (button), "button_press_event", - GTK_SIGNAL_FUNC (e_note_resize_button_changed), note); - gtk_signal_connect (GTK_OBJECT (button), "button_release_event", - GTK_SIGNAL_FUNC (e_note_resize_button_changed), note); - gtk_signal_connect (GTK_OBJECT (button), "motion_notify_event", - GTK_SIGNAL_FUNC (e_note_resize_motion_event), note); - gtk_widget_show (button); - priv->resize_button = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (priv->canvas)), - gnome_canvas_widget_get_type (), - "widget", button, - "x", 3.0, - "y", 3.0, - "width", 20.0, - "height", 20.0, - NULL); -} - -void -e_note_set_text (ENote *note, gchar *text) -{ - g_return_if_fail (note != NULL); - g_return_if_fail (E_IS_NOTE (note)); - g_return_if_fail (text != NULL); - - gnome_canvas_item_set (note->priv->text_item, - "text", text, - NULL); -} - -gchar * -e_note_get_text (ENote *note) -{ - gchar *text; - - g_return_val_if_fail (note != NULL, NULL); - g_return_val_if_fail (E_IS_NOTE (note), NULL); - g_return_val_if_fail (text != NULL, NULL); - - gtk_object_get (GTK_OBJECT (note->priv->text_item), - "text", &text, - NULL); - - return text; -} - - -GtkWidget * -e_note_new (void) -{ - ENote *note; - - note = gtk_type_new (E_TYPE_NOTE); - - return GTK_WIDGET (note); -} - -E_MAKE_TYPE (e_note, "ENote", ENote, e_note_class_init, e_note_init, PARENT_TYPE); diff --git a/notes/e-note.h b/notes/e-note.h deleted file mode 100644 index d7d4c63b95..0000000000 --- a/notes/e-note.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -#ifndef __E_NOTE_H__ -#define __E_NOTE_H__ - -#include <config.h> -#include <gnome.h> -#include "e-bevel-button.h" - -#define E_TYPE_NOTE (e_note_get_type ()) -#define E_NOTE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_NOTE, ENote)) -#define E_NOTE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_NOTE, ENoteClass)) -#define E_IS_NOTE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_NOTE)) -#define E_IS_NOTE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_NOTE)) - -typedef struct _ENote ENote; -typedef struct _ENotePrivate ENotePrivate; -typedef struct _ENoteClass ENoteClass; - -struct _ENote { - GtkWindow parent; - - ENotePrivate *priv; -}; - -struct _ENoteClass { - GtkWindowClass parent_class; - - void (* text_changed) (ENote *note); -}; - -GtkType e_note_get_type (void); -GtkWidget *e_note_new (void); -void e_note_set_text (ENote *note, gchar *text); -gchar *e_note_get_text (ENote *note); - -#endif /* __E_NOTE_H__ */ diff --git a/notes/main.c b/notes/main.c deleted file mode 100644 index f3198c0d63..0000000000 --- a/notes/main.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Author: - * Anders Carlsson (andersca@gnu.org) - * - * (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <gnome.h> -#include <bonobo.h> -#include <liboaf/liboaf.h> - -#include "e-util/e-gui-utils.h" -#include "component-factory.h" - -static void -init_corba (gint argc, gchar **argv) -{ - gnome_init_with_popt_table ("evolution-notes-component", VERSION, argc, argv, - oaf_popt_options, 0, NULL); - oaf_init (argc, argv); -} - -static void -init_bonobo (void) -{ - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Notes Component: Could not initialize bonobo")); - exit (1); - } -} - -gint -main (gint argc, gchar **argv) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - init_corba (argc, argv); - init_bonobo (); - - e_setup_base_dir (); - - notes_factory_init (); - component_factory_init (); - - bonobo_main (); - - return 0; -} diff --git a/notes/test-notes.c b/notes/test-notes.c deleted file mode 100644 index 41def58a24..0000000000 --- a/notes/test-notes.c +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -#include <config.h> -#include <gnome.h> -#include <gdk/gdkx.h> - -#include <gal/widgets/e-canvas.h> -#include <gal/e-text/e-text.h> - -#include "e-note.h" - -void -text_changed (GtkWidget *widget, gpointer data) -{ - g_print ("Text changed!\n"); -} - -gint -main (gint argc, gchar **argv) -{ - GtkWidget *note; - - gnome_init ("NotesTest", "0.0.1", argc, argv); - - note = e_note_new (); - e_note_set_text (E_NOTE (note), "This is a text note widget"); - gtk_signal_connect (GTK_OBJECT (note), "changed", - GTK_SIGNAL_FUNC (text_changed), NULL); - - gtk_widget_show (note); - gtk_main (); - - return 0; -} |