Commit 30443e8e authored by Claes Sjofors's avatar Claes Sjofors

Xtt export of fast curve added

parent b4f5ed5d
...@@ -439,6 +439,7 @@ void GeCurveGtk::activate_export_ok( GtkWidget *w, gpointer data) ...@@ -439,6 +439,7 @@ void GeCurveGtk::activate_export_ok( GtkWidget *w, gpointer data)
} }
g_free( value); g_free( value);
if ( ((GeCurveGtk *)curve)->layout_mask & curve_mEnable_ExportTime) {
value = gtk_editable_get_chars( GTK_EDITABLE(((GeCurveGtk *)curve)->export_fromtime_widget), 0, -1); value = gtk_editable_get_chars( GTK_EDITABLE(((GeCurveGtk *)curve)->export_fromtime_widget), 0, -1);
sts = time_AsciiToA( value, &from); sts = time_AsciiToA( value, &from);
g_free( value); g_free( value);
...@@ -461,6 +462,7 @@ void GeCurveGtk::activate_export_ok( GtkWidget *w, gpointer data) ...@@ -461,6 +462,7 @@ void GeCurveGtk::activate_export_ok( GtkWidget *w, gpointer data)
g_free( value); g_free( value);
if ( nr != 1) if ( nr != 1)
return; return;
}
value = gtk_editable_get_chars( GTK_EDITABLE(((GeCurveGtk *)curve)->export_filename_widget), 0, -1); value = gtk_editable_get_chars( GTK_EDITABLE(((GeCurveGtk *)curve)->export_filename_widget), 0, -1);
strcpy( filename, value); strcpy( filename, value);
...@@ -520,6 +522,7 @@ void GeCurveGtk::enable( unsigned int mask) ...@@ -520,6 +522,7 @@ void GeCurveGtk::enable( unsigned int mask)
g_object_set( sea_timebox, "visible", TRUE, NULL); g_object_set( sea_timebox, "visible", TRUE, NULL);
if ( mask & curve_mEnable_Add) if ( mask & curve_mEnable_Add)
g_object_set( tools_add, "visible", TRUE, NULL); g_object_set( tools_add, "visible", TRUE, NULL);
layout_mask = mask;
} }
void GeCurveGtk::setup( unsigned int mask) void GeCurveGtk::setup( unsigned int mask)
...@@ -532,6 +535,7 @@ void GeCurveGtk::setup( unsigned int mask) ...@@ -532,6 +535,7 @@ void GeCurveGtk::setup( unsigned int mask)
g_object_set( menu_export, "visible", mask & curve_mEnable_Export ? TRUE : FALSE, NULL); g_object_set( menu_export, "visible", mask & curve_mEnable_Export ? TRUE : FALSE, NULL);
g_object_set( sea_timebox, "visible", mask & curve_mEnable_Timebox ? TRUE : FALSE, NULL); g_object_set( sea_timebox, "visible", mask & curve_mEnable_Timebox ? TRUE : FALSE, NULL);
g_object_set( tools_add, "visible", mask & curve_mEnable_Add ? TRUE : FALSE, NULL); g_object_set( tools_add, "visible", mask & curve_mEnable_Add ? TRUE : FALSE, NULL);
layout_mask = mask;
} }
...@@ -602,6 +606,7 @@ void GeCurveGtk::open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *fi ...@@ -602,6 +606,7 @@ void GeCurveGtk::open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *fi
create_export_dialog(); create_export_dialog();
if ( layout_mask & curve_mEnable_ExportTime) {
time_AtoAscii( from, time_eFormat_DateAndTime, fromtime_str, sizeof(fromtime_str)); time_AtoAscii( from, time_eFormat_DateAndTime, fromtime_str, sizeof(fromtime_str));
time_AtoAscii( to, time_eFormat_DateAndTime, totime_str, sizeof(totime_str)); time_AtoAscii( to, time_eFormat_DateAndTime, totime_str, sizeof(totime_str));
sprintf( rows_str, "%d", rows); sprintf( rows_str, "%d", rows);
...@@ -615,6 +620,7 @@ void GeCurveGtk::open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *fi ...@@ -615,6 +620,7 @@ void GeCurveGtk::open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *fi
gtk_editable_delete_text( GTK_EDITABLE(export_rows_widget), 0, -1); gtk_editable_delete_text( GTK_EDITABLE(export_rows_widget), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(export_rows_widget), gtk_editable_insert_text( GTK_EDITABLE(export_rows_widget),
rows_str, strlen(rows_str), &pos); rows_str, strlen(rows_str), &pos);
}
gtk_editable_delete_text( GTK_EDITABLE(export_filename_widget), 0, -1); gtk_editable_delete_text( GTK_EDITABLE(export_filename_widget), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(export_filename_widget), gtk_editable_insert_text( GTK_EDITABLE(export_filename_widget),
filename, strlen(filename), &pos); filename, strlen(filename), &pos);
...@@ -1260,20 +1266,25 @@ void GeCurveGtk::create_export_dialog() ...@@ -1260,20 +1266,25 @@ void GeCurveGtk::create_export_dialog()
} }
gtk_combo_box_set_active( GTK_COMBO_BOX(export_attrcombo_widget), 0); gtk_combo_box_set_active( GTK_COMBO_BOX(export_attrcombo_widget), 0);
GtkWidget *fromtime_label;
GtkWidget *totime_label;
GtkWidget *rows_label;
if ( layout_mask & curve_mEnable_ExportTime) {
export_fromtime_widget = gtk_entry_new(); export_fromtime_widget = gtk_entry_new();
gtk_widget_set_size_request( export_fromtime_widget, 200, -1); gtk_widget_set_size_request( export_fromtime_widget, 200, -1);
GtkWidget *fromtime_label = gtk_label_new(CoWowGtk::translate_utf8("From")); fromtime_label = gtk_label_new(CoWowGtk::translate_utf8("From"));
gtk_widget_set_size_request( fromtime_label, 90, -1); gtk_widget_set_size_request( fromtime_label, 90, -1);
export_totime_widget = gtk_entry_new(); export_totime_widget = gtk_entry_new();
gtk_widget_set_size_request( export_totime_widget, 200, -1); gtk_widget_set_size_request( export_totime_widget, 200, -1);
GtkWidget *totime_label = gtk_label_new(CoWowGtk::translate_utf8("To")); totime_label = gtk_label_new(CoWowGtk::translate_utf8("To"));
gtk_widget_set_size_request( totime_label, 90, -1); gtk_widget_set_size_request( totime_label, 90, -1);
export_rows_widget = gtk_entry_new(); export_rows_widget = gtk_entry_new();
gtk_widget_set_size_request( export_rows_widget, 80, -1); gtk_widget_set_size_request( export_rows_widget, 80, -1);
GtkWidget *rows_label = gtk_label_new(CoWowGtk::translate_utf8("Max number of rows")); rows_label = gtk_label_new(CoWowGtk::translate_utf8("Max number of rows"));
gtk_widget_set_size_request( rows_label, 150, -1); gtk_widget_set_size_request( rows_label, 150, -1);
}
export_filename_widget = gtk_entry_new(); export_filename_widget = gtk_entry_new();
GtkWidget *filename_label = gtk_label_new(CoWowGtk::translate_utf8("Filename")); GtkWidget *filename_label = gtk_label_new(CoWowGtk::translate_utf8("Filename"));
...@@ -1297,14 +1308,18 @@ void GeCurveGtk::create_export_dialog() ...@@ -1297,14 +1308,18 @@ void GeCurveGtk::create_export_dialog()
gtk_box_pack_start( GTK_BOX(export_hbox1), export_attrcombo_widget, TRUE, TRUE, 30); gtk_box_pack_start( GTK_BOX(export_hbox1), export_attrcombo_widget, TRUE, TRUE, 30);
GtkWidget *export_hbox2 = gtk_hbox_new( FALSE, 0); GtkWidget *export_hbox2 = gtk_hbox_new( FALSE, 0);
if ( layout_mask & curve_mEnable_ExportTime) {
gtk_box_pack_start( GTK_BOX(export_hbox2), fromtime_label, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(export_hbox2), fromtime_label, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(export_hbox2), export_fromtime_widget, FALSE, FALSE, 30); gtk_box_pack_start( GTK_BOX(export_hbox2), export_fromtime_widget, FALSE, FALSE, 30);
gtk_box_pack_start( GTK_BOX(export_hbox2), totime_label, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(export_hbox2), totime_label, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(export_hbox2), export_totime_widget, FALSE, FALSE, 30); gtk_box_pack_start( GTK_BOX(export_hbox2), export_totime_widget, FALSE, FALSE, 30);
}
GtkWidget *export_hbox4 = gtk_hbox_new( FALSE, 0); GtkWidget *export_hbox4 = gtk_hbox_new( FALSE, 0);
if ( layout_mask & curve_mEnable_ExportTime) {
gtk_box_pack_start( GTK_BOX(export_hbox4), rows_label, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(export_hbox4), rows_label, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(export_hbox4), export_rows_widget, FALSE, FALSE, 30); gtk_box_pack_start( GTK_BOX(export_hbox4), export_rows_widget, FALSE, FALSE, 30);
}
GtkWidget *export_hbox5 = gtk_hbox_new( FALSE, 0); GtkWidget *export_hbox5 = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(export_hbox5), filename_label, FALSE, FALSE, 15); gtk_box_pack_start( GTK_BOX(export_hbox5), filename_label, FALSE, FALSE, 15);
......
...@@ -113,9 +113,15 @@ void GeCurve::activate_export() ...@@ -113,9 +113,15 @@ void GeCurve::activate_export()
double from_time, to_time; double from_time, to_time;
pwr_tFileName filename; pwr_tFileName filename;
// Get directory from proview.cnf // Get default file from proview.cnf
if ( layout_mask & curve_mEnable_ExportTime) {
if ( !cnf_get_value( "curveExportFile", filename, sizeof(filename))) if ( !cnf_get_value( "curveExportFile", filename, sizeof(filename)))
strcpy( filename, "~/history.txt"); strcpy( filename, "~/history_$date.txt");
}
else {
if ( !cnf_get_value( "curveExportFile", filename, sizeof(filename)))
strcpy( filename, "~/fast_$date.txt");
}
grow_MeasureWindow( growcurve_ctx, &ll_x, &ll_y, &ur_x, &ur_y); grow_MeasureWindow( growcurve_ctx, &ll_x, &ll_y, &ur_x, &ur_y);
...@@ -1530,7 +1536,7 @@ GeCurve::GeCurve( void *gc_parent_ctx, ...@@ -1530,7 +1536,7 @@ GeCurve::GeCurve( void *gc_parent_ctx,
prev_period_cb(0), next_period_cb(0), add_cb(0), madd_cb(0), remove_cb(0), export_cb(0), new_cb(0), prev_period_cb(0), next_period_cb(0), add_cb(0), madd_cb(0), remove_cb(0), export_cb(0), new_cb(0),
save_cb(0), open_cb(0), snapshot_cb(0), save_cb(0), open_cb(0), snapshot_cb(0),
initial_right_position(pos_right), last_cursor_x(0), last_mark1_x(0), last_mark2_x(0), initial_right_position(pos_right), last_cursor_x(0), last_mark1_x(0), last_mark2_x(0),
deferred_configure_axes(0), center_from_window(0), options(gc_options) deferred_configure_axes(0), center_from_window(0), options(gc_options), layout_mask(0)
{ {
pwr_tStatus sts; pwr_tStatus sts;
......
...@@ -67,7 +67,8 @@ typedef enum { ...@@ -67,7 +67,8 @@ typedef enum {
curve_mEnable_Snapshot = 1 << 3, curve_mEnable_Snapshot = 1 << 3,
curve_mEnable_Export = 1 << 4, curve_mEnable_Export = 1 << 4,
curve_mEnable_Timebox = 1 << 5, curve_mEnable_Timebox = 1 << 5,
curve_mEnable_Add = 1 << 6 curve_mEnable_Add = 1 << 6,
curve_mEnable_ExportTime = 1 << 7
} curve_mEnable; } curve_mEnable;
typedef enum { typedef enum {
...@@ -206,6 +207,7 @@ class GeCurve { ...@@ -206,6 +207,7 @@ class GeCurve {
CoWow *wow; CoWow *wow;
int center_from_window; int center_from_window;
unsigned int options; unsigned int options;
unsigned int layout_mask;
GeCurve( void *gc_parent_ctx, char *curve_name, GeCurve( void *gc_parent_ctx, char *curve_name,
char *filename, GeCurveData *curve_data, int pos_right, char *filename, GeCurveData *curve_data, int pos_right,
......
...@@ -77,10 +77,17 @@ XttFastGtk::XttFastGtk( void *parent_ctx, ...@@ -77,10 +77,17 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
*sts = XNAV__SUCCESS; *sts = XNAV__SUCCESS;
if ( strcmp( name, "") != 0)
strncpy( title, name, sizeof(title));
else
gdh_AttrrefToName( fast_arp, title, sizeof(title), cdh_mNName);
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 0, width, height, curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 0, width, height,
options); options);
curve->close_cb = fast_close_cb; curve->close_cb = fast_close_cb;
curve->help_cb = fast_help_cb; curve->help_cb = fast_help_cb;
curve->export_cb = fast_export_cb;
setup();
wow = new CoWowGtk( parent_widget); wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new(); timerid = wow->timer_new();
...@@ -88,6 +95,35 @@ XttFastGtk::XttFastGtk( void *parent_ctx, ...@@ -88,6 +95,35 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
timerid->add( 1000, fast_scan, this); timerid->add( 1000, fast_scan, this);
} }
XttFastGtk::XttFastGtk( void *parent_ctx,
GtkWidget *parent_wid,
const char *name,
GtkWidget **w,
char *filename,
int *sts) :
XttFast( parent_ctx, name, filename, sts),
parent_widget(parent_wid)
{
char title[250];
strncpy(title, filename, sizeof(title));
if ( EVEN(*sts))
// Error from XttFast
return;
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1, 0, 0, 0);
curve->close_cb = fast_close_cb;
curve->help_cb = fast_help_cb;
curve->enable(0);
wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new();
// timerid->add( 1000, fast_scan, this);
}
XttFastGtk::~XttFastGtk() XttFastGtk::~XttFastGtk()
{ {
timerid->remove(); timerid->remove();
......
...@@ -56,6 +56,12 @@ class XttFastGtk : public XttFast { ...@@ -56,6 +56,12 @@ class XttFastGtk : public XttFast {
int height, int height,
unsigned int xn_options, unsigned int xn_options,
int *sts); int *sts);
XttFastGtk( void *parent_ctx,
GtkWidget *parent_wid,
const char *name,
GtkWidget **w,
char *filename,
int *sts);
~XttFastGtk(); ~XttFastGtk();
}; };
......
...@@ -98,7 +98,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx, ...@@ -98,7 +98,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
curve->add_cb = sevhist_add_cb; curve->add_cb = sevhist_add_cb;
curve->remove_cb = sevhist_remove_cb; curve->remove_cb = sevhist_remove_cb;
curve->export_cb = sevhist_export_cb; curve->export_cb = sevhist_export_cb;
curve->enable( curve_mEnable_Timebox | curve_mEnable_Export); curve->enable( curve_mEnable_Timebox | curve_mEnable_Export | curve_mEnable_ExportTime);
if ( w) if ( w)
*w = (GtkWidget *)curve->get_widget(); *w = (GtkWidget *)curve->get_widget();
......
...@@ -270,11 +270,14 @@ XttTCurve *XNavGtk::xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, i ...@@ -270,11 +270,14 @@ XttTCurve *XNavGtk::xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, i
} }
XttFast *XNavGtk::xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height, XttFast *XNavGtk::xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height,
unsigned int options, pwr_tStatus *sts) unsigned int options, char *filename, pwr_tStatus *sts)
{ {
GtkWidget *w; GtkWidget *w;
if ( !filename)
return new XttFastGtk( this, parent_wid, name, &w, objar, width, height, options, sts); return new XttFastGtk( this, parent_wid, name, &w, objar, width, height, options, sts);
else
return new XttFastGtk( this, parent_wid, name, &w, filename, sts);
} }
XAttOne *XNavGtk::xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv, XAttOne *XNavGtk::xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv,
......
...@@ -81,7 +81,8 @@ class XNavGtk : public XNav { ...@@ -81,7 +81,8 @@ class XNavGtk : public XNav {
pwr_tOName *onamev, bool *sevhistobjectv, sevcli_tCtx scctx, pwr_tOName *onamev, bool *sevhistobjectv, sevcli_tCtx scctx,
char *filename, int width, int height, unsigned int options, pwr_tStatus *sts); char *filename, int width, int height, unsigned int options, pwr_tStatus *sts);
XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options, pwr_tStatus *sts); XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options, pwr_tStatus *sts);
XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height, unsigned int options, pwr_tStatus *sts); XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height, unsigned int options,
char *filename, pwr_tStatus *sts);
XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv, XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv,
pwr_tStatus *sts); pwr_tStatus *sts);
CLog *clog_new( const char *name, pwr_tStatus *sts); CLog *clog_new( const char *name, pwr_tStatus *sts);
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "rt_gdh_msg.h" #include "rt_gdh_msg.h"
#include "co_cdh.h" #include "co_cdh.h"
#include "co_time.h" #include "co_time.h"
#include "co_dcli.h"
#include "cow_wow.h" #include "cow_wow.h"
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
...@@ -204,6 +205,16 @@ XttFast::XttFast( void *parent_ctx, ...@@ -204,6 +205,16 @@ XttFast::XttFast( void *parent_ctx,
// (XtTimerCallbackProc)fast_scan, this); // (XtTimerCallbackProc)fast_scan, this);
} }
XttFast::XttFast( void *parent_ctx,
const char *name,
char *filename,
int *sts) : xnav(parent_ctx), fast_cnt(0), timerid(0), close_cb(0), help_cb(0),
first_scan(1), axis_configured(false)
{
*sts = read_export( filename);
}
XttFast::~XttFast() XttFast::~XttFast()
{ {
} }
...@@ -213,6 +224,11 @@ void XttFast::pop() ...@@ -213,6 +224,11 @@ void XttFast::pop()
curve->pop(); curve->pop();
} }
void XttFast::setup()
{
curve->setup( curve_mEnable_Export);
}
void XttFast::fast_close_cb( void *ctx) void XttFast::fast_close_cb( void *ctx)
{ {
XttFast *fast = (XttFast *) ctx; XttFast *fast = (XttFast *) ctx;
...@@ -461,9 +477,146 @@ void XttFast::fast_scan( void *data) ...@@ -461,9 +477,146 @@ void XttFast::fast_scan( void *data)
fast->timerid->add( 1000, fast_scan, fast); fast->timerid->add( 1000, fast_scan, fast);
} }
int XttFast::fast_export_cb( void *ctx, pwr_tTime *from, pwr_tTime *to, int rows, int idx,
char *filename)
{
XttFast *fast = (XttFast *)ctx;
pwr_tFileName fname;
pwr_tStatus sts;
FILE *fp;
// Replace $date with date
strncpy( fname, filename, sizeof(fname));
char *s1 = strstr( fname, "$date");
if ( s1) {
char timstr[40];
pwr_tFileName str;
sts = time_AtoAscii( 0, time_eFormat_FileDateAndTime,
timstr, sizeof(timstr));
strncpy( str, s1 + strlen("$date"), sizeof(str));
*s1 = 0;
strncat( fname, timstr, sizeof(fname));
strncat( fname, str, sizeof(fname));
}
dcli_translate_filename( fname, fname);
if ( idx == -1) {
// Export all attributes
fp = fopen( fname, "w");
if ( !fp)
return XNAV__NOFILE;
fprintf( fp, "# Columns %d\n", fast->fast_cnt);
fprintf( fp, "# Rows %d\n", fast->max_points);
for ( int i = 0; i < fast->fast_cnt; i++)
fprintf( fp, "# Attribute %s\n", fast->gcd->y_name[i]);
for ( int j = 0; j < fast->max_points; j++) {
fprintf( fp, "%f ", fast->gcd->x_data[0][j]);
for ( int i = 0; i < fast->fast_cnt; i++) {
fprintf( fp, "%f ", fast->gcd->y_data[i][j]);
}
fprintf( fp, "\n");
}
fclose(fp);
}
else {
fp = fopen( fname, "w");
if ( !fp)
return XNAV__NOFILE;
fprintf( fp, "# Columns %d\n", 1);
fprintf( fp, "# Rows %d\n", fast->max_points);
fprintf( fp, "# Attribute %s\n", fast->gcd->y_name[idx]);
for ( int j = 0; j < fast->max_points; j++) {
fprintf( fp, "%f ", fast->gcd->x_data[0][j]);
fprintf( fp, "%f ", fast->gcd->y_data[idx][j]);
fprintf( fp, "\n");
}
fclose(fp);
}
return XNAV__SUCCESS;
}
int XttFast::read_export( char *filename)
{
pwr_tFileName fname;
FILE *fp;
char line[200];
int idx = -1;
int rowcnt = 0;
pwr_tStatus sts;
char line_part[40][20];
dcli_translate_filename( fname, filename);
fp = fopen( fname, "r");
if ( !fp)
return 0;
gcd = new GeCurveData( curve_eDataType_DsTrend);
while( 1) {
sts = dcli_read_line( line, sizeof(line), fp);
if ( !sts)
break;
if ( line[0] == '#') {
if ( strncmp( &line[2], "Attribute", 9) == 0) {
// New attribute
idx++;
strncpy( gcd->y_name[idx], &line[12], sizeof(gcd->y_name[idx]));
gcd->y_data[idx] = (double *) calloc( 1, 8 * max_points);
gcd->y_axis_type[idx] = curve_eAxis_y;
}
else if ( strncmp( &line[2], "Rows", 4) == 0) {
sscanf( &line[7], "%d", &max_points);
gcd->rows[0] = max_points;
gcd->x_data[0] = (double *) calloc( 1, 8 * max_points);
}
else if ( strncmp( &line[2], "Columns", 4) == 0) {
sscanf( &line[10], "%d", &fast_cnt);
}
}
else {
if ( idx < 0 || fast_cnt != idx + 1)
continue;
if ( rowcnt >= max_points)
continue;
int nr = dcli_parse( line, " ", "",
(char *) line_part, sizeof( line_part)/sizeof( line_part[0]),
sizeof( line_part[0]), 0);
if ( nr < fast_cnt + 1)
return 0;
sscanf( line_part[0], "%lf", &gcd->x_data[0][rowcnt]);
for ( int i = 0; i < fast_cnt; i++)
sscanf( line_part[i+1], "%lf", &gcd->y_data[i][rowcnt]);
rowcnt++;
}
}
if ( fast_cnt == 0)
return 0;
for ( int i = 0; i < fast_cnt; i++)
gcd->rows[i] = max_points;
gcd->cols = fast_cnt;
strcpy( gcd->x_name, "Time");
gcd->x_axis_type[0] = curve_eAxis_x;
fclose(fp);
gcd->select_color( 0);
gcd->get_borders();
gcd->get_default_axis();
return 1;
}
...@@ -105,15 +105,23 @@ class XttFast { ...@@ -105,15 +105,23 @@ class XttFast {
char *xn_name, char *xn_name,
pwr_sAttrRef *fast_arp, pwr_sAttrRef *fast_arp,
int *sts); int *sts);
XttFast( void *parent_ctx,
const char *name,
char *filename,
int *sts);
//! Destructor //! Destructor
virtual ~XttFast(); virtual ~XttFast();
//! Pop fast window. //! Pop fast window.
void pop(); void pop();
void setup();
int read_export( char *filename);
static void fast_close_cb( void *ctx); static void fast_close_cb( void *ctx);
static void fast_help_cb( void *ctx); static void fast_help_cb( void *ctx);
static int fast_export_cb( void *ctx, pwr_tTime *from, pwr_tTime *to,
int rows, int idx, char *filename);
static void fast_scan( void *data); static void fast_scan( void *data);
}; };
......
...@@ -696,7 +696,7 @@ void XttSevHist::pop() ...@@ -696,7 +696,7 @@ void XttSevHist::pop()
void XttSevHist::setup() void XttSevHist::setup()
{ {
curve->setup( curve_mEnable_Timebox | curve_mEnable_Export); curve->setup( curve_mEnable_Timebox | curve_mEnable_Export | curve_mEnable_ExportTime);
} }
void XttSevHist::sevhist_close_cb( void *ctx) void XttSevHist::sevhist_close_cb( void *ctx)
......
...@@ -352,7 +352,8 @@ class XNav { ...@@ -352,7 +352,8 @@ class XNav {
pwr_tOName *oname, bool *sevhistobjectv, sevcli_tCtx scctx, pwr_tOName *oname, bool *sevhistobjectv, sevcli_tCtx scctx,
char *filename, int width, int height, unsigned int options, pwr_tStatus *sts) {return 0;} char *filename, int width, int height, unsigned int options, pwr_tStatus *sts) {return 0;}
virtual XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options, pwr_tStatus *sts) {return 0;} virtual XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options, pwr_tStatus *sts) {return 0;}
virtual XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height, unsigned int options, pwr_tStatus *sts) {return 0;} virtual XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height, unsigned int options,
char *filename, pwr_tStatus *sts) {return 0;}
virtual XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv, virtual XAttOne *xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv,
pwr_tStatus *sts) {return 0;} pwr_tStatus *sts) {return 0;}
virtual CLog *clog_new( const char *name, pwr_tStatus *sts) {return 0;} virtual CLog *clog_new( const char *name, pwr_tStatus *sts) {return 0;}
......
...@@ -4193,6 +4193,7 @@ static int xnav_open_func( void *client_data, ...@@ -4193,6 +4193,7 @@ static int xnav_open_func( void *client_data,
unsigned int options = 0; unsigned int options = 0;
int width, height, nr; int width, height, nr;
char tmp_str[40]; char tmp_str[40];
pwr_tFileName file_str;
// Command is "OPEN FAST" // Command is "OPEN FAST"
...@@ -4227,6 +4228,18 @@ static int xnav_open_func( void *client_data, ...@@ -4227,6 +4228,18 @@ static int xnav_open_func( void *client_data,
else else
height = 0; height = 0;
if ( ODD( dcli_get_qualifier( "/FILE", file_str, sizeof(file_str)))) {
// Open exported fast file
XttFast *fast = xnav->xttfast_new( title_str, 0, width, height, 0, file_str, &sts);
if ( EVEN(sts))
xnav->message('E',"Error in fast configuration");
else {
fast->close_cb = xnav_fast_close_cb;
fast->help_cb = xnav_fast_help_cb;
}
return XNAV__SUCCESS;
}
/* Get the name qualifier */ /* Get the name qualifier */
if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str, sizeof(name_str)))) if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str, sizeof(name_str))))
{ {
...@@ -4274,7 +4287,7 @@ static int xnav_open_func( void *client_data, ...@@ -4274,7 +4287,7 @@ static int xnav_open_func( void *client_data,
} }
if ( EVEN( dcli_get_qualifier( "/TITLE", title_str, sizeof(title_str)))) { if ( EVEN( dcli_get_qualifier( "/TITLE", title_str, sizeof(title_str)))) {
strcpy( title_str, "Fast"); strcpy( title_str, "");
} }
XttFast *fast; XttFast *fast;
...@@ -4282,7 +4295,7 @@ static int xnav_open_func( void *client_data, ...@@ -4282,7 +4295,7 @@ static int xnav_open_func( void *client_data,
fast->pop(); fast->pop();
} }
else { else {
fast = xnav->xttfast_new( title_str, &aref, width, height, options, &sts); fast = xnav->xttfast_new( title_str, &aref, width, height, options, 0, &sts);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message('E',"Error in fast configuration"); xnav->message('E',"Error in fast configuration");
else { else {
......
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