Commit 8c120210 authored by claes's avatar claes

Insensitive slider

parent f24e17ee
......@@ -631,6 +631,15 @@ int *GeDyn::ref_slider_disabled()
return 0;
}
int GeDyn::get_slider_disabled()
{
for ( GeDynElem *elem = elements; elem; elem = elem->next) {
if ( elem->action_type == ge_mActionType_Slider)
return ((GeSlider *)elem)->slider_disabled;
}
return 0;
}
int *GeDyn::ref_trend_hold()
{
for ( GeDynElem *elem = elements; elem; elem = elem->next) {
......@@ -4635,6 +4644,8 @@ int GeAnalogShift::connect( grow_tObject object, glow_sTraceData *trace_data)
switch ( type) {
case pwr_eType_Float32:
case pwr_eType_Int32:
case pwr_eType_UInt32:
case pwr_eType_Enum:
break;
default:
return 1;
......@@ -9274,6 +9285,11 @@ void GeSlider::get_attributes( attr_sItem *attrinfo, int *item_count)
attrinfo[i].type = glow_eType_String;
attrinfo[i++].size = sizeof( maxvalue_attr);
strcpy( attrinfo[i].name, "Slider.InsensitiveAttr");
attrinfo[i].value = insensitive_attr;
attrinfo[i].type = glow_eType_String;
attrinfo[i++].size = sizeof( insensitive_attr);
dyn->display_access = true;
*item_count = i;
}
......@@ -9301,6 +9317,7 @@ void GeSlider::save( ofstream& fp)
fp << int(ge_eSave_Slider_attribute) << FSPACE << attribute << endl;
fp << int(ge_eSave_Slider_minvalue_attr) << FSPACE << minvalue_attr << endl;
fp << int(ge_eSave_Slider_maxvalue_attr) << FSPACE << maxvalue_attr << endl;
fp << int(ge_eSave_Slider_insensitive_attr) << FSPACE << insensitive_attr << endl;
fp << int(ge_eSave_End) << endl;
}
......@@ -9327,6 +9344,10 @@ void GeSlider::open( ifstream& fp)
fp.get();
fp.getline( maxvalue_attr, sizeof(maxvalue_attr));
break;
case ge_eSave_Slider_insensitive_attr:
fp.get();
fp.getline( insensitive_attr, sizeof(insensitive_attr));
break;
case ge_eSave_End: end_found = 1; break;
default:
cout << "GeSlider:open syntax error" << endl;
......@@ -9434,6 +9455,15 @@ int GeSlider::connect( grow_tObject object, glow_sTraceData *trace_data)
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&max_value_p,
&max_value_subid, a_size);
}
insensitive_p = 0;
dyn->parse_attr_name( insensitive_attr, parsed_name,
&inverted, &a_type, &a_size);
if ( strcmp(parsed_name, "") != 0 &&
a_type == pwr_eType_Boolean) {
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&insensitive_p,
&insensitive_subid, a_size);
}
return 1;
}
......@@ -9451,6 +9481,10 @@ int GeSlider::disconnect( grow_tObject object)
gdh_UnrefObjectInfo( max_value_subid);
max_value_p = 0;
}
if ( insensitive_p) {
gdh_UnrefObjectInfo( insensitive_subid);
insensitive_p = 0;
}
return 1;
}
......@@ -9459,6 +9493,9 @@ int GeSlider::scan( grow_tObject object)
double max_value, min_value, max_pos, min_pos;
glow_eDirection direction;
if ( insensitive_p)
slider_disabled = *insensitive_p;
if ( max_value_p && min_value_p &&
( *max_value_p != old_max_value ||
*min_value_p != old_min_value)) {
......@@ -9555,6 +9592,9 @@ int GeSlider::scan( grow_tObject object)
int GeSlider::action( grow_tObject object, glow_tEvent event)
{
if ( insensitive_p && *insensitive_p)
return 1;
switch ( event->event) {
case glow_eEvent_MB1Down:
grow_SetClickSensitivity( dyn->graph->grow->ctx, glow_mSensitivity_MB1Press);
......
......@@ -407,6 +407,7 @@ extern "C" {
ge_eSave_Slider_attribute = 6000,
ge_eSave_Slider_minvalue_attr = 6001,
ge_eSave_Slider_maxvalue_attr = 6002,
ge_eSave_Slider_insensitive_attr = 6003,
ge_eSave_AnalogColor_attribute = 6100,
ge_eSave_AnalogColor_limit = 6101,
ge_eSave_AnalogColor_limit_type = 6102,
......@@ -656,6 +657,7 @@ class GeDyn {
void get_hostobject( char *hostobject);
void set_value_input( char *format, double min_value, double max_value);
int *ref_slider_disabled();
int get_slider_disabled();
int *ref_trend_hold();
double *ref_trend_scantime();
void *get_p();
......@@ -1861,6 +1863,7 @@ class GeSlider : public GeDynElem {
char attribute[120];
char minvalue_attr[120];
char maxvalue_attr[120];
char insensitive_attr[120];
int slider_disabled;
pwr_tFloat32 *p;
......@@ -1877,16 +1880,19 @@ class GeSlider : public GeDynElem {
pwr_tFloat32 old_max_value;
pwr_tSubid min_value_subid;
pwr_tSubid max_value_subid;
pwr_tBoolean *insensitive_p;
pwr_tSubid insensitive_subid;
GeSlider( GeDyn *e_dyn) :
GeDynElem(e_dyn, (ge_mDynType)0, ge_mActionType_Slider, ge_eDynPrio_Slider),
min_value_p(0), max_value_p(0), old_min_value(0), old_max_value(0)
{ strcpy( attribute, ""); strcpy( minvalue_attr, ""); strcpy( maxvalue_attr, "");}
min_value_p(0), max_value_p(0), old_min_value(0), old_max_value(0), insensitive_p(0)
{ strcpy( attribute, ""); strcpy( minvalue_attr, ""); strcpy( maxvalue_attr, "");
strcpy( insensitive_attr, "");}
GeSlider( const GeSlider& x) :
GeDynElem(x.dyn,x.dyn_type,x.action_type,x.prio),
min_value_p(0), max_value_p(0), old_min_value(0), old_max_value(0)
min_value_p(0), max_value_p(0), old_min_value(0), old_max_value(0), insensitive_p(0)
{ strcpy( attribute, x.attribute); strcpy( minvalue_attr, x.minvalue_attr);
strcpy( maxvalue_attr, x.maxvalue_attr);}
strcpy( maxvalue_attr, x.maxvalue_attr); strcpy( insensitive_attr, x.insensitive_attr);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
void open( ifstream& fp);
......
......@@ -3136,6 +3136,10 @@ static int graph_trace_grow_cb( GlowCtx *ctx, glow_tEvent event)
GeDyn *dyn;
grow_GetUserData( event->object.object, (void **)&dyn);
if ( grow_GetObjectType( event->object.object) == glow_eObjectType_GrowSlider) {
if ( dyn->get_slider_disabled())
return 0;
}
if ( graph->is_authorized( dyn->access) &&
dyn->get_actiontype( event->object.object) & ~ge_mActionType_Inherit) {
if ( dyn->get_actiontype( event->object.object) & ~ge_mActionType_PopupMenu)
......
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