X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/94933cb8c883c442ed95f19a11dacb0783f65c3b..d03d80e63418a59aee6d37fc44b72ab924598c8a:/src/viklayer.h diff --git a/src/viklayer.h b/src/viklayer.h index 6492b871..ca6788c8 100644 --- a/src/viklayer.h +++ b/src/viklayer.h @@ -26,6 +26,7 @@ #include #include +#include "uibuilder.h" #include "vikwindow.h" #include "viktreeview.h" #include "vikviewport.h" @@ -73,12 +74,21 @@ enum { VIK_LAYER_NUM_TYPES }; +/* I think most of these are ignored, + * returning GRAB_FOCUS grabs the focus for mouse move, + * mouse click, release always grabs focus. Focus allows key presses + * to be handled. + * It used to be that, if ignored, Viking could look for other layers. + * this was useful for clicking a way/trackpoint in any layer, + * if no layer was selected (find way/trackpoint) + */ 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 + VIK_LAYER_TOOL_ACK_REDRAW_IF_VISIBLE, + VIK_LAYER_TOOL_ACK_GRAB_FOCUS, /* only for move */ } VikLayerToolFuncStatus; /* gpointer is tool-specific state created in the constructor */ @@ -86,6 +96,7 @@ typedef gpointer (*VikToolConstructorFunc) (VikWindow *, VikViewport *); typedef void (*VikToolDestructorFunc) (gpointer); typedef VikLayerToolFuncStatus (*VikToolMouseFunc) (VikLayer *, GdkEventButton *, gpointer); typedef void (*VikToolActivationFunc) (VikLayer *, gpointer); +typedef gboolean (*VikToolKeyFunc) (VikLayer *, GdkEventKey *, gpointer); typedef struct _VikToolInterface VikToolInterface; struct _VikToolInterface { @@ -97,71 +108,13 @@ struct _VikToolInterface { VikToolMouseFunc click; VikToolMouseFunc move; VikToolMouseFunc release; + VikToolKeyFunc key_press; /* return FALSE if we don't use the key press -- should return AFLSE most of the time if we want any shortcuts / UI keybindings to work! use sparingly. */ + const GdkPixdata *cursor; }; /* Parameters (for I/O and Properties) */ +/* --> moved to uibuilder.h */ -typedef union { - gdouble d; - guint32 u; - gint32 i; - gboolean b; - const gchar *s; - GdkColor c; - GList *sl; -} VikLayerParamData; - -typedef struct { - const gchar *name; - guint8 type; - gint16 group; - const gchar *title; - guint8 widget_type; - gpointer widget_data; - gpointer extra_widget_data; -} VikLayerParam; - -enum { -VIK_LAYER_NOT_IN_PROPERTIES=-2, -VIK_LAYER_GROUP_NONE=-1 -}; - -enum { -VIK_LAYER_WIDGET_CHECKBUTTON=0, -VIK_LAYER_WIDGET_RADIOGROUP, -VIK_LAYER_WIDGET_SPINBUTTON, -VIK_LAYER_WIDGET_ENTRY, -VIK_LAYER_WIDGET_FILEENTRY, -VIK_LAYER_WIDGET_HSCALE, -VIK_LAYER_WIDGET_COLOR, -VIK_LAYER_WIDGET_COMBOBOX, -VIK_LAYER_WIDGET_FILELIST, -}; - -typedef struct { - gdouble min; - gdouble max; - gdouble step; - guint8 digits; -} VikLayerParamScale; - -/* id is index */ -enum { -VIK_LAYER_PARAM_DOUBLE=1, -VIK_LAYER_PARAM_UINT, -VIK_LAYER_PARAM_INT, -VIK_LAYER_PARAM_STRING, -VIK_LAYER_PARAM_BOOLEAN, -VIK_LAYER_PARAM_COLOR, - -/* NOTE: string layer works auniquely: data.sl should NOT be free'd when - * the internals call get_param -- i.e. it should be managed w/in the layer. - * The value passed by the internals into set_param should also be managed - * by the layer -- i.e. free'd by the layer. - */ - -VIK_LAYER_PARAM_STRING_LIST, -}; /* layer interface functions */ @@ -175,13 +128,13 @@ typedef void (*VikLayerFuncRealize) (VikLayer *,VikTreevi /* rarely used, this is called after a read operation or properties box is run. * usually used to create GC's that depend on params, * but GC's can also be created from create() or set_param() */ -typedef void (*VikLayerFuncPostRead) (VikLayer *,VikViewport *vp); +typedef void (*VikLayerFuncPostRead) (VikLayer *,VikViewport *vp,gboolean from_file); typedef void (*VikLayerFuncFree) (VikLayer *); /* do _not_ use this unless absolutely neccesary. Use the dynamic properties (see coordlayer for example) * returns TRUE if OK was pressed */ -typedef gboolean (*VikLayerFuncProperties) (VikLayer *,VikViewport *); /* gpointer is a VikViewport */ +typedef gboolean (*VikLayerFuncProperties) (VikLayer *,VikViewport *); typedef void (*VikLayerFuncDraw) (VikLayer *,VikViewport *); typedef void (*VikLayerFuncChangeCoordMode) (VikLayer *,VikCoordMode); @@ -195,7 +148,6 @@ typedef const gchar * (*VikLayerFuncSublayerRenameRequest) (VikLayer *,const gch gint,VikViewport *,GtkTreeIter *); /* first gpointer is a VikLayersPanel */ typedef gboolean (*VikLayerFuncSublayerToggleVisible) (VikLayer *,gint,gpointer); -typedef VikLayer * (*VikLayerFuncCopy) (VikLayer *,VikViewport *); typedef void (*VikLayerFuncMarshall) (VikLayer *, guint8 **, gint *); typedef VikLayer * (*VikLayerFuncUnmarshall) (guint8 *, gint, VikViewport *); @@ -266,7 +218,6 @@ struct _VikLayerInterface { VikLayerFuncSublayerRenameRequest sublayer_rename_request; VikLayerFuncSublayerToggleVisible sublayer_toggle_visible; - VikLayerFuncCopy copy; VikLayerFuncMarshall marshall; VikLayerFuncUnmarshall unmarshall; @@ -308,7 +259,7 @@ VikLayer *vik_layer_create ( gint type, gpointer vp, GtkWindow *w, gboolean inte gboolean vik_layer_properties ( VikLayer *layer, gpointer vp ); void vik_layer_realize ( VikLayer *l, VikTreeview *vt, GtkTreeIter * layer_iter ); -void vik_layer_post_read ( VikLayer *layer, VikViewport *vp ); +void vik_layer_post_read ( VikLayer *layer, VikViewport *vp, gboolean from_file ); gboolean vik_layer_sublayer_add_menu_items ( VikLayer *l, GtkMenu *menu, gpointer vlp, gint subtype, gpointer sublayer, GtkTreeIter *iter ); @@ -325,4 +276,15 @@ gboolean vik_layer_sublayer_toggle_visible ( VikLayer *l, gint subtype, gpointer /* TODO: put in layerspanel */ GdkPixbuf *vik_layer_load_icon ( gint type ); +VikLayer *vik_layer_get_and_reset_trigger(); +void vik_layer_emit_update_secondary ( VikLayer *vl ); /* to be called by aggregate layer only. doesn't set the trigger */ +void vik_layer_emit_update_although_invisible ( VikLayer *vl ); + +GdkCursor *vik_layer_get_tool_cursor ( gint layer_id, gint tool_id ); +void vik_layer_cursors_init(); +void vik_layer_cursors_uninit(); + + + + #endif