* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-#include <stdio.h>
-
#ifndef _VIKING_LAYER_H
#define _VIKING_LAYER_H
+#include <stdio.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixdata.h>
+#include "vikwindow.h"
+
+#include "viktreeview.h"
+#include "vikviewport.h"
+
#define VIK_LAYER_TYPE (vik_layer_get_type ())
#define VIK_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIK_LAYER_TYPE, VikLayer))
#define VIK_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIK_LAYER_TYPE, VikLayerClass))
enum {
-VIK_LAYER_AGGREGATE = 0,
-VIK_LAYER_TRW,
-VIK_LAYER_COORD,
-VIK_LAYER_GEOREF,
-VIK_LAYER_MAPS,
-VIK_LAYER_NUM_TYPES
+ VIK_LAYER_AGGREGATE = 0,
+ VIK_LAYER_TRW,
+ VIK_LAYER_COORD,
+ VIK_LAYER_GEOREF,
+ VIK_LAYER_GPS,
+ VIK_LAYER_MAPS,
+ VIK_LAYER_NUM_TYPES
};
-typedef enum { VIK_LAYER_TOOL_IGNORED=0,
- VIK_LAYER_TOOL_ACK,
- VIK_LAYER_TOOL_ACK_REDRAW_ABOVE,
- VIK_LAYER_TOOL_ACK_REDRAW_ALL,
- VIK_LAYER_TOOL_ACK_REDRAW_IF_VISIBLE }
- VikLayerToolFuncStatus;
-typedef VikLayerToolFuncStatus (*VikToolInterfaceFunc) (VikLayer *,GdkEventButton *,gpointer);
+typedef enum {
+ VIK_LAYER_TOOL_IGNORED=0,
+ VIK_LAYER_TOOL_ACK,
+ VIK_LAYER_TOOL_ACK_REDRAW_ABOVE,
+ VIK_LAYER_TOOL_ACK_REDRAW_ALL,
+ VIK_LAYER_TOOL_ACK_REDRAW_IF_VISIBLE
+} VikLayerToolFuncStatus;
-/* gpointer is viewport */
+/* gpointer is tool-specific state created in the constructor */
+typedef gpointer (*VikToolConstructorFunc) (VikWindow *, VikViewport *);
+typedef void (*VikToolDestructorFunc) (gpointer);
+typedef VikLayerToolFuncStatus (*VikToolMouseFunc) (VikLayer *, GdkEventButton *, gpointer);
+typedef void (*VikToolActivationFunc) (VikLayer *, gpointer);
typedef struct _VikToolInterface VikToolInterface;
struct _VikToolInterface {
gchar *name;
- VikToolInterfaceFunc callback;
- VikToolInterfaceFunc callback_release;
+ VikToolConstructorFunc create;
+ VikToolDestructorFunc destroy;
+ VikToolActivationFunc activate;
+ VikToolActivationFunc deactivate;
+ VikToolMouseFunc click;
+ VikToolMouseFunc move;
+ VikToolMouseFunc release;
};
/* Parameters (for I/O and Properties) */
typedef gboolean (*VikLayerFuncSublayerToggleVisible) (VikLayer *,gint,gpointer);
typedef VikLayer * (*VikLayerFuncCopy) (VikLayer *,VikViewport *);
+typedef void (*VikLayerFuncMarshall) (VikLayer *, guint8 **, gint *);
+typedef VikLayer * (*VikLayerFuncUnmarshall) (guint8 *, gint, VikViewport *);
/* returns TRUE if needs to redraw due to changed param */
typedef gboolean (*VikLayerFuncSetParam) (VikLayer *, guint16, VikLayerParamData, VikViewport *);
typedef void (*VikLayerFuncReadFileData) (VikLayer *, FILE *);
typedef void (*VikLayerFuncWriteFileData) (VikLayer *, FILE *);
-typedef gpointer (*VikLayerFuncCopyItem) (VikLayer *, gint, gpointer);
-typedef gboolean (*VikLayerFuncPasteItem) (VikLayer *, gint, gpointer);
+/* item manipulation */
+typedef void (*VikLayerFuncDeleteItem) (VikLayer *, gint, gpointer);
+ /* layer, subtype, pointer to sub-item */
+typedef void (*VikLayerFuncCopyItem) (VikLayer *, gint, gpointer, guint8 **, guint *);
+ /* layer, subtype, pointer to sub-item, return pointer, return len */
+typedef gboolean (*VikLayerFuncPasteItem) (VikLayer *, gint, guint8 *, guint);
typedef void (*VikLayerFuncFreeCopiedItem) (gint, gpointer);
/* treeview drag and drop method. called on the destination layer. it is given a source and destination layer,
*/
typedef void (*VikLayerFuncDragDropRequest) (VikLayer *, VikLayer *, GtkTreeIter *, GtkTreePath *);
+typedef enum {
+ VIK_MENU_ITEM_PROPERTY=1,
+ VIK_MENU_ITEM_CUT=2,
+ VIK_MENU_ITEM_COPY=4,
+ VIK_MENU_ITEM_PASTE=8,
+ VIK_MENU_ITEM_DELETE=16,
+ VIK_MENU_ITEM_ALL=0xff
+} VikStdLayerMenuItem;
typedef struct _VikLayerInterface VikLayerInterface;
gchar ** params_groups;
guint8 params_groups_count;
+ /* menu items to be created */
+ VikStdLayerMenuItem menu_items_selection;
+
VikLayerFuncCreate create;
VikLayerFuncRealize realize;
VikLayerFuncPostRead post_read;
VikLayerFuncSublayerToggleVisible sublayer_toggle_visible;
VikLayerFuncCopy copy;
+ VikLayerFuncMarshall marshall;
+ VikLayerFuncUnmarshall unmarshall;
/* for I/O */
VikLayerFuncSetParam set_param;
VikLayerFuncReadFileData read_file_data;
VikLayerFuncWriteFileData write_file_data;
+ VikLayerFuncDeleteItem delete_item;
VikLayerFuncCopyItem copy_item;
VikLayerFuncPasteItem paste_item;
VikLayerFuncFreeCopiedItem free_copied_item;
gboolean vik_layer_sublayer_add_menu_items ( VikLayer *l, GtkMenu *menu, gpointer vlp, gint subtype, gpointer sublayer, GtkTreeIter *iter );
VikLayer *vik_layer_copy ( VikLayer *vl, gpointer vp );
+void vik_layer_marshall ( VikLayer *vl, guint8 **data, gint *len );
+VikLayer *vik_layer_unmarshall ( guint8 *data, gint len, VikViewport *vvp );
+void vik_layer_marshall_params ( VikLayer *vl, guint8 **data, gint *len );
+void vik_layer_unmarshall_params ( VikLayer *vl, guint8 *data, gint len, VikViewport *vvp );
const gchar *vik_layer_sublayer_rename_request ( VikLayer *l, const gchar *newname, gpointer vlp, gint subtype, gpointer sublayer, GtkTreeIter *iter );