Commit d1b222c0 authored by Claes Sjofors's avatar Claes Sjofors

Sev curve window time selecton added and function to adde curve

parent 964a98e5
...@@ -202,13 +202,12 @@ void XttTblGtk::activate_list_layout( GtkWidget *w, gpointer data) ...@@ -202,13 +202,12 @@ void XttTblGtk::activate_list_layout( GtkWidget *w, gpointer data)
xtt->tblnav->show_list(); xtt->tblnav->show_list();
} }
XttSevHist *XttTblGtk::sevhist_new( pwr_tOid *oidv, pwr_tOName *anamev, pwr_tOName *onamev, bool *sevhistobjectv) XttSevHist *XttTblGtk::sevhist_new( pwr_tOid *oidv, pwr_tOName *anamev, pwr_tOName *onamev, bool *sevhistobjectv, pwr_tStatus *sts)
{ {
GtkWidget *w; GtkWidget *w;
pwr_tStatus sts;
return new XttSevHistGtk( (void *)this, toplevel, "SevHist", &w, oidv, anamev, onamev, return new XttSevHistGtk( (void *)this, toplevel, "Process History", &w, oidv, anamev, onamev,
sevhistobjectv, sevcli, &sts); sevhistobjectv, sevcli, sts);
} }
CoLogin *XttTblGtk::login_new( const char *name, CoLogin *XttTblGtk::login_new( const char *name,
...@@ -338,8 +337,11 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid, ...@@ -338,8 +337,11 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
// Functions entry // Functions entry
GtkWidget *functions_opensevhist = gtk_menu_item_new_with_mnemonic( "_Open SevHist"); GtkWidget *functions_opensevhist = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Open Process History"));
g_signal_connect(functions_opensevhist, "activate", G_CALLBACK(activate_opensevhist), this); g_signal_connect(functions_opensevhist, "activate", G_CALLBACK(activate_opensevhist), this);
gtk_widget_add_accelerator( functions_opensevhist, "activate", accel_g,
'g', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE);
GtkWidget *functions_command = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Co_mmand")); GtkWidget *functions_command = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Co_mmand"));
g_signal_connect( functions_command, "activate", g_signal_connect( functions_command, "activate",
...@@ -348,7 +350,7 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid, ...@@ -348,7 +350,7 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
'b', GdkModifierType(GDK_CONTROL_MASK), 'b', GdkModifierType(GDK_CONTROL_MASK),
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
GtkWidget *functions_delete_item = gtk_menu_item_new_with_mnemonic( "_Delete Item"); GtkWidget *functions_delete_item = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Delete Item"));
g_signal_connect(functions_delete_item, "activate", G_CALLBACK(activate_delete_item), this); g_signal_connect(functions_delete_item, "activate", G_CALLBACK(activate_delete_item), this);
GtkMenu *functions_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL); GtkMenu *functions_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
...@@ -356,16 +358,16 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid, ...@@ -356,16 +358,16 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_command); gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_command);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_delete_item); gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_delete_item);
GtkWidget *functions = gtk_menu_item_new_with_mnemonic("_Functions"); GtkWidget *functions = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Functions"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), functions); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), functions);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions), GTK_WIDGET(functions_menu)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions), GTK_WIDGET(functions_menu));
// View menu // View menu
GtkWidget *view_tree_layout = gtk_menu_item_new_with_mnemonic( "_Tree Layout"); GtkWidget *view_tree_layout = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_Tree Layout"));
g_signal_connect(view_tree_layout, "activate", G_CALLBACK(activate_tree_layout), this); g_signal_connect(view_tree_layout, "activate", G_CALLBACK(activate_tree_layout), this);
GtkWidget *view_list_layout = gtk_menu_item_new_with_mnemonic( "_List Layout"); GtkWidget *view_list_layout = gtk_menu_item_new_with_mnemonic( CoWowGtk::translate_utf8("_List Layout"));
g_signal_connect(view_list_layout, "activate", G_CALLBACK(activate_list_layout), this); g_signal_connect(view_list_layout, "activate", G_CALLBACK(activate_list_layout), this);
GtkWidget *view_zoom_in = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Zoom _In")); GtkWidget *view_zoom_in = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Zoom _In"));
...@@ -419,7 +421,7 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid, ...@@ -419,7 +421,7 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_project); gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_project);
gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_proview); gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_proview);
GtkWidget *help = gtk_menu_item_new_with_mnemonic("_Help"); GtkWidget *help = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Help"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu));
...@@ -432,7 +434,7 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid, ...@@ -432,7 +434,7 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect(tools_opensevhist, "clicked", G_CALLBACK(activate_opensevhist), this); g_signal_connect(tools_opensevhist, "clicked", G_CALLBACK(activate_opensevhist), this);
g_object_set( tools_opensevhist, "can-focus", FALSE, NULL); g_object_set( tools_opensevhist, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_opensevhist,CoWowGtk::translate_utf8("Open hist item"), ""); gtk_toolbar_append_widget( tools, tools_opensevhist,CoWowGtk::translate_utf8("Open history item"), "");
GtkWidget *tools_zoom_in = gtk_button_new(); GtkWidget *tools_zoom_in = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_in.png"); dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_in.png");
......
...@@ -49,7 +49,8 @@ class XttTblGtk : public XttTbl { ...@@ -49,7 +49,8 @@ class XttTblGtk : public XttTbl {
CoWowEntryGtk *cmd_entry; CoWowEntryGtk *cmd_entry;
void message( char severity, char *message); void message( char severity, char *message);
XttSevHist *sevhist_new( pwr_tOid *oidv, pwr_tOName *anamev, pwr_tOName *onamev, bool *sevhistobjectv); XttSevHist *sevhist_new( pwr_tOid *oidv, pwr_tOName *anamev, pwr_tOName *onamev,
bool *sevhistobjectv, pwr_tStatus *sts);
CoLogin *login_new( const char *wl_name, CoLogin *login_new( const char *wl_name,
const char *wl_groupname, const char *wl_groupname,
void (* wl_bc_success)( void *), void (* wl_bc_success)( void *),
......
...@@ -40,8 +40,11 @@ ...@@ -40,8 +40,11 @@
#include "glow_growapi.h" #include "glow_growapi.h"
#include "flow_msg.h" #include "flow_msg.h"
#include "glow_curvectx.h"
#include "xtt_tbl.h" #include "xtt_tbl.h"
#include "xtt_tblnav.h" #include "xtt_tblnav.h"
#include "xtt_sevhist.h"
XttTbl::~XttTbl() XttTbl::~XttTbl()
{ {
...@@ -126,6 +129,8 @@ void XttTbl::activate_print() ...@@ -126,6 +129,8 @@ void XttTbl::activate_print()
void XttTbl::activate_opensevhist() void XttTbl::activate_opensevhist()
{ {
ItemBase *item; ItemBase *item;
XttSevHist *hist;
pwr_tStatus sts;
if ( !tblnav->get_select( &item)) { if ( !tblnav->get_select( &item)) {
message( 'E', "Select an storage item"); message( 'E', "Select an storage item");
...@@ -142,7 +147,12 @@ void XttTbl::activate_opensevhist() ...@@ -142,7 +147,12 @@ void XttTbl::activate_opensevhist()
bool sevhistobjectv[2] = {hi->attrnum > 1, false}; bool sevhistobjectv[2] = {hi->attrnum > 1, false};
if( !sevhistobjectv[0] ) { if( !sevhistobjectv[0] ) {
strcpy( anamev[0], hi->objectattrlist[0].aname); strcpy( anamev[0], hi->objectattrlist[0].aname);
sevhist_new( oidv, anamev, onamev, sevhistobjectv); strcpy( onamev[0], hi->oname);
hist = sevhist_new( oidv, anamev, onamev, sevhistobjectv, &sts);
if ( ODD(sts)) {
hist->help_cb = sevhist_help_cb;
hist->get_select_cb = sevhist_get_select_cb;
}
} }
else { else {
char *s; char *s;
...@@ -156,7 +166,11 @@ void XttTbl::activate_opensevhist() ...@@ -156,7 +166,11 @@ void XttTbl::activate_opensevhist()
strcpy( aname, s+1); strcpy( aname, s+1);
} }
strcpy( anamev[0], aname); strcpy( anamev[0], aname);
sevhist_new( oidv, anamev, onamev, sevhistobjectv); hist = sevhist_new( oidv, anamev, onamev, sevhistobjectv, &sts);
if ( ODD(sts)) {
hist->help_cb = sevhist_help_cb;
hist->get_select_cb = sevhist_get_select_cb;
}
} }
break; break;
} }
...@@ -253,3 +267,35 @@ void XttTbl::activate_help_proview() ...@@ -253,3 +267,35 @@ void XttTbl::activate_help_proview()
CoXHelp::dhelp( "version", "", navh_eHelpFile_Other, "$pwr_exe/sev_xtt_version_help.dat", 0); CoXHelp::dhelp( "version", "", navh_eHelpFile_Other, "$pwr_exe/sev_xtt_version_help.dat", 0);
} }
void XttTbl::sevhist_help_cb( void *ctx, const char *key)
{
CoXHelp::dhelp( key, "", navh_eHelpFile_Base, NULL, 0);
}
int XttTbl::sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname)
{
XttTbl *xtttbl = (XttTbl *) ctx;
ItemBase *item;
if ( !xtttbl->tblnav->get_select( &item)) {
xtttbl->message( 'E', "Select an storage item");
return 0;
}
switch ( item->type) {
case tblnav_eItemType_Local:
case tblnav_eItemType_TreeLocal: {
TblNav_sevhistobject *hi = &((ItemLocal *)item)->item;
if ( hi->attrnum > 1)
return 0;
*oid = hi->oid;
strcpy( aname, hi->objectattrlist[0].aname);
strcpy( oname, hi->oname);
break;
}
default:
return 0;
}
return 1;
}
...@@ -56,7 +56,7 @@ class XttTbl { ...@@ -56,7 +56,7 @@ class XttTbl {
virtual void message( char severity, const char *message) {} virtual void message( char severity, const char *message) {}
virtual XttSevHist *sevhist_new( pwr_tOid *oidv, pwr_tOName *anamev, pwr_tOName *onamev, virtual XttSevHist *sevhist_new( pwr_tOid *oidv, pwr_tOName *anamev, pwr_tOName *onamev,
bool *sevhistobjectv) { return 0;} bool *sevhistobjectv, pwr_tStatus *sts) { return 0;}
virtual CoLogin *login_new( const char *wl_name, virtual CoLogin *login_new( const char *wl_name,
const char *wl_groupname, const char *wl_groupname,
void (* wl_bc_success)( void *), void (* wl_bc_success)( void *),
...@@ -81,6 +81,8 @@ class XttTbl { ...@@ -81,6 +81,8 @@ class XttTbl {
static int is_authorized( void *ctx, unsigned int access, int msg); static int is_authorized( void *ctx, unsigned int access, int msg);
static int command_cb( void *ctx, char *cmd); static int command_cb( void *ctx, char *cmd);
static void delete_item_yes( void *ctx, void *data); static void delete_item_yes( void *ctx, void *data);
static int sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname);
static void sevhist_help_cb( void *ctx, const char *key);
virtual ~XttTbl(); virtual ~XttTbl();
int command( char* input_str); int command( char* input_str);
......
...@@ -44,11 +44,17 @@ ...@@ -44,11 +44,17 @@
#include "flow.h" #include "flow.h"
#include "flow_browctx.h" #include "flow_browctx.h"
#include "flow_browapi.h" #include "flow_browapi.h"
#include "glow.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "flow_msg.h"
#include "glow_curvectx.h"
#include "co_lng.h" #include "co_lng.h"
#include "co_error.h" #include "co_error.h"
#include "cow_wow.h" #include "cow_wow.h"
#include "xtt_tbl.h" #include "xtt_tbl.h"
#include "xtt_tblnav.h" #include "xtt_tblnav.h"
#include "xtt_sevhist.h"
#include "co_dcli_msg.h" #include "co_dcli_msg.h"
#include "cow_xhelp.h" #include "cow_xhelp.h"
#include "cow_login.h" #include "cow_login.h"
...@@ -380,6 +386,7 @@ static int xtttbl_open_func( void *client_data, ...@@ -380,6 +386,7 @@ static int xtttbl_open_func( void *client_data,
pwr_tOName onamev[11]; pwr_tOName onamev[11];
bool sevhistobjectv[11]; bool sevhistobjectv[11];
int sts; int sts;
XttSevHist *hist;
// Command is "OPEN HISTORY" // Command is "OPEN HISTORY"
...@@ -439,7 +446,11 @@ static int xtttbl_open_func( void *client_data, ...@@ -439,7 +446,11 @@ static int xtttbl_open_func( void *client_data,
} }
oidv[i] = pwr_cNOid; oidv[i] = pwr_cNOid;
xtttbl->sevhist_new( oidv, anamev, onamev, sevhistobjectv); hist = xtttbl->sevhist_new( oidv, anamev, onamev, sevhistobjectv, &sts);
if ( ODD(sts)) {
hist->help_cb = XttTbl::sevhist_help_cb;
hist->get_select_cb = XttTbl::sevhist_get_select_cb;
}
} }
else else
xtttbl->message('E',"Syntax error"); xtttbl->message('E',"Syntax error");
......
...@@ -62,6 +62,8 @@ ...@@ -62,6 +62,8 @@
pwr_Assert((p->tv_sec < 0) ? (p->tv_nsec <= 0 && p->tv_nsec > -1000000000) : TRUE);\ pwr_Assert((p->tv_sec < 0) ? (p->tv_nsec <= 0 && p->tv_nsec > -1000000000) : TRUE);\
} while (0) } while (0)
#define ONEDAY 86400
/* String representations of months. */ /* String representations of months. */
static const char *monStr[] = static const char *monStr[] =
...@@ -137,16 +139,8 @@ validateTm ( ...@@ -137,16 +139,8 @@ validateTm (
} }
return TIME__SUCCESS; return TIME__SUCCESS;
} }
//! Compare two timespecs.
/*! Returns \n
1 if t1 > t2 \n
0 if t1 == t2 \n
-1 if t1 < t2 \n
If argument 't2' is NULL the comparison will
be done as if t2 == 0.
*/
//! Test if time is Null.
int int
time_IsNull ( time_IsNull (
pwr_tTime *t1 pwr_tTime *t1
...@@ -1038,3 +1032,692 @@ int time_GetTimeMonotonic( pwr_tTime *ts) ...@@ -1038,3 +1032,692 @@ int time_GetTimeMonotonic( pwr_tTime *ts)
return sts; return sts;
} }
//! Calculate start and end time for month.
int time_PeriodMonth( pwr_tTime *time,
pwr_tTime *from,
pwr_tTime *to,
int previous)
{
struct tm *tm;
int days, month, year;
time_t t;
time_t sec = time->tv_sec;
tm = localtime(&sec);
sec = time->tv_sec - (tm->tm_mday - 1) * ONEDAY;
tm = localtime(&sec);
tm->tm_sec = 0;
tm->tm_min = 0;
tm->tm_hour = 0;
tm->tm_mday = 1;
t = mktime(tm);
year = tm->tm_year + 1900;
if ( previous) {
if ( tm->tm_mon == 0) {
month = 11;
year--;
}
else
month = tm->tm_mon - 1;
}
else
month = tm->tm_mon;
switch ( month) {
case 1:
if (( year % 4 == 0 && year % 100 != 0) || (year + 1900) % 400 == 0)
days = 29;
else
days = 28;
break;
case 3:
case 5:
case 8:
case 10:
days = 30;
break;
default:
days = 31;
}
if ( previous) {
if ( to) {
to->tv_sec = t;
to->tv_nsec = 0;
}
}
else {
if ( from) {
from->tv_sec = t;
from->tv_nsec = 0;
}
}
if ( previous)
sec = t - (days - 1) * ONEDAY;
else
sec = t + (days + 1) * ONEDAY;
tm = localtime(&sec);
tm->tm_sec = 0;
tm->tm_min = 0;
tm->tm_hour = 0;
tm->tm_mday = 1;
t = mktime(tm);
if ( previous) {
if ( from) {
from->tv_sec = t;
from->tv_nsec = 0;
}
}
else {
if ( to) {
to->tv_sec = t;
to->tv_nsec = 0;
}
}
return 1;
}
//! Calculate start and end time for month.
static int time_PeriodYear( pwr_tTime *time,
pwr_tTime *from,
pwr_tTime *to,
int previous)
{
struct tm *tm;
int days, year;
time_t t;
time_t sec = time->tv_sec;
tm = localtime(&sec);
sec = time->tv_sec - (tm->tm_yday - 1) * ONEDAY;
tm = localtime(&sec);
tm->tm_sec = 0;
tm->tm_min = 0;
tm->tm_hour = 0;
tm->tm_mon = 0;
tm->tm_mday = 1;
t = mktime(tm);
year = tm->tm_year + 1900;
if ( previous)
year--;
if (( year % 4 == 0 && year % 100 != 0) || (year + 1900) % 400 == 0)
days = 365;
else
days = 366;
if ( previous) {
if ( to) {
to->tv_sec = t;
to->tv_nsec = 0;
}
}
else {
if ( from) {
from->tv_sec = t;
from->tv_nsec = 0;
}
}
if ( previous)
sec = t - (days - 1) * ONEDAY;
else
sec = t + (days + 1) * ONEDAY;
tm = localtime(&sec);
tm->tm_sec = 0;
tm->tm_min = 0;
tm->tm_hour = 0;
tm->tm_mon = 0;
tm->tm_mday = 1;
t = mktime(tm);
if ( previous) {
if ( from) {
from->tv_sec = t;
from->tv_nsec = 0;
}
}
else {
if ( to) {
to->tv_sec = t;
to->tv_nsec = 0;
}
}
return 1;
}
//! Calculate start and end time for previous week.
/*! Computes dates for monday to sunday in the
previous week from the time now.
Output times are only date, e g 1-MAY-1992 00:00:00.00.
*/
int time_PeriodPreviousWeek( pwr_tTime *time,
pwr_tTime *from,
pwr_tTime *to)
{
struct tm *tm;
int days;
pwr_tTime t;
time_t sec = time->tv_sec;
tm = localtime(&sec);
if (tm->tm_wday == 0) /* Sunday */
days = 13;
else
days = tm->tm_wday + 6;
tm->tm_sec = 0;
tm->tm_min = 0;
tm->tm_hour = 0;
t.tv_sec = mktime(tm);
if ( from) {
from->tv_sec = t.tv_sec - days * ONEDAY;
from->tv_nsec = 0;
}
if ( to) {
to->tv_sec = t.tv_sec + (7 - days) * ONEDAY;
to->tv_nsec = 0;
}
return 1;
}
void time_PreviousDayBreak( pwr_tTime *time,
pwr_tTime *daybreak)
{
struct tm *tm;
time_t sec = time->tv_sec;
tm = localtime(&sec);
tm->tm_sec = 0;
tm->tm_min = 0;
tm->tm_hour = 0;
daybreak->tv_sec = mktime(tm);
daybreak->tv_nsec = 0;
}
static void time_PeriodSec( pwr_tTime *from, pwr_tTime *to, pwr_tTime *center, int sec)
{
pwr_tStatus sts;
pwr_tTime current;
sts = time_GetTime( &current);
to->tv_sec = center->tv_sec + sec/2;
to->tv_nsec = center->tv_nsec;
if ( time_Acomp( to, &current) == 1)
*to = current;
from->tv_sec = to->tv_sec - sec;
from->tv_nsec = to->tv_nsec;
}
void time_Period( time_ePeriod period, pwr_tTime *from, pwr_tTime *to, pwr_tTime *center,
int daybreak)
{
int sts;
pwr_tTime current;
switch ( period) {
case time_ePeriod_OneMinute:
if ( !center) {
time_Period( time_ePeriod_LastMinute, from, to, center, daybreak);
return;
}
time_PeriodSec( from, to, center, 60);
break;
case time_ePeriod_10Minutes:
if ( !center) {
time_Period( time_ePeriod_Last10Minutes, from, to, center, daybreak);
return;
}
time_PeriodSec( from, to, center, 600);
break;
case time_ePeriod_OneHour:
if ( !center) {
time_Period( time_ePeriod_LastHour, from, to, center, daybreak);
return;
}
time_PeriodSec( from, to, center, 3600);
break;
case time_ePeriod_OneDay:
if ( !center) {
time_Period( time_ePeriod_LastHour, from, to, center, daybreak);
return;
}
time_PeriodSec( from, to, center, ONEDAY);
break;
case time_ePeriod_OneWeek:
if ( !center) {
time_Period( time_ePeriod_LastWeek, from, to, center, daybreak);
return;
}
time_PeriodSec( from, to, center, 7 * ONEDAY);
break;
case time_ePeriod_OneMonth:
if ( !center) {
time_Period( time_ePeriod_LastMonth, from, to, center, daybreak);
return;
}
time_PeriodMonth( center, from, to, 0);
int middle = from->tv_sec + (to->tv_sec - from->tv_sec) / 2;
int half = middle - from->tv_sec;
if ( center->tv_sec >= middle - ONEDAY/2 &&
center->tv_sec <= middle + ONEDAY/2)
return;
if ( center->tv_sec < middle) {
// Take period from previous month
time_PeriodMonth( center, from, to, 1);
middle = from->tv_sec + (to->tv_sec - from->tv_sec) / 2;
half = middle - from->tv_sec;
}
to->tv_sec = center->tv_sec + half;
from->tv_sec = center->tv_sec - half;
sts = time_GetTime( &current);
if ( time_Acomp( to, &current) == 1) {
from->tv_sec = current.tv_sec - (to->tv_sec - from->tv_sec);
from->tv_nsec = current.tv_sec;
*to = current;
}
break;
case time_ePeriod_LastMinute:
sts = time_GetTime( to);
from->tv_sec = to->tv_sec - 60;
from->tv_nsec = to->tv_nsec;
break;
case time_ePeriod_Last10Minutes:
sts = time_GetTime( to);
from->tv_sec = to->tv_sec - 600;
from->tv_nsec = to->tv_nsec;
break;
case time_ePeriod_LastHour:
sts = time_GetTime( to);
from->tv_sec = to->tv_sec - 3600;
from->tv_nsec = to->tv_nsec;
break;
case time_ePeriod_Today:
sts = time_GetTime( from);
*to = *from;
time_PreviousDayBreak( from, from);
if ( daybreak) {
to->tv_sec += ONEDAY;
time_PreviousDayBreak( to, to);
}
break;
case time_ePeriod_Yesterday:
sts = time_GetTime( to);
time_PreviousDayBreak( to, to);
from->tv_sec = to->tv_sec - ONEDAY;
from->tv_nsec = 0;
break;
case time_ePeriod_ThisWeek:
sts = time_GetTime( &current);
sts = time_PeriodPreviousWeek( &current, 0, from);
*to = current;
if ( daybreak) {
to->tv_sec += ONEDAY;
time_PreviousDayBreak( to, to);
}
break;
case time_ePeriod_LastWeek:
sts = time_GetTime( &current);
sts = time_PeriodPreviousWeek( &current, from, to);
break;
case time_ePeriod_ThisMonth:
sts = time_GetTime( &current);
sts = time_PeriodMonth( &current, 0, from, 1);
*to = current;
if ( daybreak) {
to->tv_sec += ONEDAY;
time_PreviousDayBreak( to, to);
}
break;
case time_ePeriod_LastMonth:
sts = time_GetTime( &current);
sts = time_PeriodMonth( &current, from, to, 1);
break;
case time_ePeriod_OneYear:
case time_ePeriod_ThisYear:
sts = time_GetTime( &current);
sts = time_PeriodYear( &current, 0, from, 1);
*to = current;
if ( daybreak) {
to->tv_sec += ONEDAY;
time_PreviousDayBreak( to, to);
}
break;
default: {
// time_ePeriod_All:
struct tm *tm;
sts = time_GetTime( to);
if ( daybreak) {
to->tv_sec += ONEDAY;
time_PreviousDayBreak( to, to);
}
time_t sec = to->tv_sec;
tm = localtime(&sec);
tm->tm_sec = 0;
tm->tm_min = 0;
tm->tm_hour = 0;
tm->tm_mday = 1;
tm->tm_mon = 0;
tm->tm_year = 70;
from->tv_sec = mktime(tm);
from->tv_nsec = 0;
break;
}
}
}
void time_PreviousPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime *prev_to,
pwr_tTime *from, pwr_tTime *to)
{
switch ( period) {
case time_ePeriod_OneMinute:
case time_ePeriod_LastMinute:
*to = *from = *prev_from;
from->tv_sec -= 60;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = 60;
}
break;
case time_ePeriod_10Minutes:
case time_ePeriod_Last10Minutes:
*to = *from = *prev_from;
from->tv_sec -= 600;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = 600;
}
break;
case time_ePeriod_OneHour:
case time_ePeriod_LastHour:
*to = *from = *prev_from;
from->tv_sec -= 3600;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = 3660;
}
break;
case time_ePeriod_OneDay:
case time_ePeriod_Today:
case time_ePeriod_Yesterday:
*to = *from = *prev_from;
from->tv_sec -= ONEDAY;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = ONEDAY;
}
break;
case time_ePeriod_OneWeek:
case time_ePeriod_ThisWeek:
case time_ePeriod_LastWeek:
*to = *from = *prev_from;
from->tv_sec -= ONEDAY * 7;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = ONEDAY * 7;
}
break;
case time_ePeriod_OneMonth:
case time_ePeriod_ThisMonth:
case time_ePeriod_LastMonth:
time_PeriodMonth( prev_from, from, to, 1);
from->tv_sec += prev_from->tv_sec - to->tv_sec;
from->tv_nsec = prev_from->tv_nsec;
*to = *prev_from;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = ONEDAY * 30;
}
break;
case time_ePeriod_OneYear:
case time_ePeriod_ThisYear:
time_PeriodYear( prev_from, from, to, 1);
from->tv_sec += prev_from->tv_sec - to->tv_sec;
from->tv_nsec = prev_from->tv_nsec;
*to = *prev_from;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = ONEDAY * 365;
}
break;
case time_ePeriod_AllTime:
time_Period( period, from, to, 0, 1);
break;
case time_ePeriod_UserDefined:
// Same lenth of intervall as before
*to = *from = *prev_from;
from->tv_sec -= prev_to->tv_sec - prev_from->tv_sec;
if ( from->tv_sec < 0) {
from->tv_sec = 0;
to->tv_sec = prev_to->tv_sec - prev_from->tv_sec;
}
break;
default: ;
}
}
void time_NextPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime *prev_to,
pwr_tTime *from, pwr_tTime *to)
{
int sts;
pwr_tTime current;
sts = time_GetTime( &current);
switch ( period) {
case time_ePeriod_OneMinute:
case time_ePeriod_LastMinute:
*to = *from = *prev_to;
to->tv_sec += 60;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 60;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_10Minutes:
case time_ePeriod_Last10Minutes:
*to = *from = *prev_to;
to->tv_sec += 600;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 600;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_OneHour:
case time_ePeriod_LastHour:
*to = *from = *prev_to;
to->tv_sec += 3600;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 3600;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_OneDay:
case time_ePeriod_Today:
case time_ePeriod_Yesterday:
*to = *from = *prev_to;
to->tv_sec += ONEDAY;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - ONEDAY;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_OneWeek:
case time_ePeriod_ThisWeek:
case time_ePeriod_LastWeek:
*to = *from = *prev_to;
to->tv_sec += 7 * ONEDAY;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 7 * ONEDAY;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_OneMonth:
case time_ePeriod_ThisMonth:
case time_ePeriod_LastMonth:
time_PeriodMonth( prev_to, from, to, 0);
to->tv_sec += prev_to->tv_sec - from->tv_sec;
*from = *prev_to;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 30 * ONEDAY;
from->tv_nsec = current.tv_nsec;
}
break;
case time_ePeriod_OneYear:
case time_ePeriod_ThisYear:
time_PeriodYear( prev_to, from, to, 0);
to->tv_sec += prev_to->tv_sec - from->tv_sec;
*from = *prev_to;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - 365 * ONEDAY;
from->tv_nsec = current.tv_nsec;
}
break;
break;
case time_ePeriod_AllTime:
time_Period( period, from, to, 0, 1);
break;
case time_ePeriod_UserDefined:
// Same lenth of intervall as before
*to = *from = *prev_to;
to->tv_sec += prev_to->tv_sec - prev_from->tv_sec;
if ( time_Acomp( &current, to) != 1) {
*to = current;
from->tv_sec = current.tv_sec - (prev_to->tv_sec - prev_from->tv_sec);
from->tv_nsec = current.tv_nsec;
}
break;
default: ;
}
}
int time_PeriodZoomIn( time_ePeriod *period)
{
int changed = 1;
switch( *period) {
case time_ePeriod_Last10Minutes:
case time_ePeriod_10Minutes:
*period = time_ePeriod_OneMinute;
break;
case time_ePeriod_OneHour:
case time_ePeriod_LastHour:
*period = time_ePeriod_10Minutes;
break;
case time_ePeriod_Today:
case time_ePeriod_Yesterday:
case time_ePeriod_OneDay:
*period = time_ePeriod_OneHour;
break;
case time_ePeriod_ThisWeek:
case time_ePeriod_LastWeek:
case time_ePeriod_OneWeek:
*period = time_ePeriod_OneDay;
break;
case time_ePeriod_ThisMonth:
case time_ePeriod_LastMonth:
case time_ePeriod_OneMonth:
*period = time_ePeriod_OneWeek;
break;
case time_ePeriod_ThisYear:
case time_ePeriod_OneYear:
*period = time_ePeriod_OneMonth;
break;
case time_ePeriod_AllTime:
*period = time_ePeriod_OneYear;
break;
default:
changed = 0;
}
return changed;
}
int time_PeriodZoomOut( time_ePeriod *period)
{
int changed = 1;
switch( *period) {
case time_ePeriod_OneMinute:
case time_ePeriod_LastMinute:
*period = time_ePeriod_10Minutes;
break;
case time_ePeriod_Last10Minutes:
case time_ePeriod_10Minutes:
*period = time_ePeriod_OneHour;
break;
case time_ePeriod_OneHour:
case time_ePeriod_LastHour:
*period = time_ePeriod_OneDay;
break;
case time_ePeriod_Today:
case time_ePeriod_Yesterday:
case time_ePeriod_OneDay:
*period = time_ePeriod_OneWeek;
break;
case time_ePeriod_ThisWeek:
case time_ePeriod_LastWeek:
case time_ePeriod_OneWeek:
*period = time_ePeriod_OneMonth;
break;
case time_ePeriod_ThisMonth:
case time_ePeriod_LastMonth:
case time_ePeriod_OneMonth:
*period = time_ePeriod_OneYear;
break;
case time_ePeriod_ThisYear:
case time_ePeriod_OneYear:
*period = time_ePeriod_AllTime;
break;
default:
changed = 0;
}
return changed;
}
...@@ -73,6 +73,30 @@ typedef enum { ...@@ -73,6 +73,30 @@ typedef enum {
time_eFormat_NumDateAndTime = 3 //!< Date and time format, 2005-01-01 00:00:00 time_eFormat_NumDateAndTime = 3 //!< Date and time format, 2005-01-01 00:00:00
} time_eFormat; } time_eFormat;
typedef enum {
time_ePeriod_,
time_ePeriod_UserDefined,
time_ePeriod_OneMinute,
time_ePeriod_10Minutes,
time_ePeriod_OneHour,
time_ePeriod_OneDay,
time_ePeriod_OneWeek,
time_ePeriod_OneMonth,
time_ePeriod_OneYear,
time_ePeriod_LastMinute,
time_ePeriod_Last10Minutes,
time_ePeriod_LastHour,
time_ePeriod_Today,
time_ePeriod_Yesterday,
time_ePeriod_ThisWeek,
time_ePeriod_LastWeek,
time_ePeriod_ThisMonth,
time_ePeriod_LastMonth,
time_ePeriod_ThisYear,
time_ePeriod_AllTime,
time_ePeriod__
} time_ePeriod;
#define SWE 0 #define SWE 0
#define GB 1 #define GB 1
...@@ -157,6 +181,17 @@ pwr_tDeltaTime * time_ZeroD (pwr_tDeltaTime*); ...@@ -157,6 +181,17 @@ pwr_tDeltaTime * time_ZeroD (pwr_tDeltaTime*);
void time_Sleep (float time); void time_Sleep (float time);
int time_GetTime (pwr_tTime *ts); int time_GetTime (pwr_tTime *ts);
int time_GetTimeMonotonic (pwr_tTime *ts); int time_GetTimeMonotonic (pwr_tTime *ts);
int time_PeriodPreviousMonth( pwr_tTime *time, pwr_tTime *from, pwr_tTime *to);
int time_PeriodPreviousWeek( pwr_tTime *time, pwr_tTime *from, pwr_tTime *to);
void time_PreviousDayBreak( pwr_tTime *time, pwr_tTime *daybreak);
void time_Period( time_ePeriod period, pwr_tTime *from, pwr_tTime *to, pwr_tTime *center,
int daybreak);
void time_PreviousPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime *prev_to,
pwr_tTime *from, pwr_tTime *to);
void time_NextPeriod( time_ePeriod period, pwr_tTime *prev_from, pwr_tTime *prev_to,
pwr_tTime *from, pwr_tTime *to);
int time_PeriodZoomIn( time_ePeriod *period);
int time_PeriodZoomOut( time_ePeriod *period);
#if defined(OS_ELN) #if defined(OS_ELN)
......
...@@ -50,6 +50,71 @@ ...@@ -50,6 +50,71 @@
#include "ge_curve_gtk.h" #include "ge_curve_gtk.h"
#include "ge_msg.h" #include "ge_msg.h"
typedef struct {
char text[40];
time_ePeriod period;
} ge_sTimeComboText;
ge_sTimeComboText curve_timecombo_text[] = {
{"One Minute", time_ePeriod_OneMinute},
{"10 Minutes", time_ePeriod_10Minutes},
{"One Hour", time_ePeriod_OneHour},
{"One Day", time_ePeriod_OneDay},
{"One Week", time_ePeriod_OneWeek},
{"One Month", time_ePeriod_OneMonth},
{"One Year", time_ePeriod_OneYear},
{"Last Minute", time_ePeriod_LastMinute},
{"Last 10 Minutes", time_ePeriod_Last10Minutes},
{"Last Hour", time_ePeriod_LastHour},
{"Today", time_ePeriod_Today},
{"Yesterday", time_ePeriod_Yesterday},
{"This Week", time_ePeriod_ThisWeek},
{"Last Week", time_ePeriod_LastWeek},
{"This Month", time_ePeriod_ThisMonth},
{"Last Month", time_ePeriod_LastMonth},
{"This Year", time_ePeriod_ThisYear},
{"All Time", time_ePeriod_AllTime},
{"Edit", time_ePeriod_UserDefined},
{"", time_ePeriod_}};
void GeCurveGtk::set_period( time_ePeriod period, int nocallback)
{
for ( int i = 0; curve_timecombo_text[i].text[0]; i++) {
if ( curve_timecombo_text[i].period == period) {
if ( nocallback)
disable_timecombo_callback = 1;
gtk_combo_box_set_active( GTK_COMBO_BOX(timebox_timecombo), i);
if ( nocallback)
disable_timecombo_callback = 0;
break;
}
}
}
int GeCurveGtk::get_period( time_ePeriod *period)
{
gchar *gtext;
*period = time_ePeriod_;
gtext = gtk_combo_box_get_active_text( GTK_COMBO_BOX(timebox_timecombo));
if ( !gtext)
return 0;
for ( int i = 0; curve_timecombo_text[i].text[0]; i++) {
if ( strcmp( CoWowGtk::translate_utf8( curve_timecombo_text[i].text), gtext) == 0) {
*period = curve_timecombo_text[i].period;
g_free( gtext);
return 1;
}
}
g_free( gtext);
return 0;
}
void GeCurveGtk::activate_exit( GtkWidget *w, gpointer data) void GeCurveGtk::activate_exit( GtkWidget *w, gpointer data)
{ {
GeCurve *curve = (GeCurve *)data; GeCurve *curve = (GeCurve *)data;
...@@ -121,20 +186,83 @@ void GeCurveGtk::activate_scroll_left( GtkWidget *w, gpointer data) ...@@ -121,20 +186,83 @@ void GeCurveGtk::activate_scroll_left( GtkWidget *w, gpointer data)
curve->set_inputfocus(); curve->set_inputfocus();
} }
void GeCurveGtk::activate_higher_res( GtkWidget *w, gpointer data) void GeCurveGtk::activate_increase_period( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
if ( curve->increase_period_cb)
(curve->increase_period_cb)( curve->parent_ctx);
}
void GeCurveGtk::activate_reload( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
if ( curve->reload_cb)
(curve->reload_cb)( curve->parent_ctx);
}
void GeCurveGtk::activate_add( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
if ( curve->add_cb)
(curve->add_cb)( curve->parent_ctx);
}
void GeCurveGtk::activate_remove( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
if ( curve->remove_cb)
(curve->remove_cb)( curve->parent_ctx);
}
void GeCurveGtk::activate_prev_period( GtkWidget *w, gpointer data)
{ {
GeCurve *curve = (GeCurve *)data; GeCurve *curve = (GeCurve *)data;
if ( curve->higher_res_cb) if ( curve->prev_period_cb)
(curve->higher_res_cb)( curve->parent_ctx); (curve->prev_period_cb)( curve->parent_ctx);
} }
void GeCurveGtk::activate_lower_res( GtkWidget *w, gpointer data) void GeCurveGtk::activate_next_period( GtkWidget *w, gpointer data)
{ {
GeCurve *curve = (GeCurve *)data; GeCurve *curve = (GeCurve *)data;
if ( curve->lower_res_cb) if ( curve->next_period_cb)
(curve->lower_res_cb)( curve->parent_ctx); (curve->next_period_cb)( curve->parent_ctx);
}
void GeCurveGtk::activate_decrease_period( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
if ( curve->decrease_period_cb)
(curve->decrease_period_cb)( curve->parent_ctx);
}
void GeCurveGtk::activate_timecombo( GtkWidget *w, gpointer data)
{
GeCurve *curve = (GeCurve *)data;
time_ePeriod period;
gchar *gtext;
int sts;
if ( ((GeCurveGtk *)curve)->disable_timecombo_callback)
return;
gtext = gtk_combo_box_get_active_text( GTK_COMBO_BOX(((GeCurveGtk *)curve)->timebox_timecombo));
if ( !gtext)
return;
sts = ((GeCurveGtk *)curve)->get_period( &period);
if ( EVEN(sts)) return;
if ( period == time_ePeriod_UserDefined)
curve->activate_edit();
else
curve->activate_period( period);
} }
void GeCurveGtk::activate_background( GtkWidget *w, gpointer data) void GeCurveGtk::activate_background( GtkWidget *w, gpointer data)
...@@ -200,10 +328,9 @@ void GeCurveGtk::activate_minmax_cancel( GtkWidget *w, gpointer data) ...@@ -200,10 +328,9 @@ void GeCurveGtk::activate_minmax_cancel( GtkWidget *w, gpointer data)
g_object_set( ((GeCurveGtk *)curve)->minmax_widget, "visible", FALSE, NULL); g_object_set( ((GeCurveGtk *)curve)->minmax_widget, "visible", FALSE, NULL);
} }
void GeCurveGtk::enable_resolution_buttons() void GeCurveGtk::enable_timebox()
{ {
g_object_set( tools_higher_res, "visible", TRUE, NULL); g_object_set( sea_timebox, "visible", TRUE, NULL);
g_object_set( tools_lower_res, "visible", TRUE, NULL);
} }
void GeCurveGtk::pop() void GeCurveGtk::pop()
...@@ -264,6 +391,57 @@ void GeCurveGtk::open_minmax( int idx) ...@@ -264,6 +391,57 @@ void GeCurveGtk::open_minmax( int idx)
minmax_idx = idx; minmax_idx = idx;
} }
void GeCurveGtk::set_times( pwr_tTime *from, pwr_tTime *to)
{
char timestr[32];
time_AtoFormAscii( to, SWE, SECOND, timestr, sizeof(timestr));
gint pos = 0;
gtk_editable_delete_text( GTK_EDITABLE(timebox_stop_time), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(timebox_stop_time), timestr,
strlen(timestr), &pos);
time_AtoFormAscii( from, SWE, SECOND, timestr, sizeof(timestr));
pos = 0;
gtk_editable_delete_text( GTK_EDITABLE(timebox_start_time), 0, -1);
gtk_editable_insert_text( GTK_EDITABLE(timebox_start_time), timestr,
strlen(timestr), &pos);
}
void GeCurveGtk::set_times_sensitivity( int sensitive)
{
gtk_widget_set_sensitive( timebox_start_time, sensitive ? TRUE : FALSE);
gtk_widget_set_sensitive( timebox_stop_time, sensitive ? TRUE : FALSE);
}
pwr_tStatus GeCurveGtk::get_times( pwr_tTime *from, pwr_tTime *to)
{
char *from_p, *to_p;
pwr_tStatus sts;
from_p = gtk_editable_get_chars( GTK_EDITABLE(timebox_start_time), 0, -1);
to_p = gtk_editable_get_chars( GTK_EDITABLE(timebox_stop_time), 0, -1);
sts = time_FormAsciiToA( from_p, SWE, SECOND, from);
if ( EVEN(sts)) {
g_free( from_p);
g_free( to_p);
return sts;
}
sts = time_FormAsciiToA( to_p, SWE, SECOND, to);
if ( EVEN(sts)) {
g_free( from_p);
g_free( to_p);
return sts;
}
g_free( from_p);
g_free( to_p);
return 1;
}
void GeCurveGtk::set_inputfocus() void GeCurveGtk::set_inputfocus()
{ {
gtk_widget_grab_focus( growcurve_main_widget); gtk_widget_grab_focus( growcurve_main_widget);
...@@ -308,7 +486,8 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx, ...@@ -308,7 +486,8 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
GeCurveData *curve_data, GeCurveData *curve_data,
int pos_right) : int pos_right) :
GeCurve( gc_parent_ctx, curve_name, filename, curve_data, pos_right), GeCurve( gc_parent_ctx, curve_name, filename, curve_data, pos_right),
minmax_widget(0) minmax_widget(0), disable_timecombo_callback(0)
{ {
const int window_width = 900; const int window_width = 900;
const int window_height = 700; const int window_height = 700;
...@@ -490,21 +669,108 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx, ...@@ -490,21 +669,108 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
g_object_set( tools_page_right, "can-focus", FALSE, NULL); g_object_set( tools_page_right, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_page_right, CoWowGtk::translate_utf8("Page right"), ""); gtk_toolbar_append_widget( tools, tools_page_right, CoWowGtk::translate_utf8("Page right"), "");
tools_higher_res = gtk_button_new(); // Time box
GtkToolbar *timetools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
GtkWidget *sea_time_start_label = gtk_label_new( CoWowGtk::translate_utf8("Time"));
gtk_widget_set_size_request( sea_time_start_label, 70, -1);
gtk_misc_set_alignment( GTK_MISC(sea_time_start_label), 0.0, 0.5);
gtk_toolbar_append_widget( timetools, sea_time_start_label, "", "");
// Time option menu
timebox_timecombo = gtk_combo_box_new_text();
for ( int i = 0; curve_timecombo_text[i].text[0]; i++)
gtk_combo_box_append_text( GTK_COMBO_BOX(timebox_timecombo),
CoWowGtk::translate_utf8(curve_timecombo_text[i].text));
g_signal_connect(timebox_timecombo, "changed", G_CALLBACK(activate_timecombo), this);
gtk_toolbar_append_widget( timetools, timebox_timecombo, 0, "");
timebox_start_time = gtk_entry_new();
gtk_widget_set_size_request( timebox_start_time, 160, -1);
gtk_toolbar_append_widget( timetools, timebox_start_time, "", "");
GtkWidget *sea_time_stop_label = gtk_label_new( CoWowGtk::translate_utf8("-"));
gtk_widget_set_size_request( sea_time_stop_label, 20, -1);
gtk_toolbar_append_widget( timetools, sea_time_stop_label, "", "");
timebox_stop_time = gtk_entry_new();
gtk_widget_set_size_request( timebox_stop_time, 160, -1);
gtk_toolbar_append_widget( timetools, timebox_stop_time, "", "");
GtkWidget *timebox_prev_period = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_scroll_left.png");
gtk_container_add( GTK_CONTAINER(timebox_prev_period),
gtk_image_new_from_file( fname));
g_signal_connect(timebox_prev_period, "clicked", G_CALLBACK(activate_prev_period), this);
g_object_set( timebox_prev_period, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( timetools, timebox_prev_period, CoWowGtk::translate_utf8("Previous period"), "");
GtkWidget *timebox_next_period = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_scroll_right.png");
gtk_container_add( GTK_CONTAINER(timebox_next_period),
gtk_image_new_from_file( fname));
g_signal_connect(timebox_next_period, "clicked", G_CALLBACK(activate_next_period), this);
g_object_set( timebox_next_period, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( timetools, timebox_next_period, CoWowGtk::translate_utf8("Next period"), "");
GtkWidget *timebox_increase_period = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_up.png"); dcli_translate_filename( fname, "$pwr_exe/xtt_up.png");
gtk_container_add( GTK_CONTAINER(tools_higher_res), gtk_container_add( GTK_CONTAINER(timebox_increase_period),
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect(tools_higher_res, "clicked", G_CALLBACK(activate_higher_res), this); g_signal_connect(timebox_increase_period, "clicked", G_CALLBACK(activate_increase_period), this);
g_object_set( tools_higher_res, "can-focus", FALSE, NULL); g_object_set( timebox_increase_period, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_higher_res, CoWowGtk::translate_utf8("Higer resolution"), ""); gtk_toolbar_append_widget( timetools, timebox_increase_period, CoWowGtk::translate_utf8("Increase period"), "");
tools_lower_res = gtk_button_new(); GtkWidget *timebox_decrease_period = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_down.png"); dcli_translate_filename( fname, "$pwr_exe/xtt_down.png");
gtk_container_add( GTK_CONTAINER(tools_lower_res), gtk_container_add( GTK_CONTAINER(timebox_decrease_period),
gtk_image_new_from_file( fname));
g_signal_connect(timebox_decrease_period, "clicked", G_CALLBACK(activate_decrease_period), this);
g_object_set( timebox_decrease_period, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( timetools, timebox_decrease_period, CoWowGtk::translate_utf8("Decrease period"), "");
GtkWidget *timebox_reload = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/ge_reload.png");
gtk_container_add( GTK_CONTAINER(timebox_reload),
gtk_image_new_from_file( fname));
g_signal_connect(timebox_reload, "clicked", G_CALLBACK(activate_reload), this);
g_object_set( timebox_reload, "can-focus", FALSE, NULL);
// gtk_toolbar_append_widget( timetools, timebox_reload, CoWowGtk::translate_utf8("Update"), "");
GtkWidget *timebox_add = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_add.png");
gtk_container_add( GTK_CONTAINER(timebox_add),
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect(tools_lower_res, "clicked", G_CALLBACK(activate_lower_res), this); g_signal_connect(timebox_add, "clicked", G_CALLBACK(activate_add), this);
g_object_set( tools_lower_res, "can-focus", FALSE, NULL); g_object_set( timebox_add, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_lower_res, CoWowGtk::translate_utf8("Lower resolution"), ""); // gtk_toolbar_append_widget( timetools, timebox_add, CoWowGtk::translate_utf8("Add curve item"), "");
GtkWidget *timebox_remove = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_remove.png");
gtk_container_add( GTK_CONTAINER(timebox_remove),
gtk_image_new_from_file( fname));
g_signal_connect(timebox_remove, "clicked", G_CALLBACK(activate_remove), this);
g_object_set( timebox_remove, "can-focus", FALSE, NULL);
// gtk_toolbar_append_widget( timetools, timebox_remove, CoWowGtk::translate_utf8("Remove selected curve"), "");
GtkToolbar *curvebuttonbox = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
//GtkWidget *curvebuttonbox = gtk_hbox_new( FALSE, 0);
gtk_toolbar_append_widget( curvebuttonbox, timebox_reload, CoWowGtk::translate_utf8("Update curve"), "");
gtk_toolbar_append_widget( curvebuttonbox, timebox_add, CoWowGtk::translate_utf8("Add curve item"), "");
sea_timebox = gtk_hbox_new( FALSE, 0);
// gtk_box_pack_start( GTK_BOX(sea_timebox), sea_time_start_label, FALSE, FALSE, 0);
// gtk_box_pack_start( GTK_BOX(sea_timebox), timebox_timecombo, FALSE, FALSE, 10);
// gtk_box_pack_start( GTK_BOX(sea_timebox), timebox_start_time, FALSE, FALSE, 0);
// gtk_box_pack_start( GTK_BOX(sea_timebox), sea_time_stop_label, FALSE, FALSE, 0);
// gtk_box_pack_start( GTK_BOX(sea_timebox), timebox_stop_time, FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(sea_timebox), GTK_WIDGET(timetools), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(sea_timebox), gtk_hseparator_new(), FALSE, FALSE, 10);
gtk_box_pack_start( GTK_BOX(sea_timebox), GTK_WIDGET(curvebuttonbox), FALSE, FALSE, 0);
GtkWidget *w; GtkWidget *w;
grownames_main_widget = scrolledgrowwidgetgtk_new( init_grownames_cb, this, &w); grownames_main_widget = scrolledgrowwidgetgtk_new( init_grownames_cb, this, &w);
...@@ -531,9 +797,14 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx, ...@@ -531,9 +797,14 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
gtk_paned_pack2( GTK_PANED(vpaned2), nav_widget, FALSE, TRUE); gtk_paned_pack2( GTK_PANED(vpaned2), nav_widget, FALSE, TRUE);
gtk_widget_show_all( vpaned2); gtk_widget_show_all( vpaned2);
GtkWidget *tools_box = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(tools_box), GTK_WIDGET(tools), FALSE, FALSE, 0);
// gtk_box_pack_start( GTK_BOX(tools_box), GTK_WIDGET(sea_timebox), FALSE, FALSE, 0);
GtkWidget *vbox = gtk_vbox_new( FALSE, 0); GtkWidget *vbox = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(tools), FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(tools_box), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(sea_timebox), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(vpaned1), TRUE, TRUE, 0); gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(vpaned1), TRUE, TRUE, 0);
gtk_container_add( GTK_CONTAINER(toplevel), vbox); gtk_container_add( GTK_CONTAINER(toplevel), vbox);
...@@ -542,10 +813,12 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx, ...@@ -542,10 +813,12 @@ GeCurveGtk::GeCurveGtk( void *gc_parent_ctx,
gtk_paned_set_position( GTK_PANED(vpaned1), names_height); gtk_paned_set_position( GTK_PANED(vpaned1), names_height);
gtk_paned_set_position( GTK_PANED(vpaned2), window_height - names_height - nav_height - 50); gtk_paned_set_position( GTK_PANED(vpaned2), window_height - names_height - nav_height - 50);
g_object_set( tools_higher_res, "visible", FALSE, NULL); g_object_set( sea_timebox, "visible", FALSE, NULL);
g_object_set( tools_lower_res, "visible", FALSE, NULL);
wow = new CoWowGtk( toplevel); wow = new CoWowGtk( toplevel);
gtk_combo_box_set_active( GTK_COMBO_BOX(timebox_timecombo), 2);
} }
static gint minmax_delete_event( GtkWidget *w, GdkEvent *event, gpointer curve) static gint minmax_delete_event( GtkWidget *w, GdkEvent *event, gpointer curve)
......
...@@ -47,9 +47,12 @@ class GeCurveGtk : public GeCurve { ...@@ -47,9 +47,12 @@ class GeCurveGtk : public GeCurve {
GtkWidget *minmax_widget; GtkWidget *minmax_widget;
GtkWidget *minmax_textmin_widget; GtkWidget *minmax_textmin_widget;
GtkWidget *minmax_textmax_widget; GtkWidget *minmax_textmax_widget;
GtkWidget *tools_higher_res; GtkWidget *sea_timebox;
GtkWidget *tools_lower_res; GtkWidget *timebox_start_time;
GtkWidget *timebox_stop_time;
GtkWidget *timebox_timecombo;
CoWowFocusTimerGtk focustimer; CoWowFocusTimerGtk focustimer;
int disable_timecombo_callback;
void pop(); void pop();
void write_title( char *str); void write_title( char *str);
...@@ -58,7 +61,12 @@ class GeCurveGtk : public GeCurve { ...@@ -58,7 +61,12 @@ class GeCurveGtk : public GeCurve {
void axis_set_width( int width); void axis_set_width( int width);
void create_minmax_dialog(); void create_minmax_dialog();
void set_inputfocus(); void set_inputfocus();
void enable_resolution_buttons(); void enable_timebox();
void set_times( pwr_tTime *from, pwr_tTime *to);
void set_times_sensitivity( int sensitive);
pwr_tStatus get_times( pwr_tTime *from, pwr_tTime *to);
int get_period( time_ePeriod *period);
void set_period( time_ePeriod period, int nocallback);
~GeCurveGtk(); ~GeCurveGtk();
...@@ -72,8 +80,14 @@ class GeCurveGtk : public GeCurve { ...@@ -72,8 +80,14 @@ class GeCurveGtk : public GeCurve {
static void activate_page_right( GtkWidget *w, gpointer data); static void activate_page_right( GtkWidget *w, gpointer data);
static void activate_scroll_left( GtkWidget *w, gpointer data); static void activate_scroll_left( GtkWidget *w, gpointer data);
static void activate_scroll_right( GtkWidget *w, gpointer data); static void activate_scroll_right( GtkWidget *w, gpointer data);
static void activate_higher_res( GtkWidget *w, gpointer data); static void activate_increase_period( GtkWidget *w, gpointer data);
static void activate_lower_res( GtkWidget *w, gpointer data); static void activate_decrease_period( GtkWidget *w, gpointer data);
static void activate_reload( GtkWidget *w, gpointer data);
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_remove( GtkWidget *w, gpointer data);
static void activate_timecombo( GtkWidget *w, gpointer data);
static void activate_background( GtkWidget *w, gpointer data); static void activate_background( GtkWidget *w, gpointer data);
static void activate_showname( GtkWidget *w, gpointer data); static void activate_showname( GtkWidget *w, gpointer data);
static void activate_filledcurves( GtkWidget *w, gpointer data); static void activate_filledcurves( GtkWidget *w, gpointer data);
......
...@@ -111,6 +111,56 @@ void GeCurve::activate_help() ...@@ -111,6 +111,56 @@ void GeCurve::activate_help()
(help_cb)( parent_ctx); (help_cb)( parent_ctx);
} }
void GeCurve::activate_edit()
{
set_times_sensitivity( 1);
}
void GeCurve::activate_period( time_ePeriod period)
{
pwr_tTime from;
pwr_tTime to;
pwr_tTime center;
double ll_x, ll_y, ur_x, ur_y;
int low, high;
if ( center_from_window) {
// Get the center time
measure_window( &ll_x, &ll_y, &ur_x, &ur_y);
low = int( cd->x_min_value_axis[0] +
ll_x / 200 * (cd->x_max_value_axis[0] - cd->x_min_value_axis[0]));
high = int( cd->x_min_value_axis[0] +
ur_x / 200 * (cd->x_max_value_axis[0] - cd->x_min_value_axis[0]));
center_from_window = 0;
}
else {
// Get period from current time intervall
pwr_tStatus sts;
pwr_tTime t_low, t_high;
sts = get_times( &t_low, &t_high);
if ( EVEN(sts)) {
// No previous valid time
time_Period( period, &from, &to, 0, 1);
set_times_sensitivity( 0);
set_times( &from, &to);
return;
}
high = t_high.tv_sec;
low = t_low.tv_sec;
}
center.tv_sec = low + (high - low)/2;
center.tv_nsec = 0;
time_Period( period, &from, &to, &center, 1);
set_times_sensitivity( 0);
set_times( &from, &to);
}
void GeCurve::activate_minmax_ok( double min_value, double max_value) void GeCurve::activate_minmax_ok( double min_value, double max_value)
{ {
...@@ -588,19 +638,8 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data) ...@@ -588,19 +638,8 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
{ {
GeCurve *curve = (GeCurve *) client_data; GeCurve *curve = (GeCurve *) client_data;
curve->grownames_ctx = (GrowCtx *) fctx; curve->grownames_ctx = (GrowCtx *) fctx;
grow_tObject t1;
grow_sAttributes grow_attr; grow_sAttributes grow_attr;
unsigned long mask; unsigned long mask;
glow_eDrawType color;
double x;
int date = (strcmp( curve->cd->x_format[0], "%10t") == 0 ||
strcmp( curve->cd->x_format[0], "%11t") == 0) ? 1 : 0;
int time_size;
if ( date)
time_size = 8;
else
time_size = 3;
mask = 0; mask = 0;
// Double buffer is used for print // Double buffer is used for print
...@@ -621,9 +660,29 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data) ...@@ -621,9 +660,29 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
grow_EnableEvent( (GrowCtx *)curve->grownames_ctx, glow_eEvent_HotRequest, grow_EnableEvent( (GrowCtx *)curve->grownames_ctx, glow_eEvent_HotRequest,
glow_eEventType_CallBack, grownames_cb); glow_eEventType_CallBack, grownames_cb);
curve->config_names();
return 1;
}
int GeCurve::config_names()
{
grow_tObject t1;
glow_eDrawType color;
double x;
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 = 8;
else
time_size = 3;
// Create nodeclass for mark values // Create nodeclass for mark values
grow_New( grownames_ctx);
grow_tNodeClass nc; grow_tNodeClass nc;
grow_CreateNodeClass( curve->grownames_ctx, "MarkVal", glow_eNodeGroup_Common, &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_eDrawType_LineGray, 1, 0,
glow_mDisplayLevel_1, 0, 0, 0, glow_mDisplayLevel_1, 0, 0, 0,
glow_eDrawType_Line, NULL); glow_eDrawType_Line, NULL);
...@@ -633,125 +692,125 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data) ...@@ -633,125 +692,125 @@ int GeCurve::init_grownames_cb( GlowCtx *fctx, void *client_data)
// Draw header // Draw header
grow_tObject o1; grow_tObject o1;
grow_CreateGrowLine( curve->grownames_ctx, "", 0, 0.75, 60, 0.75, grow_CreateGrowLine( grownames_ctx, "", 0, 0.75, 60, 0.75,
glow_eDrawType_Color34, 2, 0, NULL, &o1); glow_eDrawType_Color34, 2, 0, NULL, &o1);
grow_CreateGrowRect( curve->grownames_ctx, "", 0, 0, 60, 0.8, grow_CreateGrowRect( grownames_ctx, "", 0, 0, 60, 0.8,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1); glow_eDrawType_Color32, NULL, &o1);
x = 0.8; x = 0.8;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("View"), grow_CreateGrowText( grownames_ctx, "", Lng::translate("View"),
x, 0.6, glow_eDrawType_TextHelvetica, x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1); glow_mDisplayLevel_1, NULL, &o1);
x += 1.8; x += 1.8;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Cursor"), grow_CreateGrowText( grownames_ctx, "", Lng::translate("Cursor"),
x, 0.6, glow_eDrawType_TextHelvetica, x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1); glow_mDisplayLevel_1, NULL, &o1);
x += time_size + 0.2; x += time_size + 0.2;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Mark"), grow_CreateGrowText( grownames_ctx, "", Lng::translate("Mark"),
x, 0.6, glow_eDrawType_TextHelvetica, x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1); glow_mDisplayLevel_1, NULL, &o1);
x += time_size + 0.2; x += time_size + 0.2;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Unit"), grow_CreateGrowText( grownames_ctx, "", Lng::translate("Unit"),
x, 0.6, glow_eDrawType_TextHelvetica, x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1); glow_mDisplayLevel_1, NULL, &o1);
x += 2; x += 2;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Scale"), grow_CreateGrowText( grownames_ctx, "", Lng::translate("Scale"),
x, 0.6, glow_eDrawType_TextHelvetica, x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1); glow_mDisplayLevel_1, NULL, &o1);
x += 3; x += 3;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Attribute"), grow_CreateGrowText( grownames_ctx, "", Lng::translate("Attribute"),
x, 0.6, glow_eDrawType_TextHelvetica, x, 0.6, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &o1); glow_mDisplayLevel_1, NULL, &o1);
for ( int i = 0; i < curve->cd->cols; i++) { for ( int i = 0; i < cd->cols; i++) {
// Draw shadowed frame // Draw shadowed frame
grow_CreateGrowRect( curve->grownames_ctx, "", 0, (i+0.8), 60, 1, grow_CreateGrowRect( grownames_ctx, "", 0, (i+0.8), 60, 1,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1); glow_eDrawType_Color32, NULL, &o1);
// Draw color rectangle // Draw color rectangle
grow_CreateGrowRect( curve->grownames_ctx, "", 0.25, (i+0.8)+0.3, 0.75, 0.5, 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, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
curve->cd->color[i], NULL, &curve->name_rect[i]); cd->color[i], NULL, &name_rect[i]);
if ( curve->hide[i]) if ( hide[i])
color = glow_eDrawType_LineErase; color = glow_eDrawType_LineErase;
else else
color = glow_eDrawType_Line; color = glow_eDrawType_Line;
// Draw checkbox for hide // Draw checkbox for hide
grow_CreateGrowLine( curve->grownames_ctx, "", 1.4, (i+0.8)+0.45, 1.52, (i+0.8)+0.75, grow_CreateGrowLine( grownames_ctx, "", 1.4, (i+0.8)+0.45, 1.52, (i+0.8)+0.75,
color, 2, 0, NULL, &curve->hide_l1[i]); color, 2, 0, NULL, &hide_l1[i]);
grow_CreateGrowLine( curve->grownames_ctx, "", 1.50, (i+0.8)+0.75, 1.77, (i+0.8)+0.35, grow_CreateGrowLine( grownames_ctx, "", 1.50, (i+0.8)+0.75, 1.77, (i+0.8)+0.35,
color, 2, 0, NULL, &curve->hide_l2[i]); color, 2, 0, NULL, &hide_l2[i]);
grow_CreateGrowRect( curve->grownames_ctx, "", 1.3, (i+0.8)+0.3, 0.5, 0.5, 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_Line, 1, 0, glow_mDisplayLevel_1, 0, 1, 1,
glow_eDrawType_Color32, NULL, &curve->hide_rect[i]); glow_eDrawType_Color32, NULL, &hide_rect[i]);
// Draw nodes for mark and cursor values // Draw nodes for mark and cursor values
x = 2.2; x = 2.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL, grow_CreateGrowNode( grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL,
&curve->cursor_annot[i]); &cursor_annot[i]);
x += time_size + 0.2; x += time_size + 0.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL, grow_CreateGrowNode( grownames_ctx, "", nc, x, (i+0.8)+0.05, NULL,
&curve->mark_annot[i]); &mark_annot[i]);
// Draw unit // Draw unit
x += time_size + 0.6; x += time_size + 0.6;
grow_CreateGrowText( curve->grownames_ctx, "", curve->cd->y_unit[i], grow_CreateGrowText( grownames_ctx, "", cd->y_unit[i],
x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica, x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
// Draw button for scale // Draw button for scale
x += 2; x += 2;
grow_CreateGrowRect( curve->grownames_ctx, "", x, (i+0.8)+0.1, 1.2, 0.7, 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_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eDrawType_Color33, NULL, &curve->scale_rect[i]); glow_eDrawType_Color33, NULL, &scale_rect[i]);
grow_SetObjectShadowWidth( curve->scale_rect[i], 20); grow_SetObjectShadowWidth( scale_rect[i], 20);
// Draw attribute name // Draw attribute name
x += 3; x += 3;
grow_CreateGrowText( curve->grownames_ctx, "", curve->cd->y_name[i], grow_CreateGrowText( grownames_ctx, "", cd->y_name[i],
x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica, x, (i+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
grow_SetAnnotation( curve->cursor_annot[i], 0, "0", 1); grow_SetAnnotation( cursor_annot[i], 0, "0", 1);
grow_SetAnnotation( curve->mark_annot[i], 0, "0", 1); grow_SetAnnotation( mark_annot[i], 0, "0", 1);
} }
// Draw nodes for time values // Draw nodes for time values
// Draw shadowed frame // Draw shadowed frame
grow_CreateGrowRect( curve->grownames_ctx, "", 0, (curve->cd->cols+0.8), 60, 1, grow_CreateGrowRect( grownames_ctx, "", 0, (cd->cols+0.8), 60, 1,
glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1, glow_eDrawType_Line, 1, 0, glow_mDisplayLevel_1, 0, 0, 1,
glow_eDrawType_Color32, NULL, &o1); glow_eDrawType_Color32, NULL, &o1);
x = 2.2; x = 2.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (curve->cd->cols+0.8)+0.05, NULL, grow_CreateGrowNode( grownames_ctx, "", nc, x, (cd->cols+0.8)+0.05, NULL,
&curve->cursor_annot[curve->cd->cols]); &cursor_annot[cd->cols]);
x += time_size + 0.2; x += time_size + 0.2;
grow_CreateGrowNode( curve->grownames_ctx, "", nc, x, (curve->cd->cols+0.8)+0.05, NULL, grow_CreateGrowNode( grownames_ctx, "", nc, x, (cd->cols+0.8)+0.05, NULL,
&curve->mark_annot[curve->cd->cols]); &mark_annot[cd->cols]);
// Draw unit // Draw unit
x += time_size + 0.6; x += time_size + 0.6;
grow_CreateGrowText( curve->grownames_ctx, "", "s", grow_CreateGrowText( grownames_ctx, "", "s",
x, (curve->cd->cols+0.8) + 0.75, glow_eDrawType_TextHelvetica, x, (cd->cols+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
// Draw button for scale // Draw button for scale
x += 2; x += 2;
grow_CreateGrowRect( curve->grownames_ctx, "", x, (curve->cd->cols+0.8)+0.1, 1.2, 0.7, 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_Line, 1, 0, glow_mDisplayLevel_1, 1, 1, 1,
glow_eDrawType_Color33, NULL, &curve->scale_rect[curve->cd->cols]); glow_eDrawType_Color33, NULL, &scale_rect[cd->cols]);
grow_SetObjectShadowWidth( curve->scale_rect[curve->cd->cols], 20); grow_SetObjectShadowWidth( scale_rect[cd->cols], 20);
// Draw attribute name // Draw attribute name
x += 3; x += 3;
grow_CreateGrowText( curve->grownames_ctx, "", Lng::translate("Time axis"), grow_CreateGrowText( grownames_ctx, "", Lng::translate("Time axis"),
x, (curve->cd->cols+0.8) + 0.75, glow_eDrawType_TextHelvetica, x, (cd->cols+0.8) + 0.75, glow_eDrawType_TextHelvetica,
glow_eDrawType_Line, 2, glow_eFont_LucidaSans, glow_eDrawType_Line, 2, glow_eFont_LucidaSans,
glow_mDisplayLevel_1, NULL, &t1); glow_mDisplayLevel_1, NULL, &t1);
grow_SetAnnotation( curve->cursor_annot[curve->cd->cols], 0, "0", 1); grow_SetAnnotation( cursor_annot[cd->cols], 0, "0", 1);
grow_SetAnnotation( curve->mark_annot[curve->cd->cols], 0, "0", 1); grow_SetAnnotation( mark_annot[cd->cols], 0, "0", 1);
return 1; return 1;
} }
...@@ -797,6 +856,7 @@ int GeCurve::configure_axes() ...@@ -797,6 +856,7 @@ int GeCurve::configure_axes()
double x = 0; double x = 0;
int i, idx; int i, idx;
grow_SetNodraw( growaxis_ctx);
grow_New( growaxis_ctx); grow_New( growaxis_ctx);
memset( axis_object, 0, sizeof( axis_object)); memset( axis_object, 0, sizeof( axis_object));
...@@ -858,6 +918,8 @@ int GeCurve::configure_axes() ...@@ -858,6 +918,8 @@ int GeCurve::configure_axes()
width = int( zoom_y * axis_window_width); width = int( zoom_y * axis_window_width);
axis_set_width( width); axis_set_width( width);
} }
grow_ResetNodraw( growaxis_ctx);
grow_Redraw( growaxis_ctx);
return 1; return 1;
} }
...@@ -1229,8 +1291,10 @@ GeCurve::GeCurve( void *gc_parent_ctx, ...@@ -1229,8 +1291,10 @@ 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), help_cb(0), higher_res_cb(0), lower_res_cb(0), minmax_idx(0), close_cb(0), help_cb(0), increase_period_cb(0), decrease_period_cb(0), reload_cb(0),
initial_right_position(pos_right), last_cursor_x(0), last_mark_x(0), deferred_configure_axes(0) prev_period_cb(0), next_period_cb(0), add_cb(0), remove_cb(0),
initial_right_position(pos_right), last_cursor_x(0), last_mark_x(0), deferred_configure_axes(0),
center_from_window(0)
{ {
pwr_tStatus sts; pwr_tStatus sts;
......
...@@ -143,14 +143,20 @@ class GeCurve { ...@@ -143,14 +143,20 @@ class GeCurve {
int minmax_idx; int minmax_idx;
void (*close_cb)( void *); void (*close_cb)( void *);
void (*help_cb)( void *); void (*help_cb)( void *);
void (*higher_res_cb)( void *); void (*increase_period_cb)( void *);
void (*lower_res_cb)( void *); void (*decrease_period_cb)( void *);
void (*reload_cb)( void *);
void (*prev_period_cb)( void *);
void (*next_period_cb)( void *);
void (*add_cb)( void *);
void (*remove_cb)( void *);
int initial_right_position; int initial_right_position;
char title[300]; char title[300];
double last_cursor_x; double last_cursor_x;
double last_mark_x; double last_mark_x;
int deferred_configure_axes; int deferred_configure_axes;
CoWow *wow; CoWow *wow;
int center_from_window;
GeCurve( void *gc_parent_ctx, char *curve_name, GeCurve( void *gc_parent_ctx, char *curve_name,
char *filename, GeCurveData *curve_data, int pos_right); char *filename, GeCurveData *curve_data, int pos_right);
...@@ -160,12 +166,18 @@ class GeCurve { ...@@ -160,12 +166,18 @@ class GeCurve {
virtual void resize() {} virtual void resize() {}
virtual void open_minmax( int idx) {} virtual void open_minmax( int idx) {}
virtual void axis_set_width( int width) {} virtual void axis_set_width( int width) {}
virtual void enable_resolution_buttons() {} virtual void enable_timebox() {}
virtual void set_times( pwr_tTime *from, pwr_tTime *to) {}
virtual void set_times_sensitivity( int sensitive) {}
virtual pwr_tStatus get_times( pwr_tTime *from, pwr_tTime *to) {return 0;}
virtual int get_period( time_ePeriod *period) {return 0;}
virtual void set_period( time_ePeriod period, int nocallback) {}
void set_inputfocus() {} void set_inputfocus() {}
int read_file( char *filename); int read_file( char *filename);
int configure_curves(); int configure_curves();
int configure_axes(); int configure_axes();
int config_names();
void points_added(); void points_added();
void set_title( char *str); void set_title( char *str);
void set_time( pwr_tTime time); void set_time( pwr_tTime time);
...@@ -178,10 +190,13 @@ class GeCurve { ...@@ -178,10 +190,13 @@ class GeCurve {
void activate_background(); void activate_background();
void activate_filledcurves( int set); void activate_filledcurves( int set);
void activate_help(); void activate_help();
void activate_period( time_ePeriod);
void activate_edit();
void activate_minmax_ok( double min_value, double max_value); void activate_minmax_ok( double min_value, double max_value);
void set_curvedata( GeCurveData *curve_data); void set_curvedata( GeCurveData *curve_data);
void redraw(); void redraw();
void x_to_points( double x, double *time, double *values); void x_to_points( double x, double *time, double *values);
void set_center_from_window( int val) { center_from_window = val;}
static int growcurve_cb( GlowCtx *ctx, glow_tEvent event); static int growcurve_cb( GlowCtx *ctx, glow_tEvent event);
static int init_growcurve_cb( GlowCtx *fctx, void *client_data); static int init_growcurve_cb( GlowCtx *fctx, void *client_data);
......
...@@ -238,12 +238,12 @@ HistGtk::HistGtk( void *hist_parent_ctx, ...@@ -238,12 +238,12 @@ HistGtk::HistGtk( void *hist_parent_ctx,
gtk_widget_set_size_request( sea_time_start_label, 120, -1); gtk_widget_set_size_request( sea_time_start_label, 120, -1);
gtk_misc_set_alignment( GTK_MISC(sea_time_start_label), 0.0, 0.5); gtk_misc_set_alignment( GTK_MISC(sea_time_start_label), 0.0, 0.5);
start_time_entry_w = gtk_entry_new(); start_time_entry_w = gtk_entry_new();
gtk_widget_set_size_request( start_time_entry_w, 140, -1); gtk_widget_set_size_request( start_time_entry_w, 160, -1);
GtkWidget *sea_time_stop_label = gtk_label_new( CoWowGtk::translate_utf8("Stop time")); GtkWidget *sea_time_stop_label = gtk_label_new( CoWowGtk::translate_utf8("Stop time"));
gtk_widget_set_size_request( sea_time_stop_label, 120, -1); gtk_widget_set_size_request( sea_time_stop_label, 120, -1);
stop_time_entry_w = gtk_entry_new(); stop_time_entry_w = gtk_entry_new();
gtk_widget_set_size_request( start_time_entry_w, 140, -1); gtk_widget_set_size_request( stop_time_entry_w, 160, -1);
// Time option menu // Time option menu
GtkWidget *sea_time_all = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("All ")); GtkWidget *sea_time_all = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("All "));
...@@ -262,10 +262,10 @@ HistGtk::HistGtk( void *hist_parent_ctx, ...@@ -262,10 +262,10 @@ HistGtk::HistGtk( void *hist_parent_ctx,
g_signal_connect( sea_time_lastw, "activate", G_CALLBACK( lastw_cb), this); g_signal_connect( sea_time_lastw, "activate", G_CALLBACK( lastw_cb), this);
GtkWidget *sea_time_thism = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("This Month")); GtkWidget *sea_time_thism = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("This Month"));
g_signal_connect( sea_time_thism, "activate", G_CALLBACK( thisw_cb), this); g_signal_connect( sea_time_thism, "activate", G_CALLBACK( thism_cb), this);
GtkWidget *sea_time_lastm = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("Last Month")); GtkWidget *sea_time_lastm = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("Last Month"));
g_signal_connect( sea_time_lastm, "activate", G_CALLBACK( lastw_cb), this); g_signal_connect( sea_time_lastm, "activate", G_CALLBACK( lastm_cb), this);
GtkWidget *sea_time_time = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("Time")); GtkWidget *sea_time_time = gtk_menu_item_new_with_label( CoWowGtk::translate_utf8("Time"));
g_signal_connect( sea_time_time, "activate", G_CALLBACK( time_cb), this); g_signal_connect( sea_time_time, "activate", G_CALLBACK( time_cb), this);
...@@ -423,25 +423,8 @@ HistGtk::HistGtk( void *hist_parent_ctx, ...@@ -423,25 +423,8 @@ HistGtk::HistGtk( void *hist_parent_ctx,
pwr_tStatus sts; pwr_tStatus sts;
pwr_tOName name_str; pwr_tOName name_str;
gint pos = 0; gint pos = 0;
char buf[80];
pwr_tTime StopTime;
pwr_tTime StartTime;
strcpy( buf, "1970-05-05 00:00:00"); ((Hist *)this)->all_cb();
gtk_editable_insert_text( GTK_EDITABLE(start_time_entry_w), buf,
strlen(buf), &pos);
gtk_widget_set_sensitive( start_time_entry_w, FALSE);
sts = time_GetTime( &StopTime);
sts = AdjustForDayBreak( this, &StopTime, &StartTime);
StopTime = StartTime;
StopTime.tv_sec += ONEDAY;
time_AtoFormAscii(&StopTime, SWE, SECOND, buf, sizeof(buf));
gtk_editable_insert_text( GTK_EDITABLE(stop_time_entry_w), buf,
strlen(buf), &pos);
gtk_widget_set_sensitive( stop_time_entry_w, FALSE);
// If objid is applied, search for this object // If objid is applied, search for this object
pos = 0; pos = 0;
......
...@@ -69,9 +69,14 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx, ...@@ -69,9 +69,14 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1); curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1);
curve->close_cb = sevhist_close_cb; curve->close_cb = sevhist_close_cb;
curve->help_cb = sevhist_help_cb; curve->help_cb = sevhist_help_cb;
curve->higher_res_cb = sevhist_higher_res_cb; curve->increase_period_cb = sevhist_increase_period_cb;
curve->lower_res_cb = sevhist_lower_res_cb; curve->decrease_period_cb = sevhist_decrease_period_cb;
curve->enable_resolution_buttons(); curve->reload_cb = sevhist_reload_cb;
curve->prev_period_cb = sevhist_prev_period_cb;
curve->next_period_cb = sevhist_next_period_cb;
curve->add_cb = sevhist_add_cb;
curve->remove_cb = sevhist_remove_cb;
curve->enable_timebox();
wow = new CoWowGtk( parent_widget); wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new(); timerid = wow->timer_new();
......
...@@ -139,67 +139,40 @@ void Hist::activate_helpevent() ...@@ -139,67 +139,40 @@ void Hist::activate_helpevent()
void Hist::today_cb() void Hist::today_cb()
{ {
int Sts;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
Sts = time_GetTime( &StopTime); time_Period( time_ePeriod_Today, &StartTime, &StopTime, 0, 1);
Sts = AdjustForDayBreak( this, &StopTime, &StartTime);
StopTime = StartTime;
StopTime.tv_sec += ONEDAY;
if ( time_Acomp( &StartTime, &StopTime) > 0)
StartTime.tv_sec -= ONEDAY;
SetListTime( StartTime, StopTime, INSENS); SetListTime( StartTime, StopTime, INSENS);
} }
void Hist::yesterday_cb() void Hist::yesterday_cb()
{ {
int Sts;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
Sts = time_GetTime( &StopTime); time_Period( time_ePeriod_Yesterday, &StartTime, &StopTime, 0, 0);
Sts = AdjustForDayBreak( this, &StopTime, &StartTime);
if ( time_Acomp( &StartTime, &StopTime) > 0)
StartTime.tv_sec -= ONEDAY;
StopTime = StartTime;
StartTime.tv_sec -= ONEDAY;
SetListTime( StartTime, StopTime, INSENS); SetListTime( StartTime, StopTime, INSENS);
} }
void Hist::thisw_cb() void Hist::thisw_cb()
{ {
int Sts;
pwr_tTime CurrTime;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
Sts = time_GetTime( &CurrTime); time_Period( time_ePeriod_ThisWeek, &StartTime, &StopTime, 0, 1);
Sts = GoBackWeek( CurrTime, &StartTime, &StopTime); SetListTime( StartTime, StopTime, INSENS);
StopTime.tv_sec += ONEDAY;
CurrTime.tv_sec += ONEDAY;
SetListTime( StopTime, CurrTime, INSENS);
} }
void Hist::lastw_cb() void Hist::lastw_cb()
{ {
int Sts;
pwr_tTime CurrTime;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
Sts = time_GetTime( &CurrTime); time_Period( time_ePeriod_LastWeek, &StartTime, &StopTime, 0, 0);
Sts = GoBackWeek( CurrTime, &StartTime, &StopTime);
SetListTime( StartTime, StopTime, INSENS); SetListTime( StartTime, StopTime, INSENS);
...@@ -207,62 +180,41 @@ void Hist::lastw_cb() ...@@ -207,62 +180,41 @@ void Hist::lastw_cb()
void Hist::thism_cb() void Hist::thism_cb()
{ {
int Sts;
pwr_tTime CurrTime;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
Sts = time_GetTime( &CurrTime); time_Period( time_ePeriod_ThisMonth, &StartTime, &StopTime, 0, 1);
Sts = GoBackMonth( CurrTime, &StartTime, &StopTime);
StopTime.tv_sec += ONEDAY;
CurrTime.tv_sec += ONEDAY;
SetListTime( StopTime, CurrTime, INSENS); SetListTime( StartTime, StopTime, INSENS);
} }
void Hist::lastm_cb() void Hist::lastm_cb()
{ {
int Sts;
pwr_tTime CurrTime;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
Sts = time_GetTime( &CurrTime); time_Period( time_ePeriod_LastMonth, &StartTime, &StopTime, 0, 0);
Sts = GoBackMonth( CurrTime, &StartTime, &StopTime);
SetListTime( StartTime, StopTime, INSENS); SetListTime( StartTime, StopTime, INSENS);
} }
void Hist::all_cb() void Hist::all_cb()
{ {
int Sts;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
char timestr[32] = "01-JAN-1970 00:00:00";
time_AsciiToA(timestr, &StartTime);
Sts = time_GetTime( &StopTime); time_Period( time_ePeriod_AllTime, &StartTime, &StopTime, 0, 1);
StopTime.tv_sec += ONEDAY;
SetListTime( StartTime, StopTime, INSENS); SetListTime( StartTime, StopTime, INSENS);
} }
void Hist::time_cb() void Hist::time_cb()
{ {
int Sts;
pwr_tTime StartTime; pwr_tTime StartTime;
pwr_tTime StopTime; pwr_tTime StopTime;
char timestr[32] = "01-JAN-1970 00:00:00";
time_AsciiToA(timestr, &StartTime);
Sts = time_GetTime( &StopTime); time_Period( time_ePeriod_AllTime, &StartTime, &StopTime, 0, 0);
SetListTime( StartTime, StopTime, SENS); SetListTime( StartTime, StopTime, SENS);
...@@ -806,7 +758,10 @@ int Hist::GoBackMonth( pwr_tTime TimeIn, pwr_tTime *FromTime, ...@@ -806,7 +758,10 @@ int Hist::GoBackMonth( pwr_tTime TimeIn, pwr_tTime *FromTime,
break; break;
} }
memset(Tm, 0, sizeof(*Tm)); // memset(Tm, 0, sizeof(*Tm));
Tm->tm_sec = 0;
Tm->tm_min = 0;
Tm->tm_hour = 0;
Tm->tm_mday = 1; Tm->tm_mday = 1;
Tm->tm_mon = Month; Tm->tm_mon = Month;
Tm->tm_year = TmYear; Tm->tm_year = TmYear;
...@@ -814,8 +769,9 @@ int Hist::GoBackMonth( pwr_tTime TimeIn, pwr_tTime *FromTime, ...@@ -814,8 +769,9 @@ int Hist::GoBackMonth( pwr_tTime TimeIn, pwr_tTime *FromTime,
FromTime->tv_sec = mktime(Tm); FromTime->tv_sec = mktime(Tm);
FromTime->tv_nsec = 0; FromTime->tv_nsec = 0;
Tm->tm_mday = DaysOfMonth; ToTime->tv_sec = FromTime->tv_sec + DaysOfMonth * ONEDAY;
ToTime->tv_sec = mktime(Tm); // Tm->tm_mday = DaysOfMonth;
// ToTime->tv_sec = mktime(Tm);
ToTime->tv_nsec = 0; ToTime->tv_nsec = 0;
return(1); return(1);
...@@ -859,7 +815,7 @@ int Hist::GoBackWeek( pwr_tTime TimeIn, pwr_tTime *FromTime, ...@@ -859,7 +815,7 @@ int Hist::GoBackWeek( pwr_tTime TimeIn, pwr_tTime *FromTime,
FromTime->tv_sec = Time.tv_sec - Days * ONEDAY; FromTime->tv_sec = Time.tv_sec - Days * ONEDAY;
FromTime->tv_nsec = 0; FromTime->tv_nsec = 0;
ToTime->tv_sec = Time.tv_sec - (Days - 6) * ONEDAY; ToTime->tv_sec = FromTime->tv_sec + 7 * ONEDAY;
ToTime->tv_nsec = 0; ToTime->tv_nsec = 0;
return(1); return(1);
...@@ -883,14 +839,19 @@ int Hist::GoBackWeek( pwr_tTime TimeIn, pwr_tTime *FromTime, ...@@ -883,14 +839,19 @@ int Hist::GoBackWeek( pwr_tTime TimeIn, pwr_tTime *FromTime,
pwr_tStatus Hist::AdjustForDayBreak( Hist *histOP, pwr_tTime *Time, pwr_tStatus Hist::AdjustForDayBreak( Hist *histOP, pwr_tTime *Time,
pwr_tTime *NewTime) pwr_tTime *NewTime)
{ {
pwr_tStatus Sts; struct tm *Tm;
char timestr[32];
Sts = time_AtoAscii(Time, time_eFormat_DateAndTime, timestr, sizeof(timestr)); time_t sec = Time->tv_sec;
sprintf(&timestr[12],"00:00:00"); Tm = localtime(&sec);
Tm->tm_sec = 0;
Tm->tm_min = 0;
Tm->tm_hour = 0;
return time_AsciiToA(timestr, NewTime); NewTime->tv_sec = mktime(Tm);
NewTime->tv_nsec = 0;
return 1;
} /* AdjustForDayBreak */ } /* AdjustForDayBreak */
#endif #endif
......
...@@ -28,7 +28,7 @@ xtt_sMethodButton XttMethodToolbar::m_data[XttMethodToolbar::m_size] = ...@@ -28,7 +28,7 @@ xtt_sMethodButton XttMethodToolbar::m_data[XttMethodToolbar::m_size] =
{"Note", "$Object-Note", "$Object-NoteFilter", "$pwr_exe/xtt_meth_note.png", "Note"}, {"Note", "$Object-Note", "$Object-NoteFilter", "$pwr_exe/xtt_meth_note.png", "Note"},
{"Trend", "$Object-OpenTrend", "$Object-OpenTrendFilter", "$pwr_exe/xtt_meth_trend.png", "Trend"}, {"Trend", "$Object-OpenTrend", "$Object-OpenTrendFilter", "$pwr_exe/xtt_meth_trend.png", "Trend"},
{"Fast", "$Object-OpenFast", "$Object-OpenFastFilter", "$pwr_exe/xtt_meth_fast.png", "Fast"}, {"Fast", "$Object-OpenFast", "$Object-OpenFastFilter", "$pwr_exe/xtt_meth_fast.png", "Fast"},
{"History", "$Object-History", "$Object-HistoryFilter", "$pwr_exe/xtt_meth_history.png", "History"}, {"History", "$Object-OpenHistory", "$Object-OpenHistoryFilter", "$pwr_exe/xtt_meth_history.png", "History"},
{"Photo", "$Object-Photo", "$Object-PhotoFilter", "$pwr_exe/xtt_meth_photo.png", "Photo"}, {"Photo", "$Object-Photo", "$Object-PhotoFilter", "$pwr_exe/xtt_meth_photo.png", "Photo"},
{"Graph", "$Object-OpenGraph", "$Object-OpenGraphFilter", "$pwr_exe/xtt_meth_graph.png", "Graph"}, {"Graph", "$Object-OpenGraph", "$Object-OpenGraphFilter", "$pwr_exe/xtt_meth_graph.png", "Graph"},
{"RtNavigator", "$Object-RtNavigator", "$Object-RtNavigatorFilter", "$pwr_exe/xtt_meth_navigator.png", "RtNavigator"}, {"RtNavigator", "$Object-RtNavigator", "$Object-RtNavigatorFilter", "$pwr_exe/xtt_meth_navigator.png", "RtNavigator"},
......
...@@ -54,8 +54,15 @@ XttSevHist::XttSevHist( void *parent_ctx, ...@@ -54,8 +54,15 @@ XttSevHist::XttSevHist( void *parent_ctx,
sevcli_tCtx xn_scctx, sevcli_tCtx xn_scctx,
int *sts) : int *sts) :
xnav(parent_ctx), gcd(0), curve(0), rows(0), vsize(0), timerid(0), close_cb(0), help_cb(0), xnav(parent_ctx), gcd(0), curve(0), rows(0), vsize(0), timerid(0), close_cb(0), help_cb(0),
first_scan(1), scctx(xn_scctx), time_low_old(0), time_high_old(0) get_select_cb(0), first_scan(1), scctx(xn_scctx), time_low_old(0), time_high_old(0)
{ {
pwr_tTime from, to;
if ( xn_oidv == 0 || xn_oidv[0].vid == 0) {
oid_cnt = 0;
gcd = new GeCurveData( curve_eDataType_DsTrend);
return;
}
// Count number of curves // Count number of curves
for ( oid_cnt = 0; xn_oidv[oid_cnt].vid != 0; oid_cnt++) ; for ( oid_cnt = 0; xn_oidv[oid_cnt].vid != 0; oid_cnt++) ;
...@@ -68,12 +75,13 @@ XttSevHist::XttSevHist( void *parent_ctx, ...@@ -68,12 +75,13 @@ XttSevHist::XttSevHist( void *parent_ctx,
memcpy( onamev, xn_onamev, oid_cnt * sizeof(onamev[0])); memcpy( onamev, xn_onamev, oid_cnt * sizeof(onamev[0]));
memcpy( sevhistobjectv, xn_sevhistobjectv, oid_cnt * sizeof(sevhistobjectv[0])); memcpy( sevhistobjectv, xn_sevhistobjectv, oid_cnt * sizeof(sevhistobjectv[0]));
time_Period( time_ePeriod_OneHour, &from, &to, 0, 0);
if ( oid_cnt == 1) { if ( oid_cnt == 1) {
get_data( sts, pwr_cNTime, pwr_cNTime); get_data( sts, from, to);
if ( EVEN(*sts)) return; if ( EVEN(*sts)) return;
} }
else { else {
get_multidata( sts, pwr_cNTime, pwr_cNTime); get_multidata( sts, from, to);
if ( EVEN(*sts)) return; if ( EVEN(*sts)) return;
} }
cdh_StrncpyCutOff( title, name, sizeof(title), 1); cdh_StrncpyCutOff( title, name, sizeof(title), 1);
...@@ -586,6 +594,52 @@ int XttSevHist::get_multidata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to) ...@@ -586,6 +594,52 @@ int XttSevHist::get_multidata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
return 1; return 1;
} }
void XttSevHist::curve_add( pwr_tOid oid, pwr_tOName aname, pwr_tOName oname,
bool sevhistobject)
{
if ( oid_cnt == XTT_SEVHIST_MAX)
return;
if ( gcd->type != curve_eDataType_MultiTrend) {
// Convert to multidata
for ( int i = 1; i < gcd->cols; i++) {
gcd->rows[i] = gcd->rows[0];
gcd->x_data[i] = (double *) calloc( 1, 8 * gcd->rows[i]);
memcpy( gcd->x_data[i], gcd->x_data[0], 8 * gcd->rows[i]);
gcd->x_axis_type[i] = curve_eAxis_x;
strcpy( gcd->x_format[i], "%10t");
}
gcd->type = curve_eDataType_MultiTrend;
}
oidv[oid_cnt] = oid;
strncpy( anamev[oid_cnt], aname, sizeof(anamev[0]));
strncpy( onamev[oid_cnt], oname, sizeof(onamev[0]));
oid_cnt++;
int curve_cnt = gcd->cols;
rows = 0;
gcd->x_data[curve_cnt] = (double *) calloc( 1, 8 * rows);
gcd->x_axis_type[curve_cnt] = curve_eAxis_x;
strcpy( gcd->x_format[curve_cnt], "%10t");
strcpy( gcd->y_name[curve_cnt], oname);
if ( strcmp( oname, "") != 0)
strcat( gcd->y_name[curve_cnt], ".");
strcat( gcd->y_name[curve_cnt], aname);
gcd->y_data[curve_cnt] = (double *) calloc( 1, 8 * rows);
gcd->cols++;
gcd->select_color( 0);
curve->config_names();
}
void XttSevHist::pop() void XttSevHist::pop()
{ {
...@@ -602,30 +656,56 @@ void XttSevHist::sevhist_close_cb( void *ctx) ...@@ -602,30 +656,56 @@ void XttSevHist::sevhist_close_cb( void *ctx)
delete sevhist; delete sevhist;
} }
void XttSevHist::sevhist_higher_res_cb( void *ctx) void XttSevHist::sevhist_decrease_period_cb( void *ctx)
{ {
XttSevHist *sevhist = (XttSevHist *) ctx; XttSevHist *sevhist = (XttSevHist *) ctx;
double ll_x, ll_y, ur_x, ur_y; time_ePeriod period;
pwr_tTime t_low, t_high;
pwr_tStatus sts; pwr_tStatus sts;
int changed;
sevhist->curve->measure_window( &ll_x, &ll_y, &ur_x, &ur_y); sts = sevhist->curve->get_period( &period);
t_low.tv_sec = int( sevhist->gcd->x_min_value_axis[0] + changed = time_PeriodZoomIn( &period);
ll_x / 200 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0])); if ( changed)
t_low.tv_nsec = 0; sevhist->curve->set_period( period, 0);
t_high.tv_sec = int( sevhist->gcd->x_min_value_axis[0] +
ur_x / 200 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0])); }
t_high.tv_nsec = 0;
void XttSevHist::sevhist_increase_period_cb( void *ctx)
{
XttSevHist *sevhist = (XttSevHist *) ctx;
time_ePeriod period;
pwr_tStatus sts;
int changed;
sts = sevhist->curve->get_period( &period);
changed = time_PeriodZoomOut( &period);
if ( changed)
sevhist->curve->set_period( period, 0);
}
void XttSevHist::sevhist_reload_cb( void *ctx)
{
XttSevHist *sevhist = (XttSevHist *) ctx;
pwr_tTime t_low, t_high;
pwr_tStatus sts;
{ sts = sevhist->curve->get_times( &t_low, &t_high);
char s1[40], s2[40]; if ( EVEN(sts)) {
time_AtoAscii( &t_low, time_eFormat_NumDateAndTime, s1, sizeof(s1)); sevhist->wow->DisplayError( "Time", "Time syntax error");
time_AtoAscii( &t_high, time_eFormat_NumDateAndTime, s2, sizeof(s2)); return;
}
printf( "Low: %s, High: %s\n", s1, s2); if ( time_Acomp( &t_high, &t_low) != 1) {
sevhist->wow->DisplayError( "Time", "Start time later than end time");
return;
} }
if ( t_low.tv_sec < 0)
t_low.tv_sec = 0;
if ( sevhist->oid_cnt == 1) if ( sevhist->oid_cnt == 1)
sevhist->get_data( &sts, t_low, t_high); sevhist->get_data( &sts, t_low, t_high);
else else
...@@ -633,46 +713,118 @@ void XttSevHist::sevhist_higher_res_cb( void *ctx) ...@@ -633,46 +713,118 @@ void XttSevHist::sevhist_higher_res_cb( void *ctx)
sevhist->time_low_old = 0; sevhist->time_low_old = 0;
sevhist->time_high_old = 0; sevhist->time_high_old = 0;
sevhist->curve->set_center_from_window( 1);
} }
void XttSevHist::sevhist_lower_res_cb( void *ctx) void XttSevHist::sevhist_prev_period_cb( void *ctx)
{ {
XttSevHist *sevhist = (XttSevHist *) ctx; XttSevHist *sevhist = (XttSevHist *) ctx;
double ll_x, ll_y, ur_x, ur_y; pwr_tTime from, to, prev_from, prev_to;
pwr_tTime t_low, t_high;
pwr_tStatus sts; pwr_tStatus sts;
time_ePeriod period;
sevhist->curve->measure_window( &ll_x, &ll_y, &ur_x, &ur_y); sts = sevhist->curve->get_times( &prev_from, &prev_to);
if ( EVEN(sts)) {
sevhist->wow->DisplayError( "Time", "Time syntax error");
return;
}
t_low.tv_sec = int( sevhist->gcd->x_min_value_axis[0] - sts = sevhist->curve->get_period( &period);
5 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
t_low.tv_nsec = 0;
t_high.tv_sec = int( sevhist->gcd->x_max_value_axis[0] +
5 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
t_high.tv_nsec = 0;
if ( t_low.tv_sec == sevhist->time_low_old && t_high.tv_sec == sevhist->time_high_old) { if ( time_Acomp( &prev_to, &prev_from) != 1) {
t_low.tv_sec = int( sevhist->gcd->x_min_value_axis[0] - sevhist->wow->DisplayError( "Time", "Start time later than end time");
25 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0])); return;
t_high.tv_sec = int( sevhist->gcd->x_max_value_axis[0] +
25 * (sevhist->gcd->x_max_value_axis[0] - sevhist->gcd->x_min_value_axis[0]));
} }
{ time_PreviousPeriod( period, &prev_from, &prev_to, &from, &to);
char s1[40], s2[40];
time_AtoAscii( &t_low, time_eFormat_NumDateAndTime, s1, sizeof(s1)); sevhist->curve->set_times( &from, &to);
time_AtoAscii( &t_high, time_eFormat_NumDateAndTime, s2, sizeof(s2));
printf( "Low: %s, High: %s\n", s1, s2); int change_period = 1;
switch( period) {
case time_ePeriod_LastMinute:
period = time_ePeriod_OneMinute;
break;
case time_ePeriod_Last10Minutes:
period = time_ePeriod_10Minutes;
break;
case time_ePeriod_LastHour:
period = time_ePeriod_OneHour;
break;
case time_ePeriod_Today:
period = time_ePeriod_Yesterday;
break;
case time_ePeriod_Yesterday:
period = time_ePeriod_OneDay;
break;
case time_ePeriod_ThisWeek:
period = time_ePeriod_LastWeek;
break;
case time_ePeriod_LastWeek:
period = time_ePeriod_OneWeek;
break;
case time_ePeriod_ThisMonth:
period = time_ePeriod_LastMonth;
break;
case time_ePeriod_LastMonth:
period = time_ePeriod_OneMonth;
break;
case time_ePeriod_ThisYear:
period = time_ePeriod_OneYear;
break;
default:
change_period = 0;
} }
if ( change_period)
sevhist->curve->set_period( period, 1);
if ( sevhist->oid_cnt == 1) }
sevhist->get_data( &sts, t_low, t_high);
else
sevhist->get_multidata( &sts, t_low, t_high);
sevhist->time_low_old = t_low.tv_sec; void XttSevHist::sevhist_next_period_cb( void *ctx)
sevhist->time_high_old = t_high.tv_sec; {
XttSevHist *sevhist = (XttSevHist *) ctx;
pwr_tTime from, to, prev_from, prev_to;
pwr_tStatus sts;
time_ePeriod period;
sts = sevhist->curve->get_times( &prev_from, &prev_to);
if ( EVEN(sts)) {
sevhist->wow->DisplayError( "Time", "Time syntax error");
return;
}
sts = sevhist->curve->get_period( &period);
if ( time_Acomp( &prev_to, &prev_from) != 1) {
sevhist->wow->DisplayError( "Time", "Start time later than end time");
return;
}
time_NextPeriod( period, &prev_from, &prev_to, &from, &to);
sevhist->curve->set_times( &from, &to);
}
void XttSevHist::sevhist_add_cb( void *ctx)
{
XttSevHist *sevhist = (XttSevHist *) ctx;
pwr_tOid oid;
pwr_tOName aname, oname;
int sts;
if ( !sevhist->get_select_cb)
return;
sts = sevhist->get_select_cb( sevhist->xnav, &oid, aname, oname);
if ( EVEN(sts)) return;
sevhist->curve_add( oid, aname, oname, false);
}
void XttSevHist::sevhist_remove_cb( void *ctx)
{
// Do do
} }
void XttSevHist::sevhist_help_cb( void *ctx) void XttSevHist::sevhist_help_cb( void *ctx)
......
...@@ -65,6 +65,7 @@ class XttSevHist { ...@@ -65,6 +65,7 @@ class XttSevHist {
CoWowTimer *timerid; //!< Time id for scan. CoWowTimer *timerid; //!< Time id for scan.
void (*close_cb)( void *, XttSevHist *); //!< Close callback to parent. void (*close_cb)( void *, XttSevHist *); //!< Close callback to parent.
void (*help_cb)( void *, const char *); //!< Open help window. void (*help_cb)( void *, const char *); //!< Open help window.
int (*get_select_cb)( void *, pwr_tOid *, char *, char *); //!< Get selected SevHist object.
bool first_scan; //!< Indicates that this is the first scan. bool first_scan; //!< Indicates that this is the first scan.
char title[250]; //!< Window title char title[250]; //!< Window title
sevcli_tCtx scctx; sevcli_tCtx scctx;
...@@ -95,10 +96,17 @@ class XttSevHist { ...@@ -95,10 +96,17 @@ class XttSevHist {
int get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to); int get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to);
int get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to); int get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to);
int get_multidata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to); int get_multidata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to);
void curve_add( pwr_tOid oid, pwr_tOName aname, pwr_tOName oname,
bool sevhistobject);
static void sevhist_close_cb( void *ctx); static void sevhist_close_cb( void *ctx);
static void sevhist_higher_res_cb( void *ctx); static void sevhist_increase_period_cb( void *ctx);
static void sevhist_lower_res_cb( void *ctx); static void sevhist_decrease_period_cb( void *ctx);
static void sevhist_reload_cb( void *ctx);
static void sevhist_prev_period_cb( void *ctx);
static void sevhist_next_period_cb( void *ctx);
static void sevhist_add_cb( void *ctx);
static void sevhist_remove_cb( void *ctx);
static void sevhist_help_cb( void *ctx); static void sevhist_help_cb( void *ctx);
static void sevhist_scan( void *data); static void sevhist_scan( void *data);
......
...@@ -151,6 +151,7 @@ static void xnav_op_ack_last_cb( void *xnav, unsigned long type, unsigned long p ...@@ -151,6 +151,7 @@ static void xnav_op_ack_last_cb( void *xnav, unsigned long type, unsigned long p
static void xnav_trend_close_cb( void *ctx, XttTrend *trend); static void xnav_trend_close_cb( void *ctx, XttTrend *trend);
static void xnav_trend_help_cb( void *ctx, const char *key); static void xnav_trend_help_cb( void *ctx, const char *key);
static void xnav_sevhist_help_cb( void *ctx, const char *key); static void xnav_sevhist_help_cb( void *ctx, const char *key);
static int xnav_sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname);
static void xnav_fast_close_cb( void *ctx, XttFast *fast); static void xnav_fast_close_cb( void *ctx, XttFast *fast);
static void xnav_fast_help_cb( void *ctx, const char *key); static void xnav_fast_help_cb( void *ctx, const char *key);
static void xnav_xao_close_cb( void *ctx, XAttOne *xao); static void xnav_xao_close_cb( void *ctx, XAttOne *xao);
...@@ -3367,18 +3368,21 @@ static int xnav_open_func( void *client_data, ...@@ -3367,18 +3368,21 @@ static int xnav_open_func( void *client_data,
hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv, xnav->scctx, &sts); hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv, xnav->scctx, &sts);
if ( ODD(sts)) { if ( ODD(sts)) {
hist->help_cb = xnav_sevhist_help_cb; hist->help_cb = xnav_sevhist_help_cb;
hist->get_select_cb = xnav_sevhist_get_select_cb;
} }
} }
else if( sevHistObjectFound ) { else if( sevHistObjectFound ) {
hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv, xnav->scctx, &sts); hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv, xnav->scctx, &sts);
if ( ODD(sts)) { if ( ODD(sts)) {
hist->help_cb = xnav_sevhist_help_cb; hist->help_cb = xnav_sevhist_help_cb;
hist->get_select_cb = xnav_sevhist_get_select_cb;
} }
} }
else { else {
hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv, xnav->scctx, &sts); hist = xnav->xttsevhist_new( title_str, oidv, anamev, onamev, sevhistobjectv, xnav->scctx, &sts);
if ( ODD(sts)) { if ( ODD(sts)) {
hist->help_cb = xnav_sevhist_help_cb; hist->help_cb = xnav_sevhist_help_cb;
hist->get_select_cb = xnav_sevhist_get_select_cb;
} }
} }
} }
...@@ -4084,6 +4088,68 @@ static void xnav_sevhist_help_cb( void *ctx, const char *key) ...@@ -4084,6 +4088,68 @@ static void xnav_sevhist_help_cb( void *ctx, const char *key)
xnav->message( ' ', null_str); xnav->message( ' ', null_str);
} }
static int xnav_sevhist_get_select_cb( void *ctx, pwr_tOid *oid, char *aname, char *oname)
{
XNav *xnav = (XNav *) ctx;
pwr_tAttrRef sel_aref, attr_aref, aref;
int is_attr;
int sts;
pwr_tAName name;
pwr_tCid cid;
pwr_tAName arefname;
char *s;
pwr_tOid ch;
sts = xnav->get_select( &sel_aref, &is_attr);
if ( EVEN(sts)) return sts;
sts = gdh_ObjidToName( sel_aref.Objid, name, sizeof(name), cdh_mNName);
if ( EVEN(sts)) return sts;
sts = gdh_GetObjectClass( sel_aref.Objid, &cid);
switch ( cid) {
case pwr_cClass_SevHist:
break;
case pwr_cClass_SevHistObject:
return 0; // NYI
default:
// Look for a SevHist child
for ( sts = gdh_GetChild( sel_aref.Objid, &ch);
ODD(sts);
sts = gdh_GetNextSibling( ch, &ch)) {
sts = gdh_GetObjectClass( ch, &cid);
if ( EVEN(sts)) return sts;
switch ( cid) {
case pwr_cClass_SevHist:
sel_aref = cdh_ObjidToAref( ch);
break;
default:
return 0;
}
}
}
sts = gdh_ArefANameToAref( &sel_aref, "Attribute", &attr_aref);
if ( EVEN(sts)) return sts;
sts = gdh_GetObjectInfoAttrref( &attr_aref, &aref, sizeof(aref));
if ( EVEN(sts)) return sts;
sts = gdh_AttrrefToName( &aref, arefname, sizeof(arefname), cdh_mNName);
if ( EVEN(sts)) return sts;
s = strchr( arefname, '.');
if ( !s) return 0;
*s = 0;
strcpy( oname, arefname);
strcpy( aname, s+1);
*oid = aref.Objid;
return XNAV__SUCCESS;
}
static void xnav_fast_close_cb( void *ctx, XttFast *fast) static void xnav_fast_close_cb( void *ctx, XttFast *fast)
{ {
XNav *xnav = (XNav *) ctx; XNav *xnav = (XNav *) ctx;
......
xtt/mmi/ge/src/ge_page_left.png

228 Bytes | W: | H:

xtt/mmi/ge/src/ge_page_left.png

203 Bytes | W: | H:

xtt/mmi/ge/src/ge_page_left.png
xtt/mmi/ge/src/ge_page_left.png
xtt/mmi/ge/src/ge_page_left.png
xtt/mmi/ge/src/ge_page_left.png
  • 2-up
  • Swipe
  • Onion skin
xtt/mmi/ge/src/ge_page_right.png

236 Bytes | W: | H:

xtt/mmi/ge/src/ge_page_right.png

207 Bytes | W: | H:

xtt/mmi/ge/src/ge_page_right.png
xtt/mmi/ge/src/ge_page_right.png
xtt/mmi/ge/src/ge_page_right.png
xtt/mmi/ge/src/ge_page_right.png
  • 2-up
  • Swipe
  • Onion skin
xtt/mmi/ge/src/ge_scroll_left.png

224 Bytes | W: | H:

xtt/mmi/ge/src/ge_scroll_left.png

217 Bytes | W: | H:

xtt/mmi/ge/src/ge_scroll_left.png
xtt/mmi/ge/src/ge_scroll_left.png
xtt/mmi/ge/src/ge_scroll_left.png
xtt/mmi/ge/src/ge_scroll_left.png
  • 2-up
  • Swipe
  • Onion skin
xtt/mmi/ge/src/ge_scroll_right.png

223 Bytes | W: | H:

xtt/mmi/ge/src/ge_scroll_right.png

219 Bytes | W: | H:

xtt/mmi/ge/src/ge_scroll_right.png
xtt/mmi/ge/src/ge_scroll_right.png
xtt/mmi/ge/src/ge_scroll_right.png
xtt/mmi/ge/src/ge_scroll_right.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -212,6 +212,30 @@ E 1.10.11 "Unit" ...@@ -212,6 +212,30 @@ E 1.10.11 "Unit"
E 1.10.12 "Scale" E 1.10.12 "Scale"
E 1.10.13 "Attribute" E 1.10.13 "Attribute"
E 1.10.14 "Time axis" E 1.10.14 "Time axis"
E 1.10.15 "One Minute"
E 1.10.16 "10 Minutes"
E 1.10.17 "One Hour"
E 1.10.18 "One Day"
E 1.10.19 "One Week"
E 1.10.20 "One Month"
E 1.10.21 "One Year"
E 1.10.22 "Last Minute"
E 1.10.23 "Last 10 Minutes"
E 1.10.24 "Last Hour"
E 1.10.25 "This Year"
E 1.10.26 "All Time"
E 1.10.27 "Edit"
E 1.10.28 "Page left"
E 1.10.29 "Scroll left"
E 1.10.30 "Scroll right"
E 1.10.31 "Page right"
E 1.10.32 "Previous period"
E 1.10.33 "Next period"
E 1.10.34 "Increase period"
E 1.10.35 "Decrease period"
E 1.10.36 "Update curve"
E 1.10.37 "Add curve item"
E 1.10.38 "Remove selected curve"
# #
# Fileview # Fileview
E 1.11.1 "Save" E 1.11.1 "Save"
......
xtt/mmi/xtt/src/xtt_down.png

196 Bytes | W: | H:

xtt/mmi/xtt/src/xtt_down.png

219 Bytes | W: | H:

xtt/mmi/xtt/src/xtt_down.png
xtt/mmi/xtt/src/xtt_down.png
xtt/mmi/xtt/src/xtt_down.png
xtt/mmi/xtt/src/xtt_down.png
  • 2-up
  • Swipe
  • Onion skin
xtt/mmi/xtt/src/xtt_up.png

187 Bytes | W: | H:

xtt/mmi/xtt/src/xtt_up.png

210 Bytes | W: | H:

xtt/mmi/xtt/src/xtt_up.png
xtt/mmi/xtt/src/xtt_up.png
xtt/mmi/xtt/src/xtt_up.png
xtt/mmi/xtt/src/xtt_up.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -212,6 +212,30 @@ E 1.10.11 "Enhet" ...@@ -212,6 +212,30 @@ E 1.10.11 "Enhet"
E 1.10.12 "Skala" E 1.10.12 "Skala"
E 1.10.13 "Attribut" E 1.10.13 "Attribut"
E 1.10.14 "Tidsaxel" E 1.10.14 "Tidsaxel"
E 1.10.15 "En minut"
E 1.10.16 "10 minuter"
E 1.10.17 "En timme"
E 1.10.18 "En dag"
E 1.10.19 "En vecka"
E 1.10.20 "En mnad"
E 1.10.21 "Ett r"
E 1.10.22 "Sista minuten"
E 1.10.23 "Sista 10 minuterna"
E 1.10.24 "Sista timmen"
E 1.10.25 "Detta r"
E 1.10.26 "All tid"
E 1.10.27 "Editera"
E 1.10.28 "Sida vnster"
E 1.10.29 "Rulla vnster"
E 1.10.30 "Rulla hger"
E 1.10.31 "Sida hger"
E 1.10.32 "Tidigare period"
E 1.10.33 "Nsta period"
E 1.10.34 "ka period"
E 1.10.35 "Minska period"
E 1.10.36 "Updatera kurva"
E 1.10.37 "Addera kurva"
E 1.10.38 "Ta bort utvald kurva"
# #
# Fileview # Fileview
E 1.11.1 "Spara" E 1.11.1 "Spara"
......
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