Commit 14e57a76 authored by claes's avatar claes

Postscript print from xtt

parent 90e4af94
#! /bin/bash
#
FileName="$1"
Color="$2"
Printer="$pwr_rt_print"
ColorPrinter="$pwr_rt_colorprint"
if [ "$Color" == "1" ]; then
if [ -z "$pwr_rt_colorprint" ]; then
Printer=$pwr_rt_print
else
Printer=$pwr_rt_colorprint
fi
else
if [ -z "$pwr_rt_print" ]; then
Printer=$pwr_rt_colorprint
else
Printer=$pwr_rt_print
fi
fi
if [ -z "$Printer" ]; then
echo "Printer is not defined in env 'pwr_rt_print'"
else
echo "Printing $1"
$Printer $1
fi
...@@ -515,7 +515,14 @@ static void xtt_activate_exit( Widget w, Xtt *xtt, XmAnyCallbackStruct *data) ...@@ -515,7 +515,14 @@ static void xtt_activate_exit( Widget w, Xtt *xtt, XmAnyCallbackStruct *data)
static void xtt_activate_print( Widget w, Xtt *xtt, XmAnyCallbackStruct *data) static void xtt_activate_print( Widget w, Xtt *xtt, XmAnyCallbackStruct *data)
{ {
xtt->xnav->print( "pwrp_tmp:xnav.ps"); pwr_tFileName filename;
pwr_tCmd cmd;
dcli_translate_filename( filename, "$pwrp_tmp/xnav.ps");
xtt->xnav->print( filename);
sprintf( cmd, "$pwr_exe/rt_print.sh %s", filename);
system(cmd);
} }
static void xtt_activate_find( Widget w, Xtt *xtt, XmAnyCallbackStruct *data) static void xtt_activate_find( Widget w, Xtt *xtt, XmAnyCallbackStruct *data)
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
extern "C" { extern "C" {
#include "co_cdh.h" #include "co_cdh.h"
#include "co_time.h" #include "co_time.h"
#include "co_dcli.h"
#include "pwr_baseclasses.h" #include "pwr_baseclasses.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_mh.h" #include "rt_mh.h"
...@@ -53,6 +54,9 @@ static void ev_blk_action_inputfocus( Widget w, XmAnyCallbackStruct *data); ...@@ -53,6 +54,9 @@ static void ev_blk_action_inputfocus( Widget w, XmAnyCallbackStruct *data);
static void ev_eve_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data); static void ev_eve_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_ala_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data); static void ev_ala_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_blk_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data); static void ev_blk_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_eve_activate_print( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_ala_activate_print( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_blk_activate_print( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_eve_activate_ack_last( Widget w, Ev *ev, XmAnyCallbackStruct *data); static void ev_eve_activate_ack_last( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_ala_activate_ack_last( Widget w, Ev *ev, XmAnyCallbackStruct *data); static void ev_ala_activate_ack_last( Widget w, Ev *ev, XmAnyCallbackStruct *data);
static void ev_eve_activate_zoom_in( Widget w, Ev *ev, XmAnyCallbackStruct *data); static void ev_eve_activate_zoom_in( Widget w, Ev *ev, XmAnyCallbackStruct *data);
...@@ -151,6 +155,7 @@ Ev::Ev( ...@@ -151,6 +155,7 @@ Ev::Ev(
static MrmRegisterArg reglist[] = { static MrmRegisterArg reglist[] = {
{ "ev_ctx", 0 }, { "ev_ctx", 0 },
{"ev_eve_activate_exit",(caddr_t)ev_eve_activate_exit }, {"ev_eve_activate_exit",(caddr_t)ev_eve_activate_exit },
{"ev_eve_activate_print",(caddr_t)ev_eve_activate_print },
{"ev_eve_activate_ack_last",(caddr_t)ev_eve_activate_ack_last }, {"ev_eve_activate_ack_last",(caddr_t)ev_eve_activate_ack_last },
{"ev_eve_activate_zoom_in",(caddr_t)ev_eve_activate_zoom_in }, {"ev_eve_activate_zoom_in",(caddr_t)ev_eve_activate_zoom_in },
{"ev_eve_activate_zoom_out",(caddr_t)ev_eve_activate_zoom_out }, {"ev_eve_activate_zoom_out",(caddr_t)ev_eve_activate_zoom_out },
...@@ -164,6 +169,7 @@ Ev::Ev( ...@@ -164,6 +169,7 @@ Ev::Ev(
{"ev_eve_activate_helpevent",(caddr_t)ev_eve_activate_helpevent }, {"ev_eve_activate_helpevent",(caddr_t)ev_eve_activate_helpevent },
{"ev_eve_create_form",(caddr_t)ev_eve_create_form }, {"ev_eve_create_form",(caddr_t)ev_eve_create_form },
{"ev_ala_activate_exit",(caddr_t)ev_ala_activate_exit }, {"ev_ala_activate_exit",(caddr_t)ev_ala_activate_exit },
{"ev_ala_activate_print",(caddr_t)ev_ala_activate_print },
{"ev_ala_activate_ack_last",(caddr_t)ev_ala_activate_ack_last }, {"ev_ala_activate_ack_last",(caddr_t)ev_ala_activate_ack_last },
{"ev_ala_activate_zoom_in",(caddr_t)ev_ala_activate_zoom_in }, {"ev_ala_activate_zoom_in",(caddr_t)ev_ala_activate_zoom_in },
{"ev_ala_activate_zoom_out",(caddr_t)ev_ala_activate_zoom_out }, {"ev_ala_activate_zoom_out",(caddr_t)ev_ala_activate_zoom_out },
...@@ -177,6 +183,7 @@ Ev::Ev( ...@@ -177,6 +183,7 @@ Ev::Ev(
{"ev_ala_activate_helpevent",(caddr_t)ev_ala_activate_helpevent }, {"ev_ala_activate_helpevent",(caddr_t)ev_ala_activate_helpevent },
{"ev_ala_create_form",(caddr_t)ev_ala_create_form }, {"ev_ala_create_form",(caddr_t)ev_ala_create_form },
{"ev_blk_activate_exit",(caddr_t)ev_blk_activate_exit }, {"ev_blk_activate_exit",(caddr_t)ev_blk_activate_exit },
{"ev_blk_activate_print",(caddr_t)ev_blk_activate_print },
{"ev_blk_activate_zoom_in",(caddr_t)ev_blk_activate_zoom_in }, {"ev_blk_activate_zoom_in",(caddr_t)ev_blk_activate_zoom_in },
{"ev_blk_activate_zoom_out",(caddr_t)ev_blk_activate_zoom_out }, {"ev_blk_activate_zoom_out",(caddr_t)ev_blk_activate_zoom_out },
{"ev_blk_activate_zoom_reset",(caddr_t)ev_blk_activate_zoom_reset }, {"ev_blk_activate_zoom_reset",(caddr_t)ev_blk_activate_zoom_reset },
...@@ -557,6 +564,42 @@ static void ev_blk_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data) ...@@ -557,6 +564,42 @@ static void ev_blk_activate_exit( Widget w, Ev *ev, XmAnyCallbackStruct *data)
ev->blk_displayed = 0; ev->blk_displayed = 0;
} }
static void ev_eve_activate_print( Widget w, Ev *ev, XmAnyCallbackStruct *data)
{
pwr_tFileName filename;
pwr_tCmd cmd;
dcli_translate_filename( filename, "$pwrp_tmp/xnav.ps");
ev->eve->print( filename);
sprintf( cmd, "$pwr_exe/rt_print.sh %s", filename);
system(cmd);
}
static void ev_ala_activate_print( Widget w, Ev *ev, XmAnyCallbackStruct *data)
{
pwr_tFileName filename;
pwr_tCmd cmd;
dcli_translate_filename( filename, "$pwrp_tmp/xnav.ps");
ev->ala->print( filename);
sprintf( cmd, "$pwr_exe/rt_print.sh %s", filename);
system(cmd);
}
static void ev_blk_activate_print( Widget w, Ev *ev, XmAnyCallbackStruct *data)
{
pwr_tFileName filename;
pwr_tCmd cmd;
dcli_translate_filename( filename, "$pwrp_tmp/xnav.ps");
ev->blk->print( filename);
sprintf( cmd, "$pwr_exe/rt_print.sh %s", filename);
system(cmd);
}
static void ev_eve_activate_ack_last( Widget w, Ev *ev, XmAnyCallbackStruct *data) static void ev_eve_activate_ack_last( Widget w, Ev *ev, XmAnyCallbackStruct *data)
{ {
mh_sEventId *id; mh_sEventId *id;
......
...@@ -769,6 +769,11 @@ void EvList::event_return( mh_sReturn *msg) ...@@ -769,6 +769,11 @@ void EvList::event_return( mh_sReturn *msg)
} }
} }
void EvList::print( char *filename)
{
brow_Print( brow->ctx, filename);
}
void EvList::event_clear_alarmlist( pwr_tNodeIndex nix) void EvList::event_clear_alarmlist( pwr_tNodeIndex nix)
{ {
int i; int i;
......
...@@ -177,6 +177,7 @@ class EvList { ...@@ -177,6 +177,7 @@ class EvList {
int get_selected_event( char *eventname); int get_selected_event( char *eventname);
int get_destination( pwr_tTime time, void **dest); int get_destination( pwr_tTime time, void **dest);
void block_remove(); void block_remove();
void print( char *filename);
}; };
class ItemAlarm { class ItemAlarm {
......
...@@ -29,6 +29,7 @@ extern "C" { ...@@ -29,6 +29,7 @@ extern "C" {
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_gdh_msg.h" #include "rt_gdh_msg.h"
#include "co_cdh.h" #include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h" #include "co_time.h"
#include "co_mrm_util.h" #include "co_mrm_util.h"
} }
...@@ -376,6 +377,18 @@ void ge_pop( ge_tCtx gectx) ...@@ -376,6 +377,18 @@ void ge_pop( ge_tCtx gectx)
flow_MapWidget( gectx->toplevel); flow_MapWidget( gectx->toplevel);
} }
void ge_print( ge_tCtx gectx)
{
pwr_tFileName filename;
pwr_tCmd cmd;
dcli_translate_filename( filename, "$pwrp_tmp/graph.ps");
((Graph *)gectx->graph)->print( filename);
sprintf( cmd, "$pwr_exe/rt_print.sh %s 1", filename);
system(cmd);
}
void ge_swap( ge_tCtx gectx, int mode) void ge_swap( ge_tCtx gectx, int mode)
{ {
((Graph *)gectx->graph)->swap( mode); ((Graph *)gectx->graph)->swap( mode);
......
...@@ -57,6 +57,7 @@ typedef struct ge_sCtx { ...@@ -57,6 +57,7 @@ typedef struct ge_sCtx {
} *ge_tCtx; } *ge_tCtx;
void ge_pop( ge_tCtx gectx); void ge_pop( ge_tCtx gectx);
void ge_print( ge_tCtx gectx);
int ge_set_object_focus( ge_tCtx gectx, char *name, int empty); int ge_set_object_focus( ge_tCtx gectx, char *name, int empty);
int ge_set_folder_index( ge_tCtx gectx, char *name, int idx); int ge_set_folder_index( ge_tCtx gectx, char *name, int idx);
void ge_swap( ge_tCtx gectx, int mode); void ge_swap( ge_tCtx gectx, int mode);
......
...@@ -64,6 +64,8 @@ static void hist_action_inputfocus( Widget w, XmAnyCallbackStruct *data); ...@@ -64,6 +64,8 @@ static void hist_action_inputfocus( Widget w, XmAnyCallbackStruct *data);
static void hist_activate_exit( Widget w, Hist *histOP, XmAnyCallbackStruct *data); static void hist_activate_exit( Widget w, Hist *histOP, XmAnyCallbackStruct *data);
static void hist_activate_print( Widget w, Hist *histOP, XmAnyCallbackStruct *data);
static void hist_activate_zoom_in( Widget w, Hist *histOP, XmAnyCallbackStruct *data); static void hist_activate_zoom_in( Widget w, Hist *histOP, XmAnyCallbackStruct *data);
static void hist_activate_zoom_out( Widget w, Hist *histOP, XmAnyCallbackStruct *data); static void hist_activate_zoom_out( Widget w, Hist *histOP, XmAnyCallbackStruct *data);
...@@ -188,6 +190,7 @@ Hist::Hist( ...@@ -188,6 +190,7 @@ Hist::Hist(
static MrmRegisterArg reglist[] = { static MrmRegisterArg reglist[] = {
{ "hist_ctx", 0 }, { "hist_ctx", 0 },
{"hist_activate_exit",(caddr_t)hist_activate_exit }, {"hist_activate_exit",(caddr_t)hist_activate_exit },
{"hist_activate_print",(caddr_t)hist_activate_print },
{"hist_activate_zoom_in",(caddr_t)hist_activate_zoom_in }, {"hist_activate_zoom_in",(caddr_t)hist_activate_zoom_in },
{"hist_activate_zoom_out",(caddr_t)hist_activate_zoom_out }, {"hist_activate_zoom_out",(caddr_t)hist_activate_zoom_out },
{"hist_activate_zoom_reset",(caddr_t)hist_activate_zoom_reset }, {"hist_activate_zoom_reset",(caddr_t)hist_activate_zoom_reset },
...@@ -431,6 +434,14 @@ static void hist_activate_exit( Widget w, Hist *histOP, XmAnyCallbackStruct *dat ...@@ -431,6 +434,14 @@ static void hist_activate_exit( Widget w, Hist *histOP, XmAnyCallbackStruct *dat
//flow_UnmapWidget( histOP->parent_wid_hist); //flow_UnmapWidget( histOP->parent_wid_hist);
} }
static void hist_activate_print( Widget w, Hist *histOP, XmAnyCallbackStruct *data)
{
char filename[200];
dcli_translate_filename( filename, "$pwrp_tmp/xnav.ps");
histOP->hist->print( filename);
}
static void hist_activate_zoom_in( Widget w, Hist *histOP, XmAnyCallbackStruct *data) static void hist_activate_zoom_in( Widget w, Hist *histOP, XmAnyCallbackStruct *data)
{ {
histOP->hist->zoom( 1.2); histOP->hist->zoom( 1.2);
......
...@@ -619,7 +619,7 @@ int ItemBaseAttr::open_children( XNavBrow *brow, double x, double y) ...@@ -619,7 +619,7 @@ int ItemBaseAttr::open_children( XNavBrow *brow, double x, double y)
} }
free( (char *)vd); free( (char *)vd);
} }
else { else if ( type_id == pwr_eType_Mask) {
gdh_sBitDef *bd; gdh_sBitDef *bd;
int rows; int rows;
...@@ -637,6 +637,8 @@ int ItemBaseAttr::open_children( XNavBrow *brow, double x, double y) ...@@ -637,6 +637,8 @@ int ItemBaseAttr::open_children( XNavBrow *brow, double x, double y)
} }
free( (char *)bd); free( (char *)bd);
} }
else
return 0;
brow_SetOpen( node, xnav_mOpen_Children); brow_SetOpen( node, xnav_mOpen_Children);
brow_SetAnnotPixmap( node, 1, brow->pixmap_openmap); brow_SetAnnotPixmap( node, 1, brow->pixmap_openmap);
......
...@@ -101,6 +101,7 @@ int xnav_get_trace_attr( pwr_sAttrRef *arp, char *attr) ...@@ -101,6 +101,7 @@ int xnav_get_trace_attr( pwr_sAttrRef *arp, char *attr)
case pwr_cClass_Ii: case pwr_cClass_Ii:
case pwr_cClass_Io: case pwr_cClass_Io:
case pwr_cClass_Iv: case pwr_cClass_Iv:
case pwr_cClass_Sv:
strcpy( attr, "ActualValue"); strcpy( attr, "ActualValue");
break; break;
case pwr_cClass_ChanDi: case pwr_cClass_ChanDi:
...@@ -158,6 +159,13 @@ int xnav_get_trace_attr( pwr_sAttrRef *arp, char *attr) ...@@ -158,6 +159,13 @@ int xnav_get_trace_attr( pwr_sAttrRef *arp, char *attr)
case pwr_cClass_inv : case pwr_cClass_inv :
case pwr_cClass_waith : case pwr_cClass_waith :
case pwr_cClass_darithm : case pwr_cClass_darithm :
case pwr_cClass_Even :
case pwr_cClass_Odd :
case pwr_cClass_Equal :
case pwr_cClass_GreaterEqual :
case pwr_cClass_GreaterThan :
case pwr_cClass_LessEqual :
case pwr_cClass_LessThan :
strcpy( attr, "Status"); strcpy( attr, "Status");
break; break;
case pwr_cClass_DSup : case pwr_cClass_DSup :
...@@ -177,6 +185,35 @@ int xnav_get_trace_attr( pwr_sAttrRef *arp, char *attr) ...@@ -177,6 +185,35 @@ int xnav_get_trace_attr( pwr_sAttrRef *arp, char *attr)
case pwr_cClass_adelay : case pwr_cClass_adelay :
case pwr_cClass_aarithm : case pwr_cClass_aarithm :
case pwr_cClass_timint : case pwr_cClass_timint :
case pwr_cClass_IAbs :
case pwr_cClass_IAdd :
case pwr_cClass_IDiv :
case pwr_cClass_ILimit :
case pwr_cClass_IMax :
case pwr_cClass_IMin :
case pwr_cClass_IMul :
case pwr_cClass_ISel :
case pwr_cClass_ISub :
case pwr_cClass_IMux :
case pwr_cClass_Add :
case pwr_cClass_Div :
case pwr_cClass_Mul :
case pwr_cClass_Max :
case pwr_cClass_Min :
case pwr_cClass_Mux :
case pwr_cClass_Sub :
case pwr_cClass_Sin :
case pwr_cClass_Cos :
case pwr_cClass_Tan :
case pwr_cClass_ASin :
case pwr_cClass_ACos :
case pwr_cClass_ATan :
case pwr_cClass_Exp :
case pwr_cClass_Log :
case pwr_cClass_Ln :
case pwr_cClass_Sqrt :
case pwr_cClass_Abs :
case pwr_cClass_Mod :
strcpy( attr, "ActVal"); strcpy( attr, "ActVal");
break; break;
case pwr_cClass_maxmin : case pwr_cClass_maxmin :
......
...@@ -155,6 +155,8 @@ static int xnav_call_func( void *client_data, ...@@ -155,6 +155,8 @@ static int xnav_call_func( void *client_data,
void *client_flag); void *client_flag);
static int xnav_check_func( void *client_data, static int xnav_check_func( void *client_data,
void *client_flag); void *client_flag);
static int xnav_print_func( void *client_data,
void *client_flag);
dcli_tCmdTable xnav_command_table[] = { dcli_tCmdTable xnav_command_table[] = {
{ {
...@@ -296,6 +298,13 @@ dcli_tCmdTable xnav_command_table[] = { ...@@ -296,6 +298,13 @@ dcli_tCmdTable xnav_command_table[] = {
&xnav_check_func, &xnav_check_func,
{ "dcli_arg1", "/METHOD", "/OBJECT", ""} { "dcli_arg1", "/METHOD", "/OBJECT", ""}
}, },
{
"PRINT",
&xnav_print_func,
{ "dcli_arg1", "dcli_arg2", "/NAME", "/FILE",
"/OBJECT",
""}
},
{"",}}; {"",}};
...@@ -4235,6 +4244,48 @@ static int xnav_check_func( void *client_data, ...@@ -4235,6 +4244,48 @@ static int xnav_check_func( void *client_data,
} }
static int xnav_print_func(void *client_data,
void *client_flag)
{
XNav *xnav = (XNav *)client_data;
char arg1_str[80];
int arg1_sts;
arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str);
if ( strncmp( arg1_str, "GRAPH", strlen( arg1_str)) == 0)
{
char file_str[80];
char name_str[80] = "";
ge_tCtx gectx;
char fname[200];
if ( ODD( dcli_get_qualifier( "dcli_arg2", file_str))) {
if ( file_str[0] == '/') {
xnav->message('E', "Syntax error");
return XNAV__HOLDCOMMAND;
}
}
else if ( ODD( dcli_get_qualifier( "/FILE", file_str))) {
// Get base class graphs on $pwr_exe
cdh_ToLower( fname, file_str);
}
if ( xnav->appl.find( applist_eType_Graph, file_str, name_str,
(void **) &gectx))
ge_print( gectx);
else {
xnav->message('E', "Graph not found");
return XNAV__HOLDCOMMAND;
}
}
else
xnav->message('E',"Syntax error");
return XNAV__SUCCESS;
}
int XNav::show_database() int XNav::show_database()
{ {
int sts; int sts;
......
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