Commit c5ae65ac authored by claes's avatar claes

Help callback in curve window

parent 409440f4
/* /*
* Proview $Id: ge_curve.cpp,v 1.7 2005-11-14 16:18:32 claes Exp $ * Proview $Id: ge_curve.cpp,v 1.8 2005-11-17 09:03:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -188,6 +188,8 @@ static void gec_activate_xlimits( Widget w, GeCurve *curve, ...@@ -188,6 +188,8 @@ static void gec_activate_xlimits( Widget w, GeCurve *curve,
static void gec_activate_help( Widget w, GeCurve *curve, XmAnyCallbackStruct *data) static void gec_activate_help( Widget w, GeCurve *curve, XmAnyCallbackStruct *data)
{ {
if ( curve->help_cb)
(curve->help_cb)( curve->parent_ctx);
} }
static void gec_create_pane( Widget w, GeCurve *curve, XmAnyCallbackStruct *data) static void gec_create_pane( Widget w, GeCurve *curve, XmAnyCallbackStruct *data)
...@@ -898,7 +900,7 @@ GeCurve::GeCurve( void *gc_parent_ctx, ...@@ -898,7 +900,7 @@ GeCurve::GeCurve( void *gc_parent_ctx,
border_dark(glow_eDrawType_Color28), border_dark(glow_eDrawType_Color28),
border_bright(glow_eDrawType_Color22), border_bright(glow_eDrawType_Color22),
cd(0), axis_window_width(0), auto_refresh(1), axis_displayed(1), cd(0), axis_window_width(0), auto_refresh(1), axis_displayed(1),
minmax_idx(0), close_cb(0), initial_right_position(pos_right) minmax_idx(0), close_cb(0), help_cb(0), initial_right_position(pos_right)
{ {
char uid_filename[120] = {"xtt_curve.uid"}; char uid_filename[120] = {"xtt_curve.uid"};
char *uid_filename_p = uid_filename; char *uid_filename_p = uid_filename;
...@@ -1251,7 +1253,7 @@ void GeCurveData::scale( int axis_type, int value_type, ...@@ -1251,7 +1253,7 @@ void GeCurveData::scale( int axis_type, int value_type,
minval = i_value; minval = i_value;
min_lines = abs(i_value); min_lines = abs(i_value);
} }
else if ( max_value - min_value < 3000) { else if ( max_value - min_value < 1000) {
i_value = int(max_value/10) * 10 + 10; i_value = int(max_value/10) * 10 + 10;
maxval = i_value; maxval = i_value;
max_lines = i_value / 10; max_lines = i_value / 10;
...@@ -1263,6 +1265,18 @@ void GeCurveData::scale( int axis_type, int value_type, ...@@ -1263,6 +1265,18 @@ void GeCurveData::scale( int axis_type, int value_type,
minval = i_value; minval = i_value;
min_lines = abs(i_value) / 10; min_lines = abs(i_value) / 10;
} }
else if ( max_value - min_value < 3000) {
i_value = int(max_value/50) * 50 + 50;
maxval = i_value;
max_lines = i_value / 50;
if ( fabs( min_value) < DBL_EPSILON)
i_value = 0;
else
i_value = int(min_value/50) * 50 - 50;
minval = i_value;
min_lines = abs(i_value) / 50;
}
else if ( max_value - min_value < 10000) { else if ( max_value - min_value < 10000) {
i_value = int(max_value/100) * 100 + 100; i_value = int(max_value/100) * 100 + 100;
maxval = i_value; maxval = i_value;
...@@ -1322,7 +1336,7 @@ void GeCurveData::scale( int axis_type, int value_type, ...@@ -1322,7 +1336,7 @@ void GeCurveData::scale( int axis_type, int value_type,
format_type = 1; format_type = 1;
} }
else { else {
i_value = int(max_value/600) * 3600 + 3600; i_value = int(max_value/3600) * 3600 + 3600;
maxval = i_value; maxval = i_value;
max_lines = i_value / 3600; max_lines = i_value / 3600;
...@@ -1332,8 +1346,8 @@ void GeCurveData::scale( int axis_type, int value_type, ...@@ -1332,8 +1346,8 @@ void GeCurveData::scale( int axis_type, int value_type,
i_value = int(min_value/3600) * 3600 - 3600; i_value = int(min_value/3600) * 3600 - 3600;
minval = i_value; minval = i_value;
min_lines = abs(i_value) / 3600; min_lines = abs(i_value) / 3600;
axlinequot = 2; axlinequot = 2 * int((max_value - min_value)/140000);
axvaluequot = 2; axvaluequot = 2 * int((max_value - min_value)/140000);
format_type = 2; format_type = 2;
} }
} }
......
/* /*
* Proview $Id: ge_curve.h,v 1.6 2005-11-14 16:18:32 claes Exp $ * Proview $Id: ge_curve.h,v 1.7 2005-11-17 09:03:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -133,6 +133,7 @@ class GeCurve { ...@@ -133,6 +133,7 @@ class GeCurve {
int axis_displayed; int axis_displayed;
int minmax_idx; int minmax_idx;
void (*close_cb)( void *); void (*close_cb)( void *);
void (*help_cb)( void *);
int initial_right_position; int initial_right_position;
char title[300]; char title[300];
......
/* /*
* Proview $Id: xtt_fast.cpp,v 1.5 2005-11-14 16:15:02 claes Exp $ * Proview $Id: xtt_fast.cpp,v 1.6 2005-11-17 09:03:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -60,6 +60,7 @@ extern "C" { ...@@ -60,6 +60,7 @@ extern "C" {
} }
static void fast_close_cb( void *ctx); static void fast_close_cb( void *ctx);
static void fast_help_cb( void *ctx);
static void fast_scan( XttFast *fast); static void fast_scan( XttFast *fast);
XttFast::XttFast( XttFast::XttFast(
...@@ -69,7 +70,7 @@ XttFast::XttFast( ...@@ -69,7 +70,7 @@ XttFast::XttFast(
Widget *w, Widget *w,
pwr_sAttrRef *fast_arp, pwr_sAttrRef *fast_arp,
int *sts) : int *sts) :
xnav(parent_ctx), parent_widget(parent_wid), fast_cnt(0), close_cb(0), first_scan(1), xnav(parent_ctx), parent_widget(parent_wid), fast_cnt(0), close_cb(0), help_cb(0), first_scan(1),
axis_configured(false) axis_configured(false)
{ {
pwr_sAttrRef aref = pwr_cNAttrRef; pwr_sAttrRef aref = pwr_cNAttrRef;
...@@ -201,6 +202,7 @@ XttFast::XttFast( ...@@ -201,6 +202,7 @@ XttFast::XttFast(
cdh_StrncpyCutOff( title, name, sizeof(title), 1); cdh_StrncpyCutOff( title, name, sizeof(title), 1);
curve = new GeCurve( this, parent_widget, title, NULL, gcd, 0); curve = new GeCurve( this, parent_widget, title, NULL, gcd, 0);
curve->close_cb = fast_close_cb; curve->close_cb = fast_close_cb;
curve->help_cb = fast_help_cb;
// timerid = XtAppAddTimeOut( // timerid = XtAppAddTimeOut(
// XtWidgetToApplicationContext(parent_widget), 1000, // XtWidgetToApplicationContext(parent_widget), 1000,
...@@ -232,6 +234,14 @@ static void fast_close_cb( void *ctx) ...@@ -232,6 +234,14 @@ static void fast_close_cb( void *ctx)
delete fast; delete fast;
} }
static void fast_help_cb( void *ctx)
{
XttFast *fast = (XttFast *) ctx;
if ( fast->help_cb)
(fast->help_cb)( fast->xnav, "fastwindow");
}
void fast_scan( XttFast *fast) void fast_scan( XttFast *fast)
{ {
int i, j, k; int i, j, k;
......
/* /*
* Proview $Id: xtt_fast.h,v 1.3 2005-09-01 14:57:48 claes Exp $ * Proview $Id: xtt_fast.h,v 1.4 2005-11-17 09:03:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -82,6 +82,7 @@ class XttFast { ...@@ -82,6 +82,7 @@ class XttFast {
int max_points; //!< Max number of points in curves. int max_points; //!< Max number of points in curves.
XtIntervalId timerid; //!< Time id for scan. XtIntervalId timerid; //!< Time id for scan.
void (*close_cb)( void *, XttFast *); //!< Close callback to parent. void (*close_cb)( void *, XttFast *); //!< Close callback to parent.
void (*help_cb)( void *, char *); //!< Open help window.
pwr_tBoolean old_new; //!< Old value of new. Used to detect edge of New. pwr_tBoolean old_new; //!< Old value of new. Used to detect edge of New.
pwr_tMask fast_function; //!< Function configured in DsFastCurve object. pwr_tMask fast_function; //!< Function configured in DsFastCurve object.
bool first_scan; //!< Indicates that this is the first scan. bool first_scan; //!< Indicates that this is the first scan.
......
/* /*
* Proview $Id: xtt_trend.cpp,v 1.6 2005-11-14 16:14:55 claes Exp $ * Proview $Id: xtt_trend.cpp,v 1.7 2005-11-17 09:03:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -59,6 +59,7 @@ extern "C" { ...@@ -59,6 +59,7 @@ extern "C" {
} }
static void trend_close_cb( void *ctx); static void trend_close_cb( void *ctx);
static void trend_help_cb( void *ctx);
static void trend_scan( XttTrend *trend); static void trend_scan( XttTrend *trend);
XttTrend::XttTrend( XttTrend::XttTrend(
...@@ -69,7 +70,7 @@ XttTrend::XttTrend( ...@@ -69,7 +70,7 @@ XttTrend::XttTrend(
pwr_sAttrRef *trend_list, pwr_sAttrRef *trend_list,
pwr_sAttrRef *plotgroup, pwr_sAttrRef *plotgroup,
int *sts) : int *sts) :
xnav(parent_ctx), parent_widget(parent_wid), trend_cnt(0), close_cb(0) xnav(parent_ctx), parent_widget(parent_wid), trend_cnt(0), close_cb(0), help_cb(0)
{ {
pwr_sAttrRef *aref_list; pwr_sAttrRef *aref_list;
pwr_sAttrRef *aref_p; pwr_sAttrRef *aref_p;
...@@ -268,6 +269,7 @@ XttTrend::XttTrend( ...@@ -268,6 +269,7 @@ XttTrend::XttTrend(
curve = new GeCurve( this, parent_widget, name, NULL, gcd, 1); curve = new GeCurve( this, parent_widget, name, NULL, gcd, 1);
curve->close_cb = trend_close_cb; curve->close_cb = trend_close_cb;
curve->help_cb = trend_help_cb;
timerid = XtAppAddTimeOut( timerid = XtAppAddTimeOut(
XtWidgetToApplicationContext(parent_widget), 1000, XtWidgetToApplicationContext(parent_widget), 1000,
...@@ -299,6 +301,14 @@ static void trend_close_cb( void *ctx) ...@@ -299,6 +301,14 @@ static void trend_close_cb( void *ctx)
delete trend; delete trend;
} }
static void trend_help_cb( void *ctx)
{
XttTrend *trend = (XttTrend *) ctx;
if ( trend->help_cb)
(trend->help_cb)( trend->xnav, "trendwindow");
}
static void trend_scan( XttTrend *trend) static void trend_scan( XttTrend *trend)
{ {
int i, j, k; int i, j, k;
......
/* /*
* Proview $Id: xtt_trend.h,v 1.3 2005-09-01 14:57:48 claes Exp $ * Proview $Id: xtt_trend.h,v 1.4 2005-11-17 09:03:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -63,6 +63,7 @@ class XttTrend { ...@@ -63,6 +63,7 @@ class XttTrend {
int last_buffer[XTT_TREND_MAX]; int last_buffer[XTT_TREND_MAX];
int last_next_index[XTT_TREND_MAX]; int last_next_index[XTT_TREND_MAX];
void (*close_cb)( void *, XttTrend *); void (*close_cb)( void *, XttTrend *);
void (*help_cb)( void *, char *);
void pop(); void pop();
~XttTrend(); ~XttTrend();
}; };
......
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