Changeset 36

Show
Ignore:
Timestamp:
04/12/06 06:33:09 (2 years ago)
Author:
jordi
Message:

I've forgoten the rotate left and rotate right sensitivity. I've added the two functions to the main view's interface and gtk shell. Also added to the test suite.

Now the gtk shell can change the sensitiveness of the widgets.

Location:
trunk
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/IMainView.h

    r33 r36  
    3838            virtual void sensitiveGoToPage (gboolean sensitive) = 0; 
    3939            virtual void sensitiveGoToPreviousPage (gboolean sensitive) = 0; 
     40            virtual void sensitiveRotateLeft (gboolean sensitive) = 0; 
     41            virtual void sensitiveRotateRight (gboolean sensitive) = 0; 
    4042            virtual void sensitiveZoomIn (gboolean sensitive) = 0; 
    4143            virtual void sensitiveZoomOut (gboolean sensitive) = 0; 
  • trunk/src/MainPter.cxx

    r35 r36  
    5252{ 
    5353    delete m_Document; 
     54    delete m_View; 
    5455    delete m_DocumentPage; 
    55     delete m_View; 
    5656} 
    5757 
     
    8080        } 
    8181        view.sensitiveGoToPage (TRUE); 
     82        view.sensitiveRotateRight (TRUE); 
     83        view.sensitiveRotateLeft (TRUE); 
    8284        view.sensitiveZoomIn (TRUE); 
    8385        view.sensitiveZoomOut (TRUE); 
     
    9597        view.sensitiveGoToPage (FALSE); 
    9698        view.sensitiveGoToPreviousPage (FALSE); 
     99        view.sensitiveRotateRight (FALSE); 
     100        view.sensitiveRotateLeft (FALSE); 
    97101        view.sensitiveZoomIn (FALSE); 
    98102        view.sensitiveZoomOut (FALSE); 
  • trunk/src/gtk/MainView.cxx

    r35 r36  
    2626 
    2727// Forward delarations. 
     28static void main_window_go_to_first_page_cb (GtkWidget *, gpointer); 
     29static void main_window_go_to_last_page_cb (GtkWidget *, gpointer); 
     30static void main_window_go_to_next_page_cb (GtkWidget *, gpointer); 
     31static void main_window_go_to_previous_page_cb (GtkWidget *, gpointer); 
    2832static void main_window_open_file_cb (GtkWidget *, gpointer); 
    2933static void main_window_quit_cb (GtkWidget *, gpointer); 
     
    6064MainView::~MainView () 
    6165{ 
     66    g_object_unref (G_OBJECT (m_UIManager)); 
    6267} 
    6368 
     
    9297MainView::sensitiveGoToFirstPage (gboolean sensitive) 
    9398{ 
     99    GtkAction *goToFirstPage = gtk_ui_manager_get_action (m_UIManager, 
     100            "/MenuBar/GoMenu/GoToFirstPage"); 
     101    gtk_action_set_sensitive (goToFirstPage, sensitive); 
    94102} 
    95103 
     
    97105MainView::sensitiveGoToLastPage (gboolean sensitive) 
    98106{ 
     107    GtkAction *goToLastPage =  
     108        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/GoMenu/GoToLastPage"); 
     109    gtk_action_set_sensitive (goToLastPage, sensitive); 
    99110} 
    100111 
     
    102113MainView::sensitiveGoToNextPage (gboolean sensitive) 
    103114{ 
     115    GtkAction *goToNextPage =  
     116        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/GoMenu/GoToNextPage"); 
     117    gtk_action_set_sensitive (goToNextPage, sensitive); 
    104118} 
    105119 
     
    112126MainView::sensitiveGoToPreviousPage (gboolean sensitive) 
    113127{ 
     128    GtkAction *goToPreviousPage = gtk_ui_manager_get_action (m_UIManager,  
     129            "/MenuBar/GoMenu/GoToPreviousPage"); 
     130    gtk_action_set_sensitive (goToPreviousPage, sensitive); 
     131} 
     132 
     133void  
     134MainView::sensitiveRotateLeft (gboolean sensitive) 
     135{ 
     136    GtkAction *rotateLeft =  
     137        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/RotateLeft"); 
     138    gtk_action_set_sensitive (rotateLeft, sensitive); 
     139} 
     140 
     141void  
     142MainView::sensitiveRotateRight (gboolean sensitive) 
     143{ 
     144    GtkAction *rotateRight = gtk_ui_manager_get_action (m_UIManager,  
     145            "/MenuBar/ViewMenu/RotateRight"); 
     146    gtk_action_set_sensitive (rotateRight, sensitive); 
    114147} 
    115148 
     
    117150MainView::sensitiveZoomIn (gboolean sensitive) 
    118151{ 
     152    GtkAction *zoomIn =  
     153        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomIn"); 
     154    gtk_action_set_sensitive (zoomIn, sensitive); 
    119155} 
    120156 
     
    122158MainView::sensitiveZoomOut (gboolean sensitive) 
    123159{ 
     160    GtkAction *zoomOut =  
     161        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomOut"); 
     162    gtk_action_set_sensitive (zoomOut, sensitive); 
    124163} 
    125164 
     
    127166MainView::sensitiveZoomFit (gboolean sensitive) 
    128167{ 
     168    GtkAction *zoomFit =  
     169        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomFit"); 
     170    gtk_action_set_sensitive (zoomFit, sensitive); 
    129171} 
    130172 
     
    132174MainView::sensitiveZoomWidth (gboolean sensitive) 
    133175{ 
     176    GtkAction *zoomWidth =  
     177        gtk_ui_manager_get_action (m_UIManager, "/MenuBar/ViewMenu/ZoomWidth"); 
     178    gtk_action_set_sensitive (zoomWidth, sensitive); 
    134179} 
    135180 
     
    226271        { "RotateRight", GTK_STOCK_REDO, _("Rotate _Right"), NULL, NULL, NULL}, 
    227272        { "RotateLeft", GTK_STOCK_UNDO, _("Rotate Left"), NULL, NULL, NULL}, 
    228         { "GoToFirstPage", GTK_STOCK_GOTO_FIRST, _("_First Page"), "Home", NULL, NULL }, 
    229         { "GoToNextPage", GTK_STOCK_GO_FORWARD, _("_Next Page"), "Page_Down", NULL, NULL }, 
    230         { "GoToPreviousPage", GTK_STOCK_GO_BACK, _("_Previous Page"), "Page_Up", NULL, NULL }, 
    231         { "GoToLastPage", GTK_STOCK_GOTO_LAST, _("_Last Page"), "End", NULL, NULL }, 
     273        { "GoToFirstPage", GTK_STOCK_GOTO_FIRST, _("_First Page"), "Home", NULL, G_CALLBACK (main_window_go_to_first_page_cb) }, 
     274        { "GoToNextPage", GTK_STOCK_GO_FORWARD, _("_Next Page"), "Page_Down", NULL, G_CALLBACK (main_window_go_to_next_page_cb) }, 
     275        { "GoToPreviousPage", GTK_STOCK_GO_BACK, _("_Previous Page"), "Page_Up", NULL, G_CALLBACK (main_window_go_to_previous_page_cb) }, 
     276        { "GoToLastPage", GTK_STOCK_GOTO_LAST, _("_Last Page"), "End", NULL, G_CALLBACK (main_window_go_to_last_page_cb) }, 
    232277        { "About", GTK_STOCK_ABOUT, "_About", NULL, NULL, NULL } 
    233278    }; 
     
    237282        "  <menubar name='MenuBar'>" 
    238283        "    <menu action='FileMenu'>" 
    239         "      <menuitem action='OpenFile'/>" 
     284        "      <menuitem name='OpenFile' action='OpenFile'/>" 
    240285        "      <separator/>" 
    241         "      <menuitem action='Quit'/>" 
     286        "      <menuitem name='Quit' action='Quit'/>" 
    242287        "    </menu>" 
    243288        "    <menu action='ViewMenu'>" 
    244         "      <menuitem action='ZoomIn'/>" 
    245         "      <menuitem action='ZoomOut'/>" 
    246         "      <menuitem action='ZoomFit'/>" 
    247         "      <menuitem action='ZoomWidth'/>" 
     289        "      <menuitem name='ZoomIn' action='ZoomIn'/>" 
     290        "      <menuitem name='ZoomOut' action='ZoomOut'/>" 
     291        "      <menuitem name='ZoomFit' action='ZoomFit'/>" 
     292        "      <menuitem name='ZoomWidth' action='ZoomWidth'/>" 
    248293        "      <separator />" 
    249         "      <menuitem action='RotateRight'/>" 
    250         "      <menuitem action='RotateLeft'/>" 
     294        "      <menuitem name='RotateRight' action='RotateRight'/>" 
     295        "      <menuitem name='RotateLeft' action='RotateLeft'/>" 
    251296        "    </menu>" 
    252297        "    <menu action='GoMenu'>" 
    253         "      <menuitem action='GoToFirstPage'/>" 
    254         "      <menuitem action='GoToPreviousPage'/>" 
    255         "      <menuitem action='GoToNextPage'/>" 
    256         "      <menuitem action='GoToLastPage'/>" 
     298        "      <menuitem name='GoToFirstPage' action='GoToFirstPage'/>" 
     299        "      <menuitem name='GoToPreviousPage' action='GoToPreviousPage'/>" 
     300        "      <menuitem name='GoToNextPage' action='GoToNextPage'/>" 
     301        "      <menuitem name='GoToLastPage' action='GoToLastPage'/>" 
    257302        "    </menu>" 
    258303        "    <menu action='HelpMenu'>" 
    259         "      <menuitem action='About'/>" 
     304        "      <menuitem name='About' action='About'/>" 
    260305        "    </menu>" 
    261306        "  </menubar>" 
    262307        "  <toolbar name='ToolBar'>" 
    263         "    <toolitem action='OpenFile'/>" 
     308        "    <toolitem name='OpenFile' action='OpenFile'/>" 
    264309        "    <separator/>" 
    265         "    <toolitem action='GoToPreviousPage'/>" 
    266         "    <toolitem action='GoToNextPage'/>" 
     310        "    <toolitem name='GoToPreviousPage' action='GoToPreviousPage'/>" 
     311        "    <toolitem name='GoToNextPage' action='GoToNextPage'/>" 
    267312        "    <separator/>" 
    268313        "    <separator/>" 
    269         "    <toolitem action='ZoomIn'/>" 
    270         "    <toolitem action='ZoomOut'/>" 
    271         "    <toolitem action='ZoomFit'/>" 
    272         "    <toolitem action='ZoomWidth'/>" 
     314        "    <toolitem name='ZoomIn' action='ZoomIn'/>" 
     315        "    <toolitem name='ZoomOut' action='ZoomOut'/>" 
     316        "    <toolitem name='ZoomFit' action='ZoomFit'/>" 
     317        "    <toolitem name='ZoomWidth' action='ZoomWidth'/>" 
    273318        "  </toolbar>" 
    274319        "</ui>"; 
     
    305350//////////////////////////////////////////////////////////////// 
    306351 
     352void 
     353main_window_go_to_first_page_cb (GtkWidget *, gpointer) 
     354{ 
     355} 
     356 
     357void 
     358main_window_go_to_last_page_cb (GtkWidget *, gpointer) 
     359{ 
     360} 
     361 
     362void 
     363main_window_go_to_next_page_cb (GtkWidget *, gpointer) 
     364{ 
     365} 
     366 
     367void 
     368main_window_go_to_previous_page_cb (GtkWidget *, gpointer) 
     369{ 
     370} 
     371 
    307372/// 
    308373/// @brief The user tries to open a file. 
  • trunk/src/gtk/MainView.h

    r35 r36  
    3939            void sensitiveGoToPage (gboolean sensitive); 
    4040            void sensitiveGoToPreviousPage (gboolean sensitive); 
     41            void sensitiveRotateLeft (gboolean sensitive); 
     42            void sensitiveRotateRight (gboolean sensitive); 
    4143            void sensitiveZoomIn (gboolean sensitive); 
    4244            void sensitiveZoomOut (gboolean sensitive); 
  • trunk/tests/DumbMainView.cxx

    r31 r36  
    3838    m_SensitiveGoToPage = TRUE; 
    3939    m_SensitiveGoToPreviousPage = TRUE; 
     40    m_SensitiveRotateLeft = TRUE; 
     41    m_SensitiveRotateRight = TRUE; 
    4042    m_SensitiveZoomIn = TRUE; 
    4143    m_SensitiveZoomOut = TRUE; 
     
    100102} 
    101103 
     104void  
     105DumbMainView::sensitiveRotateLeft (gboolean sensitive) 
     106{ 
     107    m_SensitiveRotateLeft = sensitive; 
     108} 
     109 
     110void  
     111DumbMainView::sensitiveRotateRight (gboolean sensitive) 
     112{ 
     113    m_SensitiveRotateRight = sensitive; 
     114} 
     115 
    102116void 
    103117DumbMainView::sensitiveZoomIn (gboolean sensitive) 
     
    248262{ 
    249263    return m_SensitiveGoToPreviousPage; 
     264} 
     265 
     266gboolean 
     267DumbMainView::isSensitiveRotateLeft () 
     268{ 
     269    return m_SensitiveRotateLeft; 
     270} 
     271 
     272gboolean 
     273DumbMainView::isSensitiveRotateRight () 
     274{ 
     275    return m_SensitiveRotateRight; 
    250276} 
    251277 
  • trunk/tests/DumbMainView.h

    r31 r36  
    3535            void sensitiveGoToPage (gboolean sensitive); 
    3636            void sensitiveGoToPreviousPage (gboolean sensitive); 
     37            void sensitiveRotateLeft (gboolean sensitive); 
     38            void sensitiveRotateRight (gboolean sensitive); 
    3739            void sensitiveZoomIn (gboolean sensitive); 
    3840            void sensitiveZoomOut (gboolean sensitive); 
     
    6062            gboolean isSensitiveGoToPage (void); 
    6163            gboolean isSensitiveGoToPreviousPage (void); 
     64            gboolean isSensitiveRotateLeft (void); 
     65            gboolean isSensitiveRotateRight (void); 
    6266            gboolean isSensitiveZoomIn (void);         
    6367            gboolean isSensitiveZoomOut (void); 
     
    7983            gboolean m_SensitiveGoToPage; 
    8084            gboolean m_SensitiveGoToPreviousPage; 
     85            gboolean m_SensitiveRotateLeft; 
     86            gboolean m_SensitiveRotateRight; 
    8187            gboolean m_SensitiveZoomIn; 
    8288            gboolean m_SensitiveZoomOut; 
  • trunk/tests/MainPterTest.cxx

    r31 r36  
    6868    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPage ()); 
    6969    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     70    CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 
     71    CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 
    7072    CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 
    7173    CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); 
     
    9597    CPPUNIT_ASSERT (m_View->isSensitiveGoToPage ()); 
    9698    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     99    CPPUNIT_ASSERT (m_View->isSensitiveRotateLeft ()); 
     100    CPPUNIT_ASSERT (m_View->isSensitiveRotateRight ()); 
    97101    CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 
    98102    CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); 
     
    111115    CPPUNIT_ASSERT (m_View->isSensitiveGoToPage ()); 
    112116    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     117    CPPUNIT_ASSERT (m_View->isSensitiveRotateLeft ()); 
     118    CPPUNIT_ASSERT (m_View->isSensitiveRotateRight ()); 
    113119    CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 
    114120    CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ()); 
     
    136142    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPage ()); 
    137143    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     144    CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 
     145    CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 
    138146    CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 
    139147    CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); 
     
    164172    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPage ()); 
    165173    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     174    CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 
     175    CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 
    166176    CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 
    167177    CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); 
     
    194204    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPage ()); 
    195205    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     206    CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 
     207    CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 
    196208    CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 
    197209    CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); 
     
    224236    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPage ()); 
    225237    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     238    CPPUNIT_ASSERT (!m_View->isSensitiveRotateLeft ()); 
     239    CPPUNIT_ASSERT (!m_View->isSensitiveRotateRight ()); 
    226240    CPPUNIT_ASSERT (!m_View->isSensitiveZoomIn ()); 
    227241    CPPUNIT_ASSERT (!m_View->isSensitiveZoomOut ()); 
     
    254268    CPPUNIT_ASSERT (m_View->isSensitiveGoToPage ()); 
    255269    CPPUNIT_ASSERT (!m_View->isSensitiveGoToPreviousPage ()); 
     270    CPPUNIT_ASSERT (m_View->isSensitiveRotateLeft ()); 
     271    CPPUNIT_ASSERT (m_View->isSensitiveRotateRight ()); 
    256272    CPPUNIT_ASSERT (m_View->isSensitiveZoomIn ()); 
    257273    CPPUNIT_ASSERT (m_View->isSensitiveZoomOut ());