Commit 9f1e1785 authored by claes's avatar claes

rt_xtt -s : show list with opplaces

parent e5aa5525
/* /*
* Proview $Id: rt_xtt_gtk.cpp,v 1.7 2007-04-17 13:58:13 claes Exp $ * Proview $Id: rt_xtt_gtk.cpp,v 1.8 2007-05-16 12:37:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -868,6 +868,9 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) : ...@@ -868,6 +868,9 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) :
} }
methodtoolbar->set_sensitive(); methodtoolbar->set_sensitive();
if ( select_opplace)
list_opplace();
xtt_mainloop(); xtt_mainloop();
} }
......
/* /*
* Proview $Id: rt_xtt_main.h,v 1.2 2007-01-17 06:18:11 claes Exp $ * Proview $Id: rt_xtt_main.h,v 1.3 2007-05-16 12:37:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -63,6 +63,8 @@ class Xtt { ...@@ -63,6 +63,8 @@ class Xtt {
int quiet; int quiet;
int attach_audio; int attach_audio;
XttMethodToolbar *methodtoolbar; XttMethodToolbar *methodtoolbar;
int select_opplace;
int op_close_button;
Xtt( int argc, char *argv[], int *return_sts); Xtt( int argc, char *argv[], int *return_sts);
virtual ~Xtt() {} virtual ~Xtt() {}
...@@ -73,6 +75,9 @@ class Xtt { ...@@ -73,6 +75,9 @@ class Xtt {
virtual void set_prompt( char *prompt) {} virtual void set_prompt( char *prompt) {}
virtual void open_change_value() {} virtual void open_change_value() {}
void list_opplace();
static void opplace_selected_cb( void *ctx, char *text);
void hotkey_activate_command( char *cmdp); void hotkey_activate_command( char *cmdp);
static void hotkey_activate_toggledig( char *namep); static void hotkey_activate_toggledig( char *namep);
static void hotkey_activate_setdig( char *namep); static void hotkey_activate_setdig( char *namep);
......
/* /*
* Proview $Id: xtt_main.cpp,v 1.3 2007-05-07 12:37:18 claes Exp $ * Proview $Id: xtt_main.cpp,v 1.4 2007-05-16 12:37:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -445,7 +445,7 @@ void Xtt::activate_help_proview() ...@@ -445,7 +445,7 @@ void Xtt::activate_help_proview()
} }
Xtt::Xtt( int argc, char *argv[], int *return_sts) : Xtt::Xtt( int argc, char *argv[], int *return_sts) :
root_item(0), input_open(0), command_open(0), india_ok_cb(0), quiet(0), attach_audio(0) root_item(0), input_open(0), command_open(0), india_ok_cb(0), quiet(0), attach_audio(0), select_opplace(0), op_close_button(0)
{ {
pwr_tStatus sts; pwr_tStatus sts;
int i; int i;
...@@ -493,6 +493,10 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) : ...@@ -493,6 +493,10 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) :
} }
else if ( strcmp( argv[i], "-a") == 0) else if ( strcmp( argv[i], "-a") == 0)
attach_audio = 1; attach_audio = 1;
else if ( strcmp( argv[i], "-s") == 0)
select_opplace = 1;
else if ( strcmp( argv[i], "-c") == 0)
op_close_button = 1;
else if ( strcmp( argv[i], "-u") == 0 && i + 1 < argc) { else if ( strcmp( argv[i], "-u") == 0 && i + 1 < argc) {
char oname[80]; char oname[80];
...@@ -539,9 +543,52 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) : ...@@ -539,9 +543,52 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) :
} }
} }
void Xtt::opplace_selected_cb( void *ctx, char *text)
{
Xtt *xtt = (Xtt *)ctx;
pwr_tCmd cmd;
sprintf( cmd, "open operator %s", text);
if ( xtt->op_close_button)
strcat( cmd, " /closebutton");
xtt->xnav->command( cmd);
}
void Xtt::list_opplace()
{
char texts[20][80];
pwr_tStatus sts;
pwr_tOid oid;
int i = 0;
for ( sts = gdh_GetClassList( pwr_cClass_OpPlace, &oid);
ODD(sts);
sts = gdh_GetNextObject( oid, &oid)) {
sts = gdh_ObjidToName( oid, texts[i], sizeof(texts[0]), cdh_mNName);
if ( EVEN(sts)) continue;
i++;
if ( i == (int)(sizeof(texts)/sizeof(texts[0]) - 2))
break;
}
strcpy( texts[i], "");
if ( i == 0) {
printf( "No opplace objects found\n");
exit(0);
}
if ( i == 1) {
// Only one opplace found, open it
pwr_tCmd cmd;
sprintf( cmd, "open operator %s", texts[0]);
xnav->command( cmd);
}
else
// Select oplace from list
wow->CreateList( "Select Operator Place", (char *)texts, opplace_selected_cb, this);
}
......
/* /*
* Proview $Id: xtt_op_gtk.cpp,v 1.3 2007-02-21 14:14:21 claes Exp $ * Proview $Id: xtt_op_gtk.cpp,v 1.4 2007-05-16 12:37:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -243,34 +243,40 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -243,34 +243,40 @@ OpGtk::OpGtk( void *op_parent_ctx,
gtk_box_pack_end( GTK_BOX(vbox_ala), hbox_b, FALSE, FALSE, 0); gtk_box_pack_end( GTK_BOX(vbox_ala), hbox_b, FALSE, FALSE, 0);
// Toolbar // Toolbar
GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL); GtkWidget *tools = (GtkWidget *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
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");
gtk_container_add( GTK_CONTAINER(tools_zoom_in), gtk_container_add( GTK_CONTAINER(tools_zoom_in),
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect(tools_zoom_in, "clicked", G_CALLBACK(activate_zoom_in), this); g_signal_connect(tools_zoom_in, "clicked", G_CALLBACK(activate_zoom_in), this);
gtk_toolbar_append_widget( tools, tools_zoom_in, "Zoom in", ""); gtk_toolbar_append_widget( GTK_TOOLBAR(tools), tools_zoom_in, "Zoom in", "");
GtkWidget *tools_zoom_out = gtk_button_new(); GtkWidget *tools_zoom_out = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_out.png"); dcli_translate_filename( fname, "$pwr_exe/xtt_zoom_out.png");
gtk_container_add( GTK_CONTAINER(tools_zoom_out), gtk_container_add( GTK_CONTAINER(tools_zoom_out),
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect(tools_zoom_out, "clicked", G_CALLBACK(activate_zoom_out), this); g_signal_connect(tools_zoom_out, "clicked", G_CALLBACK(activate_zoom_out), this);
gtk_toolbar_append_widget( tools, tools_zoom_out, "Zoom out", ""); gtk_toolbar_append_widget( GTK_TOOLBAR(tools), tools_zoom_out, "Zoom out", "");
GtkWidget *tools_help = gtk_button_new(); GtkWidget *tools_help = gtk_button_new();
gtk_container_add( GTK_CONTAINER(tools_help), gtk_container_add( GTK_CONTAINER(tools_help),
gtk_image_new_from_stock( "gtk-help", GTK_ICON_SIZE_SMALL_TOOLBAR)); gtk_image_new_from_stock( "gtk-help", GTK_ICON_SIZE_SMALL_TOOLBAR));
g_signal_connect(tools_help, "clicked", G_CALLBACK(activate_help), this); g_signal_connect(tools_help, "clicked", G_CALLBACK(activate_help), this);
gtk_toolbar_append_widget( tools, tools_help, "Help", ""); gtk_toolbar_append_widget( GTK_TOOLBAR(tools), tools_help, "Help", "");
GtkWidget *tools_navigator = gtk_button_new(); GtkWidget *tools_navigator = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_navigator.png"); dcli_translate_filename( fname, "$pwr_exe/xtt_navigator.png");
gtk_container_add( GTK_CONTAINER( tools_navigator), gtk_container_add( GTK_CONTAINER( tools_navigator),
gtk_image_new_from_file( fname)); gtk_image_new_from_file( fname));
g_signal_connect(tools_navigator, "clicked", G_CALLBACK(activate_navigator), this); g_signal_connect(tools_navigator, "clicked", G_CALLBACK(activate_navigator), this);
gtk_toolbar_append_widget( tools, tools_navigator, "Open Navigator", ""); gtk_toolbar_append_widget( GTK_TOOLBAR(tools), tools_navigator, "Open Navigator", "");
tools_close = gtk_button_new();
gtk_container_add( GTK_CONTAINER(tools_close),
gtk_image_new_from_stock( "gtk-close", GTK_ICON_SIZE_SMALL_TOOLBAR));
g_signal_connect(tools_close, "clicked", G_CALLBACK(activate_exit), this);
gtk_toolbar_append_widget( GTK_TOOLBAR(tools), tools_close, "Close", "");
// System pushbuttons // System pushbuttons
GtkWidget *alarmlist_button = gtk_button_new_with_label("Alarmlist"); GtkWidget *alarmlist_button = gtk_button_new_with_label("Alarmlist");
...@@ -295,7 +301,7 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -295,7 +301,7 @@ OpGtk::OpGtk( void *op_parent_ctx,
gtk_box_pack_start( GTK_BOX(sysbutton_box), eventlist_button, FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(sysbutton_box), eventlist_button, FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(sysbutton_box), eventlog_button, FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(sysbutton_box), eventlog_button, FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(sysbutton_box), help_button, FALSE, FALSE, 0); gtk_box_pack_start( GTK_BOX(sysbutton_box), help_button, FALSE, FALSE, 0);
gtk_widget_set_size_request( sysbutton_box, 130, -1); gtk_widget_set_size_request( sysbutton_box, 140, -1);
// Main window // Main window
configure( opplace); configure( opplace);
...@@ -334,6 +340,7 @@ OpGtk::OpGtk( void *op_parent_ctx, ...@@ -334,6 +340,7 @@ OpGtk::OpGtk( void *op_parent_ctx,
g_object_set( help_button, "visible", FALSE, NULL); g_object_set( help_button, "visible", FALSE, NULL);
g_object_set( eventlog_button, "visible", FALSE, NULL); g_object_set( eventlog_button, "visible", FALSE, NULL);
g_object_set( decr_button, "visible", FALSE, NULL); g_object_set( decr_button, "visible", FALSE, NULL);
g_object_set( tools_close, "visible", FALSE, NULL);
int width, height; int width, height;
GdkWindow *rootwindow = gtk_widget_get_root_window( toplevel); GdkWindow *rootwindow = gtk_widget_get_root_window( toplevel);
...@@ -367,6 +374,11 @@ void OpGtk::map() ...@@ -367,6 +374,11 @@ void OpGtk::map()
gtk_window_present( GTK_WINDOW(toplevel)); gtk_window_present( GTK_WINDOW(toplevel));
} }
void OpGtk::add_close_button()
{
g_object_set( tools_close, "visible", TRUE, NULL);
}
void OpGtk::update_alarm_info() void OpGtk::update_alarm_info()
{ {
evlist_sAlarmInfo info; evlist_sAlarmInfo info;
......
/* /*
* Proview $Id: xtt_op_gtk.h,v 1.1 2007-01-04 08:29:32 claes Exp $ * Proview $Id: xtt_op_gtk.h,v 1.2 2007-05-16 12:37:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -51,6 +51,7 @@ class OpGtk : public Op { ...@@ -51,6 +51,7 @@ class OpGtk : public Op {
GtkWidget *eventlog_button; GtkWidget *eventlog_button;
GtkWidget *help_button; GtkWidget *help_button;
GtkWidget *decr_button; GtkWidget *decr_button;
GtkWidget *tools_close;
int a_height; int a_height;
int a_exist[5]; int a_exist[5];
int a_active[5]; int a_active[5];
...@@ -59,6 +60,7 @@ class OpGtk : public Op { ...@@ -59,6 +60,7 @@ class OpGtk : public Op {
void map(); void map();
int configure( char *opplace_str); int configure( char *opplace_str);
void update_alarm_info(); void update_alarm_info();
void add_close_button();
static void activate_exit( GtkWidget *w, gpointer data); static void activate_exit( GtkWidget *w, gpointer data);
static void activate_aalarm_ack( GtkWidget *w, gpointer data); static void activate_aalarm_ack( GtkWidget *w, gpointer data);
......
/* /*
* Proview $Id: xtt_op.h,v 1.3 2007-01-04 08:22:47 claes Exp $ * Proview $Id: xtt_op.h,v 1.4 2007-05-16 12:37:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -66,6 +66,7 @@ class Op { ...@@ -66,6 +66,7 @@ class Op {
virtual void map() {} virtual void map() {}
virtual int configure( char *opplace_str) {return 0;} virtual int configure( char *opplace_str) {return 0;}
virtual void update_alarm_info() {} virtual void update_alarm_info() {}
virtual void add_close_button() {}
void set_jop_qid( int qix) { if ( jop) jop->set_jop_qid( qix);}; void set_jop_qid( int qix) { if ( jop) jop->set_jop_qid( qix);};
void scan(); void scan();
......
/* /*
* Proview $Id: xtt_xnav_command.cpp,v 1.30 2007-04-25 13:39:21 claes Exp $ * Proview $Id: xtt_xnav_command.cpp,v 1.31 2007-05-16 12:37:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -188,7 +188,7 @@ dcli_tCmdTable xnav_command_table[] = { ...@@ -188,7 +188,7 @@ dcli_tCmdTable xnav_command_table[] = {
"/NAVIGATOR", "/CENTER", "/OBJECT", "/NEW", "/NAVIGATOR", "/CENTER", "/OBJECT", "/NEW",
"/INSTANCE", "/COLLECT", "/FOCUS", "/INPUTEMPTY", "/INSTANCE", "/COLLECT", "/FOCUS", "/INPUTEMPTY",
"/ENTRY", "/TITLE", "/ACCESS", "/CLASSGRAPH", "/BYPASS", "/ENTRY", "/TITLE", "/ACCESS", "/CLASSGRAPH", "/BYPASS",
""} "/CLOSEBUTTON", ""}
}, },
{ {
"CLOSE", "CLOSE",
...@@ -2586,6 +2586,8 @@ static int xnav_open_func( void *client_data, ...@@ -2586,6 +2586,8 @@ static int xnav_open_func( void *client_data,
return XNAV__HOLDCOMMAND; return XNAV__HOLDCOMMAND;
} }
int closebutton = ODD( dcli_get_qualifier( "/CLOSEBUTTON", 0, 0));
xnav->op = xnav->op_new( opplace_str, &sts); xnav->op = xnav->op_new( opplace_str, &sts);
if ( EVEN(sts)) if ( EVEN(sts))
{ {
...@@ -2600,6 +2602,8 @@ static int xnav_open_func( void *client_data, ...@@ -2600,6 +2602,8 @@ static int xnav_open_func( void *client_data,
xnav->op->map_cb = xnav_op_map_cb; xnav->op->map_cb = xnav_op_map_cb;
xnav->op->get_alarm_info_cb = xnav_op_get_alarm_info_cb; xnav->op->get_alarm_info_cb = xnav_op_get_alarm_info_cb;
xnav->op->ack_last_cb = xnav_op_ack_last_cb; xnav->op->ack_last_cb = xnav_op_ack_last_cb;
if ( closebutton)
xnav->op->add_close_button();
} }
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