Commit c7127070 authored by claes's avatar claes

CoXHelp used for help window

parent d3eddeb1
...@@ -48,6 +48,7 @@ extern "C" { ...@@ -48,6 +48,7 @@ extern "C" {
#include "xtt_xnav.h" #include "xtt_xnav.h"
#include "xtt_item.h" #include "xtt_item.h"
#include "co_lng.h" #include "co_lng.h"
#include "co_xhelp.h"
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
// //
...@@ -717,14 +718,17 @@ static void xtt_activate_zoom_reset( Widget w, Xtt *xtt, XmAnyCallbackStruct *da ...@@ -717,14 +718,17 @@ static void xtt_activate_zoom_reset( Widget w, Xtt *xtt, XmAnyCallbackStruct *da
static void xtt_activate_help( Widget w, Xtt *xtt, XmAnyCallbackStruct *data) static void xtt_activate_help( Widget w, Xtt *xtt, XmAnyCallbackStruct *data)
{ {
xtt->xnav->open_help(); CoXHelp::dhelp("overview", "", navh_eHelpFile_Base, NULL, 0);
xtt->xnav->xhelp->help("overview", "", navh_eHelpFile_Base, NULL);
} }
static void xtt_activate_help_project( Widget w, Xtt *xtt, XmAnyCallbackStruct *data) static void xtt_activate_help_project( Widget w, Xtt *xtt, XmAnyCallbackStruct *data)
{ {
xtt->xnav->open_help(); CoXHelp::dhelp("index", "", navh_eHelpFile_Project, NULL, 0);
xtt->xnav->xhelp->help("index", "", navh_eHelpFile_Project, NULL); }
static void xtt_activate_help_proview( Widget w, Xtt *xtt, XmAnyCallbackStruct *data)
{
CoXHelp::dhelp( "version", "", navh_eHelpFile_Other, "$pwr_exe/xtt_version_help.dat", 0);
} }
static void xtt_create_msg_label( Widget w, Xtt *xtt, XmAnyCallbackStruct *data) static void xtt_create_msg_label( Widget w, Xtt *xtt, XmAnyCallbackStruct *data)
...@@ -878,6 +882,7 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) : ...@@ -878,6 +882,7 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) :
{"xtt_activate_zoom_reset",(caddr_t)xtt_activate_zoom_reset }, {"xtt_activate_zoom_reset",(caddr_t)xtt_activate_zoom_reset },
{"xtt_activate_help",(caddr_t)xtt_activate_help }, {"xtt_activate_help",(caddr_t)xtt_activate_help },
{"xtt_activate_help_project",(caddr_t)xtt_activate_help_project }, {"xtt_activate_help_project",(caddr_t)xtt_activate_help_project },
{"xtt_activate_help_proview",(caddr_t)xtt_activate_help_proview },
{"xtt_create_msg_label",(caddr_t)xtt_create_msg_label }, {"xtt_create_msg_label",(caddr_t)xtt_create_msg_label },
{"xtt_create_cmd_prompt",(caddr_t)xtt_create_cmd_prompt }, {"xtt_create_cmd_prompt",(caddr_t)xtt_create_cmd_prompt },
{"xtt_create_cmd_input",(caddr_t)xtt_create_cmd_input }, {"xtt_create_cmd_input",(caddr_t)xtt_create_cmd_input },
...@@ -1038,6 +1043,10 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) : ...@@ -1038,6 +1043,10 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) :
xnav->change_value_cb = &xtt_change_value; xnav->change_value_cb = &xtt_change_value;
xnav->set_dimension_cb = &xtt_set_dimension; xnav->set_dimension_cb = &xtt_set_dimension;
// Create help window
CoXHelp *xhelp = new CoXHelp( toplevel, 0, xhelp_eUtility_Xtt, &sts);
CoXHelp::set_default( xhelp);
XtRealizeWidget( toplevel); XtRealizeWidget( toplevel);
// XmProcessTraversal( xnav->brow_widget, XmTRAVERSE_CURRENT); // XmProcessTraversal( xnav->brow_widget, XmTRAVERSE_CURRENT);
...@@ -1060,3 +1069,10 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) : ...@@ -1060,3 +1069,10 @@ Xtt::Xtt( int argc, char *argv[], int *return_sts) :
xtt_mainloop( app_ctx, this); xtt_mainloop( app_ctx, this);
} }
...@@ -46,6 +46,7 @@ extern "C" { ...@@ -46,6 +46,7 @@ extern "C" {
} }
#include "co_lng.h" #include "co_lng.h"
#include "co_error.h" #include "co_error.h"
#include "co_xhelp.h"
#include "xtt_xnav.h" #include "xtt_xnav.h"
#include "xtt_item.h" #include "xtt_item.h"
#include "xtt_menu.h" #include "xtt_menu.h"
...@@ -864,6 +865,7 @@ void XNav::start_trace( pwr_tObjid objid, char *object_str) ...@@ -864,6 +865,7 @@ void XNav::start_trace( pwr_tObjid objid, char *object_str)
} }
#if 0
int XNav::open_help() int XNav::open_help()
{ {
int sts; int sts;
...@@ -878,6 +880,7 @@ int XNav::open_help() ...@@ -878,6 +880,7 @@ int XNav::open_help()
} }
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
#endif
int XNav::open_object( pwr_tObjid objid) int XNav::open_object( pwr_tObjid objid)
{ {
...@@ -958,8 +961,7 @@ XNav::XNav( ...@@ -958,8 +961,7 @@ XNav::XNav(
set_dimension_cb(NULL), ccm_func_registred(0), verify(0), set_dimension_cb(NULL), ccm_func_registred(0), verify(0),
menu_tree(NULL), ev(NULL), op(NULL), closing_down(0), menu_tree(NULL), ev(NULL), op(NULL), closing_down(0),
base_priv(pwr_mPrv_System), priv(pwr_mPrv_System), displayed(0), base_priv(pwr_mPrv_System), priv(pwr_mPrv_System), displayed(0),
current_logging_index(-1), search_last_found(0), search_compiled(0), current_logging_index(-1), search_last_found(0), search_compiled(0)
xhelp(0)
{ {
strcpy( name, xn_name); strcpy( name, xn_name);
strcpy( opplace_name, xn_opplace_name); strcpy( opplace_name, xn_opplace_name);
...@@ -1543,19 +1545,17 @@ static void xnav_trace_help_cb(tra_tCtx tractx, char *key) ...@@ -1543,19 +1545,17 @@ static void xnav_trace_help_cb(tra_tCtx tractx, char *key)
pwr_tObjid objid; pwr_tObjid objid;
char objid_str[40]; char objid_str[40];
xnav->open_help(); sts = CoXHelp::dhelp( key, "", navh_eHelpFile_Project, NULL, 0);
sts = xnav->xhelp->help( key, "", navh_eHelpFile_Project, NULL);
if ( EVEN(sts)) { if ( EVEN(sts)) {
// Try to convert to objid and search for objid as topic // Try to convert to objid and search for objid as topic
sts = gdh_NameToObjid ( key, &objid); sts = gdh_NameToObjid ( key, &objid);
if ( ODD(sts)) { if ( ODD(sts)) {
cdh_ObjidToString( objid_str, objid, 1); cdh_ObjidToString( objid_str, objid, 1);
sts = xnav->xhelp->help( objid_str, "", navh_eHelpFile_Project, NULL); sts = CoXHelp::dhelp( objid_str, "", navh_eHelpFile_Project, NULL, 0);
} }
} }
if ( EVEN(sts)) if ( EVEN(sts))
sts = xnav->xhelp->help( key, "", navh_eHelpFile_Base, NULL); sts = CoXHelp::dhelp( key, "", navh_eHelpFile_Base, NULL, 0);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message( 'E', "Unable to find topic"); xnav->message( 'E', "Unable to find topic");
else else
...@@ -2712,12 +2712,13 @@ int XNavGbl::symbolfile_exec( void *xnav) ...@@ -2712,12 +2712,13 @@ int XNavGbl::symbolfile_exec( void *xnav)
{ {
char cmd[80]; char cmd[80];
if ( strcmp( symbolfilename, "") != 0) if ( strcmp( symbolfilename, "") == 0)
{ strcpy( symbolfilename, "$HOME/xtt_setup");
strcpy( cmd, "@"); strcpy( cmd, "@");
strcat( cmd, symbolfilename); strcat( cmd, symbolfilename);
((XNav *)xnav)->command( cmd); ((XNav *)xnav)->command( cmd);
}
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
...@@ -2832,6 +2833,7 @@ int XNavGbl::load_config( void *xnav) ...@@ -2832,6 +2833,7 @@ int XNavGbl::load_config( void *xnav)
sizeof( symbolfilename)); sizeof( symbolfilename));
if ( EVEN(sts)) if ( EVEN(sts))
strcpy( symbolfilename, ""); strcpy( symbolfilename, "");
dcli_trim( symbolfilename, symbolfilename);
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
......
...@@ -80,10 +80,6 @@ extern "C" { ...@@ -80,10 +80,6 @@ extern "C" {
#include "xtt_menu.h" #include "xtt_menu.h"
#endif #endif
#ifndef xtt_xhelp_h
#include "xtt_xhelp.h"
#endif
#define xnav_cVersion "X3.0b" #define xnav_cVersion "X3.0b"
#define XNAV_BROW_MAX 25 #define XNAV_BROW_MAX 25
#define XNAV_LOGG_MAX 10 #define XNAV_LOGG_MAX 10
...@@ -278,7 +274,6 @@ class XNav { ...@@ -278,7 +274,6 @@ class XNav {
int search_compiled; int search_compiled;
xnav_eSearchType search_type; xnav_eSearchType search_type;
int init_help; int init_help;
XHelp *xhelp;
void start_trace( pwr_tObjid Objid, char *object_str); void start_trace( pwr_tObjid Objid, char *object_str);
void start_trace_selected(); void start_trace_selected();
...@@ -333,7 +328,6 @@ class XNav { ...@@ -333,7 +328,6 @@ class XNav {
void enable_events( XNavBrow *brow); void enable_events( XNavBrow *brow);
int open_object( pwr_tObjid objid); int open_object( pwr_tObjid objid);
int open_crossref( pwr_tObjid objid); int open_crossref( pwr_tObjid objid);
int open_help();
void swap( int mode); void swap( int mode);
......
...@@ -55,6 +55,7 @@ extern "C" { ...@@ -55,6 +55,7 @@ extern "C" {
#include "xtt_xnav_crr.h" #include "xtt_xnav_crr.h"
#include "co_dcli_msg.h" #include "co_dcli_msg.h"
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
#include "co_xhelp.h"
#include "glow_curvectx.h" #include "glow_curvectx.h"
#include "glow_curvewidget.h" #include "glow_curvewidget.h"
...@@ -215,7 +216,7 @@ dcli_tCmdTable xnav_command_table[] = { ...@@ -215,7 +216,7 @@ dcli_tCmdTable xnav_command_table[] = {
{ "dcli_arg1", "dcli_arg2", "dcli_arg3", "dcli_arg4", { "dcli_arg1", "dcli_arg2", "dcli_arg3", "dcli_arg4",
"/HELPFILE", "/POPNAVIGATOR", "/BOOKMARK", "/HELPFILE", "/POPNAVIGATOR", "/BOOKMARK",
"/INDEX", "/BASE", "/RETURNCOMMAND", "/WIDTH", "/INDEX", "/BASE", "/RETURNCOMMAND", "/WIDTH",
"/HEIGHT", ""} "/HEIGHT", "/VERSION", ""}
}, },
{ {
"LOGOUT", "LOGOUT",
...@@ -304,28 +305,31 @@ static int xnav_help_func( void *client_data, ...@@ -304,28 +305,31 @@ static int xnav_help_func( void *client_data,
{ {
if ( ODD( dcli_get_qualifier( "/HELPFILE", file_str))) if ( ODD( dcli_get_qualifier( "/HELPFILE", file_str)))
{ {
sts = xnav->xhelp->help_index( navh_eHelpFile_Other, file_str); sts = CoXHelp::dhelp_index( navh_eHelpFile_Other, file_str);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message('E', "Unable to find file"); xnav->message('E', "Unable to find file");
} }
else else
{ {
if ( ODD( dcli_get_qualifier( "/BASE", file_str))) { if ( ODD( dcli_get_qualifier( "/BASE", file_str)))
xnav->open_help(); sts = CoXHelp::dhelp_index( navh_eHelpFile_Base, NULL);
sts = xnav->xhelp->help_index( navh_eHelpFile_Base, NULL); else
} sts = CoXHelp::dhelp_index( navh_eHelpFile_Project, NULL);
else {
xnav->open_help();
sts = xnav->xhelp->help_index( navh_eHelpFile_Project, NULL);
}
} }
return 1; return 1;
} }
if ( ODD( dcli_get_qualifier( "/VERSION", 0))) {
sts = CoXHelp::dhelp( "version", "", navh_eHelpFile_Other, "$pwr_exe/xtt_version_help.dat", 0);
if ( EVEN(sts))
xnav->message('E', "No help on this subject");
return sts;
}
int strict = 0;
if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg_str))) if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg_str)))
{ {
xnav->open_help(); sts = CoXHelp::dhelp( "help command", "", navh_eHelpFile_Base, NULL, strict);
sts = xnav->xhelp->help( "help command", "", navh_eHelpFile_Base, NULL);
return 1; return 1;
} }
if ( EVEN( dcli_get_qualifier( "/BOOKMARK", bookmark_str))) if ( EVEN( dcli_get_qualifier( "/BOOKMARK", bookmark_str)))
...@@ -386,9 +390,15 @@ static int xnav_help_func( void *client_data, ...@@ -386,9 +390,15 @@ static int xnav_help_func( void *client_data,
if ( ODD( dcli_get_qualifier( "/HELPFILE", file_str))) if ( ODD( dcli_get_qualifier( "/HELPFILE", file_str)))
{ {
xnav->open_help(); sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Other, file_str, strict);
xnav->xhelp->set_dimension( width, height); if ( EVEN(sts))
sts = xnav->xhelp->help( key, bookmark_str, navh_eHelpFile_Other, file_str); xnav->message('E', "No help on this subject");
else if ( strcmp( return_str, "") != 0)
xnav->set_push_command( return_str);
}
else if ( ODD( dcli_get_qualifier( "/BASE", 0)))
{
sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Base, 0, strict);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message('E', "No help on this subject"); xnav->message('E', "No help on this subject");
else if ( strcmp( return_str, "") != 0) else if ( strcmp( return_str, "") != 0)
...@@ -396,12 +406,10 @@ static int xnav_help_func( void *client_data, ...@@ -396,12 +406,10 @@ static int xnav_help_func( void *client_data,
} }
else else
{ {
xnav->open_help(); sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Base, 0, strict);
xnav->xhelp->set_dimension( width, height);
sts = xnav->xhelp->help( key, bookmark_str, navh_eHelpFile_Base, NULL);
if ( EVEN(sts)) if ( EVEN(sts))
{ {
sts = xnav->xhelp->help( key, bookmark_str, navh_eHelpFile_Project, NULL); sts = CoXHelp::dhelp( key, bookmark_str, navh_eHelpFile_Project, 0, strict);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message('E', "No help on this subject"); xnav->message('E', "No help on this subject");
} }
...@@ -1856,6 +1864,16 @@ static int xnav_open_func( void *client_data, ...@@ -1856,6 +1864,16 @@ static int xnav_open_func( void *client_data,
else else
instance_p = 0; instance_p = 0;
if ( ODD( dcli_get_qualifier( "/CLASSGRAPH", 0))) {
classgraph = 1;
if ( !instance_p) {
xnav->message('E', "Instance is missing");
return XNAV__HOLDCOMMAND;
}
}
else
classgraph = 0;
if ( ODD( dcli_get_qualifier( "/OBJECT", object_str))) if ( ODD( dcli_get_qualifier( "/OBJECT", object_str)))
{ {
pwr_tObjid objid; pwr_tObjid objid;
...@@ -1953,11 +1971,17 @@ static int xnav_open_func( void *client_data, ...@@ -1953,11 +1971,17 @@ static int xnav_open_func( void *client_data,
sts = gdh_ObjidToName( cdh_ClassIdToObjid( cid), cname, sizeof(cname), sts = gdh_ObjidToName( cdh_ClassIdToObjid( cid), cname, sizeof(cname),
cdh_mName_object); cdh_mName_object);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
cdh_ToLower( cname, cname);
if ( cdh_CidToVid(cid) < cdh_cUserClassVolMin) {
if ( cname[0] == '$') if ( cname[0] == '$')
sprintf( file_str, "pwr_c_%s", &cname[1]); sprintf( file_str, "pwr_c_%s", &cname[1]);
else else
sprintf( file_str, "pwr_c_%s", cname); sprintf( file_str, "pwr_c_%s", cname);
} }
else
strcpy( file_str, cname);
}
else { else {
xnav->message('E',"Enter file"); xnav->message('E',"Enter file");
return XNAV__HOLDCOMMAND; return XNAV__HOLDCOMMAND;
...@@ -2713,11 +2737,9 @@ static void xnav_ge_help_cb( ge_tCtx gectx, char *key) ...@@ -2713,11 +2737,9 @@ static void xnav_ge_help_cb( ge_tCtx gectx, char *key)
XNav *xnav = (XNav *)gectx->parent_ctx; XNav *xnav = (XNav *)gectx->parent_ctx;
int sts; int sts;
xnav->open_help(); sts = CoXHelp::dhelp( key, "", navh_eHelpFile_Project, NULL, 0);
sts = xnav->xhelp->help( key, "", navh_eHelpFile_Project, NULL);
if ( EVEN(sts)) if ( EVEN(sts))
sts = xnav->xhelp->help( "graph window", "", navh_eHelpFile_Base, NULL); sts = CoXHelp::dhelp( "graph window", "", navh_eHelpFile_Base, NULL, 0);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message( 'E', "Unable to find topic"); xnav->message( 'E', "Unable to find topic");
else else
...@@ -5015,19 +5037,17 @@ static void xnav_ev_help_cb( void *ctx, char *key) ...@@ -5015,19 +5037,17 @@ static void xnav_ev_help_cb( void *ctx, char *key)
pwr_tObjid objid; pwr_tObjid objid;
char objid_str[40]; char objid_str[40];
xnav->open_help(); sts = CoXHelp::dhelp( key, "", navh_eHelpFile_Project, NULL, 0);
sts = xnav->xhelp->help( key, "", navh_eHelpFile_Project, NULL);
if ( EVEN(sts)) { if ( EVEN(sts)) {
// Try to convert to objid and search for objid as topic // Try to convert to objid and search for objid as topic
sts = gdh_NameToObjid ( key, &objid); sts = gdh_NameToObjid ( key, &objid);
if ( ODD(sts)) { if ( ODD(sts)) {
cdh_ObjidToString( objid_str, objid, 1); cdh_ObjidToString( objid_str, objid, 1);
sts = xnav->xhelp->help( objid_str, "", navh_eHelpFile_Project, NULL); sts = CoXHelp::dhelp( objid_str, "", navh_eHelpFile_Project, NULL, 0);
} }
} }
if ( EVEN(sts)) if ( EVEN(sts))
sts = xnav->xhelp->help( key, "", navh_eHelpFile_Base, NULL); sts = CoXHelp::dhelp( key, "", navh_eHelpFile_Base, NULL, 0);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message( 'E', "Unable to find topic"); xnav->message( 'E', "Unable to find topic");
...@@ -5216,9 +5236,7 @@ static void xnav_op_help_cb( void *ctx, char *key) ...@@ -5216,9 +5236,7 @@ static void xnav_op_help_cb( void *ctx, char *key)
XNav *xnav = (XNav *) ctx; XNav *xnav = (XNav *) ctx;
int sts; int sts;
xnav->open_help(); sts = CoXHelp::dhelp( key, "", navh_eHelpFile_Project, NULL, 0);
sts = xnav->xhelp->help( key, "", navh_eHelpFile_Project, NULL);
if ( EVEN(sts)) if ( EVEN(sts))
xnav->message( 'E', "Unable to find topic"); xnav->message( 'E', "Unable to find topic");
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment