Commit e1fed599 authored by claes's avatar claes

Visibility dimmed added

parent 996ac6f8
......@@ -187,6 +187,13 @@ typedef enum {
glow_eDir_Horizontal //!< Horizontal direction
} glow_eDir;
//! Visibility enum
typedef enum {
glow_eVis_Visible, //!< Object is visible
glow_eVis_Invisible, //!< Object is invisible
glow_eVis_Dimmed //!< Object is dimmed insensible
} glow_eVis;
//! Different kind of alignment functions
typedef enum {
glow_eAlignDirection_CenterCenter,
......
......@@ -140,7 +140,7 @@ class GlowArrayElem {
virtual void incr_color_shift( int shift) {};
virtual void set_original_color_shift( int shift) {};
virtual void reset_color_shift() {};
virtual void set_visibility( int visible) {};
virtual void set_visibility( glow_eVis visibiliby) {};
virtual void set_transform( GlowTransform *t) {};
virtual void set_transform_from_stored( GlowTransform *t) {};
virtual void store_transform() {};
......
......@@ -287,8 +287,20 @@ glow_eDrawType GlowColor::get_drawtype( glow_eDrawType local_drawtype,
}
}
if ( node && ((GrowNode *)node)->color_inverse) {
if ( drawtype >= 10)
drawtype = (glow_eDrawType)(drawtype + 10 - 2 * (drawtype % 10) - 1);
if ( drawtype >= 30)
drawtype = (glow_eDrawType)(drawtype + 10 - 2 * (drawtype % 10) - 1);
}
if ( node && ((GrowNode *)node)->dimmed) {
if ( drawtype == 0)
drawtype = (glow_eDrawType) 25;
else if ( 26 <= drawtype && drawtype <= 29)
drawtype = (glow_eDrawType) ( drawtype - 4);
else if ( 36 <= drawtype && drawtype <= 39)
drawtype = (glow_eDrawType) ( drawtype - 4);
else if ( 46 <= drawtype && drawtype <= 49)
drawtype = (glow_eDrawType) ( drawtype - 4);
else if ( 56 <= drawtype && drawtype <= 59)
drawtype = (glow_eDrawType) ( drawtype - 4);
}
}
if ( drawtype < 0 || drawtype >= 300) {
......
......@@ -3394,9 +3394,9 @@ void grow_SetObjectColorInverse( grow_tObject object, int inverse)
((GrowNode *)object)->set_color_inverse( inverse);
}
void grow_SetObjectVisibility( grow_tObject object, int visible)
void grow_SetObjectVisibility( grow_tObject object, glow_eVis visibility)
{
((GlowArrayElem *)object)->set_visibility( visible);
((GlowArrayElem *)object)->set_visibility( visibility);
}
void grow_RotateSelectedObjects( grow_tCtx ctx, double angel,
......
......@@ -1621,7 +1621,7 @@ typedef GlowTraceData glow_sTraceData;
\param object Object.
\param visible 1 object is visible, 0 object is invisible.
*/
void grow_SetObjectVisibility( grow_tObject object, int visible);
void grow_SetObjectVisibility( grow_tObject object, glow_eVis visibility);
//! Rotate selected objects.
/*!
......
......@@ -24,7 +24,7 @@ GrowNode::GrowNode( GlowCtx *glow_ctx, char *name, GlowNodeClass *node_class,
original_color_lightness(0),
color_lightness(0), original_color_intensity(0), color_intensity(0),
original_color_shift(0), color_shift(0), color_inverse(0), line_width(0),
invisible(0), object_type(glow_eObjectType_GrowNode), root_node(0),
invisible(0), dimmed(0), object_type(glow_eObjectType_GrowNode), root_node(0),
flip_horizontal(false), flip_vertical(false), fill_level(1),
level_direction( glow_eDirection_Right), shadow(0), input_position(0), input_selected(0)
{
......@@ -415,7 +415,7 @@ int GrowNode::event_handler( glow_eEvent event, double fx, double fy)
double x, y;
int sts;
if ( invisible)
if ( invisible || dimmed)
return 0;
trf.reverse( fx, fy, &x, &y);
......@@ -438,7 +438,7 @@ int GrowNode::event_handler( glow_eEvent event, int x, int y, double fx,
double rx, ry;
if ( invisible)
if ( invisible || dimmed)
return 0;
switch ( event) {
......@@ -2118,4 +2118,28 @@ int GrowNode::get_annotation_info( int num, int *t_size, glow_eDrawType *t_drawt
return sts;
}
void GrowNode::set_visibility( glow_eVis visibility)
{
switch( visibility) {
case glow_eVis_Visible:
if ( invisible == 0 && dimmed == 0)
return;
invisible = 0;
dimmed = 0;
break;
case glow_eVis_Invisible:
if ( invisible)
return;
invisible = 1;
erase();
break;
case glow_eVis_Dimmed:
if ( dimmed && !invisible)
return;
dimmed = 1;
invisible = 0;
break;
}
draw();
}
......@@ -175,6 +175,7 @@ class GrowNode : public GlowNode {
int color_inverse; //!< Color inverse.
int line_width; //!< Line width.
int invisible; //!< Object is invisible.
int dimmed; //!< Object is dimmed.
GlowTransform trf; //!< Transformation matrix of object.
char *argv[20]; //!< Arguments in dynamic code.
int argsize[20]; //!< Size of arguments is dynamic code.
......@@ -494,11 +495,7 @@ class GrowNode : public GlowNode {
/*!
\param visible The visibility of the object.
*/
void set_visibility( int visible)
{ if ( invisible == !visible) return;
invisible = !visible;
if ( !visible) erase();
draw();};
void set_visibility( glow_eVis visibility);
//! Set position relative last stored transform.
/*!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment