*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <math.h>
#include <glib/gi18n.h>
-#define PRINT_CONFIG_FILENAME "ev-print-config.xml"
-
typedef struct
{
int size;
* the region code.
*/
void
-ev_print_region_contents (GdkRegion *region)
+ev_print_region_contents (cairo_region_t *region)
{
- GdkRectangle *rectangles = NULL;
gint n_rectangles, i;
if (region == NULL) {
}
g_print ("<region %p>\n", region);
- gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
+ n_rectangles = cairo_region_num_rectangles (region);
for (i = 0; i < n_rectangles; i++) {
- g_print ("\t(%d %d, %d %d) [%dx%d]\n",
- rectangles[i].x,
- rectangles[i].y,
- rectangles[i].x + rectangles[i].width,
- rectangles[i].y + rectangles[i].height,
- rectangles[i].width,
- rectangles[i].height);
- }
- g_free (rectangles);
-}
-
-#ifdef WITH_GNOME_PRINT
-gboolean
-using_pdf_printer (GnomePrintConfig *config)
-{
- const guchar *driver;
-
- driver = gnome_print_config_get (
- config, (const guchar *)"Settings.Engine.Backend.Driver");
-
- if (driver) {
- if (!strcmp ((const gchar *)driver, "gnome-print-pdf"))
- return TRUE;
- else
- return FALSE;
- }
-
- return FALSE;
-}
-
-gboolean
-using_postscript_printer (GnomePrintConfig *config)
-{
- const guchar *driver;
- const guchar *transport;
-
- driver = gnome_print_config_get (
- config, (const guchar *)"Settings.Engine.Backend.Driver");
-
- transport = gnome_print_config_get (
- config, (const guchar *)"Settings.Transport.Backend");
-
- if (driver) {
- if (!strcmp ((const gchar *)driver, "gnome-print-ps"))
- return TRUE;
- else
- return FALSE;
- } else if (transport) { /* these transports default to PostScript */
- if (!strcmp ((const gchar *)transport, "CUPS"))
- return TRUE;
- else if (!strcmp ((const gchar *)transport, "LPD"))
- return TRUE;
- else if (!strcmp ((const gchar *)transport, "PAPI"))
- return TRUE;
- }
-
- return FALSE;
-}
-
-GnomePrintConfig *
-load_print_config_from_file (void)
-{
- GnomePrintConfig *print_config = NULL;
- char *file_name, *contents = NULL;
-
- file_name = g_build_filename (ev_dot_dir (), PRINT_CONFIG_FILENAME,
- NULL);
-
- if (g_file_get_contents (file_name, &contents, NULL, NULL)) {
- print_config = gnome_print_config_from_string (contents, 0);
- g_free (contents);
- }
+ GdkRectangle rect;
- if (print_config == NULL) {
- print_config = gnome_print_config_default ();
+ cairo_region_get_rectangle (region, i, &rect);
+ g_print ("\t(%d %d, %d %d) [%dx%d]\n",
+ rect.x,
+ rect.y,
+ rect.x + rect.width,
+ rect.y + rect.height,
+ rect.width,
+ rect.height);
}
-
- g_free (file_name);
-
- return print_config;
}
-void
-save_print_config_to_file (GnomePrintConfig *config)
-{
- char *file_name, *str;
-
- g_return_if_fail (config != NULL);
-
- str = gnome_print_config_to_string (config, 0);
- if (str == NULL) return;
-
- file_name = g_build_filename (ev_dot_dir (),
- PRINT_CONFIG_FILENAME,
- NULL);
-
- g_file_set_contents (file_name, str, -1, NULL);
-
- g_free (file_name);
- g_free (str);
-}
-#endif /* WITH_GNOME_PRINT */
-
static void
ev_gui_sanitise_popup_position (GtkMenu *menu,
GtkWidget *widget,
GtkTreeView *tree_view = GTK_TREE_VIEW (user_data);
GtkWidget *widget = GTK_WIDGET (user_data);
GtkRequisition req;
+ GtkAllocation allocation;
GdkRectangle visible;
gtk_widget_size_request (GTK_WIDGET (menu), &req);
- gdk_window_get_origin (widget->window, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
+ gtk_widget_get_allocation (widget, &allocation);
- *x += (widget->allocation.width - req.width) / 2;
+ *x += (allocation.width - req.width) / 2;
/* Add on height for the treeview title */
gtk_tree_view_get_visible_rect (tree_view, &visible);
- *y += widget->allocation.height - visible.height;
+ *y += allocation.height - visible.height;
selection = gtk_tree_view_get_selection (tree_view);
selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
return gdk_screen_get_n_monitors (screen);
}
-gdouble
-get_screen_dpi (GtkWindow *window)
-{
- GdkScreen *screen;
- gdouble xdpi, ydpi;
-
- screen = gtk_window_get_screen (window);
-
- xdpi = 25.4 * gdk_screen_get_width (screen) / gdk_screen_get_width_mm (screen);
- ydpi = 25.4 * gdk_screen_get_height (screen) / gdk_screen_get_height_mm (screen);
-
- return (xdpi + ydpi) / 2.0;
-}
-
-
void
file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser)
{
g_slist_free (pixbuf_formats);
return NULL;
}
-