00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #include <gtk/gtk.h>
00058 #include "config.h"
00059 #include "gxsm/plugin.h"
00060 #include "epsfutils.h"
00061 #include "gxsm/glbvars.h"
00062 #include "printer.h"
00063 #include "pyremote.h"
00064 #include "mkicons.h"
00065
00066
00067 static void printer_init( void );
00068 static void printer_about( void );
00069 static void printer_configure( void );
00070 static void printer_query( void );
00071 static void printer_cleanup( void );
00072 static void printer_run(GtkWidget *w, void *data);
00073
00074
00075 static void printer_run_non_interactive(GtkWidget *w, gpointer pc);
00076
00077
00078 GxsmPlugin printer_pi = {
00079 NULL,
00080 NULL,
00081 0,
00082 NULL,
00083
00084
00085
00086
00087 "Printer",
00088 NULL,
00089
00090 "Multifunction Printer PI.",
00091
00092 "Stefan Schroeder",
00093
00094 N_("_File/"),
00095
00096 N_("Print"),
00097
00098 N_("Printer Control."),
00099
00100 "no more info",
00101 NULL,
00102 NULL,
00103
00104
00105 printer_init,
00106
00107
00108 printer_query,
00109
00110
00111 printer_about,
00112
00113
00114 printer_configure,
00115
00116
00117 NULL,
00118
00119
00120 printer_cleanup
00121 };
00122
00123
00124 static const char *about_text = N_("Gxsm Plugin\n\n"
00125 "Printer Plugin + Control.");
00126
00127
00128 GxsmPlugin *get_gxsm_plugin_info ( void ){
00129 printer_pi.description = g_strdup_printf(N_("Gxsm printer plugin %s"), VERSION);
00130 return &printer_pi;
00131 }
00132
00133
00134
00135
00136
00137 #define PI_PRINT_FILE 0x01
00138 #define PI_PRINT_PRINTER 0x02
00139 #define PI_PRINT_PREVIEW 0x04
00140 #define PI_PRINT_FRAME 0x10
00141 #define PI_PRINT_SCALE 0x20
00142 #define PI_PRINT_REGIONS 0x40
00143
00144
00145 char *pOpt_Type[] = {"plain", "with ticks", "with ticks, Off.=0", "with bar", "circular", NULL};
00146 char *pOpt_Info[] = {"none", "size only", "more", "all", NULL};
00147
00148
00149 MKICONSPI_OPTIONS pOptionsList[] = {
00150 { "Type", pOpt_Type, "ptzbc", 0 },
00151 { "Info", pOpt_Info, "nsma", 0 },
00152 { NULL, NULL, NULL, 0 }
00153 };
00154
00155 typedef union pOptIndex {
00156 struct { unsigned char oi, x, y, z; } s;
00157 unsigned long l;
00158 };
00159
00160
00161 PIPrintControl::PIPrintControl (){
00162
00163
00164
00165
00166
00167 pdata = NULL;
00168 Fw = NULL;
00169 Fs = NULL;
00170
00171 }
00172
00173 void PIPrintControl::cleanup (){
00174
00175 if(Fw)
00176 delete Fw;
00177 Fw = NULL;
00178
00179 if(Fs)
00180 delete Fs;
00181 Fs = NULL;
00182
00183 if(pdata)
00184 delete pdata;
00185 pdata = NULL;
00186 }
00187
00188 PIPrintControl::~PIPrintControl (){
00189
00190 cleanup();
00191 }
00192
00193
00194 PIPrintPSData::PIPrintPSData(){
00195 gchar *tmp, *p;
00196 MKICONSPI_OPTIONS *opt;
00197
00198 XsmRescourceManager xrm("PrintOptions");
00199
00200 title = xrm.GetStr ("Titel", "My image (by GXSM)");
00201 prtcmd = xrm.GetStr ("PrintCommand", "lpr");
00202 previewcmd = xrm.GetStr ("PreviewCommand", "gv");
00203
00204 PI_DEBUG (DBG_L4, "PIPrintPSData::PIPrintPSData()");
00205
00206 if( gapp->xsm->ActiveScan ){
00207 tmp = g_strdup(gapp->xsm->ActiveScan->data.ui.name);
00208 if(strrchr(tmp, '.') > tmp){
00209 *(p = strrchr(tmp, '.')) = 0;
00210 fname = g_strconcat(tmp, ".ps", NULL);
00211 *p = '.';
00212 }else
00213 fname = g_strdup("/tmp/noname.ps");
00214 g_free(tmp);
00215 }
00216 else
00217 fname = g_strdup("/tmp/noscan.ps");
00218
00219 ptUnit = new UnitObj("pt","pt");
00220 mmUnit = new UnitObj("mm","mm");
00221 fontsize = 12.;
00222 figwidth = 177.;
00223 mode = 0;
00224 typ = 0;
00225 info = 0;
00226 PI_DEBUG (DBG_L4, "PIPrintPSData::PIPrintPSData done");
00227 }
00228 void PIPrintControl::run(){
00229 GtkWidget *dialog;
00230 GtkWidget *vbox;
00231 GtkWidget *hbox;
00232 GtkWidget *VarName;
00233 GtkWidget *variable;
00234 GtkWidget *help;
00235 GtkWidget *separator;
00236 GtkWidget *checkbutton;
00237 GtkWidget *radiobutton;
00238 GSList *radiogroup;
00239
00240 DlgStart();
00241 pdata = new PIPrintPSData();
00242
00243 dialog = gnome_dialog_new(_("Gxsm Print"),
00244 GNOME_STOCK_BUTTON_OK,
00245 GNOME_STOCK_BUTTON_CANCEL,
00246 NULL);
00247
00248 gnome_dialog_set_close(GNOME_DIALOG(dialog), FALSE);
00249 gnome_dialog_close_hides(GNOME_DIALOG(dialog), FALSE);
00250 gnome_dialog_set_default(GNOME_DIALOG(dialog), 3);
00251
00252
00253
00254 vbox = gtk_vbox_new (FALSE, 0);
00255 gtk_widget_show (vbox);
00256
00257 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),
00258 vbox, TRUE, TRUE, GNOME_PAD);
00259
00260
00261 hbox = gtk_hbox_new (FALSE, 0);
00262 gtk_widget_show (hbox);
00263
00264
00265 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
00266
00267 VarName = gtk_label_new (_("Title"));
00268 gtk_widget_set_usize (VarName, 50, -1);
00269 gtk_widget_show (VarName);
00270 gtk_label_set_justify(GTK_LABEL(VarName), GTK_JUSTIFY_LEFT);
00271 gtk_misc_set_alignment (GTK_MISC (VarName), 0.0, 0.5);
00272 gtk_misc_set_padding (GTK_MISC (VarName), 5, 0);
00273 gtk_box_pack_start (GTK_BOX (hbox), VarName, TRUE, TRUE, 0);
00274
00275 title = variable = gtk_entry_new ();
00276 gtk_widget_set_usize (title, 200, -1);
00277 gtk_widget_show (variable);
00278 gtk_box_pack_start (GTK_BOX (hbox), variable, TRUE, TRUE, 0);
00279 gtk_entry_set_text (GTK_ENTRY (variable), pdata->title);
00280
00281 help = gtk_button_new_with_label (_("Help"));
00282 gtk_widget_show (help);
00283 gtk_box_pack_start (GTK_BOX (hbox), help, TRUE, TRUE, 0);
00284 gtk_signal_connect (GTK_OBJECT (help), "clicked",
00285 GTK_SIGNAL_FUNC (show_info_callback),
00286 (void*)(_("Title is placed above Scanimage.")));
00287
00288
00289 separator = gtk_hseparator_new ();
00290 gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 5);
00291 gtk_widget_show (separator);
00292
00293
00294 hbox = gtk_hbox_new (FALSE, 0);
00295 gtk_widget_show (hbox);
00296 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
00297
00298 GtkWidget *mvbox, *label, *wid, *menu, *menuitem;
00299 MKICONSPI_OPTIONS *opt;
00300 char **item;
00301 pOptIndex pOptI;
00302 int i,j;
00303
00304 XsmRescourceManager xrm("PrintOptions");
00305 for(j=0, opt = pOptionsList; opt->name; ++j, ++opt){
00306
00307 gchar *idefault=g_strdup_printf("%d",opt->init);
00308 xrm.Get(opt->name, &opt->init, idefault);
00309 g_free(idefault);
00310
00311 mvbox = gtk_vbox_new (FALSE, 0);
00312 gtk_widget_show (mvbox);
00313 gtk_box_pack_start (GTK_BOX (hbox), mvbox, TRUE, TRUE, 0);
00314
00315 label = gtk_label_new (opt->name);
00316 gtk_widget_show (label);
00317 gtk_container_add (GTK_CONTAINER (mvbox), label);
00318
00319 wid = gtk_option_menu_new ();
00320 gtk_widget_show (wid);
00321 gtk_container_add (GTK_CONTAINER (mvbox), wid);
00322
00323 menu = gtk_menu_new ();
00324
00325
00326 for(i=0, item=opt->list; *item; ++i, ++item){
00327 menuitem = gtk_menu_item_new_with_label (*item);
00328 gtk_widget_show (menuitem);
00329 gtk_menu_append (GTK_MENU (menu), menuitem);
00330
00331 pOptI.l = 0L;
00332 pOptI.s.oi = j;
00333 pOptI.s.x = i;
00334 gtk_object_set_data(GTK_OBJECT (menuitem), "optindex", (gpointer)pOptI.l);
00335 gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
00336 GTK_SIGNAL_FUNC (PIPrintControl::option_choice_callback),
00337 this);
00338 }
00339 gtk_option_menu_set_menu (GTK_OPTION_MENU (wid), menu);
00340 gtk_option_menu_set_history (GTK_OPTION_MENU (wid), opt->init);
00341 }
00342
00343
00344
00345 hbox = gtk_hbox_new (FALSE, 0);
00346 gtk_widget_show (hbox);
00347 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
00348
00349 scalebutton = checkbutton = gtk_check_button_new_with_label( "scale full range");
00350 gtk_box_pack_start (GTK_BOX (hbox), checkbutton, TRUE, TRUE, 0);
00351 gtk_widget_show (checkbutton);
00352
00353 framebutton = checkbutton = gtk_check_button_new_with_label( "Frame");
00354 gtk_box_pack_start (GTK_BOX (hbox), checkbutton, TRUE, TRUE, 0);
00355 gtk_widget_show (checkbutton);
00356
00357 regionbutton = checkbutton = gtk_check_button_new_with_label( "Regions (exp.)");
00358 gtk_box_pack_start (GTK_BOX (hbox), checkbutton, TRUE, TRUE, 0);
00359 gtk_widget_show (checkbutton);
00360
00361 separator = gtk_hseparator_new ();
00362 gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 5);
00363 gtk_widget_show (separator);
00364
00365 GtkWidget *input;
00366 input = mygtk_create_input("Fontsize", vbox, hbox);
00367 Fs = new Gtk_EntryControl (pdata->ptUnit, MLD_WERT_NICHT_OK, &pdata->fontsize,
00368 1., 64., ".1f", input);
00369
00370 input = mygtk_add_input("Figwidth", hbox);
00371 Fw = new Gtk_EntryControl (pdata->mmUnit, MLD_WERT_NICHT_OK, &pdata->figwidth,
00372 10., 1000., ".1f", input);
00373
00374
00375
00376 hbox = gtk_hbox_new (FALSE, 0);
00377 gtk_widget_show (hbox);
00378 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
00379
00380 filebutton = radiobutton = gtk_radio_button_new_with_label (NULL, _("Save to file"));
00381 gtk_widget_set_usize (radiobutton, 100, -1);
00382 gtk_box_pack_start (GTK_BOX (hbox), radiobutton, TRUE, TRUE, 0);
00383 gtk_widget_show (radiobutton);
00384 radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton));
00385
00386 fname = variable = gtk_entry_new ();
00387 gtk_widget_show (variable);
00388 gtk_box_pack_start (GTK_BOX (hbox), variable, TRUE, TRUE, 0);
00389 gtk_entry_set_text (GTK_ENTRY (variable), pdata->fname);
00390
00391
00392 hbox = gtk_hbox_new (FALSE, 0);
00393 gtk_widget_show (hbox);
00394 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
00395
00396 printbutton = radiobutton = gtk_radio_button_new_with_label (radiogroup, _("Print command"));
00397 radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton));
00398 gtk_widget_set_usize (radiobutton, 100, -1);
00399 gtk_box_pack_start (GTK_BOX (hbox), radiobutton, TRUE, TRUE, 0);
00400 gtk_widget_show (radiobutton);
00401
00402 prtcmd = variable = gtk_entry_new ();
00403 gtk_widget_show (variable);
00404 gtk_box_pack_start (GTK_BOX (hbox), variable, TRUE, TRUE, 0);
00405 gtk_entry_set_text (GTK_ENTRY (variable), pdata->prtcmd);
00406
00407
00408 hbox = gtk_hbox_new (FALSE, 0);
00409 gtk_widget_show (hbox);
00410 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
00411
00412 previewbutton = radiobutton = gtk_radio_button_new_with_label (radiogroup, _("Preview via"));
00413 radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton));
00414 gtk_widget_set_usize (radiobutton, 100, -1);
00415 gtk_box_pack_start (GTK_BOX (hbox), radiobutton, TRUE, TRUE, 0);
00416 gtk_widget_show (radiobutton);
00417
00418 previewcmd = variable = gtk_entry_new ();
00419 gtk_widget_show (variable);
00420 gtk_box_pack_start (GTK_BOX (hbox), variable, TRUE, TRUE, 0);
00421 gtk_entry_set_text (GTK_ENTRY (variable), pdata->previewcmd);
00422
00423
00424
00425 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (scalebutton) , TRUE);
00426 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (filebutton) , FALSE);
00427 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (printbutton) , TRUE);
00428 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON (previewbutton) , FALSE);
00429
00430 pdata->typ = (int)pOptionsList[0].id[pOptionsList[0].init];
00431 pdata->info = (int)pOptionsList[1].id[pOptionsList[1].init];
00432
00433
00434
00435 gtk_signal_connect(GTK_OBJECT(dialog), "clicked",
00436 GTK_SIGNAL_FUNC(PIPrintControl::dlg_clicked),
00437 this);
00438
00439 gtk_widget_show(dialog);
00440
00441
00442 }
00443
00444
00445
00446 void PIPrintControl::option_choice_callback(GtkWidget *widget, PIPrintControl *pc){
00447 pOptIndex i;
00448 i.l=(long)gtk_object_get_data( GTK_OBJECT (widget), "optindex");
00449 switch(i.s.oi){
00450 case 0: pc->pdata->typ = (int)pOptionsList[i.s.oi].id[pOptionsList[i.s.oi].init=i.s.x]; break;
00451 case 1: pc->pdata->info = (int)pOptionsList[i.s.oi].id[pOptionsList[i.s.oi].init=i.s.x]; break;
00452 }
00453 }
00454
00455 void PIPrintControl::dlg_clicked(GnomeDialog * dialog, gint button_number, PIPrintControl *pc){
00456
00457 g_free(pc->pdata->title);
00458 g_free(pc->pdata->fname);
00459 g_free(pc->pdata->prtcmd);
00460 g_free(pc->pdata->previewcmd);
00461 pc->pdata->title = g_strdup(gtk_entry_get_text (GTK_ENTRY (pc->title)));
00462 pc->pdata->fname = g_strdup(gtk_entry_get_text (GTK_ENTRY (pc->fname)));
00463 pc->pdata->prtcmd = g_strdup(gtk_entry_get_text (GTK_ENTRY (pc->prtcmd)));
00464 pc->pdata->previewcmd = g_strdup(gtk_entry_get_text (GTK_ENTRY (pc->previewcmd)));
00465
00466 pc->pdata->mode = 0;
00467 if (GTK_TOGGLE_BUTTON (pc->framebutton)->active)
00468 pc->pdata->mode |= PI_PRINT_FRAME;
00469 if (GTK_TOGGLE_BUTTON (pc->scalebutton)->active)
00470 pc->pdata->mode |= PI_PRINT_SCALE;
00471 if (GTK_TOGGLE_BUTTON (pc->regionbutton)->active)
00472 pc->pdata->mode |= PI_PRINT_REGIONS;
00473
00474 if (GTK_TOGGLE_BUTTON (pc->filebutton)->active)
00475 pc->pdata->mode |= PI_PRINT_FILE;
00476 if (GTK_TOGGLE_BUTTON (pc->printbutton)->active)
00477 pc->pdata->mode |= PI_PRINT_PRINTER;
00478 if (GTK_TOGGLE_BUTTON (pc->previewbutton)->active)
00479 pc->pdata->mode |= PI_PRINT_PREVIEW;
00480
00481 switch(button_number){
00482 case 0:
00483 gnome_dialog_close(dialog);
00484 PIPrintPS(pc->pdata);
00485 break;
00486 case 1:
00487 gnome_dialog_close(dialog);
00488 break;
00489 }
00490
00491 pc->cleanup();
00492
00493 pc->DlgDone();
00494 }
00495
00496
00497 PIPrintPSData::~PIPrintPSData(){
00498
00499 MKICONSPI_OPTIONS *opt;
00500
00501 XsmRescourceManager xrm("PrintOptions");
00502
00503 xrm.Put ("Titel", title);
00504 xrm.Put ("PrintCommand", prtcmd);
00505 xrm.Put ("PreviewCommand", previewcmd);
00506
00507 for(opt = pOptionsList; opt->name; ++opt)
00508 xrm.Put(opt->name, opt->init);
00509
00510 g_free(title);
00511 g_free(fname);
00512 g_free(prtcmd);
00513 g_free(previewcmd);
00514
00515 delete ptUnit;
00516 delete mmUnit;
00517 }
00518
00519
00520 static void printer_init(void)
00521 {
00522 PI_DEBUG (DBG_L2, "printer Plugin Init");
00523
00524
00525 remote_action_cb *ra;
00526 GtkWidget *dummywidget = gtk_menu_item_new();
00527
00528 ra = g_new( remote_action_cb, 1);
00529 ra -> cmd = g_strdup_printf("print_PI");
00530 ra -> RemoteCb = &printer_run_non_interactive;
00531 ra -> widget = dummywidget;
00532 ra -> data = NULL;
00533 gapp->RemoteActionList = g_slist_prepend ( gapp->RemoteActionList, ra );
00534 PI_DEBUG (DBG_L2, "printer-plugin: Adding new Remote Cmd: print_PI");
00535
00536 }
00537
00538 static void printer_run_non_interactive( GtkWidget *widget , gpointer ppc )
00539 {
00540 PI_DEBUG (DBG_L2, "printer-plugin: print is called from script.");
00541
00542 PIPrintPSData *pdata = new PIPrintPSData();
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561 pdata->mode = 1;
00562 PIPrintPS(pdata);
00563
00564 return;
00565 }
00566
00567
00568
00569 static void printer_about(void)
00570 {
00571 const gchar *authors[] = { printer_pi.authors, NULL};
00572 gtk_widget_show(gnome_about_new ( printer_pi.name,
00573 VERSION,
00574 N_("(C) 2000 the Free Software Foundation"),
00575 about_text,
00576 authors,
00577 NULL,NULL,NULL
00578 ));
00579 }
00580
00581
00582 static void printer_configure(void)
00583 {
00584 if(printer_pi.app)
00585 printer_pi.app->message("Printer Plugin Configuration");
00586 }
00587
00588 static void printer_query(void)
00589 {
00590 printer_pi.app->ConnectPluginToPrinterEvent (printer_run);
00591 }
00592
00593
00594
00595 static void printer_cleanup(void)
00596 {
00597 printer_pi.app->ConnectPluginToPrinterEvent (NULL);
00598
00599 }
00600
00601
00602 static void printer_run( GtkWidget *w, void *data )
00603 {
00604 static PIPrintControl *pc = NULL;
00605 if(w){
00606 if(!pc)
00607 pc = new PIPrintControl();
00608 if(!pc->running())
00609 pc->run();
00610 }else
00611 if(pc)
00612 delete pc;
00613
00614
00615 }
00616
00617 void PIPrintPS(PIPrintPSData *ppsd){
00618 gchar *fname;
00619 Scan *ActiveScan;
00620 GError *printer_failure;
00621 ActiveScan = gapp->xsm->GetActiveScan();
00622
00623 if(!ActiveScan)
00624 XSM_SHOW_ALERT(ERR_SORRY, ERR_NOACTIVESCAN,HINT_ACTIVATESCAN,1);
00625 else{
00626 if(ppsd->mode & PI_PRINT_PRINTER || ppsd->mode & PI_PRINT_PREVIEW){
00627 g_file_open_tmp("GXSM_TEMPFILE_XXXXXX", &fname, &printer_failure);
00628
00629 }
00630 else{
00631 if(ppsd->mode & PI_PRINT_FILE)
00632 fname = g_strdup(ppsd->fname);
00633 else{
00634 g_file_open_tmp("GXSM_ERROR_XXXXXX", &fname, &printer_failure);
00635
00636 }
00637 }
00638 EpsfTools *eps;
00639 if(IS_SPALEED_CTRL)
00640 eps = new SPA_epsftools;
00641 else
00642 eps = new SPM_epsftools;
00643
00644 eps->open(fname, TRUE, ppsd->typ, ppsd->info);
00645
00646 eps->SetAbbWidth(ppsd->figwidth);
00647 eps->SetFontSize(ppsd->fontsize);
00648
00649 eps->placeimage();
00650
00651 if(ppsd->info == 's' || ppsd->info == 'm')
00652 eps->putsize(ActiveScan);
00653 if(ppsd->mode & PI_PRINT_FRAME)
00654 eps->putframe();
00655 if(ppsd->typ == 'z')
00656 eps->putticks(ActiveScan);
00657 if(ppsd->typ == 't')
00658 eps->putticks(ActiveScan, FALSE);
00659 if(ppsd->typ == 'b')
00660 eps->putbar(ActiveScan);
00661 if(ppsd->info == 'm' || ppsd->info == 'a')
00662 eps->putmore(ActiveScan, ppsd->title);
00663
00664 eps->putgrey(ActiveScan, ActiveScan->mem2d,
00665 ppsd->mode & PI_PRINT_SCALE ? TRUE:FALSE,
00666 FALSE,
00667 ppsd->typ == 'c');
00668
00669 eps->endimage();
00670
00671 if (ppsd->mode & PI_PRINT_REGIONS){
00672 scan_object_data* test_scan_obj;
00673
00674 for (unsigned int i=0; i< ActiveScan->number_of_object(); i++){
00675 test_scan_obj = (scan_object_data*)ActiveScan->get_object_data (i);
00676
00677
00678 if (test_scan_obj->get_name()[0] == 'L'){
00679 PI_DEBUG (DBG_L4, "PIprinter::PrintPS. Printing Line.");
00680 double A, B, C, D;
00681 test_scan_obj->get_xy(0, A, B);
00682 test_scan_obj->get_xy(1, C, D);
00683
00684 eps->putline(ActiveScan, int(A), int(B), int(C), int(D));
00685 }
00686 else if (test_scan_obj->get_name()[0] == 'R'){
00687 PI_DEBUG (DBG_L4, "PIprinter::PrintPS. Printing Rectangle.");
00688 double A, B, C, D;
00689 test_scan_obj->get_xy(0, A, B);
00690 test_scan_obj->get_xy(1, C, D);
00691
00692 eps->putline(ActiveScan, int(A), int(B), int(C), int(B));
00693 eps->putline(ActiveScan, int(C), int(B), int(C), int(D));
00694 eps->putline(ActiveScan, int(A), int(B), int(A), int(D));
00695 eps->putline(ActiveScan, int(A), int(D), int(C), int(D));
00696 }
00697 else if (test_scan_obj->get_name()[0] == 'P' &&
00698 test_scan_obj->get_name()[2] == 'i'){
00699 PI_DEBUG (DBG_L4, "PIprinter::PrintPS. Printing Point.");
00700 double A, B;
00701 test_scan_obj->get_xy(0, A, B);
00702 eps->putcircle(ActiveScan, int(A), int(B), int(A+1), int(B+1));
00703 }
00704 else if (test_scan_obj->get_name()[0] == 'C'){
00705 PI_DEBUG (DBG_L4, "PIprinter::PrintPS. Printing Circle.");
00706 double A, B, C, D;
00707 test_scan_obj->get_xy(0, A, B);
00708 test_scan_obj->get_xy(1, C, D);
00709
00710 eps->putcircle(ActiveScan, int(A), int(B), int(C), int(D));
00711 }
00712 else{
00713 PI_DEBUG (DBG_L4, "PIprinter::PrintPS. Don't know how to print this: " << test_scan_obj->get_name() );
00714 }
00715 }
00716 }
00717
00718
00719
00720 eps->close();
00721 delete eps;
00722
00723 if(ppsd->mode & PI_PRINT_PRINTER || ppsd->mode & PI_PRINT_PREVIEW){
00724 FILE *lprcmd;
00725 char command[512];
00726 char retinfo[64];
00727 int ret;
00728 sprintf(command, "%s %s\n",
00729 ppsd->mode & PI_PRINT_PREVIEW ?
00730 ppsd->previewcmd : ppsd->prtcmd, fname);
00731 lprcmd=popen(command,"r");
00732 ret=pclose(lprcmd);
00733 sprintf(retinfo, "%s", ret? "Exec. Error":"OK");
00734 XSM_SHOW_ALERT("PI PRINT INFO", command, retinfo,1);
00735
00736 sprintf(command, "rm %s\n", fname);
00737 lprcmd=popen(command,"r");
00738 pclose(lprcmd);
00739 }
00740 g_free(fname);
00741 }
00742 }