From c0c8d854a31148715fadf546b22ed1a8c26a2214 Mon Sep 17 00:00:00 2001 From: "amardare%qnx.com" Date: Fri, 30 Apr 2004 20:03:43 +0000 Subject: [PATCH] Changes for qnx/photon platform. They should not affect building/runtime other platforms. When printing from the embedded application, allow it to set the print frame, BG colors, BG images in the print settings, according to the preferences. Also changes for ShowTooltip ( it was broken ). Known problem - the location is broken if the page has frames and the tooltip is inside a frame. --- embedding/browser/photon/Makefile.in | 2 +- embedding/browser/photon/src/EmbedPrivate.cpp | 4 ++++ embedding/browser/photon/src/EmbedWindow.cpp | 19 ++++++++++++------- embedding/browser/photon/src/PtMozilla.cpp | 7 +++++++ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/embedding/browser/photon/Makefile.in b/embedding/browser/photon/Makefile.in index 8c5e29f0d58..15f7c0984a5 100644 --- a/embedding/browser/photon/Makefile.in +++ b/embedding/browser/photon/Makefile.in @@ -25,7 +25,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS=src +DIRS=src mozserver ifdef ENABLE_TESTS DIRS += tests diff --git a/embedding/browser/photon/src/EmbedPrivate.cpp b/embedding/browser/photon/src/EmbedPrivate.cpp index ae7dcb70bcd..34b6570122b 100644 --- a/embedding/browser/photon/src/EmbedPrivate.cpp +++ b/embedding/browser/photon/src/EmbedPrivate.cpp @@ -962,6 +962,10 @@ static void mozilla_set_default_pref( nsIPref *pref ) pref->SetCharPref( "network.proxy.ftp_port", "80" ); pref->SetCharPref( "network.proxy.gopher_port", "80" ); + pref->SetCharPref( "general.skins.selectedSkin", "classic/1.0" ); + pref->SetIntPref( "browser.cache.memory.capacity", 100 ); /* 100k ( no cache ) */ + pref->SetCharPref( "user.print.print_frame", "print_frame_selected" ); + pref->SavePrefFile( nsnull ); } diff --git a/embedding/browser/photon/src/EmbedWindow.cpp b/embedding/browser/photon/src/EmbedWindow.cpp index 02b9243378f..a9cbbd9a40c 100644 --- a/embedding/browser/photon/src/EmbedWindow.cpp +++ b/embedding/browser/photon/src/EmbedWindow.cpp @@ -490,12 +490,12 @@ EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) { nsAutoString tipText ( aTipText ); - const char* tipString = ToNewCString(tipText); + const char* tipString = ToNewCString(tipText), *font = "TextFont08"; PtArg_t args[10]; PhRect_t extent; PhDim_t dim; PhPoint_t pos = {0, 0}; - int n = 0; + int n = 0, w, h; if (sTipWindow) PtDestroyWidget(sTipWindow); @@ -506,22 +506,27 @@ EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, PtWidget_t *window; window = NS_STATIC_CAST(PtWidget_t *, mainWidget->GetNativeData(NS_NATIVE_WINDOW)); - PgExtentText(&extent, &pos, NULL, tipString, 0); - dim.w = extent.lr.x - extent.ul.x + 1; - dim.h = extent.lr.y - extent.ul.y + 1; + PgExtentText(&extent, &pos, font, tipString, 0); + w = extent.lr.x - extent.ul.x + 1; + h = extent.lr.y - extent.ul.y + 1; - pos.x = aXCoords; - pos.y = aYCoords; n = 0; + pos.x = aXCoords; + pos.y = aYCoords + 10; /* we add 10 so that we don't position it right under the mouse */ + dim.w = w + 6; dim.h = h + 6; PtSetArg(&args[n++], Pt_ARG_POS, &pos, 0); PtSetArg(&args[n++], Pt_ARG_DIM, &dim, 0); + PtSetArg( &args[n++], Pt_ARG_REGION_OPAQUE, Ph_EV_EXPOSE, Ph_EV_EXPOSE); sTipWindow = PtCreateWidget(PtRegion, window, n, args); + n = 0; pos.x = pos.y = 0; + dim.w = w; dim.h = h; PtSetArg(&args[n++], Pt_ARG_POS, &pos, 0); PtSetArg(&args[n++], Pt_ARG_DIM, &dim, 0); PtSetArg(&args[n++], Pt_ARG_FLAGS, Pt_HIGHLIGHTED, -1 ); PtSetArg(&args[n++], Pt_ARG_FILL_COLOR, 0xfeffb1, 0); + PtSetArg(&args[n++], Pt_ARG_TEXT_FONT, font, 0); PtSetArg(&args[n++], Pt_ARG_TEXT_STRING, tipString, 0); PtSetArg(&args[n++], Pt_ARG_BASIC_FLAGS, Pt_STATIC_GRADIENT | Pt_TOP_OUTLINE | Pt_LEFT_OUTLINE | Pt_RIGHT_OUTLINE | Pt_BOTTOM_OUTLINE, -1 ); diff --git a/embedding/browser/photon/src/PtMozilla.cpp b/embedding/browser/photon/src/PtMozilla.cpp index f9765436668..a8cf8bd60e0 100644 --- a/embedding/browser/photon/src/PtMozilla.cpp +++ b/embedding/browser/photon/src/PtMozilla.cpp @@ -733,6 +733,13 @@ mozilla_set_pref( PtWidget_t *widget, char *option, char *value ) else if( !strcmp( option, "Use_Explicit_Accept_Headers" ) ) ; /* not used */ else if( !strcmp( option, "Visitation_Horizon" ) ) ; /* not used */ + else if( !strcmp( option, "Print_Frame" ) ) + pref->SetCharPref( "user.print.print_frame", value ); + else if( !strcmp( option, "SetPrintBGColors" ) ) + pref->SetCharPref( "user.print.SetPrintBGColors", value ); + else if( !strcmp( option, "SetPrintBGImages" ) ) + pref->SetCharPref( "user.print.SetPrintBGImages", value ); + pref->SavePrefFile( nsnull ); }