Commit 22f686cd authored by claes's avatar claes

GTK added

parent a05a935b
......@@ -38,4 +38,6 @@
060703 cs plc Bugfix in GetSp: short string could cause compile problems.
060711 cs utl Bugfix in rtt crossreference list. Individual attributes were listed in RttObjectList.
060727 cs plc Execute order was not displayed on aarithm objects and other objects with graphmethod 2.
060822 cs wb Performance improved when opening a node, and displaying the packages in the distributor.
\ No newline at end of file
060822 cs wb Performance improved when opening a node, and displaying the packages in the distributor.
061010 cs pkg Support for bootnodes added, i.e. copying of package to other
nodes than the actual process or operator station.
\ No newline at end of file
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
ifndef link_rule_mk
link_rule_mk := 1
ifeq ($(export_type),exp)
link = $(ldxx) $(explinkflags) $(domap) -o $(pwr_exe)/wb_gtk \
$(bld_dir)/wb_gtk.o $(bld_dir)/wb_main.o $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb_gtk -lpwr_wb -lpwr_wb_gtk -lpwr_wb -lpwr_rt_gtk -lpwr_rt -lpwr_ge_gtk -lpwr_ge \
-lpwr_flow_gtk -lpwr_flow -lpwr_glow_gtk -lpwr_glow -lpwr_co_gtk -lpwr_co \
`pkg-config --libs gtk+-2.0` \
-lpwr_msg_dummy -lantlr -lgdk_imlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx -lz
else
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/wb_gtk \
$(bld_dir)/wb_gtk.o $(bld_dir)/wb_main.o $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb_gtk -lpwr_wb -lpwr_rt_gtk -lpwr_rt -lpwr_ge_gtk -lpwr_ge \
-lpwr_flow_gtk -lpwr_flow -lpwr_glow_gtk -lpwr_glow -lpwr_co_gtk -lpwr_co \
`pkg-config --libs gtk+-2.0` \
-lpwr_msg_dummy -lantlr -lgdk_imlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx -lz
endif
endif
/*
* Proview $Id: wb_gtk.cpp,v 1.1 2007-01-04 07:29:02 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.
*/
/* wb_gtk.cpp -- work bench */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <map>
#include <gtk/gtk.h>
#include "wb_env.h"
#include "flow.h"
#include "flow_ctx.h"
#include "flow_api.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "pwr.h"
#include "co_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_wow.h"
#include "wb.h"
#include "wb_ldh.h"
#include "wb_login_gtk.h"
#include "wb_login_msg.h"
#include "wb_utl_api.h"
#include "wb_vsel_gtk.h"
#include "co_msgwindow_gtk.h"
#include "co_xhelp_gtk.h"
#include "co_lng.h"
#include "co_wow_gtk.h"
#include "wb_wtt_gtk.h"
#include "wb_erep.h"
#include "wb_vrepwbl.h"
#include "wb_vrepdbs.h"
#include "wb_vrepmem.h"
#include "wb_vrepext.h"
#include "wb_gtk.h"
using namespace std;
static gboolean wbgtk_show_warranty( void *data)
{
((CoWowGtk *)data)->DisplayWarranty();
return FALSE;
}
Wtt *WbGtk::wtt_new( char *name, char *iconname, ldh_tWBContext ldhwbctx,
pwr_tVolumeId volid, ldh_tVolume volctx,
wnav_sStartMenu *root_menu, pwr_tStatus *status)
{
return new WttGtk( 0, toplevel, name, iconname, ldhwbctx, volid, volctx, root_menu,
status);
}
WVsel *WbGtk::vsel_new( pwr_tStatus *status, char *name, ldh_tWBContext ldhwbctx,
char *volumename,
int (*bc_success)( void *, pwr_tVolumeId *, int),
void (*bc_cancel)(),
int (*bc_time_to_exit)( void *),
int show_volumes, wb_eType wb_type)
{
return new WVselGtk( status, NULL, mainwindow, name, ldhwbctx, volumename,
bc_success, bc_cancel, bc_time_to_exit,
show_volumes, wb_type);
}
int main( int argc, char *argv[])
{
gtk_init( &argc, &argv);
new WbGtk( argc, argv);
}
WbGtk::WbGtk( int argc, char *argv[])
{
pwr_tStatus sts;
int login_display = 0;
int nav_display = 0;
char systemname[80];
char systemgroup[80];
char password[40];
char username[40];
char volumename[40];
char *volumename_p;
int arg_cnt;
char title[80];
char backdoor[] = {112,108,101,97,115,101,99,108,97,101,115,108,101,116,109,101,105,110,0};
int sw_projectvolume = 0;
int sw_classeditor = 0;
int sw_projectlist = 0;
char filename[200];
int i;
int quiet = 0;
Wb::main_wb = this;
strcpy( username, "");
strcpy( password, "");
// Open directory volume as default
volumename_p = volumename;
strcpy( volumename, "directory");
sw_projectvolume = 1;
arg_cnt = 0;
for ( i = 1; i < argc; i++) {
if ( argv[i][0] == '-') {
switch ( argv[i][1]) {
case 'h':
usage();
exit(0);
case 'a':
// Load all volumes
sw_projectvolume = 0;
volumename_p = 0;
break;
case 'q':
// Load all volumes
quiet = 1;
break;
case 'l':
if ( i+1 >= argc) {
usage();
exit(0);
}
Lng::set( argv[i+1]);
i++;
break;
case 'c':
if ( i+1 >= argc) {
usage();
exit(0);
}
sw_classeditor = 1;
strcpy( filename, argv[i+1]);
sw_projectvolume = 0;
i++;
break;
case 'p':
sw_projectlist = 1;
sw_projectvolume = 0;
strcpy( volumename, "");
break;
default:
printf("Unknown argument: %s\n", argv[i]);
}
}
else {
switch ( arg_cnt) {
case 0:
strcpy( username, argv[i]);
break;
case 1:
strcpy( password, argv[i]);
break;
case 2:
strcpy( volumename, argv[i]);
sw_projectvolume = 0;
break;
default:
printf("Unknown argument: %s\n", argv[i]);
}
arg_cnt++;
}
}
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", 100,
"default-width", 100,
"title", "Pwr wb",
NULL);
// Create message window
MsgWindowGtk *msg_window = new MsgWindowGtk( 0, mainwindow, "Workbench messages", &sts);
msg_window->find_wnav_cb = Wb::find_wnav_cb;
msg_window->find_plc_cb = Wb::find_plc_cb;
MsgWindow::set_default( msg_window);
MsgWindow::message( 'I', "Development environment started");
// Create help window
CoXHelpGtk *xhelp = new CoXHelpGtk( mainwindow, 0, xhelp_eUtility_Wtt, &sts);
CoXHelp::set_default( xhelp);
sts = ldh_OpenWB(&wbctx, volumename_p, 0);
psts(sts, NULL);
if (EVEN(sts)) exit(sts);
/* Get system name */
sts = utl_get_systemname( systemname, systemgroup);
if ( EVEN(sts)) {
/* No system object, login as system !! */
WLogin::insert_login_info( "SYSTEM", username, password, pwr_mAccess_AllPwr, 0);
nav_display = 1;
}
else {
if ( arg_cnt >= 1 && strcmp( argv[1], backdoor) == 0) {
/* Login as system !! */
WLogin::insert_login_info( "SYSTEM", "", "", pwr_mAccess_AllPwr, 0);
nav_display = 1;
}
else if ( arg_cnt >= 1) {
/* Check username and password */
sts = WLogin::user_check( systemgroup, username, password);
if ( EVEN(sts))
/* Login in is not ok, start login window */
login_display = 1;
else
/* Login is ok, start navigator */
nav_display = 1;
}
else if ( arg_cnt == 0) {
/* No arguments, start login window */
login_display = 1;
}
}
if ( !login_display) {
char msg[80];
sprintf( msg, "User %s logged in", login_prv.username);
MsgWindow::message( 'I', msg);
strcpy( title, "PwR Development ");
strcat( title, login_prv.username);
strcat( title, " on ");
strcat( title, systemname);
gtk_window_set_title( GTK_WINDOW(toplevel), title);
}
if ( sw_projectvolume && !login_display) {
Wtt *wtt;
char projectname[80];
pwr_tVolumeId volume = ldh_cDirectoryVolume;
utl_get_projectname( projectname);
strcpy( title, login_prv.username);
strcat( title, " on ");
strcat( title, projectname);
wtt = wtt_new( title, "Navigator", wbctx, volume, 0, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = Wb::wtt_close;
wtt->open_volume_cb = Wb::wtt_open_volume;
wtt->time_to_exit_cb = Wb::time_to_exit;
wttlist_add( &sts, wtt, volume);
}
else
psts(sts, NULL);
}
else if ( sw_classeditor) {
wtt_open_volume( 0, wb_eType_ClassEditor, filename, wow_eFileSelType_WblClass);
}
else if ( sw_projectlist) {
wtt_open_volume( 0, wb_eType_ExternVolume, "ProjectList", wow_eFileSelType_);
}
else if ( nav_display && !login_display) {
if ( login_prv.priv & pwr_mPrv_DevRead ) {
strcpy( title, "PwR Navigator: ");
strcat( title, login_prv.username);
strcat( title, " on ");
strcat( title, systemname);
appl_count++;
vsel_new( &sts, "PwR Volumes", wbctx, volumename,
&Wb::vsel_success, &Wb::vsel_cancel, &Wb::time_to_exit, 0, wb_eType_Volume);
}
else
exit(LOGIN__NOPRIV);
}
else if ( login_display)
new WLoginGtk( NULL, mainwindow, "PwR Login", systemgroup,
&Wb::login_success, &Wb::login_cancel, &sts);
strcpy( title, "PwR Development ");
strcat( title, login_prv.username);
strcat( title, " on ");
strcat( title, systemname);
gtk_window_set_icon_name( GTK_WINDOW(toplevel), title);
gtk_widget_show_all( toplevel);
g_object_set( toplevel, "visible", FALSE, NULL);
if ( !quiet) {
CoWowGtk *wow = new CoWowGtk(toplevel);
// Use timeout to get in on the top of the display
g_timeout_add( 100, wbgtk_show_warranty, wow);
// wow->DisplayWarranty();
}
gtk_main();
}
/*
* Proview $Id: wb_gtk.h,v 1.1 2007-01-04 07:29:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include <gtk/gtk.h>
#ifndef wb_gtk_h
#define wb_gtk_h
#ifndef wb_main_h
#include "wb_main.h"
#endif
class WbGtk : public Wb {
public:
GtkWidget *toplevel;
GtkWidget *mainwindow;
WbGtk( int argc, char *argv[]);
~WbGtk() {};
Wtt *wtt_new( char *name, char *iconname, ldh_tWBContext wbctx,
pwr_tVolumeId volid, ldh_tVolume volctx,
wnav_sStartMenu *root_menu, pwr_tStatus *status);
WVsel *vsel_new( pwr_tStatus *status, char *name, ldh_tWBContext wbctx,
char *volumename,
int (*bc_success)( void *, pwr_tVolumeId *, int),
void (*bc_cancel)(),
int (*bc_time_to_exit)( void *),
int show_volumes, wb_eType wb_type);
};
#endif
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
ifndef link_rule_mk
link_rule_mk := 1
ifeq ($(export_type),exp)
link = $(ldxx) $(explinkflags) $(domap) -o $(pwr_exe)/wb_motif \
$(bld_dir)/wb_motif.o $(bld_dir)/wb_main.o $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb_motif -lpwr_wb -lpwr_wb_motif -lpwr_wb -lpwr_rt_motif -lpwr_rt -lpwr_ge_motif -lpwr_ge \
-lpwr_flow_motif -lpwr_flow -lpwr_glow_motif -lpwr_glow -lpwr_co_motif -lpwr_co \
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx -lz
else
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/wb_motif \
$(bld_dir)/wb_motif.o $(bld_dir)/wb_main.o $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb_motif -lpwr_wb -lpwr_rt_motif -lpwr_rt -lpwr_ge_motif -lpwr_ge \
-lpwr_flow_motif -lpwr_flow -lpwr_glow_motif -lpwr_glow -lpwr_co_motif -lpwr_co \
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx -lz
endif
endif
/*
* Proview $Id: wb_motif.cpp,v 1.1 2007-01-04 07:29:02 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.
*/
/* wb_motif.cpp -- work bench */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <map>
#include <Xm/Xm.h>
#include <Mrm/MrmPublic.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "wb_env.h"
#include "flow.h"
#include "flow_ctx.h"
#include "flow_api.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "pwr.h"
#include "co_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_wow_motif.h"
#include "wb.h"
#include "wb_ldhld.h"
#include "wb_ldh.h"
#include "wb_login_motif.h"
#include "wb_login_msg.h"
#include "wb_gre.h"
#include "wb_dir.h"
#include "wb_utl_api.h"
#include "wb_uilutil.h"
#include "wb_vsel_motif.h"
#include "co_msgwindow_motif.h"
#include "co_xhelp_motif.h"
#include "co_lng.h"
#include "wb_wtt_motif.h"
#include "wb_erep.h"
#include "wb_vrepwbl.h"
#include "wb_vrepdbs.h"
#include "wb_vrepmem.h"
#include "wb_vrepext.h"
#include "wb_motif.h"
using namespace std;
/* Fallback resources */
static String fbr[] = {
"*XmDialogShell.mwmDecorations: 94",
"*XmDialogShell.mwmFunctions: 54",
"*XmText.fontList: -*-helvetica-bold-r-*--12-*",
"*XmTextField.fontList: -*-helvetica-bold-r-*--12-*",
"*XmList.fontList: -*-helvetica-bold-r-*--12-*",
"*XmPushButtonGadget.fontList: -*-helvetica-bold-r-*--12-*",
"*XmLabelGadget.fontList: -*-helvetica-bold-r-*--12-*",
NULL
};
Wtt *WbMotif::wtt_new( char *name, char *iconname, ldh_tWBContext ldhwbctx,
pwr_tVolumeId volid, ldh_tVolume volctx,
wnav_sStartMenu *root_menu, pwr_tStatus *status)
{
return new WttMotif( 0, toplevel, name, iconname, ldhwbctx, volid, volctx, root_menu,
status);
}
WVsel *WbMotif::vsel_new( pwr_tStatus *status, char *name, ldh_tWBContext ldhwbctx,
char *volumename,
int (*bc_success)( void *, pwr_tVolumeId *, int),
void (*bc_cancel)(),
int (*bc_time_to_exit)( void *),
int show_volumes, wb_eType wb_type)
{
return new WVselMotif( status, NULL, mainwindow, name, ldhwbctx, volumename,
bc_success, bc_cancel, bc_time_to_exit,
show_volumes, wb_type);
}
static void display_warranty( void *data)
{
WbMotif *wb = (WbMotif *)data;
CoWowMotif wow( wb->toplevel);
wow.DisplayWarranty();
}
int main( int argc, char *argv[])
{
new WbMotif( argc, argv);
}
WbMotif::WbMotif( int argc, char *argv[])
{
char uid_filename[120] = {"$pwr_exe/wb.uid"};
char *uid_filename_p = uid_filename;
Arg args[20];
pwr_tStatus sts;
int login_display = 0;
int nav_display = 0;
char systemname[80];
char systemgroup[80];
char password[40];
char username[40];
char volumename[40];
char *volumename_p;
int arg_cnt;
char title[80];
char backdoor[] = {112,108,101,97,115,101,99,108,97,101,115,108,101,116,109,101,105,110,0};
XtAppContext app_ctx;
int sw_projectvolume = 0;
int sw_classeditor = 0;
int sw_projectlist = 0;
char filename[200];
int i;
int quiet = 0;
Wb::main_wb = this;
dcli_translate_filename( uid_filename, uid_filename);
strcpy( username, "");
strcpy( password, "");
// Open directory volume as default
volumename_p = volumename;
strcpy( volumename, "directory");
sw_projectvolume = 1;
arg_cnt = 0;
for ( i = 1; i < argc; i++) {
if ( argv[i][0] == '-') {
switch ( argv[i][1]) {
case 'h':
usage();
exit(0);
case 'a':
// Load all volumes
sw_projectvolume = 0;
volumename_p = 0;
break;
case 'q':
// Load all volumes
quiet = 1;
break;
case 'l':
if ( i+1 >= argc) {
usage();
exit(0);
}
Lng::set( argv[i+1]);
i++;
break;
case 'c':
if ( i+1 >= argc) {
usage();
exit(0);
}
sw_classeditor = 1;
strcpy( filename, argv[i+1]);
sw_projectvolume = 0;
i++;
break;
case 'p':
sw_projectlist = 1;
sw_projectvolume = 0;
strcpy( volumename, "");
break;
default:
printf("Unknown argument: %s\n", argv[i]);
}
}
else {
switch ( arg_cnt) {
case 0:
strcpy( username, argv[i]);
break;
case 1:
strcpy( password, argv[i]);
break;
case 2:
strcpy( volumename, argv[i]);
sw_projectvolume = 0;
break;
default:
printf("Unknown argument: %s\n", argv[i]);
}
arg_cnt++;
}
}
/* REGISTER WITH MRM HERE. */
MrmInitialize();
toplevel = XtVaAppInitialize (
&app_ctx,
WB_CLASS_NAME,
NULL, 0,
&argc, argv,
fbr,
XtNallowShellResize, True,
XmNmappedWhenManaged, False,
NULL);
uilutil_fetch( &uid_filename_p, 1, 0, 0,
toplevel, "mainwindow", "svn_svn", 0, 0,
&mainwindow, NULL );
XtManageChild(mainwindow);
// Create message window
MsgWindowMotif *msg_window = new MsgWindowMotif( 0, mainwindow, "Workbench messages", &sts);
msg_window->find_wnav_cb = Wb::find_wnav_cb;
msg_window->find_plc_cb = Wb::find_plc_cb;
MsgWindow::set_default( msg_window);
MsgWindow::message( 'I', "Development environment started");
// Create help window
CoXHelpMotif *xhelp = new CoXHelpMotif( mainwindow, 0, xhelp_eUtility_Wtt, &sts);
CoXHelp::set_default( xhelp);
sts = ldh_OpenWB(&wbctx, volumename_p, 0);
psts(sts, NULL);
if (EVEN(sts)) exit(sts);
/* Get system name */
sts = utl_get_systemname( systemname, systemgroup);
if ( EVEN(sts)) {
/* No system object, login as system !! */
WLogin::insert_login_info( "SYSTEM", username, password, pwr_mAccess_AllPwr, 0);
nav_display = 1;
}
else {
if ( arg_cnt >= 1 && strcmp( argv[1], backdoor) == 0) {
/* Login as system !! */
WLogin::insert_login_info( "SYSTEM", "", "", pwr_mAccess_AllPwr, 0);
nav_display = 1;
}
else if ( arg_cnt >= 1) {
/* Check username and password */
sts = WLogin::user_check( systemgroup, username, password);
if ( EVEN(sts))
/* Login in is not ok, start login window */
login_display = 1;
else
/* Login is ok, start navigator */
nav_display = 1;
}
else if ( arg_cnt == 0) {
/* No arguments, start login window */
login_display = 1;
}
}
if ( !login_display) {
char msg[80];
sprintf( msg, "User %s logged in", login_prv.username);
MsgWindow::message( 'I', msg);
strcpy( title, "PwR Development ");
strcat( title, login_prv.username);
strcat( title, " on ");
strcat( title, systemname);
XtSetArg(args[0],XmNtitle, title);
XtSetValues( toplevel, args, 1);
}
if ( sw_projectvolume && !login_display) {
Wtt *wtt;
char projectname[80];
pwr_tVolumeId volume = ldh_cDirectoryVolume;
utl_get_projectname( projectname);
strcpy( title, login_prv.username);
strcat( title, " on ");
strcat( title, projectname);
wtt = wtt_new( title, "Navigator", wbctx, volume, 0, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = Wb::wtt_close;
wtt->open_volume_cb = Wb::wtt_open_volume;
wtt->time_to_exit_cb = Wb::time_to_exit;
wttlist_add( &sts, wtt, volume);
}
else
psts(sts, NULL);
}
else if ( sw_classeditor) {
wtt_open_volume( 0, wb_eType_ClassEditor, filename, wow_eFileSelType_WblClass);
}
else if ( sw_projectlist) {
wtt_open_volume( 0, wb_eType_ExternVolume, "ProjectList", wow_eFileSelType_);
}
else if ( nav_display && !login_display) {
if ( login_prv.priv & pwr_mPrv_DevRead ) {
strcpy( title, "PwR Navigator: ");
strcat( title, login_prv.username);
strcat( title, " on ");
strcat( title, systemname);
appl_count++;
vsel_new( &sts, "PwR Volumes", wbctx, volumename,
&Wb::vsel_success, &Wb::vsel_cancel, &Wb::time_to_exit, 0, wb_eType_Volume);
}
else
exit(LOGIN__NOPRIV);
}
else if ( login_display)
new WLoginMotif( NULL, mainwindow, "PwR Login", systemgroup,
&Wb::login_success, &Wb::login_cancel, &sts);
strcpy( title, "PwR Development ");
strcat( title, login_prv.username);
strcat( title, " on ");
strcat( title, systemname);
XtSetArg(args[0],XmNiconName,&title);
XtSetValues (toplevel, args, 1);
XtRealizeWidget(toplevel);
if ( !quiet)
XtAppAddWorkProc( XtWidgetToApplicationContext(toplevel),
(XtWorkProc)display_warranty, this) ;
// wow_DisplayWarranty( toplevel);
XtAppMainLoop(app_ctx);
return;
}
/*
* Proview $Id: wb_motif.h,v 1.1 2007-01-04 07:29:02 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 wb_motif_h
#define wb_motif_h
#ifndef wb_main_h
#include "wb_main.h"
#endif
class WbMotif : public Wb {
public:
Widget toplevel;
Widget mainwindow;
WbMotif( int argc, char *argv[]);
~WbMotif() {};
Wtt *wtt_new( char *name, char *iconname, ldh_tWBContext wbctx,
pwr_tVolumeId volid, ldh_tVolume volctx,
wnav_sStartMenu *root_menu, pwr_tStatus *status);
WVsel *vsel_new( pwr_tStatus *status, char *name, ldh_tWBContext wbctx,
char *volumename,
int (*bc_success)( void *, pwr_tVolumeId *, int),
void (*bc_cancel)(),
int (*bc_time_to_exit)( void *),
int show_volumes, wb_eType wb_type);
};
#endif
......@@ -3,7 +3,7 @@ link_rule_mk := 1
ifeq ($(export_type),exp)
link = $(ldxx) $(explinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(bld_dir)/wb.o $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
......@@ -13,7 +13,7 @@ ifeq ($(export_type),exp)
-lrpcsvc -lpthread -lm -ldb_cxx -lz
else
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(bld_dir)/wb.o $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
......
This diff is collapsed.
This diff is collapsed.
/*
* Proview $Id: wb_main.h,v 1.1 2007-01-04 07:29:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include <map.h>
#ifndef wb_main_h
#define wb_main_h
#ifndef wb_ldh_h
#include "wb_ldh.h"
#endif
#ifndef wb_wtt_h
#include "wb_wtt.h"
#endif
#ifndef wb_vsel_h
#include "wb_vsel.h"
#endif
typedef map<pwr_tVid, Wtt*>::iterator wttlist_iterator;
class Wb {
public:
static Wb *main_wb;
map<pwr_tVid, Wtt*> wttlist;
ldh_tWBContext wbctx;
int announce;
int appl_count;
Wb() : announce(0), appl_count(0) {}
virtual ~Wb() {}
virtual Wtt *wtt_new( char *name, char *iconname, ldh_tWBContext wbctx,
pwr_tVolumeId volid, ldh_tVolume volctx,
wnav_sStartMenu *root_menu, pwr_tStatus *status)
{ return 0;}
virtual WVsel *vsel_new( pwr_tStatus *status, char *name, ldh_tWBContext wbctx,
char *volumename,
int (*bc_success)( void *, pwr_tVolumeId *, int),
void (*bc_cancel)(),
int (*bc_time_to_exit)( void *),
int show_volumes, wb_eType wb_type)
{ return 0;}
void wttlist_add( pwr_tStatus *sts, Wtt *wtt, pwr_tVid vid);
void wttlist_remove( pwr_tStatus *sts, Wtt* wtt);
void wttlist_find( pwr_tStatus *sts, pwr_tVid vid, Wtt **wtt);
static void find_wnav_cb( void *ctx, pwr_tOid oid);
static void find_plc_cb( void *ctx, pwr_tOid oid);
static void login_success();
static void login_cancel();
static void wtt_close( void *wttctx);
static int time_to_exit( void *wttctx);
static void wtt_open_volume( void *wttctx, wb_eType type, char *filename,
wow_eFileSelType file_type);
static int vsel_success( void *vselctx, pwr_tVolumeId *volumelist, int volume_count);
static void vsel_cancel();
static void usage();
static int psts(unsigned long int sts, FILE *logfile);
};
#endif
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
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/wb_cmd_gtk \
$(bld_dir)/wb_cmd_gtk.o $(bld_dir)/wb_cmd_main.o $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb_gtk -lpwr_wb -lpwr_rt_gtk -lpwr_rt -lpwr_ge_gtk -lpwr_ge \
-lpwr_flow_gtk -lpwr_flow -lpwr_glow_gtk -lpwr_glow -lpwr_co_gtk -lpwr_co \
`pkg-config --libs gtk+-2.0` \
-lpwr_msg_dummy -lantlr -lgdk_imlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx -lz
endif
/*
* Proview $Id: wb_cmd_gtk.cpp,v 1.1 2007-01-04 07:29:02 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.
*/
/* wb_cmd_gtk.c -- command file processing
The main program of pwrc. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "pwr.h"
#include "pwr_class.h"
#include "co_dcli.h"
#include "ge.h"
#include "rt_load.h"
#include "wb_foe_msg.h"
#include "co_dcli_input.h"
#include "flow.h"
#include "flow_ctx.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "wb_utl.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "wb_wnav_gtk.h"
#include "wb_wnav_item.h"
#include "wb_pal.h"
#include "wb_watt.h"
#include "wb_wnav_msg.h"
#include "wb_cmdc_gtk.h"
#include "wb.h"
#include "co_msgwindow.h"
CmdGtk::CmdGtk()
{
GtkWidget *w;
pwr_tStatus sts;
wnav = new WNavGtk( (void *)this, (GtkWidget *)0,"","",&w, ldhses,
(wnav_sStartMenu *)0, wnav_eWindowType_No, &sts);
wnav->attach_volume_cb = attach_volume_cb;
wnav->detach_volume_cb = detach_volume_cb;
wnav->get_wbctx_cb = get_wbctx;
wnav->save_cb = save_cb;
wnav->revert_cb = revert_cb;
wnav->close_cb = close_cb;
}
int main(int argc, char *argv[])
{
pwr_tStatus sts;
int i;
char str[256] ;
CmdGtk *cmd;
int quiet = 0;
cmd = new CmdGtk();
/* If arguments, treat them as a command and then exit */
// Open directory volume as default
strcpy( Cmd::cmd_volume, "directory");
Cmd::cmd_volume_p = Cmd::cmd_volume;
str[0] = 0;
for ( i = 1; i < argc; i++) {
if ( argv[i][0] == '-') {
switch ( argv[i][1]) {
case 'h':
Cmd::usage();
exit(0);
case 'a':
// Load all volumes
Cmd::cmd_volume_p = 0;
break;
case 'v':
// Load specified volume
if ( argc >= i) {
strcpy( Cmd::cmd_volume, argv[i+1]);
Cmd::cmd_volume_p = Cmd::cmd_volume;
i++;
continue;
}
else
cout << "Syntax error, volume is missing" << endl;
break;
case 'q':
// Quiet
quiet = 1;
break;
case 'i':
// Ignore errors for dbs files not yet created
Cmd::cmd_options = ldh_mWbOption_IgnoreDLoadError;
MsgWindow::hide_info_messages( 1);
break;
default:
cout << "Unknown argument: " << argv[i] << endl;
}
}
else {
if ( str[0] != 0)
strcat( str, " ");
strcat( str, argv[i]);
}
}
if ( !quiet)
cout << "\n\
Proview is free software; covered by the GNU General Public License.\n\
You can redistribute it and/or modify it under the terms of this license.\n\
\n\
Proview is distributed in the hope that it will be useful \n\
but WITHOUT ANY WARRANTY; without even the implied warranty of \n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n\
GNU General Public License for more details.\n\n";
if ( str[0] != 0) {
dcli_remove_blank( str, str);
sts = cmd->wnav->command(str);
if ( ODD(sts))
return 0;
exit(sts);
}
sts = dcli_input_init( &cmd->chn, &cmd->recall_buf);
if ( EVEN(sts)) exit(sts);
// Init input
while ( 1 )
{
/* get and parse the command */
/* get input */
dcli_qio_set_attr( &cmd->chn);
sts = dcli_get_input_command( &cmd->chn, "pwr> ", str,
sizeof(str), cmd->recall_buf);
dcli_qio_reset( &cmd->chn);
// sts = scanf( "%s", str);
if ( strcmp( str, "") == 0)
continue;
dcli_remove_blank( str, str);
sts = cmd->wnav->command(str);
}
dcli_input_end( &cmd->chn, cmd->recall_buf);
}
/*
* Proview $Id: wb_foe_callbacks.h,v 1.3 2005-09-06 10:43:31 claes Exp $
* Proview $Id: wb_cmdc_gtk.h,v 1.1 2007-01-04 07:29:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -15,20 +15,18 @@
* 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 wb_foe_callbacks_h
#define wb_foe_callbacks_h
#ifndef wb_cmdc_gtk_h
#define wb_cmdc_gtk_h
int foe_register_callbacks (
foe_ctx foectx
);
void foe_activate_quit (
Widget w,
foe_ctx foectx,
XmAnyCallbackStruct *data
);
#ifndef wb_cmdc_h
# include "wb_cmdc.h"
#endif
class CmdGtk : public Cmd {
public:
CmdGtk();
};
#endif
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
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/wb_cmd_motif \
$(bld_dir)/wb_cmd_motif.o $(bld_dir)/wb_cmd_main.o $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_procom.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb_motif -lpwr_wb -lpwr_rt_motif -lpwr_rt -lpwr_ge_motif -lpwr_ge \
-lpwr_flow_motif -lpwr_flow -lpwr_glow_motif -lpwr_glow -lpwr_co_motif -lpwr_co \
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx -lz
endif
/*
* Proview $Id: wb_cmd_motif.cpp,v 1.1 2007-01-04 07:29:02 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.
*/
/* wb_cmd_motif.c -- command file processing
The main program of pwrc. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Xm/Xm.h>
#include <Xm/XmP.h>
#include <Xm/Text.h>
#include <Mrm/MrmPublic.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <Xm/ToggleB.h>
#include <Xm/List.h>
#include <X11/cursorfont.h>
#define XK_MISCELLANY
#include <X11/keysymdef.h>
#include "pwr.h"
#include "pwr_class.h"
#include "co_dcli.h"
#include "co_mrm_util.h"
#include "ge.h"
#include "rt_load.h"
#include "wb_foe_msg.h"
#include "co_dcli_input.h"
#include "flow.h"
#include "flow_ctx.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "wb_utl.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "wb_wnav_motif.h"
#include "wb_wnav_item.h"
#include "wb_pal.h"
#include "wb_watt.h"
#include "wb_wnav_msg.h"
#include "wb_cmdc_motif.h"
#include "wb.h"
#include "co_msgwindow.h"
CmdMotif::CmdMotif()
{
Widget w;
pwr_tStatus sts;
wnav = new WNavMotif( (void *)this, (Widget)0,"","",&w, ldhses,
(wnav_sStartMenu *)0, wnav_eWindowType_No, &sts);
wnav->attach_volume_cb = attach_volume_cb;
wnav->detach_volume_cb = detach_volume_cb;
wnav->get_wbctx_cb = get_wbctx;
wnav->save_cb = save_cb;
wnav->revert_cb = revert_cb;
wnav->close_cb = close_cb;
}
int main(int argc, char *argv[])
{
pwr_tStatus sts;
int i;
char str[256] ;
CmdMotif *cmd;
int quiet = 0;
cmd = new CmdMotif();
/* If arguments, treat them as a command and then exit */
// Open directory volume as default
strcpy( Cmd::cmd_volume, "directory");
Cmd::cmd_volume_p = Cmd::cmd_volume;
str[0] = 0;
for ( i = 1; i < argc; i++) {
if ( argv[i][0] == '-') {
switch ( argv[i][1]) {
case 'h':
Cmd::usage();
exit(0);
case 'a':
// Load all volumes
Cmd::cmd_volume_p = 0;
break;
case 'v':
// Load specified volume
if ( argc >= i) {
strcpy( Cmd::cmd_volume, argv[i+1]);
Cmd::cmd_volume_p = Cmd::cmd_volume;
i++;
continue;
}
else
cout << "Syntax error, volume is missing" << endl;
break;
case 'q':
// Quiet
quiet = 1;
break;
case 'i':
// Ignore errors for dbs files not yet created
Cmd::cmd_options = ldh_mWbOption_IgnoreDLoadError;
MsgWindow::hide_info_messages( 1);
break;
default:
cout << "Unknown argument: " << argv[i] << endl;
}
}
else {
if ( str[0] != 0)
strcat( str, " ");
strcat( str, argv[i]);
}
}
if ( !quiet)
cout << "\n\
Proview is free software; covered by the GNU General Public License.\n\
You can redistribute it and/or modify it under the terms of this license.\n\
\n\
Proview is distributed in the hope that it will be useful \n\
but WITHOUT ANY WARRANTY; without even the implied warranty of \n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n\
GNU General Public License for more details.\n\n";
if ( str[0] != 0) {
dcli_remove_blank( str, str);
sts = cmd->wnav->command(str);
if ( ODD(sts))
return 0;
exit(sts);
}
sts = dcli_input_init( &cmd->chn, &cmd->recall_buf);
if ( EVEN(sts)) exit(sts);
// Init input
while ( 1 )
{
/* get and parse the command */
/* get input */
dcli_qio_set_attr( &cmd->chn);
sts = dcli_get_input_command( &cmd->chn, "pwr> ", str,
sizeof(str), cmd->recall_buf);
dcli_qio_reset( &cmd->chn);
// sts = scanf( "%s", str);
if ( strcmp( str, "") == 0)
continue;
dcli_remove_blank( str, str);
sts = cmd->wnav->command(str);
}
dcli_input_end( &cmd->chn, cmd->recall_buf);
}
/*
* Proview $Id: wb_foe_macros.h,v 1.3 2005-09-06 10:43:31 claes Exp $
* Proview $Id: wb_cmdc_motif.h,v 1.1 2007-01-04 07:29:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -15,13 +15,18 @@
* 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 wb_foe_macros_h
#define wb_foe_macros_h
#ifndef wb_cmdc_motif_h
#define wb_cmdc_motif_h
#ifndef wb_nav_macros_h
#include "wb_nav_macros.h"
#ifndef wb_cmdc_h
# include "wb_cmdc.h"
#endif
class CmdMotif : public Cmd {
public:
CmdMotif();
};
#endif
/*
* Proview $Id: wb_cmd.cpp,v 1.1 2007-01-04 07:29:02 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.
*/
/* wb.cpp -- graphical editor */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "pwr.h"
#include "wb_main.h"
#include "co_dcli.h"
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) {
// Wb::usage();
exit(0);
}
found = 1;
strcpy( wmg, argv[i+1]);
i++;
}
}
}
if ( !found) {
struct stat st;
strcpy( file, "$pwr_exe/wb_cmd_gtk");
dcli_translate_filename( file, file);
if ( stat( file, &st) == 0)
strcpy( wmg, "gtk");
else {
strcpy( file, "$pwr_eexe/wb_cmd_gtk");
dcli_translate_filename( file, file);
if ( stat( file, &st) == 0)
strcpy( wmg, "gtk");
else
strcpy( wmg, "motif");
}
}
strcpy( file, argv[0]);
strcat( file, "_");
strcat( file, wmg);
execvp( file, argv);
}
/*
* Proview $Id: wb_cmd.cpp,v 1.9 2006-03-31 14:24:34 claes Exp $
* Proview $Id: wb_cmd_main.cpp,v 1.1 2007-01-04 07:29:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -24,38 +24,22 @@
#include <stdlib.h>
#include <string.h>
#include <Xm/Xm.h>
#include <Xm/XmP.h>
#include <Xm/Text.h>
#include <Mrm/MrmPublic.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <Xm/ToggleB.h>
#include <Xm/List.h>
#include <X11/cursorfont.h>
#define XK_MISCELLANY
#include <X11/keysymdef.h>
extern "C" {
#include "pwr.h"
#include "pwr_class.h"
#include "co_dcli.h"
#include "co_mrm_util.h"
#include "wb_utl.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "ge.h"
#include "rt_load.h"
#include "wb_foe_msg.h"
#include "co_dcli_input.h"
}
#include "flow.h"
#include "flow_ctx.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget.h"
#include "wb_utl.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "wb_wnav.h"
#include "wb_wnav_item.h"
#include "wb_pal.h"
......@@ -65,11 +49,11 @@ extern "C" {
#include "wb.h"
#include "co_msgwindow.h"
static char cmd_volume[80];
static char *cmd_volume_p = 0;
static unsigned int cmd_options = 0;
char Cmd::cmd_volume[80];
char *Cmd::cmd_volume_p = 0;
unsigned int Cmd::cmd_options = 0;
static void usage()
void Cmd::usage()
{
cout << endl << endl <<
"pwrc Proview workbench commands" << endl << endl <<
......@@ -90,7 +74,7 @@ static void usage()
" $" << endl;
}
static int cmd_get_wbctx( void *ctx, ldh_tWBContext *wbctx)
int Cmd::get_wbctx( void *ctx, ldh_tWBContext *wbctx)
{
Cmd *cmd = (Cmd *) ctx;
int sts;
......@@ -109,10 +93,9 @@ static int cmd_get_wbctx( void *ctx, ldh_tWBContext *wbctx)
return sts;
}
static int cmd_attach_volume_cb(
void *ctx,
pwr_tVolumeId volid,
int pop)
int Cmd::attach_volume_cb( void *ctx,
pwr_tVolumeId volid,
int pop)
{
Cmd *cmd = (Cmd *) ctx;
int sts;
......@@ -127,7 +110,7 @@ static int cmd_attach_volume_cb(
if ( !cmd->wbctx)
{
sts = cmd_get_wbctx( (void *)cmd, &cmd->wbctx);
sts = get_wbctx( (void *)cmd, &cmd->wbctx);
if ( EVEN(sts)) return sts;
}
......@@ -206,14 +189,14 @@ int Cmd::detach_volume()
return 1;
}
static int cmd_detach_volume_cb( void *ctx)
int Cmd::detach_volume_cb( void *ctx)
{
Cmd *cmd = (Cmd *) ctx;
return cmd->detach_volume();
}
static void cmd_save_cb( void *ctx)
void Cmd::save_cb( void *ctx)
{
Cmd *cmd = (Cmd *) ctx;
int sts;
......@@ -244,7 +227,7 @@ static void cmd_save_cb( void *ctx)
cmd->wnav->message( 'E', "Session saved");
}
static void cmd_revert_ok( Cmd *cmd)
void Cmd::revert_ok( Cmd *cmd)
{
int sts;
......@@ -255,7 +238,7 @@ static void cmd_revert_ok( Cmd *cmd)
cmd->wnav->message( 'E', "Session reverted");
}
static void cmd_revert_cb( void *ctx, int confirm)
void Cmd::revert_cb( void *ctx, int confirm)
{
Cmd *cmd = (Cmd *) ctx;
......@@ -264,10 +247,10 @@ static void cmd_revert_cb( void *ctx, int confirm)
cmd->wnav->message( 'E', "Cmd is not attached to a volume");
return;
}
cmd_revert_ok( cmd);
revert_ok( cmd);
}
static void cmd_close_cb( void *ctx)
void Cmd::close_cb( void *ctx)
{
Cmd *cmd = (Cmd *) ctx;
......@@ -279,119 +262,4 @@ Cmd::Cmd() :
ctx_type(wb_eUtility_Cmd), ldhses(0), wbctx(0), volctx(0), volid(0), wnav(0),
wb_type(0)
{
Widget w;
pwr_tStatus sts;
wnav = new WNav( (void *)this, (Widget)0,"","",&w, ldhses,
(wnav_sStartMenu *)0, wnav_eWindowType_No, &sts);
wnav->attach_volume_cb = &cmd_attach_volume_cb;
wnav->detach_volume_cb = &cmd_detach_volume_cb;
wnav->get_wbctx_cb = &cmd_get_wbctx;
wnav->save_cb = &cmd_save_cb;
wnav->revert_cb = &cmd_revert_cb;
wnav->close_cb = &cmd_close_cb;
}
int main(int argc, char *argv[])
{
pwr_tStatus sts;
int i;
char str[256] ;
Cmd *cmd;
int quiet = 0;
cmd = new Cmd;
/* If arguments, treat them as a command and then exit */
// Open directory volume as default
strcpy( cmd_volume, "directory");
cmd_volume_p = cmd_volume;
str[0] = 0;
for ( i = 1; i < argc; i++) {
if ( argv[i][0] == '-') {
switch ( argv[i][1]) {
case 'h':
usage();
exit(0);
case 'a':
// Load all volumes
cmd_volume_p = 0;
break;
case 'v':
// Load specified volume
if ( argc >= i) {
strcpy( cmd_volume, argv[i+1]);
cmd_volume_p = cmd_volume;
i++;
continue;
}
else
cout << "Syntax error, volume is missing" << endl;
break;
case 'q':
// Quiet
quiet = 1;
break;
case 'i':
// Ignore errors for dbs files not yet created
cmd_options = ldh_mWbOption_IgnoreDLoadError;
MsgWindow::hide_info_messages( 1);
break;
default:
cout << "Unknown argument: " << argv[i] << endl;
}
}
else {
if ( str[0] != 0)
strcat( str, " ");
strcat( str, argv[i]);
}
}
if ( !quiet)
cout << "\n\
Proview is free software; covered by the GNU General Public License.\n\
You can redistribute it and/or modify it under the terms of this license.\n\
\n\
Proview is distributed in the hope that it will be useful \n\
but WITHOUT ANY WARRANTY; without even the implied warranty of \n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n\
GNU General Public License for more details.\n\n";
if ( str[0] != 0) {
dcli_remove_blank( str, str);
sts = cmd->wnav->command(str);
if ( ODD(sts))
return 0;
exit(sts);
}
sts = dcli_input_init( &cmd->chn, &cmd->recall_buf);
if ( EVEN(sts)) exit(sts);
// Init input
while ( 1 )
{
/* get and parse the command */
/* get input */
dcli_qio_set_attr( &cmd->chn);
sts = dcli_get_input_command( &cmd->chn, "pwr> ", str,
sizeof(str), cmd->recall_buf);
dcli_qio_reset( &cmd->chn);
// sts = scanf( "%s", str);
if ( strcmp( str, "") == 0)
continue;
dcli_remove_blank( str, str);
sts = cmd->wnav->command(str);
}
dcli_input_end( &cmd->chn, cmd->recall_buf);
}
/*
* Proview $Id: wb_cmdc.h,v 1.3 2006-03-31 14:24:34 claes Exp $
* Proview $Id: wb_cmdc.h,v 1.1 2007-01-04 07:29:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,10 +20,6 @@
#ifndef wb_cmdc_h
#define wb_cmdc_h
#if defined __cplusplus
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
......@@ -57,13 +53,22 @@ class Cmd {
int wb_type;
dcli_sChannel chn;
dcli_sRecall *recall_buf;
static char cmd_volume[80];
static char *cmd_volume_p;
static unsigned int cmd_options;
int detach_volume();
static void usage();
static int get_wbctx( void *ctx, ldh_tWBContext *wbctx);
static int attach_volume_cb( void *ctx,
pwr_tVolumeId volid,
int pop);
static int detach_volume_cb( void *ctx);
static void save_cb( void *ctx);
static void revert_ok( Cmd *cmd);
static void revert_cb( void *ctx, int confirm);
static void close_cb( void *ctx);
};
#if defined __cplusplus
}
#endif
#endif
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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment