Commit 19634e67 authored by Claes Sjofors's avatar Claes Sjofors

Xtt eventlist and eventlog, File/Export added

parent ad12625f
...@@ -1287,7 +1287,7 @@ void WttGtk::activate_openfile_dbs(GtkWidget* w, gpointer data) ...@@ -1287,7 +1287,7 @@ void WttGtk::activate_openfile_dbs(GtkWidget* w, gpointer data)
wtt->set_clock_cursor(); wtt->set_clock_cursor();
wtt->wnav->wow->CreateFileSelDia("Loadfile Selection", (void*)wtt, wtt->wnav->wow->CreateFileSelDia("Loadfile Selection", (void*)wtt,
Wtt::file_selected_cb, wow_eFileSelType_Dbs); Wtt::file_selected_cb, wow_eFileSelType_Dbs, wow_eFileSelAction_Open);
wtt->reset_cursor(); wtt->reset_cursor();
} }
...@@ -1297,7 +1297,7 @@ void WttGtk::activate_openfile_wbl(GtkWidget* w, gpointer data) ...@@ -1297,7 +1297,7 @@ void WttGtk::activate_openfile_wbl(GtkWidget* w, gpointer data)
wtt->set_clock_cursor(); wtt->set_clock_cursor();
wtt->wnav->wow->CreateFileSelDia("Loadfile Selection", (void*)wtt, wtt->wnav->wow->CreateFileSelDia("Loadfile Selection", (void*)wtt,
Wtt::file_selected_cb, wow_eFileSelType_Wbl); Wtt::file_selected_cb, wow_eFileSelType_Wbl, wow_eFileSelAction_Open);
wtt->reset_cursor(); wtt->reset_cursor();
} }
......
...@@ -1181,7 +1181,8 @@ void WttQtWidget::activate_openfile_dbs() ...@@ -1181,7 +1181,8 @@ void WttQtWidget::activate_openfile_dbs()
{ {
wtt->set_clock_cursor(); wtt->set_clock_cursor();
wtt->wnav->wow->CreateFileSelDia( wtt->wnav->wow->CreateFileSelDia(
"Loadfile Selection", wtt, Wtt::file_selected_cb, wow_eFileSelType_Dbs); "Loadfile Selection", wtt, Wtt::file_selected_cb, wow_eFileSelType_Dbs,
wow_eFileSelAction_Open);
wtt->reset_cursor(); wtt->reset_cursor();
} }
...@@ -1189,7 +1190,8 @@ void WttQtWidget::activate_openfile_wbl() ...@@ -1189,7 +1190,8 @@ void WttQtWidget::activate_openfile_wbl()
{ {
wtt->set_clock_cursor(); wtt->set_clock_cursor();
wtt->wnav->wow->CreateFileSelDia( wtt->wnav->wow->CreateFileSelDia(
"Loadfile Selection", wtt, Wtt::file_selected_cb, wow_eFileSelType_Wbl); "Loadfile Selection", wtt, Wtt::file_selected_cb, wow_eFileSelType_Wbl,
wow_eFileSelAction_Open);
wtt->reset_cursor(); wtt->reset_cursor();
} }
......
...@@ -100,7 +100,7 @@ void WbBckW::filter_cb(void* ctx, void* data, char* text) ...@@ -100,7 +100,7 @@ void WbBckW::filter_cb(void* ctx, void* data, char* text)
void WbBckW::activate_open() void WbBckW::activate_open()
{ {
wow->CreateFileSelDia("Backup File Selection", (void*)this, file_selected_cb, wow->CreateFileSelDia("Backup File Selection", (void*)this, file_selected_cb,
wow_eFileSelType_Backup); wow_eFileSelType_Backup, wow_eFileSelAction_Open);
} }
void WbBckW::file_selected_cb( void WbBckW::file_selected_cb(
...@@ -138,7 +138,7 @@ void WbBckW::activate_diff() ...@@ -138,7 +138,7 @@ void WbBckW::activate_diff()
return; return;
wow->CreateFileSelDia("Backup File Selection", (void*)this, wow->CreateFileSelDia("Backup File Selection", (void*)this,
diff_file_selected_cb, wow_eFileSelType_Backup); diff_file_selected_cb, wow_eFileSelType_Backup, wow_eFileSelAction_Open);
} }
void WbBckW::diff_file_selected_cb( void WbBckW::diff_file_selected_cb(
......
...@@ -864,13 +864,19 @@ int CoWowGtk::GetSelection(GtkWidget* w, char* str, int size, GdkAtom atom) ...@@ -864,13 +864,19 @@ int CoWowGtk::GetSelection(GtkWidget* w, char* str, int size, GdkAtom atom)
void CoWowGtk::CreateFileSelDia(const char* title, void* parent_ctx, void CoWowGtk::CreateFileSelDia(const char* title, void* parent_ctx,
void (*file_selected_cb)(void*, char*, wow_eFileSelType), void (*file_selected_cb)(void*, char*, wow_eFileSelType),
wow_eFileSelType file_type) wow_eFileSelType file_type, wow_eFileSelAction action)
{ {
GtkWidget* dialog; GtkWidget* dialog;
pwr_tFileName fname; pwr_tFileName fname;
GtkFileChooserAction gaction;
if (action == wow_eFileSelAction_Open)
gaction = GTK_FILE_CHOOSER_ACTION_OPEN;
else
gaction = GTK_FILE_CHOOSER_ACTION_SAVE;
dialog = gtk_file_chooser_dialog_new(title, NULL, dialog = gtk_file_chooser_dialog_new(title, NULL,
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, gaction, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
if (file_type == wow_eFileSelType_Dbs) { if (file_type == wow_eFileSelType_Dbs) {
...@@ -962,6 +968,10 @@ void CoWowGtk::CreateFileSelDia(const char* title, void* parent_ctx, ...@@ -962,6 +968,10 @@ void CoWowGtk::CreateFileSelDia(const char* title, void* parent_ctx,
gtk_file_filter_set_name(filter, "All Files"); gtk_file_filter_set_name(filter, "All Files");
gtk_file_filter_add_pattern(filter, "*"); gtk_file_filter_add_pattern(filter, "*");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
} else if (file_type == wow_eFileSelType_Tmp) {
pwr_tFileName folder;
dcli_translate_filename(folder, "$pwrp_tmp");
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), folder);
} }
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
......
...@@ -144,7 +144,7 @@ public: ...@@ -144,7 +144,7 @@ public:
void DeleteList(void* ctx); void DeleteList(void* ctx);
void CreateFileSelDia(const char* title, void* parent_ctx, void CreateFileSelDia(const char* title, void* parent_ctx,
void (*file_selected_cb)(void*, char*, wow_eFileSelType), void (*file_selected_cb)(void*, char*, wow_eFileSelType),
wow_eFileSelType file_type); wow_eFileSelType file_type, wow_eFileSelAction action);
int CreateModalDialog(const char* title, const char* text, int CreateModalDialog(const char* title, const char* text,
const char* button1, const char* button2, const char* button3, const char* button1, const char* button2, const char* button3,
const char* image); const char* image);
......
...@@ -424,7 +424,7 @@ int CoWowQt::GetSelection(char* str, int size) ...@@ -424,7 +424,7 @@ int CoWowQt::GetSelection(char* str, int size)
void CoWowQt::CreateFileSelDia(const char* title, void* parent_ctx, void CoWowQt::CreateFileSelDia(const char* title, void* parent_ctx,
void (*file_selected_cb)(void*, char*, wow_eFileSelType), void (*file_selected_cb)(void*, char*, wow_eFileSelType),
wow_eFileSelType file_type) wow_eFileSelType file_type, wow_eFileSelAction action)
{ {
pwr_tFileName folder; pwr_tFileName folder;
QString filter; QString filter;
...@@ -446,11 +446,16 @@ void CoWowQt::CreateFileSelDia(const char* title, void* parent_ctx, ...@@ -446,11 +446,16 @@ void CoWowQt::CreateFileSelDia(const char* title, void* parent_ctx,
} else if (file_type == wow_eFileSelType_Backup) { } else if (file_type == wow_eFileSelType_Backup) {
dcli_translate_filename(folder, "$pwrp_load"); dcli_translate_filename(folder, "$pwrp_load");
filter = "Backup files (*.bck);;All Files (*)"; filter = "Backup files (*.bck);;All Files (*)";
} else if (file_type == wow_eFileSelType_Tmp) {
dcli_translate_filename(folder, "$pwrp_tmp");
} }
// QFileDialog::getOpenFileName() is broken // QFileDialog::getOpenFileName() is broken
QFileDialog dialog(object->parent_wid, fl(title), fl(folder), filter); QFileDialog dialog(object->parent_wid, fl(title), fl(folder), filter);
if (action == wow_eFileSelAction_Open)
dialog.setFileMode(QFileDialog::ExistingFile); dialog.setFileMode(QFileDialog::ExistingFile);
else
dialog.setFileMode(QFileDialog::AnyFile);
int sts = dialog.exec(); int sts = dialog.exec();
if (sts == QDialog::Accepted && dialog.selectedFiles().length() > 0) { if (sts == QDialog::Accepted && dialog.selectedFiles().length() > 0) {
......
...@@ -176,7 +176,7 @@ void CoWow::DeleteList(void* ctx) ...@@ -176,7 +176,7 @@ void CoWow::DeleteList(void* ctx)
void CoWow::CreateFileSelDia(const char* title, void* parent_ctx, void CoWow::CreateFileSelDia(const char* title, void* parent_ctx,
void (*file_selected_cb)(void*, char*, wow_eFileSelType), void (*file_selected_cb)(void*, char*, wow_eFileSelType),
wow_eFileSelType file_type) wow_eFileSelType file_type, wow_eFileSelAction action)
{ {
} }
......
...@@ -42,6 +42,11 @@ ...@@ -42,6 +42,11 @@
#include "co_wow_msg.h" #include "co_wow_msg.h"
#include "co_lng.h" #include "co_lng.h"
typedef enum {
wow_eFileSelAction_Save,
wow_eFileSelAction_Open
} wow_eFileSelAction;
typedef enum { typedef enum {
wow_eFileSelType_, wow_eFileSelType_,
wow_eFileSelType_All, wow_eFileSelType_All,
...@@ -53,6 +58,7 @@ typedef enum { ...@@ -53,6 +58,7 @@ typedef enum {
wow_eFileSelType_History, wow_eFileSelType_History,
wow_eFileSelType_Backup, wow_eFileSelType_Backup,
wow_eFileSelType_ColorTheme, wow_eFileSelType_ColorTheme,
wow_eFileSelType_Tmp,
wow_eFileSelType__ wow_eFileSelType__
} wow_eFileSelType; } wow_eFileSelType;
...@@ -133,7 +139,7 @@ public: ...@@ -133,7 +139,7 @@ public:
virtual void DeleteList(void* ctx); virtual void DeleteList(void* ctx);
virtual void CreateFileSelDia(const char* title, void* parent_ctx, virtual void CreateFileSelDia(const char* title, void* parent_ctx,
void (*file_selected_cb)(void*, char*, wow_eFileSelType), void (*file_selected_cb)(void*, char*, wow_eFileSelType),
wow_eFileSelType file_type); wow_eFileSelType file_type, wow_eFileSelAction action);
virtual int CreateModalDialog(const char* title, const char* text, virtual int CreateModalDialog(const char* title, const char* text,
const char* button1, const char* button2, const char* button3, const char* button1, const char* button2, const char* button3,
const char* image); const char* image);
......
...@@ -534,7 +534,7 @@ void GeCurveGtk::activate_export_browse(GtkWidget* w, gpointer data) ...@@ -534,7 +534,7 @@ void GeCurveGtk::activate_export_browse(GtkWidget* w, gpointer data)
GeCurve* curve = (GeCurve*)data; GeCurve* curve = (GeCurve*)data;
curve->wow->CreateFileSelDia(CoWowGtk::translate_utf8("File Selection"), curve->wow->CreateFileSelDia(CoWowGtk::translate_utf8("File Selection"),
(void*)curve, export_file_selected_cb, wow_eFileSelType_History); (void*)curve, export_file_selected_cb, wow_eFileSelType_History, wow_eFileSelAction_Open);
} }
void GeCurveGtk::export_file_selected_cb( void GeCurveGtk::export_file_selected_cb(
......
...@@ -857,14 +857,14 @@ void GeGtk::activate_import_graph(GtkWidget* w, gpointer gectx) ...@@ -857,14 +857,14 @@ void GeGtk::activate_import_graph(GtkWidget* w, gpointer gectx)
{ {
((Ge*)gectx) ((Ge*)gectx)
->wow->CreateFileSelDia("Graph Selection", (void*)gectx, ->wow->CreateFileSelDia("Graph Selection", (void*)gectx,
graph_file_selected_cb, wow_eFileSelType_Graph); graph_file_selected_cb, wow_eFileSelType_Graph, wow_eFileSelAction_Open);
} }
void GeGtk::activate_import_image(GtkWidget* w, gpointer gectx) void GeGtk::activate_import_image(GtkWidget* w, gpointer gectx)
{ {
((Ge*)gectx) ((Ge*)gectx)
->wow->CreateFileSelDia("Image Selection", (void*)gectx, ->wow->CreateFileSelDia("Image Selection", (void*)gectx,
image_file_selected_cb, wow_eFileSelType_Image); image_file_selected_cb, wow_eFileSelType_Image, wow_eFileSelAction_Open);
} }
void GeGtk::activate_creanextpage(GtkWidget* w, gpointer gectx) void GeGtk::activate_creanextpage(GtkWidget* w, gpointer gectx)
......
...@@ -809,13 +809,13 @@ void GeQtWidget::activate_customcolors_write() ...@@ -809,13 +809,13 @@ void GeQtWidget::activate_customcolors_write()
void GeQtWidget::activate_import_graph() void GeQtWidget::activate_import_graph()
{ {
ge->wow->CreateFileSelDia("Graph Selection", ge, ge->wow->CreateFileSelDia("Graph Selection", ge,
GeQt::graph_file_selected_cb, wow_eFileSelType_Graph); GeQt::graph_file_selected_cb, wow_eFileSelType_Graph, wow_eFileSelAction_Open);
} }
void GeQtWidget::activate_import_image() void GeQtWidget::activate_import_image()
{ {
ge->wow->CreateFileSelDia("Image Selection", ge, ge->wow->CreateFileSelDia("Image Selection", ge,
GeQt::image_file_selected_cb, wow_eFileSelType_Image); GeQt::image_file_selected_cb, wow_eFileSelType_Image, wow_eFileSelAction_Open);
} }
void GeQtWidget::activate_creanextpage() void GeQtWidget::activate_creanextpage()
......
...@@ -1626,7 +1626,7 @@ void Ge::activate_colortheme_next() ...@@ -1626,7 +1626,7 @@ void Ge::activate_colortheme_next()
void Ge::activate_customcolors_read() void Ge::activate_customcolors_read()
{ {
wow->CreateFileSelDia("CustomColors Selection", (void*)this, wow->CreateFileSelDia("CustomColors Selection", (void*)this,
customcolors_selected_cb, wow_eFileSelType_ColorTheme); customcolors_selected_cb, wow_eFileSelType_ColorTheme, wow_eFileSelAction_Open);
} }
void Ge::customcolors_selected_cb( void Ge::customcolors_selected_cb(
......
...@@ -156,6 +156,11 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name, ...@@ -156,6 +156,11 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name,
g_signal_connect( g_signal_connect(
file_print, "activate", G_CALLBACK(eve_activate_print), this); file_print, "activate", G_CALLBACK(eve_activate_print), this);
GtkWidget* file_export = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Export"));
g_signal_connect(
file_export, "activate", G_CALLBACK(eve_activate_export), this);
GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic( GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Close")); CoWowGtk::translate_utf8("_Close"));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close), gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close),
...@@ -167,6 +172,7 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name, ...@@ -167,6 +172,7 @@ EvGtk::EvGtk(void* ev_parent_ctx, GtkWidget* ev_parent_wid, char* eve_name,
GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL); GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_export);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget* file GtkWidget* file
...@@ -1199,6 +1205,11 @@ void EvGtk::blk_activate_print(GtkWidget* w, gpointer ev) ...@@ -1199,6 +1205,11 @@ void EvGtk::blk_activate_print(GtkWidget* w, gpointer ev)
((Ev*)ev)->blk_activate_print(); ((Ev*)ev)->blk_activate_print();
} }
void EvGtk::eve_activate_export(GtkWidget* w, gpointer ev)
{
((Ev*)ev)->eve_activate_export();
}
void EvGtk::eve_activate_ack_last(GtkWidget* w, gpointer ev) void EvGtk::eve_activate_ack_last(GtkWidget* w, gpointer ev)
{ {
((Ev*)ev)->eve_activate_ack_last(); ((Ev*)ev)->eve_activate_ack_last();
......
...@@ -106,6 +106,7 @@ public: ...@@ -106,6 +106,7 @@ public:
static void eve_activate_print(GtkWidget* w, gpointer data); static void eve_activate_print(GtkWidget* w, gpointer data);
static void ala_activate_print(GtkWidget* w, gpointer data); static void ala_activate_print(GtkWidget* w, gpointer data);
static void blk_activate_print(GtkWidget* w, gpointer data); static void blk_activate_print(GtkWidget* w, gpointer data);
static void eve_activate_export(GtkWidget* w, gpointer data);
static void eve_activate_ack_last(GtkWidget* w, gpointer data); static void eve_activate_ack_last(GtkWidget* w, gpointer data);
static void ala_activate_ack_last(GtkWidget* w, gpointer data); static void ala_activate_ack_last(GtkWidget* w, gpointer data);
static void ala_activate_ack_all(GtkWidget* w, gpointer data); static void ala_activate_ack_all(GtkWidget* w, gpointer data);
......
...@@ -122,6 +122,10 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid, ...@@ -122,6 +122,10 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid,
gtk_image_new_from_stock("gtk-print", GTK_ICON_SIZE_MENU)); gtk_image_new_from_stock("gtk-print", GTK_ICON_SIZE_MENU));
g_signal_connect(file_print, "activate", G_CALLBACK(activate_print), this); g_signal_connect(file_print, "activate", G_CALLBACK(activate_print), this);
GtkWidget* file_export = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Export"));
g_signal_connect(file_export, "activate", G_CALLBACK(activate_export), this);
GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic( GtkWidget* file_close = gtk_image_menu_item_new_with_mnemonic(
CoWowGtk::translate_utf8("_Close")); CoWowGtk::translate_utf8("_Close"));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close), gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(file_close),
...@@ -132,6 +136,7 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid, ...@@ -132,6 +136,7 @@ HistGtk::HistGtk(void* hist_parent_ctx, GtkWidget* hist_parent_wid,
GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL); GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_export);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close); gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget* file GtkWidget* file
...@@ -717,6 +722,13 @@ void HistGtk::activate_print(GtkWidget* w, gpointer data) ...@@ -717,6 +722,13 @@ void HistGtk::activate_print(GtkWidget* w, gpointer data)
histOP->activate_print(); histOP->activate_print();
} }
void HistGtk::activate_export(GtkWidget* w, gpointer data)
{
Hist* histOP = (Hist*)data;
histOP->activate_export();
}
void HistGtk::activate_zoom_in(GtkWidget* w, gpointer data) void HistGtk::activate_zoom_in(GtkWidget* w, gpointer data)
{ {
Hist* histOP = (Hist*)data; Hist* histOP = (Hist*)data;
......
...@@ -92,6 +92,7 @@ public: ...@@ -92,6 +92,7 @@ public:
GtkWidget* w, GdkEvent* event, gpointer data); GtkWidget* w, GdkEvent* event, gpointer data);
static void activate_exit(GtkWidget* w, gpointer data); static void activate_exit(GtkWidget* w, gpointer data);
static void activate_print(GtkWidget* w, gpointer data); static void activate_print(GtkWidget* w, gpointer data);
static void activate_export(GtkWidget* w, gpointer data);
static void activate_zoom_in(GtkWidget* w, gpointer data); static void activate_zoom_in(GtkWidget* w, gpointer data);
static void activate_zoom_out(GtkWidget* w, gpointer data); static void activate_zoom_out(GtkWidget* w, gpointer data);
static void activate_zoom_reset(GtkWidget* w, gpointer data); static void activate_zoom_reset(GtkWidget* w, gpointer data);
......
...@@ -135,6 +135,7 @@ EvQt::EvQt(void* ev_parent_ctx, char* eve_name, char* ala_name, char* blk_name, ...@@ -135,6 +135,7 @@ EvQt::EvQt(void* ev_parent_ctx, char* eve_name, char* ala_name, char* blk_name,
QMenu* file = menu_bar->addMenu(translate_utf8("&File")); QMenu* file = menu_bar->addMenu(translate_utf8("&File"));
addMenuItem(object, file, "&Print", SLOT(eve_activate_print()), "", addMenuItem(object, file, "&Print", SLOT(eve_activate_print()), "",
"document-print"); "document-print");
addMenuItem(object, file, "&Export", SLOT(eve_activate_export()));
addMenuItem( addMenuItem(
object, file, "&Close", SLOT(eve_activate_exit()), "CTRL+W", "window-close"); object, file, "&Close", SLOT(eve_activate_exit()), "CTRL+W", "window-close");
...@@ -657,6 +658,11 @@ void EvQtObject::blk_activate_print() ...@@ -657,6 +658,11 @@ void EvQtObject::blk_activate_print()
ev->blk_activate_print(); ev->blk_activate_print();
} }
void EvQtObject::eve_activate_export()
{
ev->eve_activate_export();
}
void EvQtObject::eve_activate_ack_last() void EvQtObject::eve_activate_ack_last()
{ {
ev->eve_activate_ack_last(); ev->eve_activate_ack_last();
......
...@@ -107,6 +107,7 @@ public slots: ...@@ -107,6 +107,7 @@ public slots:
void eve_activate_print(); void eve_activate_print();
void ala_activate_print(); void ala_activate_print();
void blk_activate_print(); void blk_activate_print();
void eve_activate_export();
void eve_activate_ack_last(); void eve_activate_ack_last();
void ala_activate_ack_last(); void ala_activate_ack_last();
void ala_activate_ack_all(); void ala_activate_ack_all();
......
...@@ -269,6 +269,48 @@ void Ev::blk_activate_print() ...@@ -269,6 +269,48 @@ void Ev::blk_activate_print()
blk->print(title); blk->print(title);
} }
void Ev::eve_activate_export()
{
wow->CreateFileSelDia("Export", (void*)this,
eve_export_file_selected_cb, wow_eFileSelType_Tmp, wow_eFileSelAction_Save);
}
void Ev::eve_export_file_selected_cb(void *ctx, char *filename, wow_eFileSelType file_type)
{
((Ev *)ctx)->eve_export_events(filename);
}
int Ev::eve_export_events(const char *filename)
{
brow_tObject *list;
int list_cnt;
ItemAlarm *item;
char timstr[40];
char supobjectstr[80];
pwr_tFileName fname;
FILE *fp;
dcli_translate_filename(fname, filename);
fp = fopen(fname, "w");
if (!fp)
return 0;
fprintf(fp, "Time,Type,Prio,Text,Name,SupObject,Id,Status\n");
brow_GetObjectList(eve->brow->ctx, &list, &list_cnt);
for (int i = 0; i < list_cnt; i++) {
brow_GetUserData(list[i], (void **)&item);
time_AtoAscii(&item->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
strcpy(supobjectstr, cdh_ObjidToString(item->supobject.Objid, 1));
if (item->supobject.Flags.b.ObjectAttr)
sprintf(&supobjectstr[strlen(supobjectstr)], "#%u:%u", item->supobject.Offset,
item->supobject.Size);
fprintf(fp, "%s,%u,%lu,\"%s\",\"%s\",%s,\"(%u,%u)\",%u\n",
timstr, item->eventtype, item->eventprio, item->eventtext, item->eventname,
supobjectstr, item->eventid.Nix, item->eventid.Idx, item->status);
}
fclose(fp);
return 1;
}
void Ev::eve_activate_ack_last() void Ev::eve_activate_ack_last()
{ {
mh_sEventId* id; mh_sEventId* id;
......
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
#ifndef xtt_eveve #ifndef xtt_eveve
#include "xtt_eveve.h" #include "xtt_eveve.h"
#endif #endif
#ifndef cow_wow
#include "cow_wow.h"
#endif
class CoWow; class CoWow;
class XttMethodToolbar; class XttMethodToolbar;
...@@ -164,10 +167,12 @@ public: ...@@ -164,10 +167,12 @@ public:
char* name_to_alias(char* name); char* name_to_alias(char* name);
pwr_tStatus set_view(pwr_tOid view); pwr_tStatus set_view(pwr_tOid view);
void view_shift(); void view_shift();
int eve_export_events(const char *filename);
void eve_activate_print(); void eve_activate_print();
void ala_activate_print(); void ala_activate_print();
void blk_activate_print(); void blk_activate_print();
void eve_activate_export();
void ala_activate_ack_last(); void ala_activate_ack_last();
void eve_activate_ack_last(); void eve_activate_ack_last();
void eve_activate_ack_all(); void eve_activate_ack_all();
...@@ -198,6 +203,7 @@ public: ...@@ -198,6 +203,7 @@ public:
static void seve_copy_list_cb(void* ctx, EvList* evl); static void seve_copy_list_cb(void* ctx, EvList* evl);
static void seve_close_cb(void* ctx, EvEve* seve); static void seve_close_cb(void* ctx, EvEve* seve);
static void help_event_cb(void* ctx, void* item); static void help_event_cb(void* ctx, void* item);
static void eve_export_file_selected_cb(void *ctx, char *filename, wow_eFileSelType file_type);
static pwr_tStatus mh_ack_bc(mh_sAck* MsgP); static pwr_tStatus mh_ack_bc(mh_sAck* MsgP);
static pwr_tStatus mh_return_bc(mh_sReturn* MsgP); static pwr_tStatus mh_return_bc(mh_sReturn* MsgP);
......
...@@ -148,6 +148,48 @@ void Hist::activate_print() ...@@ -148,6 +148,48 @@ void Hist::activate_print()
hist->print(Lng::translate("Eventlog")); hist->print(Lng::translate("Eventlog"));
} }
void Hist::activate_export()
{
wow->CreateFileSelDia("Export", (void*)this,
export_file_selected_cb, wow_eFileSelType_Tmp, wow_eFileSelAction_Save);
}
void Hist::export_file_selected_cb(void *ctx, char *filename, wow_eFileSelType file_type)
{
((Hist *)ctx)->export_events(filename);
}
int Hist::export_events(const char *filename)
{
brow_tObject *list;
int list_cnt;
ItemAlarm *item;
char timstr[40];
char supobjectstr[80];
pwr_tFileName fname;
FILE *fp;
dcli_translate_filename(fname, filename);
fp = fopen(fname, "w");
if (!fp)
return 0;
fprintf(fp, "Time,Type,Prio,Text,Name,SupObject,Id,Status\n");
brow_GetObjectList(hist->brow->ctx, &list, &list_cnt);
for (int i = 0; i < list_cnt; i++) {
brow_GetUserData(list[i], (void **)&item);
time_AtoAscii(&item->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
strcpy(supobjectstr, cdh_ObjidToString(item->supobject.Objid, 1));
if (item->supobject.Flags.b.ObjectAttr)
sprintf(&supobjectstr[strlen(supobjectstr)], "#%u:%u", item->supobject.Offset,
item->supobject.Size);
fprintf(fp, "%s,%u,%lu,\"%s\",\"%s\",%s,\"(%u,%u)\",%u\n",
timstr, item->eventtype, item->eventprio, item->eventtext, item->eventname,
supobjectstr, item->eventid.Nix, item->eventid.Idx, item->status);
}
fclose(fp);
return 1;
}
void Hist::activate_help() void Hist::activate_help()
{ {
if (help_cb) if (help_cb)
......
...@@ -50,6 +50,9 @@ extern "C" { ...@@ -50,6 +50,9 @@ extern "C" {
#ifndef xtt_evlist #ifndef xtt_evlist
#include "xtt_evlist.h" #include "xtt_evlist.h"
#endif #endif
#ifndef cow_wow
#include "cow_wow.h"
#endif
#define ERROR_TIME_CONVERT -99 #define ERROR_TIME_CONVERT -99
class CoWow; class CoWow;
...@@ -133,10 +136,12 @@ public: ...@@ -133,10 +136,12 @@ public:
} }
void activate_print(); void activate_print();
void activate_export();
void activate_help(); void activate_help();
void activate_helpevent(); void activate_helpevent();
void time_cb(time_ePeriod period); void time_cb(time_ePeriod period);
void stat(); void stat();
int export_events(const char *filename);
static int GoBackMonth( static int GoBackMonth(
pwr_tTime TimeIn, pwr_tTime* FromTime, pwr_tTime* ToTime); pwr_tTime TimeIn, pwr_tTime* FromTime, pwr_tTime* ToTime);
...@@ -154,6 +159,7 @@ public: ...@@ -154,6 +159,7 @@ public:
static void help_event_cb(void* ctx, void* item); static void help_event_cb(void* ctx, void* item);
static void selection_changed_cb(void* ctx); static void selection_changed_cb(void* ctx);
static void hist_init_cb(void* ctx); static void hist_init_cb(void* ctx);
static void export_file_selected_cb(void *ctx, char *filename, wow_eFileSelType file_type);
}; };
#else #else
......
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