Hi, 

 Here is a patch against CVS that adds ability to print on arbitrary-sized
pages for gtk port, landscape and portrait.

 It doesn't emit BoundingBox (I don't know the scale between AW units and PS
units) - but it would be handy only if printing to custom-sized pages. 

 "Scale.." thing is not supported (what is it supposed to do?).

 May be it would be nice to include it in 0.7.13?

 
 Best regards,
  -Vlad
Only in abi-0.7.11/src: Linux_2.2.5-15_i386_DBG
diff -ru abi-0.7.11~/src/af/xap/unix/xap_UnixDlg_Print.cpp 
abi-0.7.11/src/af/xap/unix/xap_UnixDlg_Print.cpp
--- abi-0.7.11~/src/af/xap/unix/xap_UnixDlg_Print.cpp   Sat Feb 17 18:04:59 2001
+++ abi-0.7.11/src/af/xap/unix/xap_UnixDlg_Print.cpp    Sat Feb 17 20:24:39 2001
@@ -585,6 +585,7 @@
 
        // set the color mode
        m_pPSGraphics->setColorSpace(m_cColorSpace);
+       m_pPSGraphics->setPageSize(m_pageSize);
        
        m_answer = a_OK;
        return;
diff -ru abi-0.7.11~/src/af/xap/unix/xap_UnixPSGraphics.cpp 
abi-0.7.11/src/af/xap/unix/xap_UnixPSGraphics.cpp
--- abi-0.7.11~/src/af/xap/unix/xap_UnixPSGraphics.cpp  Sat Feb 17 18:04:59 2001
+++ abi-0.7.11/src/af/xap/unix/xap_UnixPSGraphics.cpp   Sat Feb 17 20:53:32 2001
@@ -39,6 +39,7 @@
 #include "xap_UnixFontXLFD.h"
 #include "xap_EncodingManager.h"
 
+
 // the resolution that we report to the application (pixels per inch).
 #define PS_RESOLUTION          7200
 
@@ -80,6 +81,7 @@
 PS_Graphics::~PS_Graphics()
 {
        // TODO free stuff
+       FREEP(m_szPageSizeName);
 }
 
 bool PS_Graphics::queryProperties(GR_Graphics::Properties gp) const
@@ -682,6 +684,11 @@
                m_ps->formatComment("Creator",&m_szSoftwareNameAndVersion,1);
        if (m_szTitle && *m_szTitle)
                m_ps->formatComment("Title",&m_szTitle,1);
+       m_ps->formatComment("Orientation", isPortrait() ? "Portrait" : "Landscape");
+
+       //TODO: emit iWidth and iHeight in BoundingBox somehow (what's a 
+       //factor between them and PS units (that are 1/72 of inch IIRC)
+       m_ps->formatComment("DocumentPaperSizes",m_szPageSizeName);
 
        _emit_DocumentNeededResources();
        
@@ -1307,4 +1314,11 @@
          pEnglishFont=m_pCurrentFont;
          pChineseFont=findMatchPSFontCJK(pEnglishFont);
        }
+};
+
+void PS_Graphics::setPageSize(char* pageSizeName, UT_uint32 iwidth, UT_uint32 
+iheight)
+{
+       m_szPageSizeName = UT_strdup(pageSizeName);
+       m_iWidth = iwidth; 
+       m_iHeight = iheight;
 };
Only in abi-0.7.11/src/af/xap/unix: xap_UnixPSGraphics.cpp-orig
diff -ru abi-0.7.11~/src/af/xap/unix/xap_UnixPSGraphics.h 
abi-0.7.11/src/af/xap/unix/xap_UnixPSGraphics.h
--- abi-0.7.11~/src/af/xap/unix/xap_UnixPSGraphics.h    Sat Feb 17 18:04:59 2001
+++ abi-0.7.11/src/af/xap/unix/xap_UnixPSGraphics.h     Sat Feb 17 20:32:15 2001
@@ -105,6 +105,7 @@
        virtual void fillRect(GR_Color3D c, UT_sint32 x, UT_sint32 y, UT_sint32 w, 
UT_sint32 h);
        virtual void fillRect(GR_Color3D c, UT_Rect &r);
 
+       virtual void setPageSize(char* pageSizeName, UT_uint32 iwidth = 0, UT_uint32 
+iheight=0);
 protected:
        UT_uint32               _scale(UT_uint32 units) const;
        bool                    _startDocument(void);
@@ -134,6 +135,9 @@
        bool                    m_bNeedStroked;
        bool                    m_bIsFile;
        UT_sint32               m_iLineWidth;
+       UT_uint32               m_iWidth;
+       UT_uint32               m_iHeight;
+       char*                   m_szPageSizeName;
 
        GR_Graphics::ColorSpace m_cs;
        
diff -ru abi-0.7.11~/src/wp/ap/xp/ap_EditMethods.cpp 
abi-0.7.11/src/wp/ap/xp/ap_EditMethods.cpp
--- abi-0.7.11~/src/wp/ap/xp/ap_EditMethods.cpp Sat Feb 17 18:05:00 2001
+++ abi-0.7.11/src/wp/ap/xp/ap_EditMethods.cpp  Sat Feb 17 20:17:04 2001
@@ -3772,7 +3772,7 @@
        da.pG = NULL;
 
        fp_PageSize ps = pPrintView->getPageSize();
-
+       
        pGraphics->setPortrait (ps.isPortrait ());
 
        if(pGraphics->startPrint())
@@ -3786,7 +3786,7 @@
                      // pGraphics->m_iRasterPosition when
                      // iHeight is allowed to vary page to page
                      pGraphics->m_iRasterPosition = (k-1)*iHeight;
-                     pGraphics->startPage(pDocName, k, true, iWidth, iHeight);
+                     pGraphics->startPage(pDocName, k, pGraphics->isPortrait(), 
+iWidth, iHeight);
                      pPrintView->draw(k-1, &da);
                    }
              }
@@ -3799,7 +3799,7 @@
                      // pGraphics->m_iRasterPosition when
                      // iHeight is allowed to vary page to page
                      pGraphics->m_iRasterPosition = (k-1)*iHeight;
-                     pGraphics->startPage(pDocName, k, true, iWidth, iHeight);
+                     pGraphics->startPage(pDocName, k, pGraphics->isPortrait(), 
+iWidth, iHeight);
                      pPrintView->draw(k-1, &da);
                    }
              }

Reply via email to