Commit 13109a4f authored by Claes Sjofors's avatar Claes Sjofors

Ge action input focus, invisible objects skipped for next tab and arrow right (refs #79)

parent 9300f10a
......@@ -12052,6 +12052,8 @@ int GeInputFocus::action( grow_tObject object, glow_tEvent event)
int sts;
grow_tObject next;
int found;
GeDyn *next_dyn;
GeInputFocus *next_inputfocus;
switch ( event->event) {
case glow_eEvent_MB1Click:
......@@ -12065,25 +12067,49 @@ int GeInputFocus::action( grow_tObject object, glow_tEvent event)
case glow_eEvent_Key_Right:
if ( event->object.object_type != glow_eObjectType_NoObject) {
found = 0;
if ( strcmp( next_horizontal, "") != 0) {
sts = grow_FindObjectByName( dyn->graph->grow->ctx, next_horizontal, &next);
if ( ODD(sts)) {
next_inputfocus = this;
while ( !found) {
if ( strcmp( next_inputfocus->next_horizontal, "") != 0) {
sts = grow_FindObjectByName( dyn->graph->grow->ctx, next_inputfocus->next_horizontal,
&next);
if ( EVEN(sts))
break;
// Check that this object can handle input focus
GeDyn *next_dyn;
grow_GetUserData( next, (void **)&next_dyn);
if ( next_dyn->total_action_type & ge_mActionType_InputFocus)
found = 1;
if ( next_dyn->total_action_type & ge_mActionType_InputFocus) {
for ( GeDynElem *elem = next_dyn->elements; elem; elem = elem->next) {
if ( elem->action_type == ge_mActionType_InputFocus) {
next_inputfocus = (GeInputFocus *)elem;
found = 1;
break;
}
}
if ( found && grow_GetObjectVisibility( next) != glow_eVis_Visible)
found = 0;
}
}
}
else if ( strcmp( next_tab, "") != 0) {
sts = grow_FindObjectByName( dyn->graph->grow->ctx, next_tab, &next);
if ( ODD(sts)) {
else if ( strcmp( next_inputfocus->next_tab, "") != 0) {
sts = grow_FindObjectByName( dyn->graph->grow->ctx, next_inputfocus->next_tab, &next);
if ( EVEN(sts))
break;
// Check that this object can handle input focus
GeDyn *next_dyn;
grow_GetUserData( next, (void **)&next_dyn);
if ( next_dyn->total_action_type & ge_mActionType_InputFocus)
found = 1;
if ( next_dyn->total_action_type & ge_mActionType_InputFocus) {
for ( GeDynElem *elem = next_dyn->elements; elem; elem = elem->next) {
if ( elem->action_type == ge_mActionType_InputFocus) {
next_inputfocus = (GeInputFocus *)elem;
found = 1;
break;
}
}
if ( found && grow_GetObjectVisibility( next) != glow_eVis_Visible)
found = 0;
}
}
if ( next_inputfocus == this)
break;
}
if ( found)
......@@ -12244,32 +12270,33 @@ int GeInputFocus::action( grow_tObject object, glow_tEvent event)
case glow_eEvent_Key_Tab:
if ( event->object.object_type != glow_eObjectType_NoObject) {
found = 0;
if ( strcmp( next_tab, "") != 0) {
sts = grow_FindObjectByName( dyn->graph->grow->ctx, next_tab, &next);
if ( ODD(sts)) {
next_inputfocus = this;
while ( !found) {
if ( strcmp( next_inputfocus->next_tab, "") != 0) {
sts = grow_FindObjectByName( dyn->graph->grow->ctx, next_inputfocus->next_tab, &next);
if ( EVEN(sts))
break;
// Check that this object can handle input focus
GeDyn *next_dyn;
grow_GetUserData( next, (void **)&next_dyn);
if ( next_dyn->total_action_type & ge_mActionType_InputFocus)
found = 1;
if ( next_dyn->total_action_type & ge_mActionType_InputFocus) {
for ( GeDynElem *elem = next_dyn->elements; elem; elem = elem->next) {
if ( elem->action_type == ge_mActionType_InputFocus) {
next_inputfocus = (GeInputFocus *)elem;
found = 1;
break;
}
}
if ( found && grow_GetObjectVisibility( next) != glow_eVis_Visible)
found = 0;
}
}
if ( next_inputfocus == this)
break;
}
if ( found) {
grow_SetObjectInputFocus( next, 1, event->event);
// Mark this object as previous tab
if ( grow_GetObjectType( next) == glow_eObjectType_GrowNode ||
grow_GetObjectType( next) == glow_eObjectType_GrowSlider ||
grow_GetObjectType( next) == glow_eObjectType_GrowGroup) {
GeDyn *next_dyn;
grow_GetUserData( next, (void **)&next_dyn);
for ( GeDynElem *elem = next_dyn->elements; elem; elem = elem->next) {
if ( elem->action_type == ge_mActionType_InputFocus) {
((GeInputFocus *)elem)->prev_tab = object;
break;
}
}
}
next_inputfocus->prev_tab = object;
}
else
grow_SetObjectInputFocus( object, 0, event->event);
......
......@@ -182,6 +182,7 @@ class GlowArrayElem {
virtual void set_original_color_shift( int shift) {};
virtual void reset_color_shift() {};
virtual void set_visibility( glow_eVis visibiliby) {};
virtual glow_eVis get_visibility() { return glow_eVis_Visible;}
virtual void set_transform( GlowTransform *t) {};
virtual void set_transform_from_stored( GlowTransform *t) {};
virtual void store_transform() {};
......
......@@ -4101,6 +4101,11 @@ void grow_SetObjectVisibility( grow_tObject object, glow_eVis visibility)
((GlowArrayElem *)object)->set_visibility( visibility);
}
glow_eVis grow_GetObjectVisibility( grow_tObject object)
{
return ((GlowArrayElem *)object)->get_visibility();
}
void grow_RotateSelectedObjects( grow_tCtx ctx, double angle,
glow_eRotationPoint type)
{
......
......@@ -1743,6 +1743,9 @@ extern "C" {
*/
void grow_SetObjectVisibility( grow_tObject object, glow_eVis visibility);
//! Get object visibility.
glow_eVis grow_GetObjectVisibility( grow_tObject object);
//! Rotate selected objects.
/*!
\param ctx Grow context.
......
......@@ -2087,6 +2087,15 @@ int GrowNode::get_annotation_text_size( int num, double *tsize)
return nc->get_annotation_text_size( &trf, num, tsize);
}
glow_eVis GrowNode::get_visibility()
{
if ( invisible)
return glow_eVis_Invisible;
if ( dimmed)
return glow_eVis_Dimmed;
return glow_eVis_Visible;
}
void GrowNode::set_visibility( glow_eVis visibility)
{
switch( visibility) {
......
......@@ -532,6 +532,9 @@ class GrowNode : public GlowNode {
*/
void set_visibility( glow_eVis visibility);
//! Get object visibility.
glow_eVis get_visibility();
//! Set position relative last stored transform.
/*!
\param x x coordinate.
......
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