svnno****@sourc*****
svnno****@sourc*****
Tue Apr 10 09:26:30 JST 2007
Revision: 3158 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3158 Author: kous Date: 2007-04-10 09:26:29 +0900 (Tue, 10 Apr 2007) Log Message: ----------- * module/embed/gecko/Makefile.am: added ENABLE_GTKMOZEMBED macro. * module/embed/gecko/kz-mozthumbnailcreator.cpp (kz_moz_thumbnail_creator_create_next): used gtk_moz_embed_previous_content_is_printing() if we're using internal gtkmozembed. * module/embed/gecko/gtkmozembed.h, module/embed/gecko/gtkmozembed2.c (gtk_moz_embed_previous_content_is_printing): added. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/gecko/Makefile.am kazehakase/trunk/module/embed/gecko/gtkmozembed.h kazehakase/trunk/module/embed/gecko/gtkmozembed2.cpp kazehakase/trunk/module/embed/gecko/kz-mozthumbnailcreator.cpp Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-04-09 01:35:44 UTC (rev 3157) +++ kazehakase/trunk/ChangeLog 2007-04-10 00:26:29 UTC (rev 3158) @@ -1,3 +1,16 @@ +2007-04-10 Kouhei Sutou <kou****@cozmi*****> + + * module/embed/gecko/Makefile.am: added ENABLE_GTKMOZEMBED macro. + + * module/embed/gecko/kz-mozthumbnailcreator.cpp + (kz_moz_thumbnail_creator_create_next): used + gtk_moz_embed_previous_content_is_printing() if we're using + internal gtkmozembed. + + * module/embed/gecko/gtkmozembed.h, + module/embed/gecko/gtkmozembed2.c + (gtk_moz_embed_previous_content_is_printing): added. + 2007-04-09 Kouhei Sutou <kou****@cozmi*****> * module/embed/ie/kz-ie.cpp: include <objbase.h>. Modified: kazehakase/trunk/module/embed/gecko/Makefile.am =================================================================== --- kazehakase/trunk/module/embed/gecko/Makefile.am 2007-04-09 01:35:44 UTC (rev 3157) +++ kazehakase/trunk/module/embed/gecko/Makefile.am 2007-04-10 00:26:29 UTC (rev 3158) @@ -82,6 +82,9 @@ MozillaEmbedPrivate.cpp MozillaEmbedPrivate.h \ nsEmbedAPI.cpp \ $(PROFILEDIRSERVICE_SOURCES) +LIBGTKMOZEMBED_CPPFLAGS = -DENABLE_GTKMOZEMBED +else +LIBGTKMOZEMBED_CPPFLAGS = endif if MOZ_NO_NSICANVASRENDERINGCONTEXTINTERNAL_HAVE_GETINPUTSTREAM_ @@ -131,7 +134,8 @@ -DMOZILLA_PREFIX=\"$(MOZILLA_PREFIX)\" \ -DGECKO_VERSION=\"$(GECKO_VERSION)\" \ -DG_LOG_DOMAIN=\"Kazehakase-Gecko\" \ - -DG_DISABLE_DEPRECATED=1 + -DG_DISABLE_DEPRECATED=1 \ + $(LIBGTKMOZEMBED_CPPFLAGS) EXTRA_DIST= \ gtkmozembed_internal.h \ Modified: kazehakase/trunk/module/embed/gecko/gtkmozembed.h =================================================================== --- kazehakase/trunk/module/embed/gecko/gtkmozembed.h 2007-04-09 01:35:44 UTC (rev 3157) +++ kazehakase/trunk/module/embed/gecko/gtkmozembed.h 2007-04-10 00:26:29 UTC (rev 3158) @@ -118,6 +118,8 @@ guint32 flags); guint32 gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed); +gboolean gtk_moz_embed_previous_content_is_printing (GtkMozEmbed *embed); + /* enum types */ #define GTK_TYPE_MOZ_EMBED_PROGRESS_FLAGS \ (gtk_moz_embed_progress_flags_get_type()) Modified: kazehakase/trunk/module/embed/gecko/gtkmozembed2.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/gtkmozembed2.cpp 2007-04-09 01:35:44 UTC (rev 3157) +++ kazehakase/trunk/module/embed/gecko/gtkmozembed2.cpp 2007-04-10 00:26:29 UTC (rev 3158) @@ -33,6 +33,12 @@ // so we can do our get_nsIWebBrowser later... #include <nsIWebBrowser.h> +#include <nsIInterfaceRequestorUtils.h> +#include <nsIDocShell.h> +#include <nsIContentViewer.h> +#include <nsIDocumentViewer.h> +#include <nsIWebBrowserPrint.h> + class nsIDirectoryServiceProvider; // class and instance initialization @@ -673,6 +679,51 @@ embedPrivate->LoadCurrentURI(); } +gboolean +gtk_moz_embed_previous_content_is_printing(GtkMozEmbed *embed) +{ + EmbedPrivate *embedPrivate; + gboolean g_printing = FALSE; + + g_return_val_if_fail(embed != NULL, FALSE); + g_return_val_if_fail(GTK_IS_MOZ_EMBED(embed), FALSE); + + embedPrivate = (EmbedPrivate *)embed->data; + + if (!embedPrivate->mWindow) + return FALSE; + + nsresult rv; + nsCOMPtr<nsIWebBrowser> webBrowser; + + if (embedPrivate->mWindow->GetWebBrowser(getter_AddRefs(webBrowser)) != NS_OK) + return FALSE; + + nsCOMPtr<nsIDocShell> docShell(do_GetInterface(webBrowser, &rv)); + if (rv != NS_OK) + return FALSE; + + nsCOMPtr<nsIContentViewer> currentViewer; + if (docShell->GetContentViewer(getter_AddRefs(currentViewer)) != NS_OK) + return FALSE; + + nsCOMPtr<nsIContentViewer> prevViewer; + if (currentViewer->GetPreviousViewer(getter_AddRefs(prevViewer)) != NS_OK) + return FALSE; + + nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(prevViewer, &rv)); + if (rv == NS_OK && print) { + PRBool printing = PR_FALSE; + if (print->GetDoingPrint(&printing) == NS_OK && printing) + g_printing = TRUE; + + if (print->GetDoingPrintPreview(&printing) == NS_OK && printing) + g_printing = TRUE; + } + + return g_printing; +} + void gtk_moz_embed_stop_load(GtkMozEmbed *embed) { Modified: kazehakase/trunk/module/embed/gecko/kz-mozthumbnailcreator.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/kz-mozthumbnailcreator.cpp 2007-04-09 01:35:44 UTC (rev 3157) +++ kazehakase/trunk/module/embed/gecko/kz-mozthumbnailcreator.cpp 2007-04-10 00:26:29 UTC (rev 3158) @@ -384,6 +384,11 @@ &rv); if (!ContentNav) return; +#ifdef ENABLE_GTKMOZEMBED + if (gtk_moz_embed_previous_content_is_printing(GTK_MOZ_EMBED(creator))) + return; +#endif + gtk_moz_embed_stop_load(GTK_MOZ_EMBED(creator)); nsCOMPtr<nsISHistory> SessionHistory;