/* $Id: gui-dialog-print.c,v 1.12 2006/03/17 14:01:43 mcmahill Exp $ */ /* * COPYRIGHT * * PCB, interactive printed circuit board design * Copyright (C) 1994,1995,1996 Thomas Nau * * 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. * * Contact addresses for paper mail and Email: * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany * Thomas.Nau@rz.uni-ulm.de * */ /* This file written by Bill Wilson for the PCB Gtk port. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDLIB_H #include #endif #include "gui.h" #ifdef HAVE_LIBDMALLOC #include #endif RCSID("$Id: gui-dialog-print.c,v 1.12 2006/03/17 14:01:43 mcmahill Exp $"); static GtkWidget *export_dialog = NULL; static void set_flag_cb (GtkToggleButton *button, gboolean *flag) { *flag = gtk_toggle_button_get_active (button); } static void intspinner_changed_cb (GtkWidget *spin_button, gpointer data) { int *ival = data; *ival = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin_button)); } static void dblspinner_changed_cb (GtkWidget *spin_button, gpointer data) { double *dval = data; *dval = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin_button)); } static void entry_changed_cb (GtkEntry *entry, char **str) { const gchar *s; s = gtk_entry_get_text (entry); if (*str) free (*str); *str = strdup (s); } static void enum_changed_cb (GtkWidget *combo_box, int *val) { gint active; active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)); *val = active; } void ghid_dialog_print (HID *printer) { GtkWidget *dialog, *main_vbox, *vbox, *vbox1, *hbox, *entry; GtkWidget *combo; GtkWidget *widget; GHidPort *out = &ghid_port; HID_Attribute *attr; int i, j, n; GtkTooltips *tips; HID_Attr_Val *vals; if (printer == NULL) { fprintf(stderr, "ERROR: %s: null printer\n", __FUNCTION__); return ; } tips = gtk_tooltips_new(); if (!PCB->PrintFilename) PCB->PrintFilename = EvaluateFilename (Settings.PrintFile, NULL, PCB->Filename ? PCB->Filename : "noname", NULL); dialog = gtk_dialog_new_with_buttons(_("PCB Print Layout"), GTK_WINDOW(out->top_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_NONE, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_window_set_wmclass (GTK_WINDOW (dialog), "PCB_Print", "PCB"); main_vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox); vbox = ghid_category_vbox(main_vbox, printer->description, 4, 2, TRUE, TRUE); /* * Iterate over all the export options and build up a dialog box * that lets us control all of the options. By doing things this * way, any changes to the exporter HID's automatically are * reflected in this dialog box. */ attr = printer->get_export_options (&n); for (j=0; jdo_export (vals); for (i=0; itop_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gtk_window_set_wmclass (GTK_WINDOW (export_dialog), "PCB_Export", "PCB"); vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (export_dialog)->vbox), vbox); /* * Iterate over all the export HID's and build up a dialog box that * lets us choose which one we want to use. * This way, any additions to the exporter HID's automatically are * reflected in this dialog box. */ hids = hid_enumerate (); for (i=0; hids[i]; i++) { if (hids[i]->exporter) { exporter = hids[i]; button = gtk_button_new_with_label (hids[i]->name); gtk_tooltips_set_tip (tips, button, hids[i]->description, NULL); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (exporter_clicked_cb), hids[i]); } } if (exporter == NULL) { gui->log (_("Can't find a suitable exporter HID")); } gtk_widget_show_all (export_dialog); gtk_dialog_run (GTK_DIALOG (export_dialog)); if (export_dialog != NULL) gtk_widget_destroy (export_dialog); export_dialog = NULL; }