From 5e8a67a77defea10844838086169cc65985712ef Mon Sep 17 00:00:00 2001 From: joelholdsworth Date: Sat, 22 Dec 2007 21:06:55 +0000 Subject: [PATCH] Fixed the parenting of the print dialog so that it cannot fall behind the main inkscape desktop window --- src/file.cpp | 8 ++++---- src/file.h | 4 ++-- src/print.cpp | 4 ++-- src/print.h | 3 ++- src/ui/dialog/print.cpp | 4 ++-- src/ui/dialog/print.h | 2 +- src/verbs.cpp | 4 ++-- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/file.cpp b/src/file.cpp index 904ff9323..9b5f39312 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1375,11 +1375,11 @@ sp_file_import_from_ocal(Gtk::Window &parentWindow) * Print the current document, if any. */ void -sp_file_print() +sp_file_print(Gtk::Window& parentWindow) { SPDocument *doc = SP_ACTIVE_DOCUMENT; if (doc) - sp_print_document(doc, FALSE); + sp_print_document(parentWindow, doc, FALSE); } @@ -1388,11 +1388,11 @@ sp_file_print() * the machine's print drivers. */ void -sp_file_print_direct() +sp_file_print_direct(Gtk::Window& parentWindow) { SPDocument *doc = SP_ACTIVE_DOCUMENT; if (doc) - sp_print_document(doc, TRUE); + sp_print_document(parentWindow, doc, TRUE); } diff --git a/src/file.h b/src/file.h index 7f960ab65..f3ba1576b 100644 --- a/src/file.h +++ b/src/file.h @@ -179,12 +179,12 @@ would be useful as instance methods /** * */ -void sp_file_print (void); +void sp_file_print (Gtk::Window& parentWindow); /** * */ -void sp_file_print_direct (void); +void sp_file_print_direct (Gtk::Window& parentWindow); /** * diff --git a/src/print.cpp b/src/print.cpp index 0dfb8ab5a..a24a01ff7 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -123,7 +123,7 @@ sp_print_preview_document(SPDocument *doc) } void -sp_print_document(SPDocument *doc, unsigned int /*direct*/) +sp_print_document(Gtk::Window& parentWindow, SPDocument *doc, unsigned int /*direct*/) { sp_document_ensure_up_to_date(doc); @@ -135,7 +135,7 @@ sp_print_document(SPDocument *doc, unsigned int /*direct*/) // Run print dialog Inkscape::UI::Dialog::Print printop(doc,base); - Gtk::PrintOperationResult res = printop.run(Gtk::PRINT_OPERATION_ACTION_PRINT_DIALOG); + Gtk::PrintOperationResult res = printop.run(Gtk::PRINT_OPERATION_ACTION_PRINT_DIALOG, parentWindow); (void)res; // TODO handle this // Release arena diff --git a/src/print.h b/src/print.h index 0ec3fb321..69d4f8369 100644 --- a/src/print.h +++ b/src/print.h @@ -11,6 +11,7 @@ * This code is in public domain */ +#include #include #include "forward.h" #include "extension/extension-forward.h" @@ -40,7 +41,7 @@ void sp_print_get_param(SPPrintContext *ctx, gchar *name, bool *value); /* UI */ void sp_print_preview_document(SPDocument *doc); -void sp_print_document(SPDocument *doc, unsigned int direct); +void sp_print_document(Gtk::Window& parentWindow, SPDocument *doc, unsigned int direct); void sp_print_document_to_file(SPDocument *doc, gchar const *filename); diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 9165167f4..6740247cd 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -158,10 +158,10 @@ Print::Print(SPDocument *doc, SPItem *base) : } Gtk::PrintOperationResult -Print::run(Gtk::PrintOperationAction action) +Print::run(Gtk::PrintOperationAction action, Gtk::Window& parent) { Gtk::PrintOperationResult res; - res = _printop->run (action); + res = _printop->run (action, parent); return res; } diff --git a/src/ui/dialog/print.h b/src/ui/dialog/print.h index d893efbf1..721c910ff 100644 --- a/src/ui/dialog/print.h +++ b/src/ui/dialog/print.h @@ -30,7 +30,7 @@ class Print { public: Print(SPDocument *doc, SPItem *base); - Gtk::PrintOperationResult run(Gtk::PrintOperationAction action); + Gtk::PrintOperationResult run(Gtk::PrintOperationAction action, Gtk::Window& parentWindow); //GtkPrintOperationResult run(GtkPrintOperationAction action); protected: diff --git a/src/verbs.cpp b/src/verbs.cpp index 78dd8bee8..e96eca2ce 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -779,13 +779,13 @@ FileVerb::perform(SPAction *action, void *data, void */*pdata*/) sp_file_save_a_copy(*parent, NULL, NULL); break; case SP_VERB_FILE_PRINT: - sp_file_print(); + sp_file_print(*parent); break; case SP_VERB_FILE_VACUUM: sp_file_vacuum(); break; case SP_VERB_FILE_PRINT_DIRECT: - sp_file_print_direct(); + sp_file_print_direct(*parent); break; case SP_VERB_FILE_PRINT_PREVIEW: sp_file_print_preview(NULL, NULL); -- 2.30.2