Commit fc402b1e authored by claes's avatar claes

New program to view helptexts

parent b62a35e4
/*
* Proview $Id: co_help_gtk.cpp,v 1.1 2008-10-28 09:36:12 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.
*/
/* co_help_gtk.cpp -- Help window */
#include "flow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "co_dcli.h"
#include "co_lng.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "co_help_gtk.h"
#include "co_xhelp_gtk.h"
void CoHelpGtk::close_cb( void *ctx, void *xhelp)
{
delete (CoXHelpGtk *)xhelp;
exit(0);
}
void CoHelpGtk::cohelp_mainloop()
{
gtk_main();
}
int main( int argc, char *argv[])
{
int sts;
gtk_init( &argc, &argv);
setlocale( LC_TIME, "en_US");
new CoHelpGtk( argc, argv, &sts);
exit(sts);
}
CoHelpGtk::~CoHelpGtk()
{
}
CoHelpGtk::CoHelpGtk( int argc, char *argv[], int *return_sts) :
CoHelpMain( argc, argv, return_sts)
{
pwr_tStatus sts;
#if 0
const int window_width = 400;
const int window_height = 700;
char title[120] = "Xtt ";
// Gtk
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", window_height,
"default-width", window_width,
"title", title,
NULL);
#endif
// Create help window
CoXHelp *xhelp = new CoXHelpGtk( 0 /*toplevel*/, this, xhelp_eUtility_Xtt, &sts);
// xhelp->open_URL_cb = open_URL_cb;
CoXHelp::set_default( xhelp);
xhelp->close_cb = close_cb;
exec_help();
cohelp_mainloop();
}
/*
* Proview $Id: co_help_gtk.h,v 1.1 2008-10-28 09:36:12 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_help_gtk_h
#define co_help_gtk_h
/* co_help_gtk.h -- Help window */
#ifndef co_help_main_h
# include "co_help_main.h"
#endif
class CoHelpGtk : public CoHelpMain {
public:
CoHelpGtk( int argc, char *argv[], int *sts);
~CoHelpGtk();
void cohelp_mainloop();
static void close_cb( void *ctx, void *xhelp);
};
#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
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/co_help_gtk \
$(bld_dir)/co_help_gtk.o $(bld_dir)/help_main.o $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o -L/usr/X11R6/lib\
-L/opt/gnome/lib \
-lpwr_xtt_gtk -lpwr_xtt -lpwr_xtt_gtk -lpwr_xtt -lpwr_ge_gtk -lpwr_ge -lpwr_rt_gtk -lpwr_rt \
-lpwr_co_gtk -lpwr_co -lpwr_flow_gtk -lpwr_flow -lpwr_glow_gtk -lpwr_glow \
`pkg-config --libs gtk+-2.0` \
-lpwr_msg_dummy \
-ldb -lrpcsvc -lpthread -lm -lrt -lcrypt
endif
/*
* Proview $Id: co_help.cpp,v 1.1 2008-10-28 09:36:12 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.
*/
/* co_help.cpp -- Help window */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "pwr.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) {
printf( "co_help: Syntax error\n");
exit(0);
}
found = 1;
strcpy( wmg, argv[i+1]);
i++;
}
}
}
if ( !found) {
struct stat st;
strcpy( file, "$pwr_exe/co_help_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: co_help_main.h,v 1.1 2008-10-28 09:36:12 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 co_help_main_h
#define co_help_main_h
/* co_help_main.h -- Help window */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browapi.h"
#endif
#ifndef co_nav_help_h
#include "co_nav_help.h"
#endif
class CoHelpMain {
public:
CoHelpMain( int argc, char *argv[], int *return_sts);
virtual ~CoHelpMain() {}
void exec_help();
char topic[80];
pwr_tFileName helpfile;
char bookmark[80];
int strict;
navh_eHelpFile type;
};
#endif
/*
* Proview $Id: help_main.cpp,v 1.1 2008-10-28 09:36:12 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_xtt.cpp -- Display plant and node hiererachy */
#include "flow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include "pwr.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "co_help_main.h"
#include "co_xhelp.h"
#include "co_lng.h"
#include "co_msg.h"
static void usage()
{
cout << "co_help Proview Help Window" << endl << endl <<
"Usage:" << endl << endl <<
" co_help [-t 'topic'] [-s 'sourcefile'] [-b 'bookmark']" << endl << endl <<
"Arguments:" << endl << endl <<
" -t Help topic, default 'index'" << endl <<
" -s Source helpfile" << endl <<
" -b Bookmark" << endl <<
" -l Language, e.g sv_se" << endl <<
" -c Open Configuration help" << endl <<
" -d Open Designer's Guide" << endl <<
" -g Open Ge Reference Manual" << endl <<
" -o Open Operator Help" << endl << endl;
}
void CoHelpMain::exec_help()
{
pwr_tStatus sts;
sts = CoXHelp::dhelp( topic, bookmark, type, helpfile, strict);
if ( EVEN(sts)) {
char msg[80];
msg_GetText( sts, msg, sizeof(msg));
printf( "%s\n", msg);
exit(0);
}
}
CoHelpMain::CoHelpMain( int argc, char *argv[], int *return_sts) :
strict(0), type( navh_eHelpFile_Project)
{
strcpy( topic, "index");
strcpy( helpfile, "");
strcpy( bookmark, "");
// Set language
for ( int i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-l") == 0 && i + 1 < argc) {
Lng::set( argv[i+1]);
i++;
}
else if ( strcmp( argv[i], "-t") == 0 && i + 1 < argc) {
strcpy( topic, argv[i+1]);
i++;
}
else if ( strcmp( argv[i], "-s") == 0 && i + 1 < argc) {
type = navh_eHelpFile_Other;
strcpy( helpfile, argv[i+1]);
i++;
}
else if ( strcmp( argv[i], "-b") == 0 && i + 1 < argc) {
strcpy( bookmark, argv[i+1]);
i++;
}
else if ( strcmp( argv[i], "-c") == 0) {
type = navh_eHelpFile_Other;
if ( strcmp(topic, "index") == 0)
strcpy( topic, "overview");
strcpy( helpfile, "$pwr_lang/wtt_help.dat");
}
else if ( strcmp( argv[i], "-d") == 0) {
type = navh_eHelpFile_Other;
strcpy( helpfile, "$pwr_lang/man_dg.dat");
}
else if ( strcmp( argv[i], "-p") == 0) {
type = navh_eHelpFile_Project;
}
else if ( strcmp( argv[i], "-o") == 0) {
type = navh_eHelpFile_Other;
if ( strcmp(topic, "index") == 0)
strcpy( topic, "overview");
strcpy( helpfile, "$pwr_exe/xtt_help.dat");
}
else if ( strcmp( argv[i], "-g") == 0) {
type = navh_eHelpFile_Other;
strcpy( helpfile, "$pwr_lang/man_geref.dat");
}
else if ( strcmp( argv[i], "-h") == 0) {
usage();
exit(0);
}
}
}
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
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) -lpwr_co
endif
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