diff --git a/src/include/ZMap/zmapStyle.h b/src/include/ZMap/zmapStyle.h index 8bfee98f6d4d4ead26fe3ee65b64ff912d48f37c..651fadf964ec3d58373f8dc77457c2b9571671eb 100755 --- a/src/include/ZMap/zmapStyle.h +++ b/src/include/ZMap/zmapStyle.h @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Jul 29 09:27 2009 (edgrif) * Created: Mon Feb 26 09:28:26 2007 (edgrif) - * CVS info: $Id: zmapStyle.h,v 1.44 2010-01-06 15:58:00 mh17 Exp $ + * CVS info: $Id: zmapStyle.h,v 1.45 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_STYLE_H @@ -97,6 +97,7 @@ /* glyph properties. */ #define ZMAPSTYLE_PROPERTY_GLYPH_MODE "glyph-mode" +#define ZMAPSTYLE_PROPERTY_GLYPH_TYPE "glyph-type" /* alignment properties */ #define ZMAPSTYLE_PROPERTY_ALIGNMENT_PARSE_GAPS "alignment-parse-gaps" @@ -204,13 +205,19 @@ _(ZMAPSTYLE_GRAPH_HISTOGRAM, , "histogram", "Usual blocky like graph." , "") ZMAP_DEFINE_ENUM(ZMapStyleGraphMode, ZMAP_STYLE_GRAPH_MODE_LIST); -/* Specifies the style of glyph. */ +/* Specifies the sub-mode of glyph. + * SPLICE is partly hard coded due the nature of the data + * MARKER can be attached to any data via style mode=glyph and glyph type defined as in GLYPH_TYPE below + */ + #define ZMAP_STYLE_GLYPH_MODE_LIST(_) \ _(ZMAPSTYLE_GLYPH_INVALID, , "invalid", "Initial setting. ", "") \ -_(ZMAPSTYLE_GLYPH_SPLICE, , "splice" , "" , "") +_(ZMAPSTYLE_GLYPH_SPLICE, , "splice" , "" , "") \ +_(ZMAPSTYLE_GLYPH_MARKER, , "marker" , "Zoom free marker" , "") ZMAP_DEFINE_ENUM(ZMapStyleGlyphMode, ZMAP_STYLE_GLYPH_MODE_LIST); + /* Specifies the style of glyph for an incomplete alignment marker. (not a free standing glyph) */ // refer to enum in zmapWindowGlyphItem.h #define ZMAP_STYLE_GLYPH_TYPE_LIST(_) \ @@ -394,9 +401,15 @@ double zMapStyleGetMinScore(ZMapFeatureTypeStyle style) ; gboolean zMapStyleGetShowWhenEmpty(ZMapFeatureTypeStyle style); gboolean zMapStyleGetColours(ZMapFeatureTypeStyle style, ZMapStyleColourTarget target, ZMapStyleColourType type, GdkColor **fill, GdkColor **draw, GdkColor **border) ; +gboolean zMapStyleGetColoursDefault(ZMapFeatureTypeStyle style, + GdkColor **background, GdkColor **foreground, GdkColor **outline); char *zMapStyleGetDescription(ZMapFeatureTypeStyle style) ; double zMapStyleGetWidth(ZMapFeatureTypeStyle style) ; +ZMapStyleGlyphType zMapStyleGlyphType(ZMapFeatureTypeStyle style); +ZMapStyleGlyphType zMapStyleGlyphMode(ZMapFeatureTypeStyle style); + + void zMapStyleGetGappedAligns(ZMapFeatureTypeStyle style, gboolean *parse_gaps, gboolean *show_gaps) ; double zMapStyleGetBumpWidth(ZMapFeatureTypeStyle style) ; diff --git a/src/zmapConfig/zmapConfigLoader.c b/src/zmapConfig/zmapConfigLoader.c index f8594fb121247506d3dc49e842aab532ca2a0aee..9d3f9dba1bc79b6fd313ce38d267f66b43649733 100644 --- a/src/zmapConfig/zmapConfigLoader.c +++ b/src/zmapConfig/zmapConfigLoader.c @@ -31,7 +31,7 @@ * HISTORY: * Last edited: Nov 6 13:34 2009 (edgrif) * Created: Thu Sep 25 14:12:05 2008 (rds) - * CVS info: $Id: zmapConfigLoader.c,v 1.4 2010-01-06 15:58:01 mh17 Exp $ + * CVS info: $Id: zmapConfigLoader.c,v 1.5 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ @@ -785,6 +785,7 @@ static gpointer create_config_style() { ZMAPSTYLE_PROPERTY_GRAPH_BASELINE, FALSE, ZMAPCONF_DOUBLE, {FALSE}, ZMAPCONV_NONE, {NULL} }, { ZMAPSTYLE_PROPERTY_GLYPH_MODE, FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2ENUM, {(ZMapConfStr2EnumFunc)zMapStyleStr2GlyphMode} }, + { ZMAPSTYLE_PROPERTY_GLYPH_TYPE, FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2ENUM, {(ZMapConfStr2EnumFunc)zMapStyleStr2GlyphType} }, { ZMAPSTYLE_PROPERTY_ALIGNMENT_PARSE_GAPS, FALSE, ZMAPCONF_BOOLEAN, {FALSE}, ZMAPCONV_NONE, {NULL} }, { ZMAPSTYLE_PROPERTY_ALIGNMENT_SHOW_GAPS, FALSE, ZMAPCONF_BOOLEAN, {FALSE}, ZMAPCONV_NONE, {NULL} }, @@ -893,7 +894,7 @@ static ZMapConfigIniContextKeyEntry get_style_group_data(char **stanza_name, cha { ZMAPSTYLE_PROPERTY_GRAPH_BASELINE, G_TYPE_DOUBLE, style_set_property, FALSE }, { ZMAPSTYLE_PROPERTY_GLYPH_MODE, G_TYPE_STRING, style_set_property, FALSE }, - + { ZMAPSTYLE_PROPERTY_GLYPH_TYPE, G_TYPE_STRING, style_set_property, FALSE }, { ZMAPSTYLE_PROPERTY_ALIGNMENT_PARSE_GAPS, G_TYPE_BOOLEAN, style_set_property, FALSE }, { ZMAPSTYLE_PROPERTY_ALIGNMENT_SHOW_GAPS, G_TYPE_BOOLEAN, style_set_property, FALSE }, diff --git a/src/zmapDraw/zmapDraw.c b/src/zmapDraw/zmapDraw.c index 6e722afc835ce7ece1d83aaec0f5ce4bef2af820..415eaf645dca70cc3c16baa22b31ad07da9e4684 100755 --- a/src/zmapDraw/zmapDraw.c +++ b/src/zmapDraw/zmapDraw.c @@ -30,7 +30,7 @@ * HISTORY: * Last edited: Dec 2 15:02 2008 (rds) * Created: Wed Oct 20 09:19:16 2004 (edgrif) - * CVS info: $Id: zmapDraw.c,v 1.66 2008-12-02 15:04:33 rds Exp $ + * CVS info: $Id: zmapDraw.c,v 1.67 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ @@ -288,6 +288,7 @@ void zMapDrawBoxChangeSize(FooCanvasItem *box, * * @return Returns a pointer to the new canvas item representing the glyph. * */ +// mh17: this function is never called FooCanvasItem *zMapDrawGlyph(FooCanvasGroup *group, double x, double y, ZMapDrawGlyphType glyph_type, GdkColor *colour, double width, guint line_width) diff --git a/src/zmapFeature/zmapStyle.c b/src/zmapFeature/zmapStyle.c index a0d17f79566ee0d9a34141745dbd89108bfbedd3..1af90e3e03133fa18d79771c3b0ba88690012621 100755 --- a/src/zmapFeature/zmapStyle.c +++ b/src/zmapFeature/zmapStyle.c @@ -30,7 +30,7 @@ * HISTORY: * Last edited: Jul 29 09:27 2009 (edgrif) * Created: Mon Feb 26 09:12:18 2007 (edgrif) - * CVS info: $Id: zmapStyle.c,v 1.37 2010-01-11 11:29:16 mh17 Exp $ + * CVS info: $Id: zmapStyle.c,v 1.38 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ @@ -1441,7 +1441,7 @@ GdkColor *zMapStyleGetColour(ZMapFeatureTypeStyle style, ZMapStyleDrawContext co -/* I NOW THINK THIS FUNCTION IS REDUNDANT.... */ +/* I NOW THINK THIS FUNCTION IS REDUNDANT.... mh17: not true it has a new lease of life */ /* As for zMapStyleGetColours() but defaults colours that are not set in the style according * to the style mode e.g. rules may be different for Transcript as opposed to Basic mode. * @@ -1459,14 +1459,14 @@ gboolean zMapStyleGetColoursDefault(ZMapFeatureTypeStyle style, case ZMAPSTYLE_MODE_TRANSCRIPT: case ZMAPSTYLE_MODE_ALIGNMENT: case ZMAPSTYLE_MODE_TEXT: + case ZMAPSTYLE_MODE_GLYPH: case ZMAPSTYLE_MODE_GRAPH: { /* Our rule is that missing colours will default to the fill colour so if the fill colour * is missing there is nothing we can do. */ if (style->colours.normal.fields_set.fill) { - result = TRUE ; /* We know we can default to fill - colour. */ + result = TRUE ; /* We know we can default to fill colour. */ if (background) { @@ -1965,6 +1965,27 @@ double zMapStyleBaseline(ZMapFeatureTypeStyle style) return baseline ; } +ZMapStyleGlyphType zMapStyleGlyphMode(ZMapFeatureTypeStyle style) +{ + int glyph_mode = ZMAPSTYLE_GLYPH_INVALID; + + g_object_get(style, + ZMAPSTYLE_PROPERTY_GLYPH_MODE, &glyph_mode, + NULL) ; + + return glyph_mode ; +} + +ZMapStyleGlyphType zMapStyleGlyphType(ZMapFeatureTypeStyle style) +{ + int glyph_type = ZMAPSTYLE_GLYPH_TYPE_INVALID; + + g_object_get(style, + ZMAPSTYLE_PROPERTY_GLYPH_TYPE, &glyph_type, + NULL) ; + + return glyph_type ; +} diff --git a/src/zmapFeature/zmapStyle_I.h b/src/zmapFeature/zmapStyle_I.h index e3cf5c22ef046f0f36bd417aa03e207f715ae61d..48d9dec952f55553583f2bc92c631ae726c4fd64 100755 --- a/src/zmapFeature/zmapStyle_I.h +++ b/src/zmapFeature/zmapStyle_I.h @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Jul 29 09:43 2009 (edgrif) * Created: Mon Feb 26 09:13:30 2007 (edgrif) - * CVS info: $Id: zmapStyle_I.h,v 1.13 2010-01-06 15:58:02 mh17 Exp $ + * CVS info: $Id: zmapStyle_I.h,v 1.14 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ @@ -180,10 +180,12 @@ typedef struct struct { unsigned int mode : 1 ; + unsigned int type : 1 ; } fields_set ; /*!< Fields set. */ - ZMapStyleGlyphMode mode ; /*!< Glyph style. */ - + ZMapStyleGlyphMode mode ; /*!< Glyph mode. eg splice or marker*/ + ZMapStyleGlyphMode type ; /*!< Glyph type. eg diamond or circle */ + } ZMapStyleGlyphStruct, *ZMapStyleGlyph ; diff --git a/src/zmapWindow/items/zmapWindowBasicFeature.c b/src/zmapWindow/items/zmapWindowBasicFeature.c index 01424080d68c9c647d0f8e19bd75fe3f5a2abdec..cd724d52bb26989da664dac67c161f324222dbe0 100755 --- a/src/zmapWindow/items/zmapWindowBasicFeature.c +++ b/src/zmapWindow/items/zmapWindowBasicFeature.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Jul 3 17:07 2009 (rds) * Created: Wed Dec 3 10:02:22 2008 (rds) - * CVS info: $Id: zmapWindowBasicFeature.c,v 1.8 2009-07-27 03:13:28 rds Exp $ + * CVS info: $Id: zmapWindowBasicFeature.c,v 1.9 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ @@ -104,6 +104,8 @@ static FooCanvasItem *zmap_window_basic_feature_add_interval(ZMapWindowCanvasIte ZMapFeatureTypeStyle style; ZMapFeature feature; gboolean interval_type_from_feature_type = TRUE; /* for now */ + GdkColor fill,outline; + GdkColor *pfill = &fill,*poutline = &outline; feature = basic->feature; style = (ZMAP_CANVAS_ITEM_GET_CLASS(basic)->get_style)(basic); @@ -127,29 +129,55 @@ static FooCanvasItem *zmap_window_basic_feature_add_interval(ZMapWindowCanvasIte case ZMAP_WINDOW_BASIC_GLYPH: { /* where do we do the points calculation? */ - /* Should it be here from the left, right, top, bottom coords? */ + /* Should it be here from the left, right, top, bottom cogreenords? */ /* Should the glyph code do it? */ /* intron/gaps are done at this level... */ int type = 0; - - if(feature->strand == ZMAPSTRAND_FORWARD) - type = ZMAP_GLYPH_ITEM_STYLE_TRIANGLE; - else - type = ZMAP_GLYPH_ITEM_STYLE_TRIANGLE; + int mode = zMapStyleGlyphMode(style); + + switch(mode) + { + case ZMAPSTYLE_GLYPH_SPLICE: // hard coded on GF_Splice feature - should never be configured + if(feature->strand == ZMAPSTRAND_FORWARD) + type = ZMAP_GLYPH_ITEM_STYLE_TRIANGLE; + else + type = ZMAP_GLYPH_ITEM_STYLE_TRIANGLE; // mh17: (sic) + + gdk_color_parse("#0000ff",&fill); + gdk_color_parse("#000000",&outline); + pfill = &fill; + poutline = &outline; + break; + + case ZMAPSTYLE_GLYPH_MARKER: + type = zMapStyleGlyphType(style); + if(!zMapStyleGetColoursDefault(style,&pfill,NULL,&poutline)) + { + gdk_color_parse("#00ff00",&fill); + gdk_color_parse("#000000",&outline); + pfill = &fill; + poutline = &outline; + } + + break; + } + basic->auto_resize_background = 1; item = foo_canvas_item_new(FOO_CANVAS_GROUP(basic), - ZMAP_TYPE_WINDOW_GLYPH_ITEM, - "glyph_style", type, - "x", 0.0, - "y", 0.0, - "width", right, - "height", right, - "line-width", 1, - "join_style", GDK_JOIN_BEVEL, - "cap_style", GDK_CAP_BUTT, - NULL); + ZMAP_TYPE_WINDOW_GLYPH_ITEM, + "glyph_style", type, + "x", 0.0, + "y", 0.0, + "width", right, + "height", right, // mh17: gross!.. right being the width of the column? so this means square?? + "line-width", 1, + "join_style", GDK_JOIN_BEVEL, + "cap_style", GDK_CAP_BUTT, + "fill_color_gdk", pfill, + "outline_color_gdk", poutline, + NULL); } break; case ZMAP_WINDOW_BASIC_BOX: diff --git a/src/zmapWindow/items/zmapWindowCollectionFeature.c b/src/zmapWindow/items/zmapWindowCollectionFeature.c index f42c0c97c26aa7278407bc9cdac100e60414b33d..87c24010e54f4ea22af8a36e10eaad9d248d9ba0 100755 --- a/src/zmapWindow/items/zmapWindowCollectionFeature.c +++ b/src/zmapWindow/items/zmapWindowCollectionFeature.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Aug 28 09:12 2009 (edgrif) * Created: Wed Dec 3 10:02:22 2008 (rds) - * CVS info: $Id: zmapWindowCollectionFeature.c,v 1.11 2010-01-11 11:29:16 mh17 Exp $ + * CVS info: $Id: zmapWindowCollectionFeature.c,v 1.12 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ @@ -293,7 +293,7 @@ void zMapWindowCollectionFeatureAddIncompleteMarkers(ZMapWindowCanvasItem collec // char *noncolinear_colour = ZMAP_WINDOW_MATCH_NOTCOLINEAR ; FooCanvasGroup *group; GdkColor *marker_fill=NULL,*marker_draw=NULL,*marker_border=NULL; - GdkColor red; + GdkColor fill,outline; double width; gboolean incomplete ; ZMapStyleGlyphType glyph_style; // = ZMAP_GLYPH_ITEM_STYLE_DIAMOND; @@ -310,8 +310,10 @@ void zMapWindowCollectionFeatureAddIncompleteMarkers(ZMapWindowCanvasItem collec style = (ZMAP_CANVAS_ITEM_GET_CLASS(collection)->get_style)(collection); if(!zMapStyleGetColoursGlyphDefault(style,&marker_fill,&marker_draw,&marker_border)) { - gdk_color_parse("red",&red); - marker_fill = marker_border = &red; + gdk_color_parse("red",&fill); + gdk_color_parse("black",&outline); + marker_fill = &fill; + marker_border = &outline; } if(group->item_list) diff --git a/src/zmapWindow/items/zmapWindowGlyphItem.c b/src/zmapWindow/items/zmapWindowGlyphItem.c index e19a5873a69ad9103707c44681db0a235ca3003b..7dd3f73a6c2a145678646a412ee1e965394f4b2d 100755 --- a/src/zmapWindow/items/zmapWindowGlyphItem.c +++ b/src/zmapWindow/items/zmapWindowGlyphItem.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Jun 3 09:51 2009 (rds) * Created: Fri Jan 16 11:20:07 2009 (rds) - * CVS info: $Id: zmapWindowGlyphItem.c,v 1.4 2010-01-06 15:58:02 mh17 Exp $ + * CVS info: $Id: zmapWindowGlyphItem.c,v 1.5 2010-01-11 16:50:20 mh17 Exp $ *------------------------------------------------------------------- */ @@ -451,9 +451,9 @@ static void zmap_window_glyph_item_set_property (GObject *object, switch(param_id) { - case PROP_FILL_COLOR: - case PROP_FILL_COLOR_GDK: - case PROP_FILL_COLOR_RGBA: + case PROP_OUTLINE_COLOR: + case PROP_OUTLINE_COLOR_GDK: + case PROP_OUTLINE_COLOR_RGBA: { glyph_item->line_set = glyph_set_color_property(glyph_item, param_id, value, &(glyph_item->line_rgba), @@ -462,10 +462,10 @@ static void zmap_window_glyph_item_set_property (GObject *object, redraw = 1; } break; - - case PROP_OUTLINE_COLOR: - case PROP_OUTLINE_COLOR_GDK: - case PROP_OUTLINE_COLOR_RGBA: + + case PROP_FILL_COLOR: + case PROP_FILL_COLOR_GDK: + case PROP_FILL_COLOR_RGBA: { glyph_item->area_set = glyph_set_color_property(glyph_item, param_id, value, &(glyph_item->area_rgba), @@ -489,6 +489,7 @@ static void zmap_window_glyph_item_set_property (GObject *object, case PROP_HEIGHT_PIXELS: glyph_item->ch = g_value_get_double(value); coord_update = 1; + break; case PROP_GLYPH_STYLE: glyph_item->style = g_value_get_uint(value);