Commit 4d8eed8b authored by claes's avatar claes

images in brow and helpfiles

parent dcad4301
......@@ -989,10 +989,11 @@ int ClassRead::remove_spaces(
strcpy( out, s);
s = out;
if ( strlen(s) != 0)
{
for ( s += strlen(s) - 1;
!((s == in) || ((*s != ' ') && (*s != 9))); s--) ;
!((s == out) || ((*s != ' ') && (*s != 9))); s--) ;
s++;
*s = 0;
}
......
......@@ -117,6 +117,7 @@ int ClassRead::html_class()
char struct_file[100];
char low_volume_name[80];
char low_class_name[80];
char *s;
cdh_ToLower( low_volume_name, volume_name);
cdh_ToLower( low_class_name, class_name);
......@@ -227,10 +228,18 @@ endl <<
"<BR><DT><B>Description</B><DT><BR>" << endl <<
"</DL><XMP>" << endl;
if ( doc_fresh)
for ( i = 0; i < doc_cnt; i++)
html_clf->f << doc_text[i] << endl;
if ( doc_fresh) {
for ( i = 0; i < doc_cnt; i++) {
if ( (s = strstr( low(doc_text[i]), "@image")) != 0) {
char imagefile[80];
remove_spaces( s + 6, imagefile);
html_clf->f << "</XMP><IMG SRC=\"" << imagefile << "\"><XMP>" << endl;
}
else
html_clf->f << doc_text[i] << endl;
}
}
html_clf->f <<
"</XMP>" << endl;
......@@ -305,6 +314,7 @@ endl <<
"<TD><CODE><B>" << doc_text[i] << "</B></CODE></TD>" << endl <<
"<TD><CODE>" << doc_text[i+1] << "</CODE></TD>" << endl;
}
html_clf->f << "</TABLE>" << endl;
return 1;
}
......@@ -330,6 +340,7 @@ endl <<
"<TD><CODE><B>" << doc_text[i] << "</B></CODE></TD>" << endl <<
"<TD><CODE>" << doc_text[i+1] << "</CODE></TD>" << endl;
}
html_clf->f << "</TABLE>" << endl;
return 1;
}
......@@ -359,7 +370,7 @@ endl <<
"<TD><CODE><B>" << doc_text[i] << "</B></CODE></TD>" << endl <<
"<TD><CODE>" << doc_text[i+1] << "</CODE></TD>" << endl;
}
html_clf->f << "</TABLE>" << endl;
return 1;
}
......@@ -387,6 +398,7 @@ int ClassRead::html_class_close()
int ClassRead::html_attribute()
{
int i;
char *s;
// Summary
......@@ -414,11 +426,14 @@ int ClassRead::html_attribute()
{
if ( strcmp( doc_summary, "") == 0)
{
for ( i = 0; i < doc_cnt; i++)
{
html_clf->f << doc_text[i];
if ( i < doc_cnt - 1)
html_clf->f << "<BR>" << endl;
for ( i = 0; i < doc_cnt; i++) {
if ( (s = strstr( low(doc_text[i]), "@image")) != 0)
continue;
else {
html_clf->f << doc_text[i];
if ( i < doc_cnt - 1)
html_clf->f << "<BR>" << endl;
}
}
}
else
......@@ -468,10 +483,18 @@ int ClassRead::html_attribute()
"<CODE><B>Description</B></CODE><DT></DL>" << endl <<
"<XMP>" << endl;
if ( doc_fresh)
for ( i = 0; i < doc_cnt; i++)
fp_tmp << doc_text[i] << endl;
if ( doc_fresh) {
for ( i = 0; i < doc_cnt; i++) {
if ( (s = strstr( low(doc_text[i]), "@image")) != 0) {
char imagefile[80];
remove_spaces( s + 6, imagefile);
fp_tmp << "</XMP><IMG SRC=\"" << imagefile << "\"><XMP>" << endl;
}
else
fp_tmp << doc_text[i] << endl;
}
}
fp_tmp <<
"</XMP>" << endl;
......
......@@ -91,10 +91,18 @@ int ClassRead::xtthelp_class()
fp_tmp <<
"<H1>Description" << endl;
if ( doc_fresh)
for ( i = 0; i < doc_cnt; i++)
fp_tmp << doc_text[i] << endl;
if ( doc_fresh) {
for ( i = 0; i < doc_cnt; i++) {
if ( (s = strstr( low(doc_text[i]), "@image")) != 0) {
char imagefile[80];
remove_spaces( s + 6, imagefile);
fp_tmp << "<IMAGE> " << imagefile << endl;
}
else
fp_tmp << doc_text[i] << endl;
}
}
for ( i = 0; i < doc_clink_cnt; i++) {
if ( strncmp( doc_clink_ref[i], "pwrb_", 5) == 0)
strcpy( link_ref, &doc_clink_ref[i][5]);
......@@ -133,6 +141,7 @@ int ClassRead::xtthelp_class_close()
int ClassRead::xtthelp_attribute()
{
int i;
char *s;
fp_tmp <<
endl <<
......@@ -159,10 +168,18 @@ endl <<
fp_tmp << endl;
if ( doc_fresh)
for ( i = 0; i < doc_cnt; i++)
fp_tmp << doc_text[i] << endl;
if ( doc_fresh) {
for ( i = 0; i < doc_cnt; i++) {
if ( (s = strstr( low(doc_text[i]), "@image")) != 0) {
char imagefile[80];
remove_spaces( s + 6, imagefile);
fp_tmp << "<IMAGE> " << imagefile << endl;
}
else
fp_tmp << doc_text[i] << endl;
}
}
return 1;
}
......@@ -61,10 +61,11 @@ static int help_remove_spaces(
strcpy( out, s);
s = out;
if ( strlen(s) != 0)
{
for ( s += strlen(s) - 1;
!((s == in) || ((*s != ' ') && (*s != 9))); s--) ;
for ( s += strlen(s) - 1;
!((s == out) || ((*s != ' ') && (*s != 9))); s--) ;
s++;
*s = 0;
}
......@@ -111,6 +112,9 @@ int NavHelp::help( char *help_key, char *help_bookmark,
int header1;
int header2;
int bold;
int horizontal_line;
int image;
char imagefile[80];
int register_bookmark = 0;
int bookmark_found = 0;
void *bookmark_node = 0;
......@@ -291,9 +295,11 @@ int NavHelp::help( char *help_key, char *help_bookmark,
else
index_link = 0;
image = 0;
header1 = 0;
header2 = 0;
bold = 0;
horizontal_line = 0;
if ( (s = strstr( line, "<h1>")) || (s = strstr( line, "<H1>")))
{
header1 = 1;
......@@ -309,6 +315,16 @@ int NavHelp::help( char *help_key, char *help_bookmark,
bold = 1;
strcpy( text1, s + 3);
}
else if ( (s = strstr( line, "<hr>")) || (s = strstr( line, "<HR>")))
{
horizontal_line = 1;
}
else if ( (s = strstr( line, "<image>")) || (s = strstr( line, "<IMAGE>")))
{
help_remove_spaces( s + 7, imagefile);
image = 1;
}
else
{
strcpy( text1, line);
......@@ -365,6 +381,22 @@ int NavHelp::help( char *help_key, char *help_bookmark,
register_bookmark = 0;
}
}
else if ( horizontal_line) {
node = (insert_cb)( parent_ctx, navh_eItemType_HorizontalLine, NULL,
NULL, NULL, NULL, NULL, NULL, navh_eHelpFile_, 0, NULL);
}
else if ( image)
{
node = (insert_cb)( parent_ctx, navh_eItemType_Image,
imagefile, NULL, NULL, link,
link_bookmark, link_filename_p, file_type, index_link,
bookmark_p);
if ( register_bookmark)
{
bookmark_node = node;
register_bookmark = 0;
}
}
else
{
node = (insert_cb)( parent_ctx, navh_eItemType_Help, text1, text2,
......
......@@ -25,8 +25,10 @@ typedef enum {
navh_eItemType_HelpHeader,
navh_eItemType_Header,
navh_eItemType_HeaderLarge,
navh_eItemType_HorizontalLine,
navh_eItemType_Topic,
navh_eItemType_EndTopic
navh_eItemType_EndTopic,
navh_eItemType_Image
} navh_eItemType;
......
......@@ -47,6 +47,39 @@ XHelp *XHelp::default_xhelp = 0;
// Prototype declarations
static void xhelp_open_input_dialog( XHelp *xhelp, char *text, char *title,
char *init_text,
void (*ok_cb)( XHelp *, char *))
{
Arg args[10];
int i;
XmString cstr;
i = 0;
XtSetArg(args[0], XmNlabelString,
cstr=XmStringCreateLtoR( text, "ISO8859-1") ); i++;
XtSetValues( xhelp->india_label, args, i);
XmStringFree( cstr);
i = 0;
XtSetArg(args[0], XmNdialogTitle,
cstr=XmStringCreateLtoR( title, "ISO8859-1") ); i++;
XtSetValues( xhelp->india_widget, args, i);
XmStringFree( cstr);
XmTextSetString( xhelp->india_text, init_text);
XtManageChild( xhelp->india_widget);
XmProcessTraversal( xhelp->india_text, XmTRAVERSE_CURRENT);
xhelp->india_ok_cb = ok_cb;
}
static void xhelp_find_ok( XHelp *xhelp, char *search_str)
{
xhelp->xhelpnav->search( search_str, false);
}
static void xhelp_activate_exit( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
if ( xhelp->close_cb)
......@@ -85,6 +118,44 @@ static void xhelp_activate_zoom_reset( Widget w, XHelp *xhelp, XmAnyCallbackStru
xhelp->xhelpnav->unzoom();
}
static void xhelp_activate_search( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
xhelp_open_input_dialog( xhelp, "Search string", "Search string",
"", &xhelp_find_ok);
}
static void xhelp_activate_searchnext( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
xhelp->xhelpnav->search_next();
}
static void xhelp_activate_searchprevious( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
xhelp->xhelpnav->search_next_reverse();
}
static void xhelp_create_india_label( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
xhelp->india_label = w;
}
static void xhelp_create_india_text( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
xhelp->india_text = w;
}
static void xhelp_activate_india_ok( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
char *value;
value = XmTextGetString( xhelp->india_text);
XtUnmanageChild( xhelp->india_widget);
(xhelp->india_ok_cb)( xhelp, value);
}
static void xhelp_activate_india_cancel( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
XtUnmanageChild( xhelp->india_widget);
}
static void xhelp_activate_help( Widget w, XHelp *xhelp, XmAnyCallbackStruct *data)
{
XHelp::dhelp( "helpwindow", 0, navh_eHelpFile_Base, 0, true);
......@@ -240,6 +311,13 @@ XHelp::XHelp(
{"xhelp_activate_zoom_in",(caddr_t)xhelp_activate_zoom_in },
{"xhelp_activate_zoom_out",(caddr_t)xhelp_activate_zoom_out },
{"xhelp_activate_zoom_reset",(caddr_t)xhelp_activate_zoom_reset },
{"xhelp_activate_search",(caddr_t)xhelp_activate_search },
{"xhelp_activate_searchnext",(caddr_t)xhelp_activate_searchnext },
{"xhelp_activate_searchprevious",(caddr_t)xhelp_activate_searchprevious },
{"xhelp_activate_india_ok",(caddr_t)xhelp_activate_india_ok },
{"xhelp_activate_india_cancel",(caddr_t)xhelp_activate_india_cancel },
{"xhelp_create_india_label",(caddr_t)xhelp_create_india_label },
{"xhelp_create_india_text",(caddr_t)xhelp_create_india_text },
{"xhelp_activate_help",(caddr_t)xhelp_activate_help },
{"xhelp_create_xhelpnav_form",(caddr_t)xhelp_create_xhelpnav_form }
};
......@@ -271,6 +349,10 @@ XHelp::XHelp(
name, args, 1, &toplevel, &dclass);
if (sts != MrmSUCCESS) printf("can't fetch %s\n", name);
sts = MrmFetchWidget(s_DRMh, "input_dialog", toplevel,
&india_widget, &dclass);
if (sts != MrmSUCCESS) printf("can't fetch input dialog\n");
MrmCloseHierarchy(s_DRMh);
......
......@@ -40,6 +40,10 @@ class XHelp {
int set_focus_disabled;
XtIntervalId focus_timerid;
int displayed;
Widget india_widget;
Widget india_label;
Widget india_text;
void (*india_ok_cb)( XHelp *, char *);
static XHelp *default_xhelp;
......
......@@ -215,6 +215,13 @@ void XHelpNavBrow::create_nodeclasses()
flow_eDrawType_TextHelveticaBold, 4, flow_eAnnotType_OneLine,
1);
// Create Horizontal line
brow_CreateNodeClass( ctx, "NavigatorLine",
flow_eNodeGroup_Common, &nc_line);
// brow_AddFrame( nc_line, 0, 0, 20, 0.9, flow_eDrawType_Line, -1, 1);
brow_AddFrame( nc_line, 0, 0, 20, 0.15, flow_eDrawType_LineGray, 2, 1);
}
void XHelpNavBrow::brow_setup()
......@@ -279,9 +286,11 @@ XHelpNav::XHelpNav(
Widget *w,
pwr_tStatus *status) :
parent_ctx(xn_parent_ctx), parent_wid(xn_parent_wid),
brow_cnt(0), closing_down(0), displayed(0), utility(xn_utility)
brow_cnt(0), closing_down(0), displayed(0), utility(xn_utility),
search_node(0), search_strict(false)
{
strcpy( name, xn_name);
strcpy( search_str, "");
form_widget = ScrolledBrowCreate( parent_wid, name, NULL, 0,
xhelpnav_init_brow_base_cb, this, (Widget *)&brow_widget);
......@@ -665,7 +674,79 @@ static int xhelpnav_init_brow_cb( BrowCtx *ctx, void *client_data)
return 1;
}
pwr_tStatus XHelpNav::search( char *str, bool strict)
{
search_node = 0;
search_strict = strict;
strncpy( search_str, str, sizeof(search_str));
if ( !strict)
cdh_ToUpper( search_str, search_str);
return search_exec( false);
}
#define XHELP__SEARCHNOTSTARTED 2;
#define XHELP__SUCCESS 1;
#define XHELP__SEARCHNOTFOUND 4;
pwr_tStatus XHelpNav::search_next()
{
if ( strcmp( search_str, "") == 0)
return XHELP__SEARCHNOTSTARTED;
return search_exec( false);
}
pwr_tStatus XHelpNav::search_next_reverse()
{
if ( strcmp( search_str, "") == 0)
return XHELP__SEARCHNOTSTARTED;
return search_exec( true);
}
pwr_tStatus XHelpNav::search_exec( bool reverse)
{
brow_tObject *object_list;
int object_cnt;
HItem *item;
bool active = false;
bool hit = false;
int idx;
if ( !search_node)
active = true;
brow_GetObjectList( brow->ctx, &object_list, &object_cnt);
for ( int i = 0; i < object_cnt; i++) {
if ( reverse)
idx = object_cnt - 1 - i;
else
idx = i;
if ( !active) {
if ( search_node == object_list[idx])
active = true;
continue;
}
brow_GetUserData( object_list[idx], (void **)&item);
hit = item->search( search_str, search_strict);
if ( hit) {
// Select and center node
brow_SelectClear( brow->ctx);
brow_SetInverse( object_list[idx], 1);
brow_SelectInsert( brow->ctx, object_list[idx]);
if ( !brow_IsVisible( brow->ctx, object_list[idx]))
brow_CenterObject( brow->ctx, object_list[idx], 0.25);
search_node = object_list[idx];
return XHELP__SUCCESS;
}
}
// Not found
search_node = 0;
return XHELP__SEARCHNOTFOUND;
}
HItemHeader::HItemHeader( XHelpNavBrow *brow, char *item_name, char *title,
brow_tNode dest, flow_eDest dest_code)
......@@ -676,6 +757,58 @@ HItemHeader::HItemHeader( XHelpNavBrow *brow, char *item_name, char *title,
brow_SetAnnotation( node, 0, title, strlen(title));
}
HItemHelpLine::HItemHelpLine( XHelpNavBrow *brow, char *item_name,
brow_tNode dest, flow_eDest dest_code)
{
type = xhelpnav_eHItemType_HelpLine;
brow_CreateNode( brow->ctx, "header", brow->nc_line,
dest, dest_code, (void *)this, 1, &node);
}
HItemHelpImage::HItemHelpImage( XHelpNavBrow *brow, char *item_name, brow_tNodeClass nc,
char *item_link, char *item_bookmark,
char *item_file_name, navh_eHelpFile help_file_type,
brow_tNode dest, flow_eDest dest_code)
: file_type(help_file_type)
{
type = xhelpnav_eHItemType_HelpImage;
strcpy( link, item_link);
strcpy( bookmark, item_bookmark);
if ( item_file_name)
strcpy( file_name, item_file_name);
else
strcpy( file_name, "");
brow_CreateNode( brow->ctx, "image", nc,
dest, dest_code, (void *)this, 1, &node);
if ( link[0] != 0)
brow_SetAnnotPixmap( node, 0, brow->pixmap_morehelp);
}
int HItemHelpImage::doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav, double x, double y)
{
int sts;
if ( strcmp( link, "") != 0)
{
if ( (strstr( link, ".htm") != 0) || (strstr( link, ".pdf") != 0)) {
// Open the url
xhelpnav_open_URL( link);
}
else {
if ( file_name[0] == 0)
{
sts = xhelpnav->help( link, bookmark, navh_eHelpFile_Base, NULL, 1, true);
if (EVEN(sts))
sts = xhelpnav->help( link, bookmark, navh_eHelpFile_Project, NULL, 1, true);
}
else
sts = xhelpnav->help( link, bookmark, navh_eHelpFile_Other, file_name, 1, true);
}
}
return 1;
}
HItemHeaderLarge::HItemHeaderLarge( XHelpNavBrow *brow, char *item_name, char *title,
brow_tNode dest, flow_eDest dest_code)
{
......@@ -685,6 +818,20 @@ HItemHeaderLarge::HItemHeaderLarge( XHelpNavBrow *brow, char *item_name, char *t
brow_SetAnnotation( node, 0, title, strlen(title));
}
bool HItemHeaderLarge::search( char *str, bool strict)
{
char text[256];
brow_GetAnnotation( node, 0, text, sizeof(text));
if ( text[0] == 0)
return false;
if ( !strict)
cdh_ToUpper( text, text);
if ( strstr( text, str) != 0)
return true;
return false;
}
HItemHelpHeader::HItemHelpHeader( XHelpNavBrow *brow, char *item_name, char *title, bool base,
brow_tNode dest, flow_eDest dest_code)
{
......@@ -696,6 +843,20 @@ HItemHelpHeader::HItemHelpHeader( XHelpNavBrow *brow, char *item_name, char *tit
brow_SetAnnotPixmap( node, 0, brow->pixmap_closehelp);
}
bool HItemHelpHeader::search( char *str, bool strict)
{
char text[256];
brow_GetAnnotation( node, 0, text, sizeof(text));
if ( text[0] == 0)
return false;
if ( !strict)
cdh_ToUpper( text, text);
if ( strstr( text, str) != 0)
return true;
return false;
}
int HItemHelpHeader::doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav, double x, double y)
{
if ( xhelpnav)
......@@ -726,6 +887,22 @@ HItemHelp::HItemHelp( XHelpNavBrow *brow, char *item_name, char *text, char *tex
brow_SetAnnotPixmap( node, 0, brow->pixmap_morehelp);
}
bool HItemHelp::search( char *str, bool strict)
{
char text[256];
for ( int i = 0; i < 3; i++) {
brow_GetAnnotation( node, i, text, sizeof(text));
if ( text[0] == 0)
continue;
if ( !strict)
cdh_ToUpper( text, text);
if ( strstr( text, str) != 0)
return true;
}
return false;
}
int HItemHelp::doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav, double x, double y)
{
int sts;
......@@ -777,6 +954,22 @@ HItemHelpBold::HItemHelpBold( XHelpNavBrow *brow, char *item_name, char *text, c
brow_SetAnnotPixmap( node, 0, brow->pixmap_morehelp);
}
bool HItemHelpBold::search( char *str, bool strict)
{
char text[256];
for ( int i = 0; i < 3; i++) {
brow_GetAnnotation( node, i, text, sizeof(text));
if ( text[0] == 0)
continue;
if ( !strict)
cdh_ToUpper( text, text);
if ( strstr( text, str) != 0)
return true;
}
return false;
}
int HItemHelpBold::doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav, double x, double y)
{
int sts;
......@@ -858,6 +1051,24 @@ void *xhelpnav_help_insert_cb( void *ctx, navh_eItemType item_type, char *text1,
NULL, flow_eDest_IntoLast);
return item->node;
}
case navh_eItemType_HorizontalLine:
{
HItemHelpLine *item = new HItemHelpLine( xhelpnav->brow, "help",
NULL, flow_eDest_IntoLast);
return item->node;
}
case navh_eItemType_Image:
{
brow_tNodeClass nc;
brow_CreateNodeClass( xhelpnav->brow->ctx, "Image", flow_eNodeGroup_Common, &nc);
brow_AddFrame( nc, 0, 0, 20, 0.8, flow_eDrawType_Line, -1, 1);
brow_AddAnnotPixmap( nc, 0, 0.2, 0.1, flow_eDrawType_Line, 2, 0);
brow_AddImage( nc, text1, 2, 0);
HItemHelpImage *item = new HItemHelpImage( xhelpnav->brow, "help", nc,
link, bookmark, file_name, file_type, NULL, flow_eDest_IntoLast);
return item->node;
}
default:
return 0;
}
......
......@@ -51,7 +51,9 @@ typedef enum {
xhelpnav_eHItemType_HeaderLarge,
xhelpnav_eHItemType_Help,
xhelpnav_eHItemType_HelpBold,
xhelpnav_eHItemType_HelpHeader
xhelpnav_eHItemType_HelpHeader,
xhelpnav_eHItemType_HelpLine,
xhelpnav_eHItemType_HelpImage
} xhelpnav_eHItemType;
typedef enum {
......@@ -74,6 +76,7 @@ class XHelpNavBrow {
brow_tNodeClass nc_text;
brow_tNodeClass nc_header;
brow_tNodeClass nc_headerlarge;
brow_tNodeClass nc_line;
flow_sAnnotPixmap *pixmap_morehelp;
flow_sAnnotPixmap *pixmap_closehelp;
......@@ -108,6 +111,9 @@ class XHelpNav {
int displayed;
int init_help;
xhelp_eUtility utility;
brow_tNode search_node;
char search_str[80];
bool search_strict;
void print( char *filename);
void zoom( double zoom_factor);
......@@ -124,7 +130,10 @@ class XHelpNav {
int help( char *key, char *help_bookmark, navh_eHelpFile file_type,
char *file_name, int pop, bool strict);
int help_index( navh_eHelpFile file_type, char *file_name, int pop);
pwr_tStatus search( char *str, bool strict);
pwr_tStatus search_next();
pwr_tStatus search_next_reverse();
pwr_tStatus search_exec( bool reverse);
};
class HItem {
......@@ -135,6 +144,7 @@ class HItem {
{};
virtual int doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav,
double x, double y) { return 1;}
virtual bool search( char *str, bool strict) { return false;}
xhelpnav_eHItemType type;
brow_tNode node;
};
......@@ -145,10 +155,31 @@ class HItemHeader : public HItem {
brow_tNode dest, flow_eDest dest_code);
};
class HItemHelpLine : public HItem {
public:
HItemHelpLine( XHelpNavBrow *brow, char *item_name,
brow_tNode dest, flow_eDest dest_code);
};
class HItemHelpImage : public HItem {
public:
HItemHelpImage( XHelpNavBrow *brow, char *item_name, brow_tNodeClass nc,
char *item_link, char *item_bookmark,
char *item_file_name, navh_eHelpFile help_file_type,
brow_tNode dest, flow_eDest dest_code);
int doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav,
double x, double y);
char link[200];
char bookmark[80];
char file_name[80];
navh_eHelpFile file_type;
};
class HItemHeaderLarge : public HItem {
public:
HItemHeaderLarge( XHelpNavBrow *brow, char *item_name, char *title,
brow_tNode dest, flow_eDest dest_code);
bool search( char *str, bool strict);
};
class HItemHelp : public HItem {
......@@ -158,6 +189,7 @@ class HItemHelp : public HItem {
char *item_file_name, navh_eHelpFile help_file_type, int help_index, brow_tNode dest, flow_eDest dest_code);
int doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav,
double x, double y);
bool search( char *str, bool strict);
char link[200];
char bookmark[80];
char file_name[80];
......@@ -173,6 +205,7 @@ class HItemHelpBold : public HItem {
brow_tNode dest, flow_eDest dest_code);
int doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav,
double x, double y);
bool search( char *str, bool strict);
char link[200];
char bookmark[80];
char file_name[80];
......@@ -185,6 +218,7 @@ class HItemHelpHeader : public HItem {
HItemHelpHeader( XHelpNavBrow *brow, char *item_name, char *title, bool base,
brow_tNode dest, flow_eDest dest_code);
int doubleclick_action( XHelpNavBrow *brow, XHelpNav *xhelpnav, double x, double y);
bool search( char *str, bool strict);
};
......
......@@ -17,6 +17,8 @@
! The object is used in the Plant Configuration in a way
! analog to the $NodeHier object in the Node
! Configuration.
! @image orm_en1-166.gif
! Schematic Plant Configuration Showing Two Plants
!
! Is created in the development environment by means of
! the Configuration Editor.
......
This diff is collapsed.
......@@ -108,8 +108,8 @@ int goen_create_nodetype_m0(
char annot_str[3][80];
int annot_nr[3];
int annot_count;
double annot_width;
double annot_height;
double annot_width = 0;
double annot_height = 0;
float classname_width;
flow_tNodeClass nc_pid;
char name[80];
......
......@@ -922,7 +922,12 @@ pwr_tStatus
ldh_NameToObjid(ldh_tSession session, pwr_tOid *oid, char *name)
{
wb_session *sp = (wb_session *)session;
pwr_tStatus sts;
if ( strncmp( name, "_O", 2) == 0) {
sts = cdh_StringToObjid( name, oid);
if ( ODD(sts)) return sts;
}
wb_object o = sp->object(name);
if (!o) return o.sts();
......
......@@ -4585,7 +4585,7 @@ int vldh_node_create_spec (
**********************************************************/
else if ( node->ln.classid == vldh_class( ldhses, VLDH_CLASS_RESET_SO))
{
unsigned long order_objdid = 0;
pwr_tOid order_objdid = pwr_cNOid;
sts = ldh_SetObjectPar( ldhses,
node->ln.object_did,
......
......@@ -429,7 +429,7 @@ WAtt::WAtt(
ldhses(wa_ldhses), objid(wa_objid), editmode(wa_editmode),
input_open(0), input_multiline(0),
close_cb(0), redraw_cb(0), client_data(0),
set_focus_disabled(0)
set_focus_disabled(0), value_current_recall(0)
{
char uid_filename[120] = {"pwr_exe:wb_watt.uid"};
char *uid_filename_p = uid_filename;
......
......@@ -46,7 +46,8 @@ typedef enum {
flow_eObjectType_Pixmap,
flow_eObjectType_AnnotPixmap,
flow_eObjectType_Radiobutton,
flow_eObjectType_Frame
flow_eObjectType_Frame,
flow_eObjectType_Image
} flow_eObjectType;
typedef enum {
......
......@@ -3,6 +3,7 @@
#include <iostream.h>
#include <math.h>
#include <stdlib.h>
#include "flow_annot.h"
#include "flow_node.h"
......
......@@ -14,6 +14,7 @@
#include "flow_text.h"
#include "flow_pixmap.h"
#include "flow_annotpixmap.h"
#include "flow_image.h"
#include "flow_pushbutton.h"
#include "flow_array_elem.h"
#include "flow_array.h"
......@@ -341,6 +342,13 @@ void brow_AddArc( brow_tNodeClass nc, double x1, double y1,
((FlowNodeClass *)nc)->insert( arc);
}
void brow_AddImage( brow_tNodeClass nc, char *imagefile, double x, double y)
{
FlowImage *image = new FlowImage( ((FlowNodeClass *)nc)->ctx, imagefile, x, y);
((FlowNodeClass *)nc)->insert( image);
}
void brow_AddText( brow_tNodeClass nc, char *text_str, double x, double y,
flow_eDrawType draw_type, int text_size)
{
......
......@@ -117,6 +117,7 @@ void brow_AddLine( brow_tNodeClass nc, double x1, double y1,
void brow_AddArc( brow_tNodeClass nc, double x1, double y1,
double x2, double y2, int angel1, int angel2,
flow_eDrawType draw_type, int line_width);
void brow_AddImage( brow_tNodeClass nc, char *imagefile, double x, double y);
void brow_AddText( brow_tNodeClass nc, char *text_str, double x, double y,
flow_eDrawType draw_type, int text_size);
void brow_AddAnnot( brow_tNodeClass nc, double x, double y, int number,
......
......@@ -25,32 +25,6 @@
#define DRAW_PRESS_PIX 9
typedef struct {
Widget toplevel;
Widget nav_shell;
Widget nav_toplevel;
XtAppContext app_ctx;
Display *display;
Window window;
Window nav_window;
Screen *screen;
GC gc;
GC gc_erase;
GC gc_inverse;
GC gc_yellow;
GC gc_green;
GC gcs[flow_eDrawType__][DRAW_TYPE_SIZE];
XFontStruct *font_struct[draw_eFont__][DRAW_FONT_SIZE];
Font font[draw_eFont__][DRAW_FONT_SIZE];
int cursors[draw_eCursor__];
int ef;
int (*event_handler)(flow_eEvent event, int x, int y, int w, int h);
int (*event_handler_nav)(flow_eEvent event, int x, int y);
unsigned long background;
XtIntervalId timer_id;
int click_sensitivity;
} draw_sCtx, *draw_tCtx;
typedef struct {
Widget w;
int x;
......@@ -515,6 +489,10 @@ int flow_draw_init(
flow_create_cursor( draw_ctx);
#if defined IMLIB
draw_ctx->imlib = Imlib_init( draw_ctx->display);
#endif
init_proc( toplevel, ctx, client_data);
return 1;
......@@ -1509,6 +1487,30 @@ int flow_draw_fill_rect( FlowCtx *ctx, int x, int y, int w, int h,
return 1;
}
int flow_draw_image( FlowCtx *ctx, int x, int y, int width, int height,
Pixmap pixmap, Pixmap clip_mask)
{
draw_tCtx draw_ctx;
if ( ctx->nodraw) return 1;
if ( width == 0 || height == 0)
return 1;
draw_ctx = (draw_tCtx) ctx->draw_ctx;
if ( clip_mask)
flow_set_image_clip_mask( ctx, clip_mask, x, y);
XCopyArea( draw_ctx->display, pixmap, draw_ctx->window,
draw_ctx->gcs[flow_eDrawType_Line][0],
0, 0, width, height, x, y);
if ( clip_mask)
flow_reset_image_clip_mask( ctx);
return 1;
}
void flow_draw_clear( FlowCtx *ctx)
{
draw_tCtx draw_ctx;
......@@ -1909,3 +1911,22 @@ void flow_draw_set_click_sensitivity( FlowCtx *ctx, int value)
draw_ctx->click_sensitivity = value;
}
void flow_set_image_clip_mask( FlowCtx *ctx, Pixmap pixmap, int x, int y)
{
draw_tCtx draw_ctx = (draw_tCtx) ctx->draw_ctx;
XSetClipMask( draw_ctx->display, draw_ctx->gcs[flow_eDrawType_Line][0],
pixmap);
XSetClipOrigin( draw_ctx->display, draw_ctx->gcs[flow_eDrawType_Line][0], x, y);
}
void flow_reset_image_clip_mask( FlowCtx *ctx)
{
draw_tCtx draw_ctx = (draw_tCtx) ctx->draw_ctx;
XSetClipMask( draw_ctx->display, draw_ctx->gcs[flow_eDrawType_Line][0],
None);
XSetClipOrigin( draw_ctx->display, draw_ctx->gcs[flow_eDrawType_Line][0], 0, 0);
}
#ifndef flow_draw_h
#define flow_draw_h
#include <stdlib.h>
#include <Xm/Xm.h>
#include <Mrm/MrmPublic.h>
#ifndef _XtIntrinsic_h
......@@ -9,6 +11,52 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#if defined OS_LINUX
#define IMLIB 1
#endif
#if defined IMLIB
# if defined OS_LYNX
# define __NO_INCLUDE_WARN__ 1
# endif
# include <X11/extensions/shape.h>
# include <Imlib.h>
# if defined OS_LYNX
# undef __NO_INCLUDE_WARN__
# endif
#else
typedef void *ImlibData;
typedef void *ImlibImage;
#endif
typedef struct {
Widget toplevel;
Widget nav_shell;
Widget nav_toplevel;
XtAppContext app_ctx;
Display *display;
Window window;
Window nav_window;
Screen *screen;
GC gc;
GC gc_erase;
GC gc_inverse;
GC gc_yellow;
GC gc_green;
GC gcs[flow_eDrawType__][DRAW_TYPE_SIZE];
XFontStruct *font_struct[draw_eFont__][DRAW_FONT_SIZE];
Font font[draw_eFont__][DRAW_FONT_SIZE];
int cursors[draw_eCursor__];
int ef;
int (*event_handler)(flow_eEvent event, int x, int y, int w, int h);
int (*event_handler_nav)(flow_eEvent event, int x, int y);
unsigned long background;
XtIntervalId timer_id;
int click_sensitivity;
ImlibData *imlib;
} draw_sCtx, *draw_tCtx;
int flow_draw_init(
Widget toplevel,
void **flow_ctx,
......@@ -78,6 +126,8 @@ int flow_draw_nav_text_erase( FlowCtx *ctx, int x, int y, char *text, int len,
flow_eDrawType gc_type, int idx, int line);
int flow_draw_fill_rect( FlowCtx *ctx, int x, int y, int width, int height,
flow_eDrawType gc_type);
int flow_draw_image( FlowCtx *ctx, int x, int y, int width, int height,
Pixmap pixmap, Pixmap clip_mask);
int flow_draw_pixmaps_create( FlowCtx *ctx, flow_sPixmapData *pixmap_data,
void **pixmaps);
void flow_draw_pixmaps_delete( FlowCtx *ctx, void *pixmaps);
......@@ -122,5 +172,7 @@ int flow_draw_change_ctx(
void flow_set_inputfocus( FlowCtx *ctx);
void flow_set_widget_inputfocus( Widget w);
void flow_draw_set_click_sensitivity( FlowCtx *ctx, int value);
void flow_set_image_clip_mask( FlowCtx *ctx, Pixmap pixmap, int x, int y);
void flow_reset_image_clip_mask( FlowCtx *ctx);
#endif
......@@ -96,6 +96,7 @@ void FlowNodeClass::draw_inverse( FlowPoint *pos, int hot, void *node)
switch ( a.a[i]->type())
{
case flow_eObjectType_Radiobutton:
case flow_eObjectType_Image:
a.a[i]->draw( pos, 0, hot, node);
break;
default:
......
#ifndef flow_std_h
#define flow_std_h
#include <stdlib.h>
#if defined __cplusplus
#if defined OS_VMS && defined __ALPHA
# pragma message disable (NOSIMPINT,EXTROUENCUNNOBJ)
......
......@@ -87,3 +87,7 @@ k_Enter_Value : "Enter Value";
k_Message : "Message";
k_Value_input : "Value input";
! module xhelp
c_SearchNext : "SearchNext";
c_SearchPrevious : "SearchPrevious";
......@@ -18,11 +18,18 @@ identifier
xhelp_ctx;
procedure
xhelp_activate_exit(integer);
xhelp_activate_search(integer);
xhelp_activate_searchnext(integer);
xhelp_activate_searchprevious(integer);
xhelp_activate_zoom_in(integer);
xhelp_activate_zoom_out(integer);
xhelp_activate_zoom_reset(integer);
xhelp_activate_help(integer);
xhelp_create_xhelpnav_form(integer);
xhelp_create_india_label(integer);
xhelp_create_india_text(integer);
xhelp_activate_india_ok(integer);
xhelp_activate_india_cancel(integer);
value
menu_font : font ('-*-Helvetica-Bold-R-Normal--12-*-*-*-P-*-ISO8859-1');
......@@ -73,6 +80,7 @@ object xhelp_menu : XmMenuBar
controls
{
XmCascadeButton file_entry;
XmCascadeButton edit_entry;
XmCascadeButton view_entry;
XmCascadeButton help_entry;
};
......@@ -142,6 +150,69 @@ object functions_entry : XmCascadeButton
};
object edit_entry : XmCascadeButton
{
arguments
{
XmNlabelString = c_Edit;
XmNfontList = menu_font;
};
controls
{
XmPulldownMenu
{
controls
{
XmPushButton
{
arguments
{
XmNlabelString = c_Search;
XmNmnemonic = keysym('S');
XmNaccelerator = "Ctrl<Key>F";
XmNacceleratorText = compound_string('Ctrl+F');
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure xhelp_activate_search(xhelp_ctx);
};
};
XmPushButton
{
arguments
{
XmNlabelString = c_SearchNext;
XmNmnemonic = keysym('N');
XmNaccelerator = "Ctrl<Key>G";
XmNacceleratorText = compound_string('Ctrl+G');
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure xhelp_activate_searchnext(xhelp_ctx);
};
};
XmPushButton
{
arguments
{
XmNlabelString = c_SearchPrevious;
XmNmnemonic = keysym('P');
XmNaccelerator = "Ctrl<Key>R";
XmNacceleratorText = compound_string('Ctrl+R');
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure xhelp_activate_searchprevious(xhelp_ctx);
};
};
};
};
};
};
object view_entry : XmCascadeButton
{
arguments
......@@ -253,6 +324,93 @@ object xhelpnav_form : XmPanedWindow
};
};
!
!-----------------------------------------------------------------
!
! Input Dialog box
!
!________________________________________________________________
object input_dialog : XmFormDialog
{
arguments
{
XmNnoResize = true;
XmNwidth = 400;
XmNheight = 150;
XmNdefaultPosition = true;
XmNautoUnmanage = false;
XmNdialogTitle = "Find";
XmNdefaultButton = india_ok;
XmNbuttonFontList = menu_font;
XmNlabelFontList = menu_font;
XmNtextFontList = menu_font;
};
controls
{
XmLabel india_label;
XmTextField india_text;
XmPushButton india_ok;
XmPushButton india_cancel;
};
};
object india_label : XmLabel
{
arguments
{
XmNx = 10;
XmNy = 10;
XmNlabelString = "";
};
callbacks
{
MrmNcreateCallback = procedure xhelp_create_india_label( xhelp_ctx);
};
};
object india_text : XmTextField
{
arguments
{
XmNx = 150;
XmNy = 10;
};
callbacks
{
MrmNcreateCallback = procedure xhelp_create_india_text( xhelp_ctx);
};
};
object india_ok : XmPushButton
{
arguments
{
XmNwidth = 80;
XmNx = 20;
XmNy = 100;
XmNlabelString = "OK";
};
callbacks
{
XmNactivateCallback = procedure xhelp_activate_india_ok( xhelp_ctx);
};
};
object india_cancel : XmPushButton
{
arguments
{
XmNwidth = 80;
XmNx = 280;
XmNy = 100;
XmNlabelString = "Cancel";
};
callbacks
{
XmNactivateCallback = procedure xhelp_activate_india_cancel( xhelp_ctx);
};
};
end module;
......
......@@ -87,6 +87,10 @@ k_Enter_Value : "Ange v
k_Message : "Meddelande";
k_Value_input : "Vrde inmatning";
! module xhelp
c_SearchNext : "SkNsta";
c_SearchPrevious : "SkFregende";
......
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