Commit 683a976b authored by Claes Sjofors's avatar Claes Sjofors

Xtt curve window, colortheme added

parent 6cbb72b6
......@@ -749,9 +749,10 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
int pos_right,
int gc_width,
int gc_height,
unsigned int gc_options) :
unsigned int gc_options,
int gc_color_theme) :
GeCurve( gc_parent_ctx, curve_name, filename, curve_data, pos_right,
gc_width, gc_height, gc_options),
gc_width, gc_height, gc_options, gc_color_theme),
minmax_widget(0), export_widget(0), disable_timecombo_callback(0), clock_cursor(0)
{
......
......@@ -49,7 +49,7 @@ class GeCurveGtk : public GeCurve {
public:
GeCurveGtk( void *gc_parent_ctx, GtkWidget *parent_widget, char *curve_name,
char *filename, GeCurveData *curve_data, int pos_right,
int gc_width, int gc_height, unsigned int gc_options);
int gc_width, int gc_height, unsigned int gc_options, int gc_color_theme);
GtkWidget *parent_wid;
GtkWidget *grow_widget;
GtkWidget *curve_widget;
......
......@@ -530,6 +530,7 @@ int GeCurve::init_growcurve_cb( GlowCtx *fctx, void *client_data)
{
grow_sAttributes grow_attr;
unsigned long mask;
char path[2][80] = {"$pwrp_exe/", "$pwr_exe/"};
GeCurve *curve = (GeCurve *) client_data;
curve->growcurve_ctx = (CurveCtx *) fctx;
......@@ -545,6 +546,8 @@ int GeCurve::init_growcurve_cb( GlowCtx *fctx, void *client_data)
mask |= grow_eAttr_initial_position;
grow_attr.initial_position = glow_eDirection_Right;
}
mask |= grow_eAttr_color_theme;
strcpy( grow_attr.color_theme, "$default");
grow_SetAttributes( curve->growcurve_ctx, &grow_attr, mask);
grow_SetCtxUserData( curve->growcurve_ctx, curve);
......@@ -576,13 +579,23 @@ int GeCurve::init_growcurve_cb( GlowCtx *fctx, void *client_data)
grow_EnableEvent( (GrowCtx *)curve->growcurve_ctx, glow_eEvent_ScrollDown,
glow_eEventType_CallBack, growcurve_cb);
grow_SetPath( curve->growcurve_ctx, 2, (char *)path);
grow_ReadCustomColorFile( curve->growcurve_ctx, 0);
grow_SetBackgroundColor( curve->growcurve_ctx, glow_eCtColor_Background);
grow_CreateGrowCurve( curve->growcurve_ctx, "curve", NULL, 0, 0, 200, 30,
curve->curve_border, 2, glow_mDisplayLevel_1, 1, 1,
curve->curve_color, curve, &curve->curve_object);
grow_SetObjectOriginalFillColor( curve->curve_object, glow_eCtColor_DiagramFillcolor);
grow_SetObjectOriginalBorderColor( curve->curve_object, glow_eCtColor_DiagramBordercolor);
grow_CreateGrowAxis( curve->growcurve_ctx, "y_axis", 0, 30, 200, 31.85,
glow_eDrawType_Line, 1, 5,
glow_eDrawType_TextHelvetica, curve,
&curve->curve_axisobject);
grow_SetObjectOriginalBorderColor( curve->curve_axisobject, glow_eCtColor_AxisBordercolor);
grow_SetObjectOriginalTextColor( curve->curve_axisobject, glow_eCtColor_BackgroundTextAndLines);
grow_tNodeClass nc;
grow_CreateNodeClass( curve->growcurve_ctx, "MarkNc", glow_eNodeGroup_Common, &nc);
......@@ -698,9 +711,9 @@ int GeCurve::grownames_cb( GlowCtx *ctx, glow_tEvent event)
}
curve->hide[i] = !curve->hide[i];
if ( curve->hide[i])
color = glow_eDrawType_LineErase;
color = glow_eCtColor_Background;
else
color = glow_eDrawType_Line;
color = glow_eCtColor_BackgroundTextAndLines;
grow_SetObjectBorderColor( curve->hide_l1[i], color);
grow_SetObjectBorderColor( curve->hide_l2[i], color);
......@@ -792,6 +805,8 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
grow_attr.grid_on = 0;
mask |= grow_eAttr_hot_mode;
grow_attr.hot_mode = glow_eHotMode_TraceAction;
mask |= grow_eAttr_color_theme;
strcpy( grow_attr.color_theme, "$default");
grow_SetAttributes( curve->grownames_ctx, &grow_attr, mask);
grow_SetCtxUserData( curve->grownames_ctx, curve);
......@@ -814,139 +829,155 @@ int GeCurve::config_names()
grow_tObject t1;
glow_eDrawType color;
double x;
double x, y;
grow_sAttributes grow_attr;
unsigned long mask;
char path[2][80] = {"$pwrp_exe/", "$pwr_exe/"};
int date = (strcmp( cd->x_format[0], "%10t") == 0 ||
strcmp( cd->x_format[0], "%11t") == 0) ? 1 : 0;
int time_size;
if ( date)
time_size = 7;
time_size = 9;
else
time_size = 3;
// Create nodeclass for mark values
grow_New( grownames_ctx);
mask = grow_eAttr_color_theme;
strcpy( grow_attr.color_theme, "$default");
grow_SetAttributes( grownames_ctx, &grow_attr, mask);
grow_SetPath( grownames_ctx, 2, (char *)path);
grow_ReadCustomColorFile( grownames_ctx, 0);
grow_SetBackgroundColor( grownames_ctx, glow_eCtColor_Background);
grow_tNodeClass nc;
grow_CreateNodeClass( grownames_ctx, "MarkVal", glow_eNodeGroup_Common, &nc);
grow_AddRect( nc, "", 0, 0, time_size, 0.75, glow_eDrawType_LineGray, 1, 0,
grow_AddRect( nc, "", 0, 0, time_size, 0.75, glow_eCtColor_Background, 1, 0,
glow_mDisplayLevel_1, 0, 0, 0,
glow_eDrawType_Line, NULL);
grow_AddAnnot( nc, 0.2, 0.7, 0, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line,
2, glow_eAnnotType_OneLine, 0, glow_mDisplayLevel_1, NULL);
glow_eCtColor_BackgroundTextAndLines,
3, glow_eAnnotType_OneLine, 0, glow_mDisplayLevel_1, NULL);
// Draw header
grow_tObject o1;
grow_CreateGrowLine( grownames_ctx, "", 0, 0.75, 60, 0.75,
glow_eDrawType_Color34, 2, 0, NULL, &o1);
grow_CreateGrowRect( grownames_ctx, "", 0, 0, 60, 0.8,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1);
// grow_CreateGrowLine( grownames_ctx, "", 0, 0.75, 60, 0.75,
// glow_eDrawType_Color34, 2, 0, NULL, &o1);
y = 0;
grow_CreateGrowRect( grownames_ctx, "", 0, y, 60, y + 0.9,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 0, 0,
glow_eCtColor_AreaDelimiter, NULL, &o1);
x = 0.8;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("View"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
x += 1.8;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Cursor"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
x += time_size + 0.2;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Mark 1"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
// TODO
x += time_size + 0.2;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Mark 2"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
x += time_size + 0.2;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Unit"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
x += 2;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Scale"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
if ( options & curve_mOptions_ShowDescrFirst) {
x += 3;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Description"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
x += 14;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Attribute"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
}
else {
x += 3;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Attribute"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
x += 14;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Description"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.6, glow_eDrawType_TextHelvetica,
glow_eCtColor_AreaDelimiterTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
}
y += 1;
for ( int i = 0; i < cd->cols; i++) {
// Draw shadowed frame
grow_CreateGrowRect( grownames_ctx, "", 0, (i+0.8), 60, 1,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1);
grow_CreateGrowLine( grownames_ctx, "", 0, y + 1, 60, y + 1,
glow_eCtColor_LineDelimiter, 1, 0, NULL, &o1);
// Draw color rectangle
grow_CreateGrowRect( grownames_ctx, "", 0.25, (i+0.8)+0.3, 0.75, 0.5,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
grow_CreateGrowRect( grownames_ctx, "", 0.25, y + 0.3, 0.75, 0.5,
glow_eCtColor_IndicatorBorderColor, 1, 0, glow_mDisplayLevel_1, 1, 1, 0,
cd->color[i], NULL, &name_rect[i]);
if ( hide[i])
color = glow_eDrawType_LineErase;
color = glow_eCtColor_Background;
else
color = glow_eDrawType_Line;
color = glow_eCtColor_BackgroundTextAndLines;
// Draw checkbox for hide
grow_CreateGrowLine( grownames_ctx, "", 1.4, (i+0.8)+0.45, 1.52, (i+0.8)+0.75,
grow_CreateGrowLine( grownames_ctx, "", 1.4, y + 0.45, 1.52, y + 0.75,
color, 2, 0, NULL, &hide_l1[i]);
grow_CreateGrowLine( grownames_ctx, "", 1.50, (i+0.8)+0.75, 1.77, (i+0.8)+0.35,
grow_CreateGrowLine( grownames_ctx, "", 1.50, y + 0.75, 1.77, y + 0.35,
color, 2, 0, NULL, &hide_l2[i]);
grow_CreateGrowRect( grownames_ctx, "", 1.3, (i+0.8)+0.3, 0.5, 0.5,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 1, 1,
glow_eDrawType_Color32, NULL, &hide_rect[i]);
grow_CreateGrowRect( grownames_ctx, "", 1.3, y + 0.3, 0.5, 0.5,
color, 1, 0, glow_mDisplayLevel_1, 0, 1, 0,
glow_eCtColor_Background, NULL, &hide_rect[i]);
// Draw nodes for mark and cursor values
x = 2.2;
grow_CreateGrowNode( grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL,
grow_CreateGrowNode( grownames_ctx, "", nc, x, y + 0.05, NULL,
&cursor_annot[i]);
x += time_size + 0.2;
grow_CreateGrowNode( grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL,
grow_CreateGrowNode( grownames_ctx, "", nc, x, y + 0.05, NULL,
&mark1_annot[i]);
// TODO
x += time_size + 0.2;
grow_CreateGrowNode( grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL,
grow_CreateGrowNode( grownames_ctx, "", nc, x, y + 0.05, NULL,
&mark2_annot[i]);
// Draw unit
x += time_size + 0.6;
if ( strcmp( cd->y_unit[i], "") == 0)
strcpy( cd->y_unit[i], " ");
grow_CreateGrowText( grownames_ctx, "", cd->y_unit[i],
x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.75, glow_eDrawType_TextHelvetica,
glow_eCtColor_BackgroundTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1);
// Draw button for scale
x += 2;
grow_CreateGrowRect( grownames_ctx, "", x, (i+0.8)+0.1, 1.2, 0.7,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eDrawType_Color33, NULL, &scale_rect[i]);
grow_CreateGrowRect( grownames_ctx, "", x, y + 0.1, 1.2, 0.7,
glow_eCtColor_ButtonBordercolor, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eCtColor_ButtonFillcolor, NULL, &scale_rect[i]);
grow_SetObjectShadowWidth( scale_rect[i], 20);
// Draw attribute name
if ( options & curve_mOptions_ShowDescrFirst) {
......@@ -955,12 +986,12 @@ int GeCurve::config_names()
x += 3;
if ( strcmp( cd->y_description[i], "") != 0) {
grow_CreateGrowText( grownames_ctx, "", cd->y_description[i],
x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.75, glow_eDrawType_TextHelvetica,
glow_eCtColor_BackgroundTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1);
grow_GetTextExtent( grownames_ctx, cd->y_name[i], strlen(cd->y_name[i]),
glow_eDrawType_TextHelvetica, 2, glow_eFont_LucidaSans, &w, &h, &descent);
glow_eDrawType_TextHelvetica, 3, glow_eFont_LucidaSans, &w, &h, &descent);
if ( w < 13)
x += 14;
else
......@@ -970,30 +1001,30 @@ int GeCurve::config_names()
x += 14;
grow_CreateGrowText( grownames_ctx, "", cd->y_name[i],
x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.75, glow_eDrawType_TextHelvetica,
glow_eCtColor_BackgroundTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1);
}
else {
x += 3;
grow_CreateGrowText( grownames_ctx, "", cd->y_name[i],
x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.75, glow_eDrawType_TextHelvetica,
glow_eCtColor_BackgroundTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1);
if ( strcmp( cd->y_description[i], "") != 0) {
double w, h, descent;
grow_GetTextExtent( grownames_ctx, cd->y_name[i], strlen(cd->y_name[i]),
glow_eDrawType_TextHelvetica, 2, glow_eFont_LucidaSans, &w, &h, &descent);
glow_eDrawType_TextHelvetica, 3, glow_eFont_LucidaSans, &w, &h, &descent);
if ( w < 13)
x += 14;
else
x += w + 1;
grow_CreateGrowText( grownames_ctx, "", cd->y_description[i],
x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.75, glow_eDrawType_TextHelvetica,
glow_eCtColor_BackgroundTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1);
}
}
......@@ -1001,39 +1032,39 @@ int GeCurve::config_names()
grow_SetAnnotation( cursor_annot[i], 0, "0", 1);
grow_SetAnnotation( mark1_annot[i], 0, "0", 1);
grow_SetAnnotation( mark2_annot[i], 0, "0", 1);
y += 1;
}
// Draw nodes for time values
// Draw shadowed frame
grow_CreateGrowRect( grownames_ctx, "", 0, (cd->cols+0.8), 60, 1,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1);
grow_CreateGrowLine( grownames_ctx, "", 0, y + 1, 60, y + 1,
glow_eCtColor_LineDelimiter, 1, 0, NULL, &o1);
x = 2.2;
grow_CreateGrowNode( grownames_ctx, "", nc, x, (cd->cols+0.8)+0.05, NULL,
grow_CreateGrowNode( grownames_ctx, "", nc, x, y + 0.05, NULL,
&cursor_annot[cd->cols]);
x += time_size + 0.2;
grow_CreateGrowNode( grownames_ctx, "", nc, x, (cd->cols+0.8)+0.05, NULL,
grow_CreateGrowNode( grownames_ctx, "", nc, x, y +0.05, NULL,
&mark1_annot[cd->cols]);
// TODO
x += time_size + 0.2;
grow_CreateGrowNode( grownames_ctx, "", nc, x, (cd->cols+0.8)+0.05, NULL,
grow_CreateGrowNode( grownames_ctx, "", nc, x, y + 0.05, NULL,
&mark2_annot[cd->cols]);
// Draw unit
x += time_size + 0.6;
grow_CreateGrowText( grownames_ctx, "", "s",
x, (cd->cols+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.75, glow_eDrawType_TextHelvetica,
glow_eCtColor_BackgroundTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1);
// Draw button for scale
x += 2;
grow_CreateGrowRect( grownames_ctx, "", x, (cd->cols+0.8)+0.1, 1.2, 0.7,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eDrawType_Color33, NULL, &scale_rect[cd->cols]);
grow_CreateGrowRect( grownames_ctx, "", x, y + 0.1, 1.2, 0.7,
glow_eCtColor_ButtonBordercolor, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eCtColor_ButtonFillcolor, NULL, &scale_rect[cd->cols]);
grow_SetObjectShadowWidth( scale_rect[cd->cols], 20);
// Draw attribute name
x += 3;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Time axis"),
x, (cd->cols+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
x, y + 0.75, glow_eDrawType_TextHelvetica,
glow_eCtColor_BackgroundTextAndLines, 3, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1);
grow_SetAnnotation( cursor_annot[cd->cols], 0, "0", 1);
grow_SetAnnotation( mark1_annot[cd->cols], 0, "0", 1);
......@@ -1082,12 +1113,25 @@ int GeCurve::configure_axes()
{
double x = 0;
int i, idx;
grow_sAttributes grow_attr;
unsigned long mask;
char path[2][80] = {"$pwrp_exe/", "$pwr_exe/"};
if ( !cd)
return 0;
grow_SetNodraw( growaxis_ctx);
grow_New( growaxis_ctx);
mask = grow_eAttr_color_theme;
strcpy( grow_attr.color_theme, "$default");
grow_SetAttributes( growaxis_ctx, &grow_attr, mask);
grow_SetPath( growaxis_ctx, 2, (char *)path);
grow_ReadCustomColorFile( growaxis_ctx, 0);
grow_SetBackgroundColor( growaxis_ctx, glow_eCtColor_Background);
memset( axis_object, 0, sizeof( axis_object));
for ( i = 0; i < cd->cols; i++) {
......@@ -1526,17 +1570,19 @@ GeCurve::GeCurve( void *gc_parent_ctx,
int pos_right,
int gc_width,
int gc_height,
unsigned int gc_options) :
parent_ctx(gc_parent_ctx), growcurve_ctx(0), background_dark(glow_eDrawType_Color29),
unsigned int gc_options,
int gc_color_theme) :
parent_ctx(gc_parent_ctx), growcurve_ctx(0), background_dark(glow_eCtColor_DiagramFillcolor),
background_bright(glow_eDrawType_Color21),
border_dark(glow_eDrawType_Color28),
border_dark(glow_eCtColor_DiagramBordercolor),
border_bright(glow_eDrawType_Color22),
cd(0), axis_window_width(0), auto_refresh(1), axis_displayed(1),
minmax_idx(0), close_cb(0), help_cb(0), increase_period_cb(0), decrease_period_cb(0), reload_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),
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), layout_mask(0)
deferred_configure_axes(0), center_from_window(0), options(gc_options), layout_mask(0),
color_theme(gc_color_theme)
{
pwr_tStatus sts;
......@@ -1566,6 +1612,10 @@ GeCurve::GeCurve( void *gc_parent_ctx,
cd = curve_data;
cd->select_color( curve_color == background_dark);
}
char color_theme_file[80];
sprintf( color_theme_file, "pwr_colortheme%d", color_theme);
grow_SetDefaultColorTheme( color_theme_file);
}
GeCurveData::GeCurveData( curve_eDataType datatype) :
......@@ -2247,3 +2297,25 @@ void GeCurve::x_to_points( double x, double *t, double *values)
}
}
}
void GeCurve::update_color_theme( int ct)
{
char color_theme_file[80];
int sts;
sprintf( color_theme_file, "pwr_colortheme%d", ct);
sts = grow_ReadCustomColorFile( grownames_ctx, color_theme_file);
if ( EVEN(sts)) return;
sts = grow_ReadCustomColorFile( growcurve_ctx, color_theme_file);
if ( EVEN(sts)) return;
sts = grow_ReadCustomColorFile( growaxis_ctx, color_theme_file);
if ( EVEN(sts)) return;
grow_SetDefaultColorTheme( color_theme_file);
color_theme = ct;
}
......@@ -208,10 +208,11 @@ class GeCurve {
int center_from_window;
unsigned int options;
unsigned int layout_mask;
int color_theme;
GeCurve( void *gc_parent_ctx, char *curve_name,
char *filename, GeCurveData *curve_data, int pos_right,
int gc_width, int gc_height, unsigned int options);
int gc_width, int gc_height, unsigned int options, int color_theme);
virtual ~GeCurve();
virtual void write_title( char *str) {}
virtual void pop() {}
......@@ -261,6 +262,7 @@ class GeCurve {
void x_to_points( double x, double *time, double *values);
void set_center_from_window( int val) { center_from_window = val;}
void set_title( const char *str);
void update_color_theme( int ct);
static int growcurve_cb( GlowCtx *ctx, glow_tEvent event);
static int init_growcurve_cb( GlowCtx *fctx, void *client_data);
......
......@@ -637,7 +637,7 @@ GlowDrawGtk::GlowDrawGtk(
original_background = background;
if ( type == glow_eCtxType_Grow) {
if ( type == glow_eCtxType_Grow || type == glow_eCtxType_Curve) {
ctx->customcolors = create_customcolors();
push_customcolors( ctx->customcolors);
}
......
......@@ -1637,7 +1637,8 @@ int GrowCtx::event_handler( glow_eEvent event, int x, int y, int w, int h)
e.any.y = double (y + mw.offset_y) / mw.zoom_factor_y;
e.object.object = restriction_object;
e.object.object_type = restriction_object->type();
event_callback[glow_eEvent_SliderMoveEnd]( this, &e);
if ( event_callback[glow_eEvent_SliderMoveEnd])
event_callback[glow_eEvent_SliderMoveEnd]( this, &e);
}
node_move_last_x = x;
node_move_last_y = y;
......
......@@ -70,8 +70,9 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
int width,
int height,
unsigned int options,
int xn_color_theme,
int *sts) :
XttFast( parent_ctx, name, fast_arp, sts), parent_widget(parent_wid)
XttFast( parent_ctx, name, fast_arp, xn_color_theme, sts), parent_widget(parent_wid)
{
char title[250];
......@@ -86,7 +87,7 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
gdh_AttrrefToName( fast_arp, title, sizeof(title), cdh_mNName);
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 0, width, height,
options);
options, color_theme);
curve->close_cb = fast_close_cb;
curve->help_cb = fast_help_cb;
curve->export_cb = fast_export_cb;
......@@ -103,8 +104,9 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
const char *name,
GtkWidget **w,
char *filename,
int xn_color_theme,
int *sts) :
XttFast( parent_ctx, name, filename, sts),
XttFast( parent_ctx, name, filename, xn_color_theme, sts),
parent_widget(parent_wid)
{
char title[250];
......@@ -116,7 +118,7 @@ XttFastGtk::XttFastGtk( void *parent_ctx,
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1, 0, 0, 0);
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1, 0, 0, 0, color_theme);
curve->close_cb = fast_close_cb;
curve->help_cb = fast_help_cb;
curve->enable(0);
......
......@@ -55,12 +55,14 @@ class XttFastGtk : public XttFast {
int width,
int height,
unsigned int xn_options,
int xn_color_theme,
int *sts);
XttFastGtk( void *parent_ctx,
GtkWidget *parent_wid,
const char *name,
GtkWidget **w,
char *filename,
int xn_color_theme,
int *sts);
~XttFastGtk();
};
......
......@@ -495,13 +495,15 @@ XttMultiViewGtk::XttMultiViewGtk( GtkWidget *mv_parent_wid, void *mv_parent_ctx,
if ( plotgroup_found) {
trend[i*rows + j] = new XttTrendGtk( this, toplevel, (char *)"No title", &widget,
0, &plotgroup, w, h, (unsigned int)curve_mOptions_Embedded, sts);
0, &plotgroup, w, h, (unsigned int)curve_mOptions_Embedded,
color_theme, sts);
}
else {
arefv[0] = mv.Action[i*rows+j].Object[0];
memset( &arefv[1], 0, sizeof(arefv[0]));
trend[i*rows + j] = new XttTrendGtk( this, toplevel, (char *)"No title", &widget,
arefv, 0, w, h, (unsigned int)curve_mOptions_Embedded, sts);
arefv, 0, w, h, (unsigned int)curve_mOptions_Embedded,
color_theme, sts);
}
if ( EVEN(*sts)) break;
......@@ -696,9 +698,9 @@ XttMultiViewGtk::XttMultiViewGtk( GtkWidget *mv_parent_wid, void *mv_parent_ctx,
if ( EVEN(lsts)) break;
sevhist[i*rows + j] = new XttSevHistGtk( this, toplevel, (char *)"No title", &widget,
oidv, anamev, onamev, sevhistobjectv,
xnav->scctx, w, h,
(unsigned int)curve_mOptions_Embedded, sts);
oidv, anamev, onamev, sevhistobjectv,
xnav->scctx, w, h,
(unsigned int)curve_mOptions_Embedded, color_theme, sts);
if ( EVEN(*sts)) break;
sevhist[i*rows + j]->help_cb = multiview_trend_help_cb;
......@@ -1058,13 +1060,15 @@ int XttMultiViewGtk::set_subwindow_source( const char *name, char *source, char
XttTrendGtk *ctx;
if ( plotgroup_found) {
ctx = new XttTrendGtk( this, toplevel, (char *)"No title", &comp_w,
0, &plotgroup, w, h, (unsigned int)curve_mOptions_Embedded, &lsts);
0, &plotgroup, w, h, (unsigned int)curve_mOptions_Embedded,
color_theme, &lsts);
}
else {
arefv[0] = object_aref;
memset( &arefv[1], 0, sizeof(arefv[0]));
ctx = new XttTrendGtk( this, toplevel, (char *)"No title", &comp_w,
arefv, 0, w, h, (unsigned int)curve_mOptions_Embedded, &lsts);
arefv, 0, w, h, (unsigned int)curve_mOptions_Embedded,
color_theme, &lsts);
}
if ( EVEN(lsts)) break;
......@@ -1258,7 +1262,7 @@ int XttMultiViewGtk::set_subwindow_source( const char *name, char *source, char
ctx = new XttSevHistGtk( this, toplevel, (char *)"No title", &comp_w,
oidv, anamev, onamev, sevhistobjectv,
xnav->scctx, w, h,
(unsigned int)curve_mOptions_Embedded, &lsts);
(unsigned int)curve_mOptions_Embedded, color_theme, &lsts);
if ( EVEN(lsts)) break;
ctx->help_cb = multiview_trend_help_cb;
......
......@@ -73,8 +73,9 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
int xn_width,
int xn_height,
unsigned int xn_options,
int xn_color_theme,
int *sts) :
XttSevHist( parent_ctx, name, xn_oidv, xn_anamev, xn_onamev, sevhistobjectv, xn_scctx, sts),
XttSevHist( parent_ctx, name, xn_oidv, xn_anamev, xn_onamev, sevhistobjectv, xn_scctx, xn_color_theme, sts),
parent_widget(parent_wid)
{
char title[250];
......@@ -87,7 +88,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1,
xn_width, xn_height, xn_options);
xn_width, xn_height, xn_options, color_theme);
curve->close_cb = sevhist_close_cb;
curve->help_cb = sevhist_help_cb;
curve->increase_period_cb = sevhist_increase_period_cb;
......@@ -116,8 +117,9 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
const char *name,
GtkWidget **w,
char *filename,
int xn_color_theme,
int *sts) :
XttSevHist( parent_ctx, name, filename, sts),
XttSevHist( parent_ctx, name, filename, xn_color_theme, sts),
parent_widget(parent_wid)
{
char title[250];
......@@ -129,7 +131,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1, 0, 0, 0);
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1, 0, 0, 0, color_theme);
curve->close_cb = sevhist_close_cb;
curve->help_cb = sevhist_help_cb;
curve->enable(0);
......
......@@ -59,12 +59,14 @@ class XttSevHistGtk : public XttSevHist {
int width,
int height,
unsigned int options,
int xn_color_theme,
int *sts);
XttSevHistGtk( void *parent_ctx,
GtkWidget *parent_wid,
const char *name,
GtkWidget **w,
char *filename,
int xn_color_theme,
int *sts);
~XttSevHistGtk();
};
......
......@@ -69,8 +69,9 @@ XttTCurveGtk::XttTCurveGtk( void *parent_ctx,
int xn_width,
int xn_height,
unsigned int xn_options,
int xn_color_theme,
int *sts) :
XttTCurve( parent_ctx, name, xn_arefv, sts),
XttTCurve( parent_ctx, name, xn_arefv, xn_color_theme, sts),
parent_widget(parent_wid)
{
char title[250];
......@@ -83,7 +84,7 @@ XttTCurveGtk::XttTCurveGtk( void *parent_ctx,
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1,
xn_width, xn_height, xn_options);
xn_width, xn_height, xn_options, color_theme);
curve->close_cb = tcurve_close_cb;
curve->help_cb = tcurve_help_cb;
curve->increase_period_cb = tcurve_increase_period_cb;
......
......@@ -55,6 +55,7 @@ class XttTCurveGtk : public XttTCurve {
int xn_width,
int xn_height,
unsigned int xn_options,
int xn_color_theme,
int *sts);
~XttTCurveGtk();
};
......
......@@ -69,8 +69,9 @@ XttTrendGtk::XttTrendGtk( void *parent_ctx,
int width,
int height,
unsigned int x_options,
int x_color_theme,
int *sts) :
XttTrend( parent_ctx, name, trend_list, plotgroup, x_options, sts),
XttTrend( parent_ctx, name, trend_list, plotgroup, x_options, x_color_theme, sts),
parent_widget(parent_wid)
{
if ( EVEN(*sts))
......@@ -78,7 +79,7 @@ XttTrendGtk::XttTrendGtk( void *parent_ctx,
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, name, NULL, gcd, 1, width, height,
options);
options, color_theme);
curve->close_cb = trend_close_cb;
curve->help_cb = trend_help_cb;
curve->snapshot_cb = trend_snapshot_cb;
......
......@@ -56,6 +56,7 @@ class XttTrendGtk : public XttTrend {
int width,
int height,
unsigned int options,
int x_color_theme,
int *sts);
~XttTrendGtk();
};
......
......@@ -275,41 +275,41 @@ Op *XNavGtk::op_new( char *opplace, pwr_tStatus *sts)
}
XttTrend *XNavGtk::xtttrend_new( char *name, pwr_tAttrRef *objar, pwr_tAttrRef *plotgroup,
int width, int height, unsigned int options, pwr_tStatus *sts)
int width, int height, unsigned int options, int color_theme, pwr_tStatus *sts)
{
GtkWidget *w;
return new XttTrendGtk( this, parent_wid, name, &w, objar, plotgroup, width, height, options, sts);
return new XttTrendGtk( this, parent_wid, name, &w, objar, plotgroup, width, height, options, color_theme, sts);
}
XttSevHist *XNavGtk::xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *anamev, pwr_tOName *onamev,
bool *sevhistobjectv, sevcli_tCtx scctx, char *filename,
int width, int height, unsigned int options, pwr_tStatus *sts)
int width, int height, unsigned int options, int color_theme, pwr_tStatus *sts)
{
GtkWidget *w;
if ( !filename)
return new XttSevHistGtk( this, parent_wid, name, &w, oidv, anamev, onamev, sevhistobjectv, scctx, width, height, options, sts);
return new XttSevHistGtk( this, parent_wid, name, &w, oidv, anamev, onamev, sevhistobjectv, scctx, width, height, options, color_theme, sts);
else
return new XttSevHistGtk( this, parent_wid, name, &w, filename, sts);
return new XttSevHistGtk( this, parent_wid, name, &w, filename, color_theme, sts);
}
XttTCurve *XNavGtk::xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options, pwr_tStatus *sts)
XttTCurve *XNavGtk::xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options, int color_theme, pwr_tStatus *sts)
{
GtkWidget *w;
return new XttTCurveGtk( this, parent_wid, name, &w, arefv, width, height, options, sts);
return new XttTCurveGtk( this, parent_wid, name, &w, arefv, width, height, options, color_theme, sts);
}
XttFast *XNavGtk::xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height,
unsigned int options, char *filename, pwr_tStatus *sts)
unsigned int options, char *filename, int color_theme, pwr_tStatus *sts)
{
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, color_theme, sts);
else
return new XttFastGtk( this, parent_wid, name, &w, filename, sts);
return new XttFastGtk( this, parent_wid, name, &w, filename, color_theme, sts);
}
XAttOne *XNavGtk::xattone_new( pwr_tAttrRef *objar, char *title, unsigned int priv,
......@@ -359,9 +359,9 @@ XttStream *XNavGtk::stream_new( const char *name, const char *uri,
}
GeCurve *XNavGtk::gecurve_new( char *name, char *filename, GeCurveData *data,
int pos_right, unsigned int options)
int pos_right, unsigned int options, int color_theme)
{
return new GeCurveGtk( this, parent_wid, name, filename, data, pos_right, 0, 0, options);
return new GeCurveGtk( this, parent_wid, name, filename, data, pos_right, 0, 0, options, color_theme);
}
XttFileview *XNavGtk::fileview_new( pwr_tOid oid, char *title, char *dir, char *pattern,
......
......@@ -77,13 +77,15 @@ class XNavGtk : public XNav {
pwr_tStatus *sts);
Op *op_new( char *opplace, pwr_tStatus *sts);
XttTrend *xtttrend_new( char *name, pwr_tAttrRef *objar, pwr_tAttrRef *plotgroup,
int width, int height, unsigned int options, pwr_tStatus *sts);
int width, int height, unsigned int options, int color_theme, pwr_tStatus *sts);
XttSevHist *xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *anamev,
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);
char *filename, int width, int height, unsigned int options, int color_theme,
pwr_tStatus *sts);
XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options,
int color_theme, pwr_tStatus *sts);
XttFast *xttfast_new( char *name, pwr_tAttrRef *objar, int width, int height, unsigned int options,
char *filename, pwr_tStatus *sts);
char *filename, int color_theme, 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);
......@@ -105,7 +107,7 @@ class XNavGtk : public XNav {
int width, int height, int x, int y, double scan_time,
unsigned int options, int embedded, pwr_tAttrRef *arp, pwr_tStatus *sts);
GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
int pos_right, unsigned int options);
int pos_right, unsigned int options, int color_theme);
XttFileview *fileview_new( pwr_tOid oid, char *title, char *dir, char *pattern,
int type, char *target_attr, char *trigger_attr, char *filetype);
CoLogin *login_new( const char *wl_name,
......
......@@ -49,7 +49,8 @@ typedef enum {
applist_eType_Hist,
applist_eType_Fast,
applist_eType_MultiView,
applist_eType_Stream
applist_eType_Stream,
applist_eType_SevHist
} applist_eType;
......
......@@ -67,9 +67,10 @@
XttFast::XttFast( void *parent_ctx,
char *name,
pwr_sAttrRef *fast_arp,
int xn_color_theme,
int *sts) :
xnav(parent_ctx), fast_cnt(0), timerid(0), close_cb(0), help_cb(0), first_scan(1),
axis_configured(false)
axis_configured(false), color_theme(xn_color_theme)
{
pwr_sAttrRef aref = pwr_cNAttrRef;
pwr_tAName fast_name;
......@@ -216,8 +217,9 @@ XttFast::XttFast( void *parent_ctx,
XttFast::XttFast( void *parent_ctx,
const char *name,
char *filename,
int xn_color_theme,
int *sts) : xnav(parent_ctx), fast_cnt(0), timerid(0), close_cb(0), help_cb(0),
first_scan(1), axis_configured(false)
first_scan(1), axis_configured(false), color_theme(xn_color_theme)
{
*sts = read_export( filename);
......
......@@ -97,17 +97,20 @@ class XttFast {
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.
char title[250]; //!< Window title
char title[250]; //!< Window title
CoWow *wow;
int color_theme;
//! Constructor
XttFast( void *xn_parent_ctx,
char *xn_name,
pwr_sAttrRef *fast_arp,
int color_theme,
int *sts);
XttFast( void *parent_ctx,
const char *name,
char *filename,
int color_theme,
int *sts);
//! Destructor
......@@ -117,6 +120,7 @@ class XttFast {
void pop();
void setup();
int read_export( char *filename);
void update_color_theme( int ct) { curve->update_color_theme(ct);}
static void fast_close_cb( void *ctx);
static void fast_help_cb( void *ctx);
......
......@@ -70,10 +70,11 @@ XttSevHist::XttSevHist( void *parent_ctx,
pwr_tOName *xn_onamev,
bool *xn_sevhistobjectv,
sevcli_tCtx xn_scctx,
int xn_color_theme,
int *sts) :
xnav(parent_ctx), gcd(0), curve(0), rows(0), vsize(0), timerid(0), close_cb(0), help_cb(0),
get_select_cb(0), first_scan(1), scctx(xn_scctx), wow(0), time_low_old(0), time_high_old(0),
initial_period(time_ePeriod_)
initial_period(time_ePeriod_), color_theme(xn_color_theme)
{
pwr_tTime from, to;
......@@ -124,9 +125,11 @@ XttSevHist::XttSevHist( void *parent_ctx,
XttSevHist::XttSevHist( void *parent_ctx,
const char *name,
char *filename,
int xn_color_theme,
int *sts) :
xnav(parent_ctx), gcd(0), curve(0), rows(0), vsize(0), timerid(0), close_cb(0), help_cb(0),
get_select_cb(0), first_scan(1), scctx(0), time_low_old(0), time_high_old(0), initial_period(time_ePeriod_)
get_select_cb(0), first_scan(1), scctx(0), time_low_old(0), time_high_old(0), initial_period(time_ePeriod_),
color_theme(xn_color_theme)
{
strncpy( title, filename, sizeof(title));
......
......@@ -95,19 +95,22 @@ class XttSevHist {
long int time_high_old;
bool sevhistobjectv[XTT_SEVHIST_MAX]; //!< Indicates that it is a SevHistObject
time_ePeriod initial_period;
int color_theme;
//! Constructor
XttSevHist( void *xn_parent_ctx,
const char *xn_name,
pwr_tOid* xn_oidv,
pwr_tOName *xn_aname,
pwr_tOName *xn_oname,
bool *sevhistobjectv,
sevcli_tCtx xn_scctx,
int *sts);
const char *xn_name,
pwr_tOid* xn_oidv,
pwr_tOName *xn_aname,
pwr_tOName *xn_oname,
bool *sevhistobjectv,
sevcli_tCtx xn_scctx,
int xn_color_theme,
int *sts);
XttSevHist( void *parent_ctx,
const char *name,
char *filename,
int xn_color_theme,
int *sts);
//! Destructor
......@@ -122,6 +125,7 @@ class XttSevHist {
bool sevhistobject);
int read_export( char *filename);
void setup();
void update_color_theme( int ct) { curve->update_color_theme(ct);}
static void sevhist_close_cb( void *ctx);
static void sevhist_increase_period_cb( void *ctx);
......
......@@ -67,9 +67,10 @@
XttTCurve::XttTCurve( void *parent_ctx,
const char *name,
pwr_tAttrRef *xn_arefv,
int xn_color_theme,
int *sts) :
xnav(parent_ctx), gcd(0), curve(0), rows(0), vsize(0), timerid(0), close_cb(0), help_cb(0),
get_select_cb(0), first_scan(1), time_low_old(0), time_high_old(0)
get_select_cb(0), first_scan(1), time_low_old(0), time_high_old(0), color_theme(xn_color_theme)
{
pwr_tTime from, to;
......
......@@ -113,11 +113,13 @@ class XttTCurve {
long int time_low_old;
long int time_high_old;
tcurve_sTc tc;
int color_theme;
//! Constructor
XttTCurve( void *xn_parent_ctx,
const char *xn_name,
pwr_tAttrRef* xn_arefv,
int xn_color_theme,
int *sts);
//! Destructor
......@@ -132,6 +134,7 @@ class XttTCurve {
void save( char *filename);
void open( char *filename);
void set_title( const char *str);
void update_color_theme( int ct) { curve->update_color_theme(ct);}
static void tcurve_close_cb( void *ctx);
static void tcurve_new_cb( void *ctx);
......
......@@ -68,9 +68,10 @@ XttTrend::XttTrend( void *parent_ctx,
pwr_sAttrRef *trend_list,
pwr_sAttrRef *plotgroup,
unsigned int x_options,
int xn_color_theme,
int *sts) :
xnav(parent_ctx), trend_cnt(0), update_time(1000), options(x_options),
close_cb(0), help_cb(0), command_cb(0), get_select_cb(0)
close_cb(0), help_cb(0), command_cb(0), get_select_cb(0), color_theme(xn_color_theme)
{
pwr_sAttrRef *aref_list;
pwr_sAttrRef *aref_p;
......
......@@ -84,17 +84,20 @@ class XttTrend {
void (*command_cb)( void *, const char *);
int (*get_select_cb)( void *, pwr_tAttrRef *, int *); //!< Get selected trend object.
CoWow *wow;
int color_theme;
XttTrend( void *xn_parent_ctx,
char *xn_name,
pwr_sAttrRef *objid,
pwr_sAttrRef *plotgroup,
unsigned int options,
int xn_color_theme,
int *sts);
virtual ~XttTrend();
void pop();
void setup();
void curve_add( pwr_tAttrRef *arp, pwr_tAttrRef *trend_arp, pwr_tStatus *sts);
void update_color_theme( int ct) { curve->update_color_theme(ct);}
static void trend_close_cb( void *ctx);
static void trend_help_cb( void *ctx);
......
......@@ -361,13 +361,15 @@ class XNav {
pwr_tStatus *sts) {return 0;}
virtual Op *op_new( char *opplace, pwr_tStatus *sts) {return 0;}
virtual XttTrend *xtttrend_new( char *name, pwr_tAttrRef *objar, pwr_tAttrRef *plotgroup,
int width, int height, unsigned int options, pwr_tStatus *sts) {return 0;}
int width, int height, unsigned int options, int color_theme, pwr_tStatus *sts) {return 0;}
virtual XttSevHist *xttsevhist_new( char *name, pwr_tOid *oidv, pwr_tOName *aname,
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;}
char *filename, int width, int height, unsigned int options,
int color_theme, pwr_tStatus *sts) {return 0;}
virtual XttTCurve *xtttcurve_new( char *name, pwr_tAttrRef *arefv, int width, int height, unsigned int options,
int color_theme, 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;}
char *filename, int color_theme, 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;}
......@@ -389,7 +391,7 @@ class XNav {
int width, int height, int x, int y, double scan_time,
unsigned int options, int embedded, pwr_tAttrRef *arp, pwr_tStatus *sts) {return 0;}
virtual GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
int pos_right, unsigned int options) {return 0;}
int pos_right, unsigned int options, int color_theme) {return 0;}
virtual XttFileview *fileview_new( pwr_tOid oid, char *title, char *dir, char *pattern,
int type, char *target_attr, char *trigger_attr,
char *filetype) {return 0;}
......
......@@ -183,6 +183,7 @@ static void xnav_trend_help_cb( void *ctx, const char *key);
static void xnav_tcurve_close_cb( void *ctx, XttTCurve *trend);
static void xnav_tcurve_help_cb( void *ctx, const char *key);
static void xnav_sevhist_help_cb( void *ctx, const char *key);
static void xnav_sevhist_close_cb( void *ctx, XttSevHist *hist);
static int xnav_sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname);
static int xnav_get_select_cb( void *ctx, pwr_tAttrRef *aref, int *is_attr);
static void xnav_fast_close_cb( void *ctx, XttFast *fast);
......@@ -1153,6 +1154,12 @@ static int xnav_set_func( void *client_data,
for ( elem = xnav->appl.root; elem; elem = elem->next) {
if ( elem->type == applist_eType_Graph)
((XttGe *)elem->ctx)->update_color_theme( idx);
else if ( elem->type == applist_eType_SevHist)
((XttSevHist *)elem->ctx)->update_color_theme( idx);
else if ( elem->type == applist_eType_Trend)
((XttTrend *)elem->ctx)->update_color_theme( idx);
else if ( elem->type == applist_eType_Fast)
((XttFast *)elem->ctx)->update_color_theme( idx);
}
}
if ( xnav->op)
......@@ -4099,7 +4106,7 @@ static int xnav_open_func( void *client_data,
trend->pop();
}
else {
trend = xnav->xtttrend_new( title_str, NULL, &plotgroup, width, height, options, &sts);
trend = xnav->xtttrend_new( title_str, NULL, &plotgroup, width, height, options, xnav->gbl.color_theme, &sts);
if ( EVEN(sts))
xnav->message('E',"Error in trend configuration");
else {
......@@ -4119,7 +4126,7 @@ static int xnav_open_func( void *client_data,
trend->pop();
}
else {
trend = xnav->xtttrend_new( title_str, aref_vect, 0, width, height, options, &sts);
trend = xnav->xtttrend_new( title_str, aref_vect, 0, width, height, options, xnav->gbl.color_theme, &sts);
if ( EVEN(sts))
xnav->message('E',"Error in trend configuration");
else {
......@@ -4133,7 +4140,7 @@ static int xnav_open_func( void *client_data,
}
}
else {
trend = xnav->xtttrend_new( title_str, aref_vect, 0, width, height, options, &sts);
trend = xnav->xtttrend_new( title_str, aref_vect, 0, width, height, options, xnav->gbl.color_theme, &sts);
if ( ODD(sts)) {
trend->close_cb = xnav_trend_close_cb;
trend->command_cb = xnav_trend_command_cb;
......@@ -4257,7 +4264,7 @@ static int xnav_open_func( void *client_data,
if ( ODD( dcli_get_qualifier( "/NEW", 0, 0))) {
XttTCurve *tcurve = xnav->xtttcurve_new( title_str, 0, width, height,
options, &sts);
options, xnav->gbl.color_theme, &sts);
if ( ODD(sts)) {
tcurve->close_cb = xnav_tcurve_close_cb;
tcurve->command_cb = xnav_trend_command_cb;
......@@ -4298,7 +4305,7 @@ static int xnav_open_func( void *client_data,
return XNAV__HOLDCOMMAND;
}
XttTCurve *tcurve = xnav->xtttcurve_new( title_str, aref_vect,
width, height, options, &sts);
width, height, options, xnav->gbl.color_theme, &sts);
if ( ODD(sts)) {
tcurve->close_cb = xnav_tcurve_close_cb;
tcurve->command_cb = xnav_trend_command_cb;
......@@ -4373,11 +4380,15 @@ static int xnav_open_func( void *client_data,
if ( ODD( dcli_get_qualifier( "/FILE", file_str, sizeof(file_str)))) {
// Open exported history file
hist = xnav->xttsevhist_new( title_str, 0, 0, 0, 0, 0, file_str,
width, height, options, &sts);
hist = xnav->xttsevhist_new( file_str, 0, 0, 0, 0, 0, file_str,
width, height, options, xnav->gbl.color_theme, &sts);
if ( ODD(sts)) {
hist->help_cb = xnav_sevhist_help_cb;
hist->close_cb = xnav_sevhist_close_cb;
hist->get_select_cb = xnav_sevhist_get_select_cb;
xnav->appl.insert( applist_eType_SevHist, (void *)hist, pwr_cNOid, "",
NULL);
}
return XNAV__SUCCESS;
}
......@@ -4625,26 +4636,35 @@ static int xnav_open_func( void *client_data,
xnav->set_clock_cursor();
if ( plotgroup_found) {
hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv,
xnav->scctx, 0, width, height, options, &sts);
xnav->scctx, 0, width, height, options, xnav->gbl.color_theme, &sts);
if ( ODD(sts)) {
hist->help_cb = xnav_sevhist_help_cb;
hist->close_cb = xnav_sevhist_close_cb;
hist->get_select_cb = xnav_sevhist_get_select_cb;
xnav->appl.insert( applist_eType_SevHist, (void *)hist, oidv[0], "",
NULL);
}
}
else if( sevHistObjectFound ) {
hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv,
xnav->scctx, 0, width, height, options, &sts);
xnav->scctx, 0, width, height, options, xnav->gbl.color_theme, &sts);
if ( ODD(sts)) {
hist->help_cb = xnav_sevhist_help_cb;
hist->close_cb = xnav_sevhist_close_cb;
hist->get_select_cb = xnav_sevhist_get_select_cb;
xnav->appl.insert( applist_eType_SevHist, (void *)hist, oidv[0], "",
NULL);
}
}
else {
hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv,
xnav->scctx, 0, width, height, options, &sts);
xnav->scctx, 0, width, height, options, xnav->gbl.color_theme, &sts);
if ( ODD(sts)) {
hist->help_cb = xnav_sevhist_help_cb;
hist->close_cb = xnav_sevhist_close_cb;
hist->get_select_cb = xnav_sevhist_get_select_cb;
xnav->appl.insert( applist_eType_SevHist, (void *)hist, oidv[0], "",
NULL);
}
}
xnav->reset_cursor();
......@@ -4697,7 +4717,7 @@ static int xnav_open_func( void *client_data,
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);
XttFast *fast = xnav->xttfast_new( title_str, 0, width, height, 0, file_str, xnav->gbl.color_theme, &sts);
if ( EVEN(sts))
xnav->message('E',"Error in fast configuration");
else {
......@@ -4762,7 +4782,7 @@ static int xnav_open_func( void *client_data,
fast->pop();
}
else {
fast = xnav->xttfast_new( title_str, &aref, width, height, options, 0, &sts);
fast = xnav->xttfast_new( title_str, &aref, width, height, options, 0, xnav->gbl.color_theme, &sts);
if ( EVEN(sts))
xnav->message('E',"Error in fast configuration");
else {
......@@ -5599,6 +5619,14 @@ static void xnav_sevhist_help_cb( void *ctx, const char *key)
xnav->message( ' ', null_str);
}
static void xnav_sevhist_close_cb( void *ctx, XttSevHist *hist)
{
XNav *xnav = (XNav *) ctx;
xnav->appl.remove( (void *)hist);
delete hist;
}
static int xnav_sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname)
{
XNav *xnav = (XNav *) ctx;
......@@ -9549,7 +9577,7 @@ int XNav::set_parameter( char *name_str, char *value_str, int publicwrite)
void XNav::open_rttlog( char *name, char *filename)
{
gecurve_new( name, filename, NULL, 0, 0);
gecurve_new( name, filename, NULL, 0, 0, gbl.color_theme);
}
......@@ -9823,6 +9851,12 @@ static void xnav_colortheme_selector_ok_cb( void *ctx, char *text)
for ( elem = xnav->appl.root; elem; elem = elem->next) {
if ( elem->type == applist_eType_Graph)
((XttGe *)elem->ctx)->update_color_theme( idx);
else if ( elem->type == applist_eType_SevHist)
((XttSevHist *)elem->ctx)->update_color_theme( idx);
else if ( elem->type == applist_eType_Trend)
((XttTrend *)elem->ctx)->update_color_theme( idx);
else if ( elem->type == applist_eType_Fast)
((XttFast *)elem->ctx)->update_color_theme( idx);
}
}
if ( xnav->op)
......
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