Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
f89e43fb
Commit
f89e43fb
authored
16 years ago
by
edgrif
Browse files
Options
Downloads
Patches
Plain Diff
add colour handling to isSet function for style properties.
parent
884802b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/ZMap/zmapStyle.h
+3
-3
3 additions, 3 deletions
src/include/ZMap/zmapStyle.h
src/zmapFeature/zmapStyle.c
+106
-40
106 additions, 40 deletions
src/zmapFeature/zmapStyle.c
with
109 additions
and
43 deletions
src/include/ZMap/zmapStyle.h
+
3
−
3
View file @
f89e43fb
...
...
@@ -26,9 +26,9 @@
* Description: Style and Style set handling functions.
*
* HISTORY:
* Last edited: Nov 13 1
0
:0
5
2008 (edgrif)
* Last edited: Nov 13 1
7
:0
0
2008 (edgrif)
* Created: Mon Feb 26 09:28:26 2007 (edgrif)
* CVS info: $Id: zmapStyle.h,v 1.2
6
2008-11-13 1
0:07:01
edgrif Exp $
* CVS info: $Id: zmapStyle.h,v 1.2
7
2008-11-13 1
7:13:43
edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_STYLE_H
...
...
@@ -301,7 +301,7 @@ ZMapFeatureTypeStyle zMapFeatureStyleCopy(ZMapFeatureTypeStyle src);
gboolean
zMapStyleCCopy
(
ZMapFeatureTypeStyle
src
,
ZMapFeatureTypeStyle
*
dest_out
);
void
zMapStyleDestroy
(
ZMapFeatureTypeStyle
style
);
gboolean
zMapStyleIsPropertySet
(
ZMapFeatureTypeStyle
style
,
char
*
property_name
)
;
gboolean
zMapStyleIsPropertySet
(
ZMapFeatureTypeStyle
style
,
char
*
property_name
,
char
*
property_subpart
)
;
gboolean
zMapStyleNameCompare
(
ZMapFeatureTypeStyle
style
,
char
*
name
)
;
gboolean
zMapStyleIsTrueFeature
(
ZMapFeatureTypeStyle
style
)
;
...
...
This diff is collapsed.
Click to expand it.
src/zmapFeature/zmapStyle.c
+
106
−
40
View file @
f89e43fb
...
...
@@ -28,9 +28,9 @@
*
* Exported functions: See ZMap/zmapStyle.h
* HISTORY:
* Last edited: Nov 13 1
0:57
2008 (edgrif)
* Last edited: Nov 13 1
7:10
2008 (edgrif)
* Created: Mon Feb 26 09:12:18 2007 (edgrif)
* CVS info: $Id: zmapStyle.c,v 1.
19
2008-11-13 1
1:32:57
edgrif Exp $
* CVS info: $Id: zmapStyle.c,v 1.
20
2008-11-13 1
7:13:43
edgrif Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -146,6 +146,7 @@ static ZMapFeatureTypeStyle styleCreate(guint n_parameters, GParameter *paramete
static
gboolean
setColours
(
ZMapStyleColour
colour
,
char
*
border
,
char
*
draw
,
char
*
fill
)
;
static
void
parseColours
(
ZMapFeatureTypeStyle
style
,
ZMapFeatureTypeStyle
copy_style
,
guint
param_id
,
GValue
*
value
)
;
static
gboolean
isColourSet
(
ZMapFeatureTypeStyle
style
,
int
param_id
,
char
*
subpart
)
;
static
gboolean
validSplit
(
char
**
strings
,
ZMapStyleColourType
*
type_out
,
ZMapStyleDrawContext
*
context_out
,
char
**
colour_out
)
;
static
void
formatColours
(
GString
*
colour_string
,
char
*
type
,
ZMapStyleColour
colour
)
;
...
...
@@ -277,8 +278,19 @@ gboolean zMapStyleCCopy(ZMapFeatureTypeStyle src, ZMapFeatureTypeStyle *dest_out
/* I see no easy way to do this with the "get" methodology of g_object_get(). Nor
* do I see a good way to make use of g_object stuff to help.... */
gboolean
zMapStyleIsPropertySet
(
ZMapFeatureTypeStyle
style
,
char
*
property_name
)
* do I see a good way to make use of g_object stuff to help....
*
* NOTE that property_name for all properties colours is simply the property
* name, e.g. "min_mag".
*
* Colours have subparts however so the subpart must be specified in the form:
*
* "<type> <context>", e.g. "normal draw"
*
* and then the function returns TRUE/FALSE to show if that particular colour is set.
*
* */
gboolean
zMapStyleIsPropertySet
(
ZMapFeatureTypeStyle
style
,
char
*
property_name
,
char
*
property_subpart
)
{
gboolean
is_set
=
FALSE
;
GParamSpec
*
pspec
;
...
...
@@ -311,40 +323,10 @@ gboolean zMapStyleIsPropertySet(ZMapFeatureTypeStyle style, char *property_name)
case
STYLE_PROP_FRAME2_COLOURS
:
case
STYLE_PROP_REV_COLOURS
:
{
is_set
=
isColourSet
(
style
,
pspec
->
param_id
,
property_subpart
)
;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
ZMapStyleFullColour
this_colour
=
NULL
;
switch
(
param_id
)
{
case
STYLE_PROP_COLOURS
:
this_colour
=
&
(
style
->
colours
)
;
break
;
case
STYLE_PROP_FRAME0_COLOURS
:
this_colour
=
&
(
style
->
frame0_colours
)
;
break
;
case
STYLE_PROP_FRAME1_COLOURS
:
this_colour
=
&
(
style
->
frame1_colours
)
;
break
;
case
STYLE_PROP_FRAME2_COLOURS
:
this_colour
=
&
(
style
->
frame2_colours
)
;
break
;
case
STYLE_PROP_REV_COLOURS
:
this_colour
=
&
(
style
->
strand_rev_colours
)
;
break
;
default:
break
;
}
formatColours
(
colour_string
,
"normal"
,
&
(
this_colour
->
normal
))
;
formatColours
(
colour_string
,
"selected"
,
&
(
this_colour
->
selected
))
;
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
/* Needs code writing..... */
break
;
}
case
STYLE_PROP_PARENT_STYLE
:
{
if
(
style
->
fields_set
.
parent_id
)
...
...
@@ -548,18 +530,16 @@ gboolean zMapStyleIsPropertySet(ZMapFeatureTypeStyle style, char *property_name)
case
STYLE_PROP_ALIGNMENT_COLINEAR_COLOURS
:
case
STYLE_PROP_ALIGNMENT_NONCOLINEAR_COLOURS
:
{
/* needs code writing.... */
is_set
=
isColourSet
(
style
,
pspec
->
param_id
,
property_subpart
)
;
break
;
}
case
STYLE_PROP_TRANSCRIPT_CDS_COLOURS
:
{
/* Needs code writing... */
is_set
=
isColourSet
(
style
,
pspec
->
param_id
,
property_subpart
)
;
break
;
}
default:
{
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
style
,
pspec
->
param_id
,
pspec
);
...
...
@@ -1003,7 +983,7 @@ gboolean zMapStyleHasMode(ZMapFeatureTypeStyle style)
{
gboolean
result
;
result
=
zMapStyleIsPropertySet
(
style
,
ZMAPSTYLE_PROPERTY_MODE
)
;
result
=
zMapStyleIsPropertySet
(
style
,
ZMAPSTYLE_PROPERTY_MODE
,
NULL
)
;
return
result
;
}
...
...
@@ -3155,6 +3135,92 @@ static void parseColours(ZMapFeatureTypeStyle style, ZMapFeatureTypeStyle copy_s
static
gboolean
isColourSet
(
ZMapFeatureTypeStyle
style
,
int
param_id
,
char
*
subpart
)
{
gboolean
is_set
=
FALSE
;
char
*
full_colour
;
char
**
col_spec
=
NULL
;
ZMapStyleColourType
type
=
ZMAPSTYLE_COLOURTYPE_INVALID
;
ZMapStyleDrawContext
context
=
ZMAPSTYLE_DRAW_INVALID
;
char
*
dummy_colour
=
NULL
;
full_colour
=
g_strdup_printf
(
"%s dummy_colour"
,
subpart
)
;
if
((
full_colour
=
g_strstrip
(
full_colour
))
&&
(
col_spec
=
g_strsplit_set
(
full_colour
,
"
\t
"
,
3
))
&&
validSplit
(
col_spec
,
&
type
,
&
context
,
&
dummy_colour
))
{
ZMapStyleFullColour
this_colour
=
NULL
;
ZMapStyleColour
type_colour
=
NULL
;
switch
(
param_id
)
{
case
STYLE_PROP_COLOURS
:
this_colour
=
&
(
style
->
colours
)
;
break
;
case
STYLE_PROP_FRAME0_COLOURS
:
this_colour
=
&
(
style
->
frame0_colours
)
;
break
;
case
STYLE_PROP_FRAME1_COLOURS
:
this_colour
=
&
(
style
->
frame1_colours
)
;
break
;
case
STYLE_PROP_FRAME2_COLOURS
:
this_colour
=
&
(
style
->
frame2_colours
)
;
break
;
case
STYLE_PROP_REV_COLOURS
:
this_colour
=
&
(
style
->
strand_rev_colours
)
;
break
;
case
STYLE_PROP_ALIGNMENT_PERFECT_COLOURS
:
this_colour
=
&
(
style
->
mode_data
.
alignment
.
perfect
)
;
break
;
case
STYLE_PROP_ALIGNMENT_COLINEAR_COLOURS
:
this_colour
=
&
(
style
->
mode_data
.
alignment
.
colinear
)
;
break
;
case
STYLE_PROP_ALIGNMENT_NONCOLINEAR_COLOURS
:
this_colour
=
&
(
style
->
mode_data
.
alignment
.
noncolinear
)
;
break
;
case
STYLE_PROP_TRANSCRIPT_CDS_COLOURS
:
this_colour
=
&
(
style
->
mode_data
.
transcript
.
CDS_colours
)
;
break
;
default:
zMapAssertNotReached
()
;
break
;
}
switch
(
type
)
{
case
ZMAPSTYLE_COLOURTYPE_NORMAL
:
type_colour
=
&
(
this_colour
->
normal
)
;
break
;
case
ZMAPSTYLE_COLOURTYPE_SELECTED
:
type_colour
=
&
(
this_colour
->
selected
)
;
break
;
default:
zMapAssertNotReached
()
;
break
;
}
switch
(
context
)
{
case
ZMAPSTYLE_DRAW_FILL
:
is_set
=
type_colour
->
fields_set
.
fill
;
break
;
case
ZMAPSTYLE_DRAW_DRAW
:
is_set
=
type_colour
->
fields_set
.
draw
;
break
;
case
ZMAPSTYLE_DRAW_BORDER
:
is_set
=
type_colour
->
fields_set
.
border
;
break
;
default:
zMapAssertNotReached
()
;
break
;
}
}
return
is_set
;
}
/* strings should be a NULL terminated array of three string pointers, the
* contents of the three strings must be:
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment