[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: Re: KHTML printing
From: Waldo Bastian <bastian () kde ! org>
Date: 2000-08-30 23:05:44
[Download RAW message or body]
On Wed, 30 Aug 2000, Michael Haeckel wrote:
> On Wednesday, 30. August 2000, Waldo Bastian wrote:
> > What do you mean with miniatures? If you set your window to a width of
> > 1024 I expect (based on what the code currently does) that the output
> > will be scaled 50% so that the whole width of the window fits the page.
> > Is that what you see?
>
> No, that is only what I see if my fontsize for the reader window is around
> 12 Pt. For example if I set the font size to 24 and resize the window that
> the message fits in, only half of the width on the paper is used although
> is uses full width on the screen.
>
> If I remove m_part->setFontSizes(fontSizes) then I see that always. Even
> the line breaks are exactely at the same places then.
>
> > The print output uses its own font sizes. I don't know if there is a
> > particular reason for that.
>
> I think the best way would be if khtmlview would always use the same
> fontsize, e. g. 10 or 12 Pt for printing independant of the window width
> and the font size on the screen. Bigger or smaller fonts are not useful on
> the paper IMO. Netscape for example does it that way. The fontsize for
> printing is not even configurable there.
Ok. I think the following patch fixes this "The right way" (tm). It's on top
of the previous patch that I have put in CVS.
Please give it a good test with both kmail and konqueror.
Websites with images still give problems with postscript here btw.
Cheers,
Waldo
--
KDE/Linux, made for people, made by people.
["khtml.printing.diff" (text/x-c++)]
? khtml.diff
? error.log
? testkhtml.moc.loT
? DEADJOE
? khtml_cache.diff
? khtml_pagecache.diff
? khtmlview.diff
? saving.diff
? khtml.printing.diff
? rendering/render_frames.diff
Index: khtml_part.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
retrieving revision 1.232
diff -u -r1.232 khtml_part.cpp
--- khtml_part.cpp 2000/08/28 04:41:49 1.232
+++ khtml_part.cpp 2000/08/30 23:00:54
@@ -1907,6 +1907,10 @@
else // contentType must be "multipart/form-data"
d->m_userHeaders = "Content-Type: " + contentType + "; boundary=" + boundary;
+fprintf(stderr, "POST: User Header = %s\n", d->m_userHeaders.latin1());
+fprintf(stderr, "POST: Content type = %s\n", contentType.latin1());
+fprintf(stderr, "POST: FormData = %s\n", formData.data());
+
emit d->m_extension->openURLRequest( u, args );
}
}
Index: rendering/render_form.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_form.cpp,v
retrieving revision 1.50
diff -u -r1.50 render_form.cpp
--- rendering/render_form.cpp 2000/08/23 08:30:36 1.50
+++ rendering/render_form.cpp 2000/08/30 23:01:01
@@ -79,6 +79,7 @@
void RenderFormElement::blur()
{
+fprintf(stderr, "blurred: this = %p, className = %s\n", this, className());
disconnect(m_widget,SIGNAL(blurred()),this,SLOT(slotBlurred()));
m_widget->clearFocus();
connect(m_widget,SIGNAL(blurred()),this,SLOT(slotBlurred()));
@@ -86,6 +87,7 @@
void RenderFormElement::focus()
{
+fprintf(stderr, "focus: this = %p, className = %s\n", this, className());
disconnect(m_widget,SIGNAL(focused()),this,SLOT(slotFocused()));
m_widget->setFocus();
connect(m_widget,SIGNAL(focused()),this,SLOT(slotFocused()));
@@ -93,11 +95,13 @@
void RenderFormElement::slotBlurred()
{
+fprintf(stderr, "slotBlurred: this = %p, className = %s\n", this, className());
m_element->onBlur();
}
void RenderFormElement::slotFocused()
{
+fprintf(stderr, "slotFocused: this = %p, className = %s\n", this, className());
m_element->onFocus();
}
Index: rendering/render_root.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_root.cpp,v
retrieving revision 1.49
diff -u -r1.49 render_root.cpp
--- rendering/render_root.cpp 2000/07/27 19:14:39 1.49
+++ rendering/render_root.cpp 2000/08/30 23:01:02
@@ -53,7 +53,6 @@
void RenderRoot::calcWidth()
{
-
// the width gets set by KHTMLView::print when printing to a printer.
if(printingMode) return;
@@ -80,7 +79,12 @@
void RenderRoot::layout()
{
- //kdDebug(6040) << "RenderRoot::layout()" << endl;
+ kdDebug(6040) << "RenderRoot::layout()" << endl;
+ kdDebug(6040) << "m_width = " << m_width << " m_minWidth = " << m_minWidth << endl;
+ if (printingMode)
+ {
+ m_minWidth = m_width;
+ }
calcMinMaxWidth();
calcWidth();
@@ -94,9 +98,13 @@
// have to do that before layoutSpecialObjects() to get fixed positioned objects at the right place
m_view->resizeContents(docWidth(), docHeight());
- m_height = m_view->visibleHeight();
- m_width = m_view->visibleWidth();
- //kdDebug(0) << "visibleHeight = " << contentsHeight << endl;
+ if (!printingMode)
+ {
+ m_height = m_view->visibleHeight();
+ m_width = m_view->visibleWidth();
+ }
+ kdDebug(0) << "RenderRoot::layout height = " << m_height << endl;
+ kdDebug(0) << "RenderRoot::layout width = " << m_width << endl;
layoutSpecialObjects();
@@ -227,6 +235,7 @@
if(docHeight() != oldHeight || docHeight() < m_view->visibleHeight())
{
// kdDebug( 6040 ) << "resizing " << m_width << "," << m_height << endl;
+ kdDebug( 6040 ) << "updateHeight() calls resizeContents!!!" << endl;
m_view->resizeContents(docWidth(), docHeight());
} else {
m_view->repaintContents(0,0,1000000,1000000, FALSE); //sync repaint!
@@ -321,7 +330,9 @@
QRect RenderRoot::viewRect() const
{
- if (m_view)
+ if (printingMode)
+ return QRect(0,0, m_width, m_height);
+ else if (m_view)
return QRect(m_view->contentsX(),
m_view->contentsY(),
m_view->visibleWidth(),
@@ -331,7 +342,12 @@
int RenderRoot::docHeight() const
{
- int h = m_view->visibleHeight();
+ int h;
+ if (printingMode)
+ h = m_width;
+ else
+ h = m_view->visibleHeight();
+
if(m_first) {
int dh = m_first->height() + m_first->marginTop() + m_first->marginBottom();
if( m_first->lowestPosition() > dh )
@@ -344,7 +360,12 @@
int RenderRoot::docWidth() const
{
- int w = m_view->visibleWidth();
+ int w;
+ if (printingMode)
+ w = m_width;
+ else
+ w = m_view->visibleWidth();
+
if(m_first) {
int dw = m_first->width() + m_first->marginLeft() + m_first->marginRight();
if( dw > w )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic