From f7a16a0d9831acca81cf530389820b17f8ca7b84 Mon Sep 17 00:00:00 2001
From: mh17 <mh17>
Date: Mon, 19 Apr 2010 11:00:39 +0000
Subject: [PATCH] more glyph tweaks and pipe stuff

---
 src/include/ZMap/zmapStyle.h               | 29 +++++++++++----
 src/zmapConfig/zmapConfigLoader.c          | 12 +++---
 src/zmapFeature/zmapFeatureTypes.c         | 11 +++++-
 src/zmapFeature/zmapStyle.c                | 38 +++++++++++++------
 src/zmapFeature/zmapStyleUtils.c           |  4 +-
 src/zmapFeature/zmapStyle_I.h              |  4 +-
 src/zmapView/zmapView.c                    | 43 ++++++++++++++++------
 src/zmapView/zmapViewRemoteReceive.c       | 11 +++++-
 src/zmapWindow/items/zmapWindowGlyphItem.c | 26 ++++++++-----
 9 files changed, 127 insertions(+), 51 deletions(-)

diff --git a/src/include/ZMap/zmapStyle.h b/src/include/ZMap/zmapStyle.h
index 372316fc0..c55d3e1da 100755
--- a/src/include/ZMap/zmapStyle.h
+++ b/src/include/ZMap/zmapStyle.h
@@ -28,7 +28,7 @@
  * HISTORY:
  * Last edited: Jan 26 08:42 2010 (edgrif)
  * Created: Mon Feb 26 09:28:26 2007 (edgrif)
- * CVS info:   $Id: zmapStyle.h,v 1.53 2010-04-15 11:19:03 mh17 Exp $
+ * CVS info:   $Id: zmapStyle.h,v 1.54 2010-04-19 11:00:39 mh17 Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_STYLE_H
@@ -155,6 +155,7 @@ typedef enum
     STYLE_PROP_GLYPH_ALT_COLOURS,
     STYLE_PROP_GLYPH_THRESHOLD,
     STYLE_PROP_GLYPH_STRAND,
+    STYLE_PROP_GLYPH_ALIGN,
 
     STYLE_PROP_GRAPH_MODE,
     STYLE_PROP_GRAPH_BASELINE,
@@ -246,6 +247,7 @@ typedef enum
 #define ZMAPSTYLE_PROPERTY_GLYPH_ALT_COLOURS      "glyph-alt-colours"
 #define ZMAPSTYLE_PROPERTY_GLYPH_THRESHOLD        "glyph-threshold"
 #define ZMAPSTYLE_PROPERTY_GLYPH_STRAND           "glyph-strand"
+#define ZMAPSTYLE_PROPERTY_GLYPH_ALIGN            "glyph-align"
 
 
 /* graph properties. */
@@ -263,6 +265,7 @@ typedef enum
 #define ZMAPSTYLE_PROPERTY_ALIGNMENT_PERFECT_COLOURS     "alignment-perfect-colours"
 #define ZMAPSTYLE_PROPERTY_ALIGNMENT_COLINEAR_COLOURS    "alignment-colinear-colours"
 #define ZMAPSTYLE_PROPERTY_ALIGNMENT_NONCOLINEAR_COLOURS "alignment-noncolinear-colours"
+#define ZMAPSTYLE_PROPERTY_ALIGNMENT_SHOW_UNMARKED_COLINEAR    "alignment-unmarked-colinear"
 
 /* transcript properties */
 #define ZMAPSTYLE_PROPERTY_TRANSCRIPT_CDS_COLOURS "transcript-cds-colours"
@@ -367,7 +370,7 @@ ZMAP_DEFINE_ENUM(ZMapStyleGraphMode, ZMAP_STYLE_GRAPH_MODE_LIST);
 _(ZMAPSTYLE_SUB_FEATURE_INVALID, , "invalid", "Not used. ", "") \
 _(ZMAPSTYLE_SUB_FEATURE_HOMOLOGY,  , "homology" , "Incomplete-homology-marker" , "") \
 _(ZMAPSTYLE_SUB_FEATURE_NON_CONCENCUS_SPLICE,  , "non-concensus-splice" , "Non concensus splice marker" , "") \
-_(ZMAPSTYLE_SUBFEATURE_TRUNCATED,  , "truncated" , "Truncated transcript" , "")\
+_(ZMAPSTYLE_SUB_FEATURE_TRUNCATED,  , "truncated" , "Truncated transcript" , "")\
 _(ZMAPSTYLE_SUB_FEATURE_POLYA,  , "polyA" , "Poly A tail on RNA seq"   , "") \
 _(ZMAPSTYLE_SUB_FEATURE_MAX , ,"do-not-use" ,"" , "")
 
@@ -385,6 +388,16 @@ _(ZMAPSTYLE_GLYPH_STRAND_FLIP_Y,  , "flip-y" , "" , "")
 
 ZMAP_DEFINE_ENUM(ZMapStyleGlyphStrand, ZMAP_STYLE_GLYPH_STRAND_LIST);
 
+/*
+ * specifies glyph alignment: NB glyph shape should be chosen appropriately!
+ */
+#define ZMAP_STYLE_GLYPH_ALIGN_LIST(_)                            \
+_(ZMAPSTYLE_GLYPH_ALIGN_INVALID, , "invalid", "Initial setting. ", "") \
+_(ZMAPSTYLE_GLYPH_ALIGN_LEFT,  , "left" , ""                 , "") \
+_(ZMAPSTYLE_GLYPH_ALIGN_CENTRE,, "centre" , ""                 , "") \
+_(ZMAPSTYLE_GLYPH_ALIGN_RIGHT, , "right" , "" , "")
+
+ZMAP_DEFINE_ENUM(ZMapStyleGlyphAlign, ZMAP_STYLE_GLYPH_ALIGN_LIST);
 
 
 /* Specifies type of colour, e.g. normal or selected. */
@@ -410,12 +423,12 @@ ZMAP_DEFINE_ENUM(ZMapStyleDrawContext, ZMAP_STYLE_DRAW_CONTEXT_LIST) ;
 #define ZMAP_STYLE_SCORE_MODE_LIST(_)                                          \
 _(ZMAPSCORE_INVALID,   , "invalid"  , "Use column width only - default. ", "") \
 _(ZMAPSCORE_WIDTH,     , "width"    , "Use column width only - default. ", "") \
+_(ZMAPSCORE_HEIGHT,    , "height"   , "scale height of glyph. ", "") \
+_(ZMAPSCORE_SIZE,      , "size"     , "scale size of glyph. ", "") \
 _(ZMAPSCORE_OFFSET,    , "offset"   , ""                                 , "") \
 _(ZMAPSCORE_HISTOGRAM, , "histogram", ""                                 , "") \
 _(ZMAPSCORE_PERCENT,   , "percent"  , ""                                 , "")\
-_(ZMAPSTYLE_SCORE_GLYPH_HEIGHT,  , "glyph-height" , "variable height for glyph" , "") \
-_(ZMAPSTYLE_SCORE_GLYPH_WIDTH ,  , "glyph-width" , "variable width for glyph" , "") \
-_(ZMAPSTYLE_SCORE_ALT,  , "alt" , "alternate colour for glyph" , "")
+_(ZMAPSTYLE_SCORE_ALT, , "alt" , "alternate colour for glyph" , "")
 
 
 ZMAP_DEFINE_ENUM(ZMapStyleScoreMode, ZMAP_STYLE_SCORE_MODE_LIST) ;
@@ -470,7 +483,7 @@ ZMAP_ENUM_FROM_STRING_DEC(zMapStyleStr2ScoreMode,       ZMapStyleScoreMode) ;
 ZMAP_ENUM_FROM_STRING_DEC(zMapStyleStr2BumpMode,     ZMapStyleBumpMode) ;
 ZMAP_ENUM_FROM_STRING_DEC(zMapStyleStr2GlyphStrand,     ZMapStyleGlyphStrand) ;
 ZMAP_ENUM_FROM_STRING_DEC(zMapStyleStr2SubFeature,     ZMapStyleSubFeature) ;
-
+ZMAP_ENUM_FROM_STRING_DEC(zMapStyleStr2GlyphAlign,     ZMapStyleGlyphAlign) ;
 
 /* Enum -> String function decs: const char *zMapStyleXXXXMode2ExactStr(ZMapStyleXXXXXMode mode);  */
 ZMAP_ENUM_AS_EXACT_STRING_DEC(zMapStyleMode2ExactStr,            ZMapStyleMode) ;
@@ -484,7 +497,7 @@ ZMAP_ENUM_AS_EXACT_STRING_DEC(zmapStyleScoreMode2ExactStr,       ZMapStyleScoreM
 ZMAP_ENUM_AS_EXACT_STRING_DEC(zmapStyleBumpMode2ExactStr,     ZMapStyleBumpMode) ;
 ZMAP_ENUM_AS_EXACT_STRING_DEC(zmapStyleGlyphStrand2ExactStr,     ZMapStyleGlyphStrand) ;
 ZMAP_ENUM_AS_EXACT_STRING_DEC(zmapStyleSubFeature2ExactStr,     ZMapStyleSubFeature) ;
-
+ZMAP_ENUM_AS_EXACT_STRING_DEC(zmapStyleGlyphAlign2ExactStr,     ZMapStyleGlyphAlign) ;
 
 
 ZMAP_ENUM_TO_SHORT_TEXT_DEC(zmapStyleBumpMode2ShortText, ZMapStyleBumpMode) ;
@@ -558,8 +571,8 @@ double zMapStyleGetWidth(ZMapFeatureTypeStyle style) ;
 
 int zMapStyleGlyphThreshold(ZMapFeatureTypeStyle style);
 
-
 ZMapStyleGlyphStrand zMapStyleGlyphStrand(ZMapFeatureTypeStyle style);
+ZMapStyleGlyphAlign zMapStyleGetAlign(ZMapFeatureTypeStyle style);
 
 void zMapStyleGetGappedAligns(ZMapFeatureTypeStyle style, gboolean *parse_gaps, gboolean *show_gaps) ;
 
diff --git a/src/zmapConfig/zmapConfigLoader.c b/src/zmapConfig/zmapConfigLoader.c
index eb01d1003..1dc6fc356 100644
--- a/src/zmapConfig/zmapConfigLoader.c
+++ b/src/zmapConfig/zmapConfigLoader.c
@@ -31,7 +31,7 @@
  * HISTORY:
  * Last edited: Mar  2 14:47 2010 (edgrif)
  * Created: Thu Sep 25 14:12:05 2008 (rds)
- * CVS info:   $Id: zmapConfigLoader.c,v 1.13 2010-04-15 11:19:03 mh17 Exp $
+ * CVS info:   $Id: zmapConfigLoader.c,v 1.14 2010-04-19 11:00:39 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -948,13 +948,12 @@ static gpointer create_config_style()
       { ZMAPSTYLE_PROPERTY_GLYPH_NAME_3, FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2ENUM, {(ZMapConfStr2EnumFunc)zMapStyleQuark} },
       { ZMAPSTYLE_PROPERTY_GLYPH_SHAPE_3,   FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_NONE, {NULL} },
 
-//      { ZMAPSTYLE_PROPERTY_GLYPH_COLOURS,   FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2COLOUR, {NULL} },
       { ZMAPSTYLE_PROPERTY_GLYPH_ALT_COLOURS,   FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2COLOUR, {NULL} },
 
-//      { ZMAPSTYLE_PROPERTY_GLYPH_MODE,   FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2ENUM, {(ZMapConfStr2EnumFunc)zMapStyleStr2GlyphMode} },
-//      { ZMAPSTYLE_PROPERTY_GLYPH_SCORE_MODE,   FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2ENUM, {(ZMapConfStr2EnumFunc)zMapStyleStr2GlyphScoreMode} },
       { ZMAPSTYLE_PROPERTY_GLYPH_THRESHOLD,   FALSE, ZMAPCONF_INT, {FALSE}, ZMAPCONV_NONE, {NULL} },
 
+      { ZMAPSTYLE_PROPERTY_GLYPH_STRAND,   FALSE, ZMAPCONF_BOOLEAN, {FALSE}, ZMAPCONV_NONE, {NULL} },
+      { ZMAPSTYLE_PROPERTY_GLYPH_ALIGN,   FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2ENUM, {(ZMapConfStr2EnumFunc)zMapStyleStr2GlyphAlign} },
 
       { ZMAPSTYLE_PROPERTY_GRAPH_MODE,   FALSE, ZMAPCONF_STR, {FALSE}, ZMAPCONV_STR2ENUM, {(ZMapConfStr2EnumFunc)zMapStyleStr2GraphMode} },
       { ZMAPSTYLE_PROPERTY_GRAPH_BASELINE,   FALSE, ZMAPCONF_DOUBLE, {FALSE}, ZMAPCONV_NONE, {NULL} },
@@ -1068,11 +1067,10 @@ static ZMapConfigIniContextKeyEntry get_style_group_data(char **stanza_name, cha
     { ZMAPSTYLE_PROPERTY_GLYPH_NAME,   G_TYPE_STRING, style_set_property, FALSE },
     { ZMAPSTYLE_PROPERTY_GLYPH_NAME_5,   G_TYPE_STRING, style_set_property, FALSE },
     { ZMAPSTYLE_PROPERTY_GLYPH_NAME_3,   G_TYPE_STRING, style_set_property, FALSE },
-//   { ZMAPSTYLE_PROPERTY_GLYPH_COLOURS,   G_TYPE_STRING, style_set_property, FALSE },
     { ZMAPSTYLE_PROPERTY_GLYPH_ALT_COLOURS,   G_TYPE_STRING, style_set_property, FALSE },
-//    { ZMAPSTYLE_PROPERTY_GLYPH_MODE,   G_TYPE_STRING, style_set_property, FALSE },
-//    { ZMAPSTYLE_PROPERTY_GLYPH_SCORE_MODE,   G_TYPE_STRING, style_set_property, FALSE },
     { ZMAPSTYLE_PROPERTY_GLYPH_THRESHOLD,   G_TYPE_INT, style_set_property, FALSE },
+    { ZMAPSTYLE_PROPERTY_GLYPH_STRAND,   G_TYPE_BOOLEAN, style_set_property, FALSE },
+    { ZMAPSTYLE_PROPERTY_GLYPH_ALIGN,   G_TYPE_INT, style_set_property, FALSE },
 
 
     { ZMAPSTYLE_PROPERTY_GRAPH_MODE,   G_TYPE_STRING, style_set_property, FALSE },
diff --git a/src/zmapFeature/zmapFeatureTypes.c b/src/zmapFeature/zmapFeatureTypes.c
index d55b858d5..7efbb61ca 100755
--- a/src/zmapFeature/zmapFeatureTypes.c
+++ b/src/zmapFeature/zmapFeatureTypes.c
@@ -29,7 +29,7 @@
  * HISTORY:
  * Last edited: Jan 26 12:02 2010 (edgrif)
  * Created: Tue Dec 14 13:15:11 2004 (edgrif)
- * CVS info:   $Id: zmapFeatureTypes.c,v 1.93 2010-04-15 11:19:03 mh17 Exp $
+ * CVS info:   $Id: zmapFeatureTypes.c,v 1.94 2010-04-19 11:00:39 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -785,6 +785,15 @@ double zMapStyleGetMinScore(ZMapFeatureTypeStyle style)
    return min_score ;
 }
 
+ZMapStyleGlyphAlign zMapStyleGetAlign(ZMapFeatureTypeStyle style)
+{
+  ZMapStyleGlyphAlign z = ZMAPSTYLE_GLYPH_ALIGN_INVALID;
+
+  if(zMapStyleIsPropertySetId(style,STYLE_PROP_GLYPH_ALIGN))
+    z = style->mode_data.glyph.glyph_align;
+  return(z);
+}
+
 ZMapStyleScoreMode zMapStyleGetScoreMode(ZMapFeatureTypeStyle style)
 {
   ZMapStyleScoreMode z = ZMAPSCORE_INVALID;
diff --git a/src/zmapFeature/zmapStyle.c b/src/zmapFeature/zmapStyle.c
index 684329ac8..a0813f361 100755
--- a/src/zmapFeature/zmapStyle.c
+++ b/src/zmapFeature/zmapStyle.c
@@ -28,7 +28,7 @@
  *
  * Exported functions: See ZMap/zmapStyle.h
  *
- * CVS info:   $Id: zmapStyle.c,v 1.45 2010-04-15 11:19:03 mh17 Exp $
+ * CVS info:   $Id: zmapStyle.c,v 1.46 2010-04-19 11:00:39 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -194,33 +194,43 @@ ZMapStyleParamStruct zmapStyleParams_G[_STYLE_PROP_N_ITEMS] =
 
     { STYLE_PROP_GLYPH_NAME, STYLE_PARAM_TYPE_QUARK, ZMAPSTYLE_PROPERTY_GLYPH_NAME,
             "glyph-name", "Glyph name used to reference glyphs config stanza",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_name),0 },
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_name),ZMAPSTYLE_MODE_GLYPH },
+
     { STYLE_PROP_GLYPH_SHAPE, STYLE_PARAM_TYPE_GLYPH_SHAPE, ZMAPSTYLE_PROPERTY_GLYPH_SHAPE,
              "glyph-type", "Type of glyph to show.",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph), 0 },
-    { STYLE_PROP_GLYPH_NAME, STYLE_PARAM_TYPE_QUARK, ZMAPSTYLE_PROPERTY_GLYPH_NAME_5,
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph), ZMAPSTYLE_MODE_GLYPH },
+
+    { STYLE_PROP_GLYPH_NAME_5, STYLE_PARAM_TYPE_QUARK, ZMAPSTYLE_PROPERTY_GLYPH_NAME_5,
             "glyph-name for 5' end", "Glyph name used to reference glyphs config stanza",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_name_5),0 },
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_name_5),ZMAPSTYLE_MODE_GLYPH },
+
     { STYLE_PROP_GLYPH_SHAPE_5, STYLE_PARAM_TYPE_GLYPH_SHAPE, ZMAPSTYLE_PROPERTY_GLYPH_SHAPE_5,
              "glyph-type-5", "Type of glyph to show at 5' end.",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph5), 0 },
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph5), ZMAPSTYLE_MODE_GLYPH },
+
     { STYLE_PROP_GLYPH_NAME_3, STYLE_PARAM_TYPE_QUARK, ZMAPSTYLE_PROPERTY_GLYPH_NAME_3,
             "glyph-name for 3' end", "Glyph name used to reference glyphs config stanza",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_name_3),0 },
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_name_3),ZMAPSTYLE_MODE_GLYPH },
+
     { STYLE_PROP_GLYPH_SHAPE_3, STYLE_PARAM_TYPE_GLYPH_SHAPE, ZMAPSTYLE_PROPERTY_GLYPH_SHAPE_3,
              "glyph-type-3", "Type of glyph to show at 3' end.",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph3), 0 },
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph3), ZMAPSTYLE_MODE_GLYPH },
 
     { STYLE_PROP_GLYPH_ALT_COLOURS, STYLE_PARAM_TYPE_COLOUR,ZMAPSTYLE_PROPERTY_GLYPH_ALT_COLOURS,
             "alternate glyph colour", "Colours used to show glyphs when below thrashold.",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_alt_colours) ,0  },
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_alt_colours) ,ZMAPSTYLE_MODE_GLYPH  },
 
     { STYLE_PROP_GLYPH_THRESHOLD, STYLE_PARAM_TYPE_UINT, ZMAPSTYLE_PROPERTY_GLYPH_THRESHOLD,
             "glyph-threshold", "Glyph threshold for alternate coloura",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_threshold) ,0},
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_threshold) ,ZMAPSTYLE_MODE_GLYPH },
+
     { STYLE_PROP_GLYPH_STRAND, STYLE_PARAM_TYPE_GLYPH_STRAND, ZMAPSTYLE_PROPERTY_GLYPH_STRAND,
             "glyph-strand", "What to do for the reverse strand",
-            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_strand) ,0},
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_strand) ,ZMAPSTYLE_MODE_GLYPH },
+
+    { STYLE_PROP_GLYPH_ALIGN, STYLE_PARAM_TYPE_GLYPH_ALIGN, ZMAPSTYLE_PROPERTY_GLYPH_ALIGN,
+            "glyph-align", "where to centre the glyph",
+            offsetof(zmapFeatureTypeStyleStruct, mode_data.glyph.glyph_align) ,ZMAPSTYLE_MODE_GLYPH },
 
 
 
@@ -1459,7 +1469,7 @@ ZMapFeatureTypeStyle zMapStyleLegacyStyle(char *name)
                         ZMAPSTYLE_PROPERTY_GLYPH_SHAPE_3, zMapStyleGetGlyphShape("<0,0; 15,0; 15,-10>"),
 
                         ZMAPSTYLE_PROPERTY_FRAME_MODE, ZMAPSTYLE_3_FRAME_ONLY_1,
-                        ZMAPSTYLE_PROPERTY_SCORE_MODE, ZMAPSTYLE_SCORE_GLYPH_WIDTH,
+                        ZMAPSTYLE_PROPERTY_SCORE_MODE, ZMAPSCORE_WIDTH,
                         ZMAPSTYLE_PROPERTY_GLYPH_STRAND,ZMAPSTYLE_GLYPH_STRAND_FLIP_X,
                         ZMAPSTYLE_PROPERTY_SHOW_REVERSE_STRAND,TRUE,
 
@@ -1537,6 +1547,7 @@ guint zmapStyleParamSize(ZMapStyleParamType type)
   case STYLE_PARAM_TYPE_GRAPH_MODE:  return(sizeof(ZMapStyleGraphMode));  break;
   case STYLE_PARAM_TYPE_BLIXEM:      return(sizeof(ZMapStyleBlixemType)); break;
   case STYLE_PARAM_TYPE_GLYPH_STRAND:return(sizeof(ZMapStyleGlyphStrand)); break;
+  case STYLE_PARAM_TYPE_GLYPH_ALIGN: return(sizeof(ZMapStyleGlyphAlign)); break;
 
   case STYLE_PARAM_TYPE_GLYPH_SHAPE: return(sizeof(ZMapStyleGlyphShapeStruct)); break;
   case STYLE_PARAM_TYPE_SUB_FEATURES:return(sizeof(GQuark) * ZMAPSTYLE_SUB_FEATURE_MAX); break;
@@ -1610,6 +1621,7 @@ void zmap_param_spec_init(ZMapStyleParam param)
     case STYLE_PARAM_TYPE_GRAPH_MODE:          // ZMapStyleGraphMode
     case STYLE_PARAM_TYPE_BLIXEM:              // ZMapStyleBlixemType
     case STYLE_PARAM_TYPE_GLYPH_STRAND:        // ZMapStyleGlyphStrand
+    case STYLE_PARAM_TYPE_GLYPH_ALIGN:         // ZMapStyleGlyphAlign
 
     case STYLE_PARAM_TYPE_UINT:
 
@@ -1872,6 +1884,7 @@ static void zmap_feature_type_style_set_property_full(ZMapFeatureTypeStyle style
     STYLE_SET_PROP (STYLE_PARAM_TYPE_GRAPH_MODE,      ZMapStyleGraphMode);
     STYLE_SET_PROP (STYLE_PARAM_TYPE_BLIXEM,          ZMapStyleBlixemType);
     STYLE_SET_PROP (STYLE_PARAM_TYPE_GLYPH_STRAND,    ZMapStyleGlyphStrand);
+    STYLE_SET_PROP (STYLE_PARAM_TYPE_GLYPH_ALIGN,     ZMapStyleGlyphAlign);
 
     case STYLE_PARAM_TYPE_UINT:
       * (guint *) (((void *) style) + param->offset) = g_value_get_uint(value);
@@ -2051,6 +2064,7 @@ static void zmap_feature_type_style_get_property(GObject *gobject,
     STYLE_GET_PROP (STYLE_PARAM_TYPE_GRAPH_MODE      , ZMapStyleGraphMode);
     STYLE_GET_PROP (STYLE_PARAM_TYPE_BLIXEM          , ZMapStyleBlixemType);
     STYLE_GET_PROP (STYLE_PARAM_TYPE_GLYPH_STRAND    , ZMapStyleGlyphStrand);
+    STYLE_GET_PROP (STYLE_PARAM_TYPE_GLYPH_ALIGN     , ZMapStyleGlyphAlign);
 
     case STYLE_PARAM_TYPE_UINT:
       g_value_set_uint(value, * (guint *) (((void *) style) + param->offset));
diff --git a/src/zmapFeature/zmapStyleUtils.c b/src/zmapFeature/zmapStyleUtils.c
index 8bc123ea0..20ca1fd53 100755
--- a/src/zmapFeature/zmapStyleUtils.c
+++ b/src/zmapFeature/zmapStyleUtils.c
@@ -30,7 +30,7 @@
  * HISTORY:
  * Last edited: Jul 29 09:53 2009 (edgrif)
  * Created: Thu Oct 30 10:24:35 2008 (edgrif)
- * CVS info:   $Id: zmapStyleUtils.c,v 1.15 2010-04-15 11:19:03 mh17 Exp $
+ * CVS info:   $Id: zmapStyleUtils.c,v 1.16 2010-04-19 11:00:39 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -124,6 +124,7 @@ ZMAP_ENUM_FROM_STRING_FUNC(zMapStyleStr2ScoreMode,       ZMapStyleScoreMode,
 ZMAP_ENUM_FROM_STRING_FUNC(zMapStyleStr2BumpMode,        ZMapStyleBumpMode,           ZMAPBUMP_INVALID, ZMAP_STYLE_BUMP_MODE_LIST, , );
 ZMAP_ENUM_FROM_STRING_FUNC(zMapStyleStr2GlyphStrand,     ZMapStyleGlyphStrand,         ZMAPSTYLE_GLYPH_STRAND_INVALID, ZMAP_STYLE_GLYPH_STRAND_LIST, , );
 ZMAP_ENUM_FROM_STRING_FUNC(zMapStyleStr2SubFeature,     ZMapStyleSubFeature,         ZMAPSTYLE_SUB_FEATURE_INVALID, ZMAP_STYLE_SUB_FEATURE_LIST, , );
+ZMAP_ENUM_FROM_STRING_FUNC(zMapStyleStr2GlyphAlign,     ZMapStyleGlyphAlign,         ZMAPSTYLE_GLYPH_ALIGN_INVALID, ZMAP_STYLE_GLYPH_ALIGN_LIST, , );
 
 
 
@@ -147,6 +148,7 @@ ZMAP_ENUM_AS_EXACT_STRING_FUNC(zmapStyleScoreMode2ExactStr,       ZMapStyleScore
 ZMAP_ENUM_AS_EXACT_STRING_FUNC(zmapStyleBumpMode2ExactStr,     ZMapStyleBumpMode,        ZMAP_STYLE_BUMP_MODE_LIST);
 ZMAP_ENUM_AS_EXACT_STRING_FUNC(zmapStyleGlyphStrand2ExactStr,     ZMapStyleGlyphStrand,        ZMAP_STYLE_GLYPH_STRAND_LIST);
 ZMAP_ENUM_AS_EXACT_STRING_FUNC(zmapStyleSubFeature2ExactStr,     ZMapStyleSubFeature,        ZMAP_STYLE_SUB_FEATURE_LIST);
+ZMAP_ENUM_AS_EXACT_STRING_FUNC(zmapStyleGlyphAlign2ExactStr,     ZMapStyleGlyphAlign,        ZMAP_STYLE_GLYPH_ALIGN_LIST);
 
 
 /* Enum -> Short Text functions, these functions convert the enums to their corresponding short
diff --git a/src/zmapFeature/zmapStyle_I.h b/src/zmapFeature/zmapStyle_I.h
index 1b50ad6c2..2d2346e9c 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.20 2010-04-15 11:19:03 mh17 Exp $
+ * CVS info:   $Id: zmapStyle_I.h,v 1.21 2010-04-19 11:00:39 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -67,6 +67,7 @@ typedef enum
     STYLE_PARAM_TYPE_GRAPH_MODE,          // ZMapStyleGraphMode
     STYLE_PARAM_TYPE_BLIXEM,              // ZMapStyleBlixemType
     STYLE_PARAM_TYPE_GLYPH_STRAND,        // ZMapStyleGlyphStrand
+    STYLE_PARAM_TYPE_GLYPH_ALIGN,         // ZMapStyleGlyphAlign
 
     STYLE_PARAM_TYPE_GLYPH_SHAPE,         // ZMapStyleGlyphShapeStruct, external = string
     STYLE_PARAM_TYPE_SUB_FEATURES         // GQuark[ZMAPSTYLE_SUB_FEATURE_MAX], external = string
@@ -243,6 +244,7 @@ typedef struct
   ZMapStyleGlyphShapeStruct glyph3;       // shape for 3' end
   ZMapStyleFullColourStruct glyph_alt_colours;
   ZMapStyleGlyphStrand glyph_strand;
+  ZMapStyleGlyphAlign glyph_align;
   guint glyph_threshold;
 
 } ZMapStyleGlyphStruct, *ZMapStyleGlyph ;
diff --git a/src/zmapView/zmapView.c b/src/zmapView/zmapView.c
index 2147c69d7..507d15d78 100755
--- a/src/zmapView/zmapView.c
+++ b/src/zmapView/zmapView.c
@@ -29,7 +29,7 @@
  * HISTORY:
  * Last edited: Apr  7 15:59 2010 (edgrif)
  * Created: Thu May 13 15:28:26 2004 (edgrif)
- * CVS info:   $Id: zmapView.c,v 1.193 2010-04-15 11:19:03 mh17 Exp $
+ * CVS info:   $Id: zmapView.c,v 1.194 2010-04-19 11:00:39 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -97,7 +97,7 @@ typedef struct
 } UnsetDeferredLoadStylesStruct, *UnsetDeferredLoadStyles ;
 
 
-static GList *zmapViewGetIniSources(char *config_str);
+static GList *zmapViewGetIniSources(char *config_str,char **stylesfile);
 
 static ZMapView createZMapView(GtkWidget *xremote_widget, char *view_name,
 			       GList *sequences, void *app_data) ;
@@ -395,7 +395,7 @@ static GHashTable *zmapViewGetIniFeaturesets(char *config_str)
 gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
 {
   gboolean result = TRUE ;
-
+  char *stylesfile = NULL;
 
   if (zmap_view->state != ZMAPVIEW_INIT)        // && zmap_view->state != ZMAPVIEW_LOADED)
 
@@ -419,7 +419,7 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
        * and load in one call but we will almost certainly need the extra states later... */
       zmap_view->state = ZMAPVIEW_CONNECTING ;
 
-      settings_list = zmapViewGetIniSources(config_str);    // get the stanza structs from ZMap config
+      settings_list = zmapViewGetIniSources(config_str,&stylesfile);    // get the stanza structs from ZMap config
 
 
         /* There are a number of predefined methods that we require so add these in as well
@@ -437,7 +437,7 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
 
 	  free_this_list = settings_list ;
 
-	  current_server = (ZMapConfigSource)settings_list->data ;
+//	  current_server = (ZMapConfigSource)settings_list->data ;
 
 
 
@@ -450,6 +450,7 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
 	      ZMapViewConnection view_con ;
 
 	      current_server = (ZMapConfigSource)settings_list->data ;
+// if global            current_server->stylesfile = g_strdup(stylesfile);
 
             if(current_server->delayed)   // only request data when asked by otterlace
                   continue;
@@ -580,6 +581,8 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
        */
       startStateConnectionChecking(zmap_view) ;
     }
+//  if(stylesfile)
+//    g_free(stylesfile);
 
   return result ;
 }
@@ -1254,7 +1257,7 @@ char *zmapViewGetStatusAsStr(ZMapViewState state)
 
 
 
-static GList *zmapViewGetIniSources(char *config_str)
+static GList *zmapViewGetIniSources(char *config_str,char ** stylesfile)
 {
      ZMapConfigIniContext context ;
       GList *settings_list = NULL;
@@ -1266,8 +1269,17 @@ static GList *zmapViewGetIniSources(char *config_str)
             zMapConfigIniContextIncludeBuffer(context, config_str);
 
         settings_list = zMapConfigIniContextGetSources(context);
-
+#if MH17_NOT_NEEDED
+// now specified per server
+        if(stylesfile)
+        {
+            zMapConfigIniContextGetString(context,
+                              ZMAPSTANZA_APP_CONFIG,ZMAPSTANZA_APP_CONFIG,
+                              ZMAPSTANZA_APP_STYLESFILE,stylesfile);
+        }
+#endif
         zMapConfigIniContextDestroy(context);
+
       }
 
       return(settings_list);
@@ -1338,10 +1350,11 @@ void zmapViewLoadFeatures(ZMapView view, ZMapFeatureBlock block_orig, GList *req
   GHashTable *hash = NULL;
   GList * sources = NULL;
   ZMapConfigSource server;
+  char *stylesfile = NULL;
 
   gboolean requested = FALSE;
 
-  sources = zmapViewGetIniSources(NULL);
+  sources = zmapViewGetIniSources(NULL,&stylesfile);
   hash = zmapViewGetFeatureSourceHash(sources);
 
   for(;req_sources;req_sources = g_list_next(req_sources))
@@ -1357,6 +1370,7 @@ void zmapViewLoadFeatures(ZMapView view, ZMapFeatureBlock block_orig, GList *req
 	    featureset = GFFset->feature_set_id;
 	}
       server = zmapViewGetSourceFromFeatureset(hash,featureset);
+// if global            server->stylesfile = g_strdup(stylesfile);
 
       if(server)
 	{
@@ -1432,6 +1446,9 @@ void zmapViewLoadFeatures(ZMapView view, ZMapFeatureBlock block_orig, GList *req
       (*(view_cbs_G->state_change))(view, view->app_data, NULL) ;
     }
 
+//  if(stylesfile)
+//    g_free(stylesfile);
+
   if(sources)
     zMapConfigSourcesFreeList(sources);
   if(hash)
@@ -2238,7 +2255,11 @@ static gboolean dispatchContextRequests(ZMapViewConnection connection, ZMapServe
   return result ;
 }
 
-
+void printStyle(GQuark style_id, gpointer data, gpointer user_data)
+{
+      char *x = (char *) user_data;
+      printf("%s: style %s\n",x,g_quark_to_string(style_id));
+}
 
 /* This is _not_ a generalised processing function, it handles a sequence of replies from
  * a thread that build up a feature context from a source. The steps are interdependent
@@ -2356,7 +2377,6 @@ static gboolean processDataRequests(ZMapViewConnection view_con, ZMapServerReqAn
 	  zmap_view->source_2_featureset = feature_sets->source_2_featureset_out ;
 
 	if (!(zmap_view->source_2_sourcedata))
-
 	  zmap_view->source_2_sourcedata = feature_sets->source_2_sourcedata_out ;
 
 
@@ -2370,7 +2390,8 @@ static gboolean processDataRequests(ZMapViewConnection view_con, ZMapServerReqAn
 	/* Merge the retrieved styles into the views canonical style list. */
 	zmap_view->orig_styles = zMapStyleMergeStyles(zmap_view->orig_styles, get_styles->styles_out,
 						      ZMAPSTYLE_MERGE_PRESERVE) ;
-
+//printf("merging...\n");
+//g_datalist_foreach(&(zmap_view->orig_styles), printStyle, "view") ;
 	/* For dynamic loading the styles need to be set to load the features.*/
 	if (connect_data->dynamic_loading)
 	  {
diff --git a/src/zmapView/zmapViewRemoteReceive.c b/src/zmapView/zmapViewRemoteReceive.c
index 6b127ff00..d6f489eef 100755
--- a/src/zmapView/zmapViewRemoteReceive.c
+++ b/src/zmapView/zmapViewRemoteReceive.c
@@ -31,7 +31,7 @@
  * HISTORY:
  * Last edited: Mar 25 14:43 2010 (edgrif)
  * Created: Tue Jul 10 21:02:42 2007 (rds)
- * CVS info:   $Id: zmapViewRemoteReceive.c,v 1.43 2010-03-29 09:56:50 edgrif Exp $
+ * CVS info:   $Id: zmapViewRemoteReceive.c,v 1.44 2010-04-19 11:00:40 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -1238,18 +1238,27 @@ static gboolean xml_featureset_start_cb(gpointer user_data, ZMapXMLElement set_e
 	    {
 	      request_data->style_id = source_data->style_id ;
           }
+#if MH17_OLD_CODE
+// i think this was related to a deferred style and the need to avoid an assert later
+// it prevents delayed pipeServers from working as the styles are not there due to not having been requested yet
+// this should be safe as this eventaully calls loadFeatures() which does a complete step list of requests
+// including req styles and features will be dropped if there are no styles to match
 
         if (!(request_data->style = zMapFindStyle(request_data->view->orig_styles, request_data->style_id)))
           {
 		char *err_msg ;
+void printStyle(GQuark style_id, gpointer data, gpointer user_data);
 
 		err_msg = g_strdup_printf("Style %s not found in view->orig_styles",
 			  g_quark_to_string(request_data->style_id)) ;
 		zMapXMLParserRaiseParsingError(parser, err_msg) ;
+printf("%s\n",err_msg);
+g_datalist_foreach(&(request_data->view->orig_styles), printStyle, "remote") ;
 		g_free(err_msg) ;
 
 		result = FALSE ;
 	    }
+#endif
 	}
 
 
diff --git a/src/zmapWindow/items/zmapWindowGlyphItem.c b/src/zmapWindow/items/zmapWindowGlyphItem.c
index 1e8f77fd2..f41ae02fa 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.10 2010-04-15 11:19:04 mh17 Exp $
+ * CVS info:   $Id: zmapWindowGlyphItem.c,v 1.11 2010-04-19 11:00:40 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -148,6 +148,8 @@ ZMapWindowGlyphItem zMapWindowGlyphItemCreate(FooCanvasGroup *parent,
   ZMapStyleScoreMode score_mode = ZMAPSCORE_INVALID;
   double min = 0.0,max = 0.0;
   ZMapStyleGlyphStrand strand = ZMAPSTYLE_GLYPH_STRAND_INVALID;
+  ZMapStyleGlyphAlign align;
+  double offset;
 
   shape =   (which == 5) ? zMapStyleGlyphShape5(style) :
             (which == 3) ? zMapStyleGlyphShape3(style) :
@@ -188,9 +190,9 @@ ZMapWindowGlyphItem zMapWindowGlyphItemCreate(FooCanvasGroup *parent,
           if(score > max)
             score = max;
 
-          if(score_mode == ZMAPSTYLE_SCORE_GLYPH_WIDTH)
+          if(score_mode == ZMAPSCORE_WIDTH || score_mode == ZMAPSCORE_SIZE)
             width = width * score / max;
-          else if(score_mode == ZMAPSTYLE_SCORE_GLYPH_HEIGHT)
+          else if(score_mode == ZMAPSCORE_HEIGHT || score_mode == ZMAPSCORE_SIZE)
             height = height * score / max;
         }
           // invert H or V??
@@ -198,14 +200,20 @@ ZMapWindowGlyphItem zMapWindowGlyphItemCreate(FooCanvasGroup *parent,
          strand = zMapStyleGlyphStrand(style);
 
       if(strand == ZMAPSTYLE_GLYPH_STRAND_FLIP_X)
-        {
           width = -width;
-        }
 
       if(strand == ZMAPSTYLE_GLYPH_STRAND_FLIP_Y)
-        {
           height = -height;
-        }
+
+      // if niether of thse are set we'll offset by zero and default to centred glyphs
+      // they'll look silly so no need for an error messgae
+      align = zMapStyleGetAlign(style);
+      offset = zMapStyleGetWidth(style) / 2;
+      if(align == ZMAPSTYLE_GLYPH_ALIGN_LEFT)
+          x_coord -= offset;
+      else if(align == ZMAPSTYLE_GLYPH_ALIGN_RIGHT)
+          x_coord += offset;
+
 
       glyph = ZMAP_WINDOW_GLYPH_ITEM (foo_canvas_item_new(parent, ZMAP_TYPE_WINDOW_GLYPH_ITEM,
                         "x",           x_coord,
@@ -750,7 +758,7 @@ static void glyph_fill_points(ZMapWindowGlyphItem glyph)
         if(coord != GLYPH_COORD_INVALID)
           {
             coord *= glyph->width;
-            glyph->coords[j] = glyph->cx + coord;     // points are centred around the anchor of 0,0
+            glyph->coords[j] = glyph->cx + coord;    // points are centred around the anchor of 0,0
           }
         else
             glyph->coords[j] = GLYPH_CANVAS_COORD_INVALID; // zero, will be ignored
@@ -760,7 +768,7 @@ static void glyph_fill_points(ZMapWindowGlyphItem glyph)
         if(coord != GLYPH_COORD_INVALID)
           {
             coord *= glyph->height;
-            glyph->coords[j] = glyph->cy + coord;     // points are centred around the anchor of 0,0
+            glyph->coords[j] = glyph->cy + coord;    // points are centred around the anchor of 0,0
           }
         else
             glyph->coords[j] = GLYPH_CANVAS_COORD_INVALID; // zero, will be ignored
-- 
GitLab