Changeset 66 for trunk/src/MainPter.cxx

Show
Ignore:
Timestamp:
04/15/06 06:57:59 (3 years ago)
Author:
jordi
Message:

The main presenter shows the sidebar when the document has outlines. Also passes the outline to the view and accepts an activated outline to make change the page.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/MainPter.cxx

    r65 r66  
    7676     
    7777    IMainView &view = getView (); 
     78    gboolean showSidebar = FALSE; 
    7879    if ( m_Document->isLoaded () ) 
    7980    { 
     
    9798        view.setTotalPages (m_Document->getNumPages ()); 
    9899 
     100        // Check if we should see the outlines. 
     101        showSidebar = (NULL != m_Document->getOutline () && 
     102                       0 < m_Document->getOutline ()->getNumChildren () && 
     103                       PageModeOutlines != m_Document->getPageMode ()); 
     104 
    99105        if ( canShowPage ) 
    100106        { 
     
    117123        view.sensitiveZoomFit (FALSE); 
    118124        view.sensitiveZoomWidth (FALSE); 
     125        showSidebar = FALSE; 
    119126    } 
    120      
     127    
     128    view.setOutline (m_Document->getOutline ()); 
     129    view.showSidebar (showSidebar); 
    121130    view.show ();  
    122131} 
     
    247256    openDocument (fileName, NULL, TRUE); 
    248257    g_free (fileName); 
     258} 
     259 
     260/// 
     261/// @brief The user activated an outline. 
     262/// 
     263/// When the sidebar is shown and the user clicks on a outline, the view 
     264/// should send to the presenter which outline has been activated, so the 
     265/// presenter can change the page to the pointed by the outline. 
     266/// 
     267/// @param outline The outline that has been activated. 
     268void 
     269MainPter::outlineActivated (DocumentOutline *outline) 
     270{ 
     271    g_assert (NULL != outline && "The outline activated is NULL."); 
     272     
     273    m_Document->goToPage (outline->getDestinationPage ()); 
     274    showPage (); 
    249275} 
    250276