Changeset 256

Show
Ignore:
Timestamp:
10/17/06 11:55:46 (2 years ago)
Author:
jordi
Message:

I did a kludge that seems to fix some problems while rendering pages... seems to fix bug #32.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/PDFDocument.cxx

    r222 r256  
    1717 
    1818#include <config.h> 
     19#include <gdk/gdk.h> 
    1920#include <time.h> 
    2021#include <poppler.h> 
     
    159160        { 
    160161            PopplerRectangle *matchRect = (PopplerRectangle *)match->data; 
    161             DocumentRectangle *rect =  
     162            DocumentRectangle *rect = 
    162163                new DocumentRectangle (matchRect->x1, 
    163164                                       (height - matchRect->y2), 
     
    222223        if ( POPPLER_ERROR == loadError->domain ) 
    223224        { 
    224             errorCode = DocumentErrorEncrypted;  
     225            errorCode = DocumentErrorEncrypted; 
    225226        } 
    226227        else 
     
    231232            // Maybe I'm wrong (very probable) but that's a wrong way. 
    232233            // So I'm reading the error code from the error string... 
    233             sscanf (loadError->message, "Failed to load document (error %d)",  
     234            sscanf (loadError->message, "Failed to load document (error %d)", 
    234235                    (gint *)&errorCode); 
    235236        } 
     
    237238        // Get our error message. 
    238239        gchar *errorMessage = IDocument::getErrorMessage (errorCode); 
    239         g_set_error (error,  
     240        g_set_error (error, 
    240241                     EPDFVIEW_DOCUMENT_ERROR, errorCode, 
    241242                     _("Failed to load document '%s'.\n%s\n"), 
     
    261262    m_Outline = new DocumentOutline (); 
    262263    setOutline (m_Outline, outline); 
     264    // XXX: I still don't know why, but it seems that if I don't request 
     265    // a page here, when rendering a page Glib tells me 
     266    // that cannot register existing type `PopplerPage'... Yes, this 
     267    // is a kludge, but I don't know enough to check it why it does that. 
     268    PopplerPage *page = poppler_document_get_page (m_Document, 0); 
     269    if ( NULL != page ) 
     270    { 
     271        g_object_unref (G_OBJECT (page)); 
     272    } 
    263273 
    264274    return TRUE; 
     
    402412        do 
    403413        { 
    404             PopplerAction *action =  
     414            PopplerAction *action = 
    405415                poppler_index_iter_get_action (childrenList); 
    406416            if ( POPPLER_ACTION_GOTO_DEST == action->type ) 
     
    469479            poppler_page_get_size (page, &pageHeight, &pageWidth); 
    470480        } 
    471         else  
     481        else 
    472482        { 
    473483            poppler_page_get_size (page, &pageWidth, &pageHeight); 
     
    529539    } 
    530540} 
    531  
    532541 
    533542/// 
  • trunk/src/main.cxx

    r148 r256  
    4545        exit (EXIT_FAILURE); 
    4646    } 
     47    // Initialise the working thread. 
     48    IJob::init (); 
    4749    // Initialise the GTK library. 
    4850    gtk_init (&argc, &argv); 
    4951    g_set_application_name (_("PDF Viewer")); 
    50     // Initialise the working thread. 
    51     IJob::init (); 
    5252    // Create the main presenter. 
    5353    PDFDocument *document = new PDFDocument; 
     
    6565        document->load (argv[1], NULL); 
    6666    } 
     67 
    6768    gtk_main(); 
    68      
     69 
    6970    // There's no need for us to delete the main view, as it's 
    7071    // the presenter's responsibility. 
     
    7374    // Save the configuration. 
    7475    Config::getConfig().save (); 
    75      
     76 
    7677    // All done!. 
    7778    return EXIT_SUCCESS;