Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
30443e8e
Commit
30443e8e
authored
Dec 20, 2013
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Xtt export of fast curve added
parent
b4f5ed5d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
308 additions
and
64 deletions
+308
-64
xtt/lib/ge/gtk/ge_curve_gtk.cpp
xtt/lib/ge/gtk/ge_curve_gtk.cpp
+63
-48
xtt/lib/ge/src/ge_curve.cpp
xtt/lib/ge/src/ge_curve.cpp
+10
-4
xtt/lib/ge/src/ge_curve.h
xtt/lib/ge/src/ge_curve.h
+3
-1
xtt/lib/xtt/gtk/xtt_fast_gtk.cpp
xtt/lib/xtt/gtk/xtt_fast_gtk.cpp
+36
-0
xtt/lib/xtt/gtk/xtt_fast_gtk.h
xtt/lib/xtt/gtk/xtt_fast_gtk.h
+6
-0
xtt/lib/xtt/gtk/xtt_sevhist_gtk.cpp
xtt/lib/xtt/gtk/xtt_sevhist_gtk.cpp
+1
-1
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
+5
-2
xtt/lib/xtt/gtk/xtt_xnav_gtk.h
xtt/lib/xtt/gtk/xtt_xnav_gtk.h
+2
-1
xtt/lib/xtt/src/xtt_fast.cpp
xtt/lib/xtt/src/xtt_fast.cpp
+154
-1
xtt/lib/xtt/src/xtt_fast.h
xtt/lib/xtt/src/xtt_fast.h
+8
-0
xtt/lib/xtt/src/xtt_sevhist.cpp
xtt/lib/xtt/src/xtt_sevhist.cpp
+2
-2
xtt/lib/xtt/src/xtt_xnav.h
xtt/lib/xtt/src/xtt_xnav.h
+2
-1
xtt/lib/xtt/src/xtt_xnav_command.cpp
xtt/lib/xtt/src/xtt_xnav_command.cpp
+16
-3
No files found.
xtt/lib/ge/gtk/ge_curve_gtk.cpp
View file @
30443e8e
...
...
@@ -439,28 +439,30 @@ void GeCurveGtk::activate_export_ok( GtkWidget *w, gpointer data)
}
g_free
(
value
);
value
=
gtk_editable_get_chars
(
GTK_EDITABLE
(((
GeCurveGtk
*
)
curve
)
->
export_fromtime_widget
),
0
,
-
1
);
sts
=
time_AsciiToA
(
value
,
&
from
);
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
);
sts
=
time_AsciiToA
(
value
,
&
from
);
g_free
(
value
);
if
(
EVEN
(
sts
))
{
curve
->
wow
->
DisplayError
(
"Syntax Error"
,
"From time syntax error"
);
return
;
}
if
(
EVEN
(
sts
))
{
curve
->
wow
->
DisplayError
(
"Syntax Error"
,
"From time syntax error"
);
return
;
}
value
=
gtk_editable_get_chars
(
GTK_EDITABLE
(((
GeCurveGtk
*
)
curve
)
->
export_totime_widget
),
0
,
-
1
);
sts
=
time_AsciiToA
(
value
,
&
to
);
g_free
(
value
);
if
(
EVEN
(
sts
))
{
curve
->
wow
->
DisplayError
(
"Syntax Error"
,
"To time syntax error"
);
return
;
}
value
=
gtk_editable_get_chars
(
GTK_EDITABLE
(((
GeCurveGtk
*
)
curve
)
->
export_totime_widget
),
0
,
-
1
);
sts
=
time_AsciiToA
(
value
,
&
to
);
g_free
(
value
);
if
(
EVEN
(
sts
))
{
curve
->
wow
->
DisplayError
(
"Syntax Error"
,
"To time syntax error"
);
return
;
}
value
=
gtk_editable_get_chars
(
GTK_EDITABLE
(((
GeCurveGtk
*
)
curve
)
->
export_rows_widget
),
0
,
-
1
);
nr
=
sscanf
(
value
,
"%d"
,
&
rows
);
g_free
(
value
);
if
(
nr
!=
1
)
return
;
value
=
gtk_editable_get_chars
(
GTK_EDITABLE
(((
GeCurveGtk
*
)
curve
)
->
export_rows_widget
),
0
,
-
1
);
nr
=
sscanf
(
value
,
"%d"
,
&
rows
);
g_free
(
value
);
if
(
nr
!=
1
)
return
;
}
value
=
gtk_editable_get_chars
(
GTK_EDITABLE
(((
GeCurveGtk
*
)
curve
)
->
export_filename_widget
),
0
,
-
1
);
strcpy
(
filename
,
value
);
...
...
@@ -520,6 +522,7 @@ void GeCurveGtk::enable( unsigned int mask)
g_object_set
(
sea_timebox
,
"visible"
,
TRUE
,
NULL
);
if
(
mask
&
curve_mEnable_Add
)
g_object_set
(
tools_add
,
"visible"
,
TRUE
,
NULL
);
layout_mask
=
mask
;
}
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
(
sea_timebox
,
"visible"
,
mask
&
curve_mEnable_Timebox
?
TRUE
:
FALSE
,
NULL
);
g_object_set
(
tools_add
,
"visible"
,
mask
&
curve_mEnable_Add
?
TRUE
:
FALSE
,
NULL
);
layout_mask
=
mask
;
}
...
...
@@ -602,19 +606,21 @@ void GeCurveGtk::open_export( pwr_tTime *from, pwr_tTime *to, int rows, char *fi
create_export_dialog
();
time_AtoAscii
(
from
,
time_eFormat_DateAndTime
,
fromtime_str
,
sizeof
(
fromtime_str
));
time_AtoAscii
(
to
,
time_eFormat_DateAndTime
,
totime_str
,
sizeof
(
totime_str
));
sprintf
(
rows_str
,
"%d"
,
rows
);
if
(
layout_mask
&
curve_mEnable_ExportTime
)
{
time_AtoAscii
(
from
,
time_eFormat_DateAndTime
,
fromtime_str
,
sizeof
(
fromtime_str
));
time_AtoAscii
(
to
,
time_eFormat_DateAndTime
,
totime_str
,
sizeof
(
totime_str
));
sprintf
(
rows_str
,
"%d"
,
rows
);
gtk_editable_delete_text
(
GTK_EDITABLE
(
export_fromtime_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
export_fromtime_widget
),
gtk_editable_delete_text
(
GTK_EDITABLE
(
export_fromtime_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
export_fromtime_widget
),
fromtime_str
,
strlen
(
fromtime_str
),
&
pos
);
gtk_editable_delete_text
(
GTK_EDITABLE
(
export_totime_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
export_totime_widget
),
gtk_editable_delete_text
(
GTK_EDITABLE
(
export_totime_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
export_totime_widget
),
totime_str
,
strlen
(
totime_str
),
&
pos
);
gtk_editable_delete_text
(
GTK_EDITABLE
(
export_rows_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
export_rows_widget
),
gtk_editable_delete_text
(
GTK_EDITABLE
(
export_rows_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
export_rows_widget
),
rows_str
,
strlen
(
rows_str
),
&
pos
);
}
gtk_editable_delete_text
(
GTK_EDITABLE
(
export_filename_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
export_filename_widget
),
filename
,
strlen
(
filename
),
&
pos
);
...
...
@@ -1260,20 +1266,25 @@ void GeCurveGtk::create_export_dialog()
}
gtk_combo_box_set_active
(
GTK_COMBO_BOX
(
export_attrcombo_widget
),
0
);
export_fromtime_widget
=
gtk_entry_new
();
gtk_widget_set_size_request
(
export_fromtime_widget
,
200
,
-
1
);
GtkWidget
*
fromtime_label
=
gtk_label_new
(
CoWowGtk
::
translate_utf8
(
"From"
));
gtk_widget_set_size_request
(
fromtime_label
,
90
,
-
1
);
export_totime_widget
=
gtk_entry_new
();
gtk_widget_set_size_request
(
export_totime_widget
,
200
,
-
1
);
GtkWidget
*
totime_label
=
gtk_label_new
(
CoWowGtk
::
translate_utf8
(
"To"
));
gtk_widget_set_size_request
(
totime_label
,
90
,
-
1
);
export_rows_widget
=
gtk_entry_new
();
gtk_widget_set_size_request
(
export_rows_widget
,
80
,
-
1
);
GtkWidget
*
rows_label
=
gtk_label_new
(
CoWowGtk
::
translate_utf8
(
"Max number of rows"
));
gtk_widget_set_size_request
(
rows_label
,
150
,
-
1
);
GtkWidget
*
fromtime_label
;
GtkWidget
*
totime_label
;
GtkWidget
*
rows_label
;
if
(
layout_mask
&
curve_mEnable_ExportTime
)
{
export_fromtime_widget
=
gtk_entry_new
();
gtk_widget_set_size_request
(
export_fromtime_widget
,
200
,
-
1
);
fromtime_label
=
gtk_label_new
(
CoWowGtk
::
translate_utf8
(
"From"
));
gtk_widget_set_size_request
(
fromtime_label
,
90
,
-
1
);
export_totime_widget
=
gtk_entry_new
();
gtk_widget_set_size_request
(
export_totime_widget
,
200
,
-
1
);
totime_label
=
gtk_label_new
(
CoWowGtk
::
translate_utf8
(
"To"
));
gtk_widget_set_size_request
(
totime_label
,
90
,
-
1
);
export_rows_widget
=
gtk_entry_new
();
gtk_widget_set_size_request
(
export_rows_widget
,
80
,
-
1
);
rows_label
=
gtk_label_new
(
CoWowGtk
::
translate_utf8
(
"Max number of rows"
));
gtk_widget_set_size_request
(
rows_label
,
150
,
-
1
);
}
export_filename_widget
=
gtk_entry_new
();
GtkWidget
*
filename_label
=
gtk_label_new
(
CoWowGtk
::
translate_utf8
(
"Filename"
));
...
...
@@ -1297,14 +1308,18 @@ void GeCurveGtk::create_export_dialog()
gtk_box_pack_start
(
GTK_BOX
(
export_hbox1
),
export_attrcombo_widget
,
TRUE
,
TRUE
,
30
);
GtkWidget
*
export_hbox2
=
gtk_hbox_new
(
FALSE
,
0
);
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
),
totime_label
,
FALSE
,
FALSE
,
15
);
gtk_box_pack_start
(
GTK_BOX
(
export_hbox2
),
export_totime_widget
,
FALSE
,
FALSE
,
30
);
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
),
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
),
export_totime_widget
,
FALSE
,
FALSE
,
30
);
}
GtkWidget
*
export_hbox4
=
gtk_hbox_new
(
FALSE
,
0
);
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
);
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
),
export_rows_widget
,
FALSE
,
FALSE
,
30
);
}
GtkWidget
*
export_hbox5
=
gtk_hbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
export_hbox5
),
filename_label
,
FALSE
,
FALSE
,
15
);
...
...
xtt/lib/ge/src/ge_curve.cpp
View file @
30443e8e
...
...
@@ -113,9 +113,15 @@ void GeCurve::activate_export()
double
from_time
,
to_time
;
pwr_tFileName
filename
;
// Get directory from proview.cnf
if
(
!
cnf_get_value
(
"curveExportFile"
,
filename
,
sizeof
(
filename
)))
strcpy
(
filename
,
"~/history.txt"
);
// Get default file from proview.cnf
if
(
layout_mask
&
curve_mEnable_ExportTime
)
{
if
(
!
cnf_get_value
(
"curveExportFile"
,
filename
,
sizeof
(
filename
)))
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
);
...
...
@@ -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
),
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
),
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
;
...
...
xtt/lib/ge/src/ge_curve.h
View file @
30443e8e
...
...
@@ -67,7 +67,8 @@ typedef enum {
curve_mEnable_Snapshot
=
1
<<
3
,
curve_mEnable_Export
=
1
<<
4
,
curve_mEnable_Timebox
=
1
<<
5
,
curve_mEnable_Add
=
1
<<
6
curve_mEnable_Add
=
1
<<
6
,
curve_mEnable_ExportTime
=
1
<<
7
}
curve_mEnable
;
typedef
enum
{
...
...
@@ -206,6 +207,7 @@ class GeCurve {
CoWow
*
wow
;
int
center_from_window
;
unsigned
int
options
;
unsigned
int
layout_mask
;
GeCurve
(
void
*
gc_parent_ctx
,
char
*
curve_name
,
char
*
filename
,
GeCurveData
*
curve_data
,
int
pos_right
,
...
...
xtt/lib/xtt/gtk/xtt_fast_gtk.cpp
View file @
30443e8e
...
...
@@ -77,10 +77,17 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
*
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
,
options
);
curve
->
close_cb
=
fast_close_cb
;
curve
->
help_cb
=
fast_help_cb
;
curve
->
export_cb
=
fast_export_cb
;
setup
();
wow
=
new
CoWowGtk
(
parent_widget
);
timerid
=
wow
->
timer_new
();
...
...
@@ -88,6 +95,35 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
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
()
{
timerid
->
remove
();
...
...
xtt/lib/xtt/gtk/xtt_fast_gtk.h
View file @
30443e8e
...
...
@@ -56,6 +56,12 @@ class XttFastGtk : public XttFast {
int
height
,
unsigned
int
xn_options
,
int
*
sts
);
XttFastGtk
(
void
*
parent_ctx
,
GtkWidget
*
parent_wid
,
const
char
*
name
,
GtkWidget
**
w
,
char
*
filename
,
int
*
sts
);
~
XttFastGtk
();
};
...
...
xtt/lib/xtt/gtk/xtt_sevhist_gtk.cpp
View file @
30443e8e
...
...
@@ -98,7 +98,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
curve
->
add_cb
=
sevhist_add_cb
;
curve
->
remove_cb
=
sevhist_remove_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
)
*
w
=
(
GtkWidget
*
)
curve
->
get_widget
();
...
...
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
View file @
30443e8e
...
...
@@ -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
,
unsigned
int
options
,
pwr_tStatus
*
sts
)
unsigned
int
options
,
char
*
filename
,
pwr_tStatus
*
sts
)
{
GtkWidget
*
w
;
return
new
XttFastGtk
(
this
,
parent_wid
,
name
,
&
w
,
objar
,
width
,
height
,
options
,
sts
);
if
(
!
filename
)
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
,
...
...
xtt/lib/xtt/gtk/xtt_xnav_gtk.h
View file @
30443e8e
...
...
@@ -81,7 +81,8 @@ class XNavGtk : public XNav {
pwr_tOName
*
onamev
,
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
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
);
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
,
pwr_tStatus
*
sts
);
CLog
*
clog_new
(
const
char
*
name
,
pwr_tStatus
*
sts
);
...
...
xtt/lib/xtt/src/xtt_fast.cpp
View file @
30443e8e
...
...
@@ -46,6 +46,7 @@
#include "rt_gdh_msg.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
#include "cow_wow.h"
#include "rt_xnav_msg.h"
...
...
@@ -204,6 +205,16 @@ XttFast::XttFast( void *parent_ctx,
// (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
()
{
}
...
...
@@ -213,6 +224,11 @@ void XttFast::pop()
curve
->
pop
();
}
void
XttFast
::
setup
()
{
curve
->
setup
(
curve_mEnable_Export
);
}
void
XttFast
::
fast_close_cb
(
void
*
ctx
)
{
XttFast
*
fast
=
(
XttFast
*
)
ctx
;
...
...
@@ -295,7 +311,7 @@ void XttFast::fast_scan( void *data)
if
(
EVEN
(
sts
))
return
;
k
=
first_index
;
for
(
j
=
0
;
j
<
fast
->
max_points
;
j
++
)
{
for
(
j
=
0
;
j
<
fast
->
max_points
;
j
++
)
{
if
(
k
>=
fast
->
max_points
)
k
=
0
;
switch
(
fast
->
type
[
i
])
{
...
...
@@ -461,9 +477,146 @@ void XttFast::fast_scan( void *data)
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
;
}
xtt/lib/xtt/src/xtt_fast.h
View file @
30443e8e
...
...
@@ -105,15 +105,23 @@ class XttFast {
char
*
xn_name
,
pwr_sAttrRef
*
fast_arp
,
int
*
sts
);
XttFast
(
void
*
parent_ctx
,
const
char
*
name
,
char
*
filename
,
int
*
sts
);
//! Destructor
virtual
~
XttFast
();
//! Pop fast window.
void
pop
();
void
setup
();
int
read_export
(
char
*
filename
);
static
void
fast_close_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
);
};
...
...
xtt/lib/xtt/src/xtt_sevhist.cpp
View file @
30443e8e
...
...
@@ -113,7 +113,7 @@ XttSevHist::XttSevHist( void *parent_ctx,
get_select_cb
(
0
),
first_scan
(
1
),
scctx
(
0
),
time_low_old
(
0
),
time_high_old
(
0
)
{
strncpy
(
title
,
filename
,
sizeof
(
title
));
*
sts
=
read_export
(
filename
);
}
...
...
@@ -696,7 +696,7 @@ void XttSevHist::pop()
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
)
...
...
xtt/lib/xtt/src/xtt_xnav.h
View file @
30443e8e
...
...
@@ -352,7 +352,8 @@ class XNav {
pwr_tOName
*
oname
,
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
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
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
,
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
CLog
*
clog_new
(
const
char
*
name
,
pwr_tStatus
*
sts
)
{
return
0
;}
...
...
xtt/lib/xtt/src/xtt_xnav_command.cpp
View file @
30443e8e
...
...
@@ -4193,7 +4193,8 @@ static int xnav_open_func( void *client_data,
unsigned
int
options
=
0
;
int
width
,
height
,
nr
;
char
tmp_str
[
40
];
pwr_tFileName
file_str
;
// Command is "OPEN FAST"
if
(
ODD
(
dcli_get_qualifier
(
"/FULLSCREEN"
,
0
,
0
)))
...
...
@@ -4227,6 +4228,18 @@ static int xnav_open_func( void *client_data,
else
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 */
if
(
ODD
(
dcli_get_qualifier
(
"dcli_arg2"
,
name_str
,
sizeof
(
name_str
))))
{
...
...
@@ -4274,7 +4287,7 @@ static int xnav_open_func( void *client_data,
}
if
(
EVEN
(
dcli_get_qualifier
(
"/TITLE"
,
title_str
,
sizeof
(
title_str
))))
{
strcpy
(
title_str
,
"
Fast
"
);
strcpy
(
title_str
,
""
);
}
XttFast
*
fast
;
...
...
@@ -4282,7 +4295,7 @@ static int xnav_open_func( void *client_data,
fast
->
pop
();
}
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
))
xnav
->
message
(
'E'
,
"Error in fast configuration"
);
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment