Commit bf001ac4 authored by claes's avatar claes

GTK added

parent 033479b9
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
/*
* Proview $Id: xtt_block_gtk.cpp,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* xtt_block_gtk.cpp -- Alarm blocking window in xtt. */
#include <gtk/gtk.h>
#include "pwr_class.h"
#include "pwr_privilege.h"
#include "rt_gdh.h"
#include "rt_mh_outunit.h"
#include "co_cdh.h"
#include "xtt_block_gtk.h"
#include "co_lng.h"
#include "co_wow_gtk.h"
#include "co_msg.h"
int BlockGtk::execute()
{
mh_eEventPrio prio;
pwr_tStatus sts;
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(toggleA)))
prio = mh_eEventPrio_A;
else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(toggleB)))
prio = mh_eEventPrio_B;
else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(toggleC)))
prio = mh_eEventPrio_C;
else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(toggleD)))
prio = mh_eEventPrio_D;
else
prio = (mh_eEventPrio) 0;
sts = mh_OutunitBlock( oar.Objid, prio);
if (EVEN(sts)) {
char msg[80];
msg_GetMsg( sts, msg, sizeof(msg));
wow->DisplayError( "Block Error", msg);
}
return sts;
}
void BlockGtk::update()
{
pwr_tStatus sts;
mh_uEventInfo block_level;
sts = gdh_GetAlarmInfo( oar.Objid, NULL, NULL, (pwr_tUInt32 *) &block_level,
NULL, NULL);
switch ( block_level.Event.Prio) {
case mh_eEventPrio_A:
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(toggleA), TRUE);
break;
case mh_eEventPrio_B:
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(toggleB), TRUE);
break;
case mh_eEventPrio_C:
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(toggleC), TRUE);
break;
case mh_eEventPrio_D:
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(toggleD), TRUE);
break;
case 0:
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(toggleNo), TRUE);
break;
default:
break;
}
}
void BlockGtk::activate_apply( GtkWidget *w, gpointer data)
{
Block *blk = (Block *)data;
blk->execute();
}
void BlockGtk::activate_ok( GtkWidget *w, gpointer data)
{
Block *blk = (Block *)data;
pwr_tStatus sts;
sts = blk->execute();
if ( ODD(sts))
delete blk;
}
void BlockGtk::activate_cancel( GtkWidget *w, gpointer data)
{
Block *blk = (Block *)data;
delete blk;
}
BlockGtk::~BlockGtk()
{
delete wow;
gtk_widget_destroy( toplevel);
}
static gint delete_event( GtkWidget *w, GdkEvent *event, gpointer data)
{
BlockGtk::activate_cancel( w, data);
return TRUE;
}
BlockGtk::BlockGtk( void *b_parent_ctx,
GtkWidget *b_parent_wid,
pwr_sAttrRef *b_oar,
char *name,
unsigned int priv,
pwr_tStatus *sts):
Block( b_parent_ctx, b_oar, name, priv, sts), parent_wid(b_parent_wid)
{
char title[400];
pwr_tAName aname;
*sts = gdh_AttrrefToName( &oar, aname, sizeof(aname), cdh_mNName);
if ( EVEN(*sts)) return;
strcpy( title, name);
strcat( title, " ");
strcat( title, aname);
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", 300,
"default-width", 500,
"title", title,
NULL);
g_signal_connect( toplevel, "delete_event", G_CALLBACK(delete_event), this);
CoWowGtk::SetWindowIcon( toplevel);
toggleA = gtk_check_button_new_with_label( "A Alarm");
toggleB = gtk_check_button_new_with_label( "B Alarm");
toggleC = gtk_check_button_new_with_label( "C Alarm");
toggleD = gtk_check_button_new_with_label( "D Alarm");
toggleNo = gtk_check_button_new_with_label( "No Blocking");
GtkWidget *toggle_vbox = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(toggle_vbox), toggleA, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(toggle_vbox), toggleB, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(toggle_vbox), toggleC, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(toggle_vbox), toggleD, FALSE, FALSE, 7);
gtk_box_pack_start( GTK_BOX(toggle_vbox), toggleNo, FALSE, FALSE, 7);
buttonOk = gtk_button_new_with_label( "Ok");
gtk_widget_set_size_request( buttonOk, 70, 25);
g_signal_connect( buttonOk, "clicked", G_CALLBACK(activate_ok), this);
buttonApply = gtk_button_new_with_label( "Apply");
gtk_widget_set_size_request( buttonApply, 70, 25);
g_signal_connect( buttonApply, "clicked", G_CALLBACK(activate_apply), this);
GtkWidget *buttonCancel = gtk_button_new_with_label( "Cancel");
gtk_widget_set_size_request( buttonCancel, 70, 25);
g_signal_connect( buttonCancel, "clicked", G_CALLBACK(activate_cancel), this);
GtkWidget *hboxbuttons = gtk_hbox_new( TRUE, 40);
gtk_box_pack_start( GTK_BOX(hboxbuttons), buttonOk, FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(hboxbuttons), buttonApply, FALSE, FALSE, 0);
gtk_box_pack_end( GTK_BOX(hboxbuttons), buttonCancel, FALSE, FALSE, 0);
GtkWidget *vbox = gtk_vbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), toggle_vbox, FALSE, FALSE, 15);
gtk_box_pack_start( GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
gtk_box_pack_end( GTK_BOX(vbox), hboxbuttons, FALSE, FALSE, 15);
gtk_container_add( GTK_CONTAINER(toplevel), vbox);
gtk_widget_show_all( toplevel);
if ( !(priv & pwr_mPrv_RtEvents ||
priv & pwr_mPrv_System)) {
gtk_widget_set_sensitive( buttonOk, FALSE);
gtk_widget_set_sensitive( buttonApply, FALSE);
gtk_widget_set_sensitive( toggleA, FALSE);
gtk_widget_set_sensitive( toggleB, FALSE);
gtk_widget_set_sensitive( toggleC, FALSE);
gtk_widget_set_sensitive( toggleD, FALSE);
gtk_widget_set_sensitive( toggleNo, FALSE);
}
wow = new CoWowGtk( parent_wid);
update();
#if 0
char uid_filename[120] = {"xtt_block.uid"};
char *uid_filename_p = uid_filename;
Arg args[20];
int msts;
int i;
MrmHierarchy s_DRMh;
MrmType dclass;
char title[200];
pwr_tAName aname;
static MrmRegisterArg reglist[] = {
{ "blk_ctx", 0 },
{"blk_activate_cancel",(caddr_t)activate_cancel },
{"blk_activate_ok",(caddr_t)activate_ok },
{"blk_activate_apply",(caddr_t)activate_apply },
{"blk_create_ok",(caddr_t)create_ok },
{"blk_create_apply",(caddr_t)create_apply },
{"blk_create_toggleA",(caddr_t)create_toggleA },
{"blk_create_toggleB",(caddr_t)create_toggleB },
{"blk_create_toggleC",(caddr_t)create_toggleC },
{"blk_create_toggleD",(caddr_t)create_toggleD },
{"blk_create_toggleNo",(caddr_t)create_toggleNo }
};
static int reglist_num = (sizeof reglist / sizeof reglist[0]);
*sts = 1;
Lng::get_uid( uid_filename, uid_filename);
*sts = gdh_AttrrefToName( &oar, aname, sizeof(aname), cdh_mNName);
if ( EVEN(*sts)) return;
strcpy( title, name);
strcat( title, " ");
strcat( title, aname);
reglist[0].value = (caddr_t) this;
// Gtk
MrmInitialize();
// Save the context structure in the widget
i = 0;
XtSetArg(args[i], XmNuserData, (unsigned int) this);i++;
XtSetArg(args[i], XmNdeleteResponse, XmDO_NOTHING);i++;
msts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh);
if (msts != MrmSUCCESS) printf("can't open %s\n", uid_filename);
MrmRegisterNames(reglist, reglist_num);
parent_wid = XtCreatePopupShell( title,
topLevelShellWidgetClass, parent_wid, args, i);
msts = MrmFetchWidgetOverride( s_DRMh, "blk_window", parent_wid,
name, args, 1, &toplevel, &dclass);
if (msts != MrmSUCCESS) printf("can't fetch %s\n", name);
MrmCloseHierarchy(s_DRMh);
i = 0;
XtSetArg(args[i],XmNwidth,500);i++;
XtSetArg(args[i],XmNheight,200);i++;
XtSetValues( toplevel, args, i);
XtManageChild( toplevel);
XtPopup( parent_wid, XtGrabNone);
if ( !(priv & pwr_mPrv_RtEvents ||
priv & pwr_mPrv_System)) {
Arg sensitive[1];
// No access to block
// XtUnmanageChild( ok);
// XtUnmanageChild( apply);
XtSetArg( sensitive[0],XmNsensitive, 0);
XtSetValues( buttonOk, sensitive, 1);
XtSetValues( buttonApply, sensitive, 1);
XtSetValues( toggleA, sensitive, 1);
XtSetValues( toggleB, sensitive, 1);
XtSetValues( toggleC, sensitive, 1);
XtSetValues( toggleD, sensitive, 1);
XtSetValues( toggleNo, sensitive, 1);
}
wow = new CoWowGtk( parent_wid);
update();
// Connect the window manager close-button to exit
flow_AddCloseVMProtocolCb( parent_wid,
(XtCallbackProc)activate_cancel, this);
#endif
}
/*
* Proview $Id: xtt_block_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_block_gtk_h
#define xtt_block_gtk_h
/* xtt_block_gtk.h -- Alarm blocking window */
#ifndef xtt_block_h
# include "xtt_block.h"
#endif
class BlockGtk : public Block {
public:
BlockGtk( void *b_parent_ctx,
GtkWidget *b_parent_wid,
pwr_sAttrRef *b_oar,
char *name,
unsigned int priv,
pwr_tStatus *status);
~BlockGtk();
int execute();
void update();
GtkWidget *parent_wid;
GtkWidget *toplevel;
GtkWidget *form;
GtkWidget *toggleA;
GtkWidget *toggleB;
GtkWidget *toggleC;
GtkWidget *toggleD;
GtkWidget *toggleNo;
GtkWidget *buttonOk;
GtkWidget *buttonApply;
static void activate_ok( GtkWidget *w, gpointer data);
static void activate_cancel( GtkWidget *w, gpointer data);
static void activate_apply( GtkWidget *w, gpointer data);
};
#endif
This diff is collapsed.
/*
* Proview $Id: xtt_clog_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_clog_gtk_h
#define xtt_clog_gtk_h
/* xtt_clog_gtk.h -- Alarm and event windows in xtt */
#ifndef xtt_clog_h
# include "xtt_clog.h"
#endif
class CLogGtk : public CLog {
public:
CLogGtk( void *clog_parent_ctx,
GtkWidget *clog_parent_wid,
char *clog_name,
pwr_tStatus *status);
~CLogGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_clog;
GtkWidget *toplevel;
GtkWidget *form_clog;
GtkWidget *clognav_widget;
GtkWidget *filter_form;
GtkWidget *show_success_w;
GtkWidget *show_info_w;
GtkWidget *show_warning_w;
GtkWidget *show_error_w;
GtkWidget *show_fatal_w;
GtkWidget *show_text_w;
GtkWidget *filter_string_w;
GtkWidget *filesel_form;
GtkWidget *filesel_list_w;
GdkCursor *clock_cursor;
void pop();
void set_clock_cursor();
void reset_cursor();
void free_cursor();
void create_filter_dialog();
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void activate_exit( GtkWidget*w, gpointer data);
static void activate_select_file( GtkWidget*w, gpointer data);
static void activate_next_file( GtkWidget*w, gpointer data);
static void activate_prev_file( GtkWidget*w, gpointer data);
static void activate_update( 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_reset( GtkWidget*w, gpointer data);
static void activate_filter( GtkWidget*w, gpointer data);
static void activate_help( GtkWidget*w, gpointer data);
static void activate_helpmsg( GtkWidget*w, gpointer data);
static void filter_ok_cb( GtkWidget*w, gpointer data);
static void filter_apply_cb( GtkWidget*w, gpointer data);
static void filter_cancel_cb( GtkWidget*w, gpointer data);
static void file_selected_cb( void *ctx, char *text);
};
#endif
/*
* Proview $Id: xtt_clognav_gtk.cpp,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* xtt_clognav_gtk.cpp -- Console message window. */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <gtk/gtk.h>
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_syi.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget_gtk.h"
#include "xtt_clognav_gtk.h"
#include "xtt_menu.h"
CLogNavGtk::CLogNavGtk( void *clog_parent_ctx,
GtkWidget *clog_parent_wid,
GtkWidget **w) :
CLogNav( clog_parent_ctx), parent_wid(clog_parent_wid)
{
form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget);
gtk_widget_show_all( brow_widget);
*w = form_widget;
}
//
// Delete ev
//
CLogNavGtk::~CLogNavGtk()
{
delete brow;
gtk_widget_destroy( form_widget);
}
void CLogNavGtk::set_input_focus()
{
gtk_widget_grab_focus( brow_widget);
}
/*
* Proview $Id: xtt_clognav_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_clognav_gtk_h
#define xtt_clognav_gtk_h
/* xtt_clognav_gtk.h -- Console message window. */
// Status is defined as int i xlib...
#ifndef xtt_clognav_h
# include "xtt_clognav.h"
#endif
class CLogNavGtk : public CLogNav {
public:
CLogNavGtk( void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
GtkWidget **w);
~CLogNavGtk();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
void set_input_focus();
};
#endif
This diff is collapsed.
/*
* Proview $Id: xtt_ev_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_ev_gtk_h
#define xtt_ev_gtk_h
/* xtt_ev_gtk.h -- Alarm and event windows in xtt */
#ifndef xtt_ev_h
# include "xtt_ev.h"
#endif
class EvGtk : public Ev {
public:
EvGtk(
void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
char *eve_name,
char *ala_name,
char *blk_name,
pwr_tObjid ev_user,
int display_ala,
int display_eve,
int display_blk,
int display_return,
int display_ack,
int ev_beep,
pwr_tStatus *status);
~EvGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_eve;
GtkWidget *parent_wid_ala;
GtkWidget *parent_wid_blk;
GtkWidget *toplevel_ala;
GtkWidget *toplevel_eve;
GtkWidget *toplevel_blk;
GtkWidget *form_ala;
GtkWidget *form_eve;
GtkWidget *form_blk;
GtkWidget *eve_widget;
GtkWidget *ala_widget;
GtkWidget *blk_widget;
void map_eve();
void map_ala();
void map_blk();
void unmap_eve();
void unmap_ala();
void unmap_blk();
static gboolean eve_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static gboolean ala_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static gboolean blk_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void eve_activate_exit( GtkWidget *w, gpointer data);
static void ala_activate_exit( GtkWidget *w, gpointer data);
static void blk_activate_exit( GtkWidget *w, gpointer data);
static void eve_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 eve_activate_ack_last( GtkWidget *w, gpointer data);
static void ala_activate_ack_last( GtkWidget *w, gpointer data);
static void eve_activate_zoom_in( GtkWidget *w, gpointer data);
static void ala_activate_zoom_in( GtkWidget *w, gpointer data);
static void blk_activate_zoom_in( GtkWidget *w, gpointer data);
static void eve_activate_zoom_out( GtkWidget *w, gpointer data);
static void ala_activate_zoom_out( GtkWidget *w, gpointer data);
static void blk_activate_zoom_out( GtkWidget *w, gpointer data);
static void eve_activate_zoom_reset( GtkWidget *w, gpointer data);
static void ala_activate_zoom_reset( GtkWidget *w, gpointer data);
static void blk_activate_zoom_reset( GtkWidget *w, gpointer data);
static void blk_activate_block_remove( GtkWidget *w, gpointer data);
static void eve_activate_open_plc( GtkWidget *w, gpointer data);
static void ala_activate_open_plc( GtkWidget *w, gpointer data);
static void blk_activate_open_plc( GtkWidget *w, gpointer data);
static void eve_activate_display_in_xnav( GtkWidget *w, gpointer data);
static void ala_activate_display_in_xnav( GtkWidget *w, gpointer data);
static void blk_activate_display_in_xnav( GtkWidget *w, gpointer data);
static void eve_activate_disp_hundredth( GtkWidget *w, gpointer data);
static void ala_activate_disp_hundredth( GtkWidget *w, gpointer data);
static void eve_activate_hide_object( GtkWidget *w, gpointer data);
static void ala_activate_hide_object( GtkWidget *w, gpointer data);
static void eve_activate_hide_text( GtkWidget *w, gpointer data);
static void ala_activate_hide_text( GtkWidget *w, gpointer data);
static void eve_activate_help( GtkWidget *w, gpointer data);
static void ala_activate_help( GtkWidget *w, gpointer data);
static void blk_activate_help( GtkWidget *w, gpointer data);
static void eve_activate_helpevent( GtkWidget *w, gpointer data);
static void ala_activate_helpevent( GtkWidget *w, gpointer data);
};
#endif
/*
* Proview $Id: xtt_evlist_gtk.cpp,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* xtt_evlist_gtk.cpp -- Alarm or event list in xtt */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "co_cdh.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_mh.h"
#include "rt_mh_outunit.h"
#include "co_wow_gtk.h"
#include "co_lng.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget_gtk.h"
#include "xtt_evlist_gtk.h"
EvListGtk::EvListGtk( void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
ev_eType ev_type,
int ev_size,
GtkWidget **w) :
EvList( ev_parent_ctx, ev_type, ev_size), parent_wid(ev_parent_wid)
{
form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget);
gtk_widget_show_all( brow_widget);
*w = form_widget;
}
//
// Delete ev
//
EvListGtk::~EvListGtk()
{
delete brow;
gtk_widget_destroy( form_widget);
}
void EvListGtk::set_input_focus()
{
gtk_widget_grab_focus( brow_widget);
}
void EvListGtk::bell()
{
gdk_display_beep( gtk_widget_get_display( brow_widget));
}
void EvListGtk::popup_position( int x_event, int y_event, int *x, int *y)
{
CoWowGtk::PopupPosition( brow_widget, x_event, y_event, x, y);
}
/*
* Proview $Id: xtt_evlist_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_evlist_gtk_h
#define xtt_evlist_gtk_h
/* xtt_evlist_gtk.h -- Alarm and event windows in xtt */
#ifndef xtt_evlist_h
# include "xtt_evlist.h"
#endif
class EvListGtk : public EvList {
public:
EvListGtk(
void *ev_parent_ctx,
GtkWidget *ev_parent_wid,
ev_eType ev_type,
int ev_size,
GtkWidget **w);
~EvListGtk();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
void set_input_focus();
void bell();
void popup_position( int x_event, int y_event, int *x, int *y);
};
#endif
/*
* Proview $Id: xtt_fast_gtk.cpp,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "flow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <vector.h>
#include <gtk/gtk.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_gdh_msg.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_wow_gtk.h"
#include "rt_xnav_msg.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "glow_curvectx.h"
#include "glow_curveapi.h"
#include "xtt_xnav.h"
#include "rt_fast.h"
#include "xtt_fast_gtk.h"
#include "ge_curve_gtk.h"
XttFastGtk::XttFastGtk( void *parent_ctx,
GtkWidget *parent_wid,
char *name,
GtkWidget **w,
pwr_sAttrRef *fast_arp,
int *sts) :
XttFast( parent_ctx, name, fast_arp, sts), parent_widget(parent_wid)
{
char title[250];
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 0);
curve->close_cb = fast_close_cb;
curve->help_cb = fast_help_cb;
wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new();
timerid->add( 1000, fast_scan, this);
}
XttFastGtk::~XttFastGtk()
{
timerid->remove();
for ( int i = 0; i < fast_cnt; i++) {
gdh_UnrefObjectInfo( new_subid);
}
delete curve;
}
/*
* Proview $Id: xtt_fast_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_fast_gtk_h
#define xtt_fast_gtk_h
/* xtt_fast_gtk.h -- Fast curves */
#ifndef xtt_fast_h
# include "xtt_fast.h"
#endif
class XttFastGtk : public XttFast {
public:
GtkWidget *parent_widget; //!< Parent widget.
XttFastGtk( void *xn_parent_ctx,
GtkWidget *xn_parent_wid,
char *xn_name,
GtkWidget **w,
pwr_sAttrRef *fast_arp,
int *sts);
~XttFastGtk();
};
#endif
This diff is collapsed.
/*
* Proview $Id: xtt_ge_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_ge_gtk_h
#define xtt_ge_gtk_h
#ifndef xtt_ge_h
# include "xtt_ge.h"
#endif
class XttGeGtk : public XttGe {
public:
GtkWidget *parent_wid;
GtkWidget *grow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
GtkWidget *nav_shell;
GtkWidget *nav_widget;
GtkWidget *menu_widget;
GtkWidget *graph_form;
GtkWidget *value_input;
GtkWidget *value_dialog;
GtkWidget *confirm_widget;
GtkWidget *confirm_label;
GtkWidget *message_dia_widget;
GtkWidget *message_dia_label;
XttGeGtk( GtkWidget *parent_wid, void *parent_ctx, char *name, char *filename,
int scrollbar, int menu, int navigator, int width, int height,
int x, int y, double scan_time, char *object_name, int use_default_access,
unsigned int access,
int (*xg_command_cb) (XttGe *, char *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
~XttGeGtk();
void pop();
void set_size( int width, int height);
void create_confirm_dialog();
static void ge_change_value_cb( void *ge_ctx, void *value_object, char *text);
static void confirm_cb( void *ge_ctx, void *confirm_object, char *text);
static void message_dialog_cb( void *ge_ctx, char *text);
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void activate_value_input( GtkWidget *w, gpointer data);
static void activate_confirm_ok( GtkWidget *w, gpointer data);
static void activate_confirm_cancel( GtkWidget *w, gpointer data);
static void activate_exit( 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_reset( GtkWidget *w, gpointer data);
static void activate_help( GtkWidget *w, gpointer data);
static void create_graph_form( GtkWidget *w, gpointer data);
static void create_message_dia( GtkWidget *w, gpointer data);
static void create_menu( GtkWidget *w, gpointer data);
static void create_value_input( GtkWidget *w, gpointer data);
static void action_resize( GtkWidget *w, GtkAllocation *allocation, gpointer data);
};
#endif
This diff is collapsed.
/*
* Proview $Id: xtt_hist_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_hist_gtk_h
#define xtt_hist_gkt_h
/* xtt_hist_gtk.h -- Historical event window in xtt */
#if defined OS_LINUX
#ifndef xtt_hist_h
# include "xtt_hist.h"
#endif
class HistGtk : public Hist {
public:
HistGtk( void *hist_parent_ctx,
GtkWidget *hist_parent_wid,
char *hist_name, pwr_tObjid objid,
pwr_tStatus *status);
~HistGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_hist;
GtkWidget *toplevel_hist;
GtkWidget *toplevel_search;
GtkWidget *form_hist;
GtkWidget *hist_widget;
GtkWidget *start_time_help_lbl_w;
GtkWidget *start_time_entry_w;
GtkWidget *stop_time_entry_w;
GtkWidget *event_text_entry_w;
GtkWidget *event_name_entry_w;
GtkWidget *alarm_toggle_w;
GtkWidget *info_toggle_w;
GtkWidget *ack_toggle_w;
GtkWidget *ret_toggle_w;
GtkWidget *prioA_toggle_w;
GtkWidget *prioB_toggle_w;
GtkWidget *prioC_toggle_w;
GtkWidget *prioD_toggle_w;
GtkWidget *nrofevents_string_lbl_w;
GtkWidget *search_string_lbl_w;
GtkWidget *search_string2_lbl_w;
GtkWidget *search_string3_lbl_w;
GtkWidget *search_string4_lbl_w;
void set_num_of_events( int nrOfEvents);
void set_search_string( const char *s1, const char *s2,
const char *s3, const char *s4);
void SetListTime( pwr_tTime StartTime, pwr_tTime StopTime,
int Sensitive);
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void activate_exit( GtkWidget *w, gpointer data);
static void activate_print( 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_reset( GtkWidget *w, gpointer data);
static void activate_open_plc( GtkWidget *w, gpointer data);
static void activate_display_in_xnav( GtkWidget *w, gpointer data);
static void activate_disp_hundredth( GtkWidget *w, gpointer data);
static void activate_hide_object( GtkWidget *w, gpointer data);
static void activate_hide_text( GtkWidget *w, gpointer data);
static void activate_help( GtkWidget *w, gpointer data);
static void activate_helpevent( GtkWidget *w, gpointer data);
static void create_form( GtkWidget *w, gpointer data);
static void ok_btn( GtkWidget *w, gpointer data);
//callbackfunctions from the searchdialog
static void cancel_cb( GtkWidget *w, gpointer data);
static void today_cb( GtkWidget *w, gpointer data);
static void yesterday_cb( GtkWidget *w, gpointer data);
static void thisw_cb( GtkWidget *w, gpointer data);
static void lastw_cb( GtkWidget *w, gpointer data);
static void thism_cb( GtkWidget *w, gpointer data);
static void lastm_cb( GtkWidget *w, gpointer data);
static void all_cb( GtkWidget *w, gpointer data);
static void time_cb( GtkWidget *w, gpointer data);
};
#else
// Dummy for other platforms then OS_LINUX
class Hist {
public:
Hist(
void *hist_parent_ctx,
Widget hist_parent_wid,
char *hist_name, pwr_tObjid objid,
pwr_tStatus *status) : parent_ctx(hist_parent_ctx) {}
void *parent_ctx;
void (*close_cb)( void *);
void (*start_trace_cb)( void *, pwr_tObjid, char *);
void (*display_in_xnav_cb)( void *, pwr_tObjid);
void (*update_info_cb)( void *);
void (*help_cb)( void *, char *);
void (*popup_menu_cb)( void *, pwr_sAttrRef, unsigned long,
unsigned long, char *, Widget * );
};
#endif
#endif
/*
* Proview $Id: xtt_hotkey_gtk.cpp,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
Interface for global function keys.
The XLib function XGrabKey is used because gdk doesn't have any corresponding function.
The syntax of the definition file is
['Modifier1'] ['Modifier2'] ['Modifier3'] <Key>'keysym' : 'action'('argument')
where
Modifier1,2 and 3 can be Control, Alt or Shift.
keysym any key symbol, for example F10.
action, the name of a registred action function: SetDig, ResetDig, ToggleDig or Command.
argument, argument to the action function (an attribute, or a command)
Example
Control <Key>F11 : ToggleDig( Test-Dv1.ActualValue)
Shift <Key>F11 : ToggleDig( Test-Dv2.ActualValue)
Control Shift <Key>F11 : ToggleDig( Test-Dv3.ActualValue)
Alt <Key>F11 : ToggleDig( Test-Dv4.ActualValue)
Control Alt <Key>F11 : ToggleDig( Test-Dv5.ActualValue)
Control Shift Alt <Key>F11 : ToggleDig( Test-Dv6.ActualValue)
<Key>F10 : SetDig( Test-Dv2.ActualValue)
<Key>F12 : Command ( open graph gtest)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/keysym.h>
#include "xtt_hotkey_gtk.h"
#include "co_cdh.h"
#include "co_dcli.h"
void XttHotkey::register_action( char *name, void (* action)(char *,void *), void *userdata)
{
HotkeyAction a( name, action);
m_actions.push_back( a);
for ( int i = 0; i < (int)m_keys.size(); i++) {
m_keys[i].set_action( &m_actions[m_actions.size() - 1], userdata);
}
}
XttHotkey::XttHotkey( char *filename)
{
strcpy( m_filename, filename);
read_file();
}
XttHotkey::~XttHotkey()
{
}
int XttHotkey::read_file()
{
FILE *fp;
char line[200];
int row = 0;
char p1[2][200];
char p2[10][200];
int i, n;
char *s;
dcli_translate_filename( m_filename, m_filename);
fp = fopen( m_filename, "r");
if ( !fp)
return 0;
while ( dcli_read_line( line, sizeof(line), fp)) {
int mod = 0;
int keysym;
char keystr[20] = "";
char action_arg[200];
char action_name[200];
row++;
dcli_trim( line, line);
if ( line[0] == 0 || line[0] == '#')
continue;
n = dcli_parse( line, ":", "", (char *)p1,
sizeof( p1) / sizeof( p1[0]), sizeof( p1[0]), 0);
if ( n != 2) {
printf( "Syntax error, %s, row %d\n", m_filename, row);
continue;
}
dcli_trim( p1[0], p1[0]);
dcli_trim( p1[1], p1[1]);
n = dcli_parse( p1[0], " ", "", (char *)p2,
sizeof( p2) / sizeof( p2[0]), sizeof( p2[0]), 0);
if ( n < 1) {
printf( "Syntax error, %s, row %d\n", m_filename, row);
continue;
}
for ( i = 0; i < n; i++) {
if ( cdh_NoCaseStrcmp( p2[i], "Control") == 0)
mod |= ControlMask;
else if ( cdh_NoCaseStrcmp( p2[i], "Shift") == 0)
mod |= ShiftMask;
else if ( cdh_NoCaseStrcmp( p2[i], "Alt") == 0)
mod |= Mod1Mask;
else if ( cdh_NoCaseStrncmp( p2[i], "<key>", 5) == 0) {
strcpy( keystr, &p2[i][5]);
dcli_trim( keystr, keystr);
}
else {
printf( "Syntax error, %s, row %d\n", m_filename, row);
break;
}
}
n = dcli_parse( p1[1], "(", "", (char *)p2,
sizeof( p2) / sizeof( p2[0]), sizeof( p2[0]), 0);
if ( n < 2) {
printf( "Syntax error, %s, row %d\n", m_filename, row);
continue;
}
strcpy( action_name, p2[0]);
dcli_trim( action_name, action_name);
strcpy( action_arg, p2[1]);
if ( (s = strrchr( action_arg, ')')))
*s = 0;
else {
printf( "Syntax error, %s, row %d\n", m_filename, row);
continue;
}
keysym = XStringToKeysym( keystr);
if ( !keysym) {
printf( "Syntax error, %s, row %d\n", m_filename, row);
continue;
}
HotkeyKey key( mod, keysym, action_name, action_arg);
m_keys.push_back( key);
}
fclose( fp);
for ( i = 0; i < (int)m_keys.size(); i++) {
grab_key( m_keys[i].m_keysym, m_keys[i].m_mod);
}
return 1;
}
int XttHotkey::event_handler( GdkXEvent *xevent, gpointer data)
{
XttHotkey *hotkey = (XttHotkey *)data;
XKeyEvent *e = (XKeyEvent *)xevent;
if ( e->type == KeyPress) {
int key = e->keycode;
int keysym = XKeycodeToKeysym( GDK_DISPLAY(), key, 0);
for ( int i = 0; i < (int)hotkey->m_keys.size(); i++) {
if ( hotkey->m_keys[i].m_keysym == keysym &&
hotkey->m_keys[i].m_mod == (int)(e->state & ~LockMask
& ~Mod2Mask & ~Mod3Mask & ~Mod4Mask & ~Mod5Mask)) {
if ( hotkey->m_keys[i].m_action)
(hotkey->m_keys[i].m_action)( hotkey->m_keys[i].m_action_arg,
hotkey->m_keys[i].m_userdata);
}
}
}
return GDK_FILTER_CONTINUE;
}
int XttHotkey::grab_key( int keysym, int modifier)
{
GdkDisplay *display = gdk_display_get_default();
int n_screens = gdk_display_get_n_screens( display);
Display *dp = gdk_x11_display_get_xdisplay( display);
int mode = GrabModeAsync;
int keycode = XKeysymToKeycode( dp, keysym);
if ( !keycode)
return 0;
gdk_error_trap_push();
for ( int i = 0; i < n_screens; i++) {
GdkWindow *root = gdk_screen_get_root_window( gdk_display_get_screen( display, i));
Window w = gdk_x11_drawable_get_xid( root);
XGrabKey( dp, keycode, modifier, w, True, mode, mode);
XGrabKey( dp, keycode, modifier | LockMask, w, True, mode, mode);
XGrabKey( dp, keycode, modifier | Mod2Mask, w, True, mode, mode);
XGrabKey( dp, keycode, modifier | LockMask | Mod2Mask, w, True, mode, mode);
}
gdk_flush();
gdk_error_trap_pop();
return 1;
}
/*
* Proview $Id: xtt_hotkey_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_hotkey_gtk_h
#define xtt_hotkey_gtk_h
#include <vector.h>
#include "pwr.h"
class HotkeyAction {
public:
char m_name[80];
void (* m_action)(char *,void *);
HotkeyAction( char *name, void (* action)(char *,void *)) : m_action(action) {
strcpy( m_name, name);
}
HotkeyAction( const HotkeyAction& x) : m_action(x.m_action) {
strcpy( m_name, x.m_name);
}
};
class HotkeyKey {
public:
int m_mod;
int m_keysym;
char m_action_name[80];
char m_action_arg[200];
void (* m_action)(char *,void *);
void *m_userdata;
HotkeyKey( int mod, int keysym, char *action_name, char *action_arg) :
m_mod(mod), m_keysym(keysym), m_action(0), m_userdata(0) {
strcpy( m_action_name, action_name);
strcpy( m_action_arg, action_arg);
}
HotkeyKey( const HotkeyKey& x) : m_mod(x.m_mod), m_keysym(x.m_keysym),
m_action(x.m_action), m_userdata(x.m_userdata) {
strcpy( m_action_name, x.m_action_name);
strcpy( m_action_arg, x.m_action_arg);
}
void set_action( HotkeyAction *action, void *userdata) {
if ( strcmp( m_action_name, action->m_name) == 0) {
m_action = action->m_action;
m_userdata = userdata;
}
}
};
class XttHotkey {
public:
pwr_tFileName m_filename;
vector<HotkeyAction> m_actions;
vector<HotkeyKey> m_keys;
XttHotkey( char *filename);
~XttHotkey();
void register_action( char *name, void (* action)(char *,void *), void *userdata);
int read_file();
int grab_key( int keysym, int modifier);
static int event_handler( GdkXEvent *xevent, gpointer data);
};
#endif
This diff is collapsed.
/*
* Proview $Id: xtt_op_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_op_gtk_h
#define xtt_op_gtk_h
/* xtt_op_gtk.h -- Operator window in xtt */
#ifndef xtt_op_h
# include "xtt_op.h"
#endif
class OpGtk : public Op {
public:
OpGtk( void *op_parent_ctx,
GtkWidget *op_parent_wid,
char *opplace,
pwr_tStatus *status);
~OpGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_op;
GtkWidget *toplevel;
GtkWidget *alarmcnt_label;
GtkWidget *aalarm_label[5];
GtkWidget *aalarm_active[5];
GtkWidget *aalarm_box[5];
GtkWidget *balarm_label;
GtkWidget *balarm_active;
GtkWidget *balarm_box;
GtkWidget *balarm_ebox;
GtkWidget *balarm_mark;
GtkWidget *appl_form;
GtkWidget *eventlog_button;
GtkWidget *help_button;
GtkWidget *decr_button;
int a_height;
int a_exist[5];
int a_active[5];
int text_size;
void map();
int configure( char *opplace_str);
void update_alarm_info();
static void activate_exit( GtkWidget *w, gpointer data);
static void activate_aalarm_ack( GtkWidget *w, gpointer data);
static void activate_balarm_ack( GtkWidget *w, gpointer data);
static void activate_aalarm_incr( GtkWidget *w, gpointer data);
static void activate_aalarm_decr( 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_alarmlist( GtkWidget *w, gpointer data);
static void activate_eventlist( GtkWidget *w, gpointer data);
static void activate_eventlog( GtkWidget *w, gpointer data);
static void activate_navigator( GtkWidget *w, gpointer data);
static void activate_help( GtkWidget *w, gpointer data);
static void activate_appl1( GtkWidget *w, gpointer data);
static void activate_appl2( GtkWidget *w, gpointer data);
static void activate_appl3( GtkWidget *w, gpointer data);
static void activate_appl4( GtkWidget *w, gpointer data);
static void activate_appl5( GtkWidget *w, gpointer data);
static void activate_appl6( GtkWidget *w, gpointer data);
static void activate_appl7( GtkWidget *w, gpointer data);
static void activate_appl8( GtkWidget *w, gpointer data);
static void activate_appl9( GtkWidget *w, gpointer data);
static void activate_appl10( GtkWidget *w, gpointer data);
static void activate_appl11( GtkWidget *w, gpointer data);
static void activate_appl12( GtkWidget *w, gpointer data);
static void activate_appl13( GtkWidget *w, gpointer data);
static void activate_appl14( GtkWidget *w, gpointer data);
static void activate_appl15( GtkWidget *w, gpointer data);
};
#endif
/*
* Proview $Id: xtt_trend_gtk.cpp,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "flow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_gdh_msg.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_wow_gtk.h"
#include "rt_xnav_msg.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "glow_curvectx.h"
#include "glow_curveapi.h"
#include "xtt_xnav.h"
#include "xtt_trend_gtk.h"
#include "ge_curve_gtk.h"
XttTrendGtk::XttTrendGtk( void *parent_ctx,
GtkWidget *parent_wid,
char *name,
GtkWidget **w,
pwr_sAttrRef *trend_list,
pwr_sAttrRef *plotgroup,
int *sts) :
XttTrend( parent_ctx, name, trend_list, plotgroup, sts), parent_widget(parent_wid)
{
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, name, NULL, gcd, 1);
curve->close_cb = trend_close_cb;
curve->help_cb = trend_help_cb;
wow = new CoWowGtk( parent_widget);
timerid = wow->timer_new();
timerid->add( 1000, trend_scan, this);
}
XttTrendGtk::~XttTrendGtk()
{
timerid->remove();
for ( int i = 0; i < trend_cnt; i++) {
gdh_UnrefObjectInfo( subid[i]);
}
delete curve;
}
/*
* Proview $Id: xtt_trend_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_trend_gtk_h
#define xtt_trend_gtk_h
/* xtt_trend_gtk.h -- DsTrend curves */
#ifndef xtt_trend_h
# include "xtt_trend.h"
#endif
class XttTrendGtk : public XttTrend {
public:
GtkWidget *parent_widget;
XttTrendGtk( void *xn_parent_ctx,
GtkWidget *xn_parent_wid,
char *xn_name,
GtkWidget **w,
pwr_sAttrRef *objid,
pwr_sAttrRef *plotgroup,
int *sts);
~XttTrendGtk();
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Proview $Id: xtt_xattnav_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef xtt_xattnav_gtk_h
#define xtt_xattnav_gtk_h
/* wb_xattnav_gtk.h -- */
#ifndef xtt_xattnav_h
# include "xtt_xattnav.h"
#endif
class XAttNavGtk : public XAttNav {
public:
XAttNavGtk(
void *xa_parent_ctx,
GtkWidget *xa_parent_wid,
xattnav_eType xa_type,
char *xa_name,
pwr_sAttrRef *xa_objar,
int xa_advanced_user,
GtkWidget **w,
pwr_tStatus *status);
~XAttNavGtk();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
void popup_position( int x_event, int y_event, int *x, int *y);
void set_inputfocus();
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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