Commit 10a38b30 authored by Claes Sjofors's avatar Claes Sjofors

Print dialog in trace and plc editor

parent 419a26a1
...@@ -144,6 +144,16 @@ void WFoeGtk::activate_print( GtkWidget *w, gpointer data) ...@@ -144,6 +144,16 @@ void WFoeGtk::activate_print( GtkWidget *w, gpointer data)
foe->activate_print(); foe->activate_print();
} }
// Callback from the menu.
void WFoeGtk::activate_printdialog( GtkWidget *w, gpointer data)
{
WFoe *foe = (WFoe *)data;
pwr_tStatus sts;
CoWowGtk::CreateFlowPrintDialogGtk( "PlcEditor", foe->gre->flow_ctx, flow_eOrientation_Landscape,
1.0, ((WFoeGtk *)foe)->toplevel, &sts);
}
// Callback from the menu. // Callback from the menu.
void WFoeGtk::activate_printoverv( GtkWidget *w, gpointer data) void WFoeGtk::activate_printoverv( GtkWidget *w, gpointer data)
{ {
...@@ -1220,6 +1230,11 @@ pwr_tStatus WFoeGtk::create_window( int x_top, ...@@ -1220,6 +1230,11 @@ pwr_tStatus WFoeGtk::create_window( int x_top,
widgets.save = gtk_image_menu_item_new_from_stock(GTK_STOCK_SAVE, accel_g); widgets.save = gtk_image_menu_item_new_from_stock(GTK_STOCK_SAVE, accel_g);
g_signal_connect(widgets.save, "activate", G_CALLBACK(WFoeGtk::activate_save), this); g_signal_connect(widgets.save, "activate", G_CALLBACK(WFoeGtk::activate_save), this);
// Submenu Print
GtkWidget *file_print_dialog = gtk_menu_item_new_with_mnemonic( "_Print...");
g_signal_connect( file_print_dialog, "activate",
G_CALLBACK(WFoeGtk::activate_printdialog), this);
// Submenu Print // Submenu Print
GtkWidget *file_print_documents = gtk_menu_item_new_with_mnemonic( "_Documents"); GtkWidget *file_print_documents = gtk_menu_item_new_with_mnemonic( "_Documents");
g_signal_connect( file_print_documents, "activate", g_signal_connect( file_print_documents, "activate",
...@@ -1239,6 +1254,7 @@ pwr_tStatus WFoeGtk::create_window( int x_top, ...@@ -1239,6 +1254,7 @@ pwr_tStatus WFoeGtk::create_window( int x_top,
GtkWidget *file_print = gtk_menu_item_new_with_mnemonic( "_Print"); GtkWidget *file_print = gtk_menu_item_new_with_mnemonic( "_Print");
GtkMenu *file_print_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL); GtkMenu *file_print_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_print_menu), file_print_dialog);
gtk_menu_shell_append(GTK_MENU_SHELL(file_print_menu), file_print_documents); gtk_menu_shell_append(GTK_MENU_SHELL(file_print_menu), file_print_documents);
gtk_menu_shell_append(GTK_MENU_SHELL(file_print_menu), file_print_overv); gtk_menu_shell_append(GTK_MENU_SHELL(file_print_menu), file_print_overv);
gtk_menu_shell_append(GTK_MENU_SHELL(file_print_menu), file_print_select); gtk_menu_shell_append(GTK_MENU_SHELL(file_print_menu), file_print_select);
......
...@@ -210,6 +210,7 @@ class WFoeGtk : public WFoe { ...@@ -210,6 +210,7 @@ class WFoeGtk : public WFoe {
static void activate_restoretrace( GtkWidget *w, gpointer data); static void activate_restoretrace( GtkWidget *w, gpointer data);
static void activate_history( GtkWidget *w, gpointer data); static void activate_history( GtkWidget *w, gpointer data);
static void activate_print( GtkWidget *w, gpointer data); static void activate_print( GtkWidget *w, gpointer data);
static void activate_printdialog( GtkWidget *w, gpointer data);
static void activate_printoverv( GtkWidget *w, gpointer data); static void activate_printoverv( GtkWidget *w, gpointer data);
static void activate_printselect( GtkWidget *w, gpointer data); static void activate_printselect( GtkWidget *w, gpointer data);
static void activate_printpdf( GtkWidget *w, gpointer data); static void activate_printpdf( GtkWidget *w, gpointer data);
......
...@@ -211,7 +211,7 @@ void WdaMotif::activate_exit( Widget w, WdaMotif *wda, XmAnyCallbackStruct *data ...@@ -211,7 +211,7 @@ void WdaMotif::activate_exit( Widget w, WdaMotif *wda, XmAnyCallbackStruct *data
} }
void WdaMotif::activate_print( Widget w, WdaMotif *wda, XmAnyCallbackStruct *data) void WdaMotif::activate_print( Widget w, WdaMotif *wda, XmAnyCallbackStruct *data)
{ {
wda->print(); ((Wda *)wda)->activate_print();
} }
void WdaMotif::activate_setclass( Widget w, WdaMotif *wda, XmAnyCallbackStruct *data) void WdaMotif::activate_setclass( Widget w, WdaMotif *wda, XmAnyCallbackStruct *data)
{ {
......
...@@ -251,6 +251,7 @@ void WNavMotif::print( const char *title) ...@@ -251,6 +251,7 @@ void WNavMotif::print( const char *title)
{ {
char filename[80] = "pwrp_tmp:wnav.ps"; char filename[80] = "pwrp_tmp:wnav.ps";
char cmd[200]; char cmd[200];
int sts;
dcli_translate_filename( filename, filename); dcli_translate_filename( filename, filename);
brow_Print( brow->ctx, filename); brow_Print( brow->ctx, filename);
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "co_api.h" #include "co_api.h"
#include "co_lng.h" #include "co_lng.h"
#include "co_wow_msg.h" #include "co_wow_msg.h"
#include "flow_api.h"
#include "flow_browapi.h" #include "flow_browapi.h"
#define WOW_MAXNAMES 400 #define WOW_MAXNAMES 400
...@@ -64,7 +65,7 @@ typedef struct { ...@@ -64,7 +65,7 @@ typedef struct {
typedef struct { typedef struct {
char title[80]; char title[80];
brow_tCtx brow_ctx; flow_tCtx flow_ctx;
flow_eOrientation orientation; flow_eOrientation orientation;
double scale; double scale;
} wow_sPrintData; } wow_sPrintData;
...@@ -1531,18 +1532,18 @@ void CoWowGtk::Wait( float time) ...@@ -1531,18 +1532,18 @@ void CoWowGtk::Wait( float time)
static void begin_print( GtkPrintOperation *operation, static void browprint_begin_print( GtkPrintOperation *operation,
GtkPrintContext *context, GtkPrintContext *context,
gpointer user_data) gpointer user_data)
{ {
wow_sPrintData *print_data = (wow_sPrintData *)user_data; wow_sPrintData *print_data = (wow_sPrintData *)user_data;
int pages; int pages;
brow_PrintGetPages( print_data->brow_ctx, print_data->orientation, print_data->scale, &pages); brow_PrintGetPages( (brow_tCtx)print_data->flow_ctx, print_data->orientation, print_data->scale, &pages);
gtk_print_operation_set_n_pages( operation, pages); gtk_print_operation_set_n_pages( operation, pages);
} }
static void end_print( GtkPrintOperation *operation, static void browprint_end_print( GtkPrintOperation *operation,
GtkPrintContext *context, GtkPrintContext *context,
gpointer user_data) gpointer user_data)
{ {
...@@ -1550,18 +1551,18 @@ static void end_print( GtkPrintOperation *operation, ...@@ -1550,18 +1551,18 @@ static void end_print( GtkPrintOperation *operation,
free( print_data); free( print_data);
} }
static void draw_page( GtkPrintOperation *operation, static void browprint_draw_page( GtkPrintOperation *operation,
GtkPrintContext *context, GtkPrintContext *context,
gint page_nr, gint page_nr,
gpointer user_data) gpointer user_data)
{ {
wow_sPrintData *print_data = (wow_sPrintData *)user_data; wow_sPrintData *print_data = (wow_sPrintData *)user_data;
brow_PrintDrawPage( print_data->brow_ctx, context, print_data->title, page_nr, brow_PrintDrawPage( (brow_tCtx)print_data->flow_ctx, context, print_data->title, page_nr,
print_data->orientation, print_data->scale); print_data->orientation, print_data->scale);
} }
static void request_page_setup( GtkPrintOperation *operation, static void browprint_request_page_setup( GtkPrintOperation *operation,
GtkPrintContext *context, GtkPrintContext *context,
gint page_nr, gint page_nr,
GtkPageSetup *setup, GtkPageSetup *setup,
...@@ -1590,7 +1591,103 @@ void CoWowGtk::CreateBrowPrintDialogGtk( const char *title, void *brow_ctx, int ...@@ -1590,7 +1591,103 @@ void CoWowGtk::CreateBrowPrintDialogGtk( const char *title, void *brow_ctx, int
} }
wow_sPrintData *print_data = (wow_sPrintData *)calloc( 1, sizeof(wow_sPrintData)); wow_sPrintData *print_data = (wow_sPrintData *)calloc( 1, sizeof(wow_sPrintData));
print_data->brow_ctx = (brow_tCtx)brow_ctx; print_data->flow_ctx = (flow_tCtx)brow_ctx;
print_data->orientation = (flow_eOrientation)orientation;
print_data->scale = scale;
strncpy( print_data->title, convert_utf8(title), sizeof(print_data->title));
print = gtk_print_operation_new();
if ( settings)
gtk_print_operation_set_print_settings( print, settings);
else
settings = gtk_print_settings_new();
if ( strcmp( m_default_printer, "") != 0) {
gtk_print_settings_set_printer( settings, m_default_printer);
gtk_print_operation_set_print_settings( print, settings);
}
if ( m_printdialog_disable)
action = GTK_PRINT_OPERATION_ACTION_PRINT;
g_signal_connect( print, "begin_print", G_CALLBACK(browprint_begin_print), print_data);
g_signal_connect( print, "draw_page", G_CALLBACK(browprint_draw_page), print_data);
g_signal_connect( print, "request_page_setup", G_CALLBACK(browprint_request_page_setup), print_data);
g_signal_connect( print, "end_print", G_CALLBACK(browprint_end_print), print_data);
gtk_print_operation_set_allow_async( print, TRUE);
result = gtk_print_operation_run( print, action, GTK_WINDOW(parent_widget), 0);
if ( result == GTK_PRINT_OPERATION_RESULT_APPLY) {
if ( settings)
g_object_unref( settings);
settings = (GtkPrintSettings *)g_object_ref( gtk_print_operation_get_print_settings( print));
}
g_object_unref( print);
*sts = WOW__SUCCESS;
}
static void flowprint_begin_print( GtkPrintOperation *operation,
GtkPrintContext *context,
gpointer user_data)
{
wow_sPrintData *print_data = (wow_sPrintData *)user_data;
int pages;
flow_PrintGetPages( print_data->flow_ctx, print_data->orientation, print_data->scale, &pages);
gtk_print_operation_set_n_pages( operation, pages);
}
static void flowprint_end_print( GtkPrintOperation *operation,
GtkPrintContext *context,
gpointer user_data)
{
wow_sPrintData *print_data = (wow_sPrintData *)user_data;
free( print_data);
}
static void flowprint_draw_page( GtkPrintOperation *operation,
GtkPrintContext *context,
gint page_nr,
gpointer user_data)
{
wow_sPrintData *print_data = (wow_sPrintData *)user_data;
flow_PrintDrawPage( print_data->flow_ctx, context, print_data->title, page_nr,
print_data->orientation, print_data->scale);
}
static void flowprint_request_page_setup( GtkPrintOperation *operation,
GtkPrintContext *context,
gint page_nr,
GtkPageSetup *setup,
gpointer user_data)
{
wow_sPrintData *print_data = (wow_sPrintData *)user_data;
flow_eOrientation orientation;
flow_PrintDrawGetOrientation( print_data->flow_ctx, page_nr, &orientation);
if ( orientation == flow_eOrientation_Landscape)
gtk_page_setup_set_orientation( setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
else
gtk_page_setup_set_orientation( setup, GTK_PAGE_ORIENTATION_PORTRAIT);
}
void CoWowGtk::CreateFlowPrintDialogGtk( const char *title, void *flow_ctx, int orientation,
double scale, void *parent_widget, pwr_tStatus *sts)
{
static GtkPrintSettings *settings = 0;
GtkPrintOperation *print;
GtkPrintOperationResult result;
GtkPrintOperationAction action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
if ( m_printdialog_disable && strcmp( m_default_printer, "") == 0) {
*sts = WOW__PRINTDIALOGDISABLED;
return;
}
wow_sPrintData *print_data = (wow_sPrintData *)calloc( 1, sizeof(wow_sPrintData));
print_data->flow_ctx = (flow_tCtx)flow_ctx;
print_data->orientation = (flow_eOrientation)orientation; print_data->orientation = (flow_eOrientation)orientation;
print_data->scale = scale; print_data->scale = scale;
strncpy( print_data->title, title, sizeof(print_data->title)); strncpy( print_data->title, title, sizeof(print_data->title));
...@@ -1609,10 +1706,10 @@ void CoWowGtk::CreateBrowPrintDialogGtk( const char *title, void *brow_ctx, int ...@@ -1609,10 +1706,10 @@ void CoWowGtk::CreateBrowPrintDialogGtk( const char *title, void *brow_ctx, int
if ( m_printdialog_disable) if ( m_printdialog_disable)
action = GTK_PRINT_OPERATION_ACTION_PRINT; action = GTK_PRINT_OPERATION_ACTION_PRINT;
g_signal_connect( print, "begin_print", G_CALLBACK(begin_print), print_data); g_signal_connect( print, "begin_print", G_CALLBACK(flowprint_begin_print), print_data);
g_signal_connect( print, "draw_page", G_CALLBACK(draw_page), print_data); g_signal_connect( print, "draw_page", G_CALLBACK(flowprint_draw_page), print_data);
g_signal_connect( print, "request_page_setup", G_CALLBACK(request_page_setup), print_data); g_signal_connect( print, "request_page_setup", G_CALLBACK(flowprint_request_page_setup), print_data);
g_signal_connect( print, "end_print", G_CALLBACK(end_print), print_data); g_signal_connect( print, "end_print", G_CALLBACK(flowprint_end_print), print_data);
gtk_print_operation_set_allow_async( print, TRUE); gtk_print_operation_set_allow_async( print, TRUE);
result = gtk_print_operation_run( print, action, GTK_WINDOW(parent_widget), 0); result = gtk_print_operation_run( print, action, GTK_WINDOW(parent_widget), 0);
......
...@@ -153,6 +153,11 @@ class CoWowGtk : public CoWow { ...@@ -153,6 +153,11 @@ class CoWowGtk : public CoWow {
CreateBrowPrintDialogGtk( title, brow_ctx, orientation, scale, parent_widget, sts);} CreateBrowPrintDialogGtk( title, brow_ctx, orientation, scale, parent_widget, sts);}
static void CreateBrowPrintDialogGtk( const char *title, void *brow_ctx, int orientation, static void CreateBrowPrintDialogGtk( const char *title, void *brow_ctx, int orientation,
double scale, void *parent_widget, pwr_tStatus *sts); double scale, void *parent_widget, pwr_tStatus *sts);
void CreateFlowPrintDialog( const char *title, void *flow_ctx, int orientation, double scale,
void *parent_widget, pwr_tStatus *sts) {
CreateFlowPrintDialogGtk( title, flow_ctx, orientation, scale, parent_widget, sts);}
static void CreateFlowPrintDialogGtk( const char *title, void *flow_ctx, int orientation,
double scale, void *parent_widget, pwr_tStatus *sts);
CoWowTimer *timer_new(); CoWowTimer *timer_new();
void SetParent( GtkWidget *parent) { m_parent = parent;} void SetParent( GtkWidget *parent) { m_parent = parent;}
void Wait( float time); void Wait( float time);
......
...@@ -155,6 +155,8 @@ class CoWow { ...@@ -155,6 +155,8 @@ class CoWow {
virtual pwr_tStatus DeleteMenuItem( const char *name, void *menu) { return 0;} virtual pwr_tStatus DeleteMenuItem( const char *name, void *menu) { return 0;}
virtual void CreateBrowPrintDialog( const char *title, void *brow_ctx, int orientation, virtual void CreateBrowPrintDialog( const char *title, void *brow_ctx, int orientation,
double scale, void *parent_widget, pwr_tStatus *sts) {*sts = WOW__NYI;} double scale, void *parent_widget, pwr_tStatus *sts) {*sts = WOW__NYI;}
virtual void CreateFlowPrintDialog( const char *title, void *flow_ctx, int orientation,
double scale, void *parent_widget, pwr_tStatus *sts) {*sts = WOW__NYI;}
static void SetDefaultPrinter( const char *printer) { strncpy( m_default_printer, printer, sizeof(m_default_printer));} static void SetDefaultPrinter( const char *printer) { strncpy( m_default_printer, printer, sizeof(m_default_printer));}
static void DisablePrintDialog() { m_printdialog_disable = true;} static void DisablePrintDialog() { m_printdialog_disable = true;}
static bool PrintDialogIsDisabled() { return m_printdialog_disable;} static bool PrintDialogIsDisabled() { return m_printdialog_disable;}
......
This diff is collapsed.
...@@ -53,7 +53,7 @@ class FlowPrintDrawGtk : public FlowPrintDraw { ...@@ -53,7 +53,7 @@ class FlowPrintDrawGtk : public FlowPrintDraw {
int arc( double x, double y, double width, double height, int angle1, int angle2, int arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight); flow_eDrawType type, double idx, int highlight);
int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight); int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight);
int text( double x, double y, char *text, int len, flow_eDrawType type, double size); int text( double x, double y, char *text, int len, flow_eDrawType type, double size, int line);
int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type); int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type);
int image( double x, double y, double width, double height, flow_tImImage image, flow_eDrawType type); int image( double x, double y, double width, double height, flow_tImImage image, flow_eDrawType type);
int arrow( double x1, double y1, double x2, double y2, int arrow( double x1, double y1, double x2, double y2,
......
...@@ -92,8 +92,8 @@ void FlowAnnot::print( void *pos, void *node, int highlight) ...@@ -92,8 +92,8 @@ void FlowAnnot::print( void *pos, void *node, int highlight)
x = p.print_z_x + ((FlowPoint *)pos)->print_z_x; x = p.print_z_x + ((FlowPoint *)pos)->print_z_x;
ctx->current_print->text( x, ctx->current_print->text( x,
p.print_z_y + ((FlowPoint *)pos)->print_z_y, p.print_z_y + ((FlowPoint *)pos)->print_z_y,
((FlowNode *) node)->annotv[number], ((FlowNode *) node)->annotv[number],
strlen(((FlowNode *) node)->annotv[number]), draw_type, size); strlen(((FlowNode *) node)->annotv[number]), draw_type, size, 0);
break; break;
case flow_eAnnotType_MultiLine: case flow_eAnnotType_MultiLine:
{ {
...@@ -114,7 +114,7 @@ void FlowAnnot::print( void *pos, void *node, int highlight) ...@@ -114,7 +114,7 @@ void FlowAnnot::print( void *pos, void *node, int highlight)
{ {
if ( len) if ( len)
ctx->current_print->text( z_x, z_y + line_cnt * z_h, line, len, ctx->current_print->text( z_x, z_y + line_cnt * z_h, line, len,
draw_type, size); draw_type, size, line_cnt);
len = 0; len = 0;
line = s+1; line = s+1;
line_cnt++; line_cnt++;
...@@ -124,7 +124,7 @@ void FlowAnnot::print( void *pos, void *node, int highlight) ...@@ -124,7 +124,7 @@ void FlowAnnot::print( void *pos, void *node, int highlight)
} }
if ( len) if ( len)
ctx->current_print->text( z_x, z_y + line_cnt * z_h, line, ctx->current_print->text( z_x, z_y + line_cnt * z_h, line,
len, draw_type, size); len, draw_type, size, line_cnt);
break; break;
} }
} }
......
...@@ -490,6 +490,22 @@ int flow_PrintPdfRegion( flow_tCtx ctx, double ll_x, double ll_y, ...@@ -490,6 +490,22 @@ int flow_PrintPdfRegion( flow_tCtx ctx, double ll_x, double ll_y,
return ctx->print_pdf_region( ll_x, ll_y, ur_x, ur_y, filename); return ctx->print_pdf_region( ll_x, ll_y, ur_x, ur_y, filename);
} }
void flow_PrintDrawPage( flow_tCtx ctx, void *context, const char *title, int page,
flow_eOrientation orientation, double scale)
{
ctx->print_draw_page( context, title, page, orientation, scale);
}
void flow_PrintGetPages( flow_tCtx ctx, flow_eOrientation orientation, double scale, int *pages)
{
ctx->print_get_pages( orientation, scale, pages);
}
void flow_PrintDrawGetOrientation( flow_tCtx ctx, int page_nr, flow_eOrientation *orientation)
{
ctx->print_get_orientation( page_nr, orientation);
}
void flow_GetUserData( flow_tObject object, void **user_data) void flow_GetUserData( flow_tObject object, void **user_data)
{ {
((FlowArrayElem *)object)->get_user_data( user_data); ((FlowArrayElem *)object)->get_user_data( user_data);
......
...@@ -43,7 +43,9 @@ ...@@ -43,7 +43,9 @@
extern "C" { extern "C" {
#endif #endif
#ifndef __cplusplus #if defined __cplusplus
#include "flow_ctx.h"
#else
#ifndef flow_browapi_h #ifndef flow_browapi_h
typedef void *FlowCtx; typedef void *FlowCtx;
#endif #endif
...@@ -208,6 +210,10 @@ int flow_PrintRegion( flow_tCtx ctx, double ll_x, double ll_y, ...@@ -208,6 +210,10 @@ int flow_PrintRegion( flow_tCtx ctx, double ll_x, double ll_y,
double ur_x, double ur_y, char *filename); double ur_x, double ur_y, char *filename);
int flow_PrintPdfRegion( flow_tCtx ctx, double ll_x, double ll_y, int flow_PrintPdfRegion( flow_tCtx ctx, double ll_x, double ll_y,
double ur_x, double ur_y, char *filename); double ur_x, double ur_y, char *filename);
void flow_PrintDrawPage( flow_tCtx ctx, void *context, const char *title, int page,
flow_eOrientation orientation, double scale);
void flow_PrintGetPages( flow_tCtx ctx, flow_eOrientation orientation, double scale, int *pages);
void flow_PrintDrawGetOrientation( flow_tCtx ctx, int page_nr, flow_eOrientation *orientation);
void flow_GetUserData( flow_tObject object, void **user_data); void flow_GetUserData( flow_tObject object, void **user_data);
void flow_SetUserData( flow_tObject object, void *user_data); void flow_SetUserData( flow_tObject object, void *user_data);
void flow_GetCtxUserData( flow_tCtx ctx, void **user_data); void flow_GetCtxUserData( flow_tCtx ctx, void **user_data);
......
...@@ -754,6 +754,80 @@ int FlowCtx::print_pdf_region( double ll_x, double ll_y, double ur_x, ...@@ -754,6 +754,80 @@ int FlowCtx::print_pdf_region( double ll_x, double ll_y, double ur_x,
return sts; return sts;
} }
void FlowCtx::print_draw_page( void *context, const char *title, int page,
flow_eOrientation orientation, double scale)
{
double ll_x, ll_y, ur_x, ur_y;
int sts;
if ( a.size() == 0)
return;
int doc_cnt = 0;
int found = 0;
int page_idx;
for ( int i = 0; i < a.a_size; i++) {
if ( a.a[i]->type() == flow_eObjectType_Node &&
((FlowNode *)a.a[i])->nc->group == flow_eNodeGroup_Document) {
doc_cnt++;
if ( doc_cnt == page + 1) {
found = 1;
page_idx = i;
break;
}
}
}
((FlowNode *)a[page_idx])->measure( &ll_x, &ll_y, &ur_x, &ur_y);
current_print = (FlowPrint *)fdraw->print_draw_new( context, title, page, this, 1, &sts);
if ( EVEN(sts)) return;
current_print->print_page( ll_x, ll_y, ur_x, ur_y);
delete current_print;
}
void FlowCtx::print_get_pages( flow_eOrientation orientation, double scale, int *pages)
{
int doc_cnt = 0;
for ( int i = 0; i < a.a_size; i++) {
if ( a.a[i]->type() == flow_eObjectType_Node &&
((FlowNode *)a.a[i])->nc->group == flow_eNodeGroup_Document)
doc_cnt++;
}
*pages = doc_cnt;
}
void FlowCtx::print_get_orientation( int page_nr, flow_eOrientation *orientation)
{
double ll_x, ll_y, ur_x, ur_y;
int doc_cnt = 0;
int found = 0;
int page_idx;
for ( int i = 0; i < a.a_size; i++) {
if ( a.a[i]->type() == flow_eObjectType_Node &&
((FlowNode *)a.a[i])->nc->group == flow_eNodeGroup_Document) {
doc_cnt++;
if ( doc_cnt == page_nr + 1) {
found = 1;
page_idx = i;
break;
}
}
}
if ( !found) {
*orientation = flow_eOrientation_Portrait;
return;
}
((FlowNode *)a[page_idx])->measure( &ll_x, &ll_y, &ur_x, &ur_y);
if ( ur_x - ll_x < ur_y - ll_y)
*orientation = flow_eOrientation_Portrait;
else
*orientation = flow_eOrientation_Landscape;
}
void FlowCtx::nav_clear() void FlowCtx::nav_clear()
{ {
fdraw->nav_clear( this); fdraw->nav_clear( this);
......
...@@ -257,6 +257,11 @@ class FlowCtx { ...@@ -257,6 +257,11 @@ class FlowCtx {
double ur_y, char *filename); double ur_y, char *filename);
int print_pdf_region( double ll_x, double ll_y, double ur_x, int print_pdf_region( double ll_x, double ll_y, double ur_x,
double ur_y, char *filename); double ur_y, char *filename);
void print_draw_page( void *context, const char *title, int page,
flow_eOrientation orientation, double scale);
void print_get_pages( flow_eOrientation orientation, double scale, int *pages);
void print_get_orientation( int page_nr, flow_eOrientation *orientation);
double draw_delta; double draw_delta;
double grafcet_con_delta; double grafcet_con_delta;
int refcon_cnt; int refcon_cnt;
......
...@@ -140,7 +140,7 @@ int FlowPdf::arc( double x, double y, double width, double height, int angle1, i ...@@ -140,7 +140,7 @@ int FlowPdf::arc( double x, double y, double width, double height, int angle1, i
} }
int FlowPdf::text( double x, double y, char *text, int len, flow_eDrawType type, int FlowPdf::text( double x, double y, char *text, int len, flow_eDrawType type,
double size) double size, int line)
{ {
char t[500]; char t[500];
......
...@@ -53,7 +53,7 @@ class FlowPdf : public FlowPrint { ...@@ -53,7 +53,7 @@ class FlowPdf : public FlowPrint {
int arc( double x, double y, double width, double height, int angel1, int angel2, int arc( double x, double y, double width, double height, int angel1, int angel2,
flow_eDrawType type, double idx, int highlight); flow_eDrawType type, double idx, int highlight);
int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight); int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight);
int text( double x, double y, char *text, int len, flow_eDrawType type, double size); int text( double x, double y, char *text, int len, flow_eDrawType type, double size, int line);
int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type); int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type);
int arrow( double x1, double y1, double x2, double y2, int arrow( double x1, double y1, double x2, double y2,
double x3, double y3, flow_eDrawType type, double idx); double x3, double y3, flow_eDrawType type, double idx);
......
...@@ -51,7 +51,7 @@ class FlowPrint { ...@@ -51,7 +51,7 @@ class FlowPrint {
virtual int arc( double x, double y, double width, double height, int angle1, int angle2, virtual int arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight) {return 1;} flow_eDrawType type, double idx, int highlight) {return 1;}
virtual int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight) {return 1;} virtual int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight) {return 1;}
virtual int text( double x, double y, char *text, int len, flow_eDrawType type, double size) {return 1;} virtual int text( double x, double y, char *text, int len, flow_eDrawType type, double size, int line) {return 1;}
virtual int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type) {return 1;} virtual int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type) {return 1;}
virtual int image( double x, double y, double width, double height, flow_tImImage image, flow_eDrawType type) {return 1;} virtual int image( double x, double y, double width, double height, flow_tImImage image, flow_eDrawType type) {return 1;}
virtual int arrow( double x1, double y1, double x2, double y2, virtual int arrow( double x1, double y1, double x2, double y2,
......
...@@ -53,7 +53,7 @@ class FlowPrintDraw : public FlowPrint { ...@@ -53,7 +53,7 @@ class FlowPrintDraw : public FlowPrint {
virtual int arc( double x, double y, double width, double height, int angle1, int angle2, virtual int arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight) {return 1;} flow_eDrawType type, double idx, int highlight) {return 1;}
virtual int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight) {return 1;} virtual int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight) {return 1;}
virtual int text( double x, double y, char *text, int len, flow_eDrawType type, double size) {return 1;} virtual int text( double x, double y, char *text, int len, flow_eDrawType type, double size, int line) {return 1;}
virtual int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type) {return 1;} virtual int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type) {return 1;}
virtual int arrow( double x1, double y1, double x2, double y2, virtual int arrow( double x1, double y1, double x2, double y2,
double x3, double y3, flow_eDrawType type, double idx) {return 1;} double x3, double y3, flow_eDrawType type, double idx) {return 1;}
......
...@@ -286,7 +286,7 @@ int FlowPscript::line( double x1, double y1, double x2, double y2, flow_eDrawTyp ...@@ -286,7 +286,7 @@ int FlowPscript::line( double x1, double y1, double x2, double y2, flow_eDrawTyp
} }
int FlowPscript::text( double x, double y, char *text, int len, flow_eDrawType type, int FlowPscript::text( double x, double y, char *text, int len, flow_eDrawType type,
double size) double size, int line)
{ {
char font[40]; char font[40];
char c; char c;
......
...@@ -51,7 +51,7 @@ class FlowPscript : public FlowPrint { ...@@ -51,7 +51,7 @@ class FlowPscript : public FlowPrint {
int arc( double x, double y, double width, double height, int angle1, int angle2, int arc( double x, double y, double width, double height, int angle1, int angle2,
flow_eDrawType type, double idx, int highlight); flow_eDrawType type, double idx, int highlight);
int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight); int line( double x1, double y1, double x2, double y2, flow_eDrawType type, double idx, int highlight);
int text( double x, double y, char *text, int len, flow_eDrawType type, double size); int text( double x, double y, char *text, int len, flow_eDrawType type, double size, int line);
int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type); int pixmap( double x, double y, flow_sPixmapDataElem *data, flow_eDrawType type);
int arrow( double x1, double y1, double x2, double y2, int arrow( double x1, double y1, double x2, double y2,
double x3, double y3, flow_eDrawType type, double idx); double x3, double y3, flow_eDrawType type, double idx);
......
...@@ -72,7 +72,7 @@ void FlowText::print( void *pos, void *node, int highlight) ...@@ -72,7 +72,7 @@ void FlowText::print( void *pos, void *node, int highlight)
idx = MIN( idx, DRAW_TYPE_SIZE-1); idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->current_print->text( p.print_z_x + ((FlowPoint *)pos)->print_z_x , ctx->current_print->text( p.print_z_x + ((FlowPoint *)pos)->print_z_x ,
p.print_z_y + ((FlowPoint *)pos)->print_z_y, text, strlen(text), p.print_z_y + ((FlowPoint *)pos)->print_z_y, text, strlen(text),
draw_type, size); draw_type, size, 0);
} }
void FlowText::save( ofstream& fp, flow_eSaveMode mode) void FlowText::save( ofstream& fp, flow_eSaveMode mode)
......
...@@ -527,7 +527,7 @@ void CLogGtk::print() ...@@ -527,7 +527,7 @@ void CLogGtk::print()
pwr_tStatus sts; pwr_tStatus sts;
char title[80]; char title[80];
strcpy( title, "System Messages "); strcpy( title, Lng::translate( "System Messages"));
syi_NodeName( &sts, nodename, sizeof(nodename)); syi_NodeName( &sts, nodename, sizeof(nodename));
if ( ODD(sts)) { if ( ODD(sts)) {
strcat( title, " "); strcat( title, " ");
......
...@@ -68,9 +68,12 @@ void RtTraceGtk::activate_close(GtkWidget *w, gpointer data) ...@@ -68,9 +68,12 @@ void RtTraceGtk::activate_close(GtkWidget *w, gpointer data)
void RtTraceGtk::activate_print(GtkWidget *w, gpointer data) void RtTraceGtk::activate_print(GtkWidget *w, gpointer data)
{ {
RtTrace *tractx = (RtTrace *)data; RtTraceGtk *tractx = (RtTraceGtk *)data;
pwr_tStatus sts;
CoWowGtk::CreateFlowPrintDialogGtk( "Trace", tractx->flow_ctx, flow_eOrientation_Landscape,
1.0, tractx->toplevel, &sts);
tractx->activate_print();
} }
void RtTraceGtk::activate_printselect(GtkWidget *w, gpointer data) void RtTraceGtk::activate_printselect(GtkWidget *w, gpointer data)
......
...@@ -163,17 +163,26 @@ void Ev::blk_display_in_xnav_cb( void *ctx, pwr_tAttrRef *arp) ...@@ -163,17 +163,26 @@ void Ev::blk_display_in_xnav_cb( void *ctx, pwr_tAttrRef *arp)
void Ev::eve_activate_print() void Ev::eve_activate_print()
{ {
eve->print( "Event List"); char title[80];
strcpy( title, Lng::translate( "Event List"));
eve->print( title);
} }
void Ev::ala_activate_print() void Ev::ala_activate_print()
{ {
ala->print( "Alarm List"); char title[80];
strcpy( title, Lng::translate( "Alarm List"));
ala->print( title);
} }
void Ev::blk_activate_print() void Ev::blk_activate_print()
{ {
blk->print( "Block List"); char title[80];
strcpy( title, Lng::translate( "Blocked Alarms"));
blk->print( title);
} }
void Ev::eve_activate_ack_last() void Ev::eve_activate_ack_last()
......
...@@ -135,7 +135,7 @@ void Hist::activate_print() ...@@ -135,7 +135,7 @@ void Hist::activate_print()
hist->print_nodia( filename); hist->print_nodia( filename);
} }
else else
hist->print( "Event Log"); hist->print( Lng::translate( "Eventlog"));
} }
void Hist::activate_help() void Hist::activate_help()
......
...@@ -64,7 +64,7 @@ struct trace_sNode { ...@@ -64,7 +64,7 @@ struct trace_sNode {
class RtTrace { class RtTrace {
public: public:
void *parent_ctx; void *parent_ctx;
char name[80]; pwr_tOName name;
flow_tNodeClass trace_analyse_nc; flow_tNodeClass trace_analyse_nc;
flow_tConClass trace_con_cc; flow_tConClass trace_con_cc;
int trace_started; int trace_started;
......
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