Commit 15132516 authored by Claes Sjöfors's avatar Claes Sjöfors

Xtt trend, add curve function added

parent d593b31e
......@@ -149,6 +149,14 @@ void GeCurveGtk::activate_configure( GtkWidget *w, gpointer data)
curve->activate_configure();
}
void GeCurveGtk::activate_madd( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
if ( curve->madd_cb)
(curve->madd_cb)( curve->parent_ctx);
}
void GeCurveGtk::activate_print( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
......@@ -510,6 +518,8 @@ void GeCurveGtk::enable( unsigned int mask)
g_object_set( menu_export, "visible", TRUE, NULL);
if ( mask & curve_mEnable_Timebox)
g_object_set( sea_timebox, "visible", TRUE, NULL);
if ( mask & curve_mEnable_Add)
g_object_set( tools_add, "visible", TRUE, NULL);
}
void GeCurveGtk::setup( unsigned int mask)
......@@ -521,6 +531,7 @@ void GeCurveGtk::setup( unsigned int mask)
g_object_set( tools_snapshot, "visible", mask & curve_mEnable_Snapshot ? 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( tools_add, "visible", mask & curve_mEnable_Add ? TRUE : FALSE, NULL);
}
......@@ -775,6 +786,10 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
GtkMenuBar *menu_bar = (GtkMenuBar *) g_object_new(GTK_TYPE_MENU_BAR, NULL);
// File Entry
menu_add = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Add"));
g_signal_connect( menu_add, "activate",
G_CALLBACK(activate_madd), this);
GtkWidget *file_refresh = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Refresh"));
g_signal_connect( file_refresh, "activate",
G_CALLBACK(activate_configure), this);
......@@ -813,6 +828,7 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
GTK_ACCEL_VISIBLE);
GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_add);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_refresh);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_new);
......@@ -960,6 +976,14 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
g_object_set( tools_snapshot, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_snapshot, CoWowGtk::translate_utf8("Snapshot"), "");
tools_add = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_add.png");
gtk_container_add( GTK_CONTAINER(tools_add),
gtk_image_new_from_file( fname));
g_signal_connect(tools_add, "clicked", G_CALLBACK(activate_add), this);
g_object_set( tools_add, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_add, CoWowGtk::translate_utf8("Add"), "");
// Time box
GtkToolbar *timetools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
......@@ -1115,6 +1139,7 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
g_object_set( menu_snapshot, "visible", FALSE, NULL);
g_object_set( menu_export, "visible", FALSE, NULL);
g_object_set( tools_snapshot, "visible", FALSE, NULL);
g_object_set( tools_add, "visible", FALSE, NULL);
wow = new CoWowGtk( toplevel);
......
......@@ -71,7 +71,9 @@ class GeCurveGtk : public GeCurve {
GtkWidget *menu_open;
GtkWidget *menu_snapshot;
GtkWidget *menu_export;
GtkWidget *menu_add;
GtkWidget *tools_snapshot;
GtkWidget *tools_add;
GtkWidget *export_widget;
GtkWidget *export_attrcombo_widget;
GtkWidget *export_fromtime_widget;
......@@ -129,6 +131,7 @@ class GeCurveGtk : public GeCurve {
static void activate_prev_period( GtkWidget *w, gpointer data);
static void activate_next_period( GtkWidget *w, gpointer data);
static void activate_add( GtkWidget *w, gpointer data);
static void activate_madd( GtkWidget *w, gpointer data);
static void activate_remove( GtkWidget *w, gpointer data);
static void activate_timecombo( GtkWidget *w, gpointer data);
static void activate_background( GtkWidget *w, gpointer data);
......
......@@ -58,6 +58,7 @@
#include "co_dcli.h"
#include "cow_wow.h"
#include "co_lng.h"
#include "co_cnf.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
......@@ -110,7 +111,18 @@ void GeCurve::activate_export()
pwr_tTime to = pwr_cNTime;
pwr_tTime from = pwr_cNTime;
double from_time, to_time;
char filename[] = "~/history.txt";
pwr_tFileName filename;
pwr_tFileName dir;
// Get directory from proview.cnf
if ( cnf_get_value( "curveExportDirectory", dir, sizeof(dir))) {
strcpy( filename, dir);
if ( filename[strlen(filename)-1] != '/')
strcat( filename, "/");
}
else
strcpy( filename, "~/");
strcat( filename, "history.txt");
grow_MeasureWindow( growcurve_ctx, &ll_x, &ll_y, &ur_x, &ur_y);
......@@ -863,17 +875,32 @@ int GeCurve::config_names()
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1);
x += 3;
grow_CreateGrowText( grownames_ctx, "", Lng::translate("Attribute"),
x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, 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,
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,
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,
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,
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,
glow_mDisplayLevel_1, NULL, &o1);
}
for ( int i = 0; i < cd->cols; i++) {
// Draw shadowed frame
......@@ -923,27 +950,54 @@ int GeCurve::config_names()
glow_eDrawType_Color33, NULL, &scale_rect[i]);
grow_SetObjectShadowWidth( scale_rect[i], 20);
// Draw attribute name
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,
glow_mDisplayLevel_1, NULL, &t1);
if ( strcmp( cd->y_description[i], "") != 0) {
if ( options & curve_mOptions_ShowDescrFirst) {
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);
if ( w < 13)
x += 14;
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,
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);
if ( w < 13)
x += 14;
else
x += w + 1;
}
else
x += w + 1;
grow_CreateGrowText( grownames_ctx, "", cd->y_description[i],
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,
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,
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);
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,
glow_mDisplayLevel_1, NULL, &t1);
}
}
grow_SetAnnotation( cursor_annot[i], 0, "0", 1);
grow_SetAnnotation( mark1_annot[i], 0, "0", 1);
......@@ -1480,7 +1534,7 @@ GeCurve::GeCurve( void *gc_parent_ctx,
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), 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),
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)
......
......@@ -56,7 +56,8 @@ typedef enum {
curve_mOptions_FullMaximize = 1 << 2,
curve_mOptions_Iconify = 1 << 3,
curve_mOptions_Invisible = 1 << 4,
curve_mOptions_Embedded = 1 << 5
curve_mOptions_Embedded = 1 << 5,
curve_mOptions_ShowDescrFirst = 1 << 6
} curve_mOptions;
typedef enum {
......@@ -65,7 +66,8 @@ typedef enum {
curve_mEnable_Open = 1 << 2,
curve_mEnable_Snapshot = 1 << 3,
curve_mEnable_Export = 1 << 4,
curve_mEnable_Timebox = 1 << 5
curve_mEnable_Timebox = 1 << 5,
curve_mEnable_Add = 1 << 6
} curve_mEnable;
typedef enum {
......@@ -188,6 +190,7 @@ class GeCurve {
void (*prev_period_cb)( void *);
void (*next_period_cb)( void *);
void (*add_cb)( void *);
void (*madd_cb)( void *);
void (*remove_cb)( void *);
int (*export_cb)( void *, pwr_tTime *, pwr_tTime *, int, int, char *);
void (*new_cb)( void *);
......
......@@ -68,9 +68,10 @@ XttTrendGtk::XttTrendGtk( void *parent_ctx,
pwr_sAttrRef *plotgroup,
int width,
int height,
unsigned int options,
unsigned int x_options,
int *sts) :
XttTrend( parent_ctx, name, trend_list, plotgroup, sts), parent_widget(parent_wid)
XttTrend( parent_ctx, name, trend_list, plotgroup, x_options, sts),
parent_widget(parent_wid)
{
if ( EVEN(*sts))
return;
......@@ -81,11 +82,15 @@ XttTrendGtk::XttTrendGtk( void *parent_ctx,
curve->close_cb = trend_close_cb;
curve->help_cb = trend_help_cb;
curve->snapshot_cb = trend_snapshot_cb;
curve->add_cb = trend_add_cb;
curve->madd_cb = trend_madd_cb;
if ( w)
*w = (GtkWidget *)curve->get_widget();
if ( trend_tid == pwr_cClass_DsTrendCurve)
curve->enable( curve_mEnable_Snapshot);
curve->enable( curve_mEnable_Snapshot | curve_mEnable_Add);
else
curve->enable( curve_mEnable_Add);
wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new();
......
......@@ -85,7 +85,8 @@ XttTrendMotif::XttTrendMotif( void *parent_ctx,
int height,
unsigned int options,
int *sts) :
XttTrend( parent_ctx, name, trend_list, plotgroup, sts), parent_widget(parent_wid)
XttTrend( parent_ctx, name, trend_list, plotgroup, options, sts),
parent_widget(parent_wid)
{
if ( EVEN(*sts))
return;
......
This diff is collapsed.
......@@ -74,6 +74,7 @@ class XttTrend {
int max_points;
pwr_tTid trend_tid;
int update_time;
unsigned int options;
cbuf_sCircBuffInfo cb_info[XTT_TREND_MAX];
CoWowTimer *timerid;
int last_buffer[XTT_TREND_MAX];
......@@ -81,20 +82,25 @@ class XttTrend {
void (*close_cb)( void *, XttTrend *);
void (*help_cb)( void *, const char *);
void (*command_cb)( void *, const char *);
int (*get_select_cb)( void *, pwr_tAttrRef *, int *); //!< Get selected trend object.
CoWow *wow;
XttTrend( void *xn_parent_ctx,
char *xn_name,
pwr_sAttrRef *objid,
pwr_sAttrRef *plotgroup,
unsigned int options,
int *sts);
virtual ~XttTrend();
void pop();
void setup();
void curve_add( pwr_tAttrRef *arp, pwr_tAttrRef *trend_arp, pwr_tStatus *sts);
static void trend_close_cb( void *ctx);
static void trend_help_cb( void *ctx);
static void trend_snapshot_cb( void *ctx);
static void trend_add_cb( void *ctx);
static void trend_madd_cb( void *ctx);
static void trend_scan( void *data);
};
......
......@@ -3645,6 +3645,7 @@ static int xnav_open_func( void *client_data,
trend->help_cb = xnav_trend_command_cb;
trend->help_cb = xnav_trend_help_cb;
trend->command_cb = xnav_trend_command_cb;
trend->get_select_cb = xnav_get_select_cb;
xnav->appl.insert( applist_eType_Trend, (void *)trend, &plotgroup, "",
NULL);
}
......@@ -3663,6 +3664,7 @@ static int xnav_open_func( void *client_data,
trend->close_cb = xnav_trend_close_cb;
trend->command_cb = xnav_trend_command_cb;
trend->help_cb = xnav_trend_help_cb;
trend->get_select_cb = xnav_get_select_cb;
xnav->appl.insert( applist_eType_Trend, (void *)trend, &aref_vect[0], "",
NULL);
}
......@@ -3674,6 +3676,7 @@ static int xnav_open_func( void *client_data,
trend->close_cb = xnav_trend_close_cb;
trend->command_cb = xnav_trend_command_cb;
trend->help_cb = xnav_trend_help_cb;
trend->get_select_cb = xnav_get_select_cb;
}
}
}
......
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