From fe055761212107043f4a0c3d5ac77b8721dad60f Mon Sep 17 00:00:00 2001 From: mh17 <mh17> Date: Tue, 8 Jun 2010 08:31:23 +0000 Subject: [PATCH] removed g_datalist from styles and speeded up access to parameters --- src/include/ZMap/zmapConfigIni.h | 4 +- src/include/ZMap/zmapConfigStrings.h | 5 +- src/include/ZMap/zmapFeature.h | 30 +- src/include/ZMap/zmapGFF.h | 10 +- src/include/ZMap/zmapServerProtocol.h | 6 +- src/include/ZMap/zmapStyle.h | 475 +++++++++++-- src/include/ZMap/zmapUtilsDebug.h | 77 ++- src/include/ZMap/zmapView.h | 4 +- src/include/ZMap/zmapWindow.h | 44 +- src/include/ZMap/zmapWindowNavigator.h | 18 +- src/zmapConfig/zmapConfigLoader.c | 11 +- src/zmapFeature/zmapFeature.c | 17 +- src/zmapFeature/zmapFeatureContext.c | 4 +- src/zmapFeature/zmapFeatureOutput.c | 22 +- src/zmapFeature/zmapFeatureTypes.c | 642 +++--------------- src/zmapFeature/zmapFeatureUtils.c | 14 +- src/zmapFeature/zmapFeature_P.h | 8 +- src/zmapFeature/zmapStyle.c | 20 +- src/zmapFeature/zmapStyleUtils.c | 12 +- src/zmapFeature/zmapStyle_I.h | 296 +------- src/zmapGFF/gffparser.c | 32 +- src/zmapGFF/zmapGFF2Dumper.c | 146 ++-- src/zmapGFF/zmapGFF2parser.c | 41 +- src/zmapGFF/zmapGFF_P.h | 13 +- src/zmapServer/acedb/acedbServer.c | 42 +- src/zmapServer/das/dasServer.c | 34 +- src/zmapServer/das/dasServer_P.h | 11 +- src/zmapServer/pipe/pipeServer.c | 14 +- src/zmapServer/zmapServer.c | 8 +- src/zmapServer/zmapServer.h | 12 +- src/zmapServer/zmapServerProtocolHandler.c | 16 +- src/zmapServer/zmapServerPrototype.h | 8 +- src/zmapUtils/zmapGLibUtils.c | 47 +- src/zmapUtils/zmapUtils.c | 36 +- src/zmapUtils/zmapUtilsConfig.c | 26 +- src/zmapView/zmapView.c | 96 +-- src/zmapView/zmapViewRemoteReceive.c | 6 +- src/zmapView/zmapView_P.h | 4 +- .../items/zmapWindowAlignmentFeature.c | 6 +- .../items/zmapWindowAlignmentFeature.h | 15 +- .../items/zmapWindowAssemblyFeature.h | 15 +- src/zmapWindow/items/zmapWindowBasicFeature.c | 17 +- src/zmapWindow/items/zmapWindowBasicFeature.h | 15 +- src/zmapWindow/items/zmapWindowCanvasItem.c | 28 +- src/zmapWindow/items/zmapWindowCanvasItem.h | 17 +- .../items/zmapWindowContainerAlignment.h | 15 +- .../items/zmapWindowContainerBlock.h | 23 +- .../items/zmapWindowContainerChildren.h | 15 +- .../items/zmapWindowContainerContext.h | 15 +- .../items/zmapWindowContainerFeatureSet.c | 18 +- .../items/zmapWindowContainerFeatureSet.h | 19 +- .../zmapWindowContainerFeatureSetUtils.c | 18 +- .../items/zmapWindowContainerGroup.c | 160 ++--- .../items/zmapWindowContainerGroup.h | 30 +- .../items/zmapWindowContainerStrand.h | 15 +- src/zmapWindow/items/zmapWindowGlyphItem.h | 8 +- src/zmapWindow/items/zmapWindowLongItem.h | 17 +- .../items/zmapWindowSequenceFeature.h | 15 +- src/zmapWindow/items/zmapWindowTextFeature.h | 15 +- src/zmapWindow/items/zmapWindowTextItem.h | 22 +- .../items/zmapWindowTranscriptFeature.h | 15 +- src/zmapWindow/zmapWindow.c | 41 +- src/zmapWindow/zmapWindowColBump.c | 5 +- src/zmapWindow/zmapWindowDraw.c | 44 +- src/zmapWindow/zmapWindowDrawFeatures.c | 45 +- src/zmapWindow/zmapWindowDump.c | 4 +- src/zmapWindow/zmapWindowFeature.c | 8 +- src/zmapWindow/zmapWindowItemFactory.c | 5 +- src/zmapWindow/zmapWindowNavigator.c | 316 ++++----- src/zmapWindow/zmapWindowRemoteReceive.c | 100 +-- src/zmapWindow/zmapWindowSearch.c | 68 +- src/zmapWindow/zmapWindowUtils.c | 27 +- src/zmapWindow/zmapWindow_P.h | 112 +-- 73 files changed, 1753 insertions(+), 1866 deletions(-) diff --git a/src/include/ZMap/zmapConfigIni.h b/src/include/ZMap/zmapConfigIni.h index 527a6f68c..8e4c79a40 100755 --- a/src/include/ZMap/zmapConfigIni.h +++ b/src/include/ZMap/zmapConfigIni.h @@ -29,7 +29,7 @@ * HISTORY: * Last edited: May 26 14:53 2009 (edgrif) * Created: Thu Sep 11 10:40:13 2008 (rds) - * CVS info: $Id: zmapConfigIni.h,v 1.14 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: zmapConfigIni.h,v 1.15 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ @@ -144,7 +144,7 @@ GList *zMapConfigIniContextGetSources(ZMapConfigIniContext context) ; GList *zMapConfigIniContextGetNamed(ZMapConfigIniContext context, char *stanza_name) ; GList *zMapConfigIniContextGetStyleList(ZMapConfigIniContext context,char *styles_list_in); -gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GData **styles_out); +gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GHashTable **styles_out); GHashTable *zMapConfigIniGetFeatureset2Column(ZMapConfigIniContext context,GHashTable *hash,GHashTable *hdesc); GHashTable *zMapConfigIniGetGlyph(ZMapConfigIniContext context); diff --git a/src/include/ZMap/zmapConfigStrings.h b/src/include/ZMap/zmapConfigStrings.h index a53cb501b..03ce1232c 100755 --- a/src/include/ZMap/zmapConfigStrings.h +++ b/src/include/ZMap/zmapConfigStrings.h @@ -40,7 +40,7 @@ * HISTORY: * Last edited: Mar 2 14:19 2010 (edgrif) * Created: Tue Apr 25 14:36:16 2006 (edgrif) - * CVS info: $Id: zmapConfigStrings.h,v 1.31 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: zmapConfigStrings.h,v 1.32 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_CONFIG_STRINGS_H @@ -193,7 +193,7 @@ //#define ZMAPSTANZA_APP_STYLESFILE "stylesfile" #define ZMAPSTANZA_APP_LEGACY_STYLES "legacy-styles" #define ZMAPSTANZA_APP_XREMOTE_DEBUG "xremote-debug" -#define ZMAPSTANZA_APP_COLUMNS "columns" +#define ZMAPSTANZA_APP_COLUMNS "columns" /*! @addtogroup config_stanzas @@ -717,6 +717,7 @@ #define ZMAPSTANZA_DEBUG_APP_THREADS "threads" #define ZMAPSTANZA_DEBUG_APP_FEATURE2STYLE "feature2style" #define ZMAPSTANZA_DEBUG_APP_STYLES "styles" +#define ZMAPSTANZA_DEBUG_APP_TIMING "timing" // output timing of various things to STDOUT /*! @addtogroup config_stanzas diff --git a/src/include/ZMap/zmapFeature.h b/src/include/ZMap/zmapFeature.h index dbf2fef9e..adcfee459 100755 --- a/src/include/ZMap/zmapFeature.h +++ b/src/include/ZMap/zmapFeature.h @@ -27,7 +27,7 @@ * HISTORY: * Last edited: Mar 3 13:40 2010 (edgrif) * Created: Fri Jun 11 08:37:19 2004 (edgrif) - * CVS info: $Id: zmapFeature.h,v 1.174 2010-04-22 14:31:52 mh17 Exp $ + * CVS info: $Id: zmapFeature.h,v 1.175 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_FEATURE_H @@ -410,6 +410,8 @@ typedef struct ZMapFeatureSetStruct_ set of ZMapFeatureStruct. */ char *description ; /* As it says... */ + ZMapFeatureTypeStyle style; + } ZMapFeatureSetStruct, *ZMapFeatureSet ; @@ -546,9 +548,13 @@ typedef struct ZMapFeatureStruct_ "trans_splice_acceptor_site", this might be recognised SO term or not. */ + // style id tp be removed when style fully working GQuark style_id ; /* Style defining how this feature is processed. (use Styles _unique_ id.) */ + ZMapFeatureTypeStyle style; // pointer to the style structure + + /* coords are _always_ with reference to forward strand, i.e. x1 <= x2, strand flag gives the * strand of the feature. */ Coord x1, x2 ; @@ -685,7 +691,7 @@ typedef ZMapFeatureContextExecuteStatus (*ZMapGDataRecurseFunc)(GQuark key_id, char **error); typedef gboolean (*ZMapFeatureDumpFeatureFunc)(ZMapFeatureAny feature_any, - GData *styles, + GHashTable *styles, GString *dump_string_in_out, GError **error, gpointer user_data); @@ -697,7 +703,7 @@ ZMapFeatureAny zMapFeatureAnyCreate(ZMapStyleMode feature_type) ; ZMapFeatureAny zMapFeatureAnyCopy(ZMapFeatureAny orig_feature_any) ; gboolean zMapFeatureAnyFindFeature(ZMapFeatureAny feature_set, ZMapFeatureAny feature) ; ZMapFeatureAny zMapFeatureAnyGetFeatureByID(ZMapFeatureAny feature_set, GQuark feature_id) ; -gboolean zMapFeatureAnyAddModesToStyles(ZMapFeatureAny feature_any, GData *styles) ; +gboolean zMapFeatureAnyAddModesToStyles(ZMapFeatureAny feature_any, GHashTable *styles) ; gboolean zMapFeatureAnyRemoveFeature(ZMapFeatureAny feature_set, ZMapFeatureAny feature) ; void zMapFeatureAnyDestroy(ZMapFeatureAny feature) ; @@ -773,7 +779,7 @@ gboolean zMapFeatureAddAssemblyPathData(ZMapFeature feature, gboolean zMapFeatureSetCoords(ZMapStrand strand, int *start, int *end, int *query_start, int *query_end) ; void zMapFeature2MasterCoords(ZMapFeature feature, double *feature_x1, double *feature_x2) ; -void zMapFeatureReverseComplement(ZMapFeatureContext context, GData *styles) ; +void zMapFeatureReverseComplement(ZMapFeatureContext context, GHashTable *styles) ; ZMapFrame zMapFeatureFrame(ZMapFeature feature) ; gboolean zMapFeatureAddURL(ZMapFeature feature, char *url) ; gboolean zMapFeatureAddLocus(ZMapFeature feature, GQuark locus_id) ; @@ -926,35 +932,35 @@ char *zMapFeatureName(ZMapFeatureAny any_feature) ; char *zMapFeatureCanonName(char *feature_name) ; ZMapFeatureTypeStyle zMapFeatureGetStyle(ZMapFeatureAny feature) ; gboolean zMapSetListEqualStyles(GList **feature_set_names, GList **styles) ; -gboolean zMapFeatureAnyForceModesToStyles(ZMapFeatureAny feature_any, GData *styles) ; +gboolean zMapFeatureAnyForceModesToStyles(ZMapFeatureAny feature_any, GHashTable *styles) ; /* Probably should be merged at some time.... */ -gboolean zMapFeatureDumpStdOutFeatures(ZMapFeatureContext feature_context, GData *styles, GError **error_out) ; -gboolean zMapFeatureDumpToFileName(ZMapFeatureContext feature_context,char *filename,char *header, GData *styles, GError **error_out); -gboolean zMapFeatureContextDump(ZMapFeatureContext feature_context, GData *styles, +gboolean zMapFeatureDumpStdOutFeatures(ZMapFeatureContext feature_context, GHashTable *styles, GError **error_out) ; +gboolean zMapFeatureDumpToFileName(ZMapFeatureContext feature_context,char *filename,char *header, GHashTable *styles, GError **error_out); +gboolean zMapFeatureContextDump(ZMapFeatureContext feature_context, GHashTable *styles, GIOChannel *file, GError **error_out) ; gboolean zMapFeatureContextDumpToFile(ZMapFeatureAny feature_any, - GData *styles, + GHashTable *styles, ZMapFeatureDumpFeatureFunc dump_func, gpointer dump_user_data, GIOChannel *dump_file, GError **dump_error_out); gboolean zMapFeatureContextRangeDumpToFile(ZMapFeatureAny dump_set, - GData *styles, + GHashTable *styles, ZMapSpan span_data, ZMapFeatureDumpFeatureFunc dump_func, gpointer dump_user_data, GIOChannel *dump_file, GError **dump_error_out) ; gboolean zMapFeatureListDumpToFile(GList *feature_list, - GData *styles, + GHashTable *styles, ZMapFeatureDumpFeatureFunc dump_func, gpointer dump_user_data, GIOChannel *dump_file, GError **dump_error_out); gboolean zMapFeatureListForeachDumperCreate(ZMapFeatureDumpFeatureFunc dump_func, - GData *styles, + GHashTable *styles, gpointer dump_user_data, GDestroyNotify dump_user_free, GIOChannel *dump_file, diff --git a/src/include/ZMap/zmapGFF.h b/src/include/ZMap/zmapGFF.h index 5c9970606..82a594796 100755 --- a/src/include/ZMap/zmapGFF.h +++ b/src/include/ZMap/zmapGFF.h @@ -30,7 +30,7 @@ * HISTORY: * Last edited: Apr 21 18:23 2010 (edgrif) * Created: Sat May 29 13:18:32 2004 (edgrif) - * CVS info: $Id: zmapGFF.h,v 1.23 2010-05-19 13:15:31 mh17 Exp $ + * CVS info: $Id: zmapGFF.h,v 1.24 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_GFF_H @@ -104,7 +104,7 @@ typedef struct ZMapGFFParser zMapGFFCreateParser(void) ; -gboolean zMapGFFParserInitForFeatures(ZMapGFFParser parser, GData *sources, gboolean parse_only) ; +gboolean zMapGFFParserInitForFeatures(ZMapGFFParser parser, GHashTable *sources, gboolean parse_only) ; gboolean zMapGFFParseHeader(ZMapGFFParser parser, char *line, gboolean *header_finished) ; gboolean zMapGFFParseLine(ZMapGFFParser parser, char *line) ; gboolean zMapGFFParseLineLength(ZMapGFFParser parser, char *line, gsize line_length) ; @@ -128,10 +128,10 @@ gboolean zMapGFFTerminated(ZMapGFFParser parser) ; void zMapGFFSetFreeOnDestroy(ZMapGFFParser parser, gboolean free_on_destroy) ; void zMapGFFDestroyParser(ZMapGFFParser parser) ; -gboolean zMapGFFDump(ZMapFeatureAny dump_set, GData *styles, GIOChannel *file, GError **error_out); -gboolean zMapGFFDumpRegion(ZMapFeatureAny dump_set, GData *styles, +gboolean zMapGFFDump(ZMapFeatureAny dump_set, GHashTable *styles, GIOChannel *file, GError **error_out); +gboolean zMapGFFDumpRegion(ZMapFeatureAny dump_set, GHashTable *styles, ZMapSpan region_span, GIOChannel *file, GError **error_out) ; -gboolean zMapGFFDumpForeachList(ZMapFeatureAny first_feature, GData *styles, +gboolean zMapGFFDumpForeachList(ZMapFeatureAny first_feature, GHashTable *styles, GIOChannel *file, GError **error_out, char *sequence, GFunc *list_func_out, gpointer *list_data_out) ; diff --git a/src/include/ZMap/zmapServerProtocol.h b/src/include/ZMap/zmapServerProtocol.h index 74774b3a3..8f05cb984 100755 --- a/src/include/ZMap/zmapServerProtocol.h +++ b/src/include/ZMap/zmapServerProtocol.h @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Jan 14 09:49 2010 (edgrif) * Created: Wed Feb 2 11:47:16 2005 (edgrif) - * CVS info: $Id: zmapServerProtocol.h,v 1.33 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: zmapServerProtocol.h,v 1.34 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_PROTOCOL_H @@ -182,7 +182,7 @@ typedef struct * themseleves. This is completely data source dependent. */ gboolean server_styles_have_mode ; - GData *styles_out ; /* List of prespecified styles or NULL + GHashTable *styles_out ; /* List of prespecified styles or NULL to get all available styles. */ } ZMapServerReqStylesStruct, *ZMapServerReqStyles ; @@ -204,7 +204,7 @@ typedef struct ZMapServerReqType type ; ZMapServerResponseType response ; - GData *styles ; /* Needed for some features to control + GHashTable *styles ; /* Needed for some features to control how they are fetched. */ ZMapFeatureContext context ; /* Returned feature sets. */ diff --git a/src/include/ZMap/zmapStyle.h b/src/include/ZMap/zmapStyle.h index f57a7d925..e254e7463 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.57 2010-05-26 12:02:49 mh17 Exp $ + * CVS info: $Id: zmapStyle.h,v 1.58 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_STYLE_H @@ -453,16 +453,337 @@ ZMAP_DEFINE_ENUM(ZMapStyleMergeMode, ZMAP_STYLE_MERGE_MODE_LIST) ; /* Note the naming here in the macros. ZMAP_TYPE_FEATURE_TYPE_STYLE seemed confusing... */ #define ZMAP_TYPE_FEATURE_STYLE (zMapFeatureTypeStyleGetType()) + +#if GOBJ_CAST +#define ZMAP_FEATURE_STYLE(obj) ((ZMapFeatureTypeStyle) obj) +#define ZMAP_FEATURE_STYLE_CONST(obj) ((ZMapFeatureTypeStyle const) obj) +#else #define ZMAP_FEATURE_STYLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_FEATURE_STYLE, zmapFeatureTypeStyle)) #define ZMAP_FEATURE_STYLE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_FEATURE_STYLE, zmapFeatureTypeStyle const)) +#endif + #define ZMAP_FEATURE_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_FEATURE_STYLE, zmapFeatureTypeStyleClass)) #define ZMAP_IS_FEATURE_STYLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_FEATURE_STYLE)) #define ZMAP_FEATURE_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_FEATURE_STYLE, zmapFeatureTypeStyleClass)) -/* Instance */ -typedef struct _zmapFeatureTypeStyleStruct zmapFeatureTypeStyle, *ZMapFeatureTypeStyle ; +// ----- style structs moved here for faster access ------ + +/*! @addtogroup zmapstyles + * @{ + * */ + + +/*! @struct ZMapStyleColour zmapStyle_P.h + * @brief ZMap object colours + * + * All ZMap objects can potentially have a border colour, a fill colour and a draw colour + * which can be used to "draw" over the fill colour. */ + +typedef struct +{ + struct + { + unsigned int draw : 1 ; + unsigned int fill : 1 ; + unsigned int border : 1 ; + } fields_set ; + + GdkColor draw ; /* Overlaid on fill colour. */ + GdkColor fill ; /* Fill/background colour. */ + GdkColor border ; /* Surround/line colour. */ +} ZMapStyleColourStruct, *ZMapStyleColour ; + + +/*! @struct ZMapStyleFullColour zmapStyle_P.h + * @brief ZMap feature colours + * + * All features in ZMap can be selected and hence must have both "normal" and "selected" + * colours. */ +typedef struct +{ + ZMapStyleColourStruct normal ; + ZMapStyleColourStruct selected ; +} ZMapStyleFullColourStruct, *ZMapStyleFullColour ; + +/* At most 6 colour specs can be given for any one field (i.e. all the combinations of selected, + * normal and draw, fill, border. */ +enum {ZMAPSTYLE_MAX_COLOUR_SPECS = 6} ;/* Instance */ + + + + +/*! Styles have different modes, e.g. graph, alignment etc, information specific to a particular + * style is held in its own struct. */ + + +/*! @struct ZMapBasicGraph zmapStyle_P.h + * @brief Basic feature + * + * < currently this is empty > */ +typedef struct +{ + char *dummy ; + +} ZMapStyleBasicStruct, *ZMapStyleBasic ; + +/*! @struct ZMapSequenceGraph zmapStyle_P.h + * @brief Sequence feature + * + * (currently this is empty) */ +typedef struct +{ + char *dummy ; + +} ZMapStyleSequenceStruct, *ZMapStyleSequence ; + +/*! @struct ZMapTextGraph zmapStyle_P.h + * @brief Text feature + * + * (currently this is empty) */ +typedef struct +{ + char *font; + +} ZMapStyleTextStruct, *ZMapStyleText ; + + + +/*! @struct ZMapStyleGraph zmapStyle_P.h + * @brief Graph feature + * + * Draws a feature as a graph, the feature must contain graph points. */ +typedef struct +{ + ZMapStyleGraphMode mode ; /*!< Graph style. */ + + double baseline ; /*!< zero level for graph. */ + +} ZMapStyleGraphStruct, *ZMapStyleGraph ; + + + + + +/*! @struct ZMapStyleGlyph zmapStyle_P.h + * @brief Glyph feature + * + * Draws shapes of various kinds, e.g. splice site indicators etc. */ +typedef struct +{ + // sub feature glyphs or glyphs for glyph mode + GQuark glyph_name,glyph_name_5,glyph_name_3; + ZMapStyleGlyphShapeStruct glyph; // single glyph or unspecified 5' or 3' end + ZMapStyleGlyphShapeStruct glyph5; // shape for 5' end + ZMapStyleGlyphShapeStruct glyph3; // shape for 3' end + ZMapStyleFullColourStruct glyph_alt_colours; + ZMapStyleGlyphStrand glyph_strand; + ZMapStyleGlyphAlign glyph_align; + guint glyph_threshold; + +} ZMapStyleGlyphStruct, *ZMapStyleGlyph ; + + + +/*! @struct ZMapStyleAlignment zmapStyle_P.h + * @brief Alignment feature + * + * Draws an alignment as a series of blocks joined by straight lines. The lines can be coloured + * to indicate colinearity between adjacent blocks. */ +typedef struct + { + /* If set then blixem will be run with nucleotide or peptide sequences for the features. */ + ZMapStyleBlixemType blixem_type ; + + gboolean pfetchable ; /* TRUE => alignments have pfetch entries. */ + + gboolean allow_misalign; /* TRUE => ref and match sequences + don't have to be exactly same + length, ref coords dominate. */ + + /*! Allowable align errors, used to decide whether a match should be classified as "perfect". + * between_align_error is used to assess several alignments (e.g. for exon matches) if join_homols = TRUE + * + * Number is allowable number of missing bases between blocks/alignments, default is 0. */ + unsigned int between_align_error ; + + /*! Colours for bars joining up intra/inter alignment gaps. */ + ZMapStyleFullColourStruct perfect ; + ZMapStyleFullColourStruct colinear ; + ZMapStyleFullColourStruct noncolinear ; + ZMapStyleColumnDisplayState unmarked_colinear; /* paint colinear lines even if not marked */ + + /* Options for processing gapped aligns. */ + gboolean parse_gaps ; /* TRUE means parse gaps from input data, */ + gboolean show_gaps ; /* TRUE means gaps within alignment are displayed, + otherwise alignment is displayed as a single block. */ + +} ZMapStyleAlignmentStruct, *ZMapStyleAlignment ; + + +/*! @struct ZMapStyleTranscript zmapStyle_P.h + * @brief Transcript feature + * + * Draws a transcript as a series of boxes joined by angled lines. */ +typedef struct +{ + ZMapStyleFullColourStruct CDS_colours ; /*!< Colour for CDS part of feature. */ + +} ZMapStyleTranscriptStruct, *ZMapStyleTranscript ; + + +/*! @struct ZMapStyleAssemblyPath zmapStyle_P.h + * @brief AssemblyPath feature + * + * Draws an assembly path as a series of boxes placed alternately to form a tiling path. */ +typedef struct +{ + ZMapStyleFullColourStruct non_path_colours ; /*!< Colour for non-assembly part of feature. */ + +} ZMapStyleAssemblyPathStruct, *ZMapStyleAssemblyPath ; + + +/* THIS STRUCT NEEDS A MAGIC PTR, ONCE IT HAS ONE THEN ADD A TEST TO zmapStyleIsValid() FOR IT.... */ + +/*! @struct ZMapFeatureTypeStyle zmapStyle_P.h + * @brief ZMap Style + * + * ZMap Style definition, the style must have a mode which specifies what sort of + * of feature the style represents. */ +typedef struct //_zmapFeatureTypeStyleStruct +{ + GObject __parent__; + +#define STYLE_IS_SET_SIZE ((_STYLE_PROP_N_ITEMS + 7) / 8) + guchar is_set[STYLE_IS_SET_SIZE]; // flags to say whether fields are set + // includes mode dependant fields + // but colours have thier own flags + + /*! _All_ styles must have these fields set, no other fields are compulsory. */ + GQuark original_id ; /*!< Original name. */ + GQuark unique_id ; /*!< Name normalised to be unique. */ + + + /*! Data fields for the style. */ + + + GQuark parent_id ; /*!< Styles can inherit from other + styles, the parent style _must_ be + identified by its unique id. */ + + char *description ; /*!< Description of what this style + represents. */ + + ZMapStyleMode mode ; /*!< Specifies how features that + reference this style will be processed. */ + // must be set before setting mode dependant fields + // and may not be unset/changed afterwards + + GQuark sub_features[ZMAPSTYLE_SUB_FEATURE_MAX]; // style ID quarks indexed by SUBFEATURE ENUM + + ZMapStyleFullColourStruct colours ; /*!< Main feature colours. */ + + /*! Colours for when feature is shown in frames. */ + ZMapStyleFullColourStruct frame0_colours ; + ZMapStyleFullColourStruct frame1_colours ; + ZMapStyleFullColourStruct frame2_colours ; + + /*! Colours for when feature is shown stranded by colour */ + ZMapStyleFullColourStruct strand_rev_colours; + + + ZMapStyleColumnDisplayState col_display_state ; /* Controls how/when col is displayed. */ + + ZMapStyleBumpMode default_bump_mode ; /*!< Allows return to original bump mode. */ + ZMapStyleBumpMode curr_bump_mode ; /*!< Controls how features are grouped + into sub columns within a column. */ + double bump_spacing ; /*!< gap between bumped features. */ + + ZMapStyle3FrameMode frame_mode ; /*!< Controls how frame sensitive + features are displayed. */ + + double min_mag ; /*!< Don't display if fewer bases/line */ + double max_mag ; /*!< Don't display if more bases/line */ + + double width ; /*!< column width */ + + ZMapStyleScoreMode score_mode ; /*!< Controls width of features that + have scores. */ + double min_score, max_score ; /*!< Min/max for score width calc. */ + + + /*! GFF feature dumping, allows specifying of source/feature types independently of feature + * attributes. */ + GQuark gff_source ; + GQuark gff_feature ; + + + /*! State information for the style. */ + gboolean displayable; /* FALSE means never, ever display, + for TRUE see col_display_state. */ + + + gboolean show_when_empty; /*!< If FALSE, features' column is + displayed even if there are no features. */ + gboolean bump_fixed; /*!< If TRUE then bump mode cannot be changed. */ + + gboolean showText; /*!< Should feature text be displayed. */ + + /*! Strand, show reverse and frame are all linked: something that is frame specific must be + * strand specific as well.... */ + gboolean strand_specific; /*!< Feature that is on one strand of the dna. */ + gboolean show_rev_strand; /*!< Only display the feature on the + reverse strand if this is set. */ + gboolean hide_fwd_strand; /* don't show the fwd strand when revcomp'd */ + gboolean show_only_in_separator; + + gboolean directional_end; /*!< Display pointy ends on exons etc. */ + + gboolean deferred; /* flag for to say if this style is deferred loaded */ + + gboolean loaded; /* flag to say if we're loaded */ + + gboolean inherited; // style has inherited it's parents + + /*! Mode specific fields, see docs for individual structs. */ + union + { + ZMapStyleBasicStruct basic ; + ZMapStyleSequenceStruct sequence ; + ZMapStyleTextStruct text ; + ZMapStyleTranscriptStruct transcript ; + ZMapStyleAssemblyPathStruct assembly_path ; + ZMapStyleAlignmentStruct alignment ; + ZMapStyleGraphStruct graph ; + ZMapStyleGlyphStruct glyph ; + } mode_data ; + + +} zmapFeatureTypeStyleStruct, +#ifdef ZMAPSTYLE_INTERNAL +zmapFeatureTypeStyle, *ZMapFeatureTypeStyle; +#else +zmapFeatureTypeStyle; + +// non internal functions can ref style members but not change them +// MH17: why have I never liked typedefs? +// is it because they have to so finely balanced that you can't make them compile?? +// we need a pointer to a const style not a const pointer to a volatile style +// typdefs are atomic and not text substitutions. +// try 'google C typedef const pointer' for a few explanations +typedef const zmapFeatureTypeStyle* ZMapFeatureTypeStyle ; +#endif + + + +/* Instance */ +//#ifdef ZMAPSTYLE_INTERNAL +//typedef struct _zmapFeatureTypeStyleStruct zmapFeatureTypeStyle, *ZMapFeatureTypeStyle ; +//#else +// read-only for the public +//typedef struct _zmapFeatureTypeStyleStruct zmapFeatureTypeStyle, *ZMapFeatureTypeStyle const ; +//#endif /* Class */ typedef struct _zmapFeatureTypeStyleClassStruct zmapFeatureTypeStyleClass, *ZMapFeatureTypeStyleClass ; @@ -471,6 +792,8 @@ typedef struct _zmapFeatureTypeStyleClassStruct zmapFeatureTypeStyleClass, *ZMa + + /* Public funcs */ GType zMapFeatureTypeStyleGetType(void); @@ -531,58 +854,85 @@ gboolean zMapStyleIsTrueFeature(ZMapFeatureTypeStyle style) ; ZMapStyleGlyphShape zMapStyleGetGlyphShape(gchar *shape); ZMapFeatureTypeStyle zMapStyleLegacyStyle(char *name); -unsigned int zmapStyleGetWithinAlignError(ZMapFeatureTypeStyle style) ; -GQuark zMapStyleGetUniqueID(ZMapFeatureTypeStyle style) ; -GQuark zMapStyleGetID(ZMapFeatureTypeStyle style) ; +//unsigned int zmapStyleGetWithinAlignError(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetWithinAlignError(style) (style->mode_data.alignment.between_align_error) +//GQuark zMapStyleGetUniqueID(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetUniqueID(style) (style->unique_id) +//GQuark zMapStyleGetID(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetID(style) (style->original_id) + GQuark zMapStyleGetSubFeature(ZMapFeatureTypeStyle style,ZMapStyleSubFeature i); gboolean zMapStyleSetColours(ZMapFeatureTypeStyle style, ZMapStyleParamId target, ZMapStyleColourType type, char *fill, char *draw, char *border) ; void zMapStyleSetDisplay(ZMapFeatureTypeStyle style, ZMapStyleColumnDisplayState col_show) ; void zMapStyleSetMode(ZMapFeatureTypeStyle style, ZMapStyleMode mode) ; -ZMapStyleMode zMapStyleGetMode(ZMapFeatureTypeStyle style) ; -const gchar *zMapStyleGetName(ZMapFeatureTypeStyle style) ; -ZMapStyleScoreMode zMapStyleGetScoreMode(ZMapFeatureTypeStyle style); -ZMapStyleBumpMode zMapStyleGetBumpMode(ZMapFeatureTypeStyle style) ; +//ZMapStyleMode zMapStyleGetMode(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetMode(style) (style->mode) +//const gchar *zMapStyleGetName(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetName(style) (g_quark_to_string(style->original_id)) +//ZMapStyleScoreMode zMapStyleGetScoreMode(ZMapFeatureTypeStyle style); +#define zMapStyleGetScoreMode(style) (style->score_mode) +//ZMapStyleBumpMode zMapStyleGetBumpMode(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetBumpMode(style) (style->curr_bump_mode) void zMapStyleSetBumpMode(ZMapFeatureTypeStyle style, ZMapStyleBumpMode bump_mode) ; -const gchar *zMapStyleGetGFFSource(ZMapFeatureTypeStyle style) ; -const gchar *zMapStyleGetGFFFeature(ZMapFeatureTypeStyle style) ; +//const gchar *zMapStyleGetGFFSource(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetGFFSource(style) g_quark_to_string(style->gff_source) // NULL quark gives NULL string +//const gchar *zMapStyleGetGFFFeature(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetGFFFeature(style) g_quark_to_string(style->gff_feature) void zMapStyleSetDescription(ZMapFeatureTypeStyle style, char *description) ; -ZMapStyleBumpMode zMapStyleGetDefaultBumpMode(ZMapFeatureTypeStyle style); -double zMapStyleGetWidth(ZMapFeatureTypeStyle style) ; -double zMapStyleGetBumpSpace(ZMapFeatureTypeStyle style) ; -ZMapStyleColumnDisplayState zMapStyleGetDisplay(ZMapFeatureTypeStyle style) ; - -ZMapStyleGlyphShape zMapStyleGlyphShape(ZMapFeatureTypeStyle style); +//ZMapStyleBumpMode zMapStyleGetDefaultBumpMode(ZMapFeatureTypeStyle style); +#define zMapStyleGetDefaultBumpMode(style) (style->default_bump_mode) +//double zMapStyleGetWidth(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetWidth(style) (style->width) +//double zMapStyleGetBumpSpace(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetBumpSpace(style) (style->bump_spacing) +//ZMapStyleColumnDisplayState zMapStyleGetDisplay(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetDisplay(style) (style->col_display_state) + +//ZMapStyleGlyphShape zMapStyleGlyphShape(ZMapFeatureTypeStyle style); +#define zMapStyleGlyphShape(style) (&style->mode_data.glyph.glyph) ZMapStyleGlyphShape zMapStyleGlyphShape5(ZMapFeatureTypeStyle style); ZMapStyleGlyphShape zMapStyleGlyphShape3(ZMapFeatureTypeStyle style); void zMapStyleSetShowGaps(ZMapFeatureTypeStyle style, gboolean show_gaps) ; void zMapStyleSetJoinAligns(ZMapFeatureTypeStyle style, unsigned int between_align_error) ; -GQuark zMapStyleGetID(ZMapFeatureTypeStyle style) ; -double zMapStyleGetMinMag(ZMapFeatureTypeStyle style) ; -double zMapStyleGetMaxMag(ZMapFeatureTypeStyle style) ; + +//double zMapStyleGetMinMag(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetMinMag(style) (style->min_mag) +//double zMapStyleGetMaxMag(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetMaxMag(style) (style->max_mag) void zMapStyleGetStrandAttrs(ZMapFeatureTypeStyle type, gboolean *strand_specific, gboolean *show_rev_strand, ZMapStyle3FrameMode *frame_mode) ; -double zMapStyleGetMaxScore(ZMapFeatureTypeStyle style) ; -double zMapStyleGetMinScore(ZMapFeatureTypeStyle style) ; -gboolean zMapStyleGetShowWhenEmpty(ZMapFeatureTypeStyle style); +//double zMapStyleGetMaxScore(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetMaxScore(style) (style->max_score) +//double zMapStyleGetMinScore(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetMinScore(style) (style->min_score) +//gboolean zMapStyleGetShowWhenEmpty(ZMapFeatureTypeStyle style); +#define zMapStyleGetShowWhenEmpty(style) (style->show_when_empty) gboolean zMapStyleGetColours(ZMapFeatureTypeStyle style, ZMapStyleParamId 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) ; +//char *zMapStyleGetDescription(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetDescription(style) (style->description) + + +//int zMapStyleGlyphThreshold(ZMapFeatureTypeStyle style); +#define zMapStyleGlyphThreshold(style) (style->mode_data.glyph.glyph_threshold) -int zMapStyleGlyphThreshold(ZMapFeatureTypeStyle style); +#define zMapStyleGetUnmarked(style) (style->mode_data.alignment.unmarked_colinear) -ZMapStyleGlyphStrand zMapStyleGlyphStrand(ZMapFeatureTypeStyle style); -ZMapStyleGlyphAlign zMapStyleGetAlign(ZMapFeatureTypeStyle style); +//ZMapStyleGlyphStrand zMapStyleGlyphStrand(ZMapFeatureTypeStyle style); +#define zMapStyleGlyphStrand(style) (style->mode_data.glyph.glyph_strand) +//ZMapStyleGlyphAlign zMapStyleGetAlign(ZMapFeatureTypeStyle style); +#define zMapStyleGetAlign(style) (style->mode_data.glyph.glyph_align) -void zMapStyleGetGappedAligns(ZMapFeatureTypeStyle style, gboolean *parse_gaps, gboolean *show_gaps) ; +//void zMapStyleGetGappedAligns(ZMapFeatureTypeStyle style, gboolean *parse_gaps, gboolean *show_gaps) ; -double zMapStyleGetBumpWidth(ZMapFeatureTypeStyle style) ; +//double zMapStyleGetBumpWidth(ZMapFeatureTypeStyle style) ; +#define zMapStyleGetBumpWidth(style) (style->bump_spacing) // yes really void zMapStyleSetParent(ZMapFeatureTypeStyle style, char *parent_name) ; void zMapStyleSetMag(ZMapFeatureTypeStyle style, double min_mag, double max_mag) ; void zMapStyleSetGraph(ZMapFeatureTypeStyle style, ZMapStyleGraphMode mode, double min, double max, double baseline) ; @@ -598,7 +948,7 @@ void zMapStyleSetEndStyle(ZMapFeatureTypeStyle style, gboolean directional) ; void zMapStyleSetGappedAligns(ZMapFeatureTypeStyle style, gboolean parse_gaps, gboolean show_gaps) ; -gboolean zMapStyleGetJoinAligns(ZMapFeatureTypeStyle style, unsigned int *between_align_error) ; +//gboolean zMapStyleGetJoinAligns(ZMapFeatureTypeStyle style, unsigned int *between_align_error) ; void zMapStyleSetBumpSpace(ZMapFeatureTypeStyle style, double bump_spacing) ; void zMapStyleSetShowWhenEmpty(ZMapFeatureTypeStyle style, gboolean show_when_empty) ; void zMapStyleSetPfetch(ZMapFeatureTypeStyle style, gboolean pfetchable) ; @@ -620,27 +970,36 @@ gboolean zMapStyleIsOutlineColour(ZMapFeatureTypeStyle style) ; gboolean zMapStyleColourByStrand(ZMapFeatureTypeStyle style); -ZMapStyleGlyphStrand zMapStyleGlyphStrand(ZMapFeatureTypeStyle style); -gboolean zMapStyleIsDirectionalEnd(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsDirectionalEnd(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsDirectionalEnd(style) (style->directional_end) -gboolean zMapStyleIsDisplayable(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsDisplayable(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsDisplayable(style) (style->displayable) -gboolean zMapStyleIsDeferred(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsDeferred(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsDeferred(style) (style->deferred) -gboolean zMapStyleIsLoaded(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsLoaded(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsLoaded(style) (style->loaded) -gboolean zMapStyleIsHidden(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsHidden(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsHidden(style) (style->col_display_state == ZMAPSTYLE_COLDISPLAY_HIDE) -gboolean zMapStyleIsStrandSpecific(ZMapFeatureTypeStyle style) ; -gboolean zMapStyleIsShowReverseStrand(ZMapFeatureTypeStyle style) ; -gboolean zMapStyleIsHideForwardStrand(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsStrandSpecific(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsStrandSpecific(style) (style->strand_specific) +//gboolean zMapStyleIsShowReverseStrand(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsShowReverseStrand(style) (style->show_rev_strand) +//gboolean zMapStyleIsHideForwardStrand(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsHideForwardStrand(style) (style->hide_fwd_strand) gboolean zMapStyleIsFrameSpecific(ZMapFeatureTypeStyle style) ; -gboolean zMapStyleIsFrameOneColumn(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsFrameOneColumn(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsFrameOneColumn(style) (style->frame_mode == ZMAPSTYLE_3_FRAME_ONLY_1) -double zMapStyleBaseline(ZMapFeatureTypeStyle style) ; +//double zMapStyleBaseline(ZMapFeatureTypeStyle style) ; +#define zMapStyleBaseline(style) (style->mode_data.graph.baseline) gboolean zMapStyleIsMinMag(ZMapFeatureTypeStyle style, double *min_mag) ; gboolean zMapStyleIsMaxMag(ZMapFeatureTypeStyle style, double *max_mag) ; @@ -651,8 +1010,10 @@ ZMapFeatureTypeStyle zMapFeatureTypeCreate(char *name, char *description) ; gboolean zMapStyleHasMode(ZMapFeatureTypeStyle style); -gboolean zMapStyleIsParseGaps(ZMapFeatureTypeStyle style) ; -gboolean zMapStyleIsShowGaps(ZMapFeatureTypeStyle style) ; +//gboolean zMapStyleIsParseGaps(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsParseGaps(style) (style->mode_data.alignment.parse_gaps) +//gboolean zMapStyleIsShowGaps(ZMapFeatureTypeStyle style) ; +#define zMapStyleIsShowGaps(style) (style->mode_data.alignment.show_gaps) char *zMapStyleCreateName(char *style_name) ; @@ -660,7 +1021,6 @@ GQuark zMapStyleCreateID(char *style_name) ; ZMapFeatureTypeStyle zMapStyleGetPredefined(char *style_name) ; -gboolean zMapFeatureTypeSetAugment(GData **current, GData **new) ; void zMapStyleInitBumpMode(ZMapFeatureTypeStyle style, ZMapStyleBumpMode default_bump_mode, ZMapStyleBumpMode curr_bump_mode) ; @@ -674,19 +1034,20 @@ gboolean zMapStyleMerge(ZMapFeatureTypeStyle curr_style, ZMapFeatureTypeStyle ne -gboolean zMapStyleDisplayInSeparator(ZMapFeatureTypeStyle style); +//gboolean zMapStyleDisplayInSeparator(ZMapFeatureTypeStyle style); +#define zMapStyleDisplayInSeparator(style) (style->show_only_in_separator) /* Style set functions... */ -gboolean zMapStyleSetAdd(GData **style_set, ZMapFeatureTypeStyle style) ; -gboolean zMapStyleCopyAllStyles(GData **style_set, GData **copy_style_set_out) ; -gboolean zMapStyleInheritAllStyles(GData **style_set) ; +gboolean zMapStyleSetAdd(GHashTable *style_set, ZMapFeatureTypeStyle style) ; +gboolean zMapStyleCopyAllStyles(GHashTable *style_set, GHashTable **copy_style_set_out) ; +gboolean zMapStyleInheritAllStyles(GHashTable *style_set) ; gboolean zMapStyleNameExists(GList *style_name_list, char *style_name) ; -ZMapFeatureTypeStyle zMapFindStyle(GData *styles, GQuark style_id) ; -GList *zMapStylesGetNames(GData *styles) ; -GData *zMapStyleGetAllPredefined(void) ; -GData *zMapStyleMergeStyles(GData *curr_styles, GData *new_styles, ZMapStyleMergeMode merge_mode) ; -void zMapStyleDestroyStyles(GData **styles) ; +ZMapFeatureTypeStyle zMapFindStyle(GHashTable *styles, GQuark style_id) ; +GList *zMapStylesGetNames(GHashTable *styles) ; +GHashTable *zMapStyleGetAllPredefined(void) ; +GHashTable *zMapStyleMergeStyles(GHashTable *curr_styles, GHashTable *new_styles, ZMapStyleMergeMode merge_mode) ; +void zMapStyleDestroyStyles(GHashTable *styles) ; @@ -694,8 +1055,8 @@ void zMapStyleDestroyStyles(GData **styles) ; void zMapStylePrint(ZMapIOOut dest, ZMapFeatureTypeStyle style, char *prefix, gboolean full) ; -void zMapStyleSetPrintAll(ZMapIOOut dest, GData *type_set, char *user_string, gboolean full) ; -void zMapStyleSetPrintAllStdOut(GData *type_set, char *user_string, gboolean full) ; +void zMapStyleSetPrintAll(ZMapIOOut dest, GHashTable *type_set, char *user_string, gboolean full) ; +void zMapStyleSetPrintAllStdOut(GHashTable *type_set, char *user_string, gboolean full) ; void zMapStyleListPrintAll(ZMapIOOut dest, GList *styles, char *user_string, gboolean full) ; diff --git a/src/include/ZMap/zmapUtilsDebug.h b/src/include/ZMap/zmapUtilsDebug.h index 28c25f4a0..3fa8c204e 100755 --- a/src/include/ZMap/zmapUtilsDebug.h +++ b/src/include/ZMap/zmapUtilsDebug.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,11 +23,11 @@ * Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk * * Description: Contains macros, functions etc. useful for testing/debugging. - * + * * HISTORY: * Last edited: Mar 12 12:58 2010 (edgrif) * Created: Mon Mar 29 16:51:28 2004 (edgrif) - * CVS info: $Id: zmapUtilsDebug.h,v 1.11 2010-03-12 12:59:02 edgrif Exp $ + * CVS info: $Id: zmapUtilsDebug.h,v 1.12 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_UTILS_DEBUG_H @@ -69,7 +69,7 @@ G_STMT_START{ \ /* Define debug messages more easily. */ -#ifdef __GNUC__ +#ifdef __GNUC__ #define zMapDebugPrint(BOOLEAN_VAR, FORMAT, ...) \ G_STMT_START \ { \ @@ -88,12 +88,13 @@ G_STMT_START{ \ /* Timer functions, just simplifies printing etc a bit and provides a global timer if required. * Just comment out #define ZMAP_DISABLE_TIMER to turn it all on. */ -#define ZMAP_DISABLE_TIMER +// make this into a build option +//#define ZMAP_DISABLE_TIMER #ifdef ZMAP_DISABLE_TIMER - +// the void zero bit is so we can have a semicolon after the call. #define zMapStartTimer(TIMER_PTR) (void)0 #define zMapPrintTimer(TIMER, TEXT) (void)0 #define zMapResetTimer(TIMER) (void)0 @@ -101,29 +102,51 @@ G_STMT_START{ \ #else -/* Define reference to global timer. */ +/* Define reference to global timer from view creation */ #define ZMAP_GLOBAL_TIMER zmap_global_timer_G extern GTimer *ZMAP_GLOBAL_TIMER ; - -/* A bit clumsy but couldn't see a neat way to allow just putting NULL for the timer to get - * the global one. - * Do this for the global one: zMapStartTimer(ZMAP_GLOBAL_TIMER) ; - * and this for your one: zMapStartTimer(your_timer_ptr) ; - * */ -#define zMapStartTimer(TIMER_PTR) \ -(TIMER_PTR) = g_timer_new() - +extern gboolean zmap_timing_G; + +#define zMapInitTimer() \ + if(zmap_timing_G) \ + { GTimeVal gtv; \ + GDate gd; \ + if(ZMAP_GLOBAL_TIMER) \ + g_timer_reset(ZMAP_GLOBAL_TIMER); \ + else \ + ZMAP_GLOBAL_TIMER = g_timer_new();\ + g_get_current_time(>v);\ + g_date_set_time_val(&gd,>v);\ + printf("# %s\t%02d/%02d/%4d\n",zMapConfigDirGetFile(),\ + g_date_get_day (&gd), g_date_get_month(&gd),g_date_get_year(&gd));\ + zMapPrintTime("Reset","Timer","");\ + } + + +// this output format is TAB delimited. +// Func is Start or Stop +// ID may be readable text but may not contain TABS. +// OPT is another (descriptive) text string +// timings in seconds.milliseconds +// output is now configured from [ZMap] - can leave code compiled in +// NULL args shoudl be "" +#define zMapPrintTime(FUNC, ID, OPT) \ + { if(ZMAP_GLOBAL_TIMER) \ + printf("%s\t%.3f\t%s\t%s\n", \ + FUNC,\ + g_timer_elapsed(ZMAP_GLOBAL_TIMER, NULL),\ + ID,OPT); \ + } + +// can use start then stop, but stop on its own can be interpreted as previous event as start +#define zMapStartTimer(TEXT,OPT) zMapPrintTime("Start",TEXT,OPT) +#define zMapStopTimer(TEXT,OPT) zMapPrintTime("Stop",TEXT,OPT) + + +// interface to legacy calls: removed to avoid clutter, redef the macro if you want them back +// grep for PrintTimer to see them all (about 30) /* Takes an optional Gtimer* and an optional char* (you must supply the args but either can be NULL */ -#define zMapPrintTimer(TIMER, TEXT) \ - printf(ZMAP_MSG_FORMAT_STRING " %s - elapsed time: %g\n", \ - ZMAP_MSG_FUNCTION_MACRO, \ - ((TEXT) ? (TEXT) : ""), \ - g_timer_elapsed(((TIMER) ? (TIMER) : ZMAP_GLOBAL_TIMER), NULL)) ; - -/* Takes an optional Gtimer* (you must supply the arg but it can be NULL */ -#define zMapResetTimer(TIMER) \ - g_timer_reset(((TIMER) ? (TIMER) : ZMAP_GLOBAL_TIMER)) - +#define zMapPrintTimer(TIMER, TEXT) (void) 0 // zmapPrintTime(TEXT ? TEXT : "?","") #endif /* ZMAP_DISABLE_TIMER */ diff --git a/src/include/ZMap/zmapView.h b/src/include/ZMap/zmapView.h index 4fc9901a7..886aebe7c 100755 --- a/src/include/ZMap/zmapView.h +++ b/src/include/ZMap/zmapView.h @@ -31,7 +31,7 @@ * HISTORY: * Last edited: Jun 12 14:36 2009 (edgrif) * Created: Thu May 13 14:59:14 2004 (edgrif) - * CVS info: $Id: zmapView.h,v 1.58 2010-04-22 14:31:52 mh17 Exp $ + * CVS info: $Id: zmapView.h,v 1.59 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAPVIEW_H @@ -225,7 +225,7 @@ char *zMapViewGetStatusStr(ZMapViewState zmap_state) ; gboolean zMapViewGetFeaturesSpan(ZMapView zmap_view, int *start, int *end) ; ZMapWindow zMapViewGetWindow(ZMapViewWindow view_window) ; ZMapView zMapViewGetView(ZMapViewWindow view_window) ; -GData *zMapViewGetStyles(ZMapViewWindow view_window) ; +GHashTable *zMapViewGetStyles(ZMapViewWindow view_window) ; ZMapWindowNavigator zMapViewGetNavigator(ZMapView view); int zMapViewNumWindows(ZMapViewWindow view_window) ; diff --git a/src/include/ZMap/zmapWindow.h b/src/include/ZMap/zmapWindow.h index 57d58ab7e..88e1c2e1d 100755 --- a/src/include/ZMap/zmapWindow.h +++ b/src/include/ZMap/zmapWindow.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -24,11 +24,11 @@ * * Description: Defines interface to code that creates/handles a * window displaying genome data. - * + * * HISTORY: * Last edited: May 5 17:27 2010 (edgrif) * Created: Thu Jul 24 15:21:56 2003 (edgrif) - * CVS info: $Id: zmapWindow.h,v 1.110 2010-05-06 11:58:45 edgrif Exp $ + * CVS info: $Id: zmapWindow.h,v 1.111 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_H @@ -134,13 +134,13 @@ typedef struct -/* +/* * THIS IS GOING BACK TO HOW I ORIGINALLY ENVISAGED THE CALLBACK SYSTEM WHICH WAS AS A COMMAND * FIELD FOLLOWED BY DIFFERENT INFO. STRUCTS...I.E. LIKE THE SIGNAL INTERFACE OF GTK ETC... - * + * * Data returned by the "command" callback, note all command structs must start with the * CommandAny fields. - * + * */ typedef enum @@ -225,12 +225,12 @@ typedef struct _ZMapWindowCallbacksStruct void zMapWindowInit(ZMapWindowCallbacks callbacks) ; -ZMapWindow zMapWindowCreate(GtkWidget *parent_widget, +ZMapWindow zMapWindowCreate(GtkWidget *parent_widget, char *sequence, void *app_data, GList *feature_set_names) ; -ZMapWindow zMapWindowCopy(GtkWidget *parent_widget, char *sequence, +ZMapWindow zMapWindowCopy(GtkWidget *parent_widget, char *sequence, void *app_data, ZMapWindow old, - ZMapFeatureContext features, GData *all_styles, GData *new_styles, + ZMapFeatureContext features, GHashTable *all_styles, GHashTable *new_styles, ZMapWindowLockType window_locking) ; void zMapWindowBusyFull(ZMapWindow window, gboolean busy, const char *file, const char *func) ; @@ -244,16 +244,16 @@ void zMapWindowBusyFull(ZMapWindow window, gboolean busy, const char *file, cons void zMapWindowDisplayData(ZMapWindow window, ZMapWindowState state, ZMapFeatureContext current_features, ZMapFeatureContext new_features, - GData *all_styles, GData *new_styles, + GHashTable *all_styles, GHashTable *new_styles, GHashTable *new_featuresets_2_stylelist) ; -void zMapWindowUnDisplayData(ZMapWindow window, +void zMapWindowUnDisplayData(ZMapWindow window, ZMapFeatureContext current_features, ZMapFeatureContext new_features); void zMapWindowMove(ZMapWindow window, double start, double end) ; void zMapWindowReset(ZMapWindow window) ; void zMapWindowRedraw(ZMapWindow window) ; void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_context, - GData *all_styles, GData *new_styles, + GHashTable *all_styles, GHashTable *new_styles, gboolean reversed) ; void zMapWindowZoom(ZMapWindow window, double zoom_factor) ; ZMapWindowZoomStatus zMapWindowGetZoomStatus(ZMapWindow window) ; @@ -266,7 +266,7 @@ double zMapWindowGetZoomMaxDNAInWrappedColumn(ZMapWindow window); gboolean zMapWindowZoomToFeature(ZMapWindow window, ZMapFeature feature) ; void zMapWindowZoomToWorldPosition(ZMapWindow window, gboolean border, - double rootx1, double rooty1, + double rootx1, double rooty1, double rootx2, double rooty2); gboolean zMapWindowGetMark(ZMapWindow window, int *start, int *end) ; @@ -274,7 +274,7 @@ gboolean zMapWindowGetMark(ZMapWindow window, int *start, int *end) ; gboolean zMapWindowGetDNAStatus(ZMapWindow window); void zMapWindowStats(ZMapWindow window,GString *text) ; void zMapWindowToggle3Frame(ZMapWindow window) ; -void zMapWindowToggleDNAProteinColumns(ZMapWindow window, +void zMapWindowToggleDNAProteinColumns(ZMapWindow window, GQuark align_id, GQuark block_id, gboolean dna, gboolean protein, gboolean force_to, gboolean force); @@ -289,8 +289,8 @@ void zMapWindowSiblingWasRemoved(ZMapWindow window); /* For when a window in /* Remove this to use Ed's version */ //PangoFont *zMapWindowGetFixedWidthFont(ZMapWindow window); #endif -PangoFontDescription *zMapWindowZoomGetFixedWidthFontInfo(ZMapWindow window, - double *width_out, +PangoFontDescription *zMapWindowZoomGetFixedWidthFontInfo(ZMapWindow window, + double *width_out, double *height_out); void zMapWindowGetVisible(ZMapWindow window, double *top_out, double *bottom_out) ; @@ -307,7 +307,7 @@ gboolean zMapWindowPrint(ZMapWindow window) ; FooCanvasItem *zMapWindowFeatureAdd(ZMapWindow window, FooCanvasGroup *feature_group, ZMapFeature feature) ; FooCanvasItem *zMapWindowFeatureSetAdd(ZMapWindow window, - FooCanvasGroup *block_group, + FooCanvasGroup *block_group, char *feature_set_name) ; FooCanvasItem *zMapWindowFeatureReplace(ZMapWindow zmap_window, FooCanvasItem *curr_feature_item, @@ -335,10 +335,10 @@ void zMapWindowMergeInFeatureSetNames(ZMapWindow window, GList *feature_set_name GList *zMapWindowGetSpawnedPIDList(ZMapWindow window); void zMapWindowDestroy(ZMapWindow window) ; -void zMapWindowMenuAlignBlockSubMenus(ZMapWindow window, - ZMapGUIMenuItem each_align, - ZMapGUIMenuItem each_block, - char *root, +void zMapWindowMenuAlignBlockSubMenus(ZMapWindow window, + ZMapGUIMenuItem each_align, + ZMapGUIMenuItem each_block, + char *root, GArray **items_array_out); char *zMapWindowRemoteReceiveAccepts(ZMapWindow window); void zMapWindowSetupXRemote(ZMapWindow window, GtkWidget *widget); diff --git a/src/include/ZMap/zmapWindowNavigator.h b/src/include/ZMap/zmapWindowNavigator.h index d09ab1359..989c3c125 100755 --- a/src/include/ZMap/zmapWindowNavigator.h +++ b/src/include/ZMap/zmapWindowNavigator.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,18 +23,18 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jun 10 09:44 2009 (rds) * Created: Thu Sep 7 09:10:32 2006 (rds) - * CVS info: $Id: zmapWindowNavigator.h,v 1.10 2010-03-04 15:15:31 mh17 Exp $ + * CVS info: $Id: zmapWindowNavigator.h,v 1.11 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_NAVIGATOR_H -#define ZMAP_WINDOW_NAVIGATOR_H +#define ZMAP_WINDOW_NAVIGATOR_H #include <ZMap/zmapWindow.h> @@ -51,15 +51,15 @@ typedef struct _ZMapNavigatorCallbackStruct ZMapWindowNavigator zMapWindowNavigatorCreate(GtkWidget *canvas_widget); -void zMapWindowNavigatorFocus(ZMapWindowNavigator navigate, +void zMapWindowNavigatorFocus(ZMapWindowNavigator navigate, gboolean true_eq_focus); void zMapWindowNavigatorSetCurrentWindow(ZMapWindowNavigator navigate, ZMapWindow window); -void zMapWindowNavigatorMergeInFeatureSetNames(ZMapWindowNavigator navigate, +void zMapWindowNavigatorMergeInFeatureSetNames(ZMapWindowNavigator navigate, GList *navigator_sets); void zMapWindowNavigatorSetStrand(ZMapWindowNavigator navigate, gboolean is_revesed); -void zMapWindowNavigatorDrawFeatures(ZMapWindowNavigator navigate, +void zMapWindowNavigatorDrawFeatures(ZMapWindowNavigator navigate, ZMapFeatureContext full_context, - GData *styles); + GHashTable *styles); void zMapWindowNavigatorDrawLocator(ZMapWindowNavigator navigate, double top, double bottom); void zMapWindowNavigatorReset(ZMapWindowNavigator navigate); diff --git a/src/zmapConfig/zmapConfigLoader.c b/src/zmapConfig/zmapConfigLoader.c index 17ae412f4..7fbc48a92 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.22 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapConfigLoader.c,v 1.23 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ @@ -523,10 +523,10 @@ GQuark zMapStyleQuark(gchar *str) // get style stanzas in styles_list of all from the file -gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GData **styles_out) +gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GHashTable **styles_out) { gboolean result = FALSE ; - GData *styles = NULL ; + GHashTable *styles = NULL ; GList *settings_list = NULL, *free_this_list = NULL; ZMapConfigIniContext context ; GHashTable *shapes = NULL; @@ -548,7 +548,7 @@ gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GD { free_this_list = settings_list ; - g_datalist_init(&styles) ; + styles = g_hash_table_new(NULL,NULL); do { @@ -684,7 +684,7 @@ gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GD if ((new_style = zMapStyleCreateV(num_params, params))) { - if (!zMapStyleSetAdd(&styles, new_style)) + if (!zMapStyleSetAdd(styles, new_style)) { /* Free style, report error and move on. */ zMapStyleDestroy(new_style) ; @@ -1064,6 +1064,7 @@ static ZMapConfigIniContextKeyEntry get_debug_group_data(char **stanza_name, cha { ZMAPSTANZA_DEBUG_APP_THREADS, G_TYPE_BOOLEAN, NULL, FALSE }, { ZMAPSTANZA_DEBUG_APP_FEATURE2STYLE, G_TYPE_BOOLEAN, NULL, FALSE }, { ZMAPSTANZA_DEBUG_APP_STYLES, G_TYPE_BOOLEAN, NULL, FALSE }, + { ZMAPSTANZA_DEBUG_APP_TIMING, G_TYPE_BOOLEAN, NULL, FALSE }, { NULL } }; static char *name = ZMAPSTANZA_DEBUG_CONFIG; diff --git a/src/zmapFeature/zmapFeature.c b/src/zmapFeature/zmapFeature.c index 40efdcca5..c369d6603 100755 --- a/src/zmapFeature/zmapFeature.c +++ b/src/zmapFeature/zmapFeature.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Dec 14 11:20 2009 (edgrif) * Created: Fri Jul 16 13:05:58 2004 (edgrif) - * CVS info: $Id: zmapFeature.c,v 1.129 2010-04-26 14:29:42 mh17 Exp $ + * CVS info: $Id: zmapFeature.c,v 1.130 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ @@ -116,7 +116,7 @@ typedef struct typedef struct _HackForForcingStyleModeStruct { gboolean force; - GData *styles ; + GHashTable *styles ; ZMapFeatureSet feature_set; } HackForForcingStyleModeStruct, *HackForForcingStyleMode; @@ -288,7 +288,7 @@ gboolean zMapFeatureAnyRemoveFeature(ZMapFeatureAny feature_parent, ZMapFeatureA * in our styles... * * */ -gboolean zMapFeatureAnyAddModesToStyles(ZMapFeatureAny feature_any, GData *styles) +gboolean zMapFeatureAnyAddModesToStyles(ZMapFeatureAny feature_any, GHashTable *styles) { gboolean result = TRUE; ZMapFeatureContextExecuteStatus status = ZMAP_CONTEXT_EXEC_STATUS_OK; @@ -315,7 +315,7 @@ gboolean zMapFeatureAnyAddModesToStyles(ZMapFeatureAny feature_any, GData *style * mode to basic for featureset where there are no features to get the * mode from... When adding new features to these once empty * columns, we must force the styles... */ -gboolean zMapFeatureAnyForceModesToStyles(ZMapFeatureAny feature_any, GData *styles) +gboolean zMapFeatureAnyForceModesToStyles(ZMapFeatureAny feature_any, GHashTable *styles) { gboolean result = TRUE; ZMapFeatureContextExecuteStatus status = ZMAP_CONTEXT_EXEC_STATUS_OK; @@ -546,7 +546,7 @@ ZMapFeature zMapFeatureCreateEmpty(void) * Because the contents of this are quite a lot of work. Useful for * creating single features, but be warned that usually you will need * to keep track of uniqueness, so for large parser the GFF style of - * doing things is better (assuming we get a fix for g_datalist!). + * doing things is better * ================================================================== */ ZMapFeature zMapFeatureCreateFromStandardData(char *name, char *sequence, char *ontology, @@ -608,6 +608,7 @@ gboolean zMapFeatureAddStandardData(ZMapFeature feature, char *feature_name_id, feature->type = feature_type ; feature->ontology = g_quark_from_string(ontology) ; feature->style_id = zMapStyleGetUniqueID(style) ; + feature->style = style; feature->x1 = start ; feature->x2 = end ; feature->strand = strand ; @@ -1037,7 +1038,9 @@ void zMapFeatureSetStyle(ZMapFeatureSet feature_set, ZMapFeatureTypeStyle style) { zMapAssert(feature_set && style) ; - //feature_set->style = style ; + // MH17: was for the column (historically) + // new put back to be used for each feature + feature_set->style = style ; return ; } @@ -2591,7 +2594,7 @@ static ZMapFeatureContextExecuteStatus addModeCB(GQuark key_id, -/* A GDataForeachFunc() to add a mode to the styles for all features in a set, note that +/* A GHashTableForeachFunc() to add a mode to the styles for all features in a set, note that * this is not efficient as we go through all features but we would need more information * stored in the feature set to avoid this as there may be several different types of * feature stored in a feature set. diff --git a/src/zmapFeature/zmapFeatureContext.c b/src/zmapFeature/zmapFeatureContext.c index b07b1fcc0..12f8edef7 100755 --- a/src/zmapFeature/zmapFeatureContext.c +++ b/src/zmapFeature/zmapFeatureContext.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Nov 30 16:23 2009 (edgrif) * Created: Tue Jan 17 16:13:12 2006 (edgrif) - * CVS info: $Id: zmapFeatureContext.c,v 1.53 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: zmapFeatureContext.c,v 1.54 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ @@ -123,7 +123,7 @@ static gboolean catch_hash_abuse_G = TRUE; * mappings etc.....needs some thought and effort.... * */ -void zMapFeatureReverseComplement(ZMapFeatureContext context, GData *styles) +void zMapFeatureReverseComplement(ZMapFeatureContext context, GHashTable *styles) { RevCompDataStruct cb_data ; diff --git a/src/zmapFeature/zmapFeatureOutput.c b/src/zmapFeature/zmapFeatureOutput.c index ba10746f5..880dec91f 100755 --- a/src/zmapFeature/zmapFeatureOutput.c +++ b/src/zmapFeature/zmapFeatureOutput.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Mar 29 09:16 2010 (edgrif) * Created: Tue Oct 28 16:20:33 2008 (rds) - * CVS info: $Id: zmapFeatureOutput.c,v 1.11 2010-03-29 15:32:39 mh17 Exp $ + * CVS info: $Id: zmapFeatureOutput.c,v 1.12 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ @@ -58,7 +58,7 @@ typedef struct { gboolean status ; GIOChannel *channel ; - GData *styles ; + GHashTable *styles ; GString *dump_string; GError **dump_error ; DumpAny dump_data; /* will contain the user's data in dump_data->user_data */ @@ -80,7 +80,7 @@ static ZMapFeatureContextExecuteStatus dump_features_cb(GQuark key, char **err_out); static void invoke_dump_features_cb(gpointer list_data, gpointer user_data); static gboolean simple_context_print_cb(ZMapFeatureAny feature_any, - GData *styles, + GHashTable *styles, GString *dump_string_in_out, GError **error, gpointer user_data); @@ -98,7 +98,7 @@ static ZMapFeatureContextExecuteStatus range_invoke_dump_features_cb(GQuark ke /*! * \brief Dump the Feature Context in a zmap speific context format. Useful for debugging. */ -gboolean zMapFeatureContextDump(ZMapFeatureContext feature_context, GData *styles, +gboolean zMapFeatureContextDump(ZMapFeatureContext feature_context, GHashTable *styles, GIOChannel *file, GError **error_out) { gboolean result = FALSE; @@ -111,7 +111,7 @@ gboolean zMapFeatureContextDump(ZMapFeatureContext feature_context, GData *style } /* N.B. call only returns TRUE if the dump _and_ the io channel close succeed. */ -gboolean zMapFeatureDumpStdOutFeatures(ZMapFeatureContext feature_context, GData *styles, GError **error_out) +gboolean zMapFeatureDumpStdOutFeatures(ZMapFeatureContext feature_context, GHashTable *styles, GError **error_out) { gboolean result = FALSE ; GIOChannel *file ; @@ -139,7 +139,7 @@ gboolean zMapFeatureDumpStdOutFeatures(ZMapFeatureContext feature_context, GData } -gboolean zMapFeatureDumpToFileName(ZMapFeatureContext feature_context,char *filename, char *header, GData *styles, GError **error_out) +gboolean zMapFeatureDumpToFileName(ZMapFeatureContext feature_context,char *filename, char *header, GHashTable *styles, GError **error_out) { gboolean result = FALSE ; GIOChannel *file ; @@ -170,7 +170,7 @@ gboolean zMapFeatureDumpToFileName(ZMapFeatureContext feature_context,char *file * The GFunc expects (ZMapFeatureAny feature, gpointer dumper_data_out) */ gboolean zMapFeatureListForeachDumperCreate(ZMapFeatureDumpFeatureFunc dump_func, - GData *styles, + GHashTable *styles, gpointer dump_user_data, GDestroyNotify dump_user_free, GIOChannel *dump_file, @@ -248,7 +248,7 @@ gboolean zMapFeatureListForeachDumperDestroy(gpointer dumper_data) } gboolean zMapFeatureListDumpToFile(GList *feature_list, - GData *styles, + GHashTable *styles, ZMapFeatureDumpFeatureFunc dump_func, gpointer dump_user_data, GIOChannel *dump_file, @@ -293,7 +293,7 @@ gboolean zMapFeatureListDumpToFile(GList *feature_list, * and this code calls the callback to do the output of the feature in the appropriate * form. */ gboolean zMapFeatureContextDumpToFile(ZMapFeatureAny dump_set, - GData *styles, + GHashTable *styles, ZMapFeatureDumpFeatureFunc dump_func, gpointer dump_user_data, GIOChannel *dump_file, @@ -342,7 +342,7 @@ gboolean zMapFeatureContextDumpToFile(ZMapFeatureAny dump_set, } gboolean zMapFeatureContextRangeDumpToFile(ZMapFeatureAny dump_set, - GData *styles, + GHashTable *styles, ZMapSpan span_data, ZMapFeatureDumpFeatureFunc dump_func, gpointer dump_user_data, @@ -524,7 +524,7 @@ static void invoke_dump_features_cb(gpointer list_data, gpointer user_data) } static gboolean simple_context_print_cb(ZMapFeatureAny feature_any, - GData *styles, + GHashTable *styles, GString *dump_string_in_out, GError **error, gpointer user_data) diff --git a/src/zmapFeature/zmapFeatureTypes.c b/src/zmapFeature/zmapFeatureTypes.c index ba3f62b06..e4414bd18 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.97 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapFeatureTypes.c,v 1.98 2010-06-08 08:31:23 mh17 Exp $ *------------------------------------------------------------------- */ @@ -63,17 +63,18 @@ typedef struct { ZMapStyleMergeMode merge_mode ; - GData *curr_styles ; + GHashTable *curr_styles ; } MergeStyleCBStruct, *MergeStyleCB ; typedef struct { gboolean *error ; - GData *copy_set ; + GHashTable *copy_set ; } CopyStyleCBStruct, *CopyStyleCB ; +/* typedef struct { gboolean error ; @@ -84,22 +85,21 @@ typedef struct typedef struct { gboolean errors ; - GData *style_set ; - GData *inherited_styles ; + GhashTable *style_set ; + GhashTable *inherited_styles ; ZMapFeatureTypeStyle prev_style ; } InheritAllCBStruct, *InheritAllCB ; +*/ -static void doTypeSets(GQuark key_id, gpointer data, gpointer user_data) ; - static void checkListName(gpointer data, gpointer user_data) ; static gint compareNameToStyle(gconstpointer glist_data, gconstpointer user_data) ; -static void mergeStyle(GQuark style_id, gpointer data, gpointer user_data_unused) ; -static void destroyStyle(GQuark style_id, gpointer data, gpointer user_data_unused) ; +static void mergeStyle(gpointer style_id, gpointer data, gpointer user_data_unused) ; +static gboolean destroyStyle(gpointer style_id, gpointer data, gpointer user_data_unused) ; -static void copySetCB(GQuark key_id, gpointer data, gpointer user_data) ; +static void copySetCB(gpointer key_id, gpointer data, gpointer user_data) ; static void setStrandFrameAttrs(ZMapFeatureTypeStyle type, @@ -124,7 +124,7 @@ static void mergeColours(ZMapStyleFullColour curr, ZMapStyleFullColour new) ; /* Add a style to a set of styles, if the style is already there no action is taken * and FALSE is returned. */ -gboolean zMapStyleSetAdd(GData **style_set, ZMapFeatureTypeStyle style) +gboolean zMapStyleSetAdd(GHashTable *style_set, ZMapFeatureTypeStyle style) { gboolean result = FALSE ; GQuark style_id ; @@ -133,9 +133,9 @@ gboolean zMapStyleSetAdd(GData **style_set, ZMapFeatureTypeStyle style) style_id = zMapStyleGetUniqueID(style) ; - if (!(zMapFindStyle(*style_set, style_id))) + if (!g_hash_table_lookup(style_set, GUINT_TO_POINTER(style_id))) { - g_datalist_id_set_data(style_set, style_id, style) ; + g_hash_table_insert(style_set, GUINT_TO_POINTER(style_id), style) ; result = TRUE ; } @@ -156,7 +156,6 @@ gboolean zMapStyleSetAdd(GData **style_set, ZMapFeatureTypeStyle style) * the errors. * * re-written by mh17 May 2010 to use a more efficient way of finding parent styles and inheriting then - * Still uses GData as input and output as changing that would involve a lot of code * (previous version performed badly on sorted data...erm got an infinite list due to self-parenting styles) * ..anyway this version runs as fast as a single datalist or hash table function * & does strictly less inherit operations than the number of styles @@ -167,7 +166,7 @@ gboolean zMapStyleSetAdd(GData **style_set, ZMapFeatureTypeStyle style) // inherit the parent style, recursively inheriting its ancestors first // replaces and frees the old style with the new one and returns the new // or NULL on failure -static ZMapFeatureTypeStyle inherit_parent(ZMapFeatureTypeStyle style, GHashTable *root_styles, int depth, GData **style_set) +static ZMapFeatureTypeStyle inherit_parent(ZMapFeatureTypeStyle style, GHashTable *root_styles, int depth) { ZMapFeatureTypeStyle parent,tmp_style = NULL; @@ -197,7 +196,7 @@ static ZMapFeatureTypeStyle inherit_parent(ZMapFeatureTypeStyle style, GHashTabl } if(!parent->inherited) - parent = inherit_parent(parent,root_styles,depth+1,style_set); + parent = inherit_parent(parent,root_styles,depth+1); if(parent) { @@ -209,7 +208,6 @@ static ZMapFeatureTypeStyle inherit_parent(ZMapFeatureTypeStyle style, GHashTabl // keep this up to date g_hash_table_replace(root_styles,GUINT_TO_POINTER(style->unique_id),tmp_style); - g_datalist_id_set_data(style_set,tmp_style->unique_id,tmp_style); zMapStyleDestroy(style); } @@ -235,59 +233,48 @@ static ZMapFeatureTypeStyle inherit_parent(ZMapFeatureTypeStyle style, GHashTabl } + // add a style to a hash table -static void set_root_style(GQuark key, gpointer item, gpointer user) +static void clear_inherited(gpointer key, gpointer item, gpointer user) { - GHashTable *roots = (GHashTable *) user; ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle) item; style->inherited = FALSE; - - g_hash_table_insert(roots,GUINT_TO_POINTER(style->unique_id),style); } -// really we want to replace GData with GHashTable all through the styles code -// but there's a lot of it -// first we fix this function, then the server code that creates the Gdata style_set -// then we can hit the application layer at leisure -// after that we can remove all these copying to/from Gdata stuff - -gboolean zMapStyleInheritAllStyles(GData **style_set) +gboolean zMapStyleInheritAllStyles(GHashTable *style_set) { gboolean result = TRUE ; - GHashTable *root_styles; +// GHashTable *root_styles; GList *iter; ZMapFeatureTypeStyle old,new; - // make a hash table of all styles that are inherited - root_styles = g_hash_table_new(NULL,NULL); - g_datalist_foreach(style_set,set_root_style,root_styles); + + g_hash_table_foreach(style_set,clear_inherited,style_set); // we need to process the hash table and alter the data pointers - // probably not safe to assume GLib's opaque functions can cope // get a list of keys - zMap_g_hash_table_get_keys(&iter,root_styles); + zMap_g_hash_table_get_keys(&iter,style_set); // lookup each one and replace in turn, update the output datalist for(;iter;iter = iter->next) { // lookup the style: must do this for each as // these may be changed by inheritance of previous styles - old = (ZMapFeatureTypeStyle) g_hash_table_lookup(root_styles,iter->data); + old = (ZMapFeatureTypeStyle) g_hash_table_lookup(style_set,iter->data); zMapAssert(old); // recursively inherit parent while not already done - new = inherit_parent(old,root_styles,0,style_set); + new = inherit_parent(old,style_set,0); if(!new) result = FALSE; } // tidy up g_list_free(iter); - g_hash_table_destroy(root_styles); return result ; } @@ -296,20 +283,20 @@ gboolean zMapStyleInheritAllStyles(GData **style_set) /* Copies a set of styles. * * If there are errors in trying to copy styles then this function returns FALSE - * and a GData set containing as many styles as it could copy, there will be + * and a GHashTable containing as many styles as it could copy, there will be * log messages identifying the errors. It returns TRUE if there were no errors * at all. * * */ -gboolean zMapStyleCopyAllStyles(GData **style_set, GData **copy_style_set_out) +gboolean zMapStyleCopyAllStyles(GHashTable *style_set, GHashTable **copy_style_set_out) { gboolean result = TRUE ; CopyStyleCBStruct cb_data = {NULL} ; cb_data.error = &result ; - g_datalist_init(&(cb_data.copy_set)) ; + cb_data.copy_set = g_hash_table_new(NULL,NULL) ; - g_datalist_foreach(style_set, copySetCB, &cb_data) ; + g_hash_table_foreach(style_set, copySetCB, &cb_data) ; *copy_style_set_out = cb_data.copy_set ; @@ -438,58 +425,51 @@ static void mergeColours(ZMapStyleFullColour curr, ZMapStyleFullColour new) } +//--------------------------------- +// previous style access functions replaced with macros +// they provided default value by we can make the opbject do that +// external modules have read-only access. +//--------------------------------- -GQuark zMapStyleGetID(ZMapFeatureTypeStyle style) -{ - return style->original_id ; // is always set -} - -GQuark zMapStyleGetUniqueID(ZMapFeatureTypeStyle style) +// too complicated for macros +GQuark zMapStyleGetSubFeature(ZMapFeatureTypeStyle style,ZMapStyleSubFeature i) { - return style->unique_id ; // is always set -} + GQuark x = 0; -const gchar *zMapStyleGetName(ZMapFeatureTypeStyle style) -{ - // this is the original name, stored internally as a squark - return g_quark_to_string(style->original_id) ; // is always set + if(i > 0 && i < ZMAPSTYLE_SUB_FEATURE_MAX) + x = style->sub_features[i]; + return(x); } -gchar *zMapStyleGetDescription(ZMapFeatureTypeStyle style) -{ - return style->description ; // is always set -} -ZMapStyleBumpMode zMapStyleGetBumpMode(ZMapFeatureTypeStyle style) +ZMapStyleGlyphShape zMapStyleGlyphShape5(ZMapFeatureTypeStyle style) { - ZMapStyleBumpMode mode = ZMAPBUMP_INVALID; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_BUMP_MODE)) - mode = style->curr_bump_mode; + ZMapStyleGlyphShape shape = NULL; - return mode; + if(zMapStyleIsPropertySetId(style,STYLE_PROP_GLYPH_SHAPE_5)) + shape = &style->mode_data.glyph.glyph5; + else + shape = &style->mode_data.glyph.glyph; + return(shape); } -ZMapStyleBumpMode zMapStyleGetDefaultBumpMode(ZMapFeatureTypeStyle style) + +ZMapStyleGlyphShape zMapStyleGlyphShape3(ZMapFeatureTypeStyle style) { - ZMapStyleBumpMode mode = ZMAPBUMP_INVALID; + ZMapStyleGlyphShape shape = NULL; - if(zMapStyleIsPropertySetId(style,STYLE_PROP_BUMP_DEFAULT)) - mode = style->default_bump_mode; + if(zMapStyleIsPropertySetId(style,STYLE_PROP_GLYPH_SHAPE_3)) + shape = &style->mode_data.glyph.glyph3; + else + shape = &style->mode_data.glyph.glyph; + return(shape); +} - return mode; +//--------------------------------- -} -gboolean zMapStyleGetUnmarked(ZMapFeatureTypeStyle style) -{ - gboolean x = TRUE; // spec says default to true - if(zMapStyleIsPropertySetId(style,STYLE_PROP_ALIGNMENT_UNMARKED_COLINEAR)) - x = style->mode_data.alignment.unmarked_colinear; - return(x); -} void zMapStyleSetParent(ZMapFeatureTypeStyle style, char *parent_name) @@ -519,15 +499,6 @@ void zMapStyleSetWidth(ZMapFeatureTypeStyle style, double width) return ; } -double zMapStyleGetBumpWidth(ZMapFeatureTypeStyle style) -{ - double bump_spacing = 0.0 ; - - if (zMapStyleIsPropertySetId(style,STYLE_PROP_BUMP_SPACING)) - bump_spacing = style->bump_spacing ; - - return bump_spacing ; -} @@ -553,7 +524,7 @@ void zMapStyleSetMag(ZMapFeatureTypeStyle style, double min_mag, double max_mag) } - +// these next two functions are not called gboolean zMapStyleIsMinMag(ZMapFeatureTypeStyle style, double *min_mag) { gboolean mag_set = FALSE ; @@ -605,16 +576,6 @@ gboolean zMapStyleHasMode(ZMapFeatureTypeStyle style) } -ZMapStyleMode zMapStyleGetMode(ZMapFeatureTypeStyle style) -{ - ZMapStyleMode mode = ZMAPSTYLE_MODE_INVALID ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_MODE)) - mode = style->mode; - - return mode; -} - @@ -630,68 +591,6 @@ void zMapStyleSetPfetch(ZMapFeatureTypeStyle style, gboolean pfetchable) -const gchar *zMapStyleGetGFFSource(ZMapFeatureTypeStyle style) -{ - const gchar *gff_source = NULL; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_GFF_SOURCE)) - gff_source = g_quark_to_string(style->gff_source); - - return gff_source ; -} - -const gchar *zMapStyleGetGFFFeature(ZMapFeatureTypeStyle style) -{ - const gchar *gff_feature = NULL ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_GFF_FEATURE)) - gff_feature = g_quark_to_string(style->gff_feature); - - return gff_feature ; -} - - -gboolean zMapStyleIsDirectionalEnd(ZMapFeatureTypeStyle style) -{ - gboolean ends = FALSE ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_DIRECTIONAL_ENDS)) - ends = style->directional_end; - - return ends ; -} - - -unsigned int zmapStyleGetWithinAlignError(ZMapFeatureTypeStyle style) -{ - unsigned int error = 0; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_ALIGNMENT_BETWEEN_ERROR)) - error = style->mode_data.alignment.between_align_error; - - return error ; -} - - -gboolean zMapStyleIsParseGaps(ZMapFeatureTypeStyle style) -{ - gboolean parse_gaps = FALSE; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_ALIGNMENT_PARSE_GAPS)) - parse_gaps = style->mode_data.alignment.parse_gaps; - - return parse_gaps ; -} - -gboolean zMapStyleIsShowGaps(ZMapFeatureTypeStyle style) -{ - gboolean show_gaps =FALSE ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_ALIGNMENT_SHOW_GAPS)) - show_gaps = style->mode_data.alignment.show_gaps; - - return show_gaps ; -} void zMapStyleSetShowGaps(ZMapFeatureTypeStyle style, gboolean show_gaps) { @@ -721,17 +620,6 @@ void zMapStyleSetGappedAligns(ZMapFeatureTypeStyle style, gboolean parse_gaps, g } -void zMapStyleGetGappedAligns(ZMapFeatureTypeStyle style, gboolean *parse_gaps, gboolean *show_gaps) -{ - if(zMapStyleIsPropertySetId(style,STYLE_PROP_ALIGNMENT_PARSE_GAPS)) - *parse_gaps = style->mode_data.alignment.parse_gaps; - if(zMapStyleIsPropertySetId(style,STYLE_PROP_ALIGNMENT_SHOW_GAPS)) - *show_gaps = style->mode_data.alignment.show_gaps; - - return ; -} - - void zMapStyleSetJoinAligns(ZMapFeatureTypeStyle style, unsigned int between_align_error) { @@ -745,22 +633,6 @@ void zMapStyleSetJoinAligns(ZMapFeatureTypeStyle style, unsigned int between_ali } -/* Returns TRUE and returns the between_align_error if join_aligns is TRUE for the style, - * otherwise returns FALSE. */ -gboolean zMapStyleGetJoinAligns(ZMapFeatureTypeStyle style, unsigned int *between_align_error) -{ - gboolean result = FALSE ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_ALIGNMENT_PARSE_GAPS)) - { - *between_align_error = style->mode_data.alignment.between_align_error; - result = TRUE ; - } - - return result ; -} - - void zMapStyleSetDisplayable(ZMapFeatureTypeStyle style, gboolean displayable) { style->displayable = displayable ; @@ -769,17 +641,6 @@ void zMapStyleSetDisplayable(ZMapFeatureTypeStyle style, gboolean displayable) return ; } -gboolean zMapStyleIsDisplayable(ZMapFeatureTypeStyle style) -{ - gboolean result = FALSE ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_DISPLAYABLE)) - result = style->displayable; - - return result ; -} - - void zMapStyleSetDeferred(ZMapFeatureTypeStyle style, gboolean deferred) { style->deferred = deferred; @@ -787,16 +648,6 @@ void zMapStyleSetDeferred(ZMapFeatureTypeStyle style, gboolean deferred) return ; } -gboolean zMapStyleIsDeferred(ZMapFeatureTypeStyle style) -{ - gboolean result = FALSE; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_DEFERRED)) - result = style->deferred; - - return result ; -} - void zMapStyleSetLoaded(ZMapFeatureTypeStyle style, gboolean loaded) { style->loaded = loaded; @@ -805,16 +656,6 @@ void zMapStyleSetLoaded(ZMapFeatureTypeStyle style, gboolean loaded) return ; } -gboolean zMapStyleIsLoaded(ZMapFeatureTypeStyle style) -{ - gboolean result = FALSE; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_LOADED)) - result = style->loaded; - - return result ; -} - /* Controls whether the feature set is displayed. */ void zMapStyleSetDisplay(ZMapFeatureTypeStyle style, ZMapStyleColumnDisplayState col_show) @@ -828,31 +669,6 @@ void zMapStyleSetDisplay(ZMapFeatureTypeStyle style, ZMapStyleColumnDisplayState return ; } -ZMapStyleColumnDisplayState zMapStyleGetDisplay(ZMapFeatureTypeStyle style) -{ - ZMapStyleColumnDisplayState mode = ZMAPSTYLE_COLDISPLAY_INVALID; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_COLUMN_DISPLAY_MODE)) - mode = style->col_display_state; - - return mode ; -} - - -gboolean zMapStyleIsHidden(ZMapFeatureTypeStyle style) -{ - gboolean result = FALSE ; - ZMapStyleColumnDisplayState mode = ZMAPSTYLE_COLDISPLAY_INVALID; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_COLUMN_DISPLAY_MODE)) - mode = style->col_display_state; - - if (mode == ZMAPSTYLE_COLDISPLAY_HIDE) - result = TRUE ; - - return result ; -} - /* Controls whether the feature set is displayed initially. */ void zMapStyleSetShowWhenEmpty(ZMapFeatureTypeStyle style, gboolean show_when_empty) @@ -865,169 +681,6 @@ void zMapStyleSetShowWhenEmpty(ZMapFeatureTypeStyle style, gboolean show_when_em return ; } -gboolean zMapStyleGetShowWhenEmpty(ZMapFeatureTypeStyle style) -{ - gboolean show = FALSE; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_COLUMN_DISPLAY_MODE)) - show = style->show_when_empty; - - return show ; -} - - - -double zMapStyleGetWidth(ZMapFeatureTypeStyle style) -{ - double width = 0.0 ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_WIDTH)) - width = style->width; - - return width ; -} - -double zMapStyleGetMaxScore(ZMapFeatureTypeStyle style) -{ - double max_score = 0.0 ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_MAX_SCORE)) - max_score = style->max_score; - - return max_score ; -} - -double zMapStyleGetMinScore(ZMapFeatureTypeStyle style) -{ - double min_score = 0.0 ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_MIN_SCORE)) - min_score = style->min_score; - - 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; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_SCORE_MODE)) - z = style->score_mode; - return(z); -} - -double zMapStyleGetMinMag(ZMapFeatureTypeStyle style) -{ - double min_mag = 0.0 ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_MIN_MAG)) - min_mag = style->min_mag; - - return min_mag ; -} - - -double zMapStyleGetMaxMag(ZMapFeatureTypeStyle style) -{ - double max_mag = 0.0 ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_MAX_MAG)) - max_mag = style->max_mag; - - return max_mag ; -} - - -double zMapStyleBaseline(ZMapFeatureTypeStyle style) -{ - double baseline = 0.0 ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_GRAPH_BASELINE)) - baseline = style->mode_data.graph.baseline; - - return baseline ; -} - - -ZMapStyleGlyphStrand zMapStyleGlyphStrand(ZMapFeatureTypeStyle style) -{ - int glyph_strand = ZMAPSTYLE_GLYPH_STRAND_INVALID; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_GLYPH_STRAND)) - glyph_strand = style->mode_data.glyph.glyph_strand; - - return glyph_strand ; -} - - -int zMapStyleGlyphThreshold(ZMapFeatureTypeStyle style) -{ - return(style->mode_data.glyph.glyph_threshold); -} - -GQuark zMapStyleGetSubFeature(ZMapFeatureTypeStyle style,ZMapStyleSubFeature i) -{ - GQuark x = 0; - - if(i > 0 && i < ZMAPSTYLE_SUB_FEATURE_MAX) - x = style->sub_features[i]; - return(x); -} - -ZMapStyleGlyphShape zMapStyleGlyphShape(ZMapFeatureTypeStyle style) -{ - ZMapStyleGlyphShape shape = NULL; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_GLYPH_SHAPE)) - shape = &style->mode_data.glyph.glyph; - return(shape); -} - -ZMapStyleGlyphShape zMapStyleGlyphShape5(ZMapFeatureTypeStyle style) -{ - ZMapStyleGlyphShape shape = NULL; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_GLYPH_SHAPE_5)) - shape = &style->mode_data.glyph.glyph5; - else - shape = zMapStyleGlyphShape(style); - return(shape); -} - - -ZMapStyleGlyphShape zMapStyleGlyphShape3(ZMapFeatureTypeStyle style) -{ - ZMapStyleGlyphShape shape = NULL; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_GLYPH_SHAPE_3)) - shape = &style->mode_data.glyph.glyph3; - else - shape = zMapStyleGlyphShape(style); - return(shape); -} - - - -/* Returns TRUE if bumping has been fixed to one type, FALSE otherwise. */ -gboolean zmapStyleBumpIsFixed(ZMapFeatureTypeStyle style) -{ - gboolean is_fixed = FALSE ; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_BUMP_FIXED)) - is_fixed = style->bump_fixed; - - return is_fixed ; -} - @@ -1258,46 +911,7 @@ gboolean zMapStyleIsFrameSpecific(ZMapFeatureTypeStyle style) return frame_specific ; } -gboolean zMapStyleIsFrameOneColumn(ZMapFeatureTypeStyle style) -{ - gboolean one_column = FALSE ; - - if (zMapStyleIsPropertySetId(style,STYLE_PROP_FRAME_MODE) && style->frame_mode == ZMAPSTYLE_3_FRAME_ONLY_1) - one_column = TRUE ; - - return one_column ; -} - -gboolean zMapStyleIsStrandSpecific(ZMapFeatureTypeStyle style) -{ - gboolean strand_specific = FALSE ; - - if (zMapStyleIsPropertySetId(style,STYLE_PROP_STRAND_SPECIFIC)) - strand_specific = style->strand_specific ; - - return strand_specific ; -} - -gboolean zMapStyleIsShowReverseStrand(ZMapFeatureTypeStyle style) -{ - gboolean show_rev_strand = FALSE ; - - if (zMapStyleIsPropertySetId(style,STYLE_PROP_SHOW_REV_STRAND)) - show_rev_strand = style->show_rev_strand ; - - return show_rev_strand ; -} - -gboolean zMapStyleIsHideForwardStrand(ZMapFeatureTypeStyle style) -{ - gboolean hide_fwd_strand = FALSE ; - - if (zMapStyleIsPropertySetId(style,STYLE_PROP_HIDE_FWD_STRAND)) - hide_fwd_strand = style->hide_fwd_strand ; - - return hide_fwd_strand ; -} void zMapStyleSetGFF(ZMapFeatureTypeStyle style, char *gff_source, char *gff_feature) { @@ -1325,7 +939,7 @@ void zMapStyleSetBumpMode(ZMapFeatureTypeStyle style, ZMapStyleBumpMode bump_mod if(!(bump_mode >= ZMAPBUMP_START && bump_mode <= ZMAPBUMP_END)) bump_mode = ZMAPBUMP_UNBUMP; // better than going Assert - if (!zmapStyleBumpIsFixed(style)) + if (!style->bump_fixed) { // MH17: this looked wrong, refer to old version if(!zMapStyleIsPropertySetId(style,STYLE_PROP_BUMP_DEFAULT)) @@ -1350,25 +964,13 @@ void zMapStyleSetBumpSpace(ZMapFeatureTypeStyle style, double bump_spacing) } -double zMapStyleGetBumpSpace(ZMapFeatureTypeStyle style) -{ - double spacing = 0.0 ; - - - if (zMapStyleIsPropertySetId(style,STYLE_PROP_BUMP_SPACING)) - spacing = style->bump_spacing ; - - return spacing ; -} - - /* Reset bump mode to default and returns the default mode. */ ZMapStyleBumpMode zMapStyleResetBumpMode(ZMapFeatureTypeStyle style) { ZMapStyleBumpMode default_mode = ZMAPBUMP_INVALID ; - if (!zmapStyleBumpIsFixed(style)) + if (!style->bump_fixed) { default_mode = style->curr_bump_mode = style->default_bump_mode ; } @@ -1387,7 +989,7 @@ void zMapStyleInitBumpMode(ZMapFeatureTypeStyle style, && (curr_bump_mode == ZMAPBUMP_INVALID || (curr_bump_mode >= ZMAPBUMP_START && curr_bump_mode <= ZMAPBUMP_END))) ; - if (!zmapStyleBumpIsFixed(style)) + if (!style->bump_fixed) { if (curr_bump_mode != ZMAPBUMP_INVALID) { @@ -1443,35 +1045,6 @@ GQuark zMapStyleCreateID(char *style) } -gboolean zMapStyleDisplayInSeparator(ZMapFeatureTypeStyle style) -{ - gboolean separator_style = FALSE; - - if(zMapStyleIsPropertySetId(style,STYLE_PROP_SHOW_ONLY_IN_SEPARATOR)) - separator_style = style->show_only_in_separator; - - return separator_style; -} - - - - -gboolean zMapFeatureTypeSetAugment(GData **current, GData **new) -{ - gboolean result = FALSE ; - - zMapAssert(new && *new) ; - - if (!current || !*current) - g_datalist_init(current) ; - - g_datalist_foreach(new, doTypeSets, (void *)current) ; - - result = TRUE ; /* currently shouldn't fail.... */ - - return result ; -} - /* Check that every name has a style, if the style can't be found, remove the name from the list. */ gboolean zMapSetListEqualStyles(GList **feature_set_names, GList **styles) @@ -1498,15 +1071,15 @@ gboolean zMapSetListEqualStyles(GList **feature_set_names, GList **styles) * overloads curr_style. * * */ -GData *zMapStyleMergeStyles(GData *curr_styles, GData *new_styles, ZMapStyleMergeMode merge_mode) +GHashTable *zMapStyleMergeStyles(GHashTable *curr_styles, GHashTable *new_styles, ZMapStyleMergeMode merge_mode) { - GData *merged_styles = NULL ; + GHashTable *merged_styles = NULL ; MergeStyleCBStruct merge_data = {FALSE} ; merge_data.merge_mode = merge_mode ; merge_data.curr_styles = curr_styles ; - g_datalist_foreach(&new_styles, mergeStyle, &merge_data) ; + g_hash_table_foreach(new_styles, mergeStyle, &merge_data) ; merged_styles = merge_data.curr_styles ; @@ -1514,11 +1087,11 @@ GData *zMapStyleMergeStyles(GData *curr_styles, GData *new_styles, ZMapStyleMerg } -/* Returns a GData of all predefined styles, the user should free the list AND the styles when +/* Returns a GhashTable of all predefined styles, the user should free the list AND the styles when * they have finished with them. */ -GData *zMapStyleGetAllPredefined(void) +GHashTable *zMapStyleGetAllPredefined(void) { - GData *style_list = NULL ; + GHashTable *style_list = NULL ; ZMapFeatureTypeStyle curr = NULL ; @@ -1526,6 +1099,7 @@ GData *zMapStyleGetAllPredefined(void) * we should (e.g. DNA), this is because what we really want is to only show the forward * version of the column. This points to a flaw or lack of a column type. */ + style_list = g_hash_table_new(NULL,NULL); /* 3 Frame - meta mode controlling whether we do 3 frame display or not. */ curr = zMapStyleCreate(ZMAP_FIXED_STYLE_3FRAME, ZMAP_FIXED_STYLE_3FRAME_TEXT) ; @@ -1535,7 +1109,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_DEFAULT_BUMP_MODE, ZMAPBUMP_UNBUMP, ZMAPSTYLE_PROPERTY_DISPLAYABLE, FALSE, NULL) ; - g_datalist_id_set_data(&style_list, curr->unique_id, curr) ; + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr) ; /* 3 Frame Translation */ @@ -1575,7 +1149,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_COLOURS, colours, NULL); } - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); /* DNA */ @@ -1601,7 +1175,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_COLOURS, colours, NULL); } - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); /* Locus */ @@ -1619,7 +1193,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_STRAND_SPECIFIC, TRUE, ZMAPSTYLE_PROPERTY_COLOURS, colours, NULL); - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); } @@ -1634,7 +1208,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_DEFAULT_BUMP_MODE, ZMAPBUMP_UNBUMP, ZMAPSTYLE_PROPERTY_BUMP_FIXED, TRUE, NULL); - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); /* Scale Bar */ @@ -1648,7 +1222,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_DEFAULT_BUMP_MODE, ZMAPBUMP_UNBUMP, ZMAPSTYLE_PROPERTY_BUMP_FIXED, TRUE, NULL); - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); /* NEED TO CHECK THAT THIS ACTUALLY WORKS...DOESN'T SEEM TO JUST NOW...... */ @@ -1669,7 +1243,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_COLOURS, colours, NULL); } - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); /* strand separator */ @@ -1683,7 +1257,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_DEFAULT_BUMP_MODE, ZMAPBUMP_UNBUMP, ZMAPSTYLE_PROPERTY_BUMP_FIXED, TRUE, NULL); - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); /* Search results hits */ @@ -1707,7 +1281,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_REV_COLOURS, strand_colours, NULL); } - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); /* Assembly path */ @@ -1729,7 +1303,7 @@ GData *zMapStyleGetAllPredefined(void) ZMAPSTYLE_PROPERTY_ASSEMBLY_PATH_NON_COLOURS, non_path_colours, NULL); } - g_datalist_id_set_data(&style_list, curr->unique_id, curr); + g_hash_table_insert(style_list, GUINT_TO_POINTER(curr->unique_id), curr); return style_list ; @@ -1738,11 +1312,9 @@ GData *zMapStyleGetAllPredefined(void) /* need a func to free a styles list here..... */ -void zMapStyleDestroyStyles(GData **styles) +void zMapStyleDestroyStyles(GHashTable *styles) { - g_datalist_foreach(styles, destroyStyle, NULL) ; - - g_datalist_clear(styles) ; + g_hash_table_foreach_remove(styles, destroyStyle, NULL) ; return ; } @@ -1763,27 +1335,6 @@ void zMapStyleDestroyStyles(GData **styles) -static void doTypeSets(GQuark key_id, gpointer data, gpointer user_data) -{ - ZMapFeatureTypeStyle new_type = (ZMapFeatureTypeStyle)data ; - GData **current_out = (GData **)user_data ; - GData *current = *current_out ; - - if (!g_datalist_id_get_data(¤t, key_id)) - { - /* copy the struct and then add it to the current set. */ - ZMapFeatureTypeStyle type ; - - type = zMapFeatureStyleCopy(new_type) ; - - g_datalist_id_set_data(¤t, key_id, type) ; - } - - *current_out = current ; - - return ; -} - /* A GFunc() called from zMapSetListEqualStyles() to check that a given feature_set name * has a corresponding style. */ @@ -1822,16 +1373,16 @@ static gint compareNameToStyle(gconstpointer glist_data, gconstpointer user_data /* Either merges a new style or adds it to current list. */ -static void mergeStyle(GQuark style_id, gpointer data, gpointer user_data) +static void mergeStyle(gpointer style_id, gpointer data, gpointer user_data) { ZMapFeatureTypeStyle new_style = (ZMapFeatureTypeStyle)data ; MergeStyleCB merge_data = (MergeStyleCB)user_data ; - GData *curr_styles = merge_data->curr_styles ; + GHashTable *curr_styles = merge_data->curr_styles ; ZMapFeatureTypeStyle curr_style = NULL ; /* If we find the style then process according to merge_mode, if not then add a copy to the curr_styles. */ - if ((curr_style = zMapFindStyle(curr_styles, new_style->unique_id))) + if ((curr_style = g_hash_table_lookup(curr_styles, GUINT_TO_POINTER(new_style->unique_id)))) { switch (merge_data->merge_mode) { @@ -1845,11 +1396,10 @@ static void mergeStyle(GQuark style_id, gpointer data, gpointer user_data) /* Remove the existing style and put the new one in its place. */ ZMapFeatureTypeStyle copied_style = NULL ; - g_datalist_id_remove_data(&curr_styles, curr_style->unique_id) ; - zMapStyleDestroy(curr_style) ; + copied_style = zMapFeatureStyleCopy(new_style); + g_hash_table_replace(curr_styles,GUINT_TO_POINTER(new_style->unique_id),copied_style); - copied_style = zMapFeatureStyleCopy(new_style); - g_datalist_id_set_data(&curr_styles, new_style->unique_id, copied_style) ; + zMapStyleDestroy(curr_style) ; merge_data->curr_styles = curr_styles ; @@ -1876,7 +1426,7 @@ static void mergeStyle(GQuark style_id, gpointer data, gpointer user_data) ZMapFeatureTypeStyle copied_style = NULL ; copied_style = zMapFeatureStyleCopy(new_style); - g_datalist_id_set_data(&curr_styles, new_style->unique_id, copied_style) ; + g_hash_table_insert(curr_styles, GUINT_TO_POINTER(new_style->unique_id), copied_style) ; merge_data->curr_styles = curr_styles ; } @@ -1886,35 +1436,29 @@ static void mergeStyle(GQuark style_id, gpointer data, gpointer user_data) /* Destroy the given style. */ -static void destroyStyle(GQuark style_id, gpointer data, gpointer user_data_unused) +static gboolean destroyStyle(gpointer style_id, gpointer data, gpointer user_data_unused) { ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle)data ; zMapStyleDestroy(style); - return ; + return TRUE; } -/* A GDataForeachFunc() to copy styles into a GDatalist */ -static void copySetCB(GQuark key_id, gpointer data, gpointer user_data) +/* A GHashTableForeachFunc() to copy styles into a GHashTable */ +static void copySetCB(gpointer key_id, gpointer data, gpointer user_data) { ZMapFeatureTypeStyle curr_style = (ZMapFeatureTypeStyle)data ; CopyStyleCB cb_data = (CopyStyleCB)user_data ; ZMapFeatureTypeStyle copy_style ; - GData *style_set = cb_data->copy_set ; - - -if(key_id != curr_style->unique_id) -{ - printf("copySetCB: %s != %s\n",g_quark_to_string(key_id), g_quark_to_string(curr_style->unique_id)); -} + GHashTable *style_set = cb_data->copy_set ; - zMapAssert(key_id == curr_style->unique_id) ; + zMapAssert(GPOINTER_TO_UINT(key_id) == curr_style->unique_id) ; if ((copy_style = zMapFeatureStyleCopy(curr_style))) - g_datalist_id_set_data(&style_set, key_id, copy_style) ; + g_hash_table_insert(style_set, key_id, copy_style) ; else *(cb_data->error) = TRUE ; diff --git a/src/zmapFeature/zmapFeatureUtils.c b/src/zmapFeature/zmapFeatureUtils.c index 49d1b5552..6fe2172a6 100755 --- a/src/zmapFeature/zmapFeatureUtils.c +++ b/src/zmapFeature/zmapFeatureUtils.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Sep 2 09:42 2009 (edgrif) * Created: Tue Nov 2 2004 (rnc) - * CVS info: $Id: zmapFeatureUtils.c,v 1.69 2010-03-29 15:32:39 mh17 Exp $ + * CVS info: $Id: zmapFeatureUtils.c,v 1.70 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -55,7 +55,7 @@ static int feature_block_frame_offset(ZMapFeature feature); static void get_feature_list_extent(gpointer list_data, gpointer span_data); static gint findStyleName(gconstpointer list_data, gconstpointer user_data) ; -static void addTypeQuark(GQuark style_id, gpointer data, gpointer user_data) ; +static void addTypeQuark(gpointer style_id, gpointer data, gpointer user_data) ; static void map_parent2child(gpointer exon_data, gpointer user_data); static int sortGapsByTarget(gconstpointer a, gconstpointer b) ; @@ -626,11 +626,11 @@ char *zMapFeatureSetGetName(ZMapFeatureSet feature_set) /* Retrieve a style struct for the given style id. */ -ZMapFeatureTypeStyle zMapFindStyle(GData *styles, GQuark style_id) +ZMapFeatureTypeStyle zMapFindStyle(GHashTable *styles, GQuark style_id) { ZMapFeatureTypeStyle style = NULL ; - style = (ZMapFeatureTypeStyle)g_datalist_id_get_data(&styles, style_id) ; + style = (ZMapFeatureTypeStyle) g_hash_table_lookup(styles, GUINT_TO_POINTER(style_id)); return style ; } @@ -654,20 +654,20 @@ gboolean zMapStyleNameExists(GList *style_name_list, char *style_name) /* Retrieve a Glist of the names of all the styles... */ -GList *zMapStylesGetNames(GData *styles) +GList *zMapStylesGetNames(GHashTable *styles) { GList *quark_list = NULL ; zMapAssert(styles) ; - g_datalist_foreach(&styles, addTypeQuark, (void *)&quark_list) ; + g_hash_table_foreach(styles, addTypeQuark, (void *)&quark_list) ; return quark_list ; } /* GFunc() callback function, appends style names to a string, its called for lists * of either style name GQuarks or lists of style structs. */ -static void addTypeQuark(GQuark style_id, gpointer data, gpointer user_data) +static void addTypeQuark(gpointer key, gpointer data, gpointer user_data) { ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle)data ; GList **quarks_out = (GList **)user_data ; diff --git a/src/zmapFeature/zmapFeature_P.h b/src/zmapFeature/zmapFeature_P.h index ccc186c76..5b1b81fd4 100755 --- a/src/zmapFeature/zmapFeature_P.h +++ b/src/zmapFeature/zmapFeature_P.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -27,7 +27,7 @@ * HISTORY: * Last edited: May 10 08:06 2007 (edgrif) * Created: Wed Nov 24 11:01:24 2004 (edgrif) - * CVS info: $Id: zmapFeature_P.h,v 1.7 2010-03-04 15:10:30 mh17 Exp $ + * CVS info: $Id: zmapFeature_P.h,v 1.8 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_FEATURE_P_H @@ -49,7 +49,7 @@ typedef struct // mh17: needed in zmapFeature3Frame.c as well as FeatureContext.c typedef struct { - GData *styles ; + GHashTable *styles ; int start; int end ; } RevCompDataStruct, *RevCompData ; diff --git a/src/zmapFeature/zmapStyle.c b/src/zmapFeature/zmapStyle.c index a25f357a1..366a7baaf 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.53 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapStyle.c,v 1.54 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -396,7 +396,7 @@ GType zMapFeatureTypeStyleGetType(void) (GClassInitFunc) zmap_feature_type_style_class_init, (GClassFinalizeFunc) NULL, NULL /* class_data */, - sizeof (zmapFeatureTypeStyle), + sizeof (zmapFeatureTypeStyleStruct), 0 /* n_preallocs */, (GInstanceInitFunc) zmap_feature_type_style_init, NULL @@ -1478,7 +1478,7 @@ ZMapFeatureTypeStyle zMapStyleLegacyStyle(char *name) ZMAPSTYLE_PROPERTY_SCORE_MODE, ZMAPSCORE_WIDTH, ZMAPSTYLE_PROPERTY_SHOW_REVERSE_STRAND,FALSE, - ZMAPSTYLE_PROPERTY_STRAND_SPECIFIC,TRUE, + ZMAPSTYLE_PROPERTY_HIDE_FORWARD_STRAND,TRUE, ZMAPSTYLE_PROPERTY_STRAND_SPECIFIC,TRUE, ZMAPSTYLE_PROPERTY_WIDTH,30.0, ZMAPSTYLE_PROPERTY_MIN_SCORE,-2.0, @@ -1688,6 +1688,12 @@ static void zmap_feature_type_style_init(ZMapFeatureTypeStyle style) { zmapStyleSetIsSet(style,STYLE_PROP_IS_SET); + // default values, they don't count as being set for inheritance + // but will be returned if a paramter is not set + // ** only need to set if non zero ** + +// style->curr_bump_mode = ZMAPBUMP_INVALID; // why not umbump? + return ; } @@ -1939,6 +1945,14 @@ static void zmap_feature_type_style_set_property_full(ZMapFeatureTypeStyle style break; #endif + + case STYLE_PROP_MODE: + // set non zero default vaues for mode data + if(style->mode == ZMAPSTYLE_MODE_ALIGNMENT) + { + style->mode_data.alignment.unmarked_colinear = TRUE; + } + break; default: break; } diff --git a/src/zmapFeature/zmapStyleUtils.c b/src/zmapFeature/zmapStyleUtils.c index f52516485..2a1457476 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.17 2010-04-20 12:00:37 mh17 Exp $ + * CVS info: $Id: zmapStyleUtils.c,v 1.18 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -91,7 +91,7 @@ typedef struct -static void setPrintFunc(GQuark key_id, gpointer data, gpointer user_data) ; +static void setPrintFunc(gpointer key_id, gpointer data, gpointer user_data) ; static void listPrintFunc(gpointer data, gpointer user_data) ; @@ -171,7 +171,7 @@ ZMAP_ENUM_TO_SHORT_TEXT_FUNC(zmapStyleBumpMode2ShortText, ZMapStyleBu -void zMapStyleSetPrintAll(ZMapIOOut dest, GData *type_set, char *user_string, gboolean full) +void zMapStyleSetPrintAll(ZMapIOOut dest, GHashTable *type_set, char *user_string, gboolean full) { StylePrintStruct print_data ; @@ -180,12 +180,12 @@ void zMapStyleSetPrintAll(ZMapIOOut dest, GData *type_set, char *user_string, gb zMapOutWriteFormat(dest, "\nTypes at %s\n", user_string) ; - g_datalist_foreach(&type_set, setPrintFunc, &print_data) ; + g_hash_table_foreach(type_set, setPrintFunc, &print_data) ; return ; } -void zMapStyleSetPrintAllStdOut(GData *type_set, char *user_string, gboolean full) +void zMapStyleSetPrintAllStdOut(GHashTable *type_set, char *user_string, gboolean full) { ZMapIOOut output ; @@ -380,7 +380,7 @@ void zMapStylePrint(ZMapIOOut dest, ZMapFeatureTypeStyle style, char *prefix, gb -static void setPrintFunc(GQuark key_id, gpointer data, gpointer user_data) +static void setPrintFunc(gpointer key_id, gpointer data, gpointer user_data) { ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle)data ; StylePrint print_data = (StylePrint)user_data ; diff --git a/src/zmapFeature/zmapStyle_I.h b/src/zmapFeature/zmapStyle_I.h index c6f6bf4ba..99f8644f1 100755 --- a/src/zmapFeature/zmapStyle_I.h +++ b/src/zmapFeature/zmapStyle_I.h @@ -28,13 +28,14 @@ * HISTORY: * Last edited: May 14 13:46 2010 (edgrif) * Created: Mon Feb 26 09:13:30 2007 (edgrif) - * CVS info: $Id: zmapStyle_I.h,v 1.25 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapStyle_I.h,v 1.26 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef __ZMAP_STYLE_I_H__ #define __ZMAP_STYLE_I_H__ +#define ZMAPSTYLE_INTERNAL 1 #include <ZMap/zmapStyle.h> #include <ZMap/zmapBase.h> @@ -136,299 +137,6 @@ typedef struct _zmapFeatureTypeStyleClassStruct -/*! @addtogroup zmapstyles - * @{ - * */ - - -/*! @struct ZMapStyleColour zmapStyle_P.h - * @brief ZMap object colours - * - * All ZMap objects can potentially have a border colour, a fill colour and a draw colour - * which can be used to "draw" over the fill colour. */ - -typedef struct -{ - struct - { - unsigned int draw : 1 ; - unsigned int fill : 1 ; - unsigned int border : 1 ; - } fields_set ; - - GdkColor draw ; /* Overlaid on fill colour. */ - GdkColor fill ; /* Fill/background colour. */ - GdkColor border ; /* Surround/line colour. */ -} ZMapStyleColourStruct, *ZMapStyleColour ; - - -/*! @struct ZMapStyleFullColour zmapStyle_P.h - * @brief ZMap feature colours - * - * All features in ZMap can be selected and hence must have both "normal" and "selected" - * colours. */ -typedef struct -{ - ZMapStyleColourStruct normal ; - ZMapStyleColourStruct selected ; -} ZMapStyleFullColourStruct, *ZMapStyleFullColour ; - -/* At most 6 colour specs can be given for any one field (i.e. all the combinations of selected, - * normal and draw, fill, border. */ -enum {ZMAPSTYLE_MAX_COLOUR_SPECS = 6} ; - - - -/*! Styles have different modes, e.g. graph, alignment etc, information specific to a particular - * style is held in its own struct. */ - - -/*! @struct ZMapBasicGraph zmapStyle_P.h - * @brief Basic feature - * - * < currently this is empty > */ -typedef struct -{ - char *dummy ; - -} ZMapStyleBasicStruct, *ZMapStyleBasic ; - -/*! @struct ZMapSequenceGraph zmapStyle_P.h - * @brief Sequence feature - * - * (currently this is empty) */ -typedef struct -{ - char *dummy ; - -} ZMapStyleSequenceStruct, *ZMapStyleSequence ; - -/*! @struct ZMapTextGraph zmapStyle_P.h - * @brief Text feature - * - * (currently this is empty) */ -typedef struct -{ - char *font; - -} ZMapStyleTextStruct, *ZMapStyleText ; - - - -/*! @struct ZMapStyleGraph zmapStyle_P.h - * @brief Graph feature - * - * Draws a feature as a graph, the feature must contain graph points. */ -typedef struct -{ - ZMapStyleGraphMode mode ; /*!< Graph style. */ - - double baseline ; /*!< zero level for graph. */ - -} ZMapStyleGraphStruct, *ZMapStyleGraph ; - - - - - -/*! @struct ZMapStyleGlyph zmapStyle_P.h - * @brief Glyph feature - * - * Draws shapes of various kinds, e.g. splice site indicators etc. */ -typedef struct -{ - // sub feature glyphs or glyphs for glyph mode - GQuark glyph_name,glyph_name_5,glyph_name_3; - ZMapStyleGlyphShapeStruct glyph; // single glyph or unspecified 5' or 3' end - ZMapStyleGlyphShapeStruct glyph5; // shape for 5' end - ZMapStyleGlyphShapeStruct glyph3; // shape for 3' end - ZMapStyleFullColourStruct glyph_alt_colours; - ZMapStyleGlyphStrand glyph_strand; - ZMapStyleGlyphAlign glyph_align; - guint glyph_threshold; - -} ZMapStyleGlyphStruct, *ZMapStyleGlyph ; - - - -/*! @struct ZMapStyleAlignment zmapStyle_P.h - * @brief Alignment feature - * - * Draws an alignment as a series of blocks joined by straight lines. The lines can be coloured - * to indicate colinearity between adjacent blocks. */ -typedef struct - { - /* If set then blixem will be run with nucleotide or peptide sequences for the features. */ - ZMapStyleBlixemType blixem_type ; - - gboolean pfetchable ; /* TRUE => alignments have pfetch entries. */ - - gboolean allow_misalign; /* TRUE => ref and match sequences - don't have to be exactly same - length, ref coords dominate. */ - - /*! Allowable align errors, used to decide whether a match should be classified as "perfect". - * between_align_error is used to assess several alignments (e.g. for exon matches) if join_homols = TRUE - * - * Number is allowable number of missing bases between blocks/alignments, default is 0. */ - unsigned int between_align_error ; - - /*! Colours for bars joining up intra/inter alignment gaps. */ - ZMapStyleFullColourStruct perfect ; - ZMapStyleFullColourStruct colinear ; - ZMapStyleFullColourStruct noncolinear ; - ZMapStyleColumnDisplayState unmarked_colinear; /* paint colinear lines even if not marked */ - - /* Options for processing gapped aligns. */ - gboolean parse_gaps ; /* TRUE means parse gaps from input data, */ - gboolean show_gaps ; /* TRUE means gaps within alignment are displayed, - otherwise alignment is displayed as a single block. */ - -} ZMapStyleAlignmentStruct, *ZMapStyleAlignment ; - - -/*! @struct ZMapStyleTranscript zmapStyle_P.h - * @brief Transcript feature - * - * Draws a transcript as a series of boxes joined by angled lines. */ -typedef struct -{ - ZMapStyleFullColourStruct CDS_colours ; /*!< Colour for CDS part of feature. */ - -} ZMapStyleTranscriptStruct, *ZMapStyleTranscript ; - - -/*! @struct ZMapStyleAssemblyPath zmapStyle_P.h - * @brief AssemblyPath feature - * - * Draws an assembly path as a series of boxes placed alternately to form a tiling path. */ -typedef struct -{ - ZMapStyleFullColourStruct non_path_colours ; /*!< Colour for non-assembly part of feature. */ - -} ZMapStyleAssemblyPathStruct, *ZMapStyleAssemblyPath ; - - -/* THIS STRUCT NEEDS A MAGIC PTR, ONCE IT HAS ONE THEN ADD A TEST TO zmapStyleIsValid() FOR IT.... */ - -/*! @struct ZMapFeatureTypeStyle zmapStyle_P.h - * @brief ZMap Style - * - * ZMap Style definition, the style must have a mode which specifies what sort of - * of feature the style represents. */ -typedef struct _zmapFeatureTypeStyleStruct -{ - GObject __parent__; - -#define STYLE_IS_SET_SIZE ((_STYLE_PROP_N_ITEMS + 7) / 8) - guchar is_set[STYLE_IS_SET_SIZE]; // flags to say whether fields are set - // includes mode dependant fields - // but colours have thier own flags - - /*! _All_ styles must have these fields set, no other fields are compulsory. */ - GQuark original_id ; /*!< Original name. */ - GQuark unique_id ; /*!< Name normalised to be unique. */ - - - /*! Data fields for the style. */ - - - GQuark parent_id ; /*!< Styles can inherit from other - styles, the parent style _must_ be - identified by its unique id. */ - - char *description ; /*!< Description of what this style - represents. */ - - ZMapStyleMode mode ; /*!< Specifies how features that - reference this style will be processed. */ - // must be set before setting mode dependant fields - // and may not be unset/changed afterwards - - GQuark sub_features[ZMAPSTYLE_SUB_FEATURE_MAX]; // style ID quarks indexed by SUBFEATURE ENUM - - ZMapStyleFullColourStruct colours ; /*!< Main feature colours. */ - - /*! Colours for when feature is shown in frames. */ - ZMapStyleFullColourStruct frame0_colours ; - ZMapStyleFullColourStruct frame1_colours ; - ZMapStyleFullColourStruct frame2_colours ; - - /*! Colours for when feature is shown stranded by colour */ - ZMapStyleFullColourStruct strand_rev_colours; - - - ZMapStyleColumnDisplayState col_display_state ; /* Controls how/when col is displayed. */ - - ZMapStyleBumpMode default_bump_mode ; /*!< Allows return to original bump mode. */ - ZMapStyleBumpMode curr_bump_mode ; /*!< Controls how features are grouped - into sub columns within a column. */ - double bump_spacing ; /*!< gap between bumped features. */ - - ZMapStyle3FrameMode frame_mode ; /*!< Controls how frame sensitive - features are displayed. */ - - double min_mag ; /*!< Don't display if fewer bases/line */ - double max_mag ; /*!< Don't display if more bases/line */ - - double width ; /*!< column width */ - - ZMapStyleScoreMode score_mode ; /*!< Controls width of features that - have scores. */ - double min_score, max_score ; /*!< Min/max for score width calc. */ - - - /*! GFF feature dumping, allows specifying of source/feature types independently of feature - * attributes. */ - GQuark gff_source ; - GQuark gff_feature ; - - - /*! State information for the style. */ - gboolean displayable; /* FALSE means never, ever display, - for TRUE see col_display_state. */ - - - gboolean show_when_empty; /*!< If FALSE, features' column is - displayed even if there are no features. */ - gboolean bump_fixed; /*!< If TRUE then bump mode cannot be changed. */ - - gboolean showText; /*!< Should feature text be displayed. */ - - /*! Strand, show reverse and frame are all linked: something that is frame specific must be - * strand specific as well.... */ - gboolean strand_specific; /*!< Feature that is on one strand of the dna. */ - gboolean show_rev_strand; /*!< Only display the feature on the - reverse strand if this is set. */ - gboolean hide_fwd_strand; /* don't show the fwd strand when revcomp'd */ - gboolean show_only_in_separator; - - gboolean directional_end; /*!< Display pointy ends on exons etc. */ - - gboolean deferred; /* flag for to say if this style is deferred loaded */ - - gboolean loaded; /* flag to say if we're loaded */ - - gboolean inherited; // style has inherited it's parents - - /*! Mode specific fields, see docs for individual structs. */ - union - { - ZMapStyleBasicStruct basic ; - ZMapStyleSequenceStruct sequence ; - ZMapStyleTextStruct text ; - ZMapStyleTranscriptStruct transcript ; - ZMapStyleAssemblyPathStruct assembly_path ; - ZMapStyleAlignmentStruct alignment ; - ZMapStyleGraphStruct graph ; - ZMapStyleGlyphStruct glyph ; - } mode_data ; - - -} zmapFeatureTypeStyleStruct ; - - - #ifdef ED_G_NEVER_INCLUDE_THIS_CODE diff --git a/src/zmapGFF/gffparser.c b/src/zmapGFF/gffparser.c index 1627ff9dd..93763f48a 100755 --- a/src/zmapGFF/gffparser.c +++ b/src/zmapGFF/gffparser.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk, * Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Nov 19 15:23 2009 (edgrif) * Created: Wed Jan 11 11:30:39 2006 (rds) - * CVS info: $Id: gffparser.c,v 1.10 2010-03-04 15:10:35 mh17 Exp $ + * CVS info: $Id: gffparser.c,v 1.11 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -50,7 +50,7 @@ typedef struct -static int parseFile(char *filename, GData *styles) ; +static int parseFile(char *filename, GHashTable *styles) ; static GIOChannel *openFileOrDie(char *filename) ; static int readHeader(parserFile data) ; static gboolean readFeatures(parserFile data) ; @@ -59,7 +59,7 @@ static gboolean readFeatures(parserFile data) ; int main(int argc, char *argv[]) { int main_rc ; - GData *styles = NULL; + GHashTable *styles = NULL; #if !defined G_THREADS_ENABLED || defined G_THREADS_IMPL_NONE || !defined G_THREADS_IMPL_POSIX #error "Cannot compile, threads not properly enabled." @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) g_thread_init(NULL); zMapConfigDirCreate(NULL, NULL) ; - + zMapLogCreate(NULL) ; zMapConfigIniGetStylesFromFile(argv[2],argv[3],&styles); // styles = zMapFeatureTypeGetFromFile(argv[2], argv[3]) ; @@ -85,12 +85,12 @@ int main(int argc, char *argv[]) -/* - * Internal routines. +/* + * Internal routines. */ -static int parseFile(char *filename, GData *styles) +static int parseFile(char *filename, GHashTable *styles) { parserFileStruct data = {NULL}; @@ -101,7 +101,7 @@ static int parseFile(char *filename, GData *styles) if(!(readHeader(&data))) readFeatures(&data); - + zMapGFFDestroyParser(data.parser) ; g_string_free(data.gff_line, TRUE) ; @@ -143,13 +143,13 @@ static int readHeader(parserFile data) if (!zMapGFFParseHeader(data->parser, data->gff_line->str, &done_header)) { GError *error = zMapGFFGetError(data->parser) ; - + if (!error && (header = zMapGFFGetHeader(data->parser))) { /* Header finished..ugh poor interface.... */ break ; } - + if (!error) { printf("error %d\n", __LINE__); @@ -170,7 +170,7 @@ static int readHeader(parserFile data) error_occurred = 1; } } - + break ; } data->gff_line = g_string_truncate(data->gff_line, 0) ; @@ -197,7 +197,7 @@ static gboolean readFeatures(parserFile data) parser = data->parser; gff_file = data->file; gff_line = data->gff_line; - + while ((status = g_io_channel_read_line_string(gff_file, gff_line, &terminator_pos, &gff_file_err)) == G_IO_STATUS_NORMAL) { @@ -224,7 +224,7 @@ static gboolean readFeatures(parserFile data) } else { - /* Ignore these for this debugging. + /* Ignore these for this debugging. printf("%s", error->message) ; */ } diff --git a/src/zmapGFF/zmapGFF2Dumper.c b/src/zmapGFF/zmapGFF2Dumper.c index 1698c7304..1ff5187af 100755 --- a/src/zmapGFF/zmapGFF2Dumper.c +++ b/src/zmapGFF/zmapGFF2Dumper.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Apr 22 14:46 2010 (edgrif) * Created: Mon Nov 14 13:21:14 2005 (edgrif) - * CVS info: $Id: zmapGFF2Dumper.c,v 1.19 2010-04-22 13:49:41 edgrif Exp $ + * CVS info: $Id: zmapGFF2Dumper.c,v 1.20 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -65,8 +65,8 @@ GFF_END #define GFF_SEP_NOSCORE GFF_SEPARATOR "%c" #define GFF_STRAND_FRAME GFF_SEPARATOR GFF_STRAND GFF_SEPARATOR GFF_FRAME #define GFF_SEP_ATTRIBUTES GFF_SEPARATOR GFF_ATTRIBUTES -#define GFF_OBLIGATORY GFF_SEQ_SOURCE_FEAT_START_END GFF_SEP_SCORE GFF_STRAND_FRAME -#define GFF_OBLIGATORY_NOSCORE GFF_SEQ_SOURCE_FEAT_START_END GFF_SEP_NOSCORE GFF_STRAND_FRAME +#define GFF_OBLIGATORY GFF_SEQ_SOURCE_FEAT_START_END GFF_SEP_SCORE GFF_STRAND_FRAME +#define GFF_OBLIGATORY_NOSCORE GFF_SEQ_SOURCE_FEAT_START_END GFF_SEP_NOSCORE GFF_STRAND_FRAME #define GFF_FULL_LINE GFF_SEQ_SOURCE_FEAT_START_END GFF_SEP_SCORE GFF_STRAND_FRAME GFF_SEP_ATTRIBUTES typedef struct _GFFDumpDataStruct *GFFDumpData; @@ -87,7 +87,7 @@ typedef struct /* Fields are: <sequence> <source> <feature> <start> <end> <score> <strand> <frame> <attributes> */ typedef struct _GFFDumpDataStruct { - GData *styles ; + GHashTable *styles ; const char *gff_sequence; /* The sequence name. e.g. 16.12345-23456 */ char *gff_source; /* The source e.g. augustus, TrEMBL, trf, polya_site */ @@ -106,8 +106,8 @@ typedef struct _GFFDumpDataStruct /* Functions to dump the header section of gff files */ static gboolean dump_full_header(ZMapFeatureAny feature_any, GIOChannel *file, GError **error_out, const char **sequence_in_out) ; -static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, - gpointer data, +static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, + gpointer data, gpointer user_data, char **err_out) ; @@ -115,7 +115,7 @@ static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, /* ZMapFeatureDumpFeatureFunc to dump gff. writes lines into gstring buffer... */ static gboolean dump_gff_cb(ZMapFeatureAny feature_any, - GData *styles, + GHashTable *styles, GString *gff_string, GError **error, gpointer user_data); @@ -156,7 +156,7 @@ static gboolean dump_transcript_subpart_lines(ZMapFeature feature, static gboolean dump_transcript_foreach_subpart(ZMapFeature feature, GString *buffer, GError **error_out, - GArray *subparts, + GArray *subparts, GFFDumpData gff_data); @@ -202,18 +202,18 @@ static DumpGFFAttrFunc text_funcs_G[] = { dump_text_note, dump_transcript_locus, NULL -}; +}; /* NOTE: if we want this to dump a context it will have to cope with lots of different * sequences for the different alignments...I think the from alignment down is ok but the title * for the file is not if we have different alignments....and neither are the coords....????? - * + * * I think we would need multiple Type and sequence-region comment lines for the different * sequences. - * + * * */ -gboolean zMapGFFDump(ZMapFeatureAny dump_set, GData *styles, GIOChannel *file, GError **error_out) +gboolean zMapGFFDump(ZMapFeatureAny dump_set, GHashTable *styles, GIOChannel *file, GError **error_out) { gboolean result = TRUE; @@ -222,7 +222,7 @@ gboolean zMapGFFDump(ZMapFeatureAny dump_set, GData *styles, GIOChannel *file, G return result; } -gboolean zMapGFFDumpRegion(ZMapFeatureAny dump_set, GData *styles, +gboolean zMapGFFDumpRegion(ZMapFeatureAny dump_set, GHashTable *styles, ZMapSpan region_span, GIOChannel *file, GError **error_out) { const char *sequence = NULL; @@ -249,22 +249,22 @@ gboolean zMapGFFDumpRegion(ZMapFeatureAny dump_set, GData *styles, /* This might get overwritten later, but as DumpToFile uses * Subset, there's a chance it wouldn't get set at all */ - gff_data.gff_sequence = sequence; + gff_data.gff_sequence = sequence; if(region_span) - result = zMapFeatureContextRangeDumpToFile((ZMapFeatureAny)dump_set, styles, region_span, + result = zMapFeatureContextRangeDumpToFile((ZMapFeatureAny)dump_set, styles, region_span, dump_gff_cb, &gff_data, file, error_out) ; else - result = zMapFeatureContextDumpToFile((ZMapFeatureAny)dump_set, styles, dump_gff_cb, + result = zMapFeatureContextDumpToFile((ZMapFeatureAny)dump_set, styles, dump_gff_cb, &gff_data, file, error_out) ; } - return result ; + return result ; } /*! * \brief Dump a list of ZMapFeatureAny. sequence can be NULL */ -gboolean zMapGFFDumpList(GList *dump_list, GData *styles, char *sequence, GIOChannel *file, GError **error_out) +gboolean zMapGFFDumpList(GList *dump_list, GHashTable *styles, char *sequence, GIOChannel *file, GError **error_out) { const char *int_sequence = NULL; gboolean result = FALSE ; @@ -290,16 +290,16 @@ gboolean zMapGFFDumpList(GList *dump_list, GData *styles, char *sequence, GIOCha /* This might get overwritten later, but as DumpToFile uses * Subset, there's a chance it wouldn't get set at all */ - gff_data.gff_sequence = int_sequence; + gff_data.gff_sequence = int_sequence; - result = zMapFeatureListDumpToFile(dump_list, styles, dump_gff_cb, &gff_data, + result = zMapFeatureListDumpToFile(dump_list, styles, dump_gff_cb, &gff_data, file, error_out) ; } return result ; } -gboolean zMapGFFDumpForeachList(ZMapFeatureAny first_feature, GData *styles, +gboolean zMapGFFDumpForeachList(ZMapFeatureAny first_feature, GHashTable *styles, GIOChannel *file, GError **error_out, char *sequence, GFunc *list_func_out, gpointer *list_data_out) @@ -325,10 +325,10 @@ gboolean zMapGFFDumpForeachList(ZMapFeatureAny first_feature, GData *styles, /* This might get overwritten later, but as DumpToFile uses * Subset, there's a chance it wouldn't get set at all */ - gff_data->gff_sequence = int_sequence; + gff_data->gff_sequence = int_sequence; result = zMapFeatureListForeachDumperCreate(dump_gff_cb, styles, gff_data, g_free, - file, error_out, + file, error_out, list_func_out, list_data_out) ; } } @@ -355,7 +355,7 @@ static gboolean dump_full_header(ZMapFeatureAny feature_any, GIOChannel *file, G header_data.gff_sequence = *sequence_in_out; /* gff-version, source-version, date */ - g_string_append_printf(header_data.header_string, + g_string_append_printf(header_data.header_string, "##gff-version %d\n" "##source-version %s %s\n" "##date %s\n", @@ -367,15 +367,15 @@ static gboolean dump_full_header(ZMapFeatureAny feature_any, GIOChannel *file, G zMapFeatureContextExecute(feature_any, ZMAPFEATURE_STRUCT_BLOCK, get_type_seq_header_cb, &header_data); - + if(header_data.status) { GIOStatus write_status ; gsize bytes_written ; - if ((write_status = g_io_channel_write_chars(file, - header_data.header_string->str, - header_data.header_string->len, + if ((write_status = g_io_channel_write_chars(file, + header_data.header_string->str, + header_data.header_string->len, &bytes_written, error_out)) != G_IO_STATUS_NORMAL) { header_data.status = FALSE; @@ -390,8 +390,8 @@ static gboolean dump_full_header(ZMapFeatureAny feature_any, GIOChannel *file, G return header_data.status; } -static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, - gpointer data, +static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, + gpointer data, gpointer user_data, char **err_out) { @@ -402,7 +402,7 @@ static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, switch(feature_any->struct_type) { case ZMAPFEATURE_STRUCT_CONTEXT: - + break; case ZMAPFEATURE_STRUCT_ALIGN: if(header_data->status && header_data->cont) @@ -426,17 +426,17 @@ static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, ZMapFeatureBlock feature_block = (ZMapFeatureBlock)feature_any; gboolean reversed = FALSE; int start, end; - + start = feature_block->block_to_sequence.q1; end = feature_block->block_to_sequence.q2; - + /* I'm a little unsure about the strand stuff...think more about this... */ if (feature_block->block_to_sequence.q_strand == ZMAPSTRAND_REVERSE) reversed = TRUE ; - + g_string_append_printf(header_data->header_string, "##sequence-region %s %d %d %s\n", - g_quark_to_string(feature_any->original_id), + g_quark_to_string(feature_any->original_id), start, end, (reversed ? "(reversed)" : "")) ; header_data->status = TRUE; header_data->cont = FALSE; @@ -452,15 +452,15 @@ static ZMapFeatureContextExecuteStatus get_type_seq_header_cb(GQuark key, return status; } -static gboolean dump_gff_cb(ZMapFeatureAny feature_any, - GData *styles, +static gboolean dump_gff_cb(ZMapFeatureAny feature_any, + GHashTable *styles, GString *gff_string, GError **error, gpointer user_data) { GFFDumpData gff_data = (GFFDumpData)user_data; gboolean result = TRUE; - + switch(feature_any->struct_type) { case ZMAPFEATURE_STRUCT_ALIGN: @@ -487,7 +487,7 @@ static gboolean dump_gff_cb(ZMapFeatureAny feature_any, gff_data->gff_source = (char *)zMapStyleGetName(style); if(!(gff_data->gff_feature = (char *)zMapStyleGetGFFFeature(style))) gff_data->gff_feature = (char *)g_quark_to_string(feature->ontology); - + /* Obligatory fields. */ g_string_append_printf(gff_string, GFF_SEQ_SOURCE_FEAT_START_END, @@ -501,7 +501,7 @@ static gboolean dump_gff_cb(ZMapFeatureAny feature_any, g_string_append_printf(gff_string, GFF_SEP_SCORE, feature->score) ; else g_string_append_printf(gff_string, GFF_SEP_NOSCORE, '.') ; - + g_string_append_printf(gff_string, GFF_STRAND_FRAME, strand2Char(feature->strand), phase2Char(feature->phase)) ; @@ -511,8 +511,8 @@ static gboolean dump_gff_cb(ZMapFeatureAny feature_any, switch(feature->type) { case ZMAPSTYLE_MODE_BASIC: - { - result = dump_attributes(gff_data->basic, feature, + { + result = dump_attributes(gff_data->basic, feature, &(feature->feature.basic), gff_string, error, gff_data); } @@ -524,15 +524,15 @@ static gboolean dump_gff_cb(ZMapFeatureAny feature_any, gff_data->link_term = "Sequence"; gff_data->link_term = gff_data->gff_feature; - result = dump_attributes(gff_data->transcript, feature, + result = dump_attributes(gff_data->transcript, feature, &(feature->feature.transcript), gff_string, error, gff_data); - + } break; case ZMAPSTYLE_MODE_ALIGNMENT: { - result = dump_attributes(gff_data->homol, feature, + result = dump_attributes(gff_data->homol, feature, &(feature->feature.homol), gff_string, error, gff_data); } @@ -585,10 +585,10 @@ static gboolean dump_attributes(DumpGFFAttrFunc func_array[], if((*funcs_ptr)(feature, feature_data, gff_string, error, gff_data)) need_separator = TRUE; - + funcs_ptr++; } - + return result; } @@ -602,7 +602,7 @@ static gboolean dump_text_note(ZMapFeature feature, if(feature->description) { - g_string_append_printf(gff_string, + g_string_append_printf(gff_string, GFF_ATTRIBUTE_TAB_BEGIN GFF_QUOTED_ATTRIBUTE GFF_ATTRIBUTE_TAB_END, "Note", feature->description); result = TRUE; @@ -624,11 +624,11 @@ static gboolean dump_transcript_identifier(ZMapFeature feature, gboolean result = TRUE; /* To make Sequence "AC12345.1" */ - g_string_append_printf(gff_string, + g_string_append_printf(gff_string, GFF_ATTRIBUTE_TAB_BEGIN GFF_QUOTED_ATTRIBUTE GFF_ATTRIBUTE_TAB_END, gff_data->link_term, gff_data->feature_name); - + return result; } @@ -644,13 +644,13 @@ static gboolean dump_transcript_locus(ZMapFeature feature, if(feature->locus_id) { /* To make Locus "AC12345.1" */ - g_string_append_printf(gff_string, + g_string_append_printf(gff_string, GFF_ATTRIBUTE_TAB_BEGIN GFF_QUOTED_ATTRIBUTE GFF_ATTRIBUTE_TAB_END, "Locus", (char *)g_quark_to_string(feature->locus_id)); result = TRUE; } - + return result; } @@ -668,7 +668,7 @@ static gboolean dump_transcript_subpart_lines(ZMapFeature feature, if(result && transcript->exons) { gff_data->gff_feature = "exon"; - result = dump_transcript_foreach_subpart(feature, gff_string, error, + result = dump_transcript_foreach_subpart(feature, gff_string, error, transcript->exons, gff_data); } @@ -682,19 +682,19 @@ static gboolean dump_transcript_subpart_lines(ZMapFeature feature, if(result && transcript->flags.cds) { gff_data->gff_feature = "CDS"; - g_string_append_printf(gff_string, + g_string_append_printf(gff_string, "\n" GFF_OBLIGATORY_NOSCORE, gff_data->gff_sequence, gff_data->gff_source, gff_data->gff_feature, - transcript->cds_start, + transcript->cds_start, transcript->cds_end, '.', strand2Char(feature->strand), phase2Char(feature->phase)) ; - + result = dump_transcript_identifier(feature, transcript, - gff_string, error, + gff_string, error, gff_data); } @@ -704,7 +704,7 @@ static gboolean dump_transcript_subpart_lines(ZMapFeature feature, static gboolean dump_transcript_foreach_subpart(ZMapFeature feature, GString *buffer, GError **error_out, - GArray *subparts, + GArray *subparts, GFFDumpData gff_data) { gboolean result = TRUE ; @@ -731,7 +731,7 @@ static gboolean dump_transcript_foreach_subpart(ZMapFeature feature, result = dump_transcript_identifier(feature, &(feature->feature.transcript), buffer, error_out, gff_data); } - + return result ; } @@ -747,7 +747,7 @@ static gboolean dump_alignment_target(ZMapFeature feature, gpointer homol_data, if(feature->original_id) { - g_string_append_printf(gff_string, + g_string_append_printf(gff_string, GFF_ATTRIBUTE_TAB_BEGIN GFF_QUOTED_ATTRIBUTE " %d %d" GFF_ATTRIBUTE_TAB_END, "Target", g_quark_to_string(feature->original_id), homol->y1, homol->y2); @@ -770,28 +770,28 @@ static gboolean dump_alignment_gaps(ZMapFeature feature, gpointer homol_data, has_gaps = TRUE; g_string_append_printf(gff_string, GFF_ATTRIBUTE_TAB_BEGIN "%s ", "Gaps"); - + g_string_append_c(gff_string, '"'); for(i = 0; i < gaps_array->len; i++) { ZMapAlignBlock block = NULL; - + block = &(g_array_index(gaps_array, ZMapAlignBlockStruct, i)); - - g_string_append_printf(gff_string, "%d %d %d %d,", - block->q1, block->q2, + + g_string_append_printf(gff_string, "%d %d %d %d,", + block->q1, block->q2, block->t1, block->t2); } - + /* remove the last comma! */ g_string_truncate(gff_string, gff_string->len - 1); /* and add a quote and a tab?*/ - g_string_append_printf(gff_string, + g_string_append_printf(gff_string, "%c" GFF_ATTRIBUTE_TAB_END, '"'); } - + return has_gaps; } @@ -804,7 +804,7 @@ static gboolean dump_alignment_clone(ZMapFeature feature, gpointer homol_data, if(homol->flags.has_clone_id) { - g_string_append_printf(gff_string, + g_string_append_printf(gff_string, GFF_ATTRIBUTE_TAB_BEGIN GFF_QUOTED_ATTRIBUTE GFF_ATTRIBUTE_TAB_END, "Clone", g_quark_to_string(homol->clone_id)); has_clone = TRUE; @@ -821,8 +821,8 @@ static gboolean dump_alignment_length(ZMapFeature feature, gpointer homol_data, gboolean has_length = FALSE; if(homol->length) - { - g_string_append_printf(gff_string, + { + g_string_append_printf(gff_string, GFF_ATTRIBUTE_TAB_BEGIN "Length %d" GFF_ATTRIBUTE_TAB_END, homol->length); has_length = TRUE; diff --git a/src/zmapGFF/zmapGFF2parser.c b/src/zmapGFF/zmapGFF2parser.c index 68beae32e..1cdca5bdf 100755 --- a/src/zmapGFF/zmapGFF2parser.c +++ b/src/zmapGFF/zmapGFF2parser.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Apr 28 09:11 2010 (edgrif) * Created: Fri May 28 14:25:12 2004 (edgrif) - * CVS info: $Id: zmapGFF2parser.c,v 1.110 2010-05-19 13:15:31 mh17 Exp $ + * CVS info: $Id: zmapGFF2parser.c,v 1.111 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -143,7 +143,7 @@ ZMapGFFParser zMapGFFCreateParser(void) /* We should do this internally with a var in the parser struct.... */ /* This function must be called prior to parsing feature lines, it is not required * for either the header lines or sequences. */ -gboolean zMapGFFParserInitForFeatures(ZMapGFFParser parser, GData *sources, gboolean parse_only) +gboolean zMapGFFParserInitForFeatures(ZMapGFFParser parser, GHashTable *sources, gboolean parse_only) { gboolean result = FALSE ; GQuark locus_id ; @@ -1158,7 +1158,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find, char *feature_name_id = NULL, *feature_name = NULL ; GQuark feature_style_id ; ZMapFeatureSet feature_set = NULL ; - ZMapFeatureTypeStyle feature_set_style, feature_style ; + ZMapFeatureTypeStyle feature_set_style = NULL, feature_style = NULL; ZMapFeature feature = NULL ; ZMapGFFParserFeatureSet parser_feature_set = NULL ; char *feature_set_name = NULL ; @@ -1232,11 +1232,18 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find, feature_set_name = source ; } + // get the feature set so that we can find the style for the feature; + parser_feature_set = (ZMapGFFParserFeatureSet)g_datalist_get_data(&(parser->feature_sets), + feature_set_name); + // we know featureset is set (see below) but this costs little + if(parser_feature_set && parser_feature_set->feature_set) + feature_set_style = parser_feature_set->feature_set->style; /* If a feature set style or a feature style is missing then we can't carry on. * NOTE the feature sets style has the same name as the feature set. */ - if (!(feature_set_style = zMapFindStyle(parser->sources, feature_style_id))) + + if (!feature_set_style && !(feature_set_style = zMapFindStyle(parser->sources, feature_style_id))) { *err_text = g_strdup_printf("feature ignored, could not find style \"%s\" for feature set \"%s\".", g_quark_to_string(feature_style_id), feature_set_name) ; @@ -1244,8 +1251,10 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find, return result ; } + feature_style = feature_set_style; - if (!(feature_style = zMapFindStyle(parser->sources, feature_style_id))) +#if MH17_NOT_NEEDED + if (!feature_style && !(feature_style = zMapFindStyle(parser->sources, feature_style_id))) { *err_text = g_strdup_printf("feature ignored, could not find its style \"%s\".", g_quark_to_string(feature_style_id)) ; @@ -1253,7 +1262,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find, return result ; } - +#endif /* I'M NOT HAPPY WITH THIS, IT DOESN'T WORK AS A CONCEPT....NEED TYPES IN FEATURE STRUCT * AND IN STYLE...BUT THEY HAVE DIFFERENT PURPOSE.... */ @@ -1308,9 +1317,9 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find, /* Check if the feature_set_name for this feature is already known, if it is then check if there * is already a multiline feature with the same name as we will need to augment it with this data. */ - if (!parser->parse_only && - (parser_feature_set = (ZMapGFFParserFeatureSet)g_datalist_get_data(&(parser->feature_sets), - feature_set_name))) + if (!parser->parse_only && parser_feature_set) +// (parser_feature_set = (ZMapGFFParserFeatureSet)g_datalist_get_data(&(parser->feature_sets), +// feature_set_name))) { feature_set = parser_feature_set->feature_set ; @@ -1348,7 +1357,14 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find, feature_set = parser_feature_set->feature_set = zMapFeatureSetCreate(feature_set_name, NULL) ; - zMapFeatureSetStyle(feature_set, feature_set_style) ; /* Set the style for the set. */ + // thse are both the same, feature_set_style no longer used + // but ZMap now has a column style in addition + // zMapFeatureSetStyle(feature_set, feature_set_style) ; /* Set the style for the set. */ + + // we need a copy as these may be re-used. + // styles have already been inherited by this point by zmapView code and passed back to us + feature_style = zMapFeatureStyleCopy(feature_style); + zMapFeatureSetStyle(feature_set, feature_style) ; /* Set the style for the set. */ parser_feature_set->multiline_features = NULL ; g_datalist_init(&(parser_feature_set->multiline_features)) ; @@ -1462,7 +1478,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find, result = zMapFeatureAddAlignmentData(feature, clone_id, query_start, query_end, homol_type, query_length, query_strand, ZMAPPHASE_0, - gaps, zmapStyleGetWithinAlignError(feature_style), + gaps, zMapStyleGetWithinAlignError(feature_style), local_sequence) ; } else if (feature_type == ZMAPSTYLE_MODE_ASSEMBLY_PATH) @@ -2463,6 +2479,9 @@ static void destroyFeatureArray(gpointer data) /* No data to free in this list, just clear it. */ g_datalist_clear(&(parser_feature_set->multiline_features)) ; + if(parser_feature_set->feature_set && parser_feature_set->feature_set->style) + zMapStyleDestroy(parser_feature_set->feature_set->style); + g_free(parser_feature_set) ; diff --git a/src/zmapGFF/zmapGFF_P.h b/src/zmapGFF/zmapGFF_P.h index bf468fd90..6eb6fa2ba 100755 --- a/src/zmapGFF/zmapGFF_P.h +++ b/src/zmapGFF/zmapGFF_P.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -27,7 +27,7 @@ * HISTORY: * Last edited: Apr 22 14:26 2010 (edgrif) * Created: Sat May 29 13:18:32 2004 (edgrif) - * CVS info: $Id: zmapGFF_P.h,v 1.22 2010-04-22 13:51:48 edgrif Exp $ + * CVS info: $Id: zmapGFF_P.h,v 1.23 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_GFF_P_H @@ -69,7 +69,7 @@ typedef enum { GFF_BUF_SEQUENCE, GFF_BUF_SOURCE, GFF_BUF_FEATURE_TYPE, GFF_BUF_SCORE, GFF_BUF_STRAND, GFF_BUF_PHASE, - GFF_BUF_ATTRIBUTES, GFF_BUF_COMMENTS, + GFF_BUF_ATTRIBUTES, GFF_BUF_COMMENTS, GFF_BUF_NUM } GFFStringFieldsType ; @@ -151,7 +151,8 @@ typedef struct ZMapGFFParserStruct_ GQuark locus_set_id ; /* If not zero then make a locus set from locus tags in sequence objects. */ - GData *sources ; /* If present, only make features from + // NB for sources read styles + GHashTable *sources ; /* If present, only make features from GFF records with a source from this list. */ @@ -165,7 +166,7 @@ typedef struct ZMapGFFParserStruct_ * known line length and construct a format string for the scanf using this length. */ gsize buffer_length ; char **buffers[GFF_BUF_NUM] ; - char *format_str ; + char *format_str ; /* Parsing DNA sequence data, used when DNA sequence is embedded in the file. */ struct diff --git a/src/zmapServer/acedb/acedbServer.c b/src/zmapServer/acedb/acedbServer.c index 8680a037f..cfc890055 100755 --- a/src/zmapServer/acedb/acedbServer.c +++ b/src/zmapServer/acedb/acedbServer.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Apr 21 17:20 2010 (edgrif) * Created: Wed Aug 6 15:46:38 2003 (edgrif) - * CVS info: $Id: acedbServer.c,v 1.156 2010-05-19 13:15:31 mh17 Exp $ + * CVS info: $Id: acedbServer.c,v 1.157 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ typedef struct { GList *methods ; GHashTable *method_2_data ; - GData *styles ; + GHashTable *styles ; } LoadableStruct, *Loadable ; @@ -96,7 +96,7 @@ typedef struct { ZMapServerResponseType result ; AcedbServer server ; - GData *styles ; + GHashTable *styles ; GHFunc eachBlock ; } DoAllAlignBlocksStruct, *DoAllAlignBlocks ; @@ -111,7 +111,7 @@ typedef struct typedef struct { GHashTable *method_2_data ; - GData *styles; + GHashTable *styles; GList *fetch_methods ; } MethodFetchStruct, *MethodFetch ; @@ -162,12 +162,12 @@ static ZMapServerResponseType getFeatureSetNames(void *server, GHashTable **featureset_2_stylelist_inout, GHashTable **featureset_2_column_inout, GHashTable **source_2_sourcedata_inout) ; -static ZMapServerResponseType getStyles(void *server, GData **styles_out) ; +static ZMapServerResponseType getStyles(void *server, GHashTable **styles_out) ; static ZMapServerResponseType haveModes(void *server, gboolean *have_mode) ; static ZMapServerResponseType getSequences(void *server_in, GList *sequences_inout) ; static ZMapServerResponseType setContext(void *server, ZMapFeatureContext feature_context) ; -static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFeatureContext feature_context_out) ; -static ZMapServerResponseType getContextSequence(void *server_in, GData *styles, ZMapFeatureContext feature_context_out) ; +static ZMapServerResponseType getFeatures(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context_out) ; +static ZMapServerResponseType getContextSequence(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context_out) ; static char *lastErrorMsg(void *server) ; static ZMapServerResponseType closeConnection(void *server_in) ; static ZMapServerResponseType destroyConnection(void *server) ; @@ -179,13 +179,13 @@ static ZMapServerResponseType findColStyleTags(AcedbServer server, GList **feature_methods_out, GList **required_styles_out, GHashTable **featureset_2_stylelist_inout) ; -static GList *getMethodsLoadable(GList *all_methods, GHashTable *method_2_data, GData *styles) ; +static GList *getMethodsLoadable(GList *all_methods, GHashTable *method_2_data, GHashTable *styles) ; static void loadableCB(gpointer data, gpointer user_data) ; static char *getMethodString(GList *styles_or_style_names, gboolean style_name_list, gboolean find_string, gboolean find_methods) ; static void addTypeName(gpointer data, gpointer user_data) ; -static gboolean sequenceRequest(AcedbServer server, GData *styles, ZMapFeatureBlock feature_block) ; -static gboolean blockDNARequest(AcedbServer server, GData *styles, ZMapFeatureBlock feature_block) ; +static gboolean sequenceRequest(AcedbServer server, GHashTable *styles, ZMapFeatureBlock feature_block) ; +static gboolean blockDNARequest(AcedbServer server, GHashTable *styles, ZMapFeatureBlock feature_block) ; static gboolean getDNARequest(AcedbServer server, char *sequence_name, int start, int end, int *dna_length_out, char **dna_sequence_out) ; static gboolean getSequenceMapping(AcedbServer server, ZMapFeatureContext feature_context) ; @@ -199,7 +199,7 @@ static gboolean checkServerVersion(AcedbServer server) ; static gboolean findSequence(AcedbServer server, char *sequence_name) ; static gboolean setQuietMode(AcedbServer server) ; -static gboolean parseTypes(AcedbServer server, GData **styles_out, +static gboolean parseTypes(AcedbServer server, GHashTable **styles_out, ParseMethodNamesFunc parse_func_in, gpointer user_data) ; static ZMapServerResponseType findMethods(AcedbServer server, char *search_str, int *num_found) ; static ZMapServerResponseType getObjNames(AcedbServer server, GList **style_names_out) ; @@ -626,7 +626,7 @@ static ZMapServerResponseType getFeatureSetNames(void *server_in, -static ZMapServerResponseType getStyles(void *server_in, GData **styles_out) +static ZMapServerResponseType getStyles(void *server_in, GHashTable **styles_out) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_REQFAIL ; AcedbServer server = (AcedbServer)server_in ; @@ -748,7 +748,7 @@ static ZMapServerResponseType setContext(void *server_in, ZMapFeatureContext fea /* Get features sequence. */ -static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFeatureContext feature_context) +static ZMapServerResponseType getFeatures(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context) { AcedbServer server = (AcedbServer)server_in ; DoAllAlignBlocksStruct get_features ; @@ -788,7 +788,7 @@ static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFe /* Get features and/or sequence. */ -static ZMapServerResponseType getContextSequence(void *server_in, GData *styles, ZMapFeatureContext feature_context) +static ZMapServerResponseType getContextSequence(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context) { AcedbServer server = (AcedbServer)server_in ; DoAllAlignBlocksStruct get_sequence ; @@ -1060,7 +1060,7 @@ static ZMapServerResponseType findColStyleTags(AcedbServer server, -static GList *getMethodsLoadable(GList *all_methods, GHashTable *method_2_data, GData *styles) +static GList *getMethodsLoadable(GList *all_methods, GHashTable *method_2_data, GHashTable *styles) { GList *loadable_methods = NULL ; LoadableStruct loadable_data ; @@ -1096,7 +1096,7 @@ static void loadableCB(gpointer data, gpointer user_data) { gboolean deferred = FALSE ; - g_object_get(style, ZMAPSTYLE_PROPERTY_DEFERRED, &deferred, NULL) ; + g_object_get(G_OBJECT(style), ZMAPSTYLE_PROPERTY_DEFERRED, &deferred, NULL) ; if (!deferred) loadable_data->methods = g_list_append(loadable_data->methods, GUINT_TO_POINTER(data)) ; @@ -1216,7 +1216,7 @@ static void addTypeName(gpointer data, gpointer user_data) * I guess the best thing is to shove the errors out to the log and look for the gff start... * */ -static gboolean sequenceRequest(AcedbServer server, GData *styles, ZMapFeatureBlock feature_block) +static gboolean sequenceRequest(AcedbServer server, GHashTable *styles, ZMapFeatureBlock feature_block) { gboolean result = FALSE ; char *gene_finder_cmds = "seqactions -gf_features no_draw ;" ; @@ -1529,7 +1529,7 @@ static void eachBlockDNARequest(gpointer key, gpointer data, gpointer user_data) * * */ -static gboolean blockDNARequest(AcedbServer server, GData *styles, ZMapFeatureBlock feature_block) +static gboolean blockDNARequest(AcedbServer server, GHashTable *styles, ZMapFeatureBlock feature_block) { gboolean result = FALSE ; ZMapFeatureContext context = NULL ; @@ -2211,7 +2211,7 @@ static gboolean getServerInfo(AcedbServer server, ZMapServerInfo info) * * * */ -static gboolean parseTypes(AcedbServer server, GData **types_out, +static gboolean parseTypes(AcedbServer server, GHashTable **types_out, ParseMethodNamesFunc parse_func_in, gpointer user_data) { gboolean result = FALSE ; @@ -2219,7 +2219,7 @@ static gboolean parseTypes(AcedbServer server, GData **types_out, char *acedb_request = NULL ; void *reply = NULL ; int reply_len = 0 ; - GData *types = NULL ; + GHashTable *types = NULL ; /* Get all the methods and then filter them if there are requested types. */ command = "show -a" ; @@ -2264,7 +2264,7 @@ static gboolean parseTypes(AcedbServer server, GData **types_out, } else if ((style = (parse_func)(next_line, &curr_pos, &col_group))) { - g_datalist_id_set_data(&types, zMapStyleGetUniqueID(style), style) ; + g_hash_table_insert(types, GUINT_TO_POINTER(zMapStyleGetUniqueID(style)), style) ; num_types++ ; } diff --git a/src/zmapServer/das/dasServer.c b/src/zmapServer/das/dasServer.c index f1312abdf..64e3cab58 100755 --- a/src/zmapServer/das/dasServer.c +++ b/src/zmapServer/das/dasServer.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Jan 14 10:10 2010 (edgrif) * Created: Wed Aug 6 15:46:38 2003 (edgrif) - * CVS info: $Id: dasServer.c,v 1.46 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: dasServer.c,v 1.47 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -42,14 +42,14 @@ typedef struct { ZMapServerResponseType result ; DasServer server ; - GData *styles ; + GHashTable *styles ; } GetFeaturesStruct, *GetFeatures ; typedef struct { ZMapFeatureBlock block; DasServer server; - GData *styles ; + GHashTable *styles ; } BlockServerStruct, *BlockServer; typedef struct @@ -62,7 +62,7 @@ typedef struct { ZMapServerResponseType result ; DasServer server; - GData *output; + GHashTable *output; }DasServerTypesStruct, *DasServerTypes; typedef struct @@ -88,7 +88,7 @@ static gboolean createConnection(void **server_out, char *version_str, int timeout) ; static ZMapServerResponseType openConnection(void *server,gboolean sequence_server) ; static ZMapServerResponseType getInfo(void *server, ZMapServerInfo info) ; -static ZMapServerResponseType getStyles(void *server, GData **styles_out) ; +static ZMapServerResponseType getStyles(void *server, GHashTable **styles_out) ; static ZMapServerResponseType haveModes(void *server, gboolean *have_mode) ; static ZMapServerResponseType getSequences(void *server_in, GList *sequences_inout) ; static ZMapServerResponseType getFeatureSets(void *server, @@ -99,8 +99,8 @@ static ZMapServerResponseType getFeatureSets(void *server, GHashTable **featureset_2_column_inout, GHashTable **source_2_sourcedata_inout) ; static ZMapServerResponseType setContext(void *server, ZMapFeatureContext feature_context); -static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFeatureContext feature_context) ; -static ZMapServerResponseType getContextSequence(void *server_in, GData *styles, ZMapFeatureContext feature_context) ; +static ZMapServerResponseType getFeatures(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context) ; +static ZMapServerResponseType getContextSequence(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context) ; static char *lastErrorMsg(void *server) ; static ZMapServerResponseType closeConnection(void *server) ; static ZMapServerResponseType destroyConnection(void *server) ; @@ -120,7 +120,7 @@ static void initialiseXMLParser(DasServer server); static void getFeatures4Aligns(gpointer key, gpointer data, gpointer userData); static void getFeatures4Blocks(gpointer key, gpointer data, gpointer userData) ; -static gboolean fetchFeatures(DasServer server, GData *styles, ZMapFeatureBlock block); +static gboolean fetchFeatures(DasServer server, GHashTable *styles, ZMapFeatureBlock block); /* curl required */ @@ -137,7 +137,7 @@ static void typesFilter (ZMapDAS1Type type, gpointer user_data static void featureFilter (ZMapDAS1Feature feature, gpointer user_data); static void stylesheetFilter (ZMapDAS1Stylesheet style, gpointer user_data); -static void applyGlyphToEachType(GQuark style_id, gpointer data, gpointer user_data) ; +static void applyGlyphToEachType(gpointer style_id, gpointer data, gpointer user_data) ; static gboolean getRequestedDSN(DasServer das, ZMapDAS1DSN *dsn_out); @@ -384,7 +384,7 @@ static ZMapServerResponseType getInfo(void *server_in, ZMapServerInfo info) -static ZMapServerResponseType getStyles(void *server_in, GData **types) +static ZMapServerResponseType getStyles(void *server_in, GHashTable **types) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_OK; DasServer server = (DasServer)server_in; @@ -487,7 +487,7 @@ static ZMapServerResponseType setContext(void *server, ZMapFeatureContext featur } -static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFeatureContext feature_context) +static ZMapServerResponseType getFeatures(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_OK; DasServer server = (DasServer)server_in; @@ -503,7 +503,7 @@ static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFe } -static ZMapServerResponseType getContextSequence(void *server_in, GData *styles, ZMapFeatureContext feature_context) +static ZMapServerResponseType getContextSequence(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_OK ; @@ -995,7 +995,7 @@ static void getFeatures4Blocks(gpointer key, gpointer data, gpointer userData) return ; } -static gboolean fetchFeatures(DasServer server, GData *styles, ZMapFeatureBlock block) +static gboolean fetchFeatures(DasServer server, GHashTable *styles, ZMapFeatureBlock block) { char *segStr = NULL, *query = NULL, *url = NULL; requestParseDetailStruct detail = {0}; @@ -1308,7 +1308,7 @@ static void typesFilter (ZMapDAS1Type type, gpointer user_data zMapStyleSetWidth(style, width) ; - g_datalist_id_set_data(&(server_types->output), zMapStyleGetID(style), style) ; + g_hash_table_insert(server_types->output, GUINT_TO_POINTER(zMapStyleGetID(style)), (gpointer) style) ; return ; } @@ -1332,7 +1332,7 @@ static void featureFilter (ZMapDAS1Feature feature, gpointer user_data /* gdouble feature_score = 0.0; */ gboolean has_score = TRUE; - GData *all_styles = NULL; + GHashTable *all_styles = NULL; char *feature_name = NULL, *short_ft_name = NULL, *type_name = NULL, @@ -1409,7 +1409,7 @@ static void featureFilter (ZMapDAS1Feature feature, gpointer user_data return ; } -static void applyGlyphToEachType(GQuark style_id, gpointer data, gpointer user_data) +static void applyGlyphToEachType(gpointer style_id, gpointer data, gpointer user_data) { ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle)data; ZMapDAS1Glyph glyph = (ZMapDAS1Glyph)user_data; @@ -1441,7 +1441,7 @@ static void stylesheetFilter (ZMapDAS1Stylesheet style, gpointer user_data) if(category->id == default_id) /* apply to all categories */ { if(type->id == default_id) /* apply to all types in all categories*/ - g_datalist_foreach(&(server_types->output), applyGlyphToEachType, (gpointer)glyph); + g_hash_table_foreach(server_types->output, applyGlyphToEachType, (gpointer)glyph); else /* apply to just the specific type in all categories */ printf("[dasServer] Applying type '%s' to like types in all categories\n", (char *)g_quark_to_string(type->id)); diff --git a/src/zmapServer/das/dasServer_P.h b/src/zmapServer/das/dasServer_P.h index 81f894dc4..57d747f5b 100755 --- a/src/zmapServer/das/dasServer_P.h +++ b/src/zmapServer/das/dasServer_P.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -22,11 +22,11 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk * - * Description: + * Description: * HISTORY: * Last edited: Feb 4 15:02 2009 (edgrif) * Created: Thu Mar 18 12:02:52 2004 (edgrif) - * CVS info: $Id: dasServer_P.h,v 1.13 2010-03-04 14:41:01 mh17 Exp $ + * CVS info: $Id: dasServer_P.h,v 1.14 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef DAS_SERVER_P_H @@ -95,8 +95,7 @@ typedef struct _DasServerStruct ZMapFeatureContext req_context ; ZMapFeatureContext cur_context ; - GData *curr_styles ; /* ROY you will probably want to chang - this ! */ + GHashTable *curr_styles ; } DasServerStruct, *DasServer ; diff --git a/src/zmapServer/pipe/pipeServer.c b/src/zmapServer/pipe/pipeServer.c index 82af5c69b..975f7c29f 100755 --- a/src/zmapServer/pipe/pipeServer.c +++ b/src/zmapServer/pipe/pipeServer.c @@ -34,7 +34,7 @@ * HISTORY: * Last edited: Jan 14 10:10 2010 (edgrif) * Created: 2009-11-26 12:02:40 (mh17) - * CVS info: $Id: pipeServer.c,v 1.23 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: pipeServer.c,v 1.24 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -82,12 +82,12 @@ static ZMapServerResponseType getFeatureSetNames(void *server, GHashTable **featureset_2_stylelist_inout, GHashTable **featureset_2_column_out, GHashTable **source_2_sourcedata_out) ; -static ZMapServerResponseType getStyles(void *server, GData **styles_out) ; +static ZMapServerResponseType getStyles(void *server, GHashTable **styles_out) ; static ZMapServerResponseType haveModes(void *server, gboolean *have_mode) ; static ZMapServerResponseType getSequences(void *server_in, GList *sequences_inout) ; static ZMapServerResponseType setContext(void *server, ZMapFeatureContext feature_context) ; -static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFeatureContext feature_context_out) ; -static ZMapServerResponseType getContextSequence(void *server_in, GData *styles, ZMapFeatureContext feature_context_out) ; +static ZMapServerResponseType getFeatures(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context_out) ; +static ZMapServerResponseType getContextSequence(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context_out) ; static char *lastErrorMsg(void *server) ; static ZMapServerResponseType closeConnection(void *server_in) ; static ZMapServerResponseType destroyConnection(void *server) ; @@ -462,7 +462,7 @@ static ZMapServerResponseType getFeatureSetNames(void *server_in, * something has gone wrong. * * */ -static ZMapServerResponseType getStyles(void *server_in, GData **styles_out) +static ZMapServerResponseType getStyles(void *server_in, GHashTable **styles_out) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_REQFAIL ; PipeServer server = (PipeServer)server_in ; @@ -653,7 +653,7 @@ static ZMapServerResponseType pipeGetSequence(PipeServer server) /* Get features sequence. */ -static ZMapServerResponseType getFeatures(void *server_in, GData *styles, ZMapFeatureContext feature_context) +static ZMapServerResponseType getFeatures(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context) { PipeServer server = (PipeServer)server_in ; @@ -808,7 +808,7 @@ static void eachAlignmentSequence(gpointer key, gpointer data, gpointer user_dat /* * we have pre-read the sequence and simple copy/move the data over if it's there */ -static ZMapServerResponseType getContextSequence(void *server_in, GData *styles, ZMapFeatureContext feature_context_out) +static ZMapServerResponseType getContextSequence(void *server_in, GHashTable *styles, ZMapFeatureContext feature_context_out) { PipeServer server = (PipeServer)server_in ; diff --git a/src/zmapServer/zmapServer.c b/src/zmapServer/zmapServer.c index 1fc7e1f69..847011fb1 100755 --- a/src/zmapServer/zmapServer.c +++ b/src/zmapServer/zmapServer.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Jan 14 10:10 2010 (edgrif) * Created: Wed Aug 6 15:46:38 2003 (edgrif) - * CVS info: $Id: zmapServer.c,v 1.46 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: zmapServer.c,v 1.47 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -211,7 +211,7 @@ ZMapServerResponseType zMapServerFeatureSetNames(ZMapServer server, } -ZMapServerResponseType zMapServerGetStyles(ZMapServer server, GData **styles_out) +ZMapServerResponseType zMapServerGetStyles(ZMapServer server, GHashTable **styles_out) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_REQFAIL ; @@ -294,7 +294,7 @@ ZMapServerResponseType zMapServerSetContext(ZMapServer server, ZMapFeatureContex } -ZMapServerResponseType zMapServerGetFeatures(ZMapServer server, GData *styles, ZMapFeatureContext feature_context) +ZMapServerResponseType zMapServerGetFeatures(ZMapServer server, GHashTable *styles, ZMapFeatureContext feature_context) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_REQFAIL ; @@ -315,7 +315,7 @@ ZMapServerResponseType zMapServerGetFeatures(ZMapServer server, GData *styles, Z } -ZMapServerResponseType zMapServerGetContextSequences(ZMapServer server, GData *styles, +ZMapServerResponseType zMapServerGetContextSequences(ZMapServer server, GHashTable *styles, ZMapFeatureContext feature_context) { ZMapServerResponseType result = ZMAP_SERVERRESPONSE_REQFAIL ; diff --git a/src/zmapServer/zmapServer.h b/src/zmapServer/zmapServer.h index 90e0e3e3a..9f357df4e 100755 --- a/src/zmapServer/zmapServer.h +++ b/src/zmapServer/zmapServer.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Jan 14 10:20 2010 (edgrif) * Created: Wed Aug 6 15:48:47 2003 (edgrif) - * CVS info: $Id: zmapServer.h,v 1.19 2010-03-04 14:40:58 mh17 Exp $ + * CVS info: $Id: zmapServer.h,v 1.20 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_SERVER_H @@ -68,14 +68,14 @@ ZMapServerResponseType zMapServerFeatureSetNames(ZMapServer server, GHashTable **featureset_2_stylelist_out, GHashTable **source_2_featureset_out, GHashTable **source_2_sourcedata_out) ; -ZMapServerResponseType zMapServerGetStyles(ZMapServer server, GData **types_out) ; +ZMapServerResponseType zMapServerGetStyles(ZMapServer server, GHashTable **types_out) ; ZMapServerResponseType zMapServerStylesHaveMode(ZMapServer server, gboolean *have_mode) ; ZMapServerResponseType zMapServerGetSequence(ZMapServer server, GList *sequences_inout) ; ZMapServerResponseType zMapServerSetContext(ZMapServer server, ZMapFeatureContext feature_context) ; ZMapFeatureContext zMapServerCopyContext(ZMapServer server) ; -ZMapServerResponseType zMapServerGetFeatures(ZMapServer server, GData *styles, ZMapFeatureContext feature_context) ; +ZMapServerResponseType zMapServerGetFeatures(ZMapServer server, GHashTable *styles, ZMapFeatureContext feature_context) ; ZMapServerResponseType zMapServerGetContextSequences(ZMapServer server, - GData *styles, ZMapFeatureContext feature_context) ; + GHashTable *styles, ZMapFeatureContext feature_context) ; char *zMapServerLastErrorMsg(ZMapServer server) ; ZMapServerResponseType zMapServerCloseConnection(ZMapServer server) ; ZMapServerResponseType zMapServerFreeConnection(ZMapServer server) ; diff --git a/src/zmapServer/zmapServerProtocolHandler.c b/src/zmapServer/zmapServerProtocolHandler.c index 8693509ee..f289cf124 100755 --- a/src/zmapServer/zmapServerProtocolHandler.c +++ b/src/zmapServer/zmapServerProtocolHandler.c @@ -27,7 +27,7 @@ * HISTORY: * Last edited: Jan 14 10:26 2010 (edgrif) * Created: Thu Jan 27 13:17:43 2005 (edgrif) - * CVS info: $Id: zmapServerProtocolHandler.c,v 1.60 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: zmapServerProtocolHandler.c,v 1.61 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ @@ -70,7 +70,7 @@ typedef struct typedef struct { - GData *all_styles ; + GHashTable *all_styles ; gboolean found_style ; GString *missing_styles ; } FindStylesStruct, *FindStyles ; @@ -92,10 +92,10 @@ static int findProtocol(gconstpointer list_protocol, gconstpointer protocol) ; static ZMapThreadReturnCode getSequence(ZMapServer server, ZMapServerReqGetSequence request, char **err_msg_out) ; static ZMapThreadReturnCode terminateServer(ZMapServer *server, char **err_msg_out) ; static ZMapThreadReturnCode destroyServer(ZMapServer *server) ; -static gboolean haveRequiredStyles(GData *all_styles, GList *required_styles, char **missing_styles_out) ; +static gboolean haveRequiredStyles(GHashTable *all_styles, GList *required_styles, char **missing_styles_out) ; static void findStyleCB(gpointer data, gpointer user_data) ; #if OLD_STYLES_CODE -static gboolean getStylesFromFile(char *styles_list, char *styles_file, GData **styles_out) ; +static gboolean getStylesFromFile(char *styles_list, char *styles_file, GHashTable **styles_out) ; #endif ZMapThreadReturnCode getStyles(ZMapServer server, ZMapServerReqStyles styles, char **err_msg_out) ; @@ -747,7 +747,7 @@ static ZMapThreadReturnCode destroyServer(ZMapServer *server) // returns whether we have any of the needed styles and lists the ones we don't -static gboolean haveRequiredStyles(GData *all_styles, GList *required_styles, char **missing_styles_out) +static gboolean haveRequiredStyles(GHashTable *all_styles, GList *required_styles, char **missing_styles_out) { gboolean result = FALSE ; FindStylesStruct find_data = {NULL} ; @@ -798,7 +798,7 @@ static void findStyleCB(gpointer data, gpointer user_data) ZMapThreadReturnCode getStyles(ZMapServer server, ZMapServerReqStyles styles, char **err_msg_out) { ZMapThreadReturnCode thread_rc = ZMAPTHREAD_RETURNCODE_OK ; - GData *tmp_styles = NULL ; + GHashTable *tmp_styles = NULL ; char *missing_styles = NULL ; @@ -859,7 +859,7 @@ ZMapThreadReturnCode getStyles(ZMapServer server, ZMapServerReqStyles styles, ch tmp_styles = zMapStyleMergeStyles(tmp_styles, styles->styles_out, ZMAPSTYLE_MERGE_MERGE) ; - zMapStyleDestroyStyles(&(styles->styles_out)) ; + zMapStyleDestroyStyles(styles->styles_out) ; if(styles_debug) @@ -876,7 +876,7 @@ ZMapThreadReturnCode getStyles(ZMapServer server, ZMapServerReqStyles styles, ch } /* Now we have all the styles do the inheritance for them all. */ - if (!zMapStyleInheritAllStyles(&(tmp_styles))) + if (!zMapStyleInheritAllStyles(tmp_styles)) zMapLogWarning("%s", "There were errors in inheriting styles.") ; diff --git a/src/zmapServer/zmapServerPrototype.h b/src/zmapServer/zmapServerPrototype.h index 49126fb80..1f13a4558 100755 --- a/src/zmapServer/zmapServerPrototype.h +++ b/src/zmapServer/zmapServerPrototype.h @@ -30,7 +30,7 @@ * HISTORY: * Last edited: Jan 14 09:51 2010 (edgrif) * Created: Wed Aug 6 15:48:47 2003 (edgrif) - * CVS info: $Id: zmapServerPrototype.h,v 1.35 2010-05-17 14:41:15 mh17 Exp $ + * CVS info: $Id: zmapServerPrototype.h,v 1.36 2010-06-08 08:31:24 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_SERVER_PROTOTYPEP_H @@ -74,7 +74,7 @@ typedef ZMapServerResponseType (*ZMapServerGetFeatureSets)(void *server_in, GHashTable **source_2_sourcedata_out) ; typedef ZMapServerResponseType (*ZMapServerGetStyles)(void *server_in, - GData **styles_out) ; + GHashTable **styles_out) ; typedef ZMapServerResponseType (*ZMapServerStylesHaveModes)(void *server_in, gboolean *have_modes_out) ; @@ -87,10 +87,10 @@ typedef ZMapFeatureContext (*ZMapServerCopyContextFunc)(void *server_conn) ; typedef ZMapServerResponseType - (*ZMapServerGetFeatures)(void *server_conn, GData *styles, ZMapFeatureContext feature_context) ; + (*ZMapServerGetFeatures)(void *server_conn, GHashTable *styles, ZMapFeatureContext feature_context) ; typedef ZMapServerResponseType - (*ZMapServerGetContextSequences)(void *server_conn, GData *styles, ZMapFeatureContext feature_context) ; + (*ZMapServerGetContextSequences)(void *server_conn, GHashTable *styles, ZMapFeatureContext feature_context) ; typedef char * (*ZMapServerGetErrorMsgFunc)(void *server_conn) ; diff --git a/src/zmapUtils/zmapGLibUtils.c b/src/zmapUtils/zmapGLibUtils.c index 9d06f2788..302c63f35 100755 --- a/src/zmapUtils/zmapGLibUtils.c +++ b/src/zmapUtils/zmapGLibUtils.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Jun 12 08:44 2009 (edgrif) * Created: Thu Oct 13 15:22:35 2005 (edgrif) - * CVS info: $Id: zmapGLibUtils.c,v 1.33 2010-05-25 14:17:01 mh17 Exp $ + * CVS info: $Id: zmapGLibUtils.c,v 1.34 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -78,8 +78,7 @@ typedef struct static inline GQuark g_quark_new(ZMapQuarkSet quark_set, gchar *string) ; static void printCB(gpointer data, gpointer user_data) ; static gint caseCompareFunc(gconstpointer a, gconstpointer b) ; -static void get_datalist_length(GQuark key, gpointer data, gpointer user_data); -static void get_first_datalist_key(GQuark id, gpointer data, gpointer user_data); + static gboolean getNthHashElement(gpointer key, gpointer value, gpointer user_data) ; static void hashCopyListCB(gpointer key, gpointer value, gpointer user_data) ; @@ -699,9 +698,29 @@ gboolean zMap_g_hash_table_iter_next(GList **iter,gpointer *key, gpointer *value * Additions to GDatalist */ - +#if MH17_NOT_USED G_LOCK_DEFINE_STATIC(datalist_first); +static void get_datalist_length(GQuark key, gpointer data, gpointer user_data) +{ + gint *length = (gint *)user_data; + + (*length)++; + + return ; +} + +static void get_first_datalist_key(GQuark id, gpointer data, gpointer user_data) +{ + DatalistFirstID key = (DatalistFirstID)user_data; + + if(!key->id) + key->id = id; + + return ; +} + + gpointer zMap_g_datalist_first(GData **datalist) { DatalistFirstIDStruct key = {0}; @@ -723,6 +742,7 @@ gint zMap_g_datalist_length(GData **datalist) return length; } +#endif /* * Additions to GArray @@ -993,25 +1013,6 @@ static gint caseCompareFunc(gconstpointer a, gconstpointer b) return result ; } -static void get_datalist_length(GQuark key, gpointer data, gpointer user_data) -{ - gint *length = (gint *)user_data; - - (*length)++; - - return ; -} - -static void get_first_datalist_key(GQuark id, gpointer data, gpointer user_data) -{ - DatalistFirstID key = (DatalistFirstID)user_data; - - if(!key->id) - key->id = id; - - return ; -} - diff --git a/src/zmapUtils/zmapUtils.c b/src/zmapUtils/zmapUtils.c index 6df1b7535..5f54188ac 100755 --- a/src/zmapUtils/zmapUtils.c +++ b/src/zmapUtils/zmapUtils.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,12 +23,12 @@ * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * * Description: Utility functions for the ZMap code. - * + * * Exported functions: See ZMap/zmapUtils.h * HISTORY: * Last edited: Jun 5 17:55 2009 (edgrif) * Created: Fri Mar 12 08:16:24 2004 (edgrif) - * CVS info: $Id: zmapUtils.c,v 1.33 2010-03-04 15:11:27 mh17 Exp $ + * CVS info: $Id: zmapUtils.c,v 1.34 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -51,9 +51,9 @@ static gboolean getVersionNumbers(char *version_str, /*! @defgroup zmaputils zMapUtils: utilities for ZMap * @{ - * + * * \brief Utilities for ZMap. - * + * * zMapUtils routines provide services such as debugging, testing and logging, * string handling, file utilities and GUI functions. They are general routines * used by all of ZMap. @@ -62,13 +62,13 @@ static gboolean getVersionNumbers(char *version_str, /*! Can be set on/off to turn on/off debugging output via the zMapDebug() macro. */ -gboolean zmap_debug_G = FALSE ; +gboolean zmap_debug_G = FALSE ; /*! A global timer used for giving overall timings for zmap operations. * See the timer macros in zmapUtilsDebug.h */ GTimer *zmap_global_timer_G = NULL ; - +gboolean zmap_timing_G = FALSE; // ouput timing info? @@ -283,7 +283,7 @@ char *zMapGetTimeString(ZMapTimeFormat format, char *format_str_in) /* Given an int between 0 and 9 returns the corresponding char representation, * (surely this must exist somewhere ??). - * + * * Returns '.' if number not in [0-9] * */ char zMapInt2Char(int num) @@ -302,7 +302,7 @@ char zMapInt2Char(int num) /* There follow a series of conversion routines. These are provided either * because there are no existing ones or because the existing ones have * arcane usage. - * + * * All of them can just be used to test for validity without needing a * return variable. * */ @@ -423,7 +423,7 @@ gboolean zMapStr2Float(char *str, float *float_out) if (str && *str) { errno = 0 ; - + ret_val = strtof(str, &end_ptr) ; if (ret_val == 0 && end_ptr == str) @@ -469,7 +469,7 @@ gboolean zMapStr2Double(char *str, double *double_out) if (str && *str) { errno = 0 ; - + ret_val = strtod(str, &end_ptr) ; if (ret_val == 0 && end_ptr == str) @@ -514,7 +514,7 @@ gboolean zMapStr2Double(char *str, double *double_out) * If the call failed and err_msg_out is non-NULL then an error message is returned * explaining the failure. The caller should free error message using g_free() when * no longer required. - * + * * It is not straight forward to interpret the return value of the system call so this * function attempts to interpret the value correctly. * @@ -564,7 +564,7 @@ gboolean zMapUtilsSysCall(char *cmd_str, char **err_msg_out) result = FALSE ; if (err_msg_out) *err_msg_out = g_strdup("Child process did not exit normally.") ; - + } else { @@ -572,7 +572,7 @@ gboolean zMapUtilsSysCall(char *cmd_str, char **err_msg_out) int true_rc ; true_rc = WEXITSTATUS(sys_rc) ; - + if (true_rc == EXIT_SUCCESS) result = TRUE ; else @@ -594,7 +594,7 @@ gboolean zMapUtilsSysCall(char *cmd_str, char **err_msg_out) void zMapPrintQuark(GQuark quark) { printf("GQuark (%d) = '%s'\n", quark, g_quark_to_string(quark)); - return ; + return ; } /* make logging from totalview evaluations a lot easier... */ @@ -659,7 +659,7 @@ gboolean zMapLogQuarkHasStr(GQuark quark, char *sub_str) -/* +/* * Internal routines. */ @@ -685,7 +685,7 @@ static gboolean getVersionNumbers(char *version_str, *release_out = release ; *update_out = update ; } - + return result ; } diff --git a/src/zmapUtils/zmapUtilsConfig.c b/src/zmapUtils/zmapUtilsConfig.c index 1bdab4914..85a82bf48 100755 --- a/src/zmapUtils/zmapUtilsConfig.c +++ b/src/zmapUtils/zmapUtilsConfig.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -22,12 +22,12 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk * - * Description: + * Description: * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Oct 1 16:07 2008 (rds) * Created: Mon Oct 18 09:05:27 2004 (edgrif) - * CVS info: $Id: zmapUtilsConfig.c,v 1.7 2010-03-04 15:11:28 mh17 Exp $ + * CVS info: $Id: zmapUtilsConfig.c,v 1.8 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -38,6 +38,7 @@ // headers for globals #include <ZMap/zmapThreads.h> #include <ZMap/zmapServerProtocol.h> +#include <ZMap/zmapUtilsDebug.h> /* SHOULD MAKE THIS INTO A COVER FUNCTION FOR A MORE GENERALISED FUNCTION THAT GIVEN @@ -55,20 +56,25 @@ gboolean zMapUtilsConfigDebug(void) { result = TRUE; - zMapConfigIniContextGetBoolean(context, - ZMAPSTANZA_DEBUG_CONFIG, + zMapConfigIniContextGetBoolean(context, + ZMAPSTANZA_DEBUG_CONFIG, ZMAPSTANZA_DEBUG_CONFIG, ZMAPSTANZA_DEBUG_APP_THREADS, &zmap_thread_debug_G); - zMapConfigIniContextGetBoolean(context, - ZMAPSTANZA_DEBUG_CONFIG, + zMapConfigIniContextGetBoolean(context, + ZMAPSTANZA_DEBUG_CONFIG, ZMAPSTANZA_DEBUG_CONFIG, ZMAPSTANZA_DEBUG_APP_FEATURE2STYLE, &zmap_server_feature2style_debug_G); - zMapConfigIniContextGetBoolean(context, - ZMAPSTANZA_DEBUG_CONFIG, + zMapConfigIniContextGetBoolean(context, + ZMAPSTANZA_DEBUG_CONFIG, ZMAPSTANZA_DEBUG_CONFIG, ZMAPSTANZA_DEBUG_APP_STYLES, &zmap_server_styles_debug_G); + zMapConfigIniContextGetBoolean(context, + ZMAPSTANZA_DEBUG_CONFIG, + ZMAPSTANZA_DEBUG_CONFIG, + ZMAPSTANZA_DEBUG_APP_TIMING, &zmap_timing_G); + zMapConfigIniContextDestroy(context); } diff --git a/src/zmapView/zmapView.c b/src/zmapView/zmapView.c index 9230b5962..a123d5cc4 100755 --- a/src/zmapView/zmapView.c +++ b/src/zmapView/zmapView.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: May 5 17:39 2010 (edgrif) * Created: Thu May 13 15:28:26 2004 (edgrif) - * CVS info: $Id: zmapView.c,v 1.200 2010-06-03 12:21:41 mh17 Exp $ + * CVS info: $Id: zmapView.c,v 1.201 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -44,6 +44,7 @@ #include <ZMap/zmapUtilsXRemote.h> #include <ZMap/zmapXRemote.h> #include <ZMap/zmapCmdLineArgs.h> +#include <ZMap/zmapConfigDir.h> #include <ZMap/zmapConfigIni.h> #include <ZMap/zmapConfigStrings.h> #include <ZMap/zmapConfigStanzaStructs.h> @@ -78,7 +79,7 @@ typedef struct GHashTable *featureset_2_column; // needed by pipeServers GHashTable *source_2_sourcedata; - GData *curr_styles ; /* Styles for this context. */ + GHashTable *curr_styles ; /* Styles for this context. */ ZMapFeatureContext curr_context ; ZMapServerReqType display_after ; @@ -94,7 +95,7 @@ typedef struct typedef struct { - GData *styles ; + GHashTable *styles ; gboolean error ; } UnsetDeferredLoadStylesStruct, *UnsetDeferredLoadStyles ; @@ -120,7 +121,7 @@ static void viewSplitToPatternCB(ZMapWindow window, void *caller_data, void *win static void setZoomStatus(gpointer data, gpointer user_data); static void splitMagic(gpointer data, gpointer user_data); -static void unsetDeferredLoadStylesCB(GQuark key_id, gpointer data, gpointer user_data) ; +static void unsetDeferredLoadStylesCB(gpointer key_id, gpointer data, gpointer user_data) ; static void startStateConnectionChecking(ZMapView zmap_view) ; #ifdef ED_G_NEVER_INCLUDE_THIS_CODE @@ -150,14 +151,14 @@ static void killConnections(ZMapView zmap_view) ; static void resetWindows(ZMapView zmap_view) ; static void displayDataWindows(ZMapView zmap_view, ZMapFeatureContext all_features, - ZMapFeatureContext new_features, GData *new_styles, + ZMapFeatureContext new_features, GHashTable *new_styles, gboolean undisplay) ; static void killAllWindows(ZMapView zmap_view) ; static ZMapViewWindow createWindow(ZMapView zmap_view, ZMapWindow window) ; static void destroyWindow(ZMapView zmap_view, ZMapViewWindow view_window) ; -static void getFeatures(ZMapView zmap_view, ZMapServerReqGetFeatures feature_req, GData *styles) ; +static void getFeatures(ZMapView zmap_view, ZMapServerReqGetFeatures feature_req, GHashTable *styles) ; #ifdef ED_G_NEVER_INCLUDE_THIS_CODE @@ -165,8 +166,8 @@ static GList *string2StyleQuarks(char *feature_sets) ; static gboolean nextIsQuoted(char **text) ; #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ -static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inout, GData *styles); -static void justDrawContext(ZMapView view, ZMapFeatureContext diff_context, GData *styles); +static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inout, GHashTable *styles); +static void justDrawContext(ZMapView view, ZMapFeatureContext diff_context, GHashTable *styles); static ZMapFeatureContext createContext(char *sequence, int start, int end, GList *feature_set_names) ; @@ -174,7 +175,7 @@ static ZMapViewWindow addWindow(ZMapView zmap_view, GtkWidget *parent_widget) ; static void addAlignments(ZMapFeatureContext context) ; -static gboolean mergeAndDrawContext(ZMapView view, ZMapFeatureContext context_inout, GData *styles); +static gboolean mergeAndDrawContext(ZMapView view, ZMapFeatureContext context_inout, GHashTable *styles); static void eraseAndUndrawContext(ZMapView view, ZMapFeatureContext context_inout); #ifdef NOT_REQUIRED_ATM @@ -193,11 +194,11 @@ static void killAllSpawned(ZMapView zmap_view); static gboolean checkContinue(ZMapView zmap_view) ; -static gboolean makeStylesDrawable(GData *styles, char **missing_styles_out) ; -static void drawableCB(GQuark key_id, gpointer data, gpointer user_data) ; +static gboolean makeStylesDrawable(GHashTable *styles, char **missing_styles_out) ; +static void drawableCB(gpointer key_id, gpointer data, gpointer user_data) ; -static void addPredefined(GData **styles_inout, GHashTable **featureset_2_stylelist_inout) ; -static void styleCB(GQuark key_id, gpointer data, gpointer user_data) ; +static void addPredefined(GHashTable **styles_inout, GHashTable **featureset_2_stylelist_inout) ; +static void styleCB(gpointer key_id, gpointer data, gpointer user_data) ; static void invoke_merge_in_names(gpointer list_data, gpointer user_data); @@ -327,6 +328,7 @@ ZMapViewWindow zMapViewCreate(GtkWidget *xremote_widget, GtkWidget *view_contain * in config file and next time they create a view the debugging will go on/off. */ zMapUtilsConfigDebug(); + zMapInitTimer() ; // operates as a reset if already defined /* Set up sequence to be fetched, in this case server defaults to whatever is set in config. file. */ sequence_fetch = g_new0(ZMapViewSequenceMapStruct, 1) ; @@ -701,7 +703,7 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str) { GList *settings_list = NULL, *free_this_list = NULL; - zMapStartTimer(ZMAP_GLOBAL_TIMER) ; + zMapPrintTimer(NULL, "Open connection") ; zmapViewBusy(zmap_view, TRUE) ; @@ -910,7 +912,7 @@ ZMapViewWindow zMapViewCopyWindow(ZMapView zmap_view, GtkWidget *parent_widget, if (zmap_view->state != ZMAPVIEW_DYING) { - GData *copy_styles ; + GHashTable *copy_styles ; /* the view _must_ already have a window _and_ data. */ @@ -1178,29 +1180,36 @@ gboolean zMapViewReverseComplement(ZMapView zmap_view) zmapViewBusy(zmap_view, TRUE) ; + zMapStartTimer("RevComp",""); + /* Call the feature code that will do the revcomp. */ zMapFeatureReverseComplement(zmap_view->features, zmap_view->orig_styles) ; + zMapStopTimer("RevComp","Feature"); + /* Set our record of reverse complementing. */ zmap_view->revcomped_features = !(zmap_view->revcomped_features) ; zMapWindowNavigatorReset(zmap_view->navigator_window); zMapWindowNavigatorSetStrand(zmap_view->navigator_window, zmap_view->revcomped_features); zMapWindowNavigatorDrawFeatures(zmap_view->navigator_window, zmap_view->features, zmap_view->orig_styles); + zMapStopTimer("RevComp","Navigator"); if((list_item = g_list_first(zmap_view->window_list))) { do { ZMapViewWindow view_window ; - GData *copy_styles = NULL; + GHashTable *copy_styles = NULL; view_window = list_item->data ; copy_styles = zmap_view->orig_styles ; + zMapStartTimer("RevComp","Window"); zMapWindowFeatureRedraw(view_window->window, zmap_view->features, zmap_view->orig_styles, copy_styles, TRUE) ; + zMapStopTimer("RevComp","Window"); } while ((list_item = g_list_next(list_item))) ; } @@ -1209,6 +1218,7 @@ gboolean zMapViewReverseComplement(ZMapView zmap_view) /* signal our caller that we have data. */ (*(view_cbs_G->load_data))(zmap_view, zmap_view->app_data, NULL) ; + zMapStopTimer("RevComp",""); zmapViewBusy(zmap_view, FALSE); result = TRUE ; @@ -1356,9 +1366,9 @@ ZMapFeatureContext zMapViewGetFeatures(ZMapView zmap_view) return features ; } -GData *zMapViewGetStyles(ZMapViewWindow view_window) +GHashTable *zMapViewGetStyles(ZMapViewWindow view_window) { - GData *styles = NULL ; + GHashTable *styles = NULL ; ZMapView view = zMapViewGetView(view_window); if (view->state != ZMAPVIEW_DYING) @@ -2871,9 +2881,9 @@ printf("\nview styles lists after merge:\n"); ZMapServerReqStyles get_styles = (ZMapServerReqStyles)req_any ; //printf("\nmerging...old\n"); - //g_datalist_foreach(&(zmap_view->orig_styles), printStyle, "got styles") ; + //g_hash_table_foreach(&(zmap_view->orig_styles), printStyle, "got styles") ; //printf("\nmerging...new\n"); - //g_datalist_foreach(&(get_styles->styles_out), printStyle, "got styles") ; + //g_hash_table_foreach(&(get_styles->styles_out), printStyle, "got styles") ; /* Merge the retrieved styles into the views canonical style list. */ zmap_view->orig_styles = zMapStyleMergeStyles(zmap_view->orig_styles, get_styles->styles_out, @@ -2884,9 +2894,9 @@ printf("\nview styles lists after merge:\n"); gboolean is_complete_sequence = FALSE; if (is_complete_sequence) - g_datalist_foreach(&(zmap_view->orig_styles), unsetDeferredLoadStylesCB, NULL) ; + g_hash_table_foreach(zmap_view->orig_styles, unsetDeferredLoadStylesCB, NULL) ; - g_datalist_foreach(&(get_styles->styles_out), unsetDeferredLoadStylesCB, NULL) ; + g_hash_table_foreach(get_styles->styles_out, unsetDeferredLoadStylesCB, NULL) ; } @@ -3287,7 +3297,7 @@ static void resetWindows(ZMapView zmap_view) /* Signal all windows there is data to draw. */ static void displayDataWindows(ZMapView zmap_view, ZMapFeatureContext all_features, - ZMapFeatureContext new_features, GData *new_styles, + ZMapFeatureContext new_features, GHashTable *new_styles, gboolean undisplay) { GList *list_item, *window_list = NULL; @@ -3405,7 +3415,7 @@ static void destroyWindow(ZMapView zmap_view, ZMapViewWindow view_window) /* We have far too many function calls here...it's all confusing..... */ -static void getFeatures(ZMapView zmap_view, ZMapServerReqGetFeatures feature_req, GData *styles) +static void getFeatures(ZMapView zmap_view, ZMapServerReqGetFeatures feature_req, GHashTable *styles) { ZMapFeatureContext new_features = NULL ; @@ -3434,7 +3444,7 @@ static void getFeatures(ZMapView zmap_view, ZMapServerReqGetFeatures feature_req * We should free the context_inout context here....actually better * would to have a "free" flag............ * */ -static gboolean mergeAndDrawContext(ZMapView view, ZMapFeatureContext context_in, GData *styles) +static gboolean mergeAndDrawContext(ZMapView view, ZMapFeatureContext context_in, GHashTable *styles) { gboolean merge_results = FALSE ; ZMapFeatureContext diff_context = NULL ; @@ -3449,7 +3459,7 @@ static gboolean mergeAndDrawContext(ZMapView view, ZMapFeatureContext context_in return merge_results ; } -static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inout, GData *styles) +static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inout, GHashTable *styles) { gboolean merge_result = FALSE ; ZMapFeatureContext new_features, diff_context = NULL ; @@ -3459,15 +3469,15 @@ static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inou // printf("just Merge new = %s\n",zMapFeatureContextGetDNAStatus(new_features) ? "yes" : "non"); - zMapPrintTimer(NULL, "Merge Context starting...") ; + zMapStartTimer("Merge Context","") ; if (view->revcomped_features) { - zMapPrintTimer(NULL, "Merge Context has to rev comp first, starting") ; + zMapStartTimer("MergeRevComp","") ; zMapFeatureReverseComplement(new_features, view->orig_styles); - zMapPrintTimer(NULL, "Merge Context has to rev comp first, finished") ; + zMapStopTimer("MergeRevComp","") ; } merge = zMapFeatureContextMerge(&(view->features), &new_features, &diff_context) ; @@ -3496,7 +3506,7 @@ static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inou zMapLogCritical("%s", "Context merge failed, serious error.") ; - zMapPrintTimer(NULL, "Merge Context Finished.") ; + zMapStopTimer("Merge Context","") ; /* Return the diff_context which is the just the new features (NULL if merge fails). */ *context_inout = diff_context ; @@ -3504,7 +3514,7 @@ static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inou return merge_result ; } -static void justDrawContext(ZMapView view, ZMapFeatureContext diff_context, GData *new_styles) +static void justDrawContext(ZMapView view, ZMapFeatureContext diff_context, GHashTable *new_styles) { /* Signal the ZMap that there is work to be done. */ displayDataWindows(view, view->features, diff_context, new_styles, FALSE) ; @@ -4157,12 +4167,12 @@ static gboolean checkContinue(ZMapView zmap_view) -static gboolean makeStylesDrawable(GData *styles, char **missing_styles_out) +static gboolean makeStylesDrawable(GHashTable *styles, char **missing_styles_out) { gboolean result = FALSE ; DrawableDataStruct drawable_data = {FALSE} ; - g_datalist_foreach(&styles, drawableCB, &drawable_data) ; + g_hash_table_foreach(styles, drawableCB, &drawable_data) ; if (drawable_data.missing_styles) *missing_styles_out = g_string_free(drawable_data.missing_styles, FALSE) ; @@ -4174,9 +4184,10 @@ static gboolean makeStylesDrawable(GData *styles, char **missing_styles_out) -/* A GDataForeachFunc() to make the given style drawable. */ -static void drawableCB(GQuark key_id, gpointer data, gpointer user_data) +/* A GHashListForeachFunc() to make the given style drawable. */ +static void drawableCB(gpointer key, gpointer data, gpointer user_data) { + GQuark key_id = GPOINTER_TO_UINT(key); ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle)data ; DrawableData drawable_data = (DrawableData)user_data ; @@ -4200,8 +4211,8 @@ static void drawableCB(GQuark key_id, gpointer data, gpointer user_data) -/* A GDataForeachFunc() func that unsets DeferredLoads for styles in the target. */ -static void unsetDeferredLoadStylesCB(GQuark key_id, gpointer data, gpointer user_data_unused) +/* A GhashListForeachFunc() func that unsets DeferredLoads for styles in the target. */ +static void unsetDeferredLoadStylesCB(gpointer key, gpointer data, gpointer user_data_unused) { ZMapFeatureTypeStyle orig_style = (ZMapFeatureTypeStyle)data ; @@ -4214,14 +4225,14 @@ static void unsetDeferredLoadStylesCB(GQuark key_id, gpointer data, gpointer use -static void addPredefined(GData **styles_out, GHashTable **featureset_2_stylelist_inout) +static void addPredefined(GHashTable **styles_out, GHashTable **featureset_2_stylelist_inout) { - GData *styles ; + GHashTable *styles ; GHashTable *f2s = *featureset_2_stylelist_inout ; styles = zMapStyleGetAllPredefined() ; - g_datalist_foreach(&styles, styleCB, f2s) ; + g_hash_table_foreach(styles, styleCB, f2s) ; *styles_out = styles ; *featureset_2_stylelist_inout = f2s ; @@ -4229,9 +4240,10 @@ static void addPredefined(GData **styles_out, GHashTable **featureset_2_stylelis return ; } -/* GDataForeachFunc() to set up a feature_set/style hash. */ -static void styleCB(GQuark key_id, gpointer data, gpointer user_data) +/* GHashListForeachFunc() to set up a feature_set/style hash. */ +static void styleCB(gpointer key, gpointer data, gpointer user_data) { + GQuark key_id = GPOINTER_TO_UINT(key); GHashTable *hash = (GHashTable *)user_data ; GQuark feature_set_id, feature_set_name_id; diff --git a/src/zmapView/zmapViewRemoteReceive.c b/src/zmapView/zmapViewRemoteReceive.c index 5e1291da6..11a2fbc70 100755 --- a/src/zmapView/zmapViewRemoteReceive.c +++ b/src/zmapView/zmapViewRemoteReceive.c @@ -31,7 +31,7 @@ * HISTORY: * Last edited: Apr 30 13:15 2010 (edgrif) * Created: Tue Jul 10 21:02:42 2007 (rds) - * CVS info: $Id: zmapViewRemoteReceive.c,v 1.47 2010-06-03 12:21:42 mh17 Exp $ + * CVS info: $Id: zmapViewRemoteReceive.c,v 1.48 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -121,8 +121,8 @@ typedef struct GQuark style_id ; ZMapFeatureTypeStyle style ; - GList *feature_list; - GData *styles; + GList *feature_list; + GHashTable *styles; GList *locations ; diff --git a/src/zmapView/zmapView_P.h b/src/zmapView/zmapView_P.h index 9dc079981..4f6a15a7e 100755 --- a/src/zmapView/zmapView_P.h +++ b/src/zmapView/zmapView_P.h @@ -26,7 +26,7 @@ * HISTORY: * Last edited: Apr 7 13:48 2010 (edgrif) * Created: Thu May 13 15:06:21 2004 (edgrif) - * CVS info: $Id: zmapView_P.h,v 1.61 2010-05-17 14:41:16 mh17 Exp $ + * CVS info: $Id: zmapView_P.h,v 1.62 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_VIEW_P_H @@ -253,7 +253,7 @@ typedef struct _ZMapViewStruct /* Original styles, these are all the styles as they were loaded from the server(s). * N.B. the list may be updated during the lifetime of the view and hence is always * passed into window for all update operations. */ - GData *orig_styles ; + GHashTable *orig_styles ; GHashTable *featureset_2_stylelist ; /* Mapping of each feature_set to all the styles * the styles it requires. using a GHashTable of diff --git a/src/zmapWindow/items/zmapWindowAlignmentFeature.c b/src/zmapWindow/items/zmapWindowAlignmentFeature.c index 6e613a62b..99691fc01 100755 --- a/src/zmapWindow/items/zmapWindowAlignmentFeature.c +++ b/src/zmapWindow/items/zmapWindowAlignmentFeature.c @@ -30,7 +30,7 @@ * HISTORY: * Last edited: May 26 12:53 2010 (edgrif) * Created: Wed Dec 3 10:02:22 2008 (rds) - * CVS info: $Id: zmapWindowAlignmentFeature.c,v 1.10 2010-05-26 12:44:34 edgrif Exp $ + * CVS info: $Id: zmapWindowAlignmentFeature.c,v 1.11 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -132,7 +132,9 @@ void zmap_window_alignment_feature_clear(ZMapWindowCanvasItem canvas_item) style = (ZMAP_CANVAS_ITEM_GET_CLASS(canvas_item)->get_style)(canvas_item); - zMapStyleGetGappedAligns(style, &parse_gaps, &show_gaps) ; +// zMapStyleGetGappedAligns(style, &parse_gaps, &show_gaps) ; + parse_gaps = zMapStyleIsParseGaps(style); + show_gaps = zMapStyleIsShowGaps(style); if(alignment->flags.no_gaps_hidden == 0 && alignment->flags.no_gaps_display == 1 && diff --git a/src/zmapWindow/items/zmapWindowAlignmentFeature.h b/src/zmapWindow/items/zmapWindowAlignmentFeature.h index 9f3eccf03..86fe1226c 100755 --- a/src/zmapWindow/items/zmapWindowAlignmentFeature.h +++ b/src/zmapWindow/items/zmapWindowAlignmentFeature.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Feb 16 10:14 2010 (edgrif) * Created: Wed Dec 3 08:44:06 2008 (rds) - * CVS info: $Id: zmapWindowAlignmentFeature.h,v 1.4 2010-03-04 15:11:41 mh17 Exp $ + * CVS info: $Id: zmapWindowAlignmentFeature.h,v 1.5 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -42,8 +42,15 @@ #define ZMAP_WINDOW_ALIGNMENT_FEATURE_NAME "ZMapWindowAlignmentFeature" #define ZMAP_TYPE_WINDOW_ALIGNMENT_FEATURE (zMapWindowAlignmentFeatureGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_ALIGNMENT_FEATURE(obj) ((ZMapWindowAlignmentFeature) obj) +#define ZMAP_WINDOW_ALIGNMENT_FEATURE_CONST(obj) ((ZMapWindowAlignmentFeature const) obj) +#else #define ZMAP_WINDOW_ALIGNMENT_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_ALIGNMENT_FEATURE, zmapWindowAlignmentFeature)) #define ZMAP_WINDOW_ALIGNMENT_FEATURE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_ALIGNMENT_FEATURE, zmapWindowAlignmentFeature const)) +#endif + #define ZMAP_WINDOW_ALIGNMENT_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_ALIGNMENT_FEATURE, zmapWindowAlignmentFeatureClass)) #define ZMAP_IS_WINDOW_ALIGNMENT_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_ALIGNMENT_FEATURE)) #define ZMAP_WINDOW_ALIGNMENT_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_ALIGNMENT_FEATURE, zmapWindowAlignmentFeatureClass)) diff --git a/src/zmapWindow/items/zmapWindowAssemblyFeature.h b/src/zmapWindow/items/zmapWindowAssemblyFeature.h index 76fadc469..1b2ffb0ba 100755 --- a/src/zmapWindow/items/zmapWindowAssemblyFeature.h +++ b/src/zmapWindow/items/zmapWindowAssemblyFeature.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Feb 16 10:16 2010 (edgrif) * Created: Wed Dec 3 08:44:06 2008 (rds) - * CVS info: $Id: zmapWindowAssemblyFeature.h,v 1.4 2010-03-04 15:11:44 mh17 Exp $ + * CVS info: $Id: zmapWindowAssemblyFeature.h,v 1.5 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_ASSEMBLY_FEATURE_H @@ -41,8 +41,15 @@ #define ZMAP_WINDOW_ASSEMBLY_FEATURE_NAME "ZMapWindowAssemblyFeature" #define ZMAP_TYPE_WINDOW_ASSEMBLY_FEATURE (zMapWindowAssemblyFeatureGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_ASSEMBLY_FEATURE(obj) ((ZMapWindowAssemblyFeature) obj) +#define ZMAP_WINDOW_ASSEMBLY_FEATURE_CONST(obj) ((ZMapWindowAssemblyFeature const) obj) +#else #define ZMAP_WINDOW_ASSEMBLY_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_ASSEMBLY_FEATURE, zmapWindowAssemblyFeature)) #define ZMAP_WINDOW_ASSEMBLY_FEATURE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_ASSEMBLY_FEATURE, zmapWindowAssemblyFeature const)) +#endif + #define ZMAP_WINDOW_ASSEMBLY_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_ASSEMBLY_FEATURE, zmapWindowAssemblyFeatureClass)) #define ZMAP_IS_WINDOW_ASSEMBLY_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_ASSEMBLY_FEATURE)) #define ZMAP_WINDOW_ASSEMBLY_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_ASSEMBLY_FEATURE, zmapWindowAssemblyFeatureClass)) diff --git a/src/zmapWindow/items/zmapWindowBasicFeature.c b/src/zmapWindow/items/zmapWindowBasicFeature.c index 52b14db5d..1d1e25616 100755 --- a/src/zmapWindow/items/zmapWindowBasicFeature.c +++ b/src/zmapWindow/items/zmapWindowBasicFeature.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: May 26 12:54 2010 (edgrif) * Created: Wed Dec 3 10:02:22 2008 (rds) - * CVS info: $Id: zmapWindowBasicFeature.c,v 1.19 2010-05-26 12:47:40 edgrif Exp $ + * CVS info: $Id: zmapWindowBasicFeature.c,v 1.20 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -135,7 +135,6 @@ static FooCanvasItem *zmap_window_basic_feature_add_interval(ZMapWindowCanvasIte ZMapFeature feature; gboolean interval_type_from_feature_type = TRUE; /* for now */ feature = basic->feature; - style = (ZMAP_CANVAS_ITEM_GET_CLASS(basic)->get_style)(basic); if (interval_type_from_feature_type) @@ -169,12 +168,16 @@ static FooCanvasItem *zmap_window_basic_feature_add_interval(ZMapWindowCanvasIte which = feature->boundary_type == ZMAPBOUNDARY_5_SPLICE ? 5 : 3; } - // style is as configured or retrofitted in zMapStyleMakeDrawable() - // x and y coords are relative to main feature set up in CanvasItemCreate() - item = FOO_CANVAS_ITEM(zMapWindowGlyphItemCreate(FOO_CANVAS_GROUP(basic), - style, which, 0.0, 0.0, feature->score,strand)); + style = (ZMAP_CANVAS_ITEM_GET_CLASS(basic)->get_style)(basic); + // style is as configured or retrofitted in zMapStyleMakeDrawable() + // x and y coords are relative to main feature set up in CanvasItemCreate() - // colour should be set by caller, esp if style is frame specific + // style is as configured or retrofitted in zMapStyleMakeDrawable() + // x and y coords are relative to main feature set up in CanvasItemCreate() + item = FOO_CANVAS_ITEM(zMapWindowGlyphItemCreate(FOO_CANVAS_GROUP(basic), + style, which, 0.0, 0.0, feature->score,strand)); + + // colour should be set by caller, esp if style is frame specific break; } diff --git a/src/zmapWindow/items/zmapWindowBasicFeature.h b/src/zmapWindow/items/zmapWindowBasicFeature.h index 4926e13db..3abf83260 100755 --- a/src/zmapWindow/items/zmapWindowBasicFeature.h +++ b/src/zmapWindow/items/zmapWindowBasicFeature.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: May 25 12:20 2010 (edgrif) * Created: Wed Dec 3 08:44:06 2008 (rds) - * CVS info: $Id: zmapWindowBasicFeature.h,v 1.5 2010-05-26 12:47:40 edgrif Exp $ + * CVS info: $Id: zmapWindowBasicFeature.h,v 1.6 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_BASIC_FEATURE_H @@ -41,8 +41,15 @@ #define ZMAP_WINDOW_BASIC_FEATURE_NAME "ZMapWindowBasicFeature" #define ZMAP_TYPE_WINDOW_BASIC_FEATURE (zMapWindowBasicFeatureGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_BASIC_FEATURE(obj) ((ZMapWindowBasicFeature) obj) +#define ZMAP_WINDOW_BASIC_FEATURE_CONST(obj) ((ZMapWindowBasicFeature const) obj) +#else #define ZMAP_WINDOW_BASIC_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_BASIC_FEATURE, zmapWindowBasicFeature)) #define ZMAP_WINDOW_BASIC_FEATURE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_BASIC_FEATURE, zmapWindowBasicFeature const)) +#endif + #define ZMAP_WINDOW_BASIC_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_BASIC_FEATURE, zmapWindowBasicFeatureClass)) #define ZMAP_IS_WINDOW_BASIC_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_BASIC_FEATURE)) #define ZMAP_WINDOW_BASIC_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_BASIC_FEATURE, zmapWindowBasicFeatureClass)) diff --git a/src/zmapWindow/items/zmapWindowCanvasItem.c b/src/zmapWindow/items/zmapWindowCanvasItem.c index 075d5cf43..7fa50eff2 100755 --- a/src/zmapWindow/items/zmapWindowCanvasItem.c +++ b/src/zmapWindow/items/zmapWindowCanvasItem.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: May 26 13:13 2010 (edgrif) * Created: Wed Dec 3 09:00:20 2008 (rds) - * CVS info: $Id: zmapWindowCanvasItem.c,v 1.27 2010-05-26 12:49:21 edgrif Exp $ + * CVS info: $Id: zmapWindowCanvasItem.c,v 1.28 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -249,7 +249,7 @@ ZMapWindowCanvasItem zMapWindowCanvasItemCreate(FooCanvasGroup *parent, if (item && ZMAP_IS_CANVAS_ITEM(item)) { - GObject *object ; + ZMapWindowCanvasItemClass canvas_item_class ; @@ -262,21 +262,27 @@ ZMapWindowCanvasItem zMapWindowCanvasItemCreate(FooCanvasGroup *parent, if (ZMAP_CANVAS_ITEM_GET_CLASS(canvas_item)->post_create) (* ZMAP_CANVAS_ITEM_GET_CLASS(canvas_item)->post_create)(canvas_item) ; -#ifdef AUTO_RESIZE_OFF +#if 0 +{ GObject *object ; + #ifdef AUTO_RESIZE_OFF expand_background(canvas_item, NULL, NULL, NULL, NULL); #endif /* AUTO_RESIZE_OFF */ /* This needs to be removed and replaced by zMapWindowCanvasItemGetFeature() */ - object = G_OBJECT(item); + #ifdef RDS_DONT_INCLUDE - g_object_set_data(object, ITEM_FEATURE_DATA, feature); - g_object_set_data(object, ITEM_FEATURE_TYPE, GUINT_TO_POINTER(ITEM_FEATURE_SIMPLE)); + object = G_OBJECT(item); + g_object_set_data(object, ITEM_FEATURE_DATA, feature); + g_object_set_data(object, ITEM_FEATURE_TYPE, GUINT_TO_POINTER(ITEM_FEATURE_SIMPLE)); +#endif +} #endif - canvas_item_class = ZMAP_CANVAS_ITEM_GET_CLASS(canvas_item) ; zmapWindowItemStatsIncr(&(canvas_item_class->stats)) ; + } + } return canvas_item; @@ -422,6 +428,7 @@ FooCanvasItem *zMapWindowCanvasItemAddInterval(ZMapWindowCanvasItem canvas_ite if(interval && ZMAP_IS_CANVAS(interval->canvas)) { FooCanvasItem *long_interval; + long_interval = zmapWindowLongItemCheckPoint(interval); if(long_interval != interval) @@ -447,6 +454,7 @@ FooCanvasItem *zMapWindowCanvasItemAddInterval(ZMapWindowCanvasItem canvas_ite (* canvas_item_class->set_colour)(canvas_item, interval, sub_feature, colour_type, NULL); } + } } @@ -1147,7 +1155,7 @@ void zMapWindowCanvasItemReparent(FooCanvasItem *item, FooCanvasGroup *new_group -/* +/* * Internal routines. */ @@ -1445,9 +1453,9 @@ static gboolean canvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer /* This function is kind of a disaster from the memory and processing point of view, * it has taken the original basic feature item and bloated by adding: - * + * * FOO_TYPE_CANVAS_RECT, FOO_TYPE_CANVAS_GROUP & FOO_TYPE_CANVAS_GROUP - * + * * */ static void zmap_window_canvas_item_post_create(ZMapWindowCanvasItem canvas_item) { diff --git a/src/zmapWindow/items/zmapWindowCanvasItem.h b/src/zmapWindow/items/zmapWindowCanvasItem.h index 7e56e93db..3c12eec3a 100755 --- a/src/zmapWindow/items/zmapWindowCanvasItem.h +++ b/src/zmapWindow/items/zmapWindowCanvasItem.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Feb 15 17:45 2010 (edgrif) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowCanvasItem.h,v 1.11 2010-03-04 15:11:52 mh17 Exp $ + * CVS info: $Id: zmapWindowCanvasItem.h,v 1.12 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_CANVAS_ITEM_H @@ -54,8 +54,15 @@ #define ZMAP_WINDOW_CANVAS_INTERVAL_TYPE "interval-type" #define ZMAP_TYPE_CANVAS_ITEM (zMapWindowCanvasItemGetType()) + +#if GOBJ_CAST +#define ZMAP_CANVAS_ITEM(obj) ((ZMapWindowCanvasItem) obj) +#define ZMAP_CANVAS_ITEM_CONST(obj) ((ZMapWindowCanvasItem const) obj) +#else #define ZMAP_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CANVAS_ITEM, zmapWindowCanvasItem)) #define ZMAP_CANVAS_ITEM_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CANVAS_ITEM, zmapWindowCanvasItem const)) +#endif + #define ZMAP_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CANVAS_ITEM, zmapWindowCanvasItemClass)) #define ZMAP_IS_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CANVAS_ITEM)) #define ZMAP_CANVAS_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CANVAS_ITEM, zmapWindowCanvasItemClass)) @@ -80,7 +87,7 @@ ZMapWindowCanvasItem zMapWindowCanvasItemCreate(FooCanvasGroup *parent, FooCanvasItem *zMapWindowCanvasItemAddInterval(ZMapWindowCanvasItem canvas_item, ZMapFeatureSubPartSpan sub_feature, - double top, double bottom, + double top, double bottom, double left, double right); ZMapFeature zMapWindowCanvasItemGetFeature(FooCanvasItem *any_feature_item) ; diff --git a/src/zmapWindow/items/zmapWindowContainerAlignment.h b/src/zmapWindow/items/zmapWindowContainerAlignment.h index cabc3b0b3..42821be22 100755 --- a/src/zmapWindow/items/zmapWindowContainerAlignment.h +++ b/src/zmapWindow/items/zmapWindowContainerAlignment.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jun 10 14:53 2009 (rds) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowContainerAlignment.h,v 1.3 2010-03-04 15:11:58 mh17 Exp $ + * CVS info: $Id: zmapWindowContainerAlignment.h,v 1.4 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -44,8 +44,15 @@ #define ZMAP_TYPE_CONTAINER_ALIGNMENT (zmapWindowContainerAlignmentGetType()) + +#if GOBJ_CAST +#define ZMAP_CONTAINER_ALIGNMENT(obj) ((ZMapWindowContainerAlignment) obj) +#define ZMAP_CONTAINER_ALIGNMENT_CONST(obj) ((ZMapWindowContainerAlignment const) obj) +#else #define ZMAP_CONTAINER_ALIGNMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_ALIGNMENT, zmapWindowContainerAlignment)) #define ZMAP_CONTAINER_ALIGNMENT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_ALIGNMENT, zmapWindowContainerAlignment const)) +#endif + #define ZMAP_CONTAINER_ALIGNMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CONTAINER_ALIGNMENT, zmapWindowContainerAlignmentClass)) #define ZMAP_IS_CONTAINER_ALIGNMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CONTAINER_ALIGNMENT)) #define ZMAP_CONTAINER_ALIGNMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CONTAINER_ALIGNMENT, zmapWindowContainerAlignmentClass)) diff --git a/src/zmapWindow/items/zmapWindowContainerBlock.h b/src/zmapWindow/items/zmapWindowContainerBlock.h index 99fdde3f9..3ac4b0a02 100755 --- a/src/zmapWindow/items/zmapWindowContainerBlock.h +++ b/src/zmapWindow/items/zmapWindowContainerBlock.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jan 21 22:01 2010 (roy) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowContainerBlock.h,v 1.5 2010-03-04 15:12:01 mh17 Exp $ + * CVS info: $Id: zmapWindowContainerBlock.h,v 1.6 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -46,8 +46,15 @@ #define ZMAP_TYPE_CONTAINER_BLOCK (zmapWindowContainerBlockGetType()) + +#if GOBJ_CAST +#define ZMAP_CONTAINER_BLOCK(obj) ((ZMapWindowContainerBlock) obj) +#define ZMAP_CONTAINER_BLOCK_CONST(obj) ((ZMapWindowContainerBlock const ) obj) +#else #define ZMAP_CONTAINER_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_BLOCK, zmapWindowContainerBlock)) #define ZMAP_CONTAINER_BLOCK_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_BLOCK, zmapWindowContainerBlock const)) +#endif + #define ZMAP_CONTAINER_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CONTAINER_BLOCK, zmapWindowContainerBlockClass)) #define ZMAP_IS_CONTAINER_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CONTAINER_BLOCK)) #define ZMAP_CONTAINER_BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CONTAINER_BLOCK, zmapWindowContainerBlockClass)) @@ -65,10 +72,10 @@ typedef struct _zmapWindowContainerBlockClassStruct zmapWindowContainerBlockCla GType zmapWindowContainerBlockGetType(void); ZMapWindowContainerBlock zmapWindowContainerBlockAugment(ZMapWindowContainerBlock container_block, ZMapFeatureBlock feature_block); -void zmapWindowContainerBlockAddCompressedColumn(ZMapWindowContainerBlock block_data, +void zmapWindowContainerBlockAddCompressedColumn(ZMapWindowContainerBlock block_data, FooCanvasGroup *container); GList *zmapWindowContainerBlockRemoveCompressedColumns(ZMapWindowContainerBlock block_data); -void zmapWindowContainerBlockAddBumpedColumn(ZMapWindowContainerBlock block_data, +void zmapWindowContainerBlockAddBumpedColumn(ZMapWindowContainerBlock block_data, FooCanvasGroup *container); GList *zmapWindowContainerBlockRemoveBumpedColumns(ZMapWindowContainerBlock block_data); @@ -78,12 +85,12 @@ void zmapWindowContainerBlockUnmark(ZMapWindowContainerBlock container_block); void zmapWindowContainerBlockFlagRegion(ZMapWindowContainerBlock block_data, ZMapFeatureBlock block); void zmapWindowContainerBlockFlagRegionForColumn(ZMapWindowContainerBlock container_block, - ZMapFeatureBlock block, + ZMapFeatureBlock block, ZMapWindowContainerFeatureSet container_set); GList *zmapWindowContainerBlockFilterFlaggedColumns(ZMapWindowContainerBlock block_data, GList *list, int world1, int world2); gboolean zmapWindowContainerBlockIsColumnLoaded(ZMapWindowContainerBlock container_block, - ZMapWindowContainerFeatureSet container_set, + ZMapWindowContainerFeatureSet container_set, int world1, int world2); diff --git a/src/zmapWindow/items/zmapWindowContainerChildren.h b/src/zmapWindow/items/zmapWindowContainerChildren.h index 062345f55..e538e9c45 100755 --- a/src/zmapWindow/items/zmapWindowContainerChildren.h +++ b/src/zmapWindow/items/zmapWindowContainerChildren.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jun 4 08:32 2009 (rds) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowContainerChildren.h,v 1.4 2010-03-04 15:12:04 mh17 Exp $ + * CVS info: $Id: zmapWindowContainerChildren.h,v 1.5 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -61,8 +61,15 @@ typedef gboolean (*zmapWindowContainerItemTestCallback)(FooCanvasItem *item, gpo #define ZMAP_TYPE_CONTAINER_FEATURES (zmapWindowContainerFeaturesGetType()) + +#if GOBJ_CAST +#define ZMAP_CONTAINER_FEATURES(obj) ((ZMapWindowContainerFeatures) obj) +#define ZMAP_CONTAINER_FEATURES_CONST(obj) ((ZMapWindowContainerFeatures const) obj) +#else #define ZMAP_CONTAINER_FEATURES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_FEATURES, zmapWindowContainerFeatures)) #define ZMAP_CONTAINER_FEATURES_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_FEATURES, zmapWindowContainerFeatures const)) +#endif + #define ZMAP_CONTAINER_FEATURES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CONTAINER_FEATURES, zmapWindowContainerFeaturesClass)) #define ZMAP_IS_CONTAINER_FEATURES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CONTAINER_FEATURES)) #define ZMAP_CONTAINER_FEATURES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CONTAINER_FEATURES, zmapWindowContainerFeaturesClass)) diff --git a/src/zmapWindow/items/zmapWindowContainerContext.h b/src/zmapWindow/items/zmapWindowContainerContext.h index dbc1b31d3..99bfbadba 100755 --- a/src/zmapWindow/items/zmapWindowContainerContext.h +++ b/src/zmapWindow/items/zmapWindowContainerContext.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: May 20 13:10 2009 (rds) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowContainerContext.h,v 1.2 2010-03-04 15:12:07 mh17 Exp $ + * CVS info: $Id: zmapWindowContainerContext.h,v 1.3 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -44,8 +44,15 @@ #define ZMAP_TYPE_CONTAINER_CONTEXT (zmapWindowContainerContextGetType()) + +#if GOBJ_CAST +#define ZMAP_CONTAINER_CONTEXT(obj) ((ZMapWindowContainerContext) obj) +#define ZMAP_CONTAINER_CONTEXT_CONST(obj) ((ZMapWindowContainerContext const ) obj) +#else #define ZMAP_CONTAINER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_CONTEXT, zmapWindowContainerContext)) #define ZMAP_CONTAINER_CONTEXT_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_CONTEXT, zmapWindowContainerContext const)) +#endif + #define ZMAP_CONTAINER_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CONTAINER_CONTEXT, zmapWindowContainerContextClass)) #define ZMAP_IS_CONTAINER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CONTAINER_CONTEXT)) #define ZMAP_CONTAINER_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CONTAINER_CONTEXT, zmapWindowContainerContextClass)) diff --git a/src/zmapWindow/items/zmapWindowContainerFeatureSet.c b/src/zmapWindow/items/zmapWindowContainerFeatureSet.c index 9c3cff91a..72b3ef9ac 100755 --- a/src/zmapWindow/items/zmapWindowContainerFeatureSet.c +++ b/src/zmapWindow/items/zmapWindowContainerFeatureSet.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: May 21 17:06 2010 (edgrif) * Created: Mon Jul 30 13:09:33 2007 (rds) - * CVS info: $Id: zmapWindowContainerFeatureSet.c,v 1.28 2010-05-25 14:17:01 mh17 Exp $ + * CVS info: $Id: zmapWindowContainerFeatureSet.c,v 1.29 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ #include <string.h> /* memset */ @@ -173,6 +173,7 @@ GType zmapWindowContainerFeatureSetGetType(void) * \return ZMapWindowContainerFeatureSet that was edited. */ +// this is only called on column creation ZMapWindowContainerFeatureSet zmapWindowContainerFeatureSetAugment(ZMapWindowContainerFeatureSet container_set, ZMapWindow window, GQuark align_id, @@ -210,8 +211,11 @@ ZMapWindowContainerFeatureSet zmapWindowContainerFeatureSetAugment(ZMapWindowCon while((list = g_list_next(list))); } + // try to guess the intended visibility mode to avoid extra foo_canvas activity + zmapWindowColumnSetState(window, FOO_CANVAS_GROUP(container_set), + ZMAPSTYLE_COLDISPLAY_INVALID, FALSE); - zmapWindowContainerSetVisibility((FooCanvasGroup *)container_set, FALSE); +// zmapWindowContainerSetVisibility((FooCanvasGroup *)container_set, FALSE); } return container_set; @@ -659,7 +663,7 @@ void zmapWindowContainerFeatureSetStyleDisplay(ZMapWindowContainerFeatureSet con value_data.gvalue = &value; value_data.param_id = ITEM_FEATURE_SET_VISIBLE; - value_to_each_style_in_table(GUINT_TO_POINTER(style_id), local_style, &value_data); + value_to_each_style_in_table(GUINT_TO_POINTER(style_id), (gpointer) local_style, &value_data); g_value_unset(&value); } @@ -1069,6 +1073,8 @@ ZMapWindowContainerFeatureSet zmapWindowContainerFeatureSetDestroy(ZMapWindowCon return item_feature_set; } + +#if MH17_function_not_used /* This function is written the wrong way round. It should be * re-written, along with extract_value_from_style_table so that * this function is part of utils and extract_value_from_style_table @@ -1113,7 +1119,7 @@ gboolean zmapWindowStyleListGetSetting(GList *list_of_styles, return result; } - +#endif /* * OBJECT CODE @@ -1575,7 +1581,9 @@ static void extract_value_from_style_table(gpointer key, gpointer value, gpointe if(!current) { - if(zMapStyleGetJoinAligns(style, &style_version)) +// if(zMapStyleGetJoinAligns(style, &style_version)) + style_version = zMapStyleGetWithinAlignError(style); + if(style_version) // if it's set we only care if it's not zero { g_value_set_uint(value_data->gvalue, style_version); } diff --git a/src/zmapWindow/items/zmapWindowContainerFeatureSet.h b/src/zmapWindow/items/zmapWindowContainerFeatureSet.h index 4b9a4f8f7..ab50fe7ba 100755 --- a/src/zmapWindow/items/zmapWindowContainerFeatureSet.h +++ b/src/zmapWindow/items/zmapWindowContainerFeatureSet.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -28,7 +28,7 @@ * HISTORY: * Last edited: May 24 15:40 2010 (edgrif) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowContainerFeatureSet.h,v 1.12 2010-05-24 14:41:11 edgrif Exp $ + * CVS info: $Id: zmapWindowContainerFeatureSet.h,v 1.13 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -49,8 +49,15 @@ #define ZMAP_TYPE_CONTAINER_FEATURESET (zmapWindowContainerFeatureSetGetType()) + +#if GOBJ_CAST +#define ZMAP_CONTAINER_FEATURESET(obj) ((ZMapWindowContainerFeatureSet) obj) +#define ZMAP_CONTAINER_FEATURESET_CONST(obj) ((ZMapWindowContainerFeatureSet const) obj) +#else #define ZMAP_CONTAINER_FEATURESET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_FEATURESET, zmapWindowContainerFeatureSet)) #define ZMAP_CONTAINER_FEATURESET_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_FEATURESET, zmapWindowContainerFeatureSet const)) +#endif + #define ZMAP_CONTAINER_FEATURESET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CONTAINER_FEATURESET, zmapWindowContainerFeatureSetClass)) #define ZMAP_IS_CONTAINER_FEATURESET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CONTAINER_FEATURESET)) #define ZMAP_CONTAINER_FEATURESET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CONTAINER_FEATURESET, zmapWindowContainerFeatureSetClass)) @@ -99,7 +106,7 @@ ZMapStrand zmapWindowContainerFeatureSetGetStrand(ZMapWindowContainerFeatureSet ZMapFrame zmapWindowContainerFeatureSetGetFrame (ZMapWindowContainerFeatureSet container_set); double zmapWindowContainerFeatureSetGetWidth(ZMapWindowContainerFeatureSet container_set); double zmapWindowContainerFeatureGetBumpSpacing(ZMapWindowContainerFeatureSet container_set); -gboolean zmapWindowContainerFeatureSetGetMagValues(ZMapWindowContainerFeatureSet container_set, +gboolean zmapWindowContainerFeatureSetGetMagValues(ZMapWindowContainerFeatureSet container_set, double *min_mag_out, double *max_mag_out); ZMapStyleBumpMode zmapWindowContainerFeatureSetGetBumpUnmarked(ZMapWindowContainerFeatureSet container_set) ; @@ -135,9 +142,9 @@ void zmapWindowContainerFeatureSetPushHiddenStack(ZMapWindowContainerFeatureSet void zmapWindowContainerFeatureSetRemoveAllItems(ZMapWindowContainerFeatureSet container_set); -void zmapWindowContainerFeatureSetSortFeatures(ZMapWindowContainerFeatureSet container_set, +void zmapWindowContainerFeatureSetSortFeatures(ZMapWindowContainerFeatureSet container_set, gint direction); - + void zMapWindowContainerFeatureSetMarkUnsorted(ZMapWindowContainerFeatureSet container_set); /* Finished with this container */ diff --git a/src/zmapWindow/items/zmapWindowContainerFeatureSetUtils.c b/src/zmapWindow/items/zmapWindowContainerFeatureSetUtils.c index 954c523ac..827a08e14 100755 --- a/src/zmapWindow/items/zmapWindowContainerFeatureSetUtils.c +++ b/src/zmapWindow/items/zmapWindowContainerFeatureSetUtils.c @@ -30,7 +30,7 @@ * HISTORY: * Last edited: May 24 12:05 2010 (edgrif) * Created: Wed Dec 3 10:02:22 2008 (rds) - * CVS info: $Id: zmapWindowContainerFeatureSetUtils.c,v 1.2 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapWindowContainerFeatureSetUtils.c,v 1.3 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ #include <math.h> @@ -586,11 +586,27 @@ static gboolean fragments_splice(char *fragment_a, char *fragment_b) spliceosome[4] = fragment_b[1]; spliceosome[5] = '\0'; +#define NEW_RULES 0 +#if NEW_RULES if(!g_ascii_strcasecmp(fragment_b, "AG")) { if(!g_ascii_strcasecmp(&spliceosome[1], "GT") || !g_ascii_strcasecmp(&spliceosome[0], "GGC")) splice = TRUE; } +#else + if(g_ascii_strcasecmp(&spliceosome[1], "GTAG") == 0) + { + splice = TRUE; + } + else if(g_ascii_strcasecmp(&spliceosome[1], "GCAG") == 0) + { + splice = TRUE; + } + else if(g_ascii_strcasecmp(&spliceosome[1], "ATAC") == 0) + { + splice = TRUE; + } +#endif } diff --git a/src/zmapWindow/items/zmapWindowContainerGroup.c b/src/zmapWindow/items/zmapWindowContainerGroup.c index 705f0ab24..52b6c888d 100755 --- a/src/zmapWindow/items/zmapWindowContainerGroup.c +++ b/src/zmapWindow/items/zmapWindowContainerGroup.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: May 24 15:23 2010 (edgrif) * Created: Wed Dec 3 10:02:22 2008 (rds) - * CVS info: $Id: zmapWindowContainerGroup.c,v 1.13 2010-05-24 14:23:50 edgrif Exp $ + * CVS info: $Id: zmapWindowContainerGroup.c,v 1.14 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ @@ -58,7 +58,7 @@ typedef struct static void zmap_window_container_group_class_init (ZMapWindowContainerGroupClass container_class); static void zmap_window_container_group_init (ZMapWindowContainerGroup group); -static void zmap_window_container_group_set_property(GObject *object, +static void zmap_window_container_group_set_property(GObject *object, guint param_id, const GValue *value, GParamSpec *pspec); @@ -72,19 +72,19 @@ static void zmap_window_container_group_destroy (GtkObject *gtkobject); static void zmap_window_container_group_draw (FooCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose); static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_dx, double i2w_dy, int flags); -static void zmap_window_container_group_reposition(ZMapWindowContainerGroup container_group, +static void zmap_window_container_group_reposition(ZMapWindowContainerGroup container_group, double rect_x1, double rect_y1, double rect_x2, double rect_y2, double *dx_repos, double *dy_repos); -static void maximise_background_rectangle(ZMapWindowContainerGroup this_container, +static void maximise_background_rectangle(ZMapWindowContainerGroup this_container, FooCanvasItem *container_item, FooCanvasRE *rect); static void crop_rectangle_to_scroll_region(gpointer rectangle_data, gpointer points_data); static void zmap_window_container_scroll_region_get_item_bounds(FooCanvasItem *item, double *x1, double *y1, double *x2, double *y2); -static void zmap_window_container_update_with_crop(FooCanvasItem *item, +static void zmap_window_container_update_with_crop(FooCanvasItem *item, double i2w_dx, double i2w_dy, FooCanvasPoints *itemised_scroll_region, int flags); @@ -108,16 +108,16 @@ static FooCanvasItemClass *item_parent_class_G = NULL; /*! * \brief Get the GType for the ZMapWindowContainerGroup GObjects - * + * * \return GType corresponding to the GObject as registered by glib. */ GType zmapWindowContainerGroupGetType(void) { static GType group_type = 0; - + if (!group_type) { - static const GTypeInfo group_info = + static const GTypeInfo group_info = { sizeof (zmapWindowContainerGroupClass), (GBaseInitFunc) NULL, @@ -128,21 +128,21 @@ GType zmapWindowContainerGroupGetType(void) sizeof (zmapWindowContainerGroup), 0, /* n_preallocs */ (GInstanceInitFunc) zmap_window_container_group_init - + }; - + group_type = g_type_register_static (FOO_TYPE_CANVAS_GROUP, ZMAP_WINDOW_CONTAINER_GROUP_NAME, &group_info, 0); } - + return group_type; } /*! * \brief Create a new ZMapWindowContainerGroup object. - * + * * \param parent This is the parent ZMapWindowContainerFeatures * \param level The level the new ZMapWindowContainerGroup should be. * \param child_spacing The distance between the children of this container. @@ -171,7 +171,7 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreate(ZMapWindowContainerFeatu /*! * \brief Create a new ZMapWindowContainerGroup object. - * + * * \param parent This is the parent FooCanvasGroup. * \param level The level the new ZMapWindowContainerGroup should be. * \param child_spacing The distance between the children of this container. @@ -202,7 +202,7 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreateFromFoo(FooCanvasGroup if(ZMAP_IS_CONTAINER_GROUP(parent)) { zMapAssertNotReached(); - + parent = (FooCanvasGroup *)zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)parent); } else @@ -213,9 +213,9 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreateFromFoo(FooCanvasGroup level = parent_container->level + 1; } } - + container_type = ZMAP_TYPE_CONTAINER_GROUP; - + switch(level) { case ZMAPCONTAINER_LEVEL_ROOT: @@ -238,11 +238,11 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreateFromFoo(FooCanvasGroup break; } - item = foo_canvas_item_new(parent, container_type, + item = foo_canvas_item_new(parent, container_type, "x", 0.0, "y", 0.0, NULL); - + if(item && ZMAP_IS_CONTAINER_GROUP(item)) { group = FOO_CANVAS_GROUP(item); @@ -265,13 +265,13 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreateFromFoo(FooCanvasGroup if(ZMAP_CONTAINER_GROUP_GET_CLASS(container)->post_create) (ZMAP_CONTAINER_GROUP_GET_CLASS(container)->post_create)(container); } - + return container; } /*! * \brief Set the visibility of a whole ZMapWindowContainerGroup. - * + * * \param container_parent A FooCanvasGroup which _must_ be a ZMapWindowContainerGroup. * \param visible A boolean to specify visibility. TRUE = visible, FALSE = hidden. * @@ -294,6 +294,8 @@ gboolean zmapWindowContainerSetVisibility(FooCanvasGroup *container_parent, gboo else foo_canvas_item_hide((FooCanvasItem *)container_parent); + zMapStopTimer("SetVis",visible ? "true" : "false"); + setable = TRUE; } @@ -343,7 +345,7 @@ void zmapWindowContainerGroupBackgroundSize(ZMapWindowContainerGroup container, } /*! - * \brief A ZMapWindowContainerGroup may need to redraw it's children. + * \brief A ZMapWindowContainerGroup may need to redraw it's children. * This sets a flag so that it happens * * \param container The container that needs its flag set. @@ -352,7 +354,7 @@ void zmapWindowContainerGroupBackgroundSize(ZMapWindowContainerGroup container, * \return void */ -void zmapWindowContainerGroupChildRedrawRequired(ZMapWindowContainerGroup container, +void zmapWindowContainerGroupChildRedrawRequired(ZMapWindowContainerGroup container, gboolean redraw_required) { container->flags.column_redraw = redraw_required; @@ -417,7 +419,7 @@ void zmapWindowContainerGroupAddPreUpdateHook(ZMapWindowContainerGroup container update_hook->hook_func = hook; update_hook->hook_data = user_data; - container->pre_update_hooks = g_slist_append(container->pre_update_hooks, + container->pre_update_hooks = g_slist_append(container->pre_update_hooks, update_hook); } @@ -449,7 +451,7 @@ void zmapWindowContainerGroupRemovePreUpdateHook(ZMapWindowContainerGroup contai * * Internally the containers hold a list of these hook which get * called every time the container gets drawn. This can be done - * on a per container basis, rather than across all containers. + * on a per container basis, rather than across all containers. * In terms of utility and use case the block marking and navigator * are users of this. * @@ -471,7 +473,7 @@ void zmapWindowContainerGroupAddUpdateHook(ZMapWindowContainerGroup container, update_hook->hook_func = hook; update_hook->hook_data = user_data; - container->post_update_hooks = g_slist_append(container->post_update_hooks, + container->post_update_hooks = g_slist_append(container->post_update_hooks, update_hook); } @@ -480,7 +482,7 @@ void zmapWindowContainerGroupAddUpdateHook(ZMapWindowContainerGroup container, /*! * \brief Remove an update hook on a ZMapWindowContainerGroup. - * + * * Exactly the opposite of Add. Both the hook and the data are required * to successfully remove the hook. * @@ -512,11 +514,11 @@ void zmapWindowContainerGroupRemoveUpdateHook(ZMapWindowContainerGroup container /*! * \brief Time to free the memory associated with the ZMapWindowContainerGroup. - * + * * \code container = zmapWindowContainerGroupDestroy(container); - * + * * \param container The container to be free'd - * + * * \return The container that has been free'd. i.e. NULL */ @@ -597,7 +599,7 @@ static void zmap_window_container_group_init (ZMapWindowContainerGroup co return ; } -static void zmap_window_container_group_set_property(GObject *object, +static void zmap_window_container_group_set_property(GObject *object, guint param_id, const GValue *value, GParamSpec *pspec) @@ -698,23 +700,23 @@ static void zmap_window_container_group_get_property(GObject *obje return ; } #ifdef POINT_REQUIRED -static double window_container_group_invoke_point (FooCanvasItem *item, - double x, double y, +static double window_container_group_invoke_point (FooCanvasItem *item, + double x, double y, int cx, int cy, FooCanvasItem **actual_item) { /* Calculate x & y in item local coordinates */ - + if (FOO_CANVAS_ITEM_GET_CLASS (item)->point) return FOO_CANVAS_ITEM_GET_CLASS (item)->point (item, x, y, cx, cy, actual_item); - + return 1e18; } /* Point handler for canvas groups */ -static double zmap_window_container_group_item_point (FooCanvasItem *item, - double x, double y, +static double zmap_window_container_group_item_point (FooCanvasItem *item, + double x, double y, int cx, int cy, FooCanvasItem **actual_item) { @@ -726,15 +728,15 @@ static double zmap_window_container_group_item_point (FooCanvasItem *item, double dist, best; group = FOO_CANVAS_GROUP (item); - + x1 = cx - item->canvas->close_enough; y1 = cy - item->canvas->close_enough; x2 = cx + item->canvas->close_enough; y2 = cy + item->canvas->close_enough; - + best = 0.0; *actual_item = NULL; - + gx = x - group->xpos; gy = y - group->ypos; @@ -747,7 +749,7 @@ static double zmap_window_container_group_item_point (FooCanvasItem *item, child = list->data; if ((child->object.flags & FOO_CANVAS_ITEM_MAPPED) - && FOO_CANVAS_ITEM_GET_CLASS (child)->point) + && FOO_CANVAS_ITEM_GET_CLASS (child)->point) { dist = window_container_group_invoke_point (child, gx, gy, cx, cy, &point_item); if(point_item && ((int)(dist * item->canvas->pixels_per_unit_x + 0.5) <= item->canvas->close_enough) && @@ -756,10 +758,10 @@ static double zmap_window_container_group_item_point (FooCanvasItem *item, best = dist; *actual_item = point_item; } - } + } list = list->next; } - + if(actual_item == NULL && item_parent_class_G->point) best = (item_parent_class_G->point)(item, x, y, cx, cy, actual_item); @@ -781,7 +783,7 @@ static void zmap_window_container_group_destroy (GtkObject *gtkobject) g_slist_free(container->pre_update_hooks); container->pre_update_hooks = NULL; } - + if(container->post_update_hooks) { g_slist_foreach(container->post_update_hooks, (GFunc)g_free, NULL); @@ -805,15 +807,15 @@ static void zmap_window_container_group_draw (FooCanvasItem *item, GdkDrawable * return ; } -static void maximise_background_rectangle(ZMapWindowContainerGroup this_container, +static void maximise_background_rectangle(ZMapWindowContainerGroup this_container, FooCanvasItem *container_item, FooCanvasRE *rect) { FooCanvasItem *rect_item; double irx1, irx2, iry1, iry2; int container_x2, container_y2; /* container canvas coords, calculated from group->update above. */ - - + + /* We can't trust item->x1 and item->y1 as empty child * groups return 0,0->0,0 hence extend all parents to * 0,0! */ @@ -828,7 +830,7 @@ static void maximise_background_rectangle(ZMapWindowContainerGroup this_containe if((iry2 - iry1 + 1) < this_container->height) iry2 = this_container->height + iry1 ; - + rect->x1 = irx1; rect->y1 = iry1; rect->x2 = irx2; @@ -853,7 +855,7 @@ static void crop_rectangle_to_scroll_region(gpointer rectangle_data, gpointer po FooCanvasPoints *scroll_region = (FooCanvasPoints *)points_data; double scroll_x1, scroll_y1, scroll_x2, scroll_y2; double iwx1, iwy1, iwx2, iwy2; - + rect = (FooCanvasRE *)rectangle_data; crop_item = (FooCanvasItem *)rect; foo_canvas = crop_item->canvas; @@ -868,10 +870,10 @@ static void crop_rectangle_to_scroll_region(gpointer rectangle_data, gpointer po /* x unused ATM */ scroll_x1 = foo_canvas->scroll_x1; scroll_x2 = foo_canvas->scroll_x2; - + scroll_y1 = foo_canvas->scroll_y1; scroll_y2 = foo_canvas->scroll_y2; - + foo_canvas_item_w2i(crop_item, &scroll_x1, &scroll_y1); foo_canvas_item_w2i(crop_item, &scroll_x2, &scroll_y2); } @@ -889,7 +891,7 @@ static void crop_rectangle_to_scroll_region(gpointer rectangle_data, gpointer po { rect->y1 = scroll_y1 - 1.0; } - + if(iwy2 > scroll_y2) { rect->y2 = scroll_y2 + 1.0; @@ -913,10 +915,10 @@ static void zmap_window_container_scroll_region_get_item_bounds(FooCanvasItem *i scroll_y1 = foo_canvas->scroll_y1; scroll_y2 = foo_canvas->scroll_y2; - + foo_canvas_item_w2i(item, &scroll_x1, &scroll_y1); foo_canvas_item_w2i(item, &scroll_x2, &scroll_y2); - + if(x1) *x1 = scroll_x1; if(y1) @@ -929,7 +931,7 @@ static void zmap_window_container_scroll_region_get_item_bounds(FooCanvasItem *i return ; } -static void zmap_window_container_update_with_crop(FooCanvasItem *item, +static void zmap_window_container_update_with_crop(FooCanvasItem *item, double i2w_dx, double i2w_dy, FooCanvasPoints *itemised_scroll_region, int flags) @@ -955,7 +957,7 @@ static void zmap_window_container_update_with_crop(FooCanvasItem *item, do { - zmap_window_container_update_with_crop((FooCanvasItem *)(list->data), + zmap_window_container_update_with_crop((FooCanvasItem *)(list->data), sub_i2w_dx, sub_i2w_dy, itemised_scroll_region, flags); } @@ -997,16 +999,16 @@ static void invoke_update_hooks(ZMapWindowContainerGroup container, GSList *hook coords[1] = y1; coords[2] = x2; coords[3] = y2; - + bounds.coords = &coords[0]; bounds.ref_count = 1; bounds.num_points = 2; - + item = (FooCanvasItem *)container; if(canvas_in_update) /* actually we might not want to do this. */ canvas_in_update = item->canvas->doing_update; - + if(canvas_in_update) { @@ -1024,9 +1026,9 @@ static void invoke_update_hooks(ZMapWindowContainerGroup container, GSList *hook do { ContainerUpdateHook update_hook; - + update_hook = (ContainerUpdateHook)(hooks->data); - + if(update_hook->hook_func) (update_hook->hook_func)(container, &bounds, container->level, update_hook->hook_data); } @@ -1120,7 +1122,7 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ if(doing_reposition) { - GList *list, *list_end, tmp_features = {NULL}, tmp_background = {NULL}; + GList *list, *list_end, tmp_features = {NULL}, tmp_background = {NULL}; gboolean print_debug = FALSE; if((item_list = canvas_group->item_list)) @@ -1131,12 +1133,12 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ if(FOO_IS_CANVAS_GROUP(item_list->data)) { FooCanvasGroup *group = (FooCanvasGroup *)(item_list->data); - + if(group->xpos != 0.0) group->xpos = 0.0; if(group->ypos != 0.0) group->ypos = 0.0; - + if(ZMAP_IS_CONTAINER_OVERLAY(item_list->data)) overlay = (ZMapWindowContainerOverlay)(item_list->data); else if(ZMAP_IS_CONTAINER_UNDERLAY(item_list->data)) @@ -1145,12 +1147,12 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ else if(ZMAP_IS_CONTAINER_BACKGROUND(item_list->data)) { rect = FOO_CANVAS_RE(item_list->data); - + if(rect->x1 != 0.0) rect->x1 = 0.0; if(rect->y1 != 0.0) rect->y1 = 0.0; - + rect->x2 = 1.0; /* There's no way to know width */ rect->y2 = this_container->height; /* We know height though. */ } @@ -1172,7 +1174,7 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ default: break; } - + printf("current_x=%f, current_y=%f\n", current_x, current_y); } @@ -1226,18 +1228,18 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ if(parent_container) { double dx, dy; - + if(ZMAP_CONTAINER_GROUP_GET_CLASS(this_container)->reposition_group) - (ZMAP_CONTAINER_GROUP_GET_CLASS(this_container)->reposition_group)(this_container, - rect->x1, rect->y1, - rect->x2, rect->y2, + (ZMAP_CONTAINER_GROUP_GET_CLASS(this_container)->reposition_group)(this_container, + rect->x1, rect->y1, + rect->x2, rect->y2, &dx, &dy); - + parent_container->reposition_x += dx; parent_container->reposition_y += dy; } - zmap_window_container_invoke_post_update_hooks(this_container, + zmap_window_container_invoke_post_update_hooks(this_container, rect->x1, rect->y1, rect->x2, rect->y2); } @@ -1260,7 +1262,7 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ update_items[i++] = (FooCanvasItem *)overlay; update_items[i++] = (FooCanvasItem *)underlay; - zmap_window_container_scroll_region_get_item_bounds(update_items[0], + zmap_window_container_scroll_region_get_item_bounds(update_items[0], &coords[0], &coords[1], &coords[2], &coords[3]); scroll_region.coords = &coords[0]; @@ -1269,12 +1271,12 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ /* We need to maximise overlays and underlays if required too. */ if(overlay) - zmapWindowContainerOverlayMaximiseItems(overlay, + zmapWindowContainerOverlayMaximiseItems(overlay, rect->x1, rect->y1, rect->x2, rect->y2); if(underlay) - zmapWindowContainerUnderlayMaximiseItems(underlay, + zmapWindowContainerUnderlayMaximiseItems(underlay, rect->x1, rect->y1, rect->x2, rect->y2); @@ -1295,7 +1297,7 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_ } -static void zmap_window_container_group_reposition(ZMapWindowContainerGroup container_group, +static void zmap_window_container_group_reposition(ZMapWindowContainerGroup container_group, double rect_x1, double rect_y1, double rect_x2, double rect_y2, double *dx_repos, double *dy_repos) diff --git a/src/zmapWindow/items/zmapWindowContainerGroup.h b/src/zmapWindow/items/zmapWindowContainerGroup.h index a1c64aaf4..a9b39e048 100755 --- a/src/zmapWindow/items/zmapWindowContainerGroup.h +++ b/src/zmapWindow/items/zmapWindowContainerGroup.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: May 20 11:13 2010 (edgrif) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowContainerGroup.h,v 1.9 2010-05-24 14:24:21 edgrif Exp $ + * CVS info: $Id: zmapWindowContainerGroup.h,v 1.10 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_CONTAINER_GROUP_H @@ -50,7 +50,7 @@ /*! * ZMapWindowContainerGroup for containing and positioning of canvas items. * Each ZMapWindowContainerGroup consists of: - * + * * -------- parent_group ----------- * / / \ \ * / / \ \ @@ -74,14 +74,14 @@ * group then we make a container root, i.e. the top of the container tree. * * The new object code means that each container member including the member itself - * has a G_TYPE* This means code that does ZMAP_IS_CONTAINER_GROUP(pointer) is - * simpler and hopefully more readable. + * has a G_TYPE* This means code that does ZMAP_IS_CONTAINER_GROUP(pointer) is + * simpler and hopefully more readable. * * The ZMapWindowContainerGroup are sub classes of FooCanvasGroup and implement the * FooCanvasItem interface (draw, update, bounds, etc...). The update code takes - * care of cropping the Container "owned" items, such as the background and any - * overlays/underlays that might be being drawn. It also includes hooks to - * provide similar functionality to the ContainerExecute callbacks. These are + * care of cropping the Container "owned" items, such as the background and any + * overlays/underlays that might be being drawn. It also includes hooks to + * provide similar functionality to the ContainerExecute callbacks. These are * attached/owned by each specific container so only get called by the container * they relate to. This again leads to simpler code, without the switch on the * container level. @@ -96,8 +96,14 @@ #define ZMAP_TYPE_CONTAINER_GROUP (zmapWindowContainerGroupGetType()) + +#if GOBJ_CAST +#define ZMAP_CONTAINER_GROUP(obj) ((ZMapWindowContainerGroup) obj) +#define ZMAP_CONTAINER_GROUP_CONST(obj) ((ZMapWindowContainerGroup const) obj) +#else #define ZMAP_CONTAINER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_GROUP, zmapWindowContainerGroup)) #define ZMAP_CONTAINER_GROUP_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_GROUP, zmapWindowContainerGroup const)) +#endif #define ZMAP_CONTAINER_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CONTAINER_GROUP, zmapWindowContainerGroupClass)) #define ZMAP_IS_CONTAINER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CONTAINER_GROUP)) #define ZMAP_CONTAINER_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CONTAINER_GROUP, zmapWindowContainerGroupClass)) @@ -126,7 +132,7 @@ typedef struct _zmapWindowContainerGroupStruct zmapWindowContainerGroup, *ZMapW typedef struct _zmapWindowContainerGroupClassStruct zmapWindowContainerGroupClass, *ZMapWindowContainerGroupClass ; -typedef gboolean (* ZMapWindowContainerUpdateHook)(ZMapWindowContainerGroup group_updated, +typedef gboolean (* ZMapWindowContainerUpdateHook)(ZMapWindowContainerGroup group_updated, FooCanvasPoints *group_bounds, ZMapContainerLevelType group_level, gpointer user_data); @@ -147,7 +153,7 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreateFromFoo(FooCanvasGroup gboolean zmapWindowContainerSetVisibility(FooCanvasGroup *container_parent, gboolean visible); void zmapWindowContainerRequestReposition(ZMapWindowContainerGroup container); void zmapWindowContainerGroupBackgroundSize(ZMapWindowContainerGroup container, double height); -void zmapWindowContainerGroupChildRedrawRequired(ZMapWindowContainerGroup container, +void zmapWindowContainerGroupChildRedrawRequired(ZMapWindowContainerGroup container, gboolean redraw_required); void zmapWindowContainerGroupSetBackgroundColour(ZMapWindowContainerGroup container, GdkColor *new_colour); diff --git a/src/zmapWindow/items/zmapWindowContainerStrand.h b/src/zmapWindow/items/zmapWindowContainerStrand.h index 5e4112d8a..e1e98e0aa 100755 --- a/src/zmapWindow/items/zmapWindowContainerStrand.h +++ b/src/zmapWindow/items/zmapWindowContainerStrand.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jun 4 09:42 2009 (rds) * Created: Wed Dec 3 08:21:03 2008 (rds) - * CVS info: $Id: zmapWindowContainerStrand.h,v 1.3 2010-03-04 15:12:14 mh17 Exp $ + * CVS info: $Id: zmapWindowContainerStrand.h,v 1.4 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ @@ -44,8 +44,15 @@ #define ZMAP_TYPE_CONTAINER_STRAND (zmapWindowContainerStrandGetType()) + +#if GOBJ_CAST +#define ZMAP_CONTAINER_STRAND(obj) ((ZMapWindowContainerStrand) obj) +#define ZMAP_CONTAINER_STRAND_CONST(obj) ((ZMapWindowContainerStrand const) obj) +#else #define ZMAP_CONTAINER_STRAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_STRAND, zmapWindowContainerStrand)) #define ZMAP_CONTAINER_STRAND_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_CONTAINER_STRAND, zmapWindowContainerStrand const)) +#endif + #define ZMAP_CONTAINER_STRAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_CONTAINER_STRAND, zmapWindowContainerStrandClass)) #define ZMAP_IS_CONTAINER_STRAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_CONTAINER_STRAND)) #define ZMAP_CONTAINER_STRAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_CONTAINER_STRAND, zmapWindowContainerStrandClass)) diff --git a/src/zmapWindow/items/zmapWindowGlyphItem.h b/src/zmapWindow/items/zmapWindowGlyphItem.h index f7f3f3dd3..a43e076e8 100755 --- a/src/zmapWindow/items/zmapWindowGlyphItem.h +++ b/src/zmapWindow/items/zmapWindowGlyphItem.h @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Apr 6 14:45 2009 (rds) * Created: Fri Jan 16 14:01:12 2009 (rds) - * CVS info: $Id: zmapWindowGlyphItem.h,v 1.6 2010-04-15 11:19:04 mh17 Exp $ + * CVS info: $Id: zmapWindowGlyphItem.h,v 1.7 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ @@ -42,8 +42,14 @@ #define ZMAP_WINDOW_GLYPH_ITEM_NAME "ZMapWindowGlyphItem" #define ZMAP_TYPE_WINDOW_GLYPH_ITEM (zMapWindowGlyphItemGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_GLYPH_ITEM(obj) ((ZMapWindowGlyphItem) obj) +#define ZMAP_WINDOW_GLYPH_ITEM_CONST(obj) ((ZMapWindowGlyphItem const) obj) +#else #define ZMAP_WINDOW_GLYPH_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_GLYPH_ITEM, zmapWindowGlyphItem)) #define ZMAP_WINDOW_GLYPH_ITEM_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_GLYPH_ITEM, zmapWindowGlyphItem const)) +#endif #define ZMAP_WINDOW_GLYPH_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_GLYPH_ITEM, zmapWindowGlyphItemClass)) #define ZMAP_IS_WINDOW_GLYPH_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_GLYPH_ITEM)) #define ZMAP_WINDOW_GLYPH_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_GLYPH_ITEM, zmapWindowGlyphItemClass)) diff --git a/src/zmapWindow/items/zmapWindowLongItem.h b/src/zmapWindow/items/zmapWindowLongItem.h index b8b84fd53..cc2ddabc0 100755 --- a/src/zmapWindow/items/zmapWindowLongItem.h +++ b/src/zmapWindow/items/zmapWindowLongItem.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jul 9 10:07 2009 (rds) * Created: Fri Jan 16 14:01:12 2009 (rds) - * CVS info: $Id: zmapWindowLongItem.h,v 1.3 2010-03-04 15:12:25 mh17 Exp $ + * CVS info: $Id: zmapWindowLongItem.h,v 1.4 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ @@ -39,8 +39,15 @@ #define ZMAP_WINDOW_LONG_ITEM_NAME "ZMapWindowLongItem" #define ZMAP_TYPE_WINDOW_LONG_ITEM (zMapWindowLongItemGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_LONG_ITEM(obj) ((ZMapWindowLongItem) obj) +#define ZMAP_WINDOW_LONG_ITEM_CONST(obj) ((ZMapWindowLongItem const) obj) +#else #define ZMAP_WINDOW_LONG_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_LONG_ITEM, zmapWindowLongItem)) #define ZMAP_WINDOW_LONG_ITEM_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_LONG_ITEM, zmapWindowLongItem const)) +#endif + #define ZMAP_WINDOW_LONG_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_LONG_ITEM, zmapWindowLongItemClass)) #define ZMAP_IS_WINDOW_LONG_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_LONG_ITEM)) #define ZMAP_WINDOW_LONG_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_LONG_ITEM, zmapWindowLongItemClass)) @@ -60,7 +67,7 @@ GType zMapWindowLongItemGetType(void); FooCanvasItem *zmapWindowLongItemCheckPoint(FooCanvasItem *possibly_long_item); FooCanvasItem *zmapWindowLongItemCheckPointFull(FooCanvasItem *possibly_long_item, FooCanvasPoints *points, - double x1, double y1, + double x1, double y1, double x2, double y2); int zmapWindowIsLongItem(FooCanvasItem *foo); diff --git a/src/zmapWindow/items/zmapWindowSequenceFeature.h b/src/zmapWindow/items/zmapWindowSequenceFeature.h index 62b66927a..e17cc32d2 100755 --- a/src/zmapWindow/items/zmapWindowSequenceFeature.h +++ b/src/zmapWindow/items/zmapWindowSequenceFeature.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Feb 16 09:58 2010 (edgrif) * Created: Wed Dec 3 08:44:06 2008 (rds) - * CVS info: $Id: zmapWindowSequenceFeature.h,v 1.7 2010-03-04 15:12:29 mh17 Exp $ + * CVS info: $Id: zmapWindowSequenceFeature.h,v 1.8 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ @@ -42,8 +42,15 @@ #define ZMAP_TYPE_WINDOW_SEQUENCE_FEATURE (zMapWindowSequenceFeatureGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_SEQUENCE_FEATURE(obj) ((ZMapWindowSequenceFeature) obj) +#define ZMAP_WINDOW_SEQUENCE_FEATURE_CONST(obj) ((ZMapWindowSequenceFeature const) obj) +#else #define ZMAP_WINDOW_SEQUENCE_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_SEQUENCE_FEATURE, zmapWindowSequenceFeature)) #define ZMAP_WINDOW_SEQUENCE_FEATURE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_SEQUENCE_FEATURE, zmapWindowSequenceFeature const)) +#endif + #define ZMAP_WINDOW_SEQUENCE_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_SEQUENCE_FEATURE, zmapWindowSequenceFeatureClass)) #define ZMAP_IS_WINDOW_SEQUENCE_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_SEQUENCE_FEATURE)) #define ZMAP_WINDOW_SEQUENCE_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_SEQUENCE_FEATURE, zmapWindowSequenceFeatureClass)) diff --git a/src/zmapWindow/items/zmapWindowTextFeature.h b/src/zmapWindow/items/zmapWindowTextFeature.h index add83de8e..6ffe194ac 100755 --- a/src/zmapWindow/items/zmapWindowTextFeature.h +++ b/src/zmapWindow/items/zmapWindowTextFeature.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jan 13 13:40 2009 (rds) * Created: Wed Dec 3 08:44:06 2008 (rds) - * CVS info: $Id: zmapWindowTextFeature.h,v 1.2 2010-03-04 15:12:32 mh17 Exp $ + * CVS info: $Id: zmapWindowTextFeature.h,v 1.3 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ @@ -39,8 +39,15 @@ #define ZMAP_WINDOW_TEXT_FEATURE_NAME "ZMapWindowTextFeature" #define ZMAP_TYPE_WINDOW_TEXT_FEATURE (zMapWindowTextFeatureGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_TEXT_FEATURE(obj) ((ZMapWindowTextFeature) obj) +#define ZMAP_WINDOW_TEXT_FEATURE_CONST(obj) ((ZMapWindowTextFeature const) obj) +#else #define ZMAP_WINDOW_TEXT_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_TEXT_FEATURE, zmapWindowTextFeature)) #define ZMAP_WINDOW_TEXT_FEATURE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_TEXT_FEATURE, zmapWindowTextFeature const)) +#endif + #define ZMAP_WINDOW_TEXT_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_TEXT_FEATURE, zmapWindowTextFeatureClass)) #define ZMAP_IS_WINDOW_TEXT_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_TEXT_FEATURE)) #define ZMAP_WINDOW_TEXT_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_TEXT_FEATURE, zmapWindowTextFeatureClass)) diff --git a/src/zmapWindow/items/zmapWindowTextItem.h b/src/zmapWindow/items/zmapWindowTextItem.h index 0325efa9b..ad096dc73 100755 --- a/src/zmapWindow/items/zmapWindowTextItem.h +++ b/src/zmapWindow/items/zmapWindowTextItem.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Jun 18 15:01 2009 (rds) * Created: Fri Jan 16 14:01:12 2009 (rds) - * CVS info: $Id: zmapWindowTextItem.h,v 1.3 2010-03-04 15:12:35 mh17 Exp $ + * CVS info: $Id: zmapWindowTextItem.h,v 1.4 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ @@ -42,8 +42,14 @@ #define ZMAP_WINDOW_TEXT_ITEM_NAME "ZMapWindowTextItem" #define ZMAP_TYPE_WINDOW_TEXT_ITEM (zMapWindowTextItemGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_TEXT_ITEM(obj) ((ZMapWindowTextItem) obj) +#define ZMAP_WINDOW_TEXT_ITEM_CONST(obj) ((ZMapWindowTextItem const) obj) +#else #define ZMAP_WINDOW_TEXT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_TEXT_ITEM, zmapWindowTextItem)) #define ZMAP_WINDOW_TEXT_ITEM_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_TEXT_ITEM, zmapWindowTextItem const)) +#endif #define ZMAP_WINDOW_TEXT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_TEXT_ITEM, zmapWindowTextItemClass)) #define ZMAP_IS_WINDOW_TEXT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_TEXT_ITEM)) #define ZMAP_WINDOW_TEXT_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_TEXT_ITEM, zmapWindowTextItemClass)) @@ -82,10 +88,10 @@ typedef gint (* ZMapTextItemAllocateCB)(FooCanvasItem *item, gint buffer_size, gpointer user_data); -typedef gint (* ZMapTextItemFetchTextCB)(FooCanvasItem *item, +typedef gint (* ZMapTextItemFetchTextCB)(FooCanvasItem *item, ZMapTextItemDrawData draw_data, - char *buffer, - gint buffer_size, + char *buffer, + gint buffer_size, gpointer user_data); @@ -98,7 +104,7 @@ typedef gboolean (* ZMapWindowTextItemSelectionCB)(ZMapWindowTextItem text_item, GType zMapWindowTextItemGetType(void); -void zMapWindowTextItemSelect(ZMapWindowTextItem text_item, int start, int end, +void zMapWindowTextItemSelect(ZMapWindowTextItem text_item, int start, int end, gboolean deselect_first, gboolean emit_signal); void zMapWindowTextItemDeselect(ZMapWindowTextItem text_item, gboolean emit_signal); diff --git a/src/zmapWindow/items/zmapWindowTranscriptFeature.h b/src/zmapWindow/items/zmapWindowTranscriptFeature.h index ea9e44531..18c1e132a 100755 --- a/src/zmapWindow/items/zmapWindowTranscriptFeature.h +++ b/src/zmapWindow/items/zmapWindowTranscriptFeature.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Feb 16 10:01 2010 (edgrif) * Created: Wed Dec 3 08:44:06 2008 (rds) - * CVS info: $Id: zmapWindowTranscriptFeature.h,v 1.3 2010-03-04 15:12:38 mh17 Exp $ + * CVS info: $Id: zmapWindowTranscriptFeature.h,v 1.4 2010-06-08 08:31:27 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_TRANSCRIPT_FEATURE_H @@ -39,8 +39,15 @@ #define ZMAP_WINDOW_TRANSCRIPT_FEATURE_NAME "ZMapWindowTranscriptFeature" #define ZMAP_TYPE_WINDOW_TRANSCRIPT_FEATURE (zMapWindowTranscriptFeatureGetType()) + +#if GOBJ_CAST +#define ZMAP_WINDOW_TRANSCRIPT_FEATURE(obj) ((ZMapWindowTranscriptFeature) obj) +#define ZMAP_WINDOW_TRANSCRIPT_FEATURE_CONST(obj) ((ZMapWindowTranscriptFeature const) obj) +#else #define ZMAP_WINDOW_TRANSCRIPT_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_TRANSCRIPT_FEATURE, zmapWindowTranscriptFeature)) #define ZMAP_WINDOW_TRANSCRIPT_FEATURE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), ZMAP_TYPE_WINDOW_TRANSCRIPT_FEATURE, zmapWindowTranscriptFeature const)) +#endif + #define ZMAP_WINDOW_TRANSCRIPT_FEATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), ZMAP_TYPE_WINDOW_TRANSCRIPT_FEATURE, zmapWindowTranscriptFeatureClass)) #define ZMAP_IS_WINDOW_TRANSCRIPT_FEATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), ZMAP_TYPE_WINDOW_TRANSCRIPT_FEATURE)) #define ZMAP_WINDOW_TRANSCRIPT_FEATURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ZMAP_TYPE_WINDOW_TRANSCRIPT_FEATURE, zmapWindowTranscriptFeatureClass)) diff --git a/src/zmapWindow/zmapWindow.c b/src/zmapWindow/zmapWindow.c index d581c4380..d3dd1ea5a 100755 --- a/src/zmapWindow/zmapWindow.c +++ b/src/zmapWindow/zmapWindow.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: May 24 16:04 2010 (edgrif) * Created: Thu Jul 24 14:36:27 2003 (edgrif) - * CVS info: $Id: zmapWindow.c,v 1.322 2010-05-24 15:04:55 edgrif Exp $ + * CVS info: $Id: zmapWindow.c,v 1.323 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -61,8 +61,8 @@ typedef struct { ZMapFeatureContext current_features ; ZMapFeatureContext new_features ; - GData *all_styles ; - GData *new_styles ; + GHashTable *all_styles ; + GHashTable *new_styles ; GHashTable *featuresets_2_stylelist ; ZMapWindowState state ; /* Can be NULL! */ } FeatureSetsStateStruct, *FeatureSetsState ; @@ -367,7 +367,7 @@ ZMapWindow zMapWindowCreate(GtkWidget *parent_widget, ZMapWindow zMapWindowCopy(GtkWidget *parent_widget, char *sequence, void *app_data, ZMapWindow original_window, ZMapFeatureContext feature_context, - GData *read_only_styles, GData *display_styles, + GHashTable *read_only_styles, GHashTable *display_styles, ZMapWindowLockType window_locking) { ZMapWindow new_window = NULL ; @@ -399,7 +399,7 @@ ZMapWindow zMapWindowCopy(GtkWidget *parent_widget, char *sequence, /* Update styles lists in original window, new window is done by display call. */ zMapAssert(read_only_styles && display_styles) ; - if (!zmapWindowUpdateStyles(original_window, &read_only_styles, &display_styles)) + if (!zmapWindowUpdateStyles(original_window, read_only_styles, display_styles)) zMapLogWarning("%s", "Errors in copying read only and display styles for original window.") ; /* Lock windows together for scrolling/zooming if requested. */ @@ -511,7 +511,7 @@ void zMapWindowBusyFull(ZMapWindow window, gboolean busy, const char *file, cons * */ void zMapWindowDisplayData(ZMapWindow window, ZMapWindowState state, ZMapFeatureContext current_features, ZMapFeatureContext new_features, - GData *all_styles, GData *new_styles, + GHashTable *all_styles, GHashTable *new_styles, GHashTable *new_featuresets_2_stylelist) { FeatureSetsState feature_sets ; @@ -523,8 +523,8 @@ void zMapWindowDisplayData(ZMapWindow window, ZMapWindowState state, feature_sets->current_features = current_features ; feature_sets->new_features = new_features ; - zMapStyleCopyAllStyles(&all_styles, &(feature_sets->all_styles)) ; - zMapStyleCopyAllStyles(&new_styles, &(feature_sets->new_styles)) ; + zMapStyleCopyAllStyles(all_styles, &(feature_sets->all_styles)) ; + zMapStyleCopyAllStyles(new_styles, &(feature_sets->new_styles)) ; feature_sets->featuresets_2_stylelist = new_featuresets_2_stylelist ; @@ -715,7 +715,7 @@ void zMapWindowStats(ZMapWindow window, GString *text) * We also need the information so that we can maintain window position after a revcomp. * We really do need to know even though it feels a bit hacky... */ void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_context, - GData *all_styles, GData *new_styles, + GHashTable *all_styles, GHashTable *new_styles, gboolean features_are_revcomped) { int x, y ; @@ -725,6 +725,7 @@ void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_conte gboolean state_saves_position = TRUE; + zMapStartTimer("WindowFeatureRedraw",""); state = zmapWindowStateCreate(); /* Note that currently we lose the 3 frame state and other state such as columns */ @@ -787,15 +788,19 @@ void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_conte free_child_windows = TRUE ; } + zMapStopTimer("WindowFeatureRedraw","Revcomp"); + /* wrap the resetCanvas and set scroll region in a expose free cape */ zmapWindowInterruptExpose(window); resetCanvas(window, free_child_windows, free_revcomp_safe_windows) ; /* Resets scrolled region and much else. */ + zMapStopTimer("WindowFeatureRedraw","ResetCanvas"); if(window->strand_separator_context) zMapFeatureContextDestroy(window->strand_separator_context, TRUE); window->strand_separator_context = NULL; + zMapStopTimer("WindowFeatureRedraw","Separator"); /* You cannot just draw the features here as the canvas needs to be realised so we send * an event to get the data drawn which means that the canvas is guaranteed to be @@ -803,6 +808,8 @@ void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_conte zMapWindowDisplayData(window, state, feature_context, feature_context, all_styles, new_styles, window->featureset_2_styles) ; + zMapStopTimer("WindowFeatureRedraw","Display"); + /* stop the expose avoidance */ zmapWindowUninterruptExpose(window); @@ -815,6 +822,7 @@ void zMapWindowFeatureRedraw(ZMapWindow window, ZMapFeatureContext feature_conte * Code moved to the correct place, dataEventCB() */ } + zMapStopTimer("WindowFeatureRedraw",""); return ; @@ -1125,9 +1133,9 @@ void zMapWindowDestroy(ZMapWindow window) unlockWindow(window, FALSE) ; if (window->read_only_styles) - zMapStyleDestroyStyles(&(window->read_only_styles)) ; + zMapStyleDestroyStyles(window->read_only_styles) ; if (window->display_styles) - zMapStyleDestroyStyles(&(window->display_styles)) ; + zMapStyleDestroyStyles(window->display_styles) ; /* free the array of feature list windows and the windows themselves */ zmapWindowFreeWindowArray(&(window->featureListWindows), TRUE) ; @@ -2482,7 +2490,7 @@ static gboolean dataEventCB(GtkWidget *widget, GdkEventClient *event, gpointer c diff_context = feature_sets->current_features ; /* Reload the styles lists. */ - if (!zmapWindowUpdateStyles(window, &(feature_sets->all_styles), &(feature_sets->new_styles))) + if (!zmapWindowUpdateStyles(window, feature_sets->all_styles, feature_sets->new_styles)) zMapLogWarning("%s", "Errors in copying read only and display styles.") ; @@ -2566,8 +2574,8 @@ static gboolean dataEventCB(GtkWidget *widget, GdkEventClient *event, gpointer c zMapLogMessage("%s", "event handler for canvas already registered."); - zMapStyleDestroyStyles(&(feature_sets->all_styles)) ; - zMapStyleDestroyStyles(&(feature_sets->new_styles)) ; + zMapStyleDestroyStyles(feature_sets->all_styles) ; + zMapStyleDestroyStyles(feature_sets->new_styles) ; g_free(feature_sets) ; g_free(window_data) ; /* Free the WindowData struct. */ @@ -3861,7 +3869,7 @@ GList *zmapWindowDeferredColumns(ZMapWindow window) { GList *list = NULL; - //g_datalist_foreach(&(window->read_only_styles), filter_deferred_styles, &list); + //g_hash_table_foreach(&(window->read_only_styles), filter_deferred_styles, &list); list = g_list_copy(window->feature_set_names); @@ -4192,9 +4200,6 @@ static gboolean keyboardEvent(ZMapWindow window, GdkEventKey *key_event) compress_mode = ZMAPWINDOW_COMPRESS_ALL ; } - - zMapResetTimer(NULL) ; - zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(focus_column), bump_mode, compress_mode) ; zmapWindowFullReposition(window) ; diff --git a/src/zmapWindow/zmapWindowColBump.c b/src/zmapWindow/zmapWindowColBump.c index abbfd9258..73248eff0 100755 --- a/src/zmapWindow/zmapWindowColBump.c +++ b/src/zmapWindow/zmapWindowColBump.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: May 24 16:01 2010 (edgrif) * Created: Tue Sep 4 10:52:09 2007 (edgrif) - * CVS info: $Id: zmapWindowColBump.c,v 1.74 2010-05-26 15:28:09 mh17 Exp $ + * CVS info: $Id: zmapWindowColBump.c,v 1.75 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -414,7 +414,8 @@ void zmapWindowColumnBumpRange(FooCanvasItem *bump_item, ZMapStyleBumpMode bump_ ZMAPSTYLE_PROPERTY_DISPLAY_MODE, &(bump_properties.display_state), NULL); - zMapStyleGetJoinAligns(style, &(bump_properties.match_threshold)); +// zMapStyleGetJoinAligns(style, &(bump_properties.match_threshold)); + bump_properties.match_threshold = zMapStyleGetWithinAlignError(style); zMapStyleSetBumpMode(style, bump_mode); } diff --git a/src/zmapWindow/zmapWindowDraw.c b/src/zmapWindow/zmapWindowDraw.c index 1698d8f1c..6a7a4b2d0 100755 --- a/src/zmapWindow/zmapWindowDraw.c +++ b/src/zmapWindow/zmapWindowDraw.c @@ -30,7 +30,7 @@ * HISTORY: * Last edited: Feb 15 11:52 2010 (edgrif) * Created: Thu Sep 8 10:34:49 2005 (edgrif) - * CVS info: $Id: zmapWindowDraw.c,v 1.123 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapWindowDraw.c,v 1.124 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -67,6 +67,7 @@ typedef struct execOnChildrenStruct_ } execOnChildrenStruct, *execOnChildren ; +#if 0 /* For 3 frame display/normal display. */ typedef struct { @@ -83,7 +84,7 @@ typedef struct ZMapFeatureTypeStyle style; } RedrawDataStruct, *RedrawData ; - +#endif typedef struct @@ -103,7 +104,7 @@ typedef struct /* Records which alignment, block, set, type we are processing. */ ZMapFeatureContext full_context ; - GData *styles ; + GHashTable *styles ; ZMapFeatureAlignment curr_alignment ; ZMapFeatureBlock curr_block ; ZMapFeatureSet curr_set ; @@ -168,6 +169,7 @@ void zMapWindowToggle3Frame(ZMapWindow window) zMapWindowBusy(window, TRUE) ; + zMapStartTimer("3Frame" ,window->display_3_frame ? "off" : "on"); // yuk... three_frame_id = GUINT_TO_POINTER(zMapStyleCreateID(ZMAP_FIXED_STYLE_3FRAME)); three_frame_Id = GUINT_TO_POINTER(g_quark_from_string(ZMAP_FIXED_STYLE_3FRAME)); @@ -184,11 +186,13 @@ void zMapWindowToggle3Frame(ZMapWindow window) // remove always columns or 3-frame depending on mode zmapWindowDrawRemove3FrameFeatures(window); + zMapStopTimer("3FrameRemove",""); window->display_3_frame = !window->display_3_frame; // draw always columns or 3-frame depending on mode zmapWindowDraw3FrameFeatures(window); + zMapStopTimer("3FrameDraw",""); /* Now we've drawn all the features we can position them all. */ zmapWindowColOrderColumns(window); @@ -200,6 +204,8 @@ void zMapWindowToggle3Frame(ZMapWindow window) else zMapWarning("%s", "No '" ZMAP_FIXED_STYLE_3FRAME "' column in config file."); + zMapStopTimer("3Frame" ,window->display_3_frame ? "off" : "on"); + zMapWindowBusy(window, FALSE) ; return ; @@ -245,10 +251,12 @@ void zmapWindowCanvasGroupChildSort(FooCanvasGroup *group_inout) * * */ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group, + // new_col_state = NULL if new (empty) column ZMapStyleColumnDisplayState new_col_state, gboolean redraw_if_needed) { ZMapWindowContainerFeatureSet container; ZMapStyleColumnDisplayState curr_col_state ; + gboolean test_mag = TRUE; container = (ZMapWindowContainerFeatureSet)column_group; @@ -260,8 +268,14 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group, gboolean redraw = FALSE ; if (!new_col_state) - new_col_state = curr_col_state ; - + { + test_mag = FALSE; + // we are creating the column: mag not vis due to no features + // but we still want it to be visible + // a bit hacky, but less grief than adding a new flag + + new_col_state = curr_col_state ; + } switch(new_col_state) { case ZMAPSTYLE_COLDISPLAY_HIDE: @@ -276,23 +290,13 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group, { gboolean mag_visible, frame_visible ; - mag_visible = zmapWindowColumnIsMagVisible(window, column_group) ; +// ha ha ... this runs nearly 2x slower and we get blank columns +// mag_visible = test_mag ? zmapWindowColumnIsMagVisible(window, column_group) : TRUE ; + mag_visible = zmapWindowColumnIsMagVisible(window, column_group);; frame_visible = zmapWindowColumnIs3frameVisible(window, column_group) ; - if (mag_visible && frame_visible) - { - zmapWindowContainerSetVisibility(column_group, TRUE) ; - redraw = TRUE; - } - else if (!mag_visible || !frame_visible) - { - zmapWindowContainerSetVisibility(column_group, FALSE) ; - redraw = TRUE; - } - - /* Check mag, mark, compress etc. etc....probably need some funcs in compress/mark/mag * packages to return whether a column should be hidden.... */ if ((curr_col_state == ZMAPSTYLE_COLDISPLAY_HIDE || curr_col_state == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE) @@ -319,14 +323,14 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group, break ; } } - + zMapStopTimer("DrawFeatureSet","SetVis"); /* Set the new display for the column _and_ all styles within the column. */ zmapWindowContainerFeatureSetSetDisplay(container, new_col_state) ; /* Only do redraw if it was requested _and_ state change needs it. */ if (redraw_if_needed && redraw) - zmapWindowFullReposition(window) ; + zmapWindowFullReposition(window) ; } diff --git a/src/zmapWindow/zmapWindowDrawFeatures.c b/src/zmapWindow/zmapWindowDrawFeatures.c index c26c4b750..684b86705 100755 --- a/src/zmapWindow/zmapWindowDrawFeatures.c +++ b/src/zmapWindow/zmapWindowDrawFeatures.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Mar 11 14:19 2010 (edgrif) * Created: Thu Jul 29 10:45:00 2004 (rnc) - * CVS info: $Id: zmapWindowDrawFeatures.c,v 1.272 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapWindowDrawFeatures.c,v 1.273 2010-06-08 08:31:25 mh17 Exp $ *------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ typedef struct _ZMapCanvasDataStruct /* Records which alignment, block, set, type we are processing. */ ZMapFeatureContext full_context ; - GData *styles ; + GHashTable *styles ; ZMapFeatureAlignment curr_alignment ; ZMapFeatureBlock curr_block ; ZMapFeatureSet curr_set ; @@ -106,7 +106,7 @@ typedef struct typedef struct { ZMapWindow window ; - GData *styles ; + GHashTable *styles ; GHashTable *feature_hash ; int feature_count; ZMapWindowContainerFeatures curr_forward_col ; @@ -116,7 +116,7 @@ typedef struct } CreateFeatureSetDataStruct, *CreateFeatureSetData ; static void windowDrawContext(ZMapCanvasData canvas_data, - GData *styles, + GHashTable *styles, ZMapFeatureContext full_context, ZMapFeatureContext diff_context); static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark key_id, @@ -448,7 +448,7 @@ gboolean zmapWindowCreateSetColumns(ZMapWindow window, ZMapWindowContainerFeatures reverse_strand_group, ZMapFeatureBlock block, ZMapFeatureSet feature_set, - GData *styles, + GHashTable *styles, ZMapFrame frame, FooCanvasGroup **forward_col_out, FooCanvasGroup **reverse_col_out, @@ -620,7 +620,7 @@ gboolean zmapWindowCreateSetColumns(ZMapWindow window, * ProcessFeature splits the feature sets features into the separate strands. */ void zmapWindowDrawFeatureSet(ZMapWindow window, - GData *styles, + GHashTable *styles, ZMapFeatureSet feature_set, FooCanvasGroup *forward_col_wcp, FooCanvasGroup *reverse_col_wcp, @@ -670,7 +670,9 @@ void zmapWindowDrawFeatureSet(ZMapWindow window, featureset_data.feature_count = 0; /* Now draw all the features in the column. */ + zMapStartTimer("DrawFeatureSet","ProcessFeature"); g_hash_table_foreach(feature_set->features, ProcessFeature, &featureset_data) ; + zMapStopTimer("DrawFeatureSet","ProcessFeature"); if(featureset_data.feature_count > 0) { @@ -689,6 +691,7 @@ void zmapWindowDrawFeatureSet(ZMapWindow window, } } + zMapStartTimer("DrawFeatureSet","Bump"); /* We should be bumping columns here if required... */ if (bump_required && view_feature_set) { @@ -708,6 +711,7 @@ void zmapWindowDrawFeatureSet(ZMapWindow window, * already loaded in this column a COMPRESS_ALL will bump the whole column * _not_ just the newly loaded ones... */ + if (forward_col_wcp) { if ((bump_mode = zmapWindowContainerFeatureSetGetBumpMode((ZMapWindowContainerFeatureSet)forward_container)) != ZMAPBUMP_UNBUMP) @@ -715,8 +719,10 @@ void zmapWindowDrawFeatureSet(ZMapWindow window, /* Some columns are hidden initially, could be mag. level, 3 frame only display or * set explicitly in the style for the column. */ + zMapStartTimer("DrawFeatureSet","SetState"); zmapWindowColumnSetState(window, forward_col_wcp, ZMAPSTYLE_COLDISPLAY_INVALID, FALSE) ; - } + zMapStopTimer("DrawFeatureSet","SetState"); + } if (reverse_col_wcp) { @@ -728,7 +734,7 @@ void zmapWindowDrawFeatureSet(ZMapWindow window, zmapWindowColumnSetState(window, reverse_col_wcp, ZMAPSTYLE_COLDISPLAY_INVALID, FALSE) ; } } - + zMapStopTimer("DrawFeatureSet","Bump"); return ; } @@ -937,7 +943,7 @@ static void toggleColumnInMultipleBlocks(ZMapWindow window, char *name, */ static void windowDrawContext(ZMapCanvasData canvas_data, - GData *styles, + GHashTable *styles, ZMapFeatureContext full_context, ZMapFeatureContext diff_context) { @@ -1515,6 +1521,8 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark key_id, double x, y; gboolean block_created = FALSE; + zMapStartTimer("DrawBlock",""); + feature_block = (ZMapFeatureBlock)feature_any; #ifdef MH17_REVCOMP_DEBUG printf("\ndrawFeatures block %d-%d",feature_block->block_to_sequence.t1,feature_block->block_to_sequence.t2); @@ -1678,14 +1686,18 @@ printf("\ndrawFeatures block %d-%d",feature_block->block_to_sequence.t1,feature_ canvas_data->curr_forward_group = zmapWindowContainerGetFeatures(forward_group) ; + zMapStartTimer("CreateColumns",""); /* We create the columns here now. */ /* Why? So that we always have the column, even though it's empty... */ g_list_foreach(window->feature_set_names, set_name_create_set_columns, canvas_data); + + zMapStopTimer("CreateColumns",""); } + zMapStopTimer("DrawBlock",""); break; } @@ -1711,6 +1723,8 @@ printf("drawFeatures set %s",feature_set->description); { int i, got_columns = 0; +//printf("drawFeatures set %s\n",g_quark_to_string(feature_set->unique_id)); + /* re-written for(i = frame_start; i <= frame_end; i++) */ i = frame_start; do @@ -1731,7 +1745,7 @@ printf("drawFeatures set %s",feature_set->description); #ifdef MH17_REVCOMP_DEBUG printf("\nFeatures...\n"); #endif - + zMapStartTimer("DrawFeatureSet",g_quark_to_string(feature_set->unique_id)); zmapWindowDrawFeatureSet(window, canvas_data->styles, @@ -1739,6 +1753,7 @@ printf("drawFeatures set %s",feature_set->description); tmp_forward, tmp_reverse, canvas_data->current_frame); + zMapStopTimer("DrawFeatureSet",g_quark_to_string(feature_set->unique_id)); } i++; } @@ -2049,11 +2064,15 @@ static void ProcessFeature(gpointer key, gpointer data, gpointer user_data) featureset_data->feature_count++; - style = zMapFindStyle(featureset_data->styles, feature->style_id) ; + style = feature->style; // fails: no display. fixed it for pipe via GFF2parser, ACE seems to call it??? + // features paint so it musk be ok! +// style = zMapFindStyle(featureset_data->styles, feature->style_id) ; + #ifdef MH17_REVCOMP_DEBUG if(!style) printf("no style 1 "); #endif +#if MH17_FEATURESET_HAS_OWN_COPY_POINTED_AT_BY_FEATURE if(style) style = zmapWindowContainerFeatureSetStyleFromStyle((ZMapWindowContainerFeatureSet)column_group, style) ; else @@ -2065,13 +2084,15 @@ static void ProcessFeature(gpointer key, gpointer data, gpointer user_data) if(!style) printf("no style 2"); printf("\n"); #endif + +#endif + if(style) feature_item = zmapWindowFeatureDraw(window, style, (FooCanvasGroup *)column_group, feature) ; else g_warning("definitely need a style '%s' for feature '%s'", g_quark_to_string(feature->style_id), g_quark_to_string(feature->original_id)); - return ; } diff --git a/src/zmapWindow/zmapWindowDump.c b/src/zmapWindow/zmapWindowDump.c index 69f14bcfe..e881e8b4d 100755 --- a/src/zmapWindow/zmapWindowDump.c +++ b/src/zmapWindow/zmapWindowDump.c @@ -29,7 +29,7 @@ * HISTORY: * Last edited: Jun 19 13:38 2009 (rds) * Created: Thu Mar 30 16:48:34 2006 (edgrif) - * CVS info: $Id: zmapWindowDump.c,v 1.15 2010-05-17 14:41:16 mh17 Exp $ + * CVS info: $Id: zmapWindowDump.c,v 1.16 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -1184,7 +1184,7 @@ static void dumpFeatureCB(gpointer data, gpointer user_data) double x, y ; // so I can look at them in the debugger -ZMapWindowTextItem zwt = ZMAP_WINDOW_TEXT_ITEM(text_item); +//ZMapWindowTextItem zwt = ZMAP_WINDOW_TEXT_ITEM(text_item); // "GLib-GObject-WARNING **: invalid cast from `ZMapWindowTextItem' to `FooCanvasZMapText'" //FooCanvasZMapText *fzt = FOO_CANVAS_ZMAP_TEXT(text_item); diff --git a/src/zmapWindow/zmapWindowFeature.c b/src/zmapWindow/zmapWindowFeature.c index 535e38da3..1bf411865 100755 --- a/src/zmapWindow/zmapWindowFeature.c +++ b/src/zmapWindow/zmapWindowFeature.c @@ -30,7 +30,7 @@ * HISTORY: * Last edited: May 5 16:32 2010 (edgrif) * Created: Mon Jan 9 10:25:40 2006 (edgrif) - * CVS info: $Id: zmapWindowFeature.c,v 1.185 2010-05-26 12:02:50 mh17 Exp $ + * CVS info: $Id: zmapWindowFeature.c,v 1.186 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -207,7 +207,7 @@ static gboolean mouse_debug_G = FALSE ; #ifdef ED_G_NEVER_INCLUDE_THIS_CODE -GData *zMapWindowFeatureAllStyles(ZMapWindow window) +GHashTable *zMapWindowFeatureAllStyles(ZMapWindow window) { zMapAssert(window && window->feature_context); @@ -474,7 +474,8 @@ ZMapStrand zmapWindowFeatureStrand(ZMapWindow window, ZMapFeature feature) ZMapFeatureTypeStyle style = NULL; ZMapStrand strand = ZMAPSTRAND_FORWARD ; - style = zMapFindStyle(window->read_only_styles, feature->style_id) ; +// style = zMapFindStyle(window->read_only_styles, feature->style_id) ; + style = feature->style; // safe failure... g_return_val_if_fail(style != NULL, strand); @@ -552,6 +553,7 @@ FooCanvasItem *zmapWindowFeatureDraw(ZMapWindow window, block, set, feature); + return new_feature; } diff --git a/src/zmapWindow/zmapWindowItemFactory.c b/src/zmapWindow/zmapWindowItemFactory.c index d51efba23..68c2a2200 100755 --- a/src/zmapWindow/zmapWindowItemFactory.c +++ b/src/zmapWindow/zmapWindowItemFactory.c @@ -30,7 +30,7 @@ * HISTORY: * Last edited: Apr 28 09:49 2010 (edgrif) * Created: Mon Sep 25 09:09:52 2006 (rds) - * CVS info: $Id: zmapWindowItemFactory.c,v 1.81 2010-04-28 08:51:43 edgrif Exp $ + * CVS info: $Id: zmapWindowItemFactory.c,v 1.82 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -550,7 +550,7 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory, ZMapFrame frame; ZMapStrand strand; - g_object_set_data(G_OBJECT(item), ITEM_FEATURE_ITEM_STYLE, style) ; + g_object_set_data(G_OBJECT(item), ITEM_FEATURE_ITEM_STYLE, (gpointer) style) ; frame = zmapWindowContainerFeatureSetGetFrame((ZMapWindowContainerFeatureSet)parent_container); strand = zmapWindowContainerFeatureSetGetStrand((ZMapWindowContainerFeatureSet)parent_container); @@ -701,6 +701,7 @@ static FooCanvasItem *drawSimpleFeature(RunSet run_data, ZMapFeature feature, * We just need to Seq2CanOffset */ zmapWindowSeq2CanOffset(&y1, &y2, feature_offset); + if((new_canvas_item = zMapWindowCanvasItemCreate(parent, y1, feature, style))) { zMapWindowCanvasItemAddInterval(new_canvas_item, NULL, 0.0, y2 - y1, x1, x2); diff --git a/src/zmapWindow/zmapWindowNavigator.c b/src/zmapWindow/zmapWindowNavigator.c index 9e9d7bc0a..fc44efa06 100755 --- a/src/zmapWindow/zmapWindowNavigator.c +++ b/src/zmapWindow/zmapWindowNavigator.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Apr 23 13:59 2010 (edgrif) * Created: Wed Sep 6 11:22:24 2006 (rds) - * CVS info: $Id: zmapWindowNavigator.c,v 1.60 2010-04-23 14:40:32 edgrif Exp $ + * CVS info: $Id: zmapWindowNavigator.c,v 1.61 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ typedef struct /* inputs */ ZMapWindowNavigator navigate; ZMapFeatureContext context; - GData *styles; + GHashTable *styles; /* The current features in the recursion */ ZMapFeatureAlignment current_align; @@ -61,7 +61,7 @@ typedef struct ZMapWindowContainerGroup container_block; ZMapWindowContainerGroup container_strand; ZMapWindowContainerGroup container_feature_set; - double current; + double current; } NavigateDrawStruct, *NavigateDraw; @@ -75,7 +75,7 @@ typedef struct /* We need this because the locator is drawn as a foo_canvas_rect with * a transparent background, that will not receive events! Therefore as - * a work around we set up a handler on the root background and test + * a work around we set up a handler on the root background and test * whether we're within the bounds of the locator. */ typedef struct { @@ -99,18 +99,18 @@ static void container_group_add_highlight_area_item(ZMapWindowNavigator navigate ZMapWindowContainerGroup container); /* draw some features... */ -static ZMapFeatureContextExecuteStatus drawContext(GQuark key, - gpointer data, +static ZMapFeatureContextExecuteStatus drawContext(GQuark key, + gpointer data, gpointer user_data, char **err_out); static void createColumnCB(gpointer data, gpointer user_data); -static void clampCoords(ZMapWindowNavigator navigate, - double pre_scale, double post_scale, +static void clampCoords(ZMapWindowNavigator navigate, + double pre_scale, double post_scale, double *c1_inout, double *c2_inout); -static void clampScaled(ZMapWindowNavigator navigate, +static void clampScaled(ZMapWindowNavigator navigate, double *s1_inout, double *s2_inout); -static void clampWorld2Scaled(ZMapWindowNavigator navigate, +static void clampWorld2Scaled(ZMapWindowNavigator navigate, double *w1_inout, double *w2_inout); static void updateLocatorDragger(ZMapWindowNavigator navigate, double button_y, double size); static gboolean rootBGEventCB(FooCanvasItem *item, GdkEvent *event, gpointer data); @@ -126,7 +126,7 @@ static void navigateDrawFunc(NavigateDraw nav_draw, GtkWidget *widget); static void expose_handler_disconn_cb(gpointer user_data, GClosure *unused); static gboolean nav_draw_expose_handler(GtkWidget *widget, - GdkEventExpose *expose, + GdkEventExpose *expose, gpointer user_data); static gboolean navCanvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer data); @@ -140,17 +140,17 @@ static gboolean factoryItemHandler(FooCanvasItem *new_item, ZMapFeature feature, gpointer handler_data); -static gboolean factoryFeatureSizeReq(ZMapFeature feature, - double *limits_array, - double *points_array_inout, +static gboolean factoryFeatureSizeReq(ZMapFeature feature, + double *limits_array, + double *points_array_inout, gpointer handler_data); static void customiseFactory(ZMapWindowNavigator navigator); static GHashTable *zmapWindowNavigatorLDHCreate(void); static LocusEntry zmapWindowNavigatorLDHFind(GHashTable *hash, GQuark key); -static LocusEntry zmapWindowNavigatorLDHInsert(GHashTable *hash, - ZMapFeature feature, +static LocusEntry zmapWindowNavigatorLDHInsert(GHashTable *hash, + ZMapFeature feature, double start, double end); static void zmapWindowNavigatorLDHDestroy(GHashTable **destroy); static void destroyLocusEntry(gpointer data); @@ -161,13 +161,13 @@ static void default_locus_names_filter(GList **filter_out); static gint strcmp_list_find(gconstpointer list_data, gconstpointer user_data); /* The container update hooks */ -static gboolean highlight_locator_area_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, +static gboolean highlight_locator_area_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, ZMapContainerLevelType level, gpointer user_data); -static gboolean positioning_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, +static gboolean positioning_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, ZMapContainerLevelType level, gpointer user_data); -static gboolean container_draw_locator(ZMapWindowContainerGroup container, FooCanvasPoints *points, +static gboolean container_draw_locator(ZMapWindowContainerGroup container, FooCanvasPoints *points, ZMapContainerLevelType level, gpointer user_data); /* create the items which get updated during hooks */ @@ -276,19 +276,19 @@ ZMapWindowNavigator zMapWindowNavigatorCreate(GtkWidget *canvas_widget) int gdkcolor_size = 0; gdkcolor_size = sizeof(GdkColor); canvas_color = &(gtk_widget_get_style(canvas_widget)->bg[GTK_STATE_NORMAL]); - memcpy(&(navigate->root_background), + memcpy(&(navigate->root_background), canvas_color, gdkcolor_size); - memcpy(&(navigate->align_background), + memcpy(&(navigate->align_background), canvas_color, gdkcolor_size); - memcpy(&(navigate->block_background), + memcpy(&(navigate->block_background), canvas_color, gdkcolor_size); - memcpy(&(navigate->strand_background), + memcpy(&(navigate->strand_background), canvas_color, gdkcolor_size); - memcpy(&(navigate->column_background), + memcpy(&(navigate->column_background), canvas_color, gdkcolor_size); } @@ -318,7 +318,7 @@ ZMapWindowNavigator zMapWindowNavigatorCreate(GtkWidget *canvas_widget) navigate->container_root = zmapWindowContainerGroupCreateFromFoo(root, ZMAPCONTAINER_LEVEL_ROOT, - ROOT_CHILD_SPACING, + ROOT_CHILD_SPACING, &(navigate->root_background), NULL); g_object_set_data(G_OBJECT(navigate->container_root), ZMAP_WINDOW_POINTER, navigate->current_window) ; @@ -331,8 +331,8 @@ ZMapWindowNavigator zMapWindowNavigatorCreate(GtkWidget *canvas_widget) container_group_add_locator(navigate, navigate->container_root); - zmapWindowContainerGroupAddUpdateHook(navigate->container_root, - container_draw_locator, + zmapWindowContainerGroupAddUpdateHook(navigate->container_root, + container_draw_locator, navigate); g_object_set(G_OBJECT(navigate->container_root), @@ -344,7 +344,7 @@ ZMapWindowNavigator zMapWindowNavigatorCreate(GtkWidget *canvas_widget) default_locus_names_filter(&(navigate->hide_filter)); - available_locus_names_filter(&(navigate->available_filters)); + available_locus_names_filter(&(navigate->available_filters)); } zMapAssert(navigate); @@ -394,7 +394,7 @@ void zMapWindowNavigatorReset(ZMapWindowNavigator navigate) return ; } -void zMapWindowNavigatorFocus(ZMapWindowNavigator navigate, +void zMapWindowNavigatorFocus(ZMapWindowNavigator navigate, gboolean true_eq_focus) { FooCanvasItem *root; @@ -426,7 +426,7 @@ void zMapWindowNavigatorSetCurrentWindow(ZMapWindowNavigator navigate, ZMapWindo return ; } -void zMapWindowNavigatorMergeInFeatureSetNames(ZMapWindowNavigator navigate, +void zMapWindowNavigatorMergeInFeatureSetNames(ZMapWindowNavigator navigate, GList *navigator_sets) { /* This needs to do more that just concat!! ha, it'll break something down the line ... column ordering at least */ @@ -437,9 +437,9 @@ void zMapWindowNavigatorMergeInFeatureSetNames(ZMapWindowNavigator navigate, } /* draw features */ -void zMapWindowNavigatorDrawFeatures(ZMapWindowNavigator navigate, +void zMapWindowNavigatorDrawFeatures(ZMapWindowNavigator navigate, ZMapFeatureContext full_context, - GData *styles) + GHashTable *styles) { FooCanvas *canvas = NULL; NavigateDrawStruct draw_data = {NULL}; @@ -562,7 +562,7 @@ static gboolean nav_draw_expose_handler(GtkWidget *widget, GdkEventExpose *expos gulong expose_id; expose_id = draw_data->navigate->draw_expose_handler_id; - + if(draw_data->navigate->current_window) { g_signal_handler_block(G_OBJECT(widget), expose_id); @@ -593,7 +593,7 @@ static void locus_gh_func(gpointer hash_key, gpointer hash_value, gpointer user_ end = locus_data->end; if((item = zmapWindowFToIFindFeatureItem(data->navigate->ftoi_hash, - locus_data->strand, ZMAPFRAME_NONE, + locus_data->strand, ZMAPFRAME_NONE, feature))) { FooCanvasItem *line_item; @@ -603,23 +603,23 @@ static void locus_gh_func(gpointer hash_key, gpointer hash_value, gpointer user_ text_height = data->wheight; mid = start + ((end - start + 1.0) / 2.0); draw_here = mid - (text_height / 2.0); - + iy1 = wy1 = start; iy2 = wy2 = start + text_height; - + foo_canvas_item_get_bounds(item, &x1, &y1, &x2, &y2); - + /* move to the start of the locus... */ foo_canvas_item_move(item, 0.0, start - y1); - + foo_canvas_item_get_bounds(item, &x1, &(iy1), &x2, &(iy2)); - + wy1 = iy1; wy2 = iy2; - + foo_canvas_item_i2w(item, &dummy_x, &(wy1)); foo_canvas_item_i2w(item, &dummy_x, &(wy2)); - + foo_canvas_w2c(item->canvas, dummy_x, wy1, &cx, &(cy1)); foo_canvas_w2c(item->canvas, dummy_x, wy2, &cx, &(cy2)); @@ -650,7 +650,7 @@ static void locus_gh_func(gpointer hash_key, gpointer hash_value, gpointer user_ { GList *match; char *text = NULL; - + g_object_get(G_OBJECT(item), "text", &text, NULL); @@ -669,7 +669,7 @@ static void locus_gh_func(gpointer hash_key, gpointer hash_value, gpointer user_ else zmapWindowTextPositionerAddItem(data->positioner, item); } - + return ; } @@ -684,10 +684,10 @@ static void repositionText(ZMapWindowNavigator navigate) canvas = fetchCanvas(navigate); repos_data.navigate = navigate; - repos_data.positioner = zmapWindowTextPositionerCreate(navigate->full_span.x1 * navigate->scaling_factor, + repos_data.positioner = zmapWindowTextPositionerCreate(navigate->full_span.x1 * navigate->scaling_factor, navigate->full_span.x2 * navigate->scaling_factor); - zmapWindowNavigatorTextSize(GTK_WIDGET(canvas), + zmapWindowNavigatorTextSize(GTK_WIDGET(canvas), NULL, &(repos_data.wheight)); g_hash_table_foreach(navigate->locus_display_hash, @@ -697,7 +697,7 @@ static void repositionText(ZMapWindowNavigator navigate) zmapWindowTextPositionerUnOverlap(repos_data.positioner, TRUE); zmapWindowTextPositionerDestroy(repos_data.positioner); } - + return ; } @@ -709,9 +709,9 @@ static void navigateDrawFunc(NavigateDraw nav_draw, GtkWidget *widget) zMapAssert(navigate->current_window); /* Everything to get a context drawn, raised to top and visible. */ - zMapFeatureContextExecuteComplete((ZMapFeatureAny)(nav_draw->context), - ZMAPFEATURE_STRUCT_FEATURE, - drawContext, + zMapFeatureContextExecuteComplete((ZMapFeatureAny)(nav_draw->context), + ZMAPFEATURE_STRUCT_FEATURE, + drawContext, NULL, nav_draw); repositionText(navigate); @@ -726,8 +726,8 @@ static void navigateDrawFunc(NavigateDraw nav_draw, GtkWidget *widget) } -static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, - gpointer data, +static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, + gpointer data, gpointer user_data, char **error_out) { @@ -758,7 +758,7 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, if(!navigate->container_align) { navigate->container_align = zmapWindowContainerGroupCreate(container_features, ZMAPCONTAINER_LEVEL_ALIGN, - ALIGN_CHILD_SPACING, + ALIGN_CHILD_SPACING, &(navigate->align_background), NULL); g_object_set_data(G_OBJECT(navigate->container_align), ZMAP_WINDOW_POINTER, navigate->current_window) ; @@ -768,9 +768,9 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, zmapWindowContainerGroupAddUpdateHook(navigate->container_align, positioning_cb, navigate); -#endif +#endif zmapWindowContainerGroupAddUpdateHook(navigate->container_align, - highlight_locator_area_cb, + highlight_locator_area_cb, navigate); hash_status = zmapWindowFToIAddAlign(navigate->ftoi_hash, key_id, (FooCanvasGroup *)(navigate->container_align)); @@ -789,11 +789,11 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, block_start = feature_block->block_to_sequence.q1; block_end = feature_block->block_to_sequence.q2; - + /* create the block and add the item to the hash */ features = zmapWindowContainerGetFeatures(draw_data->navigate->container_align); draw_data->container_block = zmapWindowContainerGroupCreate(features, ZMAPCONTAINER_LEVEL_BLOCK, - BLOCK_CHILD_SPACING, + BLOCK_CHILD_SPACING, &(navigate->block_background), NULL); g_object_set_data(G_OBJECT(draw_data->container_block), @@ -802,10 +802,10 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, container_group_add_highlight_area_item(navigate, draw_data->container_block); zmapWindowContainerGroupAddUpdateHook(draw_data->container_block, - highlight_locator_area_cb, + highlight_locator_area_cb, draw_data->navigate); - g_object_set_data(G_OBJECT(draw_data->container_block), ITEM_FEATURE_STATS, + g_object_set_data(G_OBJECT(draw_data->container_block), ITEM_FEATURE_STATS, zmapWindowStatsCreate((ZMapFeatureAny)draw_data->current_block)) ; hash_status = zmapWindowFToIAddBlock(navigate->ftoi_hash, draw_data->current_align->unique_id, @@ -816,7 +816,7 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, features = zmapWindowContainerGetFeatures(draw_data->container_block); /* The strand container doesn't get added to the hash! */ draw_data->container_strand = zmapWindowContainerGroupCreate(features, ZMAPCONTAINER_LEVEL_STRAND, - STRAND_CHILD_SPACING, + STRAND_CHILD_SPACING, &(navigate->strand_background), NULL); g_object_set_data(G_OBJECT(draw_data->container_strand), @@ -825,7 +825,7 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, container_group_add_highlight_area_item(navigate, draw_data->container_strand); zmapWindowContainerGroupAddUpdateHook(draw_data->container_strand, - highlight_locator_area_cb, + highlight_locator_area_cb, draw_data->navigate); /* create a column per set ... */ @@ -844,7 +844,7 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, status = ZMAP_CONTEXT_EXEC_STATUS_DONT_DESCEND; - if((item = zmapWindowFToIFindSetItem(draw_data->navigate->ftoi_hash, feature_set, + if((item = zmapWindowFToIFindSetItem(draw_data->navigate->ftoi_hash, feature_set, ZMAPSTRAND_NONE, ZMAPFRAME_NONE))) { ZMapWindowContainerFeatureSet container_feature_set; @@ -854,8 +854,8 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id, group_feature_set = FOO_CANVAS_GROUP(item); container_feature_set = (ZMapWindowContainerFeatureSet)item; - zmapWindowFToIFactoryRunSet(draw_data->navigate->item_factory, - feature_set, + zmapWindowFToIFactoryRunSet(draw_data->navigate->item_factory, + feature_set, group_feature_set, ZMAPFRAME_NONE); if ((bump_mode = zmapWindowContainerFeatureSetGetBumpMode(container_feature_set)) != ZMAPBUMP_UNBUMP) @@ -925,7 +925,7 @@ static gboolean drawScaleRequired(NavigateDraw draw_data) static void drawScale(NavigateDraw draw_data) { FooCanvasItem *item = NULL; - + GQuark scale_id = 0; int min, max, origin; @@ -939,7 +939,7 @@ static void drawScale(NavigateDraw draw_data) { FooCanvasGroup *scale_group = NULL; FooCanvasGroup *features = NULL; - + scale_group = FOO_CANVAS_GROUP(item); features = (FooCanvasGroup *)zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)scale_group); @@ -981,13 +981,13 @@ static void createColumnCB(gpointer data, gpointer user_data) if(style_list && draw_data->current_set) { ZMapWindowContainerFeatureSet container_set; - + features = zmapWindowContainerGetFeatures(ZMAP_CONTAINER_GROUP(draw_data->container_strand)); - draw_data->container_feature_set = zmapWindowContainerGroupCreate(features, + draw_data->container_feature_set = zmapWindowContainerGroupCreate(features, ZMAPCONTAINER_LEVEL_FEATURESET, - SET_CHILD_SPACING, - &(draw_data->navigate->column_background), + SET_CHILD_SPACING, + &(draw_data->navigate->column_background), NULL); g_object_set_data(G_OBJECT(draw_data->container_feature_set), @@ -996,43 +996,43 @@ static void createColumnCB(gpointer data, gpointer user_data) container_group_add_highlight_area_item(draw_data->navigate, draw_data->container_feature_set); zmapWindowContainerGroupAddUpdateHook(draw_data->container_feature_set, - highlight_locator_area_cb, + highlight_locator_area_cb, draw_data->navigate); - - status = zmapWindowFToIAddSet(draw_data->navigate->ftoi_hash, + + status = zmapWindowFToIAddSet(draw_data->navigate->ftoi_hash, draw_data->current_align->unique_id, draw_data->current_block->unique_id, set_id, ZMAPSTRAND_NONE, ZMAPFRAME_NONE, (FooCanvasGroup *)draw_data->container_feature_set); zMapAssert(status); - + container_set = (ZMapWindowContainerFeatureSet)draw_data->container_feature_set; - + zmapWindowContainerFeatureSetAugment(container_set, draw_data->navigate->current_window, draw_data->current_align->unique_id, draw_data->current_block->unique_id, set_id, 0, style_list, ZMAPSTRAND_FORWARD, ZMAPFRAME_NONE); - - zmapWindowContainerFeatureSetAttachFeatureSet(container_set, + + zmapWindowContainerFeatureSetAttachFeatureSet(container_set, draw_data->current_set); - + g_list_free(style_list); - + zmapWindowContainerSetVisibility(FOO_CANVAS_GROUP(draw_data->container_feature_set), TRUE); - + container_background = zmapWindowContainerGetBackground(draw_data->container_feature_set); - - zmapWindowContainerGroupBackgroundSize(draw_data->container_feature_set, + + zmapWindowContainerGroupBackgroundSize(draw_data->container_feature_set, (draw_data->current_block->block_to_sequence.t2 - draw_data->current_block->block_to_sequence.t1) * draw_data->navigate->scaling_factor); - + /* scale doesn't need this. */ if(set_id != g_quark_from_string(ZMAP_FIXED_STYLE_SCALE_NAME)) g_signal_connect(G_OBJECT(container_set), "event", - G_CALLBACK(columnBackgroundEventCB), + G_CALLBACK(columnBackgroundEventCB), (gpointer)draw_data->navigate); } else @@ -1041,13 +1041,13 @@ static void createColumnCB(gpointer data, gpointer user_data) return ; } -static void clampCoords(ZMapWindowNavigator navigate, - double pre_scale, double post_scale, +static void clampCoords(ZMapWindowNavigator navigate, + double pre_scale, double post_scale, double *c1_inout, double *c2_inout) { double top, bot; double min, max; - + min = (double)(navigate->full_span.x1) * pre_scale; max = (double)(navigate->full_span.x2) * pre_scale; @@ -1065,8 +1065,8 @@ static void clampCoords(ZMapWindowNavigator navigate, static void clampScaled(ZMapWindowNavigator navigate, double *s1_inout, double *s2_inout) { - clampCoords(navigate, - navigate->scaling_factor, + clampCoords(navigate, + navigate->scaling_factor, 1.0, s1_inout, s2_inout); @@ -1076,9 +1076,9 @@ static void clampScaled(ZMapWindowNavigator navigate, double *s1_inout, double * static void clampWorld2Scaled(ZMapWindowNavigator navigate, double *w1_inout, double *w2_inout) { - clampCoords(navigate, + clampCoords(navigate, 1.0, - navigate->scaling_factor, + navigate->scaling_factor, w1_inout, w2_inout); return ; @@ -1090,9 +1090,9 @@ static void updateLocatorDragger(ZMapWindowNavigator navigate, double button_y, a = button_y; b = button_y + size - 1.0; - + clampScaled(navigate, &a, &b); - + if(locator_debug_G) { double sf = navigate->scaling_factor; @@ -1104,12 +1104,12 @@ static void updateLocatorDragger(ZMapWindowNavigator navigate, double button_y, top = start / sf; bot = end / sf; - printf("%s: [nav] %f -> %f (%f) = [wrld] %f -> %f (%f)\n", - "updateLocatorDragger", + printf("%s: [nav] %f -> %f (%f) = [wrld] %f -> %f (%f)\n", + "updateLocatorDragger", start, end, end - start + 1.0, top, bot, bot - top + 1.0); } - + foo_canvas_item_set(FOO_CANVAS_ITEM(navigate->locator_drag), "y1", a, "y2", b, @@ -1171,12 +1171,12 @@ static gboolean rootBGEventCB(FooCanvasItem *item, GdkEvent *event, gpointer dat locator_y2 -= LOCATOR_LINE_WIDTH / 2.0; locator_size = locator_y2 - locator_y1 + 1.0; - + foo_canvas_item_show(navigate->locator_drag); foo_canvas_item_lower_to_bottom(navigate->locator_drag); - + updateLocatorDragger(navigate, y_coord - transp_data->click_correction, locator_size); - + event_handled = transp_data->locator_click = TRUE; } } @@ -1186,7 +1186,7 @@ static gboolean rootBGEventCB(FooCanvasItem *item, GdkEvent *event, gpointer dat { double locator_y1, locator_y2, origin_y1, origin_y2, dummy; zMapAssert(navigate->locator_drag); - + if(transp_data->locator_click == TRUE) { foo_canvas_item_get_bounds(FOO_CANVAS_ITEM(navigate->locator_drag), NULL, &locator_y1, NULL, &locator_y2); @@ -1197,7 +1197,7 @@ static gboolean rootBGEventCB(FooCanvasItem *item, GdkEvent *event, gpointer dat origin_y1 += LOCATOR_LINE_WIDTH / 2.0; origin_y2 -= LOCATOR_LINE_WIDTH / 2.0; - + foo_canvas_item_i2w(FOO_CANVAS_ITEM(navigate->locator_drag), &dummy, &locator_y1); foo_canvas_item_i2w(FOO_CANVAS_ITEM(navigate->locator_drag), &dummy, &locator_y2); @@ -1209,39 +1209,39 @@ static gboolean rootBGEventCB(FooCanvasItem *item, GdkEvent *event, gpointer dat origin_y1 /= navigate->scaling_factor; origin_y2 /= navigate->scaling_factor; - + foo_canvas_item_hide(navigate->locator_drag); - + zMapWindowNavigatorDrawLocator(navigate, locator_y1, locator_y2); if(locator_y1 != origin_y1 && locator_y2 != origin_y2) zmapWindowNavigatorValueChanged(NAVIGATOR_WIDGET(navigate), locator_y1, locator_y2); - + transp_data->locator_click = FALSE; - + event_handled = TRUE; } } break; case GDK_MOTION_NOTIFY: { - double button_y = 0.0, locator_y1, + double button_y = 0.0, locator_y1, locator_y2, locator_size = 0.0; zMapAssert(navigate->locator_drag); - + if(transp_data->locator_click == TRUE) { button_y = (double)event->button.y - transp_data->click_correction; foo_canvas_item_get_bounds(FOO_CANVAS_ITEM(navigate->locator), NULL, &locator_y1, NULL, &locator_y2); - + locator_y1 += LOCATOR_LINE_WIDTH / 2.0; locator_y2 -= LOCATOR_LINE_WIDTH / 2.0; locator_size = locator_y2 - locator_y1 + 1.0; updateLocatorDragger(navigate, button_y, locator_size); - + event_handled = TRUE; } } @@ -1252,9 +1252,9 @@ static gboolean rootBGEventCB(FooCanvasItem *item, GdkEvent *event, gpointer dat event_handled = FALSE ; break ; } - + } - + return event_handled; } @@ -1297,17 +1297,17 @@ static void makeMenuFromCanvasItem(GdkEventButton *button, FooCanvasItem *item, menu_sets = g_list_append(menu_sets, zmapWindowNavigatorMakeMenuLocusColumnOps(NULL, NULL, menu_data)); menu_sets = g_list_append(menu_sets, separator); } - + container = (ZMapWindowContainerFeatureSet)zmapWindowContainerCanvasItemGetContainer(item); } else { /* get set_data->style */ - + if(ZMAP_IS_CONTAINER_FEATURESET(item)) { container = ZMAP_CONTAINER_FEATURESET(item); - + if(container->unique_id == menu_data->navigate->locus_id) { menu_sets = g_list_append(menu_sets, zmapWindowNavigatorMakeMenuLocusColumnOps(NULL, NULL, menu_data)); @@ -1375,7 +1375,7 @@ static gboolean navCanvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpoin case GDK_2BUTTON_PRESS: { GdkEventButton *button = (GdkEventButton *)event ; - + /* Retrieve the feature item info from the canvas item. */ feature = zmapWindowItemGetFeature(item); zMapAssert(feature) ; @@ -1395,7 +1395,7 @@ static gboolean navCanvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpoin } } last_but_press = button->time ; - + event_handled = TRUE ; } else @@ -1432,7 +1432,7 @@ static gboolean factoryItemHandler(FooCanvasItem *new_item, ZMapFeature feature, gpointer handler_data) { - g_signal_connect(GTK_OBJECT(new_item), "event", + g_signal_connect(GTK_OBJECT(new_item), "event", GTK_SIGNAL_FUNC(navCanvasItemEventCB), handler_data); g_signal_connect(GTK_OBJECT(new_item), "destroy", GTK_SIGNAL_FUNC(navCanvasItemDestroyCB), handler_data); @@ -1443,9 +1443,9 @@ static gboolean factoryItemHandler(FooCanvasItem *new_item, return TRUE; } -static gboolean factoryFeatureSizeReq(ZMapFeature feature, - double *limits_array, - double *points_array_inout, +static gboolean factoryFeatureSizeReq(ZMapFeature feature, + double *limits_array, + double *points_array_inout, gpointer handler_data) { ZMapWindowNavigator navigate = (ZMapWindowNavigator)handler_data; @@ -1461,7 +1461,7 @@ static gboolean factoryFeatureSizeReq(ZMapFeature feature, block_start = limits_array[1] * scale_factor; block_end = limits_array[3] * scale_factor; - + *x1_inout = *x1_inout * scale_factor; *x2_inout = *x2_inout * scale_factor; @@ -1470,7 +1470,7 @@ static gboolean factoryFeatureSizeReq(ZMapFeature feature, points_array_inout[0] += 20; points_array_inout[2] += 20; - if((hash_entry = zmapWindowNavigatorLDHFind(navigate->locus_display_hash, + if((hash_entry = zmapWindowNavigatorLDHFind(navigate->locus_display_hash, feature->original_id))) { /* we only ever draw the first one of these. */ @@ -1486,23 +1486,23 @@ static gboolean factoryFeatureSizeReq(ZMapFeature feature, zMapAssertNotReached(); } } - + /* shift according to how we cross, like this for ease of debugging, not speed */ start_end_crossing |= ((*x1_inout < block_start) << 1); start_end_crossing |= ((*x2_inout > block_end) << 2); start_end_crossing |= ((*x1_inout > block_end) << 3); start_end_crossing |= ((*x2_inout < block_start) << 4); - + /* Now check whether we cross! */ - if(start_end_crossing & 8 || + if(start_end_crossing & 8 || start_end_crossing & 16) /* everything is out of range don't display! */ outside = TRUE; - + if(start_end_crossing & 2) *x1_inout = block_start; if(start_end_crossing & 4) *x2_inout = block_end; - + if(hash_entry) { /* extend the values in the hash list */ @@ -1520,8 +1520,8 @@ static gboolean factoryFeatureSizeReq(ZMapFeature feature, static void customiseFactory(ZMapWindowNavigator navigate) { ZMapWindowFToIFactoryProductionTeamStruct factory_helpers = {NULL}; - - /* create a factory and set up */ + + /* create a factory and set up */ navigate->item_factory = zmapWindowFToIFactoryOpen(navigate->ftoi_hash, NULL); factory_helpers.feature_size_request = factoryFeatureSizeReq; factory_helpers.top_item_created = factoryItemHandler; @@ -1536,20 +1536,20 @@ static void customiseFactory(ZMapWindowNavigator navigate) /* mini package for the locus_display_hash ... */ /* * \brief Create a hash for the locus display. - * + * * Hash is keyed on GUINT_TO_POINTER(feature->original_id) * Contains LocusEntry items. */ static GHashTable *zmapWindowNavigatorLDHCreate(void) { GHashTable *hash = NULL; - + hash = g_hash_table_new_full(NULL, NULL, NULL, destroyLocusEntry); return hash; } -/* +/* * \brief finds the entry. */ static LocusEntry zmapWindowNavigatorLDHFind(GHashTable *hash, GQuark key) @@ -1560,11 +1560,11 @@ static LocusEntry zmapWindowNavigatorLDHFind(GHashTable *hash, GQuark key) return hash_entry; } -/* +/* * \brief creates a new entry from feature, start and end (scaled) and returns it. */ -static LocusEntry zmapWindowNavigatorLDHInsert(GHashTable *hash, - ZMapFeature feature, +static LocusEntry zmapWindowNavigatorLDHInsert(GHashTable *hash, + ZMapFeature feature, double start, double end) { LocusEntry hash_entry = NULL; @@ -1575,8 +1575,8 @@ static LocusEntry zmapWindowNavigatorLDHInsert(GHashTable *hash, hash_entry->end = end; hash_entry->strand = feature->strand; hash_entry->feature = feature; /* So we can find the item */ - g_hash_table_insert(hash, - GUINT_TO_POINTER(feature->original_id), + g_hash_table_insert(hash, + GUINT_TO_POINTER(feature->original_id), (gpointer)hash_entry); } else @@ -1584,7 +1584,7 @@ static LocusEntry zmapWindowNavigatorLDHInsert(GHashTable *hash, return hash_entry; } -/* +/* * \brief Destroy the hash **! NULL's for you. */ static void zmapWindowNavigatorLDHDestroy(GHashTable **destroy_me) @@ -1605,7 +1605,7 @@ static void destroyLocusEntry(gpointer data) zMapAssert(data); locus_entry->feature = NULL; - + g_free(locus_entry); return ; @@ -1673,7 +1673,7 @@ static gint strcmp_list_find(gconstpointer list_data, gconstpointer user_data) /* container update hooks */ -static gboolean highlight_locator_area_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, +static gboolean highlight_locator_area_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, ZMapContainerLevelType level, gpointer user_data) { ZMapWindowNavigator navigate = (ZMapWindowNavigator)user_data; @@ -1698,7 +1698,7 @@ static gboolean highlight_locator_area_cb(ZMapWindowContainerGroup container, Fo if(FOO_IS_CANVAS_RE(item_list->data)) { item = FOO_CANVAS_ITEM(item_list->data); - + foo_canvas_item_set(item, "x1", points->coords[0], "x2", points->coords[2], @@ -1735,7 +1735,7 @@ static gboolean idle_resize_widget_cb(gpointer navigate_data) return FALSE; /* only run once! */ } -static gboolean positioning_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, +static gboolean positioning_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, ZMapContainerLevelType level, gpointer user_data) { ZMapWindowNavigator navigate = (ZMapWindowNavigator)user_data; @@ -1763,7 +1763,7 @@ static gboolean positioning_cb(ZMapWindowContainerGroup container, FooCanvasPoin } -static gboolean container_draw_locator(ZMapWindowContainerGroup container, FooCanvasPoints *points, +static gboolean container_draw_locator(ZMapWindowContainerGroup container, FooCanvasPoints *points, ZMapContainerLevelType level, gpointer user_data) { ZMapWindowNavigator navigate = (ZMapWindowNavigator)user_data; @@ -1776,17 +1776,17 @@ static gboolean container_draw_locator(ZMapWindowContainerGroup container, FooCa if(GTK_WIDGET_MAPPED(GTK_WIDGET(navigate->locator->canvas))) { - + x1 = points->coords[0]; x2 = points->coords[2]; - + y1 = navigate->locator_y_coords.x1; y2 = navigate->locator_y_coords.x2; - + clampWorld2Scaled(navigate, &y1, &y2); - + overlay = (FooCanvasGroup *)zmapWindowContainerGetOverlay(container); - + if((list = g_list_first(overlay->item_list))) { do @@ -1806,11 +1806,11 @@ static gboolean container_draw_locator(ZMapWindowContainerGroup container, FooCa while((list = list->next)); } - + foo_canvas_item_raise_to_top(navigate->locator); foo_canvas_item_show(navigate->locator); - + positioning_cb(container, points, level, user_data); } @@ -1888,11 +1888,11 @@ static void container_group_add_locator(ZMapWindowNavigator navigate, int i; GdkColor blue; gdk_color_parse("lightblue", &blue); - - /* These are just some markers to draw that show where the + + /* These are just some markers to draw that show where the * 1000 "scaled" world coords are. i.e. 1000 world coords * of _this_ canvas, which does not equal the feature - * coords here... They get updated in x by the + * coords here... They get updated in x by the * container_draw_locator update hook. */ for(i = 0; i < 26; i+=2) @@ -1914,13 +1914,13 @@ static void container_group_add_locator(ZMapWindowNavigator navigate, if((transp_data = g_new0(TransparencyEventStruct, 1))) { FooCanvasItem *root_bg = NULL; - + root_bg = (FooCanvasItem *)(navigate->container_root); - + transp_data->navigate = navigate; transp_data->locator_click = FALSE; transp_data->click_correction = 0.0; - + g_signal_connect(GTK_OBJECT(root_bg), "event", GTK_SIGNAL_FUNC(rootBGEventCB), transp_data); } diff --git a/src/zmapWindow/zmapWindowRemoteReceive.c b/src/zmapWindow/zmapWindowRemoteReceive.c index 9e0aa64c4..eab30bea9 100755 --- a/src/zmapWindow/zmapWindowRemoteReceive.c +++ b/src/zmapWindow/zmapWindowRemoteReceive.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,13 +23,13 @@ * Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk, * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * - * Description: + * Description: * * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: * Last edited: Sep 8 08:51 2009 (edgrif) * Created: Thu Jul 19 11:45:36 2007 (rds) - * CVS info: $Id: zmapWindowRemoteReceive.c,v 1.12 2010-03-04 15:13:20 mh17 Exp $ + * CVS info: $Id: zmapWindowRemoteReceive.c,v 1.13 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -79,7 +79,7 @@ typedef struct ZMapFeatureSet feature_set; ZMapFeature feature; - GData *styles; + GHashTable *styles; GList *locations, *feature_list; @@ -107,22 +107,22 @@ static void loadFeatures(ZMapWindow window, RequestData input_data, ResponseData #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ -static gboolean xml_zmap_start_cb(gpointer user_data, - ZMapXMLElement zmap_element, +static gboolean xml_zmap_start_cb(gpointer user_data, + ZMapXMLElement zmap_element, ZMapXMLParser parser); -static gboolean xml_request_start_cb(gpointer user_data, - ZMapXMLElement zmap_element, +static gboolean xml_request_start_cb(gpointer user_data, + ZMapXMLElement zmap_element, ZMapXMLParser parser); #if NOT_USED -static gboolean xml_featureset_start_cb(gpointer user_data, - ZMapXMLElement zmap_element, +static gboolean xml_featureset_start_cb(gpointer user_data, + ZMapXMLElement zmap_element, ZMapXMLParser parser); -static gboolean xml_feature_start_cb(gpointer user_data, - ZMapXMLElement zmap_element, +static gboolean xml_feature_start_cb(gpointer user_data, + ZMapXMLElement zmap_element, ZMapXMLParser parser); #endif -static gboolean xml_return_true_cb(gpointer user_data, - ZMapXMLElement zmap_element, +static gboolean xml_return_true_cb(gpointer user_data, + ZMapXMLElement zmap_element, ZMapXMLParser parser); static char *actions_G[ZMAPWINDOW_REMOTE_UNKNOWN + 1] = @@ -204,10 +204,10 @@ static char *window_execute_command(char *command_text, gpointer user_data, int if((zMapXMLParserParseBuffer(parser, command_text, strlen(command_text))) == TRUE) { ResponseDataStruct output_data = {0}; - + output_data.code = 0; output_data.messages = g_string_sized_new(512); - + switch(input.common.action) { @@ -244,7 +244,7 @@ static char *window_execute_command(char *command_text, gpointer user_data, int { zMapLogWarning("%s", response); g_free(response); - response = g_strdup("Broken code. Check zmap.log file"); + response = g_strdup("Broken code. Check zmap.log file"); } if(response == NULL){ response = g_strdup("Broken code."); } @@ -253,8 +253,8 @@ static char *window_execute_command(char *command_text, gpointer user_data, int #ifdef ED_G_NEVER_INCLUDE_THIS_CODE -static ZMapFeatureContextExecuteStatus zoomToFeatureCB(GQuark key, - gpointer data, +static ZMapFeatureContextExecuteStatus zoomToFeatureCB(GQuark key, + gpointer data, gpointer user_data, char **error_out) { @@ -267,7 +267,7 @@ static ZMapFeatureContextExecuteStatus zoomToFeatureCB(GQuark key, case ZMAPFEATURE_STRUCT_FEATURE: if(!input_data->zoomed) { - zMapWindowZoomToFeature(input_data->window, (ZMapFeature)feature_any); + zMapWindowZoomToFeature(input_data->window, (ZMapFeature)feature_any); input_data->zoomed = TRUE; } break; @@ -312,17 +312,17 @@ static void zoomWindowToFeature(ZMapWindow window, RequestData input_data, Respo else if ((list = g_list_first(input_data->locations))) { span = (ZMapSpan)(list->data); - zMapWindowZoomToWorldPosition(window, FALSE, + zMapWindowZoomToWorldPosition(window, FALSE, 0.0, span->x1, 100.0, span->x2); - g_string_append_printf(output_data->messages, + g_string_append_printf(output_data->messages, "Zoom to location %d-%d executed", span->x1, span->x2); } else { - g_string_append_printf(output_data->messages, - "No data for %s action", + g_string_append_printf(output_data->messages, + "No data for %s action", actions_G[ZMAPWINDOW_REMOTE_ZOOM_TO]); output_data->code = ZMAPXREMOTE_BADREQUEST; } @@ -396,13 +396,13 @@ static void loadFeatures(ZMapWindow window, RequestData input_data, ResponseData static void populate_request_data(RequestData input_data) { input_data->orig_context = input_data->window->feature_context; - + /* Copy basics of original context. */ input_data->edit_context = (ZMapFeatureContext)zMapFeatureAnyCopy((ZMapFeatureAny)(input_data->orig_context)) ; //input_data->edit_context->styles = NULL ; - + input_data->styles = input_data->window->read_only_styles ; - + return ; } #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ @@ -410,8 +410,8 @@ static void populate_request_data(RequestData input_data) #ifdef ED_G_NEVER_INCLUDE_THIS_CODE -static gboolean setupStyles(ZMapFeatureSet set, ZMapFeature feature, - GData *styles, GQuark style_id) +static gboolean setupStyles(ZMapFeatureSet set, ZMapFeature feature, + GHashTable *styles, GQuark style_id) { gboolean got_style = TRUE; @@ -421,7 +421,7 @@ static gboolean setupStyles(ZMapFeatureSet set, ZMapFeature feature, -static gboolean xml_zmap_start_cb(gpointer user_data, +static gboolean xml_zmap_start_cb(gpointer user_data, ZMapXMLElement zmap_element, ZMapXMLParser parser) { @@ -516,7 +516,7 @@ static gboolean xml_zmap_start_cb(gpointer user_data, return result ; } -static gboolean xml_request_start_cb(gpointer user_data, +static gboolean xml_request_start_cb(gpointer user_data, ZMapXMLElement zmap_element, ZMapXMLParser parser) { @@ -759,75 +759,75 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_ case ZMAPWINDOW_REMOTE_ZOOM_TO: { zMapXMLParserCheckIfTrueErrorReturn(request_data->block == NULL, - parser, + parser, "feature tag not contained within featureset tag"); - + if((attr = zMapXMLElementGetAttributeByName(feature_element, "name"))) { feature_name_q = zMapXMLAttributeGetValue(attr); } else zMapXMLParserRaiseParsingError(parser, "name is a required attribute for feature."); - + if((attr = zMapXMLElementGetAttributeByName(feature_element, "style"))) { style_q = zMapXMLAttributeGetValue(attr); } else zMapXMLParserRaiseParsingError(parser, "style is a required attribute for feature."); - + if((attr = zMapXMLElementGetAttributeByName(feature_element, "start"))) { - start = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), + start = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), (char **)NULL, 10); } else zMapXMLParserRaiseParsingError(parser, "start is a required attribute for feature."); - + if((attr = zMapXMLElementGetAttributeByName(feature_element, "end"))) { - end = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), + end = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), (char **)NULL, 10); } else zMapXMLParserRaiseParsingError(parser, "end is a required attribute for feature."); - + if((attr = zMapXMLElementGetAttributeByName(feature_element, "strand"))) { zMapFeatureFormatStrand((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), &(strand)); } - + if((attr = zMapXMLElementGetAttributeByName(feature_element, "score"))) { score = zMapXMLAttributeValueToDouble(attr); has_score = TRUE; } - + if((attr = zMapXMLElementGetAttributeByName(feature_element, "suid"))) { /* Nothing done here yet. */ zMapXMLAttributeGetValue(attr); } - + if(!zMapXMLParserLastErrorMsg(parser)) { style_name = (char *)g_quark_to_string(style_q); style_id = zMapStyleCreateID(style_name); feature_name = (char *)g_quark_to_string(feature_name_q); - + if(!(request_data->feature_set = zMapFeatureBlockGetSetByID(request_data->block, style_id))) { request_data->feature_set = zMapFeatureSetCreate(style_name , NULL); zMapFeatureBlockAddFeatureSet(request_data->block, request_data->feature_set); } - - if((request_data->feature = zMapFeatureCreateFromStandardData(feature_name, NULL, "", + + if((request_data->feature = zMapFeatureCreateFromStandardData(feature_name, NULL, "", ZMAPSTYLE_MODE_BASIC, NULL, start, end, has_score, score, strand, ZMAPPHASE_NONE))) { - if (setupStyles(request_data->feature_set, request_data->feature, + if (setupStyles(request_data->feature_set, request_data->feature, request_data->styles, style_id)) { @@ -865,7 +865,7 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_ g_free(error); } } - + /* This must go and instead use a feature create call... */ feature_any = g_new0(ZMapFeatureAnyStruct, 1) ; @@ -891,8 +891,8 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_ #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ -static gboolean xml_return_true_cb(gpointer user_data, - ZMapXMLElement zmap_element, +static gboolean xml_return_true_cb(gpointer user_data, + ZMapXMLElement zmap_element, ZMapXMLParser parser) { return TRUE; diff --git a/src/zmapWindow/zmapWindowSearch.c b/src/zmapWindow/zmapWindowSearch.c index 40eee8d92..a3d264795 100755 --- a/src/zmapWindow/zmapWindowSearch.c +++ b/src/zmapWindow/zmapWindowSearch.c @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -25,12 +25,12 @@ * Description: Implements a search window which allows a user to * specify align, block, set and feature patterns to * find sets of features. - * + * * Exported functions: See zmapWindow_P.h * HISTORY: * Last edited: Jun 12 08:58 2009 (rds) * Created: Fri Aug 12 16:53:21 2005 (edgrif) - * CVS info: $Id: zmapWindowSearch.c,v 1.42 2010-03-04 15:13:22 mh17 Exp $ + * CVS info: $Id: zmapWindowSearch.c,v 1.43 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ typedef struct ZMapWindow window ; FooCanvasItem *feature_item ; ZMapFeatureAny feature_any ; - GData *styles ; + GHashTable *styles ; GHashTable *context_to_item; ZMapWindowListGetFToIHash get_hash_func; @@ -135,15 +135,15 @@ static void setFilterDefaults(SearchData search_data) ; static void addToComboBoxText(gpointer list_data, gpointer combo_data); static void addToComboBoxQuark(gpointer list_data, gpointer combo_data); static GtkWidget *createPopulateComboBox(GList *list, gboolean quarks); -static void fetchAllComboLists(ZMapFeatureAny feature_any, +static void fetchAllComboLists(ZMapFeatureAny feature_any, GList **align_list_out, GList **block_list_out, GList **set_list_out); -static ZMapFeatureContextExecuteStatus fillAllComboList(GQuark key, gpointer data, +static ZMapFeatureContextExecuteStatus fillAllComboList(GQuark key, gpointer data, gpointer user_data, char **err_out); -static GList *getStyleQuarks(GData *styles) ; -static void getQuark(GQuark style_id, gpointer data, gpointer user_data) ; +static GList *getStyleQuarks(GHashTable *styles) ; +static void getQuark(gpointer key, gpointer data, gpointer user_data) ; gboolean searchPredCB(FooCanvasItem *canvas_item, gpointer user_data) ; @@ -166,7 +166,7 @@ static GHashTable *access_window_context_to_item(gpointer user_data) } -void zmapWindowCreateSearchWindow(ZMapWindow window, +void zmapWindowCreateSearchWindow(ZMapWindow window, ZMapWindowListGetFToIHash get_hash_func, gpointer get_hash_data, FooCanvasItem *feature_item) @@ -231,9 +231,9 @@ void zmapWindowCreateSearchWindow(ZMapWindow window, buttonBox = gtk_hbutton_box_new(); gtk_button_box_set_layout (GTK_BUTTON_BOX (buttonBox), GTK_BUTTONBOX_END); - gtk_box_set_spacing (GTK_BOX(buttonBox), + gtk_box_set_spacing (GTK_BOX(buttonBox), ZMAP_WINDOW_GTK_BUTTON_BOX_SPACING); - gtk_container_set_border_width (GTK_CONTAINER (buttonBox), + gtk_container_set_border_width (GTK_CONTAINER (buttonBox), ZMAP_WINDOW_GTK_CONTAINER_BORDER_WIDTH); search_button = gtk_button_new_with_label("Search") ; @@ -245,7 +245,7 @@ void zmapWindowCreateSearchWindow(ZMapWindow window, gtk_window_set_default(GTK_WINDOW(toplevel), search_button) ; frame = gtk_frame_new("") ; - gtk_container_set_border_width(GTK_CONTAINER(frame), + gtk_container_set_border_width(GTK_CONTAINER(frame), ZMAP_WINDOW_GTK_CONTAINER_BORDER_WIDTH); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0) ; @@ -381,7 +381,7 @@ static GtkWidget *makeFiltersPanel(SearchData search_data) GtkWidget *frame ; GtkWidget *topbox, *hbox, *entrybox, *labelbox, *entry, *label, *combo ; ZMapFeatureContext context ; - GData *styles ; + GHashTable *styles ; GList *style_quarks ; context = (ZMapFeatureContext)zMapFeatureGetParentGroup(search_data->feature_any, @@ -389,7 +389,7 @@ static GtkWidget *makeFiltersPanel(SearchData search_data) search_data->styles = styles = search_data->window->read_only_styles ; style_quarks = getStyleQuarks(styles) ; - + setFilterDefaults(search_data) ; @@ -569,7 +569,7 @@ static GQuark entry_get_text_quark(GtkEntry *entry, char *wildcard) else if((entry_text = g_strdup(entry_text))) { entry_text = g_strstrip(entry_text); - + entry_quark = g_quark_from_string(entry_text); /* The Quark table has a reference to this now... Free it. */ @@ -580,11 +580,11 @@ static GQuark entry_get_text_quark(GtkEntry *entry, char *wildcard) } /* return either usable, wildcard or canonicalized(user_set) */ -static GQuark manage_quark_from_entry(GQuark user_set, GQuark original, +static GQuark manage_quark_from_entry(GQuark user_set, GQuark original, GQuark usable, GQuark wildcard) { GQuark managed_quark = 0; - + managed_quark = user_set; if(managed_quark == original) @@ -615,7 +615,7 @@ static void searchCB(GtkWidget *widget, gpointer cb_data) char *wild_card_str = "*" ; GQuark wild_card_id ; char *style_text ; - + wild_card_id = g_quark_from_string(wild_card_str) ; @@ -636,11 +636,11 @@ static void searchCB(GtkWidget *widget, gpointer cb_data) /* Needed in more than one place. */ start_txt = (char *)gtk_entry_get_text(GTK_ENTRY(search_data->start_entry)) ; end_text = (char *)gtk_entry_get_text(GTK_ENTRY(search_data->end_entry)) ; - + if((align_id = entry_get_text_quark(GTK_ENTRY(search_data->align_entry), wild_card_str)) != 0) { /* fix up align_id */ - align_id = manage_quark_from_entry(align_id, search_data->align_original_id, + align_id = manage_quark_from_entry(align_id, search_data->align_original_id, search_data->align_id, wild_card_id); /* fix up block_id */ @@ -654,7 +654,7 @@ static void searchCB(GtkWidget *widget, gpointer cb_data) { set_id = manage_quark_from_entry(set_id, search_data->set_original_id, search_data->set_id, wild_card_id); - + /* fix up feature_id */ if((feature_id = entry_get_text_quark(GTK_ENTRY(search_data->feature_entry), wild_card_str)) != 0) { @@ -718,7 +718,7 @@ static void searchCB(GtkWidget *widget, gpointer cb_data) search_pred_ptr = &search_pred ; search_pred.start = atoi(start_txt) ; - + search_pred.end = atoi(end_text) ; search_pred.locus = locus ; @@ -778,9 +778,9 @@ static void searchCB(GtkWidget *widget, gpointer cb_data) { char *title = NULL; title = g_strdup_printf("Results '%s'", feature_txt); - zmapWindowListWindow(search_data->window, + zmapWindowListWindow(search_data->window, NULL, title, - search_data->get_hash_func, + search_data->get_hash_func, search_data->get_hash_data, NULL, NULL, NULL, zoom_to_item); @@ -789,7 +789,7 @@ static void searchCB(GtkWidget *widget, gpointer cb_data) } else { - zMapMessage("Sorry, list windows of %ss within a feature context not currently supported.", + zMapMessage("Sorry, list windows of %ss within a feature context not currently supported.", zMapFeatureStructType2Str(any_feature->struct_type)) ; } @@ -803,7 +803,7 @@ static void searchCB(GtkWidget *widget, gpointer cb_data) SearchPredCBData search_pred_data = NULL ; gboolean zoom_to_item = TRUE; char *title = NULL; - + title = g_strdup_printf("Results '%s'", feature_txt); if(callback && search_pred_ptr) @@ -1078,7 +1078,7 @@ static GtkWidget *createPopulateComboBox(GList *list, gboolean quarks) return combo; } -static ZMapFeatureContextExecuteStatus fillAllComboList(GQuark key, gpointer data, +static ZMapFeatureContextExecuteStatus fillAllComboList(GQuark key, gpointer data, gpointer user_data, char **err_out) { ZMapFeatureAny feature_any = (ZMapFeatureAny)data; @@ -1114,7 +1114,7 @@ static ZMapFeatureContextExecuteStatus fillAllComboList(GQuark key, gpointer dat return ZMAP_CONTEXT_EXEC_STATUS_OK; } -static void fetchAllComboLists(ZMapFeatureAny feature_any, +static void fetchAllComboLists(ZMapFeatureAny feature_any, GList **align_list_out, GList **block_list_out, GList **set_list_out) @@ -1136,7 +1136,7 @@ static void addToComboBoxText(gpointer list_data, gpointer combo_data) { GtkWidget *combo = (GtkWidget *)combo_data; char *text = (char *)list_data; - + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), text); return ; @@ -1147,7 +1147,7 @@ static void addToComboBoxQuark(gpointer list_data, gpointer combo_data) GtkWidget *combo = (GtkWidget *)combo_data; GQuark textId = GPOINTER_TO_UINT(list_data); const char *text = NULL; - + if(textId) { text = g_quark_to_string(textId); @@ -1248,18 +1248,18 @@ static void locusCB(GtkToggleButton *toggle_button, gpointer cb_data) -static GList *getStyleQuarks(GData *styles) +static GList *getStyleQuarks(GHashTable *styles) { GList *style_quarks = NULL ; - g_datalist_foreach(&styles, getQuark, &style_quarks) ; + g_hash_table_foreach(styles, getQuark, &style_quarks) ; return style_quarks ; } -static void getQuark(GQuark style_id, gpointer data, gpointer user_data) +static void getQuark(gpointer key, gpointer data, gpointer user_data) { ZMapFeatureTypeStyle style = (ZMapFeatureTypeStyle)data ; GList *style_quarks = *((GList **)user_data) ; diff --git a/src/zmapWindow/zmapWindowUtils.c b/src/zmapWindow/zmapWindowUtils.c index 6a39b394b..4358987a8 100755 --- a/src/zmapWindow/zmapWindowUtils.c +++ b/src/zmapWindow/zmapWindowUtils.c @@ -28,7 +28,7 @@ * HISTORY: * Last edited: Jan 22 11:22 2010 (edgrif) * Created: Thu Jan 20 14:43:12 2005 (edgrif) - * CVS info: $Id: zmapWindowUtils.c,v 1.61 2010-05-17 14:41:16 mh17 Exp $ + * CVS info: $Id: zmapWindowUtils.c,v 1.62 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ @@ -307,22 +307,22 @@ void zMapWindowGetVisible(ZMapWindow window, double *top_out, double *bottom_out * */ -gboolean zmapWindowUpdateStyles(ZMapWindow window, GData **read_only_styles, GData **display_styles) +gboolean zmapWindowUpdateStyles(ZMapWindow window, GHashTable *read_only_styles, GHashTable *display_styles) { gboolean result = FALSE ; - if (*read_only_styles) + if (read_only_styles) { if (window->read_only_styles) - zMapStyleDestroyStyles(&(window->read_only_styles)) ; + zMapStyleDestroyStyles(window->read_only_styles) ; result = zMapStyleCopyAllStyles(read_only_styles, &(window->read_only_styles)) ; } - if (*display_styles) + if (display_styles) { if (window->display_styles) - zMapStyleDestroyStyles(&(window->display_styles)) ; + zMapStyleDestroyStyles(window->display_styles) ; result = zMapStyleCopyAllStyles(display_styles, &(window->display_styles)) ; } @@ -403,7 +403,7 @@ ZMapFeatureTypeStyle zmapWindowStyleTableAddCopy(GHashTable *style_table, ZMapFe { style = zMapFeatureStyleCopy(new_style) ; - g_hash_table_insert(style_table, GINT_TO_POINTER(zMapStyleGetUniqueID(new_style)), style) ; + g_hash_table_insert(style_table, GINT_TO_POINTER(zMapStyleGetUniqueID(new_style)), (gpointer) style) ; } return style ; @@ -455,10 +455,10 @@ void zmapWindowStyleTableDestroy(GHashTable *style_table) /* Free the list, but not the styles ......um, what does this mean.....EG */ -/* It means there's no copying of the style from GData[all_styles] -> +/* It means there's no copying of the style from GHashTable[all_styles] -> * GList[some_styles] going on in this function. Just allocation of * GList items to hold onto the styles pointers. */ -GList *zmapWindowFeatureSetStyles(ZMapWindow window, GData *all_styles, GQuark feature_set_id) +GList *zmapWindowFeatureSetStyles(ZMapWindow window, GHashTable *all_styles, GQuark feature_set_id) { GList *styles_list = NULL; GList *styles_quark_list = NULL; @@ -480,7 +480,7 @@ GList *zmapWindowFeatureSetStyles(ZMapWindow window, GData *all_styles, GQuark f if((style = zMapFindStyle(all_styles, style_id))) // add styles needed by featuresets { - styles_list = g_list_append(styles_list, style); + styles_list = g_list_append(styles_list, (gpointer) style); for(i = 1;i < ZMAPSTYLE_SUB_FEATURE_MAX;i++) // add styles needed by this style { @@ -491,7 +491,7 @@ GList *zmapWindowFeatureSetStyles(ZMapWindow window, GData *all_styles, GQuark f { if((sub = zMapFindStyle(all_styles, sub_id))) { - styles_list = g_list_append(styles_list, sub); + styles_list = g_list_append(styles_list, (gpointer) sub); } } } @@ -499,12 +499,11 @@ GList *zmapWindowFeatureSetStyles(ZMapWindow window, GData *all_styles, GQuark f else { - static int fred = 0; - void printStyle(GQuark style_id, gpointer data, gpointer user_data); + //void printStyle(gpointer key, gpointer data, gpointer user_data); + //g_hash_table_foreach(&all_styles, printStyle, "FeatureSetStyles") ; zMapLogWarning("could not find style %s for featureset %s\n", g_quark_to_string(style_id),g_quark_to_string(feature_set_id)); - //g_datalist_foreach(&all_styles, printStyle, "FeatureSetStyles") ; } } while((list = g_list_next(list))); diff --git a/src/zmapWindow/zmapWindow_P.h b/src/zmapWindow/zmapWindow_P.h index 33c397b09..4267035cb 100755 --- a/src/zmapWindow/zmapWindow_P.h +++ b/src/zmapWindow/zmapWindow_P.h @@ -6,12 +6,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -23,11 +23,11 @@ * Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk * * Description: Defines internal interfaces/data structures of zMapWindow. - * + * * HISTORY: * Last edited: May 24 13:37 2010 (edgrif) * Created: Fri Aug 1 16:45:58 2003 (edgrif) - * CVS info: $Id: zmapWindow_P.h,v 1.260 2010-05-24 12:37:43 edgrif Exp $ + * CVS info: $Id: zmapWindow_P.h,v 1.261 2010-06-08 08:31:26 mh17 Exp $ *------------------------------------------------------------------- */ #ifndef ZMAP_WINDOW_P_H @@ -46,13 +46,13 @@ #include <zmapWindowContainerUtils.h> -/* set a KNOWN initial size for the foo_canvas! +/* set a KNOWN initial size for the foo_canvas! * ... the same size as foo_canvas sets ... */ #define ZMAP_CANVAS_INIT_SIZE (100.0) -/* +/* * This section details data that we attach to the foocanvas items that represent * contexts, aligns etc. Each data structure is accessed via a key given by the * string in the hash define for each struct. @@ -162,7 +162,7 @@ typedef struct GQuark block_id; GQuark set_id; GQuark feature_id; - + char *strand_str; char *frame_str; @@ -231,22 +231,22 @@ typedef struct * be changed any time soon...they impinge on the canvas which could have a very * large windows indeed. Unfortunately X just silently resets the window to size * 1 when you try to create larger windows....now read on... - * + * * The largest X window that can be created has max dimensions of 65535 (i.e. an * unsigned short), you can easily test this for a server by creating a window and * then querying its size, you should find this is the max. window size you can have. - * + * * BUT....you can't really make use of a window this size _because_ when positioning * anything (other windows, lines etc.), the coordinates are given via _signed_ ints. * This means that the maximum position you can specify must in the range -32768 * to 32767. In a way this makes sense because it means that you can have a window * that covers this entire span and so position things anywhere inside it. In a way * its completely crap and confusing....... - * + * * BUT....it means that in the visible window you are limited to the range 0 - 32767. * by sticking at 30,000 we allow ourselves a margin for error that should work on any * machine. - * + * */ enum @@ -262,13 +262,13 @@ enum ZMAP_WINDOW_INTRON_POINTS = 3 /* Number of points to draw an intron. */ } ; -enum +enum { ZMAP_WINDOW_GTK_BOX_SPACING = 5, /* Size in pixels for the GTK_BOX spacing between children */ ZMAP_WINDOW_GTK_BUTTON_BOX_SPACING = 10 }; -enum +enum { ZMAP_WINDOW_GTK_CONTAINER_BORDER_WIDTH = 5 }; @@ -308,7 +308,7 @@ typedef enum /* Controls what data is displayed in the feature list window. */ typedef enum - { + { ZMAP_WINDOW_LIST_COL_NAME, /*!< feature name column */ ZMAP_WINDOW_LIST_COL_TYPE, /*!< feature type column */ ZMAP_WINDOW_LIST_COL_STRAND, /*!< feature strand */ @@ -334,7 +334,7 @@ typedef enum /* Controls what data is displayed in the dna list window. */ typedef enum - { + { ZMAP_WINDOW_LIST_DNA_SCREEN_START, /* match screen start coord */ ZMAP_WINDOW_LIST_DNA_SCREEN_END, /* match screen end coord */ ZMAP_WINDOW_LIST_DNA_SCREEN_STRAND, /* match strand */ @@ -418,7 +418,7 @@ typedef void (*ZMapWindowRulerCanvasCallback)(gpointer data, typedef struct _ZMapWindowRulerCanvasCallbackListStruct { ZMapWindowRulerCanvasCallback paneResize; - + gpointer user_data; /* Goes to all! */ } ZMapWindowRulerCanvasCallbackListStruct, *ZMapWindowRulerCanvasCallbackList; @@ -531,7 +531,7 @@ typedef struct _ZMapWindowStruct /* Max canvas window size can either be set in pixels or in DNA bases, the latter overrides the - * former. In either case the window cannot be more than 30,000 pixels (32k is the actual + * former. In either case the window cannot be more than 30,000 pixels (32k is the actual * X windows limit. */ int canvas_maxwin_size ; int canvas_maxwin_bases ; @@ -563,8 +563,8 @@ typedef struct _ZMapWindowStruct ZMapFeatureContext feature_context ; /* Currently displayed features. */ - GData *read_only_styles ; /* Original styles list from server. */ - GData *display_styles ; /* Styles used for current display. */ + GHashTable *read_only_styles ; /* Original styles list from server. */ + GHashTable *display_styles ; /* Styles used for current display. */ ZMapFeatureContext strand_separator_context ; /* context to display non-feature context "features" with. */ @@ -583,7 +583,7 @@ typedef struct _ZMapWindowStruct /* The stupid foocanvas can generate graphics items that are greater than the X Windows 32k * limit, so we have to keep a list of the canvas items that can generate graphics greater * than this limit as we zoom in and crop them ourselves. */ - ZMapWindowLongItems long_items ; + ZMapWindowLongItems long_items ; ZMapWindowFToIFactory item_factory; /* Lists of dialog windows associated with this zmap window, these must be destroyed when @@ -720,8 +720,8 @@ void zmapWindowPrintLocalCoords(char *msg_prefix, FooCanvasItem *item) ; void zmapWindowShowItem(FooCanvasItem *item) ; -void zmapWindowListWindowCreate(ZMapWindow window, - FooCanvasItem *current_item, +void zmapWindowListWindowCreate(ZMapWindow window, + FooCanvasItem *current_item, char *title, ZMapWindowListGetFToIHash get_hash_func, gpointer get_hash_data, @@ -729,8 +729,8 @@ void zmapWindowListWindowCreate(ZMapWindow window, gpointer search_hash_data, GDestroyNotify search_hash_free, gboolean zoom_to_item); -void zmapWindowListWindow(ZMapWindow window, - FooCanvasItem *current_item, +void zmapWindowListWindow(ZMapWindow window, + FooCanvasItem *current_item, char *title, ZMapWindowListGetFToIHash get_hash_func, gpointer get_hash_data, @@ -740,7 +740,7 @@ void zmapWindowListWindow(ZMapWindow window, gboolean zoom_to_item); void zmapWindowListWindowReread(GtkWidget *window_list_widget) ; -void zmapWindowCreateSearchWindow(ZMapWindow zmapWindow, +void zmapWindowCreateSearchWindow(ZMapWindow zmapWindow, ZMapWindowListGetFToIHash get_hash_func, gpointer get_hash_data, FooCanvasItem *feature_item) ; @@ -769,7 +769,7 @@ void zmapWindowLongItemPrint(ZMapWindowLongItems long_items) ; void zmapWindowLongItemFree(ZMapWindowLongItems long_items) ; void zmapWindowLongItemDestroy(ZMapWindowLongItems long_item) ; -void zmapWindowDrawFeatures(ZMapWindow window, +void zmapWindowDrawFeatures(ZMapWindow window, ZMapFeatureContext current_context, ZMapFeatureContext new_context) ; void zmapWindowreDrawContainerExecute(ZMapWindow window, ZMapContainerUtilsExecFunc enter_cb, @@ -827,7 +827,7 @@ GList *zmapWindowFToIFindItemSetFull(GHashTable *feature_to_context_hash, GQuark align_id, GQuark block_id, GQuark set_id, char *strand_spec, char *frame_spec, GQuark feature_id, - ZMapWindowFToIPredFuncCB pred_func, gpointer user_data) ; + ZMapWindowFToIPredFuncCB pred_func, gpointer user_data) ; GList *zmapWindowFToIFindSameNameItems(GHashTable *feature_to_context_hash, char *set_strand, char *set_frame, ZMapFeature feature) ; @@ -905,9 +905,9 @@ ZMapFeatureSet zmapWindowItemFeatureSetRecoverFeatureSet(ZMapWindowItemFeatureSe -void zmapWindowItemHighlightRegionTranslations(ZMapWindow window, FooCanvasItem *item, +void zmapWindowItemHighlightRegionTranslations(ZMapWindow window, FooCanvasItem *item, int region_start, int region_end); -void zmapWindowItemHighlightTranslationRegion(ZMapWindow window, FooCanvasItem *item, +void zmapWindowItemHighlightTranslationRegion(ZMapWindow window, FooCanvasItem *item, ZMapFrame required_frame, int region_start, int region_end) ; FooCanvasItem *zmapWindowItemGetShowTranslationColumn(ZMapWindow window, FooCanvasItem *item) ; @@ -927,7 +927,7 @@ gboolean zmapWindowWorld2SeqCoords(ZMapWindow window, FooCanvasGroup **block_grp_out, int *y1_out, int *y2_out) ; gboolean zmapWindowItem2SeqCoords(FooCanvasItem *item, int *y1, int *y2) ; -void zmapWindowItemGetVisibleCanvas(ZMapWindow window, +void zmapWindowItemGetVisibleCanvas(ZMapWindow window, double *wx1, double *wy1, double *wx2, double *wy2); @@ -956,17 +956,17 @@ void zmapWindowGetScrollRegion(ZMapWindow window, void zmapWindowSetScrollRegion(ZMapWindow window, double *x1_inout, double *y1_inout, double *x2_inout, double *y2_inout); -ZMapGUIClampType zmapWindowClampSpan(ZMapWindow window, - double *top_inout, +ZMapGUIClampType zmapWindowClampSpan(ZMapWindow window, + double *top_inout, double *bot_inout) ; -ZMapGUIClampType zmapWindowClampedAtStartEnd(ZMapWindow window, - double *top_inout, +ZMapGUIClampType zmapWindowClampedAtStartEnd(ZMapWindow window, + double *top_inout, double *bot_inout) ; void zMapWindowMoveItem(ZMapWindow window, ZMapFeature origFeature, ZMapFeature modFeature, FooCanvasItem *item); -void zMapWindowMoveSubFeatures(ZMapWindow window, - ZMapFeature originalFeature, +void zMapWindowMoveSubFeatures(ZMapWindow window, + ZMapFeature originalFeature, ZMapFeature modifiedFeature, GArray *origArray, GArray *modArray, gboolean isExon); @@ -1004,7 +1004,7 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group, void zmapWindowGetPosFromScore(ZMapFeatureTypeStyle style, double score, double *curr_x1_inout, double *curr_x2_out) ; void zmapWindowFreeWindowArray(GPtrArray **window_array_inout, gboolean free_array) ; -ZMapWindowFeatureShow zmapWindowFeatureShowCreate(ZMapWindow zmapWindow, FooCanvasItem *item) ; +ZMapWindowFeatureShow zmapWindowFeatureShowCreate(ZMapWindow zmapWindow, FooCanvasItem *item) ; ZMapWindowFeatureShow zmapWindowFeatureShow(ZMapWindow zmapWindow, FooCanvasItem *item) ; GtkTreeModel *zmapWindowFeatureListCreateStore(ZMapWindowListType list_type) ; @@ -1066,8 +1066,8 @@ ZMapGUIMenuItem zmapWindowMakeMenuMarkDumpOps(int *start_index_inout, ZMapGUIMenuItemCallbackFunc callback_func, gpointer callback_data) ; -gboolean zmapWindowUpdateXRemoteData(ZMapWindow window, - ZMapFeatureAny feature_any, +gboolean zmapWindowUpdateXRemoteData(ZMapWindow window, + ZMapFeatureAny feature_any, char *action, FooCanvasItem *real_item); gboolean zmapWindowUpdateXRemoteDataFull(ZMapWindow window, ZMapFeatureAny feature_any, @@ -1084,7 +1084,7 @@ void zmapWindowZoomControlHandleResize(ZMapWindow window); double zmapWindowZoomControlLimitSpan(ZMapWindow window, double y1, double y2) ; void zmapWindowZoomControlCopyTo(ZMapWindowZoomControl orig, ZMapWindowZoomControl new) ; void zmapWindowZoomControlGetScrollRegion(ZMapWindow window, - double *x1_out, double *y1_out, + double *x1_out, double *y1_out, double *x2_out, double *y2_out); @@ -1103,7 +1103,7 @@ char *zmapWindowFeatureDescription(ZMapFeature feature) ; void zmapWindowFeatureHighlightDNA(ZMapWindow window, ZMapFeature Feature, FooCanvasItem *item); char *zmapWindowFeatureTranscriptFASTA(ZMapFeature feature, gboolean spliced, gboolean cds_only); -/* +/* void zmapWindowzoomControlClampSpan(ZMapWindow window, double *top_inout, double *bot_inout) ; */ void zmapWindowDebugWindowCopy(ZMapWindow window); @@ -1115,7 +1115,7 @@ void zmapWindowDrawScaleBar(ZMapWindow window, double start, double end) ; /*!-------------------------------------------------------------------! *| Checks to see if the item really is visible. In order to do this | - *| all the item's parent groups need to be examined. | + *| all the item's parent groups need to be examined. | *!-------------------------------------------------------------------!*/ gboolean zmapWindowItemIsVisible(FooCanvasItem *item) ; /*!-------------------------------------------------------------------! @@ -1190,7 +1190,7 @@ void zmapWindowMarkItem(ZMapWindow window, FooCanvasItem *item, gboolean mark) ; #ifdef RDS_BREAKING_STUFF ZMapWindowItemHighlighter zmapWindowItemTextHighlightCreateData(FooCanvasGroup *group); ZMapWindowItemHighlighter zmapWindowItemTextHighlightRetrieve(FooCanvasGroup *group); -gboolean zmapWindowItemTextHighlightGetIndices(ZMapWindowItemHighlighter select_control, +gboolean zmapWindowItemTextHighlightGetIndices(ZMapWindowItemHighlighter select_control, int *firstIdx, int *lastIdx); void zmapWindowItemTextHighlightFinish(ZMapWindowItemHighlighter select_control); gboolean zmapWindowItemTextHighlightValidForMotion(ZMapWindowItemHighlighter select_control); @@ -1200,7 +1200,7 @@ gboolean zmapWindowItemTextHighlightBegin(ZMapWindowItemHighlighter select_contr FooCanvasGroup *group_under_control, FooCanvasItem *item_receiving_event); void zmapWindowItemTextHighlightUpdateCoords(ZMapWindowItemHighlighter select_control, - double event_x_coord, + double event_x_coord, double event_y_coord); void zmapWindowItemTextHighlightRegion(ZMapWindowItemHighlighter select_control, FooCanvasItem *feature_parent, @@ -1210,33 +1210,33 @@ void zmapWindowItemTextHighlightSetFullText(ZMapWindowItemHighlighter select_con char *zmapWindowItemTextHighlightGetFullText(ZMapWindowItemHighlighter select_control); void zmapWindowItemTextHighlightReset(ZMapWindowItemHighlighter select_control); #endif -gboolean zmapWindowCreateSetColumns(ZMapWindow window, - ZMapWindowContainerFeatures forward_strand_group, +gboolean zmapWindowCreateSetColumns(ZMapWindow window, + ZMapWindowContainerFeatures forward_strand_group, ZMapWindowContainerFeatures reverse_strand_group, - ZMapFeatureBlock block, + ZMapFeatureBlock block, ZMapFeatureSet feature_set, - GData *styles, + GHashTable *styles, ZMapFrame frame, - FooCanvasGroup **forward_col_out, + FooCanvasGroup **forward_col_out, FooCanvasGroup **reverse_col_out, FooCanvasGroup **separator_col_out); void zmapWindowDrawFeatureSet(ZMapWindow window, - GData *styles, + GHashTable *styles, ZMapFeatureSet feature_set, - FooCanvasGroup *forward_col, + FooCanvasGroup *forward_col, FooCanvasGroup *reverse_col, ZMapFrame frame) ; void zmapWindowRemoveEmptyColumns(ZMapWindow window, FooCanvasGroup *forward_group, FooCanvasGroup *reverse_group) ; gboolean zmapWindowRemoveIfEmptyCol(FooCanvasGroup **col_group) ; -void zmapWindowDrawSeparatorFeatures(ZMapWindow window, +void zmapWindowDrawSeparatorFeatures(ZMapWindow window, ZMapFeatureBlock block, ZMapFeatureSet feature_set, ZMapFeatureTypeStyle style); -gboolean zmapWindowUpdateStyles(ZMapWindow window, GData **read_only_styles, GData **display_styles) ; -gboolean zmapWindowGetMarkedSequenceRangeFwd(ZMapWindow window, +gboolean zmapWindowUpdateStyles(ZMapWindow window, GHashTable *read_only_styles, GHashTable *display_styles) ; +gboolean zmapWindowGetMarkedSequenceRangeFwd(ZMapWindow window, ZMapFeatureBlock block, int *start, int *end); @@ -1246,7 +1246,7 @@ ZMapFeatureTypeStyle zmapWindowStyleTableFind(GHashTable *style_table, GQuark st void zmapWindowStyleTableForEach(GHashTable *style_table, ZMapWindowStyleTableCallback app_func, gpointer app_data) ; void zmapWindowStyleTableDestroy(GHashTable *style_table) ; -GList *zmapWindowFeatureSetStyles(ZMapWindow window, GData *all_styles, GQuark feature_set_id); +GList *zmapWindowFeatureSetStyles(ZMapWindow window, GHashTable *all_styles, GQuark feature_set_id); /* Ruler Functions */ ZMapWindowRulerCanvas zmapWindowRulerCanvasCreate(ZMapWindowRulerCanvasCallbackList callbacks); @@ -1261,7 +1261,7 @@ void zmapWindowRulerCanvasSetVAdjustment(ZMapWindowRulerCanvas obj, GtkAdjustmen void zmapWindowRulerCanvasSetPixelsPerUnit(ZMapWindowRulerCanvas obj, double x, double y); void zmapWindowRulerCanvasSetLineHeight(ZMapWindowRulerCanvas obj, double border); -void zmapWindowRulerGroupDraw(FooCanvasGroup *parent, double project_at, +void zmapWindowRulerGroupDraw(FooCanvasGroup *parent, double project_at, double origin, double start, double end); /* Stats functions. */ -- GitLab