diff -Naur --exclude CVS ../abi-current/abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.cpp abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.cpp --- ../abi-current/abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.cpp Tue Aug 1 01:39:48 2000 +++ abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.cpp Tue Aug 1 20:39:35 2000 @@ -36,6 +36,7 @@ #include "xap_UnixGnomeDlg_Print.h" #include "xap_UnixDlg_MessageBox.h" #include "xap_UnixApp.h" +#include "xap_UnixGnomeApp.h" #include "xap_UnixFrame.h" #include "xap_UnixPSGraphics.h" #include "xap_Strings.h" @@ -43,14 +44,14 @@ #include XAP_Dialog * XAP_UnixGnomeDialog_Print::static_constructor(XAP_DialogFactory * pFactory, - XAP_Dialog_Id id) + XAP_Dialog_Id id) { XAP_UnixGnomeDialog_Print * p = new XAP_UnixGnomeDialog_Print(pFactory,id); return p; } XAP_UnixGnomeDialog_Print::XAP_UnixGnomeDialog_Print(XAP_DialogFactory * pDlgFactory, - XAP_Dialog_Id id) + XAP_Dialog_Id id) : XAP_UnixDialog_Print(pDlgFactory,id) { } @@ -100,6 +101,7 @@ // don't set transient - this is a gnome-dialog // 2. Toggle dialog options to match persistent values + /* if (!m_bPersistValid) // first time called { m_persistPrintDlg.bEnablePrintToFile = m_bEnablePrintToFile; @@ -115,6 +117,7 @@ UT_cloneString(m_persistPrintDlg.szPrintCommand, "lpr"); } + */ // TODO: We're not really persistant. I view this as a good thing, others don't. // Gnome Print really doesn't do persistance too well (limited accessor @@ -124,11 +127,11 @@ // 3. Run dialog switch( gnome_dialog_run(GNOME_DIALOG(gpd)) ) { case GNOME_PRINT_PRINT: - break; + break; case GNOME_PRINT_PREVIEW: /* TODO: support Gnome Print-Preview */ default: - gnome_dialog_close(GNOME_DIALOG(gpd)); + gnome_dialog_close(GNOME_DIALOG(gpd)); m_answer = a_CANCEL; return; } @@ -139,32 +142,35 @@ gnome_print_dialog_get_copies(gpd, &copies, &collate); printer = gnome_print_dialog_get_printer (gpd); range = gnome_print_dialog_get_range_page(gpd, &first, &end); + + UT_DEBUGMSG(("GOT copies, printer, range\n")); + gnome_dialog_close(GNOME_DIALOG(gpd)); // Record outputs m_bDoPrintRange = (range == GNOME_PRINT_RANGE_RANGE); m_bDoPrintSelection = (range == GNOME_PRINT_RANGE_SELECTION); m_bCollate = collate; - m_cColorSpace = GR_Graphics::GR_COLORSPACE_BW; //BUG + m_cColorSpace = GR_Graphics::GR_COLORSPACE_COLOR; //BUG m_nFirstPage = first; m_nLastPage = end; m_nCopies = copies; m_answer = a_OK; /* hack - detect the pipe ('|') gnome print adds for printing to a non-file */ - m_bDoPrintToFile = *(printer->filename) != '|'; + m_bDoPrintToFile = (printer->filename) && (*(printer->filename) != '|'); if(m_bDoPrintToFile) { /* postscript output to a file */ UT_cloneString(m_szPrintToFilePathname, printer->filename); - UT_cloneString(m_szPrintCommand, ""); + UT_cloneString(m_szPrintCommand, "foo"); } else { /* printing using lpr or similar */ UT_cloneString(m_szPrintCommand, printer->filename+1); /* hack to remove "|" from "|lpr" */ - UT_cloneString(m_szPrintToFilePathname, ""); + UT_cloneString(m_szPrintToFilePathname, "foo"); } UT_DEBUGMSG(("Printing to file: %d\n", m_bDoPrintToFile)); @@ -174,6 +180,21 @@ return; } +void XAP_UnixGnomeDialog_Print::runModal(XAP_Frame * pFrame) +{ + m_pUnixFrame = static_cast(pFrame); + UT_ASSERT(m_pUnixFrame); + + // TODO: persistance + + _raisePrintDialog(pFrame); + if (m_answer == a_OK) + _getGraphics(); + + m_pUnixFrame = NULL; + return; +} + void XAP_UnixGnomeDialog_Print::_getGraphics(void) { UT_ASSERT(m_answer == a_OK); @@ -181,7 +202,7 @@ XAP_App * app = m_pUnixFrame->getApp(); UT_ASSERT(app); - XAP_UnixApp * unixapp = static_cast (app); + XAP_UnixApp * unixapp = static_cast (app); UT_ASSERT(unixapp); XAP_UnixFontManager * fontmgr = unixapp->getFontManager(); @@ -190,16 +211,16 @@ if (m_bDoPrintToFile) { m_pPSGraphics = new PS_Graphics(m_szPrintToFilePathname, m_szDocumentTitle, - m_pUnixFrame->getApp()->getApplicationName(), - fontmgr, - UT_TRUE, app); + m_pUnixFrame->getApp()->getApplicationName(), + fontmgr, + UT_TRUE, app); } else { m_pPSGraphics = new PS_Graphics(m_szPrintCommand, m_szDocumentTitle, - m_pUnixFrame->getApp()->getApplicationName(), - fontmgr, - UT_FALSE, app); + m_pUnixFrame->getApp()->getApplicationName(), + fontmgr, + UT_FALSE, app); } UT_ASSERT(m_pPSGraphics); diff -Naur --exclude CVS ../abi-current/abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.h abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.h --- ../abi-current/abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.h Tue Aug 1 01:39:48 2000 +++ abi/src/af/xap/unix/gnome/xap_UnixGnomeDlg_Print.h Tue Aug 1 20:19:22 2000 @@ -38,6 +38,8 @@ XAP_UnixGnomeDialog_Print(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); virtual ~XAP_UnixGnomeDialog_Print(void); + virtual void runModal(XAP_Frame * pFrame); + static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id); protected: diff -Naur --exclude CVS ../abi-current/abi/src/wp/ap/unix/gnome/ap_UnixGnomeDialog_Lists.cpp abi/src/wp/ap/unix/gnome/ap_UnixGnomeDialog_Lists.cpp --- ../abi-current/abi/src/wp/ap/unix/gnome/ap_UnixGnomeDialog_Lists.cpp Mon Jul 31 17:58:34 2000 +++ abi/src/wp/ap/unix/gnome/ap_UnixGnomeDialog_Lists.cpp Tue Aug 1 20:54:49 2000 @@ -59,15 +59,15 @@ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (m_wMainWindow)->vbox), _constructWindowContents (), TRUE, TRUE, 0); - // close button - gnome_dialog_append_button(GNOME_DIALOG(m_wMainWindow), - GNOME_STOCK_BUTTON_CLOSE); - m_wClose = GTK_WIDGET (g_list_last (GNOME_DIALOG (m_wMainWindow)->buttons)->data); - // apply button gnome_dialog_append_button(GNOME_DIALOG(m_wMainWindow), GNOME_STOCK_BUTTON_APPLY); m_wApply = GTK_WIDGET (g_list_last (GNOME_DIALOG (m_wMainWindow)->buttons)->data); + + // close button + gnome_dialog_append_button(GNOME_DIALOG(m_wMainWindow), + GNOME_STOCK_BUTTON_CLOSE); + m_wClose = GTK_WIDGET (g_list_last (GNOME_DIALOG (m_wMainWindow)->buttons)->data); gtk_widget_show_all(m_wMainWindow); _connectSignals();