According to Tim Silversides <[EMAIL PROTECTED]>:
> Hi,
>
> Below is a patch against stable to allow printing of pages in reverse
> order on unix
It took me some time, but I did commit it:
CVS: Modified Files:
CVS: Tag: ABI-1-0-0-STABLE
CVS: src/af/xap/unix/xap_UnixDlg_Print.cpp
CVS: src/af/xap/unix/xap_UnixDlg_Print.h
CVS: src/af/xap/xp/xap_Dlg_Print.cpp src/af/xap/xp/xap_Dlg_Print.h
CVS: src/af/xap/xp/xap_String_Id.h src/wp/ap/xp/ap_EditMethods.cpp
CVS: src/wp/ap/xp/ap_EditMethods.h
Please apply attached patch to HEAD and test before committing it.
Thanks a lot Tim.
Hub
--
AbiWord maintainer - Lille, France
http://www.figuiere.net/hub/
GPG fingerprint: 6C44 DB3E 0BF3 EAF5 B433 239A 5FEE 05E6 A56E 15A3
? abiword.log
? autom4te.cache
? src/Linux_2.2.20-pmac_ppc_OBJ
Index: src/af/xap/unix/xap_UnixDlg_Print.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/unix/xap_UnixDlg_Print.cpp,v
retrieving revision 1.54
diff -u -r1.54 xap_UnixDlg_Print.cpp
--- src/af/xap/unix/xap_UnixDlg_Print.cpp 11 Mar 2002 01:38:36 -0000 1.54
+++ src/af/xap/unix/xap_UnixDlg_Print.cpp 10 Mar 2003 21:55:43 -0000
@@ -77,7 +77,7 @@
m_persistPrintDlg.bDoPrintSelection = m_bDoPrintSelection;
m_persistPrintDlg.bDoPrintToFile = m_bDoPrintToFile;
m_persistPrintDlg.bDoCollate = m_bCollate;
-
+ m_persistPrintDlg.bDoReverse = m_bReverse;
m_persistPrintDlg.colorSpace = m_cColorSpace;
m_persistPrintDlg.szPrintCommand = m_szPrintCommand;
}
@@ -91,6 +91,7 @@
m_persistPrintDlg.bDoPrintSelection = m_bDoPrintSelection;
m_persistPrintDlg.bDoPrintToFile = m_bDoPrintToFile;
m_persistPrintDlg.bDoCollate = m_bCollate;
+ m_persistPrintDlg.bDoReverse = m_bReverse;
m_persistPrintDlg.nCopies = m_nCopies;
m_persistPrintDlg.nFromPage = m_nFirstPage;
m_persistPrintDlg.nToPage = m_nLastPage;
@@ -185,6 +186,11 @@
gtk_widget_grab_focus (entry);
}
+static void entry_range_changed( GtkWidget *entry, GtkWidget *togglebutton)
+{
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton), TRUE);
+}
+
void XAP_UnixDialog_Print::_raisePrintDialog(XAP_Frame * pFrame)
{
// raise the actual dialog and wait for an answer.
@@ -203,6 +209,7 @@
GtkWidget *buttonSelection;
GtkWidget *button;
GtkWidget *buttonCollate;
+ GtkWidget *buttonReverse;
GtkWidget *buttonEmbedFonts;
GtkWidget *spinCopies;
@@ -355,6 +362,10 @@
gtk_box_pack_start (GTK_BOX (hbox), buttonCollate, TRUE, TRUE,
0);
gtk_widget_show (buttonCollate);
+ buttonReverse = gtk_check_button_new_with_label
(pSS->getValue(XAP_STRING_ID_DLG_UP_Reverse));
+ gtk_box_pack_start (GTK_BOX (hbox), buttonReverse, TRUE, TRUE,
0);
+ gtk_widget_show (buttonReverse);
+
buttonEmbedFonts = gtk_check_button_new_with_label
(pSS->getValue(XAP_STRING_ID_DLG_UP_EmbedFonts));
gtk_box_pack_start (GTK_BOX (hbox), buttonEmbedFonts, TRUE,
TRUE, 0);
gtk_widget_show (buttonEmbedFonts);
@@ -434,6 +445,7 @@
gtk_box_pack_end (GTK_BOX (hbox), button, TRUE, TRUE, 5);
//gtk_widget_grab_default (button);
+ gtk_widget_grab_focus (button);
gtk_widget_show (button);
@@ -491,12 +503,17 @@
gtk_entry_set_text (GTK_ENTRY (entryFrom), str);
sprintf(str, "%d", m_persistPrintDlg.nToPage);
gtk_entry_set_text (GTK_ENTRY (entryTo), str);
-
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttonCollate),
m_persistPrintDlg.bDoCollate);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttonReverse),
m_persistPrintDlg.bDoReverse);
XAP_App::getApp()->getPrefsValueBool((const XML_Char
*)XAP_PREF_KEY_EmbedFontsInPS, &m_bEmbedFonts);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttonEmbedFonts),
m_bEmbedFonts);
gtk_spin_button_set_value (GTK_SPIN_BUTTON(spinCopies),
m_persistPrintDlg.nCopies);
+ gtk_signal_connect(GTK_OBJECT(entryFrom), "changed",
+ GTK_SIGNAL_FUNC(entry_range_changed), buttonRange);
+ gtk_signal_connect(GTK_OBJECT(entryTo), "changed",
+ GTK_SIGNAL_FUNC(entry_range_changed), buttonRange);
// get top level window and it's GtkWidget *
XAP_UnixFrame * frame = static_cast<XAP_UnixFrame *>(pFrame);
@@ -519,6 +536,7 @@
m_bDoPrintSelection = GTK_TOGGLE_BUTTON(buttonSelection)->active;
m_bDoPrintToFile = GTK_TOGGLE_BUTTON(buttonFile)->active;
m_bCollate =
GTK_TOGGLE_BUTTON(buttonCollate)->active;
+ m_bReverse =
GTK_TOGGLE_BUTTON(buttonReverse)->active;
bool bEmbedFonts = m_bEmbedFonts;
m_bEmbedFonts = GTK_TOGGLE_BUTTON(buttonEmbedFonts)->active;
m_nCopies =
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinCopies));
Index: src/af/xap/unix/xap_UnixDlg_Print.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/unix/xap_UnixDlg_Print.h,v
retrieving revision 1.19
diff -u -r1.19 xap_UnixDlg_Print.h
--- src/af/xap/unix/xap_UnixDlg_Print.h 3 Mar 2001 22:10:59 -0000 1.19
+++ src/af/xap/unix/xap_UnixDlg_Print.h 10 Mar 2003 21:55:43 -0000
@@ -73,6 +73,7 @@
bool bDoPrintSelection;
bool bDoPrintToFile;
bool bDoCollate;
+ bool bDoReverse;
bool bEnablePrintToFile;
bool bEnableSelection;
bool bEnablePageRange;
Index: src/af/xap/xp/xap_Dlg_Print.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/xp/xap_Dlg_Print.cpp,v
retrieving revision 1.14
diff -u -r1.14 xap_Dlg_Print.cpp
--- src/af/xap/xp/xap_Dlg_Print.cpp 20 Mar 2002 17:44:45 -0000 1.14
+++ src/af/xap/xp/xap_Dlg_Print.cpp 10 Mar 2003 21:55:49 -0000
@@ -38,6 +38,7 @@
m_bPersistValid = false;
m_persistNrCopies = 1;
m_persistCollate = false;
+ m_persistReverse = false;
m_persistColorSpace = GR_Graphics::GR_COLORSPACE_COLOR; /* full color is
default */
m_persistPrintToFile = false;
@@ -202,7 +203,14 @@
{
UT_ASSERT(m_answer == a_OK);
- return m_persistCollate;
+ return m_bCollate;
+}
+
+bool XAP_Dialog_Print::getReverse(void) const
+{
+ UT_ASSERT(m_answer == a_OK);
+
+ return m_bReverse;
}
GR_Graphics::ColorSpace XAP_Dialog_Print::getColorSpace(void) const
Index: src/af/xap/xp/xap_Dlg_Print.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/xp/xap_Dlg_Print.h,v
retrieving revision 1.11
diff -u -r1.11 xap_Dlg_Print.h
--- src/af/xap/xp/xap_Dlg_Print.h 6 Feb 2001 22:54:25 -0000 1.11
+++ src/af/xap/xp/xap_Dlg_Print.h 10 Mar 2003 21:55:49 -0000
@@ -54,6 +54,7 @@
bool getDoPrintToFile(const
char *) const;
UT_uint32 getNrCopies(void)
const;
bool getCollate(void) const;
+ bool getReverse(void) const;
GR_Graphics::ColorSpace getColorSpace(void) const;
virtual GR_Graphics * getPrinterGraphicsContext(void) = 0;
@@ -66,6 +67,7 @@
UT_uint32 m_bPersistValid;
/* persists (internal) */
UT_uint32 m_persistNrCopies;
/* persists (internal) */
bool m_persistCollate;
/* persists (internal) */
+ bool m_persistReverse;
/* persists (internal) */
GR_Graphics::ColorSpace m_persistColorSpace; /* persists
(internal) */
bool m_persistPrintToFile;
/* persists (internal) */
@@ -77,8 +79,10 @@
bool m_bEnablePrintToFile;
/* input */
bool m_bDoPrintRange;
/* output */
bool m_bDoPrintSelection;
/* output */
- bool m_bDoPrintToFile;
/* output */
- bool m_bCollate;
/* output */
+ bool m_bDoPrintToFile;
/* output */
+ bool m_bCollate;
/* output */
+ bool m_bReverse;
/* output */
+
GR_Graphics::ColorSpace m_cColorSpace; /*
output */
UT_uint32 m_nFirstPage;
/* input/output */
UT_uint32 m_nLastPage;
/* input/output */
Index: src/af/xap/xp/xap_String_Id.h
===================================================================
RCS file: /cvsroot/abi/src/af/xap/xp/xap_String_Id.h,v
retrieving revision 1.78.2.1
diff -u -r1.78.2.1 xap_String_Id.h
--- src/af/xap/xp/xap_String_Id.h 21 Aug 2002 07:23:08 -0000 1.78.2.1
+++ src/af/xap/xp/xap_String_Id.h 10 Mar 2003 21:55:49 -0000
@@ -154,6 +154,7 @@
dcl(DLG_UP_To, " to ")
dcl(DLG_UP_Selection, "Selection")
dcl(DLG_UP_Collate, "Collate")
+dcl(DLG_UP_Reverse, "Reverse Order")
dcl(DLG_UP_EmbedFonts, "Embed Fonts")
dcl(DLG_UP_Copies, "Copies: ")
dcl(DLG_UP_PrintButton, "Print")
Index: src/wp/ap/xp/ap_EditMethods.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_EditMethods.cpp,v
retrieving revision 1.477.2.8
diff -u -r1.477.2.8 ap_EditMethods.cpp
--- src/wp/ap/xp/ap_EditMethods.cpp 2 Aug 2002 08:39:39 -0000 1.477.2.8
+++ src/wp/ap/xp/ap_EditMethods.cpp 10 Mar 2003 21:57:44 -0000
@@ -5635,7 +5635,7 @@
bool s_actuallyPrint(PD_Document *doc, GR_Graphics *pGraphics,
FV_View * pPrintView, const char *pDocName,
- UT_uint32 nCopies, bool bCollate,
+ UT_uint32 nCopies, bool bCollate, bool bReverse,
UT_sint32 iWidth, UT_sint32 iHeight,
UT_uint32 nToPage, UT_uint32 nFromPage)
{
@@ -5663,16 +5663,50 @@
XML_Char msgBuf [1024];
- if (bCollate)
+ if (bCollate&&bReverse)
+ {
+ for (k=nToPage; (k >= nFromPage); k--)
+ for (j=1; (j <= nCopies); j++)
+ {
+ sprintf (msgBuf, msgTmpl, k, nToPage);
+ pFrame->setStatusMessage ( msgBuf );
+ pFrame->nullUpdate();
+
+ // NB we will need a better way to calc
+ // pGraphics->m_iRasterPosition when
+ // iHeight is allowed to vary page to page
+ pGraphics->m_iRasterPosition = (k-1)*iHeight;
+ pGraphics->startPage(pDocName, k, orient, iWidth,
iHeight);
+ pPrintView->draw(k-1, &da);
+ }
+ }
+ else if(bCollate)
+ {
+ for (k=nFromPage; (k <= nToPage); k++)
+ for (j=1; (j <= nCopies); j++)
+ {
+ sprintf (msgBuf, msgTmpl, k, nToPage);
+ pFrame->setStatusMessage ( msgBuf );
+ pFrame->nullUpdate();
+
+ // NB we will need a better way to calc
+ // pGraphics->m_iRasterPosition when
+ // iHeight is allowed to vary page to page
+ pGraphics->m_iRasterPosition = (k-1)*iHeight;
+ pGraphics->startPage(pDocName, k, orient,
iWidth, iHeight);
+ pPrintView->draw(k-1, &da);
+ }
+ }
+ else if(bReverse)
{
for (j=1; (j <= nCopies); j++)
- for (k=nFromPage; (k <= nToPage); k++)
+ for (k=nToPage; (k >= nFromPage); k--)
{
sprintf (msgBuf, msgTmpl, k, nToPage);
pFrame->setStatusMessage ( msgBuf );
pFrame->nullUpdate();
- // NB we will need a better way to calc
+ // NB we will need a better way to calc
// pGraphics->m_iRasterPosition when
// iHeight is allowed to vary page to page
pGraphics->m_iRasterPosition = (k-1)*iHeight;
@@ -5682,8 +5716,8 @@
}
else
{
- for (k=nFromPage; (k <= nToPage); k++)
- for (j=1; (j <= nCopies); j++)
+ for (j=1; (j <= nCopies); j++)
+ for (k=nFromPage; (k <= nToPage); k++)
{
sprintf (msgBuf, msgTmpl, k, nToPage);
pFrame->setStatusMessage ( msgBuf );
@@ -5774,6 +5808,7 @@
UT_uint32 nCopies = pDialog->getNrCopies();
bool bCollate = pDialog->getCollate();
+ bool bReverse = pDialog->getReverse();
// TODO these are here temporarily to make printing work. We'll fix
the hack later.
// BUGBUG assumes all pages are same size and orientation
@@ -5782,7 +5817,7 @@
const char *pDocName = ((doc->getFilename()) ? doc->getFilename() :
pFrame->getTempNameFromTitle());
- s_actuallyPrint(doc, pGraphics, pPrintView, pDocName, nCopies,
bCollate,
+ s_actuallyPrint(doc, pGraphics, pPrintView, pDocName, nCopies,
bCollate,bReverse,
iWidth, iHeight, nToPage, nFromPage);
delete pDocLayout;
@@ -5851,6 +5886,7 @@
UT_uint32 nCopies = 1;
bool bCollate = false;
+ bool bReverse = false;
// TODO these are here temporarily to make printing work. We'll fix the hack
later.
// BUGBUG assumes all pages are same size and orientation
@@ -5859,7 +5895,7 @@
const char *pDocName = ((doc->getFilename()) ? doc->getFilename() :
pFrame->getTempNameFromTitle());
- s_actuallyPrint(doc, pGraphics, pPrintView, pDocName, nCopies, bCollate,
+ s_actuallyPrint(doc, pGraphics, pPrintView, pDocName, nCopies,
bCollate,bReverse,
iWidth, iHeight, nToPage, nFromPage);
delete pDocLayout;
Index: src/wp/ap/xp/ap_EditMethods.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_EditMethods.h,v
retrieving revision 1.1.10.2
diff -u -r1.1.10.2 ap_EditMethods.h
--- src/wp/ap/xp/ap_EditMethods.h 2 Aug 2002 08:27:55 -0000 1.1.10.2
+++ src/wp/ap/xp/ap_EditMethods.h 10 Mar 2003 21:57:44 -0000
@@ -27,7 +27,7 @@
// defined in ap_editmethods.cpp
bool s_actuallyPrint(PD_Document *doc, GR_Graphics *pGraphics,
FV_View * pPrintView, const char *pDocName,
- UT_uint32 nCopies, bool bCollate,
+ UT_uint32 nCopies, bool bCollate, bool bReverse,
UT_sint32 inWidth, UT_sint32 inHeight,
UT_uint32 nToPage, UT_uint32 nFromPage) ;