Commit 5538deba authored by Christoffer Ackelman's avatar Christoffer Ackelman

Slight cleanup of xtt_ev.

parent 39ed185f
......@@ -1141,7 +1141,7 @@ gboolean EvGtk::eve_action_inputfocus(
{
Ev* ev = (Ev*)data;
if (ev && ev->eve_displayed)
if (ev && ev->is_mapped_eve())
ev->eve->set_input_focus();
return FALSE;
......@@ -1152,7 +1152,7 @@ gboolean EvGtk::ala_action_inputfocus(
{
Ev* ev = (Ev*)data;
if (ev && ev->ala_displayed)
if (ev && ev->is_mapped_ala())
ev->ala->set_input_focus();
return FALSE;
......@@ -1163,90 +1163,65 @@ gboolean EvGtk::blk_action_inputfocus(
{
Ev* ev = (Ev*)data;
if (ev && ev->blk_displayed)
if (ev && ev->is_mapped_blk())
ev->blk->set_input_focus();
return FALSE;
}
void EvGtk::eve_activate_exit(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_exit(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->unmap_eve();
ev->eve_displayed = 0;
((Ev*)ev)->unmap_eve();
}
void EvGtk::ala_activate_exit(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_exit(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->unmap_ala();
ev->ala_displayed = 0;
((Ev*)ev)->unmap_ala();
}
void EvGtk::blk_activate_exit(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_exit(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->unmap_blk();
ev->blk_displayed = 0;
((Ev*)ev)->unmap_blk();
}
void EvGtk::eve_activate_print(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_print(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve_activate_print();
((Ev*)ev)->eve_activate_print();
}
void EvGtk::ala_activate_print(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_print(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala_activate_print();
((Ev*)ev)->ala_activate_print();
}
void EvGtk::blk_activate_print(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_print(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk_activate_print();
((Ev*)ev)->blk_activate_print();
}
void EvGtk::eve_activate_ack_last(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_ack_last(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve_activate_ack_last();
((Ev*)ev)->eve_activate_ack_last();
}
void EvGtk::ala_activate_ack_last(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_ack_last(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala_activate_ack_last();
((Ev*)ev)->ala_activate_ack_last();
}
void EvGtk::ala_activate_ack_all(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_ack_all(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve_activate_ack_all();
((Ev*)ev)->eve_activate_ack_all();
}
void EvGtk::ala_activate_shift_view(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_shift_view(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->view_shift();
((Ev*)ev)->view_shift();
}
void EvGtk::ala_activate_select_flat(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_select_flat(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->set_view(pwr_cNObjid);
((Ev*)ev)->set_view(pwr_cNObjid);
}
void EvGtk::ala_activate_select_view1(GtkWidget* w, gpointer ev)
......@@ -1350,197 +1325,143 @@ void EvGtk::ala_activate_select_view25(GtkWidget* w, gpointer ev)
((Ev*)ev)->set_view(((EvGtk*)ev)->alarm_views[24]);
}
void EvGtk::eve_activate_zoom_in(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_zoom_in(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve->zoom(1.2);
((Ev*)ev)->eve->zoom(1.2);
}
void EvGtk::ala_activate_zoom_in(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_zoom_in(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala->zoom(1.2);
((Ev*)ev)->ala->zoom(1.2);
}
void EvGtk::blk_activate_zoom_in(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_zoom_in(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk->zoom(1.2);
((Ev*)ev)->blk->zoom(1.2);
}
void EvGtk::eve_activate_zoom_out(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_zoom_out(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve->zoom(5.0 / 6);
((Ev*)ev)->eve->zoom(5.0 / 6);
}
void EvGtk::ala_activate_zoom_out(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_zoom_out(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala->zoom(5.0 / 6);
((Ev*)ev)->ala->zoom(5.0 / 6);
}
void EvGtk::blk_activate_zoom_out(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_zoom_out(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk->zoom(5.0 / 6);
((Ev*)ev)->blk->zoom(5.0 / 6);
}
void EvGtk::eve_activate_zoom_reset(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_zoom_reset(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve->unzoom();
((Ev*)ev)->eve->unzoom();
}
void EvGtk::ala_activate_zoom_reset(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_zoom_reset(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala->unzoom();
((Ev*)ev)->ala->unzoom();
}
void EvGtk::blk_activate_zoom_reset(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_zoom_reset(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk->unzoom();
((Ev*)ev)->blk->unzoom();
}
void EvGtk::blk_activate_block_remove(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_block_remove(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk->block_remove();
((Ev*)ev)->blk->block_remove();
}
void EvGtk::eve_activate_open_plc(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_open_plc(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve->start_trace();
((Ev*)ev)->eve->start_trace();
}
void EvGtk::ala_activate_open_plc(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_open_plc(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala->start_trace();
((Ev*)ev)->ala->start_trace();
}
void EvGtk::blk_activate_open_plc(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_open_plc(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk->start_trace();
((Ev*)ev)->blk->start_trace();
}
void EvGtk::eve_activate_display_in_xnav(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_display_in_xnav(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve->display_in_xnav();
((Ev*)ev)->eve->display_in_xnav();
}
void EvGtk::ala_activate_display_in_xnav(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_display_in_xnav(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala->display_in_xnav();
((Ev*)ev)->ala->display_in_xnav();
}
void EvGtk::blk_activate_display_in_xnav(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_display_in_xnav(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk->display_in_xnav();
((Ev*)ev)->blk->display_in_xnav();
}
void EvGtk::eve_activate_disp_hundredth(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_disp_hundredth(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
int set = (int)gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
ev->eve->set_display_hundredth(set);
((Ev*)ev)->eve->set_display_hundredth(set);
}
void EvGtk::ala_activate_disp_hundredth(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_disp_hundredth(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
int set = (int)gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
ev->ala->set_display_hundredth(set);
((Ev*)ev)->ala->set_display_hundredth(set);
}
void EvGtk::eve_activate_hide_object(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_hide_object(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
int set = (int)gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
ev->eve->set_hide_object(set);
((Ev*)ev)->eve->set_hide_object(set);
}
void EvGtk::ala_activate_hide_object(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_hide_object(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
int set = (int)gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
ev->ala->set_hide_object(set);
((Ev*)ev)->ala->set_hide_object(set);
}
void EvGtk::eve_activate_hide_text(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_hide_text(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
int set = (int)gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
ev->eve->set_hide_text(set);
((Ev*)ev)->eve->set_hide_text(set);
}
void EvGtk::ala_activate_hide_text(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_hide_text(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
int set = (int)gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
ev->ala->set_hide_text(set);
((Ev*)ev)->ala->set_hide_text(set);
}
void EvGtk::eve_activate_help(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_help(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve_activate_help();
((Ev*)ev)->eve_activate_help();
}
void EvGtk::eve_activate_helpevent(GtkWidget* w, gpointer data)
void EvGtk::eve_activate_helpevent(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->eve_activate_helpevent();
((Ev*)ev)->eve_activate_helpevent();
}
void EvGtk::ala_activate_help(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_help(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala_activate_help();
((Ev*)ev)->ala_activate_help();
}
void EvGtk::ala_activate_helpevent(GtkWidget* w, gpointer data)
void EvGtk::ala_activate_helpevent(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->ala_activate_helpevent();
((Ev*)ev)->ala_activate_helpevent();
}
void EvGtk::blk_activate_help(GtkWidget* w, gpointer data)
void EvGtk::blk_activate_help(GtkWidget* w, gpointer ev)
{
Ev* ev = (Ev*)data;
ev->blk_activate_help();
((Ev*)ev)->blk_activate_help();
}
......@@ -63,11 +63,23 @@ public:
GtkWidget* eve_widget;
GtkWidget* ala_widget;
GtkWidget* blk_widget;
bool eve_displayed;
bool ala_displayed;
bool blk_displayed;
pwr_tObjid alarm_views[25];
void map_eve(unsigned int options);
void map_ala(unsigned int options);
void map_blk(unsigned int options);
bool is_mapped_eve() {
return eve_displayed;
}
bool is_mapped_ala() {
return ala_displayed;
}
bool is_mapped_blk() {
return blk_displayed;
}
void unmap_eve();
void unmap_ala();
void unmap_blk();
......
......@@ -419,26 +419,14 @@ EvQt::EvQt(void* ev_parent_ctx, char* eve_name, char* ala_name, char* blk_name,
// Store this for the mh callbacks
ev = this;
if (display_eve) {
parent_wid_eve->show();
eve_displayed = 1;
} else {
parent_wid_eve->setVisible(false);
}
parent_wid_eve->show();
parent_wid_eve->setVisible(display_eve);
if (display_ala) {
parent_wid_ala->show();
ala_displayed = 1;
} else {
parent_wid_ala->setVisible(false);
}
parent_wid_ala->show();
parent_wid_ala->setVisible(display_ala);
if (display_blk) {
parent_wid_blk->show();
blk_displayed = 1;
} else {
parent_wid_blk->setVisible(false);
}
parent_wid_blk->show();
parent_wid_blk->setVisible(display_blk);
wow = new CoWowQt(parent_wid_ala);
......@@ -547,7 +535,6 @@ EvQt::~EvQt()
void EvQt::map_eve(unsigned int options)
{
pop(parent_wid_eve);
eve_displayed = 1;
if (options & ev_mAlaOptions_FullScreen) {
parent_wid_eve->showFullScreen();
......@@ -561,7 +548,6 @@ void EvQt::map_eve(unsigned int options)
void EvQt::map_ala(unsigned int options)
{
pop(parent_wid_ala);
ala_displayed = 1;
if (options & ev_mAlaOptions_FullScreen) {
parent_wid_ala->showFullScreen();
......@@ -575,7 +561,6 @@ void EvQt::map_ala(unsigned int options)
void EvQt::map_blk(unsigned int options)
{
pop(parent_wid_blk);
blk_displayed = 1;
if (options & ev_mAlaOptions_FullScreen) {
parent_wid_blk->showFullScreen();
......@@ -588,26 +573,17 @@ void EvQt::map_blk(unsigned int options)
void EvQt::unmap_eve()
{
if (eve_displayed) {
parent_wid_eve->setVisible(false);
eve_displayed = 0;
}
parent_wid_eve->setVisible(false);
}
void EvQt::unmap_ala()
{
if (ala_displayed) {
parent_wid_ala->setVisible(false);
ala_displayed = 0;
}
parent_wid_ala->setVisible(false);
}
void EvQt::unmap_blk()
{
if (blk_displayed) {
parent_wid_blk->setVisible(false);
blk_displayed = 0;
}
parent_wid_blk->setVisible(false);
}
void EvQt::set_transient_eve(void* basewidget)
......@@ -632,21 +608,21 @@ void EvQt::set_title_ala(char* title)
void EvQtObject::eve_action_inputfocus()
{
if (ev->eve_displayed) {
if (ev->parent_wid_eve->isVisible()) {
ev->eve->set_input_focus();
}
}
void EvQtObject::ala_action_inputfocus()
{
if (ev->ala_displayed) {
if (ev->parent_wid_ala->isVisible()) {
ev->ala->set_input_focus();
}
}
void EvQtObject::blk_action_inputfocus()
{
if (ev->blk_displayed) {
if (ev->parent_wid_blk->isVisible()) {
ev->blk->set_input_focus();
}
}
......@@ -654,19 +630,16 @@ void EvQtObject::blk_action_inputfocus()
void EvQtObject::eve_activate_exit()
{
ev->unmap_eve();
ev->eve_displayed = 0;
}
void EvQtObject::ala_activate_exit()
{
ev->unmap_ala();
ev->ala_displayed = 0;
}
void EvQtObject::blk_activate_exit()
{
ev->unmap_blk();
ev->blk_displayed = 0;
}
void EvQtObject::eve_activate_print()
......
......@@ -64,6 +64,15 @@ public:
void map_eve(unsigned int options);
void map_ala(unsigned int options);
void map_blk(unsigned int options);
bool is_mapped_eve() {
return parent_wid_eve->isVisible();
}
bool is_mapped_ala() {
return parent_wid_ala->isVisible();
}
bool is_mapped_blk() {
return parent_wid_blk->isVisible();
}
void unmap_eve();
void unmap_ala();
void unmap_blk();
......
......@@ -54,8 +54,6 @@ EvListQt::EvListQt(void* ev_parent_ctx, ev_eType ev_type, int ev_size,
{
form_widget = scrolledbrowwidgetqt_new(init_brow_cb, this, &brow_widget);
form_widget->show();
*w = form_widget;
}
......@@ -114,4 +112,4 @@ void EvListQt::print(const char* title)
sprintf(cmd, "$pwr_exe/rt_print.sh %s", filename);
system(cmd);
}
}
\ No newline at end of file
}
......@@ -65,9 +65,8 @@ Ev::Ev(void* ev_parent_ctx, char* eve_name, char* ala_name, char* blk_name,
eve_display_return(display_return), start_trace_cb(NULL),
display_in_xnav_cb(NULL), update_info_cb(NULL), help_cb(NULL),
popup_menu_cb(0), sound_cb(0), pop_cb(0), is_authorized_cb(0), eve(NULL),
ala(NULL), blk(0), connected(0), ala_displayed(0), eve_displayed(0),
beep(ev_beep), pop_mask(ev_pop_mask), eventname_seg(ev_eventname_seg),
sala_cnt(0), seve_cnt(0), modified(0)
ala(NULL), blk(0), connected(0), beep(ev_beep), pop_mask(ev_pop_mask),
eventname_seg(ev_eventname_seg), sala_cnt(0), seve_cnt(0), modified(0)
{
}
......
......@@ -88,9 +88,6 @@ public:
EvList* ala;
EvList* blk;
int connected;
int ala_displayed;
int eve_displayed;
int blk_displayed;
int beep;
int eve_size;
int ala_size;
......@@ -155,18 +152,9 @@ public:
int outunit_connect(pwr_tObjid user);
void update(double scantime);
int is_mapped_eve()
{
return eve_displayed;
}
int is_mapped_ala()
{
return ala_displayed;
}
int is_mapped_blk()
{
return blk_displayed;
}
virtual bool is_mapped_eve() = 0;
virtual bool is_mapped_ala() = 0;
virtual bool is_mapped_blk() = 0;
int get_alarm_info(evlist_sAlarmInfo* info, int backward, int alarmsize);
void ack_last_prio(unsigned long type, unsigned long prio, int backward, int timecheck);
void ack_all();
......
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