Commit 3638f3d6 authored by claes's avatar claes

Extended predefined dynamics for subgraphs (HostObject)

parent 86195f54
......@@ -33,6 +33,7 @@ extern "C" {
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "glow_growwidget.h"
#include "flow_msg.h"
#include "ge_attr.h"
#include "ge_attrnav.h"
......
......@@ -84,6 +84,7 @@ static attrnav_sEnumElement elem_dyn_type[] = {
{ (int) ge_mDynType_SliderBackground , "SliderBackground"},
{ (int) ge_mDynType_Video , "Video"},
{ (int) ge_mDynType_Table , "Table"},
{ (int) ge_mDynType_HostObject , "HostObject"},
{ 0, ""}};
static attrnav_sEnumElement elem_dyn_type_tone[] = {
......@@ -113,6 +114,7 @@ static attrnav_sEnumElement elem_dyn_type_tone[] = {
{ (int) ge_mDynType_SliderBackground , "SliderBackground"},
{ (int) ge_mDynType_Video , "Video"},
{ (int) ge_mDynType_Table , "Table"},
{ (int) ge_mDynType_HostObject , "HostObject"},
{ 0, ""}};
static attrnav_sEnumElement elem_action_type[] = {
......@@ -1266,6 +1268,13 @@ int AttrNav::set_attr_value( char *value_str)
}
}
memcpy( item->value_p, buffer, item->size);
if ( cdh_NoCaseStrcmp( item->name, "Subgraph") == 0 &&
reconfigure_attr_cb) {
(reconfigure_attr_cb)(parent_ctx);
return FLOW__DESTROYED;
}
break;
}
default:
......
......@@ -735,16 +735,6 @@ int GeCurve::read_file( char *filename)
return 0;
}
if ( strncmp( line, "\"\"", 2) == 0) {
// If first name is "" it is missed by dcli_parse...
if ( nr == CURVE_MAX_COLS)
nr--;
for ( i = nr - 1; i >= 0; i--)
strcpy( item_str[i+1], item_str[i]);
strcpy( item_str[0], "\"\"");
nr++;
}
printf( "line: %s\n", line);
for ( i = 0; i < nr; i++)
printf( "item: %s\n", item_str[i]);
......
This diff is collapsed.
......@@ -79,6 +79,7 @@ extern "C" {
//! Priority order for dyntypes and actiontypes. Lower value gives higher priority.
typedef enum {
ge_eDynPrio_HostObject,
ge_eDynPrio_Invisible,
ge_eDynPrio_DigFlash,
ge_eDynPrio_DigError,
......@@ -155,7 +156,8 @@ extern "C" {
ge_mDynType_FastCurve = 1 << 22,
ge_mDynType_AnalogText = 1 << 23,
ge_mDynType_Table = 1 << 24,
ge_mDynType_StatusColor = 1 << 25
ge_mDynType_StatusColor = 1 << 25,
ge_mDynType_HostObject = 1 << 26
} ge_mDynType;
//! Action types.
......@@ -250,6 +252,7 @@ extern "C" {
ge_eSave_AnalogText = 29,
ge_eSave_Table = 30,
ge_eSave_StatusColor = 31,
ge_eSave_HostObject = 32,
ge_eSave_PopupMenu = 50,
ge_eSave_SetDig = 51,
ge_eSave_ResetDig = 52,
......@@ -368,6 +371,7 @@ extern "C" {
ge_eSave_Table_sel_attribute12 = 3035,
ge_eSave_StatusColor_attribute = 3100,
ge_eSave_StatusColor_nostatus_color = 3101,
ge_eSave_HostObject_object = 3200,
ge_eSave_PopupMenu_ref_object = 5000,
ge_eSave_SetDig_attribute = 5100,
ge_eSave_SetDig_instance = 5101,
......@@ -629,6 +633,8 @@ class GeDyn {
void set_dyn( ge_mDynType type, ge_mActionType action);
void unset_inherit( grow_tObject object);
void set_command( char *cmd);
void set_hostobject( char *hostobject);
void get_hostobject( char *hostobject);
void set_value_input( char *format, double min_value, double max_value);
int *ref_slider_disabled();
int *ref_trend_hold();
......@@ -640,7 +646,11 @@ class GeDyn {
void export_java_object( grow_tObject object, ofstream& fp, char *var_name);
GeDynElem *create_dyn_element( int mask, int instance);
GeDynElem *create_action_element( int mask, int instance);
GeDynElem *copy_element( GeDynElem& x);
void replace_attribute( char *from, char *to, int *cnt, int strict);
graph_eDatabase parse_attr_name( char *name, char *parsed_name,
int *inverted, int *type, int *size, int *elem = 0);
void merge( GeDyn& x);
static char *cmd_cnv( char *instr);
static int instance_to_number( int instance);
static void replace_attribute( char *attribute, int attr_size, char *from, char *to, int *cnt, int strict);
......@@ -1042,10 +1052,11 @@ class GeValue : public GeDynElem {
char old_value[80];
int annot_typeid;
int annot_size;
pwr_tTid tid;
GeValue( GeDyn *e_dyn, ge_mInstance e_instance = ge_mInstance_1) :
GeDynElem(e_dyn, ge_mDynType_Value, (ge_mActionType) 0, ge_eDynPrio_Value),
annot_typeid(0), annot_size(0)
annot_typeid(0), annot_size(0), tid(0)
{ strcpy( attribute, ""); strcpy( format, ""); instance = e_instance;}
GeValue( const GeValue& x) :
GeDynElem(x.dyn,x.dyn_type,x.action_type,x.prio)
......@@ -1376,7 +1387,7 @@ class GeStatusColor : public GeDynElem {
GeStatusColor( GeDyn *e_dyn) :
GeDynElem(e_dyn, ge_mDynType_StatusColor, (ge_mActionType) 0, ge_eDynPrio_StatusColor),
on(true)
nostatus_color(glow_eDrawType_Inherit), on(true)
{ strcpy( attribute, "");}
GeStatusColor( const GeStatusColor& x) :
GeDynElem(x.dyn,x.dyn_type,x.action_type,x.prio), nostatus_color(x.nostatus_color)
......@@ -1433,6 +1444,24 @@ class GeFillLevel : public GeDynElem {
};
//! HostObject connected to several attributes specified in the subgraph.
class GeHostObject : public GeDynElem {
public:
char hostobject[120];
GeHostObject( GeDyn *e_dyn) :
GeDynElem(e_dyn, ge_mDynType_HostObject, (ge_mActionType) 0, ge_eDynPrio_HostObject)
{ strcpy( hostobject, "");}
GeHostObject( const GeHostObject& x) :
GeDynElem(x.dyn,x.dyn_type,x.action_type,x.prio)
{ strcpy(hostobject, x.hostobject);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
void open( ifstream& fp);
void set_attribute( grow_tObject object, char *attr_name, int *cnt);
void replace_attribute( char *from, char *to, int *cnt, int strict);
};
//! Display the methods popup menu.
class GePopupMenu : public GeDynElem {
public:
......
This diff is collapsed.
......@@ -441,6 +441,8 @@ class Graph {
unsigned int default_access; //!< Default access. Can be used to override the access of the current user.
bool keep_mode; //!< Do not reset the edit mode when an object is created.
char confirm_text[200]; //!< Stored confirm text.
GeDyn *subgraph_dyn; //!< Subgraph default dynamics.
int was_subgraph; //!< Parameter to detect graph<->subgraph change.
//! Create navigator window.
/*! \param parent Paren widget. */
......@@ -697,6 +699,24 @@ class Graph {
int get_attr_items( grow_tObject object, attr_sItem **itemlist,
int *item_cnt, void **client_data);
//! Get list of attributes for a subgraph.
/*!
\param itemlist List of attributes.
\param item_cnt Number of attributes in list.
\param client_data Pointer to grow info list.
*/
int get_subgraph_attr_items( attr_sItem **itemlist,
int *item_cnt, void **client_data);
//! Get list of attributes for a graph.
/*!
\param itemlist List of attributes.
\param item_cnt Number of attributes in list.
\param client_data Pointer to grow info list.
*/
int get_graph_attr_items( attr_sItem **itemlist,
int *item_cnt, void **client_data);
//! Open attribute editor for a subgraph.
/*! /return Always 1 */
int edit_subgraph_attributes();
......@@ -1125,6 +1145,13 @@ class Graph {
*/
void create_axis( grow_tObject *object, double x, double y);
//! Set displayed folder in a folder object.
/*!
\param name Object name of folder object.
\param idx Index of folder to display.
*/
int set_folder_index( char *name, int idx);
//
// Command module
//
......
......@@ -16,7 +16,6 @@ extern "C" {
#include "co_time.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_types.h"
#include "co_dcli.h"
#include "ge_msg.h"
}
......@@ -772,10 +771,9 @@ static int graph_object_PID( Graph *graph, pwr_tObjid objid)
char classname[40];
char mode_name[120];
char cmd[200];
pwr_tFloat32 max_limit = 100;
pwr_tFloat32 min_limit = 0;
double scan_time;
unsigned int pid_alg;
pwr_tFloat32 max_limit = 100;
pwr_tFloat32 min_limit = 0;
double scan_time;
od = (graph_sObjectPID *) calloc( 1, sizeof(graph_sObjectPID));
graph->graph_object_data = (void *) od;
......@@ -911,22 +909,6 @@ static int graph_object_PID( Graph *graph, pwr_tObjid objid)
od->data_out_scan_time_p = dyn->ref_trend_scantime();
od->hold_out_p = dyn->ref_trend_hold();
// Get and convert PidAlg
sts = gdh_ClassAttrToAttrref( classid, ".PidAlg", &attrref);
if ( EVEN(sts)) return sts;
attrref.Objid = objid;
sts = gdh_GetObjectInfoAttrref( &attrref, (void *)&pid_alg, sizeof(pid_alg));
if ( EVEN(sts)) return sts;
sts = types_translate_enum( classid, "PidAlg", pid_alg, od->pid_alg_str);
sts = grow_FindObjectByName( graph->grow->ctx, "PidAlg", &object);
if ( EVEN(sts)) return sts;
grow_GetUserData( object, (void **)&dyn);
dyn->set_p( (void *) od->pid_alg_str);
// Register scan function
graph->graph_object_scan = graph_object_PID_scan;
......
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