Commit 3f40979f authored by Claes Sjofors's avatar Claes Sjofors

Ge Axis dynamics fix

parent 53ef51a9
......@@ -2657,6 +2657,11 @@ Axis
<image> geref_fig12.png
Axis shows the range for a curve or bar in x or y direction.
There are two variants of Axis, one with static min and max
values, and one with dynamic min and max values, where min and
max are connected to signals in the database. For a dynamic
Axis object, the values of Lines, LongQuotient, ValueQuotient and
Format are calculated automatically in runtime.
<h2>Attributes
<b>Attribute <t>Description
......@@ -2669,6 +2674,10 @@ ValueQuotient <t>How often a value is to be written. For example 4 impies that a
<t>written at every fourth line.
Format <t>Format in c syntax of written values.
Dynamic <t>Not implemented.
<b>Dynamic Axis
Axis.MinValueAttr <t>Min value signal.
Axis.MaxValueAttr <t>Max value signal.
</topic>
<topic>geref_windowobject <style>function
......@@ -3525,6 +3534,32 @@ Execute a xtt command by clicking MB1 on the object.
<b>Attribute <t><t>Description
Command.Command <t><t>Xtt command that is executed when the
<t><t>object is activated.
Additions to the xtt command syntax
<b>$object
$object will be replaced by the current object in an object graph
or by the stated hierarchy in an hierarchy graph.
<b>$hostobject
A special syntax for HostObject dynamics where $hostobject will be
replaced by the current host object.
<b>&(attribute-reference)
The string for an attribute reference of type &(attribute-reference)
will be replaced by the content of the attribute reference. Suppose
there is an array, H1-ObjectList.ObjArray, with attriute references
that points to objects, which object graphs is going to be shown.
With the command
<c>> open graph /class /instance=&(H1-ObjectList.ObjArray[0])
the object graph is opened for the object in the first element. It is also
possible to state double steps of attribute references with the syntax
'&&(attribute-reference)'.
</topic>
<topic>GeDynCommandDoubleClick <style>function
......
......@@ -2638,6 +2638,11 @@ Axis
<image> geref_fig12.png
Axis visar skalområdet på kurva eller stapel i x- eller y-led.
Axis finns i två varanter, en med med fasta min och max värden,
och en med dynamiska min och max värden, där min och max kopplas
till signaler i databasen. För ett dynamiskt Axis objekt beräknas
värden på Lines, LongQuotient, ValueQuotient och Format automatiskt
i runtime.
<h2>Attribut
<b>Attribut <t>Beskrivning
......@@ -2648,8 +2653,13 @@ LongQuotient <t>Hur stor del av linjerna som ska vara l
<t>att var 4:e linje är längre
ValueQuotient <t>Hur ofta värden ska skrivas ut. T ex 4 innebär att ett värde
<t>skrivs ut vid var 4:e linje.
Format <t>Format i c-syntax för utskrivna väden.
Format <t>Format i c-syntax för utskrivna värden.
Dynamic <t>Ej implementerat.
<b>Dynamisk Axis
Axis.MinValueAttr <t>Signal för minvärde.
Axis.MaxValueAttr <t>Signal för maxvärde.
</topic>
<topic>geref_windowobject <style>function
......@@ -3486,6 +3496,31 @@ Exekverar ett xtt-kommando vid Klick MB1 p
<b>Attribut <t><t>Beskrivning
Command.Command <t><t>Xtt-kommando som exekveras vid mus-klick
<t><t>på objektet.
Tillägg till xtt-kommando syntaxen
<b>$object
$object kommer att ersättas av det aktuella objektet i en objekts bild,
eller av den aktuella hierarkin i en hierarki-bild.
<b>$hostobject
En speciell syntax for HostObject dynamik där $hostobject kommer att
ersättas av det aktuella host objektet.
<b>&(attribut-referens)
Strängen för attribut-referenser av typen '&(attributnamn)' kommer att ersättas av
innehållet i attributreferensen. Antag att det finns en vektor, H1-ObjectList.ObjArray,
med attributreferenser som pekar på objekt för vilka objektsbilden ska visas.
Med kommandot
> open graph /class /instance=&(H1-ObjectList.ObjArray[0])
öppnas objektgrafen för objektet i första elementet. Man kan även age dubbla led av
attributreferenser med syntaxen &&(attribut-referens).
</topic>
<topic>GeDynCommandDoubleClick <style>function
......
......@@ -376,8 +376,9 @@ void GeDyn::replace_attribute( char *attribute, int attr_size, char *from, char
}
GeDyn::GeDyn( const GeDyn& x) :
elements(0), graph(x.graph), dyn_type1(x.dyn_type1), total_dyn_type1(x.total_dyn_type1),
action_type1(x.action_type1), total_action_type1(x.total_action_type1), access(x.access),
elements(0), graph(x.graph), dyn_type1(x.dyn_type1), dyn_type2(x.dyn_type2), total_dyn_type1(x.total_dyn_type1),
total_dyn_type2(x.total_dyn_type2), action_type1(x.action_type1), action_type2(x.action_type2),
total_action_type1(x.total_action_type1), total_action_type2(x.total_action_type2), access(x.access),
cycle(x.cycle), attr_editor(x.attr_editor)
{
GeDynElem *elem, *e;
......@@ -447,6 +448,11 @@ GeDyn::GeDyn( const GeDyn& x) :
e = new GeAxis((const GeAxis&) *elem); break;
default: ;
}
switch( elem->dyn_type2) {
case ge_mDynType2_Axis:
e = new GeAxis((const GeAxis&) *elem); break;
default: ;
}
switch( elem->action_type1) {
case ge_mActionType1_PopupMenu:
e = new GePopupMenu((const GePopupMenu&) *elem); break;
......@@ -492,6 +498,9 @@ GeDyn::GeDyn( const GeDyn& x) :
e = new GeSetValue((const GeSetValue&) *elem); break;
default: ;
}
switch( elem->action_type2) {
default: ;
}
if ( e)
insert_element( e);
}
......@@ -9295,28 +9304,66 @@ void GeAxis::open( ifstream& fp)
int GeAxis::connect( grow_tObject object, glow_sTraceData *trace_data)
{
int attr_type, attr_size;
pwr_tAName parsed_name;
int attr_size;
int sts;
int inverted;
int attr_type_min, attr_type_max;
int min_found = 0;
int max_found = 0;
imin_value = (int)(min_value + (min_value>= 0?1:-1) * 0.5);
imax_value = (int)(max_value + (max_value>= 0?1:-1) * 0.5);
min_value_p = 0;
imin_value_p = 0;
dyn->parse_attr_name( minvalue_attr, parsed_name,
&inverted, &attr_type, &attr_size);
if ( strcmp(parsed_name, "") != 0 &&
attr_type == pwr_eType_Float32) {
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&min_value_p,
&min_value_subid, attr_size);
&inverted, &attr_type_min, &attr_size);
if ( strcmp(parsed_name, "") != 0) {
switch ( attr_type_min) {
case pwr_eType_Float32:
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&min_value_p,
&min_value_subid, attr_size);
min_found = 1;
break;
case pwr_eType_Int32:
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&imin_value_p,
&min_value_subid, attr_size);
min_found = 1;
break;
default: ;
}
}
max_value_p = 0;
imax_value_p = 0;
dyn->parse_attr_name( maxvalue_attr, parsed_name,
&inverted, &attr_type, &attr_size);
if ( strcmp(parsed_name, "") != 0 &&
attr_type == pwr_eType_Float32) {
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&max_value_p,
&max_value_subid, attr_size);
&inverted, &attr_type_max, &attr_size);
if ( strcmp(parsed_name, "") != 0) {
switch ( attr_type_max) {
case pwr_eType_Float32:
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&max_value_p,
&max_value_subid, attr_size);
max_found = 1;
break;
case pwr_eType_Int32:
sts = dyn->graph->ref_object_info( dyn->cycle, parsed_name, (void **)&imax_value_p,
&max_value_subid, attr_size);
max_found = 1;
break;
default: ;
}
}
if ( min_found && max_found) {
if ( attr_type_min != attr_type_max)
attr_type = 0;
else
attr_type = attr_type_max;
}
else if ( max_found)
attr_type = attr_type_max;
else if ( min_found)
attr_type = attr_type_min;
trace_data->p = &pdummy;
first_scan = true;
......@@ -9326,11 +9373,11 @@ int GeAxis::connect( grow_tObject object, glow_sTraceData *trace_data)
int GeAxis::disconnect( grow_tObject object)
{
if ( min_value_p) {
if ( min_value_p || imin_value_p) {
gdh_UnrefObjectInfo( min_value_subid);
min_value_p = 0;
}
if ( max_value_p) {
if ( max_value_p || imax_value_p) {
gdh_UnrefObjectInfo( max_value_subid);
max_value_p = 0;
}
......@@ -9339,26 +9386,55 @@ int GeAxis::disconnect( grow_tObject object)
int GeAxis::scan( grow_tObject object)
{
if ( !(max_value_p || min_value_p))
return 1;
switch ( attr_type) {
case pwr_eType_Float32: {
if ( !(max_value_p || min_value_p))
return 1;
if ( !(first_scan ||
(max_value_p && ( *max_value_p != max_value)) ||
(min_value_p && ( *min_value_p != min_value)))) {
return 1;
}
if ( first_scan)
first_scan = 0;
if ( !(first_scan ||
(max_value_p && ( *max_value_p != max_value)) ||
(min_value_p && ( *min_value_p != min_value)))) {
return 1;
}
if ( first_scan)
first_scan = 0;
if ( min_value_p)
min_value = *min_value_p;
if ( max_value_p)
max_value = *max_value_p;
if ( min_value_p)
min_value = *min_value_p;
if ( max_value_p)
max_value = *max_value_p;
if ( max_value == min_value)
return 1;
if ( max_value == min_value)
return 1;
grow_SetAxisRange( object, min_value, max_value);
break;
}
case pwr_eType_Int32: {
if ( !(imax_value_p || imin_value_p))
return 1;
if ( !(first_scan ||
(imax_value_p && ( *imax_value_p != imax_value)) ||
(imin_value_p && ( *imin_value_p != imin_value)))) {
return 1;
}
if ( first_scan)
first_scan = 0;
if ( imin_value_p)
imin_value = *imin_value_p;
if ( imax_value_p)
imax_value = *imax_value_p;
if ( imax_value == imin_value)
return 1;
grow_SetAxisRange( object, min_value, max_value);
grow_SetAxisRange( object, (double)imin_value, (double)imax_value);
break;
}
default: ;
}
return 1;
}
......
......@@ -2684,22 +2684,28 @@ class GeAxis : public GeDynElem {
double min_value;
double max_value;
int imin_value;
int imax_value;
pwr_tAName minvalue_attr;
pwr_tAName maxvalue_attr;
pwr_tFloat32 *min_value_p;
pwr_tFloat32 *max_value_p;
pwr_tInt32 *imin_value_p;
pwr_tInt32 *imax_value_p;
pwr_tSubid min_value_subid;
pwr_tSubid max_value_subid;
int attr_type;
GeAxis( GeDyn *e_dyn) :
GeDynElem(e_dyn, ge_mDynType1_No, ge_mDynType2_Axis, ge_mActionType1_No, ge_mActionType2_No, ge_eDynPrio_Axis),
min_value(0), max_value(100), min_value_p(0), max_value_p(0)
min_value(0), max_value(100), imin_value(0), imax_value(0), min_value_p(0), max_value_p(0), imin_value_p(0),
imax_value_p(0), attr_type(0)
{ strcpy( minvalue_attr, ""); strcpy( maxvalue_attr, "");}
GeAxis( const GeAxis& x) :
GeDynElem(x.dyn,x.dyn_type1,x.dyn_type2,x.action_type1,x.action_type2,x.prio),
min_value(x.min_value),max_value(x.max_value),
min_value_p(0), max_value_p(0)
min_value_p(0), max_value_p(0), imin_value_p(0), imax_value_p(0)
{ strcpy( minvalue_attr, x.minvalue_attr); strcpy( maxvalue_attr, x.maxvalue_attr);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
......
......@@ -239,6 +239,9 @@ void GlowArray::copy_from( const GlowArray& array)
GrowAxis *n = new GrowAxis(*(GrowAxis *)array.a[i]);
n->highlight = 0;
n->hot = 0;
if ( n->ctx->userdata_copy_callback)
(n->ctx->userdata_copy_callback)( n,
((GrowAxis *)(array.a[i]))->user_data, &n->user_data, glow_eUserdataCbType_Node);
insert( n);
break;
}
......@@ -247,6 +250,9 @@ void GlowArray::copy_from( const GlowArray& array)
GrowAxisArc *n = new GrowAxisArc(*(GrowAxisArc *)array.a[i]);
n->highlight = 0;
n->hot = 0;
if ( n->ctx->userdata_copy_callback)
(n->ctx->userdata_copy_callback)( n,
((GrowAxisArc *)(array.a[i]))->user_data, &n->user_data, glow_eUserdataCbType_Node);
insert( n);
break;
}
......
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