Index: scconfig/Rev.h =================================================================== --- scconfig/Rev.h (revision 6709) +++ scconfig/Rev.h (revision 6710) @@ -1 +1 @@ -static const int myrev = 6709; +static const int myrev = 6710; Index: scconfig/Rev.tab =================================================================== --- scconfig/Rev.tab (revision 6709) +++ scconfig/Rev.tab (revision 6710) @@ -1,4 +1,4 @@ -6709 configure gtk splitup +6710 configure gtk splitup 6392 configure draw cross section plugin (gtk and lesstif depend on it) 6365 configure gtk splitup 6111 configure layer vs. layer group code split Index: src_plugins/hid_gtk/gtkhid-main.c =================================================================== --- src_plugins/hid_gtk/gtkhid-main.c (revision 6709) +++ src_plugins/hid_gtk/gtkhid-main.c (revision 6710) @@ -32,6 +32,7 @@ /* AV: Care to circular includes !!!? */ #include "../src_plugins/lib_gtk_common/act_fileio.h" +#include "../src_plugins/lib_gtk_common/act_print.h" #include "../src_plugins/lib_gtk_common/ui_zoompan.h" #include "../src_plugins/lib_gtk_common/util_block_hook.h" #include "../src_plugins/lib_gtk_common/util_timer.h" @@ -393,81 +394,11 @@ return 0; } - -static const char print_syntax[] = "Print()"; - -static const char print_help[] = N_("Print the layout."); - -/* %start-doc actions Print - -This will find the default printing HID, prompt the user for its -options, and print the layout. - -%end-doc */ - -static int Print(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) -{ - pcb_hid_t **hids; - int i; - pcb_hid_t *printer = NULL; - - hids = pcb_hid_enumerate(); - for (i = 0; hids[i]; i++) { - if (hids[i]->printer) - printer = hids[i]; - } - - if (printer == NULL) { - pcb_gui->log(_("Can't find a suitable printer HID")); - return -1; - } - - /* check if layout is empty */ - if (!pcb_data_is_empty(PCB->Data)) { - ghid_dialog_print(printer, NULL, ghid_port.top_window); - } - else - pcb_gui->log(_("Can't print empty layout")); - - return 0; -} - - /* ------------------------------------------------------------ */ -static pcb_hid_attribute_t printer_calibrate_attrs[] = { - {N_("Enter Values here:"), "", - HID_Label, 0, 0, {0, 0, 0}, 0, 0}, - {N_("x-calibration"), N_("X scale for calibrating your printer"), - HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0}, - {N_("y-calibration"), N_("Y scale for calibrating your printer"), - HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0} -}; - -static pcb_hid_attr_val_t printer_calibrate_values[3]; - -static const char printcalibrate_syntax[] = "PrintCalibrate()"; - -static const char printcalibrate_help[] = N_("Calibrate the printer."); - -/* %start-doc actions PrintCalibrate - -This will print a calibration page, which you would measure and type -the measurements in, so that future printouts will be more precise. - -%end-doc */ - -static int PrintCalibrate(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +int pcb_gtk_act_print_(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) { - pcb_hid_t *printer = pcb_hid_find_printer(); - printer->calibrate(0.0, 0.0); - - if (pcb_gui->attribute_dialog(printer_calibrate_attrs, 3, - printer_calibrate_values, - _("Printer Calibration Values"), _("Enter calibration values for your printer"))) - return 1; - printer->calibrate(printer_calibrate_values[1].real_value, printer_calibrate_values[2].real_value); - return 0; + return pcb_gtk_act_print(gport->top_window, argc, argv, x, y); } /* ------------------------------------------------------------ */ @@ -778,11 +709,9 @@ , {"Popup", 0, Popup, popup_help, popup_syntax} , - {"Print", 0, Print, - print_help, print_syntax} + {"Print", 0, pcb_gtk_act_print_, pcb_gtk_acth_print, pcb_gtk_acts_print} , - {"PrintCalibrate", 0, PrintCalibrate, - printcalibrate_help, printcalibrate_syntax} + {"PrintCalibrate", 0, pcb_gtk_act_printcalibrate, pcb_gtk_acth_printcalibrate, pcb_gtk_acts_printcalibrate} , {"Save", 0, pcb_gtk_act_save, pcb_gtk_acth_save, pcb_gtk_acts_save} , Index: src_plugins/lib_gtk_common/Plug.tmpasm =================================================================== --- src_plugins/lib_gtk_common/Plug.tmpasm (revision 6709) +++ src_plugins/lib_gtk_common/Plug.tmpasm (revision 6710) @@ -5,6 +5,7 @@ put /local/pcb/mod/OBJS_C99 [@ $(PLUGDIR)/lib_gtk_common/act_fileio.o + $(PLUGDIR)/lib_gtk_common/act_print.o $(PLUGDIR)/lib_gtk_common/bu_box.o $(PLUGDIR)/lib_gtk_common/bu_check_button.o $(PLUGDIR)/lib_gtk_common/bu_cursor_pos.o Index: src_plugins/lib_gtk_common/act_print.c =================================================================== --- src_plugins/lib_gtk_common/act_print.c (nonexistent) +++ src_plugins/lib_gtk_common/act_print.c (revision 6710) @@ -0,0 +1,99 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 1994,1995,1996 Thomas Nau + * pcb-rnd Copyright (C) 2017 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "config.h" + +#include +#include "act_print.h" + +#include "board.h" +#include "hid.h" +#include "hid_init.h" +#include "hid_attrib.h" +#include "data.h" +#include "compat_nls.h" + +#include "dlg_print.h" + +const char pcb_gtk_acts_print[] = "Print()"; +const char pcb_gtk_acth_print[] = N_("Print the layout."); +int pcb_gtk_act_print(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + pcb_hid_t **hids; + int i; + pcb_hid_t *printer = NULL; + + hids = pcb_hid_enumerate(); + for (i = 0; hids[i]; i++) { + if (hids[i]->printer) + printer = hids[i]; + } + + if (printer == NULL) { + pcb_gui->log(_("Can't find a suitable printer HID")); + return -1; + } + + /* check if layout is empty */ + if (!pcb_data_is_empty(PCB->Data)) { + ghid_dialog_print(printer, NULL, top_window); + } + else + pcb_gui->log(_("Can't print empty layout")); + + return 0; +} + +static pcb_hid_attribute_t printer_calibrate_attrs[] = { + {N_("Enter Values here:"), "", + HID_Label, 0, 0, {0, 0, 0}, 0, 0}, + {N_("x-calibration"), N_("X scale for calibrating your printer"), + HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0}, + {N_("y-calibration"), N_("Y scale for calibrating your printer"), + HID_Real, 0.5, 25, {0, 0, 1.00}, 0, 0} +}; + +static pcb_hid_attr_val_t printer_calibrate_values[3]; + +const char pcb_gtk_acts_printcalibrate[] = "PrintCalibrate()"; +const char pcb_gtk_acth_printcalibrate[] = N_("Calibrate the printer."); + +/* %start-doc actions PrintCalibrate + +This will print a calibration page, which you would measure and type +the measurements in, so that future printouts will be more precise. + +%end-doc */ + +int pcb_gtk_act_printcalibrate(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + pcb_hid_t *printer = pcb_hid_find_printer(); + printer->calibrate(0.0, 0.0); + + if (pcb_gui->attribute_dialog(printer_calibrate_attrs, 3, + printer_calibrate_values, + _("Printer Calibration Values"), _("Enter calibration values for your printer"))) + return 1; + printer->calibrate(printer_calibrate_values[1].real_value, printer_calibrate_values[2].real_value); + return 0; +} Index: src_plugins/lib_gtk_common/act_print.h =================================================================== --- src_plugins/lib_gtk_common/act_print.h (nonexistent) +++ src_plugins/lib_gtk_common/act_print.h (revision 6710) @@ -0,0 +1,9 @@ +#include +extern const char pcb_gtk_acts_print[]; +extern const char pcb_gtk_acth_print[]; +int pcb_gtk_act_print(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); + +extern const char pcb_gtk_acts_printcalibrate[]; +extern const char pcb_gtk_acth_printcalibrate[]; +int pcb_gtk_act_printcalibrate(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); +