Maybe some old-timers from this list rememmber this beast. Paul Rohr
probably does. I first wrote this patch in the 0.3.4 days, and the first
two revisions were rejected because of their incompleteness and bugginess.
Today I decided to resurect normal mode support, and I applied the
multi-year-old patch to the current tree by hand. I started working on it
where I had left off.

This version no longer crashes when printing in normal mode, leaves rulers
the old way when switching to normal mode, or creates new pages with
different sizes than the existing pages. That is not to say that it is not
buggy. There are still many bugs that make this mode not ready for prime
time, the most significant of which is some confusion about bottom page
margins (when you press the up arrow key at the top of a page, it gets
very confused, asserts, and does not move the cursor at all, as well as
some other side effects of this margin confusion bug). I'm working on
these bugs. I think the easiest way to keep this patch up to date would be
to check it into CVS. The default Page Layout mode still works fine, and
if Normal mode is still not ready for prime time by our next release, we
can always comment out the menu items so that only Page Layout mode is
possible. Since this changes FV_View a lot to make it more flexible, I
would not want people to make changes to the old version while this is
still in development.

I'd appreciate your opinion on whether this should be checked into CVS or
not, since it doesn't really Just Work yet. As always, don't respond to my
address as my DNS is currently @#$%ed. I'll check the list archives.


Aaron Lehmann
Index: src/text/fmt/xp/fl_DocLayout.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fl_DocLayout.cpp,v
retrieving revision 1.84
diff -u -r1.84 fl_DocLayout.cpp
--- src/text/fmt/xp/fl_DocLayout.cpp    2000/06/15 07:07:15     1.84
+++ src/text/fmt/xp/fl_DocLayout.cpp    2000/06/16 02:28:30
@@ -168,9 +168,10 @@
 
        if (m_pG->queryProperties(GR_Graphics::DGP_SCREEN))
        {
-               // add page view dimensions 
-               iHeight += fl_PAGEVIEW_PAGE_SEP * (count - 1);
-               iHeight += fl_PAGEVIEW_MARGIN_Y * 2;
+               // add page view dimensions
+               UT_uint32 iPageSep = m_pView->getPageviewPageSep();
+               iHeight += iPageSep * (count - 1);
+               iHeight += iPageSep * 2;
        }
 
        return iHeight;
@@ -193,7 +194,7 @@
        if (m_pG->queryProperties(GR_Graphics::DGP_SCREEN))
        {
                // add page view dimensions 
-               iWidth += fl_PAGEVIEW_MARGIN_X * 2;
+               iWidth += m_pView->getPageviewMarginX() * 2;
        }
 
        return iWidth;
@@ -303,7 +304,7 @@
        m_vecPages.deleteNthItem(ndx);
        delete pPage;
                
-       // let the view know that we created a new page,
+       // let the view know that we deleted a page,
        // so that it can update the scroll bar ranges
        // and whatever else it needs to do.
 
Index: src/text/fmt/xp/fl_DocLayout.h
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fl_DocLayout.h,v
retrieving revision 1.43
diff -u -r1.43 fl_DocLayout.h
--- src/text/fmt/xp/fl_DocLayout.h      2000/05/29 23:41:11     1.43
+++ src/text/fmt/xp/fl_DocLayout.h      2000/06/16 02:28:30
@@ -41,12 +41,6 @@
 class fl_PartOfBlock;
 
 
-// the following get used by view and layout code, 
-// since they're private to the formatter, we stick 'em here
-#define fl_PAGEVIEW_PAGE_SEP   20              // must be <= MARGIN_Y
-#define fl_PAGEVIEW_MARGIN_X   25              
-#define fl_PAGEVIEW_MARGIN_Y   25              
-
 // ----------------------------------------------------------------
 /*
        FL_DocLayout is a formatted representation of a specific PD_Document, 
@@ -86,6 +80,7 @@
        inline PD_Document*     getDocument(void) const { return m_pDoc; }
        inline fl_BlockLayout* getPendingBlock(void) const { return m_pPendingBlock; 
};
        inline fl_PartOfBlock* getPendingWord(void) const { return m_pPendingWord; };
+       inline void setPageSize(UT_sint32 iW, UT_sint32 iH) { m_pageSize.Set((double) 
+iW/100.0, (double) iH/100.0, fp_PageSize::inch); }
        
        UT_sint32               getHeight();
        UT_sint32       getWidth();
Index: src/text/fmt/xp/fl_SectionLayout.h
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fl_SectionLayout.h,v
retrieving revision 1.35
diff -u -r1.35 fl_SectionLayout.h
--- src/text/fmt/xp/fl_SectionLayout.h  2000/04/20 00:52:24     1.35
+++ src/text/fmt/xp/fl_SectionLayout.h  2000/06/16 02:28:30
@@ -176,6 +176,11 @@
        inline UT_sint32                        getSpaceAfter(void) const { return 
m_iSpaceAfter; }
        inline UT_sint32                        getSpaceAfterInLayoutUnits(void) const 
{ return m_iSpaceAfterLayoutUnits; }
        
+       inline void setLeftMargin(UT_sint32 iM) { m_iLeftMargin = iM; }
+       inline void setRightMargin(UT_sint32 iM) { m_iRightMargin = iM; }
+       inline void setTopMargin(UT_sint32 iM) { m_iTopMargin = iM; }
+       inline void setBottomMargin(UT_sint32 iM) { m_iBottomMargin = iM; }
+       
        UT_uint32                       getNumColumns(void) const;
        UT_uint32                       getColumnGap(void) const;
        UT_uint32                       getColumnGapInLayoutUnits(void) const;
Index: src/text/fmt/xp/fp_Page.h
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fp_Page.h,v
retrieving revision 1.22
diff -u -r1.22 fp_Page.h
--- src/text/fmt/xp/fp_Page.h   2000/05/18 06:10:05     1.22
+++ src/text/fmt/xp/fp_Page.h   2000/06/16 02:28:30
@@ -53,6 +53,7 @@
        UT_sint32               getWidthInLayoutUnits(void) const;
        UT_sint32               getHeight(void) const;
        UT_sint32               getHeightInLayoutUnits(void) const;
+       void                    setSize(UT_sint32 iW, UT_sint32 iH) { 
+m_pageSize.Set((double) iW/m_iResolution, (double) iH/m_iResolution, 
+fp_PageSize::inch); }
        UT_sint32               getBottom(void) const;
        fp_Page*                getNext(void) const;
        fp_Page*                getPrev(void) const;
@@ -83,6 +84,8 @@
 
        fp_HdrFtrContainer*     getHeaderContainer(fl_HdrFtrSectionLayout*);
        fp_HdrFtrContainer*     getFooterContainer(fl_HdrFtrSectionLayout*);
+
+       inline void reformat (void) { _reformat(); }
        
 #ifdef FMT_TEST
        void                    __dump(FILE * fp) const;
Index: src/text/fmt/xp/fv_View.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.cpp,v
retrieving revision 1.269
diff -u -r1.269 fv_View.cpp
--- src/text/fmt/xp/fv_View.cpp 2000/06/11 14:56:12     1.269
+++ src/text/fmt/xp/fv_View.cpp 2000/06/16 02:28:34
@@ -52,6 +52,7 @@
 #include "ap_TopRuler.h"
 #include "ap_LeftRuler.h"
 #include "ap_Prefs.h"
+#include "ap_FrameData.h" // For accessing rulers
 
 #include "sp_spell.h"
 
@@ -91,7 +92,7 @@
 //     m_bPointAP = UT_FALSE;
        m_pAutoScrollTimer      = NULL;
        m_pAutoCursorTimer  = NULL;
-        m_pParentData = pParentData;
+       m_pParentData = pParentData;
        
        // initialize prefs cache
        pApp->getPrefsValueBool(AP_PREF_KEY_CursorBlink, &m_bCursorBlink);
@@ -125,6 +126,9 @@
        m_startPosition = 0;
        m_bShowPara = UT_FALSE;
        m_bCursorIsOn = UT_FALSE;
+       
+       m_ViewTypeChanged = UT_FALSE;
+       setViewType (FV_VIEWTYPE_PGLAYOUT);
 }
 
 FV_View::~FV_View()
@@ -4092,9 +4096,9 @@
                                   UT_Bool bDirtyRunsOnly, UT_Bool bClip)
 {
        xxx_UT_DEBUGMSG(("FV_View::draw_3 [x %ld][y %ld][w %ld][h %ld][bClip %ld]\n"
-                                "\t\twith [yScrollOffset %ld][windowHeight %ld]\n",
-                                x,y,width,height,bClip,
-                                m_yScrollOffset,m_iWindowHeight));
+                                        "\t\twith [yScrollOffset %ld][windowHeight 
+%ld]\n",
+                                        x,y,width,height,bClip,
+                                        m_yScrollOffset,m_iWindowHeight));
 
        // this can happen when the frame size is decreased and
        // only the toolbars show...
@@ -4122,6 +4126,23 @@
                m_pG->setClipRect(&r);
        }
 
+       switch (m_ViewType)
+       {
+       case FV_VIEWTYPE_PGLAYOUT:
+               _draw_pglayout (x, y, width, height, bDirtyRunsOnly, bClip);
+               break;
+       case FV_VIEWTYPE_NORMAL:
+               _draw_normal (x, y, width, height, bDirtyRunsOnly, bClip);
+               break;
+       default:
+               UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
+       }
+}
+
+void FV_View::_draw_pglayout (UT_sint32 x, UT_sint32 y,
+                                                         UT_sint32 width, UT_sint32 
+height,
+                                                         UT_Bool bDirtyRunsOnly, 
+UT_Bool bClip)
+{
        // figure out where pages go, based on current window dimensions
        // TODO: don't calc for every draw
        // HYP:  cache calc results at scroll/size time
@@ -4139,13 +4160,13 @@
 
        if (!bDirtyRunsOnly)
        {
-               if (m_xScrollOffset < fl_PAGEVIEW_MARGIN_X)
+               if (m_xScrollOffset < (UT_sint32) fl_PAGEVIEW_MARGIN_X)
                {
                        // fill left margin
                        m_pG->fillRect(clrMargin, 0, 0, fl_PAGEVIEW_MARGIN_X - 
m_xScrollOffset, m_iWindowHeight);
                }
 
-               if (m_yScrollOffset < fl_PAGEVIEW_MARGIN_Y)
+               if (m_yScrollOffset < (UT_sint32) fl_PAGEVIEW_MARGIN_Y)
                {
                        // fill top margin
                        m_pG->fillRect(clrMargin, 0, 0, m_iWindowWidth, 
fl_PAGEVIEW_MARGIN_Y - m_yScrollOffset);
@@ -4301,6 +4322,296 @@
        }
 #endif
 
+}
+
+
+void FV_View::_draw_normal     (UT_sint32 x, UT_sint32 y,
+                                                        UT_sint32 width, UT_sint32 
+height,
+                                                        UT_Bool bDirtyRunsOnly, 
+UT_Bool bClip)
+{
+       // figure out where pages go, based on current window dimensions
+       // TODO: don't calc for every draw
+       // HYP:  cache calc results at scroll/size time
+       UT_sint32 iDocHeight = m_pLayout->getHeight();
+       
+       // TODO: handle positioning within oversized viewport
+       // TODO: handle variable-size pages (envelope, landscape, etc.)
+
+       UT_RGBColor clrMargin(127,127,127);             // dark gray
+
+       if (!bDirtyRunsOnly)
+       {
+               if (m_xScrollOffset < (UT_sint32) fl_PAGEVIEW_MARGIN_X)
+               {
+                       // fill left margin
+                       m_pG->fillRect(clrMargin, 0, 0, fl_PAGEVIEW_MARGIN_X - 
+m_xScrollOffset, m_iWindowHeight);
+               }
+
+               if (m_yScrollOffset < (UT_sint32) fl_PAGEVIEW_MARGIN_Y)
+               {
+                       // fill top margin
+                       m_pG->fillRect(clrMargin, 0, 0, m_iWindowWidth, 
+fl_PAGEVIEW_MARGIN_Y - m_yScrollOffset);
+               }
+       }
+
+       UT_sint32 curY = fl_PAGEVIEW_MARGIN_Y;
+       fp_Page* pPage = m_pLayout->getFirstPage();
+       while (pPage)
+       {
+               UT_sint32 iPageWidth = pPage->getWidth();
+               UT_sint32 iPageHeight = pPage->getHeight();
+               UT_sint32 adjustedTop    = curY - m_yScrollOffset;
+               UT_sint32 adjustedBottom = adjustedTop + iPageHeight + 
+fl_PAGEVIEW_PAGE_SEP;
+               if (adjustedTop > m_iWindowHeight)
+               {
+                       // the start of this page is past the bottom
+                       // of the window, so we don't need to draw it.
+
+                       xxx_UT_DEBUGMSG(("not drawing page A: iPageHeight=%d curY=%d 
+nPos=%d m_iWindowHeight=%d\n",
+                                                        iPageHeight,
+                                                        curY,
+                                                        m_yScrollOffset,
+                                                        m_iWindowHeight));
+
+                       // since all other pages are below this one, we
+                       // don't need to draw them either.  exit loop now.
+                       break;
+               }
+               else if (adjustedBottom < 0)
+               {
+                       // the end of this page is above the top of
+                       // the window, so we don't need to draw it.
+
+                       xxx_UT_DEBUGMSG(("not drawing page B: iPageHeight=%d curY=%d 
+nPos=%d m_iWindowHeight=%d\n",
+                                                        iPageHeight,
+                                                        curY,
+                                                        m_yScrollOffset,
+                                                        m_iWindowHeight));
+               }
+               else if (adjustedTop > y + height)
+               {
+                       // the top of this page is beyond the end
+                       // of the clipping region, so we don't need
+                       // to draw it.
+
+                       xxx_UT_DEBUGMSG(("not drawing page C: iPageHeight=%d curY=%d 
+nPos=%d m_iWindowHeight=%d y=%d h=%d\n",
+                                                        iPageHeight,
+                                                        curY,
+                                                        m_yScrollOffset,
+                                                        m_iWindowHeight,
+                                                        y,height));
+               }
+               else if (adjustedBottom < y)
+               {
+                       // the bottom of this page is above the top
+                       // of the clipping region, so we don't need
+                       // to draw it.
+
+                       xxx_UT_DEBUGMSG(("not drawing page D: iPageHeight=%d curY=%d 
+nPos=%d m_iWindowHeight=%d y=%d h=%d\n",
+                                                        iPageHeight,
+                                                        curY,
+                                                        m_yScrollOffset,
+                                                        m_iWindowHeight,
+                                                        y,height));
+               }
+               else
+               {
+                       // this page is on screen and intersects the clipping region,
+                       // so we *DO* draw it.
+
+                       xxx_UT_DEBUGMSG(("drawing page E: iPageHeight=%d curY=%d 
+nPos=%d m_iWindowHeight=%d y=%d h=%d\n",
+                                                        
+iPageHeight,curY,m_yScrollOffset,m_iWindowHeight,y,height));
+
+                       dg_DrawArgs da;
+
+                       da.bDirtyRunsOnly = bDirtyRunsOnly;
+                       da.pG = m_pG;
+                       da.xoff = fl_PAGEVIEW_MARGIN_X - m_xScrollOffset;
+                       da.yoff = adjustedTop;
+
+                       UT_sint32 adjustedLeft  = fl_PAGEVIEW_MARGIN_X - 
+m_xScrollOffset;
+                       UT_sint32 adjustedRight = adjustedLeft + iPageWidth;
+
+                       adjustedBottom -= fl_PAGEVIEW_PAGE_SEP;
+                       
+                       UT_RGBColor clrPaper(255,255,255);
+
+                       if (!bDirtyRunsOnly || pPage->needsRedraw())
+                       {
+                               
+m_pG->fillRect(clrPaper,adjustedLeft+1,adjustedTop+1,iPageWidth-1,iPageHeight-1);
+                       }
+                       
+                       pPage->draw(&da);
+
+                       // draw page decorations
+                       UT_RGBColor clr(0,0,0);         // black
+                       UT_RGBColor clrLG(211,211,211); // light grey
+                       m_pG->setColor(clrLG);
+
+                       // one pixel border
+                       m_pG->drawLine(adjustedLeft, adjustedTop, adjustedRight, 
+adjustedTop);
+                       m_pG->drawLine(adjustedRight, adjustedTop, adjustedRight, 
+adjustedBottom);
+                       m_pG->drawLine(adjustedRight, adjustedBottom, adjustedLeft, 
+adjustedBottom);
+                       m_pG->drawLine(adjustedLeft, adjustedBottom, adjustedLeft, 
+adjustedTop);
+                       m_pG->setColor(clr);
+
+                       // fill to right of page
+                       m_pG->fillRect(clrPaper, adjustedRight + 1, adjustedTop, 
+m_iWindowWidth - (adjustedRight + 1), iPageHeight + 1);
+
+                       // fill separator below page
+                       m_pG->fillRect(clrMargin, adjustedLeft, adjustedBottom + 1, 
+m_iWindowWidth - adjustedLeft, fl_PAGEVIEW_PAGE_SEP);
+               }
+               
+               curY += iPageHeight + fl_PAGEVIEW_PAGE_SEP;
+
+               pPage = pPage->getNext();
+       }
+
+       if (curY < iDocHeight)
+       {
+               // fill below bottom of document
+               UT_sint32 y = curY - m_yScrollOffset + 1;
+               UT_sint32 h = m_iWindowHeight - y;
+
+               m_pG->fillRect(clrMargin, 0, y, m_iWindowWidth, h);
+       }
+
+       if (bClip)
+       {
+               m_pG->setClipRect(NULL);
+       }
+
+#if 0
+       {
+               // Some test code for the graphics interface.
+               UT_RGBColor clrRed(255,0,0);
+               m_pG->setColor(clrRed);
+               m_pG->drawLine(10,10,20,10);
+               m_pG->drawLine(20,11,30,11);
+               m_pG->fillRect(clrRed,50,10,10,10);
+               m_pG->fillRect(clrRed,60,20,10,10);
+       }
+#endif
+}
+
+void FV_View::setViewType(FVViewType inViewType)
+{
+       UT_uint32 count, iNumPages = m_pLayout->countPages();
+       UT_sint32 iPageWidth, iPageHeight;
+       fp_Page * pPage = m_pLayout->getNthPage (0);
+       iPageWidth = pPage->getWidth ();
+       iPageHeight = pPage->getHeight ();
+
+       switch (inViewType)
+       {
+       case FV_VIEWTYPE_PGLAYOUT:
+               if (m_ViewType != inViewType || !m_ViewTypeChanged)
+               {
+                       if (m_ViewTypeChanged && m_ViewType == FV_VIEWTYPE_NORMAL)
+                       {
+                               fl_DocSectionLayout * section = m_pLayout -> 
+getFirstSection();
+                               UT_ASSERT (section);
+                               
+                               UT_uint32 existingMarginT = section->getTopMargin();
+                               UT_uint32 existingMarginB = 
+section->getBottomMargin();
+                               UT_uint32 existingMarginR = section->getRightMargin();
+                               UT_uint32 existingMarginL = section->getLeftMargin();
+                               
+                               m_iTopMargin = 100;
+                               m_iBottomMargin = 100;
+                               m_iRightMargin = 100;
+                               m_iLeftMargin = 100;
+                               
+                               while (section)
+                               {
+                                       section->setTopMargin(m_iTopMargin);
+                                       section->setBottomMargin(m_iBottomMargin);
+                                       section->setRightMargin(m_iRightMargin);
+                                       section->setLeftMargin (m_iLeftMargin);
+                                       section = section->getNextDocSection ();
+                               }
+                               
+                               iPageWidth += m_iRightMargin + m_iLeftMargin - 
+existingMarginL - existingMarginR;
+                               iPageHeight += m_iTopMargin + m_iBottomMargin - 
+existingMarginT - existingMarginB;
+
+                               // Set new size for all pages
+                               for (count=1; count != iNumPages+1; ++count)
+                               {
+                                       pPage->setSize (iPageWidth, iPageHeight);
+                                       pPage->reformat();
+                                       if (count != iNumPages) pPage = 
+m_pLayout->getNthPage (count);
+                               }
+                               
+                               // Set page size for new pages
+                               m_pLayout->setPageSize (iPageWidth, iPageHeight);
+                       }
+                       fl_PAGEVIEW_MARGIN_X = 25;
+                       fl_PAGEVIEW_MARGIN_Y = 25;
+                       fl_PAGEVIEW_PAGE_SEP = 20;
+               }
+               break;
+               
+       case FV_VIEWTYPE_NORMAL:
+               if (m_ViewType != inViewType)
+               {
+                       fl_DocSectionLayout * section = m_pLayout -> 
+getFirstSection();
+                       
+                       fl_PAGEVIEW_MARGIN_X = 0;
+                       fl_PAGEVIEW_MARGIN_Y = 0;
+                       fl_PAGEVIEW_PAGE_SEP = 1;
+                       
+                       UT_ASSERT (section);
+
+                       UT_uint32 existingMarginT = section->getTopMargin();
+                       UT_uint32 existingMarginB = section->getBottomMargin();
+                       UT_uint32 existingMarginR = section->getRightMargin();
+                       UT_uint32 existingMarginL = section->getLeftMargin();
+                       
+                       m_iTopMargin = 0;
+                       m_iBottomMargin = 0;
+                       m_iRightMargin = NORMAL_VIEW_MARGIN_L;
+                       m_iLeftMargin = NORMAL_VIEW_MARGIN_L;
+                       
+                       while (section)
+                       {
+                               section->setTopMargin(m_iTopMargin);
+                               section->setBottomMargin(m_iBottomMargin);
+                               section->setRightMargin(m_iRightMargin);
+                               section->setLeftMargin (m_iLeftMargin);
+                               section = section->getNextDocSection ();
+                       }
+                       
+                       iPageWidth += m_iRightMargin + m_iLeftMargin - existingMarginL 
+- existingMarginR;
+                       iPageHeight += m_iTopMargin + m_iBottomMargin - 
+existingMarginT - existingMarginB;
+
+                       for (count=1; count != iNumPages+1; ++count)
+                       {
+                               pPage->setSize (iPageWidth, iPageHeight);
+                               pPage->reformat();
+                               if (count != iNumPages) pPage = m_pLayout->getNthPage 
+(count);
+                       }
+                       // Set page size for new pages
+                       m_pLayout->setPageSize (iPageWidth, iPageHeight);
+               }
+               break;
+
+       default:
+               UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
+       }
+       m_ViewType = inViewType;
+       draw(NULL);
+       m_ViewTypeChanged = UT_TRUE;
+       
+       // We need to redraw the rulers, for obvious reasons
+       XAP_Frame * pFrame = (XAP_Frame *) getParentData();
+       AP_FrameData * pFrameData = (AP_FrameData *) pFrame->getFrameData();
+       pFrameData->m_pTopRuler->draw(NULL);
+       pFrameData->m_pLeftRuler->draw(NULL);
 }
 
 void FV_View::cmdScroll(AV_ScrollCmd cmd, UT_uint32 iPos)
Index: src/text/fmt/xp/fv_View.h
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.h,v
retrieving revision 1.122
diff -u -r1.122 fv_View.h
--- src/text/fmt/xp/fv_View.h   2000/06/10 13:58:21     1.122
+++ src/text/fmt/xp/fv_View.h   2000/06/16 02:28:34
@@ -52,6 +52,8 @@
 class UT_AlphaHashTable;
 class PP_AttrProp;
 
+#define NORMAL_VIEW_MARGIN_L 15
+
 typedef enum _FVDocPos
 {
        FV_DOCPOS_BOB, FV_DOCPOS_EOB,   // block
@@ -84,6 +86,13 @@
        UT_uint32 page;
 };
 
+typedef enum _FVViewType
+{
+       FV_VIEWTYPE_PGLAYOUT, // The default "page layout" view
+       FV_VIEWTYPE_NORMAL,   // A "normal" less-WYSIWYG view that does not show 
+margins or individual pages
+       FV_VIEWTYPE_OUTLINE   // An outline view. Currently unimplemented.
+} FVViewType;
+
 class FV_View : public AV_View
 {
        friend class fl_DocListener;
@@ -234,12 +243,26 @@
 
        FV_DocCount                     countWords(void);
 
-    void            setShowPara(UT_Bool);    
+    void            setShowPara(UT_Bool); 
     inline UT_Bool  getShowPara(void) const { return m_bShowPara; };
+       
+       inline UT_uint32  getPageviewPageSep(void) const { return 
+fl_PAGEVIEW_PAGE_SEP; };
+       inline UT_uint32  getPageviewMarginX(void) const { return 
+fl_PAGEVIEW_MARGIN_X; };
+       inline UT_uint32  getPageviewMarginY(void) const { return 
+fl_PAGEVIEW_MARGIN_Y; };
+
+       inline FVViewType getViewType (void) const { return m_ViewType; };
+       void setViewType(FVViewType inViewType);
+
 protected:
        void                            _generalUpdate(void);
        
+       // _draw() is now a function that just calls the appropriate view-specific 
+one.
        void                            _draw(UT_sint32, UT_sint32, UT_sint32, 
UT_sint32, UT_Bool bDirtyRunsOnly, UT_Bool bClip=UT_FALSE);
+
+       // The following functions are candidates for the one that actaully
+       // draws the view. The right one is called by _draw().
+       void _draw_pglayout(UT_sint32, UT_sint32, UT_sint32, UT_sint32, UT_Bool 
+bDirtyRunsOnly, UT_Bool bClip=UT_FALSE);
+       void _draw_normal(UT_sint32, UT_sint32, UT_sint32, UT_sint32, UT_Bool 
+bDirtyRunsOnly, UT_Bool bClip=UT_FALSE);
        
        void                            _drawBetweenPositions(PT_DocPosition left, 
PT_DocPosition right);
        void                            _clearBetweenPositions(PT_DocPosition left, 
PT_DocPosition right, UT_Bool bFullLineHeightRect);
@@ -279,9 +302,9 @@
        void                            _updateInsertionPoint();
        void                            _fixInsertionPointCoords();
        void                            _xorInsertionPoint();
-        UT_Bool                         _hasPointMoved(void); 
-       void                            _saveCurrentPoint(void); 
-        void                            _clearOldPoint(void); 
+       UT_Bool                         _hasPointMoved(void); 
+       void                            _saveCurrentPoint(void); 
+       void                            _clearOldPoint(void); 
        void                            _drawSelection();
        void                            _swapSelectionOrientation(void);
        void                            _extSel(UT_uint32 iOldPoint);
@@ -319,7 +342,7 @@
        FL_DocLayout*           m_pLayout;
        PD_Document*            m_pDoc;
        GR_Graphics*            m_pG;
-        void *                  m_pParentData;
+       void *                          m_pParentData;
 
     PT_DocPosition             m_iSelectionAnchor;
     PT_DocPosition             m_iSelectionLeftAnchor;
@@ -363,6 +386,11 @@
        static void _prefsListener( XAP_App *, XAP_Prefs *, UT_AlphaHashTable *, void 
*);
 
     UT_Bool             m_bShowPara;
+
+       UT_uint32                       fl_PAGEVIEW_PAGE_SEP, fl_PAGEVIEW_MARGIN_X, 
+fl_PAGEVIEW_MARGIN_Y;
+       FVViewType m_ViewType;
+       UT_Bool m_ViewTypeChanged;
+       UT_sint32 m_iTopMargin, m_iBottomMargin, m_iLeftMargin, m_iRightMargin;
 };
 
 #endif /* FV_VIEW_H */
Index: src/wp/ap/xp/ap_EditMethods.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_EditMethods.cpp,v
retrieving revision 1.208
diff -u -r1.208 ap_EditMethods.cpp
--- src/wp/ap/xp/ap_EditMethods.cpp     2000/06/11 14:20:08     1.208
+++ src/wp/ap/xp/ap_EditMethods.cpp     2000/06/16 02:28:35
@@ -239,6 +239,8 @@
        static EV_EditMethod_Fn viewStatus;
        static EV_EditMethod_Fn viewPara;
        static EV_EditMethod_Fn viewHeadFoot;
+       static EV_EditMethod_Fn viewPageLayout;
+       static EV_EditMethod_Fn viewNormal;
        static EV_EditMethod_Fn zoom;
        static EV_EditMethod_Fn dlgZoom;
 
@@ -519,6 +521,8 @@
        EV_EditMethod(NF(viewStatus),                   0,              ""),
        EV_EditMethod(NF(viewPara),                             0,              ""),
        EV_EditMethod(NF(viewHeadFoot),                 0,              ""),
+       EV_EditMethod(NF(viewPageLayout),               0,              ""),
+       EV_EditMethod(NF(viewNormal),                   0,              ""),
        EV_EditMethod(NF(zoom),                                 0,              ""),
        EV_EditMethod(NF(dlgZoom),                              0,              ""),
 
@@ -3888,6 +3892,20 @@
 
        // TODO: synch this implementation with ap_GetState_View
        s_TellNotImplemented(pFrame, "View Headers and Footers", __LINE__);
+       return UT_TRUE;
+}
+
+Defun1(viewPageLayout)
+{
+       ABIWORD_VIEW;
+       pView->setViewType(FV_VIEWTYPE_PGLAYOUT);
+       return UT_TRUE;
+}
+
+Defun1(viewNormal)
+{
+       ABIWORD_VIEW;
+       pView->setViewType(FV_VIEWTYPE_NORMAL);
        return UT_TRUE;
 }
 
Index: src/wp/ap/xp/ap_Menu_ActionSet.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_ActionSet.cpp,v
retrieving revision 1.27
diff -u -r1.27 ap_Menu_ActionSet.cpp
--- src/wp/ap/xp/ap_Menu_ActionSet.cpp  2000/04/15 12:35:17     1.27
+++ src/wp/ap/xp/ap_Menu_ActionSet.cpp  2000/06/16 02:28:35
@@ -99,6 +99,8 @@
        _s(AP_MENU_ID_EDIT_GOTO,                0,1,0,  "go",                          
 NULL,                                   NULL);
 
        _s(AP_MENU_ID_VIEW,                             1,0,0,  NULL,                  
         NULL,                                   NULL);
+       _s(AP_MENU_ID_VIEW_PGLAYOUT,    0,0,1,  "viewPageLayout",       
+ap_GetState_Viewmode,   NULL);
+       _s(AP_MENU_ID_VIEW_NORMAL,              0,0,1,  "viewNormal",           
+ap_GetState_Viewmode,   NULL);
        _s(AP_MENU_ID_VIEW_TOOLBARS,    1,0,0,  NULL,                           NULL,  
                                 NULL);
        _s(AP_MENU_ID_VIEW_TB_STD,              0,0,1,  "viewStd",                     
 ap_GetState_Bars,               NULL);
        _s(AP_MENU_ID_VIEW_TB_FORMAT,   0,0,1,  "viewFormat",           
ap_GetState_Bars,               NULL);
Index: src/wp/ap/xp/ap_Menu_Functions.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Functions.cpp,v
retrieving revision 1.29
diff -u -r1.29 ap_Menu_Functions.cpp
--- src/wp/ap/xp/ap_Menu_Functions.cpp  2000/05/18 06:10:07     1.29
+++ src/wp/ap/xp/ap_Menu_Functions.cpp  2000/06/16 02:28:36
@@ -552,3 +552,33 @@
 
        return s;
 }
+
+Defun_EV_GetMenuItemState_Fn(ap_GetState_Viewmode)
+{
+       ABIWORD_VIEW;
+       UT_ASSERT(pView);
+       
+       FVViewType viewtype=pView->getViewType();
+
+       EV_Menu_ItemState s = EV_MIS_ZERO;
+       
+       
+       switch(id)
+       {
+       case AP_MENU_ID_VIEW_PGLAYOUT:
+               if (viewtype == FV_VIEWTYPE_PGLAYOUT)
+                       s = EV_MIS_Toggled;
+               break;
+
+       case AP_MENU_ID_VIEW_NORMAL:
+               if (viewtype == FV_VIEWTYPE_NORMAL)
+                       s = EV_MIS_Toggled;
+               break;
+
+       default:
+               UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
+               break;
+       }
+
+       return s;
+}
Index: src/wp/ap/xp/ap_Menu_Functions.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Functions.h,v
retrieving revision 1.11
diff -u -r1.11 ap_Menu_Functions.h
--- src/wp/ap/xp/ap_Menu_Functions.h    1999/10/15 07:53:58     1.11
+++ src/wp/ap/xp/ap_Menu_Functions.h    2000/06/16 02:28:36
@@ -39,6 +39,7 @@
 Defun_EV_GetMenuItemState_Fn(ap_GetState_Window);
 Defun_EV_GetMenuItemState_Fn(ap_GetState_Bars);
 Defun_EV_GetMenuItemState_Fn(ap_GetState_View);
+Defun_EV_GetMenuItemState_Fn(ap_GetState_Viewmode);
 Defun_EV_GetMenuItemState_Fn(ap_GetState_Suggest);
 
 
Index: src/wp/ap/xp/ap_Menu_Id.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Id.h,v
retrieving revision 1.17
diff -u -r1.17 ap_Menu_Id.h
--- src/wp/ap/xp/ap_Menu_Id.h   2000/02/17 18:38:07     1.17
+++ src/wp/ap/xp/ap_Menu_Id.h   2000/06/16 02:28:36
@@ -71,6 +71,8 @@
 
 
        AP_MENU_ID_VIEW,
+       AP_MENU_ID_VIEW_PGLAYOUT,
+       AP_MENU_ID_VIEW_NORMAL,
        AP_MENU_ID_VIEW_TOOLBARS,
        AP_MENU_ID_VIEW_TB_STD,
        AP_MENU_ID_VIEW_TB_FORMAT,
Index: src/wp/ap/xp/ap_Menu_LabelSet_en-US.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_LabelSet_en-US.h,v
retrieving revision 1.26
diff -u -r1.26 ap_Menu_LabelSet_en-US.h
--- src/wp/ap/xp/ap_Menu_LabelSet_en-US.h       2000/04/15 12:35:17     1.26
+++ src/wp/ap/xp/ap_Menu_LabelSet_en-US.h       2000/06/16 02:28:36
@@ -70,6 +70,8 @@
        MenuLabel(AP_MENU_ID_EDIT_GOTO,                 "&Go To",                      
 "Move the insertion point to a specific location")
        
        MenuLabel(AP_MENU_ID_VIEW,                              "&View",               
         NULL)
+       MenuLabel(AP_MENU_ID_VIEW_PGLAYOUT,             "&Page Layout",         
+"Switch to the Page Layout view mode.")
+       MenuLabel(AP_MENU_ID_VIEW_NORMAL,               "&Normal",                     
+ "Switch to the Normal view mode.")
        MenuLabel(AP_MENU_ID_VIEW_TOOLBARS,             "&Toolbars",            NULL)
        MenuLabel(AP_MENU_ID_VIEW_TB_STD,               "&Standard",            "Show 
or hide the standard toolbar")
        MenuLabel(AP_MENU_ID_VIEW_TB_FORMAT,    "&Formatting",          "Show or hide 
the formatting toolbar")
Index: src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h,v
retrieving revision 1.17
diff -u -r1.17 ap_Menu_Layouts_MainMenu.h
--- src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h     2000/02/17 18:38:07     1.17
+++ src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h     2000/06/16 02:28:36
@@ -66,6 +66,9 @@
        EndSubMenu()
 
        BeginSubMenu(AP_MENU_ID_VIEW)
+       MenuItem(AP_MENU_ID_VIEW_PGLAYOUT)
+       MenuItem(AP_MENU_ID_VIEW_NORMAL)
+       Separator()
                BeginSubMenu(AP_MENU_ID_VIEW_TOOLBARS)
                        MenuItem(AP_MENU_ID_VIEW_TB_STD)
                        MenuItem(AP_MENU_ID_VIEW_TB_FORMAT)
Index: src/wp/ap/xp/ap_TopRuler.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_TopRuler.cpp,v
retrieving revision 1.84
diff -u -r1.84 ap_TopRuler.cpp
--- src/wp/ap/xp/ap_TopRuler.cpp        2000/06/12 23:54:11     1.84
+++ src/wp/ap/xp/ap_TopRuler.cpp        2000/06/16 02:28:37
@@ -1527,7 +1527,6 @@
        switch (m_draggingWhat)
        {
        case DW_NOTHING:
-               UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
                return;
                
        case DW_LEFTMARGIN:

Reply via email to