Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
0448a367
Commit
0448a367
authored
May 11, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New Status Monitor
parent
4469e089
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2775 additions
and
0 deletions
+2775
-0
xtt/exe/rt_statusmon/gtk/os_linux/hw_x86/makefile
xtt/exe/rt_statusmon/gtk/os_linux/hw_x86/makefile
+15
-0
xtt/exe/rt_statusmon/gtk/os_linux/link_rule.mk
xtt/exe/rt_statusmon/gtk/os_linux/link_rule.mk
+19
-0
xtt/exe/rt_statusmon/gtk/rt_statusmon_gtk.cpp
xtt/exe/rt_statusmon/gtk/rt_statusmon_gtk.cpp
+60
-0
xtt/exe/rt_statusmon/gtk/statusmon_nodelist_gtk.cpp
xtt/exe/rt_statusmon/gtk/statusmon_nodelist_gtk.cpp
+394
-0
xtt/exe/rt_statusmon/gtk/statusmon_nodelist_gtk.h
xtt/exe/rt_statusmon/gtk/statusmon_nodelist_gtk.h
+75
-0
xtt/exe/rt_statusmon/gtk/statusmon_nodelistnav_gtk.cpp
xtt/exe/rt_statusmon/gtk/statusmon_nodelistnav_gtk.cpp
+108
-0
xtt/exe/rt_statusmon/gtk/statusmon_nodelistnav_gtk.h
xtt/exe/rt_statusmon/gtk/statusmon_nodelistnav_gtk.h
+54
-0
xtt/exe/rt_statusmon/src/os_linux/hw_x86/makefile
xtt/exe/rt_statusmon/src/os_linux/hw_x86/makefile
+15
-0
xtt/exe/rt_statusmon/src/os_linux/hw_x86/special.mk
xtt/exe/rt_statusmon/src/os_linux/hw_x86/special.mk
+9
-0
xtt/exe/rt_statusmon/src/os_linux/link_rule.mk
xtt/exe/rt_statusmon/src/os_linux/link_rule.mk
+7
-0
xtt/exe/rt_statusmon/src/rt_statusmon.cpp
xtt/exe/rt_statusmon/src/rt_statusmon.cpp
+63
-0
xtt/exe/rt_statusmon/src/statusmon_nodelist.cpp
xtt/exe/rt_statusmon/src/statusmon_nodelist.cpp
+106
-0
xtt/exe/rt_statusmon/src/statusmon_nodelist.h
xtt/exe/rt_statusmon/src/statusmon_nodelist.h
+72
-0
xtt/exe/rt_statusmon/src/statusmon_nodelistnav.cpp
xtt/exe/rt_statusmon/src/statusmon_nodelistnav.cpp
+1528
-0
xtt/exe/rt_statusmon/src/statusmon_nodelistnav.h
xtt/exe/rt_statusmon/src/statusmon_nodelistnav.h
+250
-0
No files found.
xtt/exe/rt_statusmon/gtk/os_linux/hw_x86/makefile
0 → 100644
View file @
0448a367
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
xtt/exe/rt_statusmon/gtk/os_linux/link_rule.mk
0 → 100644
View file @
0448a367
ifndef
link_rule_mk
link_rule_mk
:=
1
link
=
$(ldxx)
$(elinkflags)
$(domap)
-o
$(pwr_exe)
/rt_statusmon_gtk
\
$(bld_dir)
/rt_statusmon_gtk.o
\
$(bld_dir)
/statusmon_nodelist_gtk.o
$(bld_dir)
/statusmon_nodelistnav_gtk.o
\
$(bld_dir)
/statusmon_nodelist.o
$(bld_dir)
/statusmon_nodelistnav.o
\
$(pwr_eobj)
/stdsoap2.o
\
$(wb_msg_eobjs)
$(rt_msg_eobjs)
\
-L
/usr/X11R6/lib
\
-L
/opt/gnome/lib
\
-lpwr_statussrv
-lpwr_ge_gtk
-lpwr_ge
-lpwr_wb_gtk
-lpwr_wb
-lpwr_wb_gtk
-l
pwr_wb
-lpwr_ge_gtk
-lpwr_ge
\
-lpwr_flow_gtk
-lpwr_flow
-lpwr_glow_gtk
-lpwr_glow
-lpwr_rt_gtk
-lpwr_rt
\
-lpwr_co_gtk
-lpwr_co
-lpwr_flow_gtk
-lpwr_flow
\
`
pkg-config
--libs
gtk+-2.0
`
\
-lpwr_msg_dummy
-lantlr
\
-lrpcsvc
-lpthread
-lm
-ldb_cxx
-lz
endif
xtt/exe/rt_statusmon/gtk/rt_statusmon_gtk.cpp
0 → 100644
View file @
0448a367
/*
* Proview $Id: rt_statusmon_gtk.cpp,v 1.1 2007-05-11 15:04:14 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.
*/
/* rt_statusmon_gtk.cpp -- Status Monitor */
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "pwr.h"
#include "statusmon_nodelist_gtk.h"
static
void
usage
()
{
printf
(
"
\n
Usage: rt_statusmonitor
\n\n
$HOME/rt_statusmon.dat : file with reqested nodes"
);
}
static
void
statusmon_close
(
void
*
ctx
)
{
exit
(
0
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
sts
;
if
(
argc
>
1
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"-h"
)
==
0
)
{
usage
();
exit
(
0
);
}
}
}
gtk_init
(
&
argc
,
&
argv
);
Nodelist
*
nl
=
new
NodelistGtk
(
NULL
,
NULL
,
"Status Monitor"
,
&
sts
);
nl
->
close_cb
=
statusmon_close
;
nl
->
set_scantime
(
3
);
gtk_main
();
return
(
0
);
}
xtt/exe/rt_statusmon/gtk/statusmon_nodelist_gtk.cpp
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelist_gtk.cpp,v 1.1 2007-05-11 15:04:14 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.
*/
/* statusmon_nodelist_gtk.cpp -- Console log in statusmon */
#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 "co_lng.h"
#include "co_wow_gtk.h"
#include "co_msgwindow_gtk.h"
#include "statusmon_nodelist.h"
#include "rt_xnav_msg.h"
#include "statusmon_nodelist_gtk.h"
#include "statusmon_nodelistnav_gtk.h"
static
gint
delete_event
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
)
{
NodelistGtk
::
activate_exit
(
w
,
data
);
return
TRUE
;
}
static
void
destroy_event
(
GtkWidget
*
w
,
gpointer
data
)
{
}
NodelistGtk
::
NodelistGtk
(
void
*
nodelist_parent_ctx
,
GtkWidget
*
nodelist_parent_wid
,
char
*
nodelist_name
,
pwr_tStatus
*
status
)
:
Nodelist
(
nodelist_parent_ctx
,
nodelist_name
,
status
),
parent_wid
(
nodelist_parent_wid
),
clock_cursor
(
0
)
{
pwr_tStatus
sts
;
toplevel
=
(
GtkWidget
*
)
g_object_new
(
GTK_TYPE_WINDOW
,
"default-height"
,
600
,
"default-width"
,
700
,
"title"
,
nodelist_name
,
NULL
);
g_signal_connect
(
toplevel
,
"delete_event"
,
G_CALLBACK
(
delete_event
),
this
);
g_signal_connect
(
toplevel
,
"destroy"
,
G_CALLBACK
(
destroy_event
),
this
);
g_signal_connect
(
toplevel
,
"focus-in-event"
,
G_CALLBACK
(
action_inputfocus
),
this
);
CoWowGtk
::
SetWindowIcon
(
toplevel
);
GtkWidget
*
vbox
=
gtk_vbox_new
(
FALSE
,
0
);
// Menu
// Accelerators
GtkAccelGroup
*
accel_g
=
(
GtkAccelGroup
*
)
g_object_new
(
GTK_TYPE_ACCEL_GROUP
,
NULL
);
gtk_window_add_accel_group
(
GTK_WINDOW
(
toplevel
),
accel_g
);
GtkMenuBar
*
menu_bar
=
(
GtkMenuBar
*
)
g_object_new
(
GTK_TYPE_MENU_BAR
,
NULL
);
// File entry
GtkWidget
*
file_close
=
gtk_image_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_Close"
));
gtk_image_menu_item_set_image
(
GTK_IMAGE_MENU_ITEM
(
file_close
),
gtk_image_new_from_stock
(
"gtk-close"
,
GTK_ICON_SIZE_MENU
));
g_signal_connect
(
file_close
,
"activate"
,
G_CALLBACK
(
activate_exit
),
this
);
gtk_widget_add_accelerator
(
file_close
,
"activate"
,
accel_g
,
'w'
,
GDK_CONTROL_MASK
,
GTK_ACCEL_VISIBLE
);
GtkWidget
*
file_add_node
=
gtk_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_Add Node"
));
g_signal_connect
(
file_add_node
,
"activate"
,
G_CALLBACK
(
activate_add_node
),
this
);
GtkWidget
*
file_remove_node
=
gtk_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_Remove Node"
));
g_signal_connect
(
file_remove_node
,
"activate"
,
G_CALLBACK
(
activate_remove_node
),
this
);
GtkWidget
*
file_save
=
gtk_image_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_Save Configuration"
));
gtk_image_menu_item_set_image
(
GTK_IMAGE_MENU_ITEM
(
file_save
),
gtk_image_new_from_stock
(
"gtk-save"
,
GTK_ICON_SIZE_MENU
));
g_signal_connect
(
file_save
,
"activate"
,
G_CALLBACK
(
activate_save
),
this
);
GtkMenu
*
file_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
file_menu
),
file_close
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
file_menu
),
file_add_node
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
file_menu
),
file_remove_node
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
file_menu
),
file_save
);
GtkWidget
*
file
=
gtk_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_File"
));
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
menu_bar
),
file
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
file
),
GTK_WIDGET
(
file_menu
));
// View menu
GtkWidget
*
view_show_events
=
gtk_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"Show _Events"
));
g_signal_connect
(
view_show_events
,
"activate"
,
G_CALLBACK
(
activate_show_events
),
this
);
GtkWidget
*
view_zoom_in
=
gtk_image_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"Zoom _In"
));
gtk_image_menu_item_set_image
(
GTK_IMAGE_MENU_ITEM
(
view_zoom_in
),
gtk_image_new_from_stock
(
"gtk-zoom-in"
,
GTK_ICON_SIZE_MENU
));
g_signal_connect
(
view_zoom_in
,
"activate"
,
G_CALLBACK
(
activate_zoom_in
),
this
);
gtk_widget_add_accelerator
(
view_zoom_in
,
"activate"
,
accel_g
,
'i'
,
GDK_CONTROL_MASK
,
GTK_ACCEL_VISIBLE
);
GtkWidget
*
view_zoom_out
=
gtk_image_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"Zoom _Out"
));
gtk_image_menu_item_set_image
(
GTK_IMAGE_MENU_ITEM
(
view_zoom_out
),
gtk_image_new_from_stock
(
"gtk-zoom-out"
,
GTK_ICON_SIZE_MENU
));
g_signal_connect
(
view_zoom_out
,
"activate"
,
G_CALLBACK
(
activate_zoom_out
),
this
);
gtk_widget_add_accelerator
(
view_zoom_out
,
"activate"
,
accel_g
,
'o'
,
GDK_CONTROL_MASK
,
GTK_ACCEL_VISIBLE
);
GtkWidget
*
view_zoom_reset
=
gtk_image_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"Zoom _Reset"
));
gtk_image_menu_item_set_image
(
GTK_IMAGE_MENU_ITEM
(
view_zoom_reset
),
gtk_image_new_from_stock
(
"gtk-zoom-100"
,
GTK_ICON_SIZE_MENU
));
g_signal_connect
(
view_zoom_reset
,
"activate"
,
G_CALLBACK
(
activate_zoom_reset
),
this
);
GtkMenu
*
view_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_show_events
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_in
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_out
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_reset
);
GtkWidget
*
view
=
gtk_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_View"
));
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
menu_bar
),
view
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
view
),
GTK_WIDGET
(
view_menu
));
// Menu Help
GtkWidget
*
help_help
=
gtk_image_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_Help"
));
gtk_image_menu_item_set_image
(
GTK_IMAGE_MENU_ITEM
(
help_help
),
gtk_image_new_from_stock
(
"gtk-help"
,
GTK_ICON_SIZE_MENU
));
g_signal_connect
(
help_help
,
"activate"
,
G_CALLBACK
(
activate_help
),
this
);
gtk_widget_add_accelerator
(
help_help
,
"activate"
,
accel_g
,
'h'
,
GDK_CONTROL_MASK
,
GTK_ACCEL_VISIBLE
);
GtkMenu
*
help_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
help_menu
),
help_help
);
GtkWidget
*
help
=
gtk_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"_Help"
));
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
menu_bar
),
help
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
help
),
GTK_WIDGET
(
help_menu
));
MsgWindowGtk
*
msg_window
=
new
MsgWindowGtk
(
this
,
toplevel
,
"Status Events"
,
&
sts
);
msg_window
->
find_wnav_cb
=
find_node_cb
;
MsgWindow
::
set_default
(
msg_window
);
MsgWindow
::
message
(
'I'
,
"Status Montitor started"
);
nodelistnav
=
new
NodelistNavGtk
(
this
,
vbox
,
&
nodelistnav_widget
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
GTK_WIDGET
(
menu_bar
),
FALSE
,
FALSE
,
0
);
gtk_box_pack_end
(
GTK_BOX
(
vbox
),
GTK_WIDGET
(
nodelistnav_widget
),
TRUE
,
TRUE
,
0
);
gtk_container_add
(
GTK_CONTAINER
(
toplevel
),
vbox
);
gtk_widget_show_all
(
toplevel
);
wow
=
new
CoWowGtk
(
toplevel
);
*
status
=
1
;
}
//
// Delete nodelist
//
NodelistGtk
::~
NodelistGtk
()
{
free_cursor
();
delete
nodelistnav
;
gtk_widget_destroy
(
toplevel
);
}
void
NodelistGtk
::
pop
()
{
gtk_window_present
(
GTK_WINDOW
(
toplevel
));
}
void
NodelistGtk
::
set_clock_cursor
()
{
if
(
!
clock_cursor
)
clock_cursor
=
gdk_cursor_new_for_display
(
gtk_widget_get_display
(
toplevel
),
GDK_WATCH
);
gdk_window_set_cursor
(
toplevel
->
window
,
clock_cursor
);
gdk_display_flush
(
gtk_widget_get_display
(
toplevel
));
}
void
NodelistGtk
::
reset_cursor
()
{
gdk_window_set_cursor
(
toplevel
->
window
,
NULL
);
}
void
NodelistGtk
::
free_cursor
()
{
if
(
clock_cursor
)
gdk_cursor_unref
(
clock_cursor
);
}
gboolean
NodelistGtk
::
action_inputfocus
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
)
{
NodelistGtk
*
nodelist
=
(
NodelistGtk
*
)
data
;
if
(
nodelist
&&
nodelist
->
nodelist_displayed
)
nodelist
->
nodelistnav
->
set_input_focus
();
return
FALSE
;
}
void
NodelistGtk
::
activate_exit
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
if
(
nodelist
->
close_cb
)
(
nodelist
->
close_cb
)(
nodelist
->
parent_ctx
);
else
delete
nodelist
;
}
void
NodelistGtk
::
activate_add_node
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
nodelist
->
activate_add_node
();
}
void
NodelistGtk
::
activate_remove_node
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
nodelist
->
activate_remove_node
();
}
void
NodelistGtk
::
activate_save
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
nodelist
->
activate_save
();
}
void
NodelistGtk
::
activate_show_events
(
GtkWidget
*
w
,
gpointer
data
)
{
MsgWindow
::
map_default
();
}
void
NodelistGtk
::
activate_zoom_in
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
nodelist
->
nodelistnav
->
zoom
(
1.2
);
}
void
NodelistGtk
::
activate_zoom_out
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
nodelist
->
nodelistnav
->
zoom
(
5.0
/
6
);
}
void
NodelistGtk
::
activate_zoom_reset
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
nodelist
->
nodelistnav
->
unzoom
();
}
void
NodelistGtk
::
activate_help
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
nodelist
->
activate_help
();
}
void
NodelistGtk
::
open_input_dialog
(
char
*
text
,
char
*
title
,
char
*
init_text
,
void
(
*
ok_cb
)(
Nodelist
*
,
char
*
))
{
create_input_dialog
();
g_object_set
(
india_widget
,
"visible"
,
TRUE
,
"title"
,
title
,
NULL
);
gtk_label_set_text
(
GTK_LABEL
(
india_label
),
text
);
gint
pos
=
0
;
gtk_editable_delete_text
(
GTK_EDITABLE
(
india_text
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
india_text
),
init_text
,
strlen
(
init_text
),
&
pos
);
india_ok_cb
=
ok_cb
;
}
void
NodelistGtk
::
activate_india_ok
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
char
*
text
,
*
textutf8
;
textutf8
=
gtk_editable_get_chars
(
GTK_EDITABLE
(((
NodelistGtk
*
)
nodelist
)
->
india_text
),
0
,
-
1
);
text
=
g_convert
(
textutf8
,
-
1
,
"ISO8859-1"
,
"UTF-8"
,
NULL
,
NULL
,
NULL
);
g_free
(
textutf8
);
g_object_set
(
((
NodelistGtk
*
)
nodelist
)
->
india_widget
,
"visible"
,
FALSE
,
NULL
);
printf
(
"Add node %s
\n
"
,
text
);
(
nodelist
->
india_ok_cb
)(
nodelist
,
text
);
g_free
(
text
);
}
void
NodelistGtk
::
activate_india_cancel
(
GtkWidget
*
w
,
gpointer
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
data
;
g_object_set
(
((
NodelistGtk
*
)
nodelist
)
->
india_widget
,
"visible"
,
FALSE
,
NULL
);
}
static
gint
india_delete_event
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
nodelist
)
{
g_object_set
(
((
NodelistGtk
*
)
nodelist
)
->
india_widget
,
"visible"
,
FALSE
,
NULL
);
return
TRUE
;
}
void
NodelistGtk
::
create_input_dialog
()
{
if
(
india_widget
)
{
g_object_set
(
india_widget
,
"visible"
,
TRUE
,
NULL
);
return
;
}
// Create an input dialog
india_widget
=
(
GtkWidget
*
)
g_object_new
(
GTK_TYPE_WINDOW
,
"default-height"
,
150
,
"default-width"
,
350
,
"title"
,
"Input Dialog"
,
"window-position"
,
GTK_WIN_POS_CENTER
,
NULL
);
g_signal_connect
(
india_widget
,
"delete_event"
,
G_CALLBACK
(
india_delete_event
),
this
);
india_text
=
gtk_entry_new
();
g_signal_connect
(
india_text
,
"activate"
,
G_CALLBACK
(
NodelistGtk
::
activate_india_ok
),
this
);
india_label
=
gtk_label_new
(
""
);
GtkWidget
*
india_image
=
(
GtkWidget
*
)
g_object_new
(
GTK_TYPE_IMAGE
,
"stock"
,
GTK_STOCK_DIALOG_QUESTION
,
"icon-size"
,
GTK_ICON_SIZE_DIALOG
,
"xalign"
,
0.5
,
"yalign"
,
1.0
,
NULL
);
GtkWidget
*
india_ok
=
gtk_button_new_with_label
(
"Ok"
);
gtk_widget_set_size_request
(
india_ok
,
70
,
25
);
g_signal_connect
(
india_ok
,
"clicked"
,
G_CALLBACK
(
NodelistGtk
::
activate_india_ok
),
this
);
GtkWidget
*
india_cancel
=
gtk_button_new_with_label
(
"Cancel"
);
gtk_widget_set_size_request
(
india_cancel
,
70
,
25
);
g_signal_connect
(
india_cancel
,
"clicked"
,
G_CALLBACK
(
NodelistGtk
::
activate_india_cancel
),
this
);
GtkWidget
*
india_hboxtext
=
gtk_hbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
india_hboxtext
),
india_image
,
FALSE
,
FALSE
,
15
);
gtk_box_pack_start
(
GTK_BOX
(
india_hboxtext
),
india_label
,
FALSE
,
FALSE
,
15
);
gtk_box_pack_end
(
GTK_BOX
(
india_hboxtext
),
india_text
,
TRUE
,
TRUE
,
30
);
GtkWidget
*
india_hboxbuttons
=
gtk_hbox_new
(
TRUE
,
40
);
gtk_box_pack_start
(
GTK_BOX
(
india_hboxbuttons
),
india_ok
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_end
(
GTK_BOX
(
india_hboxbuttons
),
india_cancel
,
FALSE
,
FALSE
,
0
);
GtkWidget
*
india_vbox
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
india_vbox
),
india_hboxtext
,
TRUE
,
TRUE
,
30
);
gtk_box_pack_start
(
GTK_BOX
(
india_vbox
),
gtk_hseparator_new
(),
FALSE
,
FALSE
,
0
);
gtk_box_pack_end
(
GTK_BOX
(
india_vbox
),
india_hboxbuttons
,
FALSE
,
FALSE
,
15
);
gtk_container_add
(
GTK_CONTAINER
(
india_widget
),
india_vbox
);
gtk_widget_show_all
(
india_widget
);
g_object_set
(
india_widget
,
"visible"
,
FALSE
,
NULL
);
}
xtt/exe/rt_statusmon/gtk/statusmon_nodelist_gtk.h
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelist_gtk.h,v 1.1 2007-05-11 15:04:14 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 statusmon_nodelist_gtk_h
#define statusmon_nodelist_gtk_h
/* statusmon_nodelist_gtk.h -- Alarm and event windows in statusmon */
#ifndef statusmon_nodelist_h
# include "statusmon_nodelist.h"
#endif
class
NodelistGtk
:
public
Nodelist
{
public:
NodelistGtk
(
void
*
nodelist_parent_ctx
,
GtkWidget
*
nodelist_parent_wid
,
char
*
nodelist_name
,
pwr_tStatus
*
status
);
~
NodelistGtk
();
GtkWidget
*
parent_wid
;
GtkWidget
*
parent_wid_nodelist
;
GtkWidget
*
toplevel
;
GtkWidget
*
form_nodelist
;
GtkWidget
*
nodelistnav_widget
;
GdkCursor
*
clock_cursor
;
GtkWidget
*
india_widget
;
GtkWidget
*
india_label
;
GtkWidget
*
india_text
;
void
pop
();
void
set_clock_cursor
();
void
reset_cursor
();
void
free_cursor
();
void
create_input_dialog
();
void
open_input_dialog
(
char
*
text
,
char
*
title
,
char
*
init_text
,
void
(
*
ok_cb
)(
Nodelist
*
,
char
*
));
static
gboolean
action_inputfocus
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
);
static
void
activate_exit
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_add_node
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_remove_node
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_save
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_show_events
(
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
activate_india_ok
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_india_cancel
(
GtkWidget
*
w
,
gpointer
data
);
};
#endif
xtt/exe/rt_statusmon/gtk/statusmon_nodelistnav_gtk.cpp
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelistnav_gtk.cpp,v 1.1 2007-05-11 15:04:14 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.
*/
/* statusmon_nodelistnav_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 "co_wow_gtk.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 "statusmon_nodelistnav_gtk.h"
NodelistNavGtk
::
NodelistNavGtk
(
void
*
nodelist_parent_ctx
,
GtkWidget
*
nodelist_parent_wid
,
GtkWidget
**
w
)
:
NodelistNav
(
nodelist_parent_ctx
),
parent_wid
(
nodelist_parent_wid
)
{
form_widget
=
scrolledbrowwidgetgtk_new
(
init_brow_cb
,
this
,
&
brow_widget
);
gtk_widget_show_all
(
brow_widget
);
*
w
=
form_widget
;
wow
=
new
CoWowGtk
(
parent_wid
);
}
//
// Delete ev
//
NodelistNavGtk
::~
NodelistNavGtk
()
{
if
(
trace_started
)
g_source_remove
(
trace_timerid
);
delete
brow
;
gtk_widget_destroy
(
form_widget
);
}
void
NodelistNavGtk
::
beep
()
{
gdk_display_beep
(
gtk_widget_get_display
(
form_widget
));
}
void
NodelistNavGtk
::
set_input_focus
()
{
gtk_widget_grab_focus
(
brow_widget
);
}
void
NodelistNavGtk
::
trace_start
()
{
NodelistNavGtk
::
trace_scan
(
this
);
}
static
gboolean
nodelistnavgtk_trace_scan
(
void
*
data
)
{
NodelistNavGtk
::
trace_scan
(
(
NodelistNav
*
)
data
);
return
FALSE
;
}
void
NodelistNavGtk
::
trace_scan
(
NodelistNav
*
nodelistnav
)
{
if
(
nodelistnav
->
trace_started
)
{
nodelistnav
->
update_nodes
();
brow_TraceScan
(
nodelistnav
->
brow
->
ctx
);
((
NodelistNavGtk
*
)
nodelistnav
)
->
trace_timerid
=
g_timeout_add
(
nodelistnav
->
scantime
,
nodelistnavgtk_trace_scan
,
nodelistnav
);
}
}
xtt/exe/rt_statusmon/gtk/statusmon_nodelistnav_gtk.h
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelistnav_gtk.h,v 1.1 2007-05-11 15:04:14 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 statusmon_nodelistnav_gtk_h
#define statusmon_nodelistnav_gtk_h
/* statusmon_nodelistnav_gtk.h -- Console message window. */
// Status is defined as int i xlib...
#ifndef statusmon_nodelistnav_h
# include "statusmon_nodelistnav.h"
#endif
class
NodelistNavGtk
:
public
NodelistNav
{
public:
NodelistNavGtk
(
void
*
ev_parent_ctx
,
GtkWidget
*
ev_parent_wid
,
GtkWidget
**
w
);
~
NodelistNavGtk
();
GtkWidget
*
parent_wid
;
GtkWidget
*
brow_widget
;
GtkWidget
*
form_widget
;
GtkWidget
*
toplevel
;
gint
trace_timerid
;
void
start_trace
(
pwr_tObjid
Objid
,
char
*
object_str
);
void
set_input_focus
();
void
trace_start
();
void
beep
();
static
void
trace_scan
(
NodelistNav
*
nodelistnav
);
};
#endif
xtt/exe/rt_statusmon/src/os_linux/hw_x86/makefile
0 → 100644
View file @
0448a367
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
xtt/exe/rt_statusmon/src/os_linux/hw_x86/special.mk
0 → 100644
View file @
0448a367
copy
:
$(inc_dir)/statusmon_nodelist.h
\
$(inc_dir)/statusmon_nodelistnav.h
$(inc_dir)/statusmon_nodelist.h
:
\
../../statusmon_nodelist.h
$(inc_dir)/statusmon_nodelistnav.h
:
\
../../statusmon_nodelistnav.h
xtt/exe/rt_statusmon/src/os_linux/link_rule.mk
0 → 100644
View file @
0448a367
ifndef
link_rule_mk
link_rule_mk
:=
1
link
=
$(ldxx)
$(elinkflags)
$(domap)
-o
$(export_exe)
\
$(export_obj)
-lpwr_co
endif
xtt/exe/rt_statusmon/src/rt_statusmon.cpp
0 → 100644
View file @
0448a367
/*
* Proview $Id: rt_statusmon.cpp,v 1.1 2007-05-11 15:04:14 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.
*/
/* rt_statusmon.cpp Status Monitor */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "pwr.h"
static
void
usage
()
{
printf
(
"
\n
Usage: rt_statusmon [-f windowmanager]"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
;
int
found
=
0
;
char
wmg
[
80
];
pwr_tFileName
file
;
if
(
argc
>
1
)
{
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"-f"
)
==
0
)
{
if
(
i
+
1
>=
argc
)
{
usage
();
exit
(
0
);
}
found
=
1
;
strcpy
(
wmg
,
argv
[
i
+
1
]);
i
++
;
}
}
}
if
(
!
found
)
strcpy
(
wmg
,
"gtk"
);
strcpy
(
file
,
argv
[
0
]);
strcat
(
file
,
"_"
);
strcat
(
file
,
wmg
);
execvp
(
file
,
argv
);
}
xtt/exe/rt_statusmon/src/statusmon_nodelist.cpp
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelist.cpp,v 1.1 2007-05-11 15:04:14 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_nodelist.cpp -- Console log in xtt */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include "co_cdh.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "co_lng.h"
#include "co_wow.h"
#include "statusmon_nodelist.h"
#include "rt_xnav_msg.h"
Nodelist
::
Nodelist
(
void
*
nodelist_parent_ctx
,
char
*
nodelist_name
,
pwr_tStatus
*
status
)
:
parent_ctx
(
nodelist_parent_ctx
),
nodelistnav
(
NULL
),
nodelist_displayed
(
0
),
help_cb
(
0
),
close_cb
(
0
)
{
*
status
=
1
;
}
//
// Delete nodelist
//
Nodelist
::~
Nodelist
()
{
}
void
Nodelist
::
activate_help
()
{
if
(
help_cb
)
(
help_cb
)(
parent_ctx
,
"consolelog"
);
}
void
Nodelist
::
find_node_cb
(
void
*
ctx
,
pwr_tOid
oid
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
ctx
;
if
(
nodelist
->
nodelistnav
->
select_node
(
oid
.
oix
))
nodelist
->
pop
();
}
void
Nodelist
::
add_node_ok
(
Nodelist
*
nodelist
,
char
*
node_name
)
{
nodelist
->
nodelistnav
->
add_node
(
node_name
);
}
void
Nodelist
::
activate_add_node
()
{
open_input_dialog
(
"Enter node name"
,
"Add Node"
,
""
,
add_node_ok
);
}
void
remove_node_ok
(
void
*
ctx
,
void
*
data
)
{
Nodelist
*
nodelist
=
(
Nodelist
*
)
ctx
;
nodelist
->
nodelistnav
->
remove_node
(
(
char
*
)
data
);
}
void
Nodelist
::
activate_remove_node
()
{
static
char
node_name
[
80
];
char
msg
[
100
];
int
sts
;
sts
=
nodelistnav
->
get_selected_node
(
node_name
);
if
(
EVEN
(
sts
))
{
nodelistnav
->
wow
->
DisplayError
(
"Remove Node"
,
"Select a node"
);
return
;
}
sprintf
(
msg
,
"Do you want to remove node %s"
,
node_name
);
nodelistnav
->
wow
->
DisplayQuestion
(
this
,
"Remove Node"
,
msg
,
remove_node_ok
,
NULL
,
node_name
);
}
void
Nodelist
::
activate_save
()
{
nodelistnav
->
save
();
}
xtt/exe/rt_statusmon/src/statusmon_nodelist.h
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelist.h,v 1.1 2007-05-11 15:04:14 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 statusmon_nodelist_h
#define statusmon_nodelist_h
/* statusmon_nodelist.h -- Status Monitor node list */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef statusmon_nodelistnav
# include "statusmon_nodelistnav.h"
#endif
class
CoWow
;
class
Nodelist
{
public:
Nodelist
(
void
*
nodelist_parent_ctx
,
char
*
nodelist_name
,
pwr_tStatus
*
status
);
virtual
~
Nodelist
();
void
*
parent_ctx
;
char
name
[
80
];
NodelistNav
*
nodelistnav
;
int
nodelist_displayed
;
void
(
*
help_cb
)(
void
*
,
char
*
);
void
(
*
close_cb
)(
void
*
);
void
(
*
india_ok_cb
)(
Nodelist
*
,
char
*
);
CoWow
*
wow
;
virtual
void
pop
()
{}
virtual
void
set_clock_cursor
()
{}
virtual
void
reset_cursor
()
{}
virtual
void
free_cursor
()
{}
virtual
void
open_input_dialog
(
char
*
text
,
char
*
title
,
char
*
init_text
,
void
(
*
ok_cb
)(
Nodelist
*
,
char
*
))
{}
void
set_scantime
(
float
scantime
)
{
nodelistnav
->
scantime
=
int
(
scantime
*
1000
);}
void
activate_help
();
void
activate_add_node
();
void
activate_remove_node
();
void
activate_save
();
static
void
find_node_cb
(
void
*
ctx
,
pwr_tOid
oid
);
static
void
add_node_ok
(
Nodelist
*
nodelist
,
char
*
node_name
);
};
#endif
xtt/exe/rt_statusmon/src/statusmon_nodelistnav.cpp
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelistnav.cpp,v 1.1 2007-05-11 15:04:14 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.
*/
/* statusmon_nodelistnav.cpp -- Console message window. */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "co_wow.h"
#include "co_msgwindow.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 "statusmon_nodelistnav.h"
#include "statussrv_utl.h"
#include "xnav_bitmap_leaf12.h"
#include "xnav_bitmap_map12.h"
#include "xnav_bitmap_openmap12.h"
#include "xnav_bitmap_attr12.h"
const
char
NodelistNav
::
config_file
[
40
]
=
"$HOME/rt_statusmon.dat"
;
//
// Free pixmaps
//
void
NodelistNavBrow
::
free_pixmaps
()
{
brow_FreeAnnotPixmap
(
ctx
,
pixmap_leaf
);
brow_FreeAnnotPixmap
(
ctx
,
pixmap_map
);
brow_FreeAnnotPixmap
(
ctx
,
pixmap_openmap
);
brow_FreeAnnotPixmap
(
ctx
,
pixmap_attr
);
}
//
// Create pixmaps for leaf, closed map and open map
//
void
NodelistNavBrow
::
allocate_pixmaps
()
{
flow_sPixmapData
pixmap_data
;
int
i
;
for
(
i
=
0
;
i
<
9
;
i
++
)
{
pixmap_data
[
i
].
width
=
xnav_bitmap_leaf12_width
;
pixmap_data
[
i
].
height
=
xnav_bitmap_leaf12_height
;
pixmap_data
[
i
].
bits
=
(
char
*
)
xnav_bitmap_leaf12_bits
;
}
brow_AllocAnnotPixmap
(
ctx
,
&
pixmap_data
,
&
pixmap_leaf
);
for
(
i
=
0
;
i
<
9
;
i
++
)
{
pixmap_data
[
i
].
width
=
xnav_bitmap_map12_width
;
pixmap_data
[
i
].
height
=
xnav_bitmap_map12_height
;
pixmap_data
[
i
].
bits
=
(
char
*
)
xnav_bitmap_map12_bits
;
}
brow_AllocAnnotPixmap
(
ctx
,
&
pixmap_data
,
&
pixmap_map
);
for
(
i
=
0
;
i
<
9
;
i
++
)
{
pixmap_data
[
i
].
width
=
xnav_bitmap_openmap12_width
;
pixmap_data
[
i
].
height
=
xnav_bitmap_openmap12_height
;
pixmap_data
[
i
].
bits
=
(
char
*
)
xnav_bitmap_openmap12_bits
;
}
brow_AllocAnnotPixmap
(
ctx
,
&
pixmap_data
,
&
pixmap_openmap
);
for
(
i
=
0
;
i
<
9
;
i
++
)
{
pixmap_data
[
i
].
width
=
xnav_bitmap_attr12_width
;
pixmap_data
[
i
].
height
=
xnav_bitmap_attr12_height
;
pixmap_data
[
i
].
bits
=
(
char
*
)
xnav_bitmap_attr12_bits
;
}
brow_AllocAnnotPixmap
(
ctx
,
&
pixmap_data
,
&
pixmap_attr
);
}
//
// Create nodeclasses
//
void
NodelistNavBrow
::
create_nodeclasses
()
{
allocate_pixmaps
();
// Create common-class
// Nodeclass for Undefinied message
brow_CreateNodeClass
(
ctx
,
"Undef"
,
flow_eNodeGroup_Common
,
&
nc_node
);
brow_AddFrame
(
nc_node
,
0
,
0
,
35
,
0.8
,
flow_eDrawType_LineGray
,
-
1
,
1
);
brow_AddAnnotPixmap
(
nc_node
,
0
,
0.2
,
0.1
,
flow_eDrawType_Line
,
2
,
0
);
brow_AddFilledRect
(
nc_node
,
1.3
,
0.15
,
0.4
,
0.4
,
flow_eDrawType_DarkGray
);
brow_AddRect
(
nc_node
,
1.3
,
0.15
,
0.4
,
0.4
,
flow_eDrawType_Line
,
0
,
0
);
brow_AddAnnot
(
nc_node
,
2.2
,
0.6
,
0
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
0
);
brow_AddAnnot
(
nc_node
,
8
,
0.6
,
1
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
0
);
brow_AddAnnot
(
nc_node
,
21
,
0.6
,
2
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
0
);
// Create attribute nodeclass
brow_CreateNodeClass
(
ctx
,
"Attr"
,
flow_eNodeGroup_Common
,
&
nc_attr
);
brow_AddFrame
(
nc_attr
,
0
,
0
,
20
,
0.8
,
flow_eDrawType_LineGray
,
-
1
,
1
);
brow_AddAnnotPixmap
(
nc_attr
,
0
,
0.2
,
0.1
,
flow_eDrawType_Line
,
2
,
0
);
brow_AddAnnot
(
nc_attr
,
2.2
,
0.6
,
0
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
0
);
brow_AddAnnot
(
nc_attr
,
8
,
0.6
,
1
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
1
);
// Create system status attribute nodeclass
brow_CreateNodeClass
(
ctx
,
"SysStsAttr"
,
flow_eNodeGroup_Common
,
&
nc_sys_sts_attr
);
brow_AddFrame
(
nc_sys_sts_attr
,
0
,
0
,
20
,
0.8
,
flow_eDrawType_LineGray
,
-
1
,
1
);
brow_AddAnnotPixmap
(
nc_sys_sts_attr
,
0
,
0.2
,
0.1
,
flow_eDrawType_Line
,
2
,
0
);
brow_AddFilledRect
(
nc_sys_sts_attr
,
1.3
,
0.15
,
0.4
,
0.4
,
flow_eDrawType_DarkGray
);
brow_AddRect
(
nc_sys_sts_attr
,
1.3
,
0.15
,
0.4
,
0.4
,
flow_eDrawType_Line
,
0
,
0
);
brow_AddAnnot
(
nc_sys_sts_attr
,
2.2
,
0.6
,
0
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
0
);
brow_AddAnnot
(
nc_sys_sts_attr
,
8
,
0.6
,
1
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
1
);
// Create system status attribute nodeclass
brow_CreateNodeClass
(
ctx
,
"StsAttr"
,
flow_eNodeGroup_Common
,
&
nc_sts_attr
);
brow_AddFrame
(
nc_sts_attr
,
0
,
0
,
20
,
0.8
,
flow_eDrawType_LineGray
,
-
1
,
1
);
brow_AddAnnotPixmap
(
nc_sts_attr
,
0
,
0.2
,
0.1
,
flow_eDrawType_Line
,
2
,
0
);
brow_AddFilledRect
(
nc_sts_attr
,
1.3
,
0.15
,
0.4
,
0.4
,
flow_eDrawType_DarkGray
);
brow_AddRect
(
nc_sts_attr
,
1.3
,
0.15
,
0.4
,
0.4
,
flow_eDrawType_Line
,
0
,
0
);
brow_AddAnnot
(
nc_sts_attr
,
2.2
,
0.6
,
0
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
0
);
brow_AddAnnot
(
nc_sts_attr
,
5
,
0.6
,
1
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
1
);
brow_AddAnnot
(
nc_sts_attr
,
10
,
0.6
,
2
,
flow_eDrawType_TextHelveticaBold
,
2
,
flow_eAnnotType_OneLine
,
1
);
}
void
NodelistNavBrow
::
brow_setup
()
{
brow_sAttributes
brow_attr
;
unsigned
long
mask
;
mask
=
0
;
mask
|=
brow_eAttr_indentation
;
brow_attr
.
indentation
=
0.5
;
mask
|=
brow_eAttr_annotation_space
;
brow_attr
.
annotation_space
=
0.5
;
brow_SetAttributes
(
ctx
,
&
brow_attr
,
mask
);
brow_SetCtxUserData
(
ctx
,
nodelistnav
);
brow_EnableEvent
(
ctx
,
flow_eEvent_MB1Click
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_MB1DoubleClick
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_MB3Press
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_MB3Down
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_SelectClear
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_ObjectDeleted
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Key_Up
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Key_Down
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Key_PageUp
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Key_PageDown
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_ScrollUp
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_ScrollDown
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Key_Right
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Key_Left
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Key_PF3
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
brow_EnableEvent
(
ctx
,
flow_eEvent_Radiobutton
,
flow_eEventType_CallBack
,
NodelistNav
::
brow_cb
);
}
//
// Backcall routine called at creation of the brow widget
// Enable event, create nodeclasses and insert the root objects.
//
int
NodelistNav
::
init_brow_cb
(
FlowCtx
*
fctx
,
void
*
client_data
)
{
int
sts
;
NodelistNav
*
nodelistnav
=
(
NodelistNav
*
)
client_data
;
BrowCtx
*
ctx
=
(
BrowCtx
*
)
fctx
;
nodelistnav
->
brow
=
new
NodelistNavBrow
(
ctx
,
(
void
*
)
nodelistnav
);
nodelistnav
->
brow
->
brow_setup
();
nodelistnav
->
brow
->
create_nodeclasses
();
nodelistnav
->
read
();
sts
=
brow_TraceInit
(
ctx
,
trace_connect_bc
,
trace_disconnect_bc
,
trace_scan_bc
);
nodelistnav
->
trace_started
=
1
;
nodelistnav
->
trace_start
();
return
1
;
}
NodelistNav
::
NodelistNav
(
void
*
nodelist_parent_ctx
)
:
parent_ctx
(
nodelist_parent_ctx
),
nodelist_size
(
0
),
trace_started
(
0
),
scantime
(
4000
),
first_scan
(
1
)
{
}
//
// Delete ev
//
NodelistNav
::~
NodelistNav
()
{
}
NodelistNavBrow
::~
NodelistNavBrow
()
{
free_pixmaps
();
}
void
NodelistNav
::
read
()
{
char
line
[
400
];
int
sts
;
FILE
*
fp
;
pwr_tFileName
fname
;
ItemNode
*
item
;
brow_tNode
dest
=
0
;
dcli_translate_filename
(
fname
,
config_file
);
fp
=
fopen
(
fname
,
"r"
);
if
(
!
fp
)
return
;
while
(
1
)
{
sts
=
dcli_read_line
(
line
,
sizeof
(
line
),
fp
);
if
(
!
sts
)
break
;
dcli_trim
(
line
,
line
);
if
(
line
[
0
]
==
0
||
line
[
0
]
==
'#'
||
line
[
0
]
==
'!'
)
continue
;
NodelistNode
node
(
line
);
node_list
.
push_back
(
node
);
}
fclose
(
fp
);
brow_SetNodraw
(
brow
->
ctx
);
brow_DeleteAll
(
brow
->
ctx
);
for
(
int
i
=
0
;
i
<
(
int
)
node_list
.
size
();
i
++
)
{
item
=
new
ItemNode
(
this
,
node_list
[
i
].
node_name
,
dest
,
flow_eDest_After
);
dest
=
item
->
node
;
node_list
[
i
].
item
=
item
;
}
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
0
);
}
//
// Zoom
//
void
NodelistNav
::
zoom
(
double
zoom_factor
)
{
brow_Zoom
(
brow
->
ctx
,
zoom_factor
);
}
//
// Return to base zoom factor
//
void
NodelistNav
::
unzoom
()
{
brow_UnZoom
(
brow
->
ctx
);
}
void
NodelistNav
::
set_nodraw
()
{
brow_SetNodraw
(
brow
->
ctx
);
}
void
NodelistNav
::
reset_nodraw
()
{
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
0
);
}
//
// Callbacks from brow
//
int
NodelistNav
::
brow_cb
(
FlowCtx
*
ctx
,
flow_tEvent
event
)
{
NodelistNav
*
nodelistnav
;
ItemNode
*
item
;
if
(
event
->
event
==
flow_eEvent_ObjectDeleted
)
{
brow_GetUserData
(
event
->
object
.
object
,
(
void
**
)
&
item
);
delete
item
;
return
1
;
}
brow_GetCtxUserData
(
(
BrowCtx
*
)
ctx
,
(
void
**
)
&
nodelistnav
);
switch
(
event
->
event
)
{
case
flow_eEvent_Key_Up
:
{
brow_tNode
*
nodelist
;
int
node_count
;
brow_tObject
object
;
int
sts
;
brow_GetSelectedNodes
(
nodelistnav
->
brow
->
ctx
,
&
nodelist
,
&
node_count
);
if
(
!
node_count
)
{
sts
=
brow_GetLastVisible
(
nodelistnav
->
brow
->
ctx
,
&
object
);
if
(
EVEN
(
sts
))
return
1
;
}
else
{
if
(
!
brow_IsVisible
(
nodelistnav
->
brow
->
ctx
,
nodelist
[
0
],
flow_eVisible_Partial
))
{
sts
=
brow_GetLastVisible
(
nodelistnav
->
brow
->
ctx
,
&
object
);
if
(
EVEN
(
sts
))
return
1
;
}
else
{
sts
=
brow_GetPrevious
(
nodelistnav
->
brow
->
ctx
,
nodelist
[
0
],
&
object
);
if
(
EVEN
(
sts
))
{
sts
=
brow_GetLast
(
nodelistnav
->
brow
->
ctx
,
&
object
);
if
(
EVEN
(
sts
))
{
if
(
node_count
)
free
(
nodelist
);
return
1
;
}
}
}
}
brow_SelectClear
(
nodelistnav
->
brow
->
ctx
);
brow_SetInverse
(
object
,
1
);
brow_SelectInsert
(
nodelistnav
->
brow
->
ctx
,
object
);
if
(
!
brow_IsVisible
(
nodelistnav
->
brow
->
ctx
,
object
,
flow_eVisible_Full
))
brow_CenterObject
(
nodelistnav
->
brow
->
ctx
,
object
,
0.25
);
if
(
node_count
)
free
(
nodelist
);
break
;
}
case
flow_eEvent_Key_Down
:
{
brow_tNode
*
nodelist
;
int
node_count
;
brow_tObject
object
;
int
sts
;
brow_GetSelectedNodes
(
nodelistnav
->
brow
->
ctx
,
&
nodelist
,
&
node_count
);
if
(
!
node_count
)
{
sts
=
brow_GetFirstVisible
(
nodelistnav
->
brow
->
ctx
,
&
object
);
if
(
EVEN
(
sts
))
return
1
;
}
else
{
if
(
!
brow_IsVisible
(
nodelistnav
->
brow
->
ctx
,
nodelist
[
0
],
flow_eVisible_Partial
))
{
sts
=
brow_GetFirstVisible
(
nodelistnav
->
brow
->
ctx
,
&
object
);
if
(
EVEN
(
sts
))
return
1
;
}
else
{
sts
=
brow_GetNext
(
nodelistnav
->
brow
->
ctx
,
nodelist
[
0
],
&
object
);
if
(
EVEN
(
sts
))
{
sts
=
brow_GetFirst
(
nodelistnav
->
brow
->
ctx
,
&
object
);
if
(
EVEN
(
sts
))
{
if
(
node_count
)
free
(
nodelist
);
return
1
;
}
}
}
}
brow_SelectClear
(
nodelistnav
->
brow
->
ctx
);
brow_SetInverse
(
object
,
1
);
brow_SelectInsert
(
nodelistnav
->
brow
->
ctx
,
object
);
if
(
!
brow_IsVisible
(
nodelistnav
->
brow
->
ctx
,
object
,
flow_eVisible_Full
))
brow_CenterObject
(
nodelistnav
->
brow
->
ctx
,
object
,
0.75
);
if
(
node_count
)
free
(
nodelist
);
break
;
}
case
flow_eEvent_Key_PageDown
:
{
brow_Page
(
nodelistnav
->
brow
->
ctx
,
0.9
);
break
;
}
case
flow_eEvent_Key_PageUp
:
{
brow_Page
(
nodelistnav
->
brow
->
ctx
,
-
0.9
);
break
;
}
case
flow_eEvent_ScrollDown
:
{
brow_Page
(
nodelistnav
->
brow
->
ctx
,
0.1
);
break
;
}
case
flow_eEvent_ScrollUp
:
{
brow_Page
(
nodelistnav
->
brow
->
ctx
,
-
0.1
);
break
;
}
case
flow_eEvent_SelectClear
:
brow_ResetSelectInverse
(
nodelistnav
->
brow
->
ctx
);
break
;
case
flow_eEvent_MB1Click
:
// Select
switch
(
event
->
object
.
object_type
)
{
case
flow_eObjectType_Node
:
double
ll_x
,
ll_y
,
ur_x
,
ur_y
;
brow_MeasureNode
(
event
->
object
.
object
,
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
if
(
event
->
object
.
x
<
ll_x
+
1.0
)
{
// Simulate doubleclick
flow_tEvent
doubleclick_event
;
int
sts
;
doubleclick_event
=
(
flow_tEvent
)
calloc
(
1
,
sizeof
(
*
doubleclick_event
));
memcpy
(
doubleclick_event
,
event
,
sizeof
(
*
doubleclick_event
));
doubleclick_event
->
event
=
flow_eEvent_MB1DoubleClick
;
sts
=
brow_cb
(
ctx
,
doubleclick_event
);
free
(
(
char
*
)
doubleclick_event
);
return
sts
;
}
if
(
brow_FindSelectedObject
(
nodelistnav
->
brow
->
ctx
,
event
->
object
.
object
))
{
brow_SelectClear
(
nodelistnav
->
brow
->
ctx
);
}
else
{
brow_SelectClear
(
nodelistnav
->
brow
->
ctx
);
brow_SetInverse
(
event
->
object
.
object
,
1
);
brow_SelectInsert
(
nodelistnav
->
brow
->
ctx
,
event
->
object
.
object
);
}
break
;
default:
brow_SelectClear
(
nodelistnav
->
brow
->
ctx
);
}
break
;
case
flow_eEvent_Key_Right
:
{
brow_tNode
*
nodelist
;
int
node_count
;
brow_GetSelectedNodes
(
nodelistnav
->
brow
->
ctx
,
&
nodelist
,
&
node_count
);
if
(
!
node_count
)
return
1
;
brow_GetUserData
(
nodelist
[
0
],
(
void
**
)
&
item
);
item
->
open_children
(
nodelistnav
,
0
,
0
);
nodelistnav
->
force_trace_scan
();
free
(
nodelist
);
break
;
}
case
flow_eEvent_Key_Left
:
{
brow_tNode
*
nodelist
;
int
node_count
;
brow_tObject
object
;
int
sts
;
brow_GetSelectedNodes
(
nodelistnav
->
brow
->
ctx
,
&
nodelist
,
&
node_count
);
if
(
!
node_count
)
return
1
;
if
(
brow_IsOpen
(
nodelist
[
0
]))
// Close this node
object
=
nodelist
[
0
];
else
{
// Close parent
sts
=
brow_GetParent
(
nodelistnav
->
brow
->
ctx
,
nodelist
[
0
],
&
object
);
if
(
EVEN
(
sts
))
{
free
(
nodelist
);
return
1
;
}
}
brow_GetUserData
(
object
,
(
void
**
)
&
item
);
item
->
close
(
nodelistnav
,
0
,
0
);
brow_SelectClear
(
nodelistnav
->
brow
->
ctx
);
brow_SetInverse
(
object
,
1
);
brow_SelectInsert
(
nodelistnav
->
brow
->
ctx
,
object
);
if
(
!
brow_IsVisible
(
nodelistnav
->
brow
->
ctx
,
object
,
flow_eVisible_Full
))
brow_CenterObject
(
nodelistnav
->
brow
->
ctx
,
object
,
0.25
);
free
(
nodelist
);
break
;
}
case
flow_eEvent_MB1DoubleClick
:
{
switch
(
event
->
object
.
object_type
)
{
case
flow_eObjectType_Node
:
brow_GetUserData
(
event
->
object
.
object
,
(
void
**
)
&
item
);
item
->
open_children
(
nodelistnav
,
event
->
object
.
x
,
event
->
object
.
y
);
break
;
default:
;
}
break
;
}
case
flow_eEvent_MB3Down
:
{
brow_SetClickSensitivity
(
nodelistnav
->
brow
->
ctx
,
flow_mSensitivity_MB3Press
);
break
;
}
default:
;
}
return
1
;
}
int
NodelistNav
::
trace_scan_bc
(
brow_tObject
object
,
void
*
p
)
{
ItemBase
*
base_item
;
char
buf
[
200
];
int
len
;
brow_GetUserData
(
object
,
(
void
**
)
&
base_item
);
switch
(
base_item
->
type
)
{
case
nodelistnav_eItemType_Attr
:
{
ItemAttr
*
item
=
(
ItemAttr
*
)
base_item
;
if
(
item
->
size
==
0
)
break
;
if
(
!
item
->
first_scan
)
{
if
(
item
->
size
>
(
int
)
sizeof
(
item
->
old_value
)
&&
item
->
type_id
==
pwr_eType_String
&&
strlen
((
char
*
)
p
)
<
sizeof
(
item
->
old_value
)
&&
strcmp
(
(
char
*
)
p
,
item
->
old_value
)
==
0
)
// No change since last time
return
1
;
else
if
(
memcmp
(
item
->
old_value
,
p
,
item
->
size
)
==
0
)
// No change since last time
return
1
;
}
else
item
->
first_scan
=
0
;
attrvalue_to_string
(
item
->
type_id
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
brow_SetAnnotation
(
object
,
1
,
buf
,
len
);
memcpy
(
item
->
old_value
,
p
,
min
(
item
->
size
,
(
int
)
sizeof
(
item
->
old_value
)));
break
;
}
case
nodelistnav_eItemType_AttrSysSts
:
{
ItemAttrSysSts
*
item
=
(
ItemAttrSysSts
*
)
base_item
;
if
(
item
->
size
==
0
)
break
;
if
(
!
item
->
first_scan
)
{
if
(
item
->
size
>
(
int
)
sizeof
(
item
->
old_value
)
&&
item
->
type_id
==
pwr_eType_String
&&
strlen
((
char
*
)
p
)
<
sizeof
(
item
->
old_value
)
&&
strcmp
(
(
char
*
)
p
,
item
->
old_value
)
==
0
)
// No change since last time
return
1
;
else
if
(
memcmp
(
item
->
old_value
,
p
,
item
->
size
)
==
0
)
// No change since last time
return
1
;
}
else
item
->
first_scan
=
0
;
attrvalue_to_string
(
item
->
type_id
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
brow_SetAnnotation
(
object
,
1
,
buf
,
len
);
memcpy
(
item
->
old_value
,
p
,
min
(
item
->
size
,
(
int
)
sizeof
(
item
->
old_value
)));
flow_eDrawType
color
;
pwr_tStatus
sts
=
*
(
pwr_tStatus
*
)
item
->
status_p
;
if
(
sts
==
0
)
color
=
flow_eDrawType_DarkGray
;
else
{
switch
(
sts
&
7
)
{
case
3
:
case
1
:
color
=
flow_eDrawType_Green
;
break
;
case
0
:
color
=
flow_eDrawType_Yellow
;
break
;
case
2
:
case
4
:
color
=
flow_eDrawType_LineRed
;
break
;
default:
color
=
flow_eDrawType_DarkGray
;
}
}
brow_SetFillColor
(
item
->
node
,
color
);
break
;
}
case
nodelistnav_eItemType_AttrSts
:
{
ItemAttrSts
*
item
=
(
ItemAttrSts
*
)
base_item
;
if
(
!
item
->
first_scan
)
{
if
(
strcmp
(
(
char
*
)
p
,
item
->
old_value
)
==
0
&&
strcmp
(
item
->
name_p
,
item
->
old_name
)
==
0
)
// No change since last time
return
1
;
}
else
item
->
first_scan
=
0
;
attrvalue_to_string
(
item
->
type_id
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
brow_SetAnnotation
(
object
,
1
,
item
->
name_p
,
strlen
(
item
->
name_p
));
brow_SetAnnotation
(
object
,
2
,
item
->
value_p
,
strlen
(
item
->
value_p
));
strcpy
(
item
->
old_value
,
item
->
value_p
);
strcpy
(
item
->
old_name
,
item
->
name_p
);
flow_eDrawType
color
;
pwr_tStatus
sts
=
*
(
pwr_tStatus
*
)
item
->
status_p
;
if
(
sts
==
0
)
color
=
flow_eDrawType_DarkGray
;
else
{
switch
(
sts
&
7
)
{
case
3
:
case
1
:
color
=
flow_eDrawType_Green
;
break
;
case
0
:
color
=
flow_eDrawType_Yellow
;
break
;
case
2
:
case
4
:
color
=
flow_eDrawType_LineRed
;
break
;
default:
color
=
flow_eDrawType_DarkGray
;
}
}
brow_SetFillColor
(
item
->
node
,
color
);
break
;
}
default:
;
}
return
1
;
}
int
NodelistNav
::
trace_connect_bc
(
brow_tObject
object
,
char
*
name
,
char
*
attr
,
flow_eTraceType
type
,
void
**
p
)
{
ItemBase
*
base_item
;
if
(
strcmp
(
name
,
""
)
==
0
)
return
1
;
brow_GetUserData
(
object
,
(
void
**
)
&
base_item
);
switch
(
base_item
->
type
)
{
case
nodelistnav_eItemType_Attr
:
{
ItemAttr
*
item
=
(
ItemAttr
*
)
base_item
;
if
(
item
->
size
==
0
)
break
;
*
p
=
item
->
value_p
;
break
;
}
case
nodelistnav_eItemType_AttrSysSts
:
{
ItemAttrSysSts
*
item
=
(
ItemAttrSysSts
*
)
base_item
;
if
(
item
->
size
==
0
)
break
;
*
p
=
item
->
value_p
;
break
;
}
case
nodelistnav_eItemType_AttrSts
:
{
ItemAttrSts
*
item
=
(
ItemAttrSts
*
)
base_item
;
*
p
=
item
->
value_p
;
break
;
}
default:
;
}
return
1
;
}
int
NodelistNav
::
trace_disconnect_bc
(
brow_tObject
object
)
{
return
1
;
}
void
NodelistNav
::
force_trace_scan
()
{
if
(
trace_started
)
brow_TraceScan
(
brow
->
ctx
);
}
void
NodelistNav
::
message
(
pwr_tStatus
sts
,
char
*
node
,
int
idx
,
char
*
text
)
{
char
severity
;
char
msg
[
200
];
pwr_tOid
oid
=
{
0
,
1
};
switch
(
sts
&
7
)
{
case
3
:
severity
=
'S'
;
case
1
:
severity
=
'I'
;
break
;
case
0
:
severity
=
'W'
;
break
;
case
2
:
severity
=
'E'
;
break
;
case
4
:
severity
=
'F'
;
break
;
default:
severity
=
' '
;
}
strcpy
(
msg
,
node
);
strcat
(
msg
,
" "
);
strncat
(
msg
,
text
,
sizeof
(
msg
)
-
strlen
(
msg
));
oid
.
oix
=
idx
;
MsgWindow
::
message
(
severity
,
msg
,
msgw_ePop_Default
,
oid
);
if
(
EVEN
(
sts
))
beep
();
}
int
NodelistNav
::
select_node
(
int
idx
)
{
if
(
idx
>=
(
int
)
node_list
.
size
())
return
0
;
brow_tObject
object
=
node_list
[
idx
].
item
->
node
;
brow_SelectClear
(
brow
->
ctx
);
brow_SetInverse
(
object
,
1
);
brow_SelectInsert
(
brow
->
ctx
,
object
);
if
(
!
brow_IsVisible
(
brow
->
ctx
,
object
,
flow_eVisible_Full
))
brow_CenterObject
(
brow
->
ctx
,
object
,
0.25
);
return
1
;
}
int
NodelistNav
::
update_nodes
()
{
pwr_tStatus
sts
;
statussrv_sGetStatus
response
;
int
nodraw
=
0
;
for
(
int
i
=
0
;
i
<
(
int
)
node_list
.
size
();
i
++
)
{
sts
=
statussrv_GetStatus
(
node_list
[
i
].
node_name
,
&
response
);
if
(
!
first_scan
&&
ODD
(
sts
)
&&
EVEN
(
node_list
[
i
].
connection_sts
))
message
(
sts
,
node_list
[
i
].
node_name
,
i
,
"Connection up to server"
);
else
if
(
(
!
first_scan
&&
EVEN
(
sts
)
&&
ODD
(
node_list
[
i
].
connection_sts
))
||
first_scan
&&
EVEN
(
sts
))
message
(
sts
,
node_list
[
i
].
node_name
,
i
,
"Connection down to server"
);
node_list
[
i
].
connection_sts
=
sts
;
if
(
ODD
(
sts
))
{
if
(
memcmp
(
&
node_list
[
i
].
item
->
data
.
BootTime
,
&
response
.
BootTime
,
sizeof
(
pwr_tTime
))
&&
node_list
[
i
].
init_done
)
{
// System restarted
message
(
2
,
node_list
[
i
].
node_name
,
i
,
"Proview restarted"
);
}
if
(
memcmp
(
&
node_list
[
i
].
item
->
data
.
RestartTime
,
&
response
.
RestartTime
,
sizeof
(
pwr_tTime
))
&&
node_list
[
i
].
init_done
)
{
// System restarted
message
(
2
,
node_list
[
i
].
node_name
,
i
,
"Proview restarted"
);
}
}
if
(
node_list
[
i
].
item
->
data
.
SystemStatus
!=
response
.
SystemStatus
)
{
// Change color
if
(
!
nodraw
)
{
brow_SetNodraw
(
brow
->
ctx
);
nodraw
=
1
;
}
node_list
[
i
].
item
->
update_color
(
this
,
response
.
SystemStatus
);
// Message if switch to error
if
(
!
first_scan
&&
ODD
(
sts
))
{
message
(
response
.
SystemStatus
,
node_list
[
i
].
node_name
,
i
,
response
.
SystemStatusStr
);
#if 0
switch ( node_list[i].item->data.SystemStatus & 7) {
case 3:
case 1:
case 0: {
switch ( response.SystemStatus & 7) {
case 2:
case 4: {
// From Info or Warning to Error or Fatal
char msg[200];
sprintf( msg, "Error status on %s\n\n%s", node_list[i].node_name,
response.SystemStatusStr);
wow->DisplayError( "System Status", msg);
beep();
break;
}
}
break;
}
}
#endif
}
else
if
(
EVEN
(
response
.
SystemStatus
)
&&
ODD
(
sts
))
// Message even status first scan
message
(
response
.
SystemStatus
,
node_list
[
i
].
node_name
,
i
,
response
.
SystemStatusStr
);
}
if
(
strcmp
(
node_list
[
i
].
item
->
data
.
SystemStatusStr
,
response
.
SystemStatusStr
)
!=
0
)
brow_SetAnnotation
(
node_list
[
i
].
item
->
node
,
2
,
response
.
SystemStatusStr
,
strlen
(
response
.
SystemStatusStr
));
node_list
[
i
].
item
->
data
.
SystemStatus
=
response
.
SystemStatus
;
strncpy
(
node_list
[
i
].
item
->
data
.
SystemStatusStr
,
response
.
SystemStatusStr
,
sizeof
(
node_list
[
i
].
item
->
data
.
SystemStatusStr
));
if
(
ODD
(
sts
))
{
if
(
strcmp
(
node_list
[
i
].
item
->
data
.
Description
,
response
.
Description
)
!=
0
)
brow_SetAnnotation
(
node_list
[
i
].
item
->
node
,
1
,
response
.
Description
,
strlen
(
response
.
Description
));
strncpy
(
node_list
[
i
].
item
->
data
.
Description
,
response
.
Description
,
sizeof
(
node_list
[
i
].
item
->
data
.
Description
));
strncpy
(
node_list
[
i
].
item
->
data
.
Version
,
response
.
Version
,
sizeof
(
node_list
[
i
].
item
->
data
.
Version
));
node_list
[
i
].
item
->
data
.
SystemTime
=
response
.
SystemTime
;
node_list
[
i
].
item
->
data
.
BootTime
=
response
.
BootTime
;
node_list
[
i
].
item
->
data
.
RestartTime
=
response
.
RestartTime
;
node_list
[
i
].
item
->
data
.
Restarts
=
response
.
Restarts
;
if
(
!
node_list
[
i
].
init_done
)
node_list
[
i
].
init_done
=
1
;
if
(
node_list
[
i
].
item
->
syssts_open
)
{
statussrv_GetExtStatus
(
node_list
[
i
].
node_name
,
&
node_list
[
i
].
item
->
xdata
);
}
}
}
if
(
nodraw
)
{
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
0
);
}
first_scan
=
0
;
return
1
;
}
void
NodelistNav
::
save
()
{
pwr_tFileName
fname
;
FILE
*
fp
;
dcli_translate_filename
(
fname
,
config_file
);
fp
=
fopen
(
fname
,
"w"
);
if
(
!
fp
)
return
;
for
(
int
i
=
0
;
i
<
(
int
)
node_list
.
size
();
i
++
)
{
fprintf
(
fp
,
"%s
\n
"
,
node_list
[
i
].
node_name
);
}
fclose
(
fp
);
}
int
NodelistNav
::
get_selected_node
(
char
*
name
)
{
brow_tNode
*
nodelist
;
int
node_count
;
ItemNode
*
item
;
brow_GetSelectedNodes
(
brow
->
ctx
,
&
nodelist
,
&
node_count
);
if
(
node_count
!=
1
)
return
0
;
brow_GetUserData
(
nodelist
[
0
],
(
void
**
)
&
item
);
free
(
nodelist
);
if
(
item
->
type
!=
nodelistnav_eItemType_Node
)
return
0
;
strcpy
(
name
,
item
->
name
);
return
1
;
}
void
NodelistNav
::
remove_node
(
char
*
name
)
{
for
(
int
i
=
0
;
i
<
(
int
)
node_list
.
size
();
i
++
)
{
if
(
cdh_NoCaseStrcmp
(
name
,
node_list
[
i
].
node_name
)
==
0
)
{
brow_DeleteNode
(
brow
->
ctx
,
node_list
[
i
].
item
->
node
);
for
(
int
j
=
i
;
j
<
(
int
)
node_list
.
size
()
-
1
;
j
++
)
node_list
[
j
]
=
node_list
[
j
+
1
];
node_list
.
pop_back
();
break
;
}
}
}
void
NodelistNav
::
add_node
(
char
*
name
)
{
brow_tNode
*
nodelist
;
int
node_count
;
ItemNode
*
item
;
int
idx
=
0
;
bool
found
;
brow_GetSelectedNodes
(
brow
->
ctx
,
&
nodelist
,
&
node_count
);
if
(
node_count
>
0
)
{
// Get index for selected node
found
=
false
;
for
(
int
i
=
0
;
i
<
(
int
)
node_list
.
size
();
i
++
)
{
if
(
node_list
[
i
].
item
->
node
==
nodelist
[
0
])
{
idx
=
i
+
1
;
found
=
true
;
break
;
}
}
if
(
!
found
)
return
;
NodelistNode
node
(
name
);
if
(
idx
==
(
int
)
node_list
.
size
())
node_list
.
push_back
(
node
);
else
{
node_list
.
push_back
(
node_list
[
node_list
.
size
()
-
1
]);
for
(
int
i
=
node_list
.
size
()
-
1
;
i
>
idx
;
i
--
)
{
node_list
[
i
]
=
node_list
[
i
-
1
];
}
node_list
[
idx
]
=
node
;
}
item
=
new
ItemNode
(
this
,
name
,
nodelist
[
0
],
flow_eDest_After
);
node_list
[
idx
].
item
=
item
;
}
else
{
// Nothing selected, insert last
NodelistNode
node
(
name
);
node_list
.
push_back
(
node
);
item
=
new
ItemNode
(
this
,
name
,
0
,
flow_eDest_IntoLast
);
node_list
[
node_list
.
size
()
-
1
].
item
=
item
;
}
}
//
// Convert attribute value to string
//
void
NodelistNav
::
attrvalue_to_string
(
int
type_id
,
void
*
value_ptr
,
char
*
str
,
int
size
,
int
*
len
,
char
*
format
)
{
if
(
value_ptr
==
0
)
{
strcpy
(
str
,
"UNDEFINED"
);
return
;
}
switch
(
type_id
)
{
case
pwr_eType_Boolean
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%d"
,
*
(
pwr_tBoolean
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
pwr_tBoolean
*
)
value_ptr
);
break
;
}
case
pwr_eType_Float32
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%f"
,
*
(
pwr_tFloat32
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
pwr_tFloat32
*
)
value_ptr
);
break
;
}
case
pwr_eType_Int32
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%d"
,
*
(
pwr_tInt32
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
pwr_tInt32
*
)
value_ptr
);
break
;
}
case
pwr_eType_String
:
{
strncpy
(
str
,
(
char
*
)
value_ptr
,
size
);
str
[
size
-
1
]
=
0
;
*
len
=
strlen
(
str
);
break
;
}
case
pwr_eType_Time
:
{
char
timstr
[
40
];
pwr_tStatus
sts
;
sts
=
time_AtoAscii
(
(
pwr_tTime
*
)
value_ptr
,
time_eFormat_DateAndTime
,
timstr
,
sizeof
(
timstr
));
if
(
EVEN
(
sts
))
strcpy
(
timstr
,
"-"
);
*
len
=
sprintf
(
str
,
"%s"
,
timstr
);
break
;
}
default:
;
}
}
ItemNode
::
ItemNode
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
ItemBase
(
item_nodelistnav
,
item_name
),
syssts_open
(
0
)
{
type
=
nodelistnav_eItemType_Node
;
strcpy
(
name
,
item_name
);
memset
(
&
xdata
,
0
,
sizeof
(
xdata
));
brow_CreateNode
(
nodelistnav
->
brow
->
ctx
,
item_name
,
nodelistnav
->
brow
->
nc_node
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotation
(
node
,
0
,
name
,
strlen
(
name
));
brow_SetAnnotation
(
node
,
1
,
data
.
Description
,
strlen
(
data
.
Description
));
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_map
);
}
int
ItemNode
::
update_color
(
NodelistNav
*
nodelistnav
,
pwr_tStatus
system_status
)
{
flow_eDrawType
color
;
if
(
system_status
==
0
)
color
=
flow_eDrawType_DarkGray
;
else
{
switch
(
system_status
&
7
)
{
case
3
:
case
1
:
color
=
flow_eDrawType_Green
;
break
;
case
0
:
color
=
flow_eDrawType_Yellow
;
break
;
case
2
:
case
4
:
color
=
flow_eDrawType_LineRed
;
break
;
default:
color
=
flow_eDrawType_DarkGray
;
}
}
brow_SetFillColor
(
node
,
color
);
return
1
;
}
int
ItemNode
::
open_children
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
))
{
// Close
brow_SetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_CloseNode
(
nodelistnav
->
brow
->
ctx
,
node
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_map
);
brow_ResetOpen
(
node
,
1
);
brow_ResetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_Redraw
(
nodelistnav
->
brow
->
ctx
,
node_y
);
}
else
{
brow_SetNodraw
(
nodelistnav
->
brow
->
ctx
);
new
ItemAttr
(
nodelistnav
,
"Description"
,
"Description"
,
pwr_eType_String
,
sizeof
(
data
.
Description
),
data
.
Description
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSysSts
(
nodelistnav
,
"SystemStatus"
,
"SystemStatus"
,
pwr_eType_String
,
sizeof
(
data
.
SystemStatusStr
),
&
data
.
SystemStatusStr
,
&
data
.
SystemStatus
,
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttr
(
nodelistnav
,
"SystemTime"
,
"SystemTime"
,
pwr_eType_Time
,
sizeof
(
data
.
SystemTime
),
&
data
.
SystemTime
,
node
,
flow_eDest_IntoLast
);
new
ItemAttr
(
nodelistnav
,
"BootTime"
,
"BootTime"
,
pwr_eType_Time
,
sizeof
(
data
.
BootTime
),
&
data
.
BootTime
,
node
,
flow_eDest_IntoLast
);
new
ItemAttr
(
nodelistnav
,
"RestartTime"
,
"RestartTime"
,
pwr_eType_Time
,
sizeof
(
data
.
RestartTime
),
&
data
.
RestartTime
,
node
,
flow_eDest_IntoLast
);
new
ItemAttr
(
nodelistnav
,
"Restarts"
,
"Restarts"
,
pwr_eType_Int32
,
sizeof
(
data
.
Restarts
),
&
data
.
Restarts
,
node
,
flow_eDest_IntoLast
);
new
ItemAttr
(
nodelistnav
,
"Version"
,
"Version"
,
pwr_eType_String
,
sizeof
(
data
.
Version
),
&
data
.
Version
,
node
,
flow_eDest_IntoLast
);
brow_SetOpen
(
node
,
1
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_Redraw
(
nodelistnav
->
brow
->
ctx
,
node_y
);
}
return
1
;
}
int
ItemNode
::
close
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
))
{
// Close
brow_SetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_CloseNode
(
nodelistnav
->
brow
->
ctx
,
node
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_map
);
brow_ResetOpen
(
node
,
1
);
brow_ResetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_Redraw
(
nodelistnav
->
brow
->
ctx
,
node_y
);
}
return
1
;
}
ItemAttr
::
ItemAttr
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
char
*
attr
,
int
attr_type
,
int
attr_size
,
void
*
attr_value_p
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
ItemBase
(
item_nodelistnav
,
item_name
),
value_p
(
attr_value_p
),
first_scan
(
1
),
type_id
(
attr_type
),
size
(
attr_size
)
{
type
=
nodelistnav_eItemType_Attr
;
strcpy
(
name
,
item_name
);
memset
(
old_value
,
0
,
sizeof
(
old_value
));
brow_CreateNode
(
nodelistnav
->
brow
->
ctx
,
item_name
,
nodelistnav
->
brow
->
nc_attr
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_attr
);
brow_SetAnnotation
(
node
,
0
,
item_name
,
strlen
(
item_name
));
brow_SetTraceAttr
(
node
,
attr
,
""
,
flow_eTraceType_User
);
}
ItemAttrSysSts
::
ItemAttrSysSts
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
char
*
attr
,
int
attr_type
,
int
attr_size
,
void
*
attr_value_p
,
void
*
attr_status_p
,
ItemNode
*
attr_parent
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
ItemBase
(
item_nodelistnav
,
item_name
),
value_p
(
attr_value_p
),
status_p
(
attr_status_p
),
first_scan
(
1
),
type_id
(
attr_type
),
size
(
attr_size
),
parent
(
attr_parent
)
{
type
=
nodelistnav_eItemType_AttrSysSts
;
strcpy
(
name
,
item_name
);
memset
(
old_value
,
0
,
sizeof
(
old_value
));
brow_CreateNode
(
nodelistnav
->
brow
->
ctx
,
item_name
,
nodelistnav
->
brow
->
nc_sys_sts_attr
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_map
);
brow_SetAnnotation
(
node
,
0
,
item_name
,
strlen
(
item_name
));
brow_SetTraceAttr
(
node
,
attr
,
""
,
flow_eTraceType_User
);
}
int
ItemAttrSysSts
::
open_children
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
))
{
// Close
brow_SetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_CloseNode
(
nodelistnav
->
brow
->
ctx
,
node
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_map
);
brow_ResetOpen
(
node
,
1
);
brow_ResetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_Redraw
(
nodelistnav
->
brow
->
ctx
,
node_y
);
parent
->
syssts_open
=
0
;
memset
(
&
parent
->
xdata
,
0
,
sizeof
(
parent
->
xdata
));
}
else
{
parent
->
syssts_open
=
1
;
brow_SetNodraw
(
nodelistnav
->
brow
->
ctx
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S1"
,
parent
->
xdata
.
ServerStsStr
[
0
],
&
parent
->
xdata
.
ServerSts
[
0
],
parent
->
xdata
.
ServerStsName
[
0
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S2"
,
parent
->
xdata
.
ServerStsStr
[
1
],
&
parent
->
xdata
.
ServerSts
[
1
],
parent
->
xdata
.
ServerStsName
[
1
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S3"
,
parent
->
xdata
.
ServerStsStr
[
2
],
&
parent
->
xdata
.
ServerSts
[
2
],
parent
->
xdata
.
ServerStsName
[
2
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S4"
,
parent
->
xdata
.
ServerStsStr
[
3
],
&
parent
->
xdata
.
ServerSts
[
3
],
parent
->
xdata
.
ServerStsName
[
3
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S5"
,
parent
->
xdata
.
ServerStsStr
[
4
],
&
parent
->
xdata
.
ServerSts
[
4
],
parent
->
xdata
.
ServerStsName
[
4
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S6"
,
parent
->
xdata
.
ServerStsStr
[
5
],
&
parent
->
xdata
.
ServerSts
[
5
],
parent
->
xdata
.
ServerStsName
[
5
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S7"
,
parent
->
xdata
.
ServerStsStr
[
6
],
&
parent
->
xdata
.
ServerSts
[
6
],
parent
->
xdata
.
ServerStsName
[
6
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S8"
,
parent
->
xdata
.
ServerStsStr
[
7
],
&
parent
->
xdata
.
ServerSts
[
7
],
parent
->
xdata
.
ServerStsName
[
7
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S9"
,
parent
->
xdata
.
ServerStsStr
[
8
],
&
parent
->
xdata
.
ServerSts
[
8
],
parent
->
xdata
.
ServerStsName
[
8
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S10"
,
parent
->
xdata
.
ServerStsStr
[
9
],
&
parent
->
xdata
.
ServerSts
[
9
],
parent
->
xdata
.
ServerStsName
[
9
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S11"
,
parent
->
xdata
.
ServerStsStr
[
10
],
&
parent
->
xdata
.
ServerSts
[
10
],
parent
->
xdata
.
ServerStsName
[
10
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S12"
,
parent
->
xdata
.
ServerStsStr
[
11
],
&
parent
->
xdata
.
ServerSts
[
11
],
parent
->
xdata
.
ServerStsName
[
11
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S13"
,
parent
->
xdata
.
ServerStsStr
[
12
],
&
parent
->
xdata
.
ServerSts
[
12
],
parent
->
xdata
.
ServerStsName
[
12
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S14"
,
parent
->
xdata
.
ServerStsStr
[
13
],
&
parent
->
xdata
.
ServerSts
[
13
],
parent
->
xdata
.
ServerStsName
[
13
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S15"
,
parent
->
xdata
.
ServerStsStr
[
14
],
&
parent
->
xdata
.
ServerSts
[
14
],
parent
->
xdata
.
ServerStsName
[
14
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S16"
,
parent
->
xdata
.
ServerStsStr
[
15
],
&
parent
->
xdata
.
ServerSts
[
15
],
parent
->
xdata
.
ServerStsName
[
15
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S17"
,
parent
->
xdata
.
ServerStsStr
[
16
],
&
parent
->
xdata
.
ServerSts
[
16
],
parent
->
xdata
.
ServerStsName
[
16
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S18"
,
parent
->
xdata
.
ServerStsStr
[
17
],
&
parent
->
xdata
.
ServerSts
[
17
],
parent
->
xdata
.
ServerStsName
[
17
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S19"
,
parent
->
xdata
.
ServerStsStr
[
18
],
&
parent
->
xdata
.
ServerSts
[
18
],
parent
->
xdata
.
ServerStsName
[
18
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Sys"
,
"S20"
,
parent
->
xdata
.
ServerStsStr
[
19
],
&
parent
->
xdata
.
ServerSts
[
19
],
parent
->
xdata
.
ServerStsName
[
19
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A1"
,
parent
->
xdata
.
ApplStsStr
[
0
],
&
parent
->
xdata
.
ApplSts
[
0
],
parent
->
xdata
.
ApplStsName
[
0
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A2"
,
parent
->
xdata
.
ApplStsStr
[
1
],
&
parent
->
xdata
.
ApplSts
[
1
],
parent
->
xdata
.
ApplStsName
[
1
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A3"
,
parent
->
xdata
.
ApplStsStr
[
2
],
&
parent
->
xdata
.
ApplSts
[
2
],
parent
->
xdata
.
ApplStsName
[
2
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A4"
,
parent
->
xdata
.
ApplStsStr
[
3
],
&
parent
->
xdata
.
ApplSts
[
3
],
parent
->
xdata
.
ApplStsName
[
3
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A5"
,
parent
->
xdata
.
ApplStsStr
[
4
],
&
parent
->
xdata
.
ApplSts
[
4
],
parent
->
xdata
.
ApplStsName
[
4
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A6"
,
parent
->
xdata
.
ApplStsStr
[
5
],
&
parent
->
xdata
.
ApplSts
[
5
],
parent
->
xdata
.
ApplStsName
[
5
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A7"
,
parent
->
xdata
.
ApplStsStr
[
6
],
&
parent
->
xdata
.
ApplSts
[
6
],
parent
->
xdata
.
ApplStsName
[
6
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A8"
,
parent
->
xdata
.
ApplStsStr
[
7
],
&
parent
->
xdata
.
ApplSts
[
7
],
parent
->
xdata
.
ApplStsName
[
7
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A9"
,
parent
->
xdata
.
ApplStsStr
[
8
],
&
parent
->
xdata
.
ApplSts
[
8
],
parent
->
xdata
.
ApplStsName
[
8
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A10"
,
parent
->
xdata
.
ApplStsStr
[
9
],
&
parent
->
xdata
.
ApplSts
[
9
],
parent
->
xdata
.
ApplStsName
[
9
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A11"
,
parent
->
xdata
.
ApplStsStr
[
10
],
&
parent
->
xdata
.
ApplSts
[
10
],
parent
->
xdata
.
ApplStsName
[
10
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A12"
,
parent
->
xdata
.
ApplStsStr
[
11
],
&
parent
->
xdata
.
ApplSts
[
11
],
parent
->
xdata
.
ApplStsName
[
11
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A13"
,
parent
->
xdata
.
ApplStsStr
[
12
],
&
parent
->
xdata
.
ApplSts
[
12
],
parent
->
xdata
.
ApplStsName
[
12
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A14"
,
parent
->
xdata
.
ApplStsStr
[
13
],
&
parent
->
xdata
.
ApplSts
[
13
],
parent
->
xdata
.
ApplStsName
[
13
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A15"
,
parent
->
xdata
.
ApplStsStr
[
14
],
&
parent
->
xdata
.
ApplSts
[
14
],
parent
->
xdata
.
ApplStsName
[
14
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"A16"
,
"A16"
,
parent
->
xdata
.
ApplStsStr
[
15
],
&
parent
->
xdata
.
ApplSts
[
15
],
parent
->
xdata
.
ApplStsName
[
15
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A17"
,
parent
->
xdata
.
ApplStsStr
[
16
],
&
parent
->
xdata
.
ApplSts
[
16
],
parent
->
xdata
.
ApplStsName
[
16
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A18"
,
parent
->
xdata
.
ApplStsStr
[
17
],
&
parent
->
xdata
.
ApplSts
[
17
],
parent
->
xdata
.
ApplStsName
[
17
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A19"
,
parent
->
xdata
.
ApplStsStr
[
18
],
&
parent
->
xdata
.
ApplSts
[
18
],
parent
->
xdata
.
ApplStsName
[
18
],
this
,
node
,
flow_eDest_IntoLast
);
new
ItemAttrSts
(
nodelistnav
,
"Appl"
,
"A20"
,
parent
->
xdata
.
ApplStsStr
[
19
],
&
parent
->
xdata
.
ApplSts
[
19
],
parent
->
xdata
.
ApplStsName
[
19
],
this
,
node
,
flow_eDest_IntoLast
);
brow_SetOpen
(
node
,
1
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_Redraw
(
nodelistnav
->
brow
->
ctx
,
node_y
);
statussrv_GetExtStatus
(
parent
->
name
,
&
parent
->
xdata
);
nodelistnav
->
force_trace_scan
();
}
return
1
;
}
int
ItemAttrSysSts
::
close
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
))
{
// Close
brow_SetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_CloseNode
(
nodelistnav
->
brow
->
ctx
,
node
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_map
);
brow_ResetOpen
(
node
,
1
);
brow_ResetNodraw
(
nodelistnav
->
brow
->
ctx
);
brow_Redraw
(
nodelistnav
->
brow
->
ctx
,
node_y
);
parent
->
syssts_open
=
0
;
memset
(
&
parent
->
xdata
,
0
,
sizeof
(
parent
->
xdata
));
}
return
1
;
}
ItemAttrSts
::
ItemAttrSts
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
char
*
attr
,
char
*
attr_value_p
,
pwr_tStatus
*
attr_status_p
,
char
*
attr_name_p
,
ItemAttrSysSts
*
attr_parent
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
ItemBase
(
item_nodelistnav
,
item_name
),
value_p
(
attr_value_p
),
status_p
(
attr_status_p
),
name_p
(
attr_name_p
),
first_scan
(
1
),
parent
(
attr_parent
)
{
type
=
nodelistnav_eItemType_AttrSts
;
strcpy
(
name
,
item_name
);
memset
(
old_value
,
0
,
sizeof
(
old_value
));
memset
(
old_name
,
0
,
sizeof
(
old_name
));
brow_CreateNode
(
nodelistnav
->
brow
->
ctx
,
item_name
,
nodelistnav
->
brow
->
nc_sts_attr
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotPixmap
(
node
,
0
,
nodelistnav
->
brow
->
pixmap_attr
);
brow_SetAnnotation
(
node
,
0
,
item_name
,
strlen
(
item_name
));
brow_SetTraceAttr
(
node
,
attr
,
""
,
flow_eTraceType_User
);
}
xtt/exe/rt_statusmon/src/statusmon_nodelistnav.h
0 → 100644
View file @
0448a367
/*
* Proview $Id: statusmon_nodelistnav.h,v 1.1 2007-05-11 15:04:14 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 statusmon_nodelistnav_h
#define statusmon_nodelistnav_h
/* statusmon_nodelistnav.h -- Console message window. */
// Status is defined as int i xlib...
#include <vector>
#include "statussrv_utl.h"
using
namespace
std
;
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef rt_errh_h
# include "rt_errh.h"
#endif
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browctx.h"
#endif
#ifndef flow_browapi_h
#include "flow_browapi.h"
#endif
typedef
enum
{
nodelistnav_eItemType_Node
,
nodelistnav_eItemType_Attr
,
nodelistnav_eItemType_AttrSts
,
nodelistnav_eItemType_AttrSysSts
}
nodelistnav_eItemType
;
class
NodelistNavBrow
{
public:
NodelistNavBrow
(
BrowCtx
*
brow_ctx
,
void
*
evl
)
:
ctx
(
brow_ctx
),
nodelistnav
(
evl
)
{};
~
NodelistNavBrow
();
BrowCtx
*
ctx
;
void
*
nodelistnav
;
brow_tNodeClass
nc_event
;
brow_tNodeClass
nc_node
;
brow_tNodeClass
nc_attr
;
brow_tNodeClass
nc_sys_sts_attr
;
brow_tNodeClass
nc_sts_attr
;
flow_sAnnotPixmap
*
pixmap_leaf
;
flow_sAnnotPixmap
*
pixmap_map
;
flow_sAnnotPixmap
*
pixmap_openmap
;
flow_sAnnotPixmap
*
pixmap_attr
;
void
free_pixmaps
();
void
allocate_pixmaps
();
void
create_nodeclasses
();
void
brow_setup
();
};
class
NodeData
{
public:
NodeData
()
:
SystemStatus
(
0
),
SystemTime
(
pwr_cNTime
),
BootTime
(
pwr_cNTime
),
RestartTime
(
pwr_cNTime
),
Restarts
(
0
)
{
strcpy
(
Description
,
""
);
strcpy
(
SystemStatusStr
,
""
);
}
pwr_tStatus
SystemStatus
;
char
SystemStatusStr
[
120
];
pwr_tString80
Description
;
pwr_tTime
SystemTime
;
pwr_tTime
BootTime
;
pwr_tTime
RestartTime
;
int
Restarts
;
char
Version
[
20
];
};
class
ItemNode
;
class
CoWow
;
class
NodelistNode
{
public:
NodelistNode
(
char
*
name
)
:
item
(
0
),
connection_sts
(
0
),
init_done
(
0
)
{
strncpy
(
node_name
,
name
,
sizeof
(
node_name
));
}
char
node_name
[
80
];
ItemNode
*
item
;
pwr_tStatus
connection_sts
;
int
init_done
;
};
class
NodelistNav
{
public:
NodelistNav
(
void
*
ev_parent_ctx
);
virtual
~
NodelistNav
();
void
*
parent_ctx
;
NodelistNavBrow
*
brow
;
int
nodelist_size
;
int
max_size
;
vector
<
NodelistNode
>
node_list
;
int
trace_started
;
int
scantime
;
int
first_scan
;
CoWow
*
wow
;
static
const
char
config_file
[
40
];
virtual
void
set_input_focus
()
{}
virtual
void
trace_start
()
{}
virtual
void
beep
()
{}
void
zoom
(
double
zoom_factor
);
void
unzoom
();
void
set_nodraw
();
void
reset_nodraw
();
void
read
();
void
draw
();
int
update_nodes
();
void
force_trace_scan
();
void
message
(
pwr_tStatus
sts
,
char
*
node
,
int
idx
,
char
*
text
);
int
select_node
(
int
idx
);
void
remove_node
(
char
*
name
);
int
get_selected_node
(
char
*
name
);
void
save
();
void
add_node
(
char
*
name
);
static
void
attrvalue_to_string
(
int
type_id
,
void
*
value_ptr
,
char
*
str
,
int
size
,
int
*
len
,
char
*
format
);
static
int
init_brow_cb
(
FlowCtx
*
fctx
,
void
*
client_data
);
static
int
brow_cb
(
FlowCtx
*
ctx
,
flow_tEvent
event
);
static
int
trace_scan_bc
(
brow_tObject
object
,
void
*
p
);
static
int
trace_connect_bc
(
brow_tObject
object
,
char
*
name
,
char
*
attr
,
flow_eTraceType
type
,
void
**
p
);
static
int
trace_disconnect_bc
(
brow_tObject
object
);
};
class
ItemBase
{
public:
ItemBase
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
)
:
nodelistnav
(
item_nodelistnav
)
{
strcpy
(
name
,
item_name
);
}
virtual
~
ItemBase
()
{}
nodelistnav_eItemType
type
;
NodelistNav
*
nodelistnav
;
brow_tNode
node
;
char
name
[
120
];
virtual
int
open_children
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
)
{
return
1
;}
virtual
int
close
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
)
{
return
1
;}
};
class
ItemNode
:
public
ItemBase
{
public:
ItemNode
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
brow_tNode
dest
,
flow_eDest
dest_code
);
NodeData
data
;
statussrv_sGetExtStatus
xdata
;
int
syssts_open
;
int
open_children
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
);
int
close
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
);
int
update_color
(
NodelistNav
*
nodelistnav
,
pwr_tStatus
sts
);
};
//! Item for a normal attribute.
class
ItemAttr
:
public
ItemBase
{
public:
ItemAttr
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
char
*
attr
,
int
attr_type
,
int
attr_size
,
void
*
attr_value_p
,
brow_tNode
dest
,
flow_eDest
dest_code
);
void
*
value_p
;
char
old_value
[
120
];
int
first_scan
;
int
type_id
;
int
size
;
};
//! Item for a system status attribute.
class
ItemAttrSysSts
:
public
ItemBase
{
public:
ItemAttrSysSts
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
char
*
attr
,
int
attr_type
,
int
attr_size
,
void
*
attr_value_p
,
void
*
attr_status_p
,
ItemNode
*
attr_parent
,
brow_tNode
dest
,
flow_eDest
dest_code
);
void
*
value_p
;
void
*
status_p
;
char
old_value
[
120
];
int
first_scan
;
int
type_id
;
int
size
;
ItemNode
*
parent
;
virtual
int
open_children
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
);
virtual
int
close
(
NodelistNav
*
nodelistnav
,
double
x
,
double
y
);
};
//! Item for a server status attribute.
class
ItemAttrSts
:
public
ItemBase
{
public:
ItemAttrSts
(
NodelistNav
*
item_nodelistnav
,
char
*
item_name
,
char
*
attr
,
char
*
attr_value_p
,
pwr_tStatus
*
attr_status_p
,
char
*
attr_name_p
,
ItemAttrSysSts
*
attr_parent
,
brow_tNode
dest
,
flow_eDest
dest_code
);
char
*
value_p
;
pwr_tStatus
*
status_p
;
char
*
name_p
;
char
old_value
[
120
];
char
old_name
[
120
];
int
first_scan
;
int
type_id
;
int
size
;
ItemAttrSysSts
*
parent
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment