Commit b295f403 authored by claes's avatar claes

New ge fetched from 3.9 and fast curves implemented

parent fb0ef6e2
......@@ -71,6 +71,15 @@ static pwr_tStatus OpenCrossref( xmenu_sMenuCall *ip)
//
static pwr_tStatus OpenCrossrefFilter( xmenu_sMenuCall *ip)
{
pwr_tClassId classid;
pwr_tStatus sts;
sts = gdh_GetObjectClass( ip->Pointed.Objid, &classid);
if ( EVEN(sts)) return sts;
if ( classid == pwr_eClass_PlantHier)
return XNAV__INVISIBLE;
return 1;
}
......
This diff is collapsed.
#ifndef xtt_fast_h
#define xtt_fast_h
/* xtt_fast.h -- Fast curves
PROVIEW/R
Copyright (C) 2003 by SSAB Oxelosund AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef ge_curve_h
# include "ge_curve.h"
#endif
#ifndef rt_fast_h
# include "rt_fast.h"
#endif
/*! \file xtt_fast.h
\brief Contains the XttFast class. */
/*! \addtogroup Xtt */
/*@{*/
#define XTT_FAST_MAX 20
//! Window that displays fast curve in a DsFastCurve object.
/*!
A DsFastCurve references a data array for the time axis, and up to 10 data arrays
with stored data. These arrays are displayed in the XttFast window. The measurement
of these curves are triggered manually, on a digital signal, or on a level of one of
the attributes. When the measurement is completed this is signaled with the New attribute
in the DsFastCurve object. The XttFast window then has to read the new data and
reconfigure the curves. XttFast uses the GeCurve class to display the curves.
*/
class XttFast {
public:
//! Constructor
XttFast(
void *xn_parent_ctx,
Widget xn_parent_wid,
char *xn_name,
Widget *w,
pwr_tObjid fast_object,
int *sts);
void *xnav; //!< Pointer to parent XNav.
Widget parent_widget; //!< Parent widget.
int fast_cnt; //!< Number of fast curves.
GeCurveData *gcd; //!< Curve data for GeCurve object.
GeCurve *curve; //!< Curve window.
pwr_tRefId new_subid; //!< Subid of New attribute in DsFastCurve.
pwr_tBoolean *new_p; //!< Pointer to New attribute, which indicates new curve data.
pwr_sAttrRef time_buff; //!< Attrref to data array for time axis.
pwr_sAttrRef buff[FAST_CURVES]; //!< Attrefs to data arrays for curves.
pwr_eType type[FAST_CURVES]; //!< Types of curves.
int fast_idx[FAST_CURVES]; //!< Conversion from DsFastCurve index to GeCurveData index.
int curve_idx[XTT_FAST_MAX]; //!< Conversion from GeCurveData index to DsFastCurve index.
int element_size[XTT_FAST_MAX]; //!< Size of data element in curves.
int max_points; //!< Max number of points in curves.
XtIntervalId timerid; //!< Time id for scan.
void (*close_cb)( void *, XttFast *); //!< Close callback to parent.
pwr_tBoolean old_new; //!< Old value of new. Used to detect edge of New.
pwr_tMask fast_function; //!< Function configured in DsFastCurve object.
bool first_scan; //!< Indicates that this is the first scan.
bool axis_configured; //!< Axis range is configured in DsFastCurve object.
pwr_sAttrRef trigg_index_attr; //!< Attrref to TriggIndex attribute in DsFastCurve object.
pwr_sAttrRef first_index_attr; //!< Attrref to FirstIndex attribute in DsFastCurve object.
pwr_sAttrRef last_index_attr; //!< Attrref to LastIndex attribute in DsFastCurve object.
pwr_sAttrRef trigg_time_attr; //!< Attrref to TriggTime attribute in DsFastCurve object.
//! Pop fast window.
void pop();
//! Destructor
~XttFast();
};
/*@}*/
#if defined __cplusplus
}
#endif
#endif
......@@ -30,6 +30,7 @@ extern "C" {
#include "rt_gdh_msg.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_mrm_util.h"
}
#include "glow_growctx.h"
......@@ -49,6 +50,43 @@ extern "C" {
static void ge_message( void *ctx, char severity, char *message);
static void ge_enable_set_focus( ge_tCtx gectx)
{
gectx->set_focus_disabled--;
}
static void ge_disable_set_focus( ge_tCtx gectx, int time)
{
gectx->set_focus_disabled++;
gectx->focus_timerid = XtAppAddTimeOut(
XtWidgetToApplicationContext( gectx->toplevel), time,
(XtTimerCallbackProc)ge_enable_set_focus, gectx);
}
static void ge_action_inputfocus( Widget w, XmAnyCallbackStruct *data)
{
Arg args[1];
ge_tCtx gectx;
XtSetArg (args[0], XmNuserData, &gectx);
XtGetValues (w, args, 1);
if ( !gectx)
return;
if ( mrm_IsIconicState(w))
return;
if ( gectx->set_focus_disabled)
return;
if ( gectx->graph)
((Graph *)gectx->graph)->set_inputfocus(1);
ge_disable_set_focus( gectx, 400);
}
static void ge_graph_init_cb( void *client_data)
{
ge_tCtx gectx = (ge_tCtx) client_data;
......@@ -107,7 +145,8 @@ static void ge_change_value_cb( void *ge_ctx, void *value_object, char *text)
XtManageChild( gectx->value_dialog);
ge_message( gectx, ' ', "");
XtSetKeyboardFocus( gectx->toplevel, gectx->value_input);
XtCallAcceptFocus( gectx->value_input, CurrentTime);
// XtSetKeyboardFocus( gectx->toplevel, gectx->value_input);
XtSetArg(args[0],XmNvalue, text);
XtSetValues( gectx->value_input, args, 1);
......@@ -147,6 +186,19 @@ static void ge_popup_menu_cb( void *ge_ctx, pwr_sAttrRef attrref,
(gectx->popup_menu_cb)( gectx->parent_ctx, attrref, item_type, utility,
arg, popup);
}
static int ge_call_method_cb( void *ge_ctx, char *method, char *filter,
pwr_sAttrRef attrref, unsigned long item_type, unsigned long utility,
char *arg)
{
ge_tCtx gectx = (ge_tCtx)ge_ctx;
if ( gectx->call_method_cb)
return (gectx->call_method_cb)( gectx->parent_ctx, method, filter, attrref, item_type, utility,
arg);
else return 0;
}
static int ge_is_authorized_cb( void *ge_ctx, unsigned int access)
{
ge_tCtx gectx = (ge_tCtx)ge_ctx;
......@@ -352,12 +404,14 @@ extern "C" ge_tCtx ge_new( Widget parent_wid,
char wname[] = "Proview/R Ge";
static char translations[] =
"<ConfigureNotify>: resize()\n";
"<ConfigureNotify>: resize()\n\
<FocusIn>: ge_xtt_inputfocus()";
static XtTranslations compiled_translations = NULL;
static XtActionsRec actions[] =
{
{"resize", (XtActionProc) ge_action_resize}
{"ge_xtt_inputfocus", (XtActionProc) ge_action_inputfocus},
{"resize", (XtActionProc) ge_action_resize},
};
static MrmRegisterArg reglist[] = {
......@@ -485,6 +539,7 @@ extern "C" ge_tCtx ge_new( Widget parent_wid,
((Graph *)gectx->graph)->is_authorized_cb = &ge_is_authorized_cb;
((Graph *)gectx->graph)->get_current_objects_cb = &ge_get_current_objects_cb;
((Graph *)gectx->graph)->popup_menu_cb = &ge_popup_menu_cb;
((Graph *)gectx->graph)->call_method_cb = &ge_call_method_cb;
XtPopup( gectx->toplevel, XtGrabNone);
......
......@@ -47,9 +47,13 @@ typedef struct ge_sCtx {
int (*is_authorized_cb)(void *, unsigned int);
void (*popup_menu_cb)(void *, pwr_sAttrRef, unsigned long,
unsigned long, char *, Widget *);
int (*call_method_cb)(void *, char *, char *, pwr_sAttrRef,
unsigned long, unsigned long, char *);
int (*get_current_objects_cb)(void *, pwr_sAttrRef **, int **);
int width;
int height;
int set_focus_disabled;
XtIntervalId focus_timerid;
} *ge_tCtx;
void ge_pop( ge_tCtx gectx);
......
......@@ -834,7 +834,7 @@ void Hist::get_hist_list()
printf(" Fel vid skapande av databashandtag avslutar\n");
return;
}
if((ret = dataBaseP->open(dataBaseP, dbName, NULL, DATABASETYPE, DB_RDONLY, 0)) != 0)
if((ret = dataBaseP->open(dataBaseP, 0, dbName, NULL, DATABASETYPE, DB_RDONLY, 0)) != 0)
{
/*error opening/creating db send the mess to errh, then exit*/
printf("error db_open: %s\n", db_strerror(ret));
......
......@@ -14,7 +14,6 @@ extern "C" {
#include "co_dcli.h"
#include "pwr_baseclasses.h"
#include "co_ccm_msg.h"
#include "co_api.h"
#include "flow_x.h"
}
......@@ -44,6 +43,7 @@ extern "C" {
#include "rt_xnav_msg.h"
#include "xtt_xnav.h"
#include "xtt_menu.h"
#include "co_api.h"
pwr_dImport pwr_BindXttMethods($Object);
pwr_dImport pwr_BindXttMethods(PlcPgm);
......
......@@ -239,7 +239,7 @@ XttTrend::XttTrend(
gcd->x_reverse = 1;
gcd->get_borders();
gcd->get_default_axis();
gcd->select_color();
gcd->select_color( 0);
if ( !trend_list) {
// Use axis values from plotgroup object
......
......@@ -66,7 +66,7 @@ static void xnav_xatt_close_cb( void *xnav, void *xatt);
static void xnav_xcrr_close_cb( void *xnav, void *xcrr);
static void xnav_trace_scan( XNav *xnav);
static int xnav_trace_scan_bc( brow_tObject object, void *p);
//static void xnav_type_id_to_name( int type_id, char *type_id_name);
// static void xnav_type_id_to_name( int type_id, char *type_id_name);
static int xnav_trace_connect_bc( brow_tObject object, char *name, char *attr,
flow_eTraceType type, void **p);
static int xnav_trace_disconnect_bc( brow_tObject object);
......
......@@ -9,6 +9,7 @@
#include "flow_std.h"
# include <vector>
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
......@@ -58,6 +59,7 @@ extern "C" {
#include "glow_curvewidget.h"
#include "ge_curve.h"
#include "xtt_trend.h"
#include "xtt_fast.h"
#include "xtt_xcrr.h"
#include "xtt_menu.h"
#include "xtt_url.h"
......@@ -2238,6 +2240,71 @@ static int xnav_open_func( void *client_data,
new XttTrend( xnav, xnav->parent_wid, title_str, &w, objid_vect,
pwr_cNObjid, &sts);
}
else if ( strncmp( arg1_str, "FAST", strlen( arg1_str)) == 0)
{
char name_str[80];
char *name_ptr;
char title_str[80];
pwr_tObjid objid;
Widget w;
int sts;
pwr_tClassId classid;
// Command is "OPEN FAST"
/* Get the name qualifier */
if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str)))
{
if ( name_str[0] != '/')
/* Assume that this is the namestring */
name_ptr = name_str;
else
{
xnav->message('E', "Syntax error");
return XNAV__HOLDCOMMAND;
}
}
else
{
if ( ODD( dcli_get_qualifier( "/NAME", name_str)))
name_ptr = name_str;
else
{
/* Get the selected object */
sts = xnav->get_current_object( &objid, name_str,
sizeof( name_str), cdh_mName_path | cdh_mName_object);
if ( EVEN(sts))
{
xnav->message('E', "Enter name or select an object");
return XNAV__SUCCESS;
}
name_ptr = name_str;
}
}
sts = gdh_NameToObjid( name_str, &objid);
if (EVEN(sts)) {
xnav->message('E', "Object not found");
return XNAV__HOLDCOMMAND;
}
sts = gdh_GetObjectClass( objid, &classid);
if (EVEN(sts)) return sts;
switch ( classid) {
case pwr_cClass_DsFastCurve:
break;
default:
xnav->message('E', "Error in object class");
return XNAV__HOLDCOMMAND;
}
if ( EVEN( dcli_get_qualifier( "/TITLE", title_str))) {
strcpy( title_str, "Fast");
}
new XttFast( xnav, xnav->parent_wid, title_str, &w, objid,
&sts);
}
else if ( strncmp( arg1_str, "URL", strlen( arg1_str)) == 0)
{
char arg2_str[80];
......@@ -4941,6 +5008,7 @@ void XNav::open_graph( char *name, char *filename, int scrollbar, int menu,
&xnav_ge_get_current_objects_cb, &xnav_ge_is_authorized_cb);
gectx->display_in_xnav_cb = xnav_ge_display_in_xnav_cb;
gectx->popup_menu_cb = xnav_popup_menu_cb;
gectx->call_method_cb = xnav_call_method_cb;
appl.insert( applist_eType_Graph, (void *)gectx, pwr_cNObjid, filename,
object_name);
......
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