Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv28646/src/gui

Modified Files:
        wxFolderView.cpp wxMainFrame.cpp wxMenuDefs.cpp 
        wxMessageView.cpp wxOptionsDlg.cpp 
Log Message:
added View|Viewers menu, removed (took inside #ifdef USE_VIEWER_BAR which is not 
defined by default) the viewer bar

Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.640
retrieving revision 1.641
diff -b -u -2 -r1.640 -r1.641
--- wxFolderView.cpp    23 Jul 2003 19:27:49 -0000      1.640
+++ wxFolderView.cpp    14 Sep 2003 14:10:12 -0000      1.641
@@ -143,5 +143,7 @@
 extern const MOption MP_MSGS_SORTBY;
 extern const MOption MP_MSGS_USE_THREADING;
+#ifdef USE_VIEWER_BAR
 extern const MOption MP_MSGVIEW_SHOWBAR;
+#endif // USE_VIEWER_BAR
 extern const MOption MP_MSGVIEW_VIEWER;
 extern const MOption MP_PREVIEW_ON_SELECT;
@@ -159,5 +161,7 @@
 extern const MPersMsgBox *M_MSGBOX_MARK_READ;
 extern const MPersMsgBox *M_MSGBOX_OPEN_UNACCESSIBLE_FOLDER;
+#ifdef USE_VIEWER_BAR
 extern const MPersMsgBox *M_MSGBOX_VIEWER_BAR_TIP;
+#endif // USE_VIEWER_BAR
 
 // ----------------------------------------------------------------------------
@@ -338,4 +342,5 @@
    void Resize();
 
+#ifdef USE_VIEWER_BAR
    // create/delete the controls we put above the viewer window
    void CreateViewerBar();
@@ -344,4 +349,5 @@
    // update the state of the viewer bar
    void UpdateViewerBar();
+#endif // USE_VIEWER_BAR
 
 private:
@@ -355,4 +361,8 @@
    wxWindow *m_winViewer;
 
+   // the event handler to hook the kbd input (NULL initially, !NULL later)
+   class wxFolderMsgViewerEvtHandler *m_evtHandlerMsgView;
+
+#ifdef USE_VIEWER_BAR
    // the viewer bar: contains the controls we put above the viewer
    wxPanel *m_winBar;
@@ -361,7 +371,4 @@
    wxArrayString m_namesViewers;
 
-   // the event handler to hook the kbd input (NULL initially, !NULL later)
-   class wxFolderMsgViewerEvtHandler *m_evtHandlerMsgView;
-
    // the event table ids
    enum
@@ -370,4 +377,5 @@
       Choice_Viewer = 200
    };
+#endif // USE_VIEWER_BAR
 
    DECLARE_EVENT_TABLE()
@@ -1049,6 +1057,8 @@
    EVT_SIZE(wxFolderMsgWindow::OnSize)
 
+#ifdef USE_VIEWER_BAR
    EVT_BUTTON(wxFolderMsgWindow::Button_Close, wxFolderMsgWindow::OnButton)
    EVT_CHOICE(wxFolderMsgWindow::Choice_Viewer, wxFolderMsgWindow::OnChoice)
+#endif // USE_VIEWER_BAR
 END_EVENT_TABLE()
 
@@ -1065,5 +1075,7 @@
 {
    m_winViewer = NULL;
+#ifdef USE_VIEWER_BAR
    m_winBar = NULL;
+#endif // USE_VIEWER_BAR
    m_folderView = folderView;
    m_listCtrl = listCtrl;
@@ -1083,4 +1095,5 @@
       m_winViewer->PopEventHandler(false /* don't delete it */);
    }
+#ifdef USE_VIEWER_BAR
    else // we didn't have any viewer window before
    {
@@ -1096,4 +1109,5 @@
       //else: don't create the viewer bar if we don't have any folder
    }
+#endif // USE_VIEWER_BAR
 
    m_winViewer = winViewerNew;
@@ -1112,4 +1126,5 @@
    else // we don't have any viewer any longer
    {
+#ifdef USE_VIEWER_BAR
       if ( m_winBar )
       {
@@ -1117,4 +1132,5 @@
       }
       //else: we might not have created it
+#endif // USE_VIEWER_BAR
    }
 }
@@ -1132,4 +1148,6 @@
 // ----------------------------------------------------------------------------
 
+#ifdef USE_VIEWER_BAR
+
 void wxFolderMsgWindow::CreateViewerBar()
 {
@@ -1232,6 +1250,9 @@
 }
 
+#endif // USE_VIEWER_BAR
+
 void wxFolderMsgWindow::UpdateOptions()
 {
+#ifdef USE_VIEWER_BAR
    if ( !m_winViewer )
    {
@@ -1270,4 +1291,5 @@
       UpdateViewerBar();
    }
+#endif // USE_VIEWER_BAR
 }
 
@@ -1284,4 +1306,6 @@
 }
 
+#ifdef USE_VIEWER_BAR
+
 void wxFolderMsgWindow::OnButton(wxCommandEvent& /* event */)
 {
@@ -1331,4 +1355,6 @@
 }
 
+#endif // USE_VIEWER_BAR
+
 // resize our own child to fill the entire available for it area
 void wxFolderMsgWindow::Resize()
@@ -1336,4 +1362,5 @@
    wxSize size = GetClientSize();
    int y;
+#ifdef USE_VIEWER_BAR
    if ( m_winBar )
    {
@@ -1342,4 +1369,5 @@
    }
    else // no viewer bar
+#endif // USE_VIEWER_BAR
    {
       y = 0;
@@ -4444,10 +4472,5 @@
 
       default:
-         if ( WXMENU_CONTAINS(VIEW_FILTERS, cmd) )
-         {
-            if ( m_MessagePreview )
-               m_MessagePreview->OnToggleViewFilter(cmd, event.IsChecked());
-         }
-         else if ( cmd >= WXMENU_POPUP_FOLDER_MENU )
+         if ( cmd >= WXMENU_POPUP_FOLDER_MENU )
          {
             // it might be a folder from popup menu
@@ -5093,4 +5116,5 @@
               WXMENU_CONTAINS(VIEW, id) ||
               WXMENU_CONTAINS(VIEW_FILTERS, id) ||
+              WXMENU_CONTAINS(VIEW_VIEWERS, id) ||
               id == WXMENU_HELP_CONTEXT ||
               id == WXMENU_EDIT_CUT ||

Index: wxMainFrame.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMainFrame.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -b -u -2 -r1.168 -r1.169
--- wxMainFrame.cpp     31 Jul 2003 13:02:58 -0000      1.168
+++ wxMainFrame.cpp     14 Sep 2003 14:10:13 -0000      1.169
@@ -996,5 +996,6 @@
              id == WXMENU_EDIT_FINDAGAIN ||
              WXMENU_CONTAINS(VIEW, id) ||
-             WXMENU_CONTAINS(VIEW_FILTERS, id)) )
+             WXMENU_CONTAINS(VIEW_FILTERS, id) ||
+             WXMENU_CONTAINS(VIEW_VIEWERS, id) ) )
    {
       m_FolderView->OnCommandEvent(event);

Index: wxMenuDefs.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMenuDefs.cpp,v
retrieving revision 1.202
retrieving revision 1.203
diff -b -u -2 -r1.202 -r1.203
--- wxMenuDefs.cpp      22 Aug 2003 22:14:24 -0000      1.202
+++ wxMenuDefs.cpp      14 Sep 2003 14:10:13 -0000      1.203
@@ -438,4 +438,7 @@
    // the available accelerators for this menu:
    // ABCDEFGIJKNOPQRSTUVXYZ
+   { WXMENU_SUBMENU,       gettext_noop("&Viewer to use"), "", wxITEM_NORMAL },
+   { WXMENU_SUBMENU,       "", "", wxITEM_NORMAL },
+   { WXMENU_SEPARATOR,     "",                  ""                         , 
wxITEM_NORMAL },
    { WXMENU_MSG_TOGGLEHEADERS, gettext_noop("Show &headers"), gettext_noop("Toggle 
display of message header") , wxITEM_CHECK },
    { WXMENU_MSG_SHOWRAWTEXT,  gettext_noop("Show ra&w message\tCtrl-Z"), 
gettext_noop("Show the raw message text") , wxITEM_NORMAL },

Index: wxMessageView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMessageView.cpp,v
retrieving revision 1.291
retrieving revision 1.292
diff -b -u -2 -r1.291 -r1.292
--- wxMessageView.cpp   13 Sep 2003 23:04:55 -0000      1.291
+++ wxMessageView.cpp   14 Sep 2003 14:10:13 -0000      1.292
@@ -77,4 +77,5 @@
 // ----------------------------------------------------------------------------
 
+extern const MOption MP_MSGVIEW_VIEWER;
 extern const MOption MP_MVIEW_TITLE_FMT;
 
@@ -264,4 +265,20 @@
       delete viewerOld->GetWindow();
    }
+
+   // we also need to update the viewers menu to indicate the currently
+   // selected one
+   if ( viewerNew )
+   {
+      int n = m_namesViewers.Index(GetProfileValues().msgViewer);
+      CHECK_RET( n != wxNOT_FOUND, _T("non existing viewer selected?") );
+
+      wxFrame *frame = GetFrame(viewerNew->GetWindow());
+      CHECK_RET( frame, _T("no parent frame in wxMessageView") );
+
+      wxMenuBar *mbar = frame->GetMenuBar();
+      CHECK_RET( mbar, _T("no menu bar in the frame containing wxMessageView?") );
+
+      mbar->Check(WXMENU_VIEW_VIEWERS_BEGIN + 1 + n, true);
+   }
 }
 
@@ -273,5 +290,5 @@
 
 // ----------------------------------------------------------------------------
-// message view filters functions
+// "View" menu support functions
 // ----------------------------------------------------------------------------
 
@@ -285,7 +302,37 @@
    WXADD_MENU(frame->GetMenuBar(), VIEW, _("&View"));
 
-   // find the filters submenu in it
-   wxMenu *menu = FindSubmenu(frame, WXMENU_VIEW_FILTERS_SUBMENU_BEGIN + 1);
-   CHECK_RET( menu, _T("View|Filters submenu not found?") );
+   // initialize viewers submenu
+   // --------------------------
+
+   wxMenu *menuView = FindSubmenu(frame, WXMENU_VIEW_VIEWERS_SUBMENU_BEGIN + 1);
+   CHECK_RET( menuView, _T("View|Viewers submenu not found?") );
+
+   Profile * const profile = GetProfile();
+   CHECK_RET( profile, _T("no Profile in wxMessageView?") );
+
+   const wxString nameCurViewer = READ_CONFIG(profile, MP_MSGVIEW_VIEWER);
+   wxArrayString descViewers;
+   size_t countViewers = GetAllAvailableViewers(&m_namesViewers, &descViewers);
+
+   for ( size_t nViewer = 0; nViewer < countViewers; nViewer++ )
+   {
+      const int id = WXMENU_VIEW_VIEWERS_BEGIN + 1 + nViewer;
+
+      menuView->AppendRadioItem(id, descViewers[nViewer]);
+
+      if ( m_namesViewers[nViewer] == nameCurViewer )
+      {
+         // indicate the current viewer
+         menuView->Check(id, true);
+      }
+   }
+
+
+   // initialize view filters submenu
+   // -------------------------------
+
+   // find the filters submenu in the top level menu
+   wxMenu *menuFlt = FindSubmenu(frame, WXMENU_VIEW_FILTERS_SUBMENU_BEGIN + 1);
+   CHECK_RET( menuFlt, _T("View|Filters submenu not found?") );
 
 
@@ -297,7 +344,7 @@
    // and then iterate over all the filters adding them
    int id = WXMENU_VIEW_FILTERS_BEGIN + 1;
-   void *cookie;
    String name,
           desc;
+   void *cookie;
    bool enabled;
    bool cont = GetFirstViewFilter(&name, &desc, &enabled, &cookie);
@@ -305,8 +352,9 @@
    {
       m_namesFilters.Add(name);
+      m_statesFilters.Add(enabled);
 
-      menu->AppendCheckItem(id, desc);
+      menuFlt->AppendCheckItem(id, desc);
       if ( enabled )
-         menu->Check(id, true);
+         menuFlt->Check(id, true);
 
       id++;
@@ -319,5 +367,5 @@
 
 void
-wxMessageView::OnToggleViewFilter(int id, bool checked)
+wxMessageView::OnToggleViewFilter(int id)
 {
    const int n = id - WXMENU_VIEW_FILTERS_BEGIN - 1;
@@ -330,5 +378,27 @@
    CHECK_RET( profile, _T("no Profile in wxMessageView?") );
 
-   profile->writeEntry(m_namesFilters[n], checked);
+   m_statesFilters[n] = !m_statesFilters[n];
+   profile->writeEntry(m_namesFilters[n], m_statesFilters[n]);
+
+   MEventManager::Send(new MEventOptionsChangeData
+                           (
+                            profile,
+                            MEventOptionsChangeData::Ok
+                           ));
+}
+
+void
+wxMessageView::OnSelectViewer(int id)
+{
+   const int n = id - WXMENU_VIEW_VIEWERS_BEGIN - 1;
+
+   CHECK_RET( n >= 0 && (size_t)n < m_namesViewers.GetCount(),
+              _T("invalid viewer selected from the menu?") );
+
+   // this one must not be DecRef()'d
+   Profile * const profile = GetProfile();
+   CHECK_RET( profile, _T("no Profile in wxMessageView?") );
+
+   profile->writeEntry(MP_MSGVIEW_VIEWER, m_namesViewers[n]);
 
    MEventManager::Send(new MEventOptionsChangeData
@@ -337,4 +407,20 @@
                             MEventOptionsChangeData::Ok
                            ));
+}
+
+// ----------------------------------------------------------------------------
+// other menu stuff
+// ----------------------------------------------------------------------------
+
+void
+wxMessageView::OnShowHeadersChange()
+{
+   wxFrame *frame = GetParentFrame();
+   CHECK_RET( frame, _T("message view without parent frame?") );
+
+   wxMenuBar *mbar = frame->GetMenuBar();
+   CHECK_RET( mbar, _T("message view frame without menu bar?") );
+
+   mbar->Check(WXMENU_MSG_TOGGLEHEADERS, GetProfileValues().showHeaders);
 }
 

Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.379
retrieving revision 1.380
diff -b -u -2 -r1.379 -r1.380
--- wxOptionsDlg.cpp    4 Sep 2003 16:12:06 -0000       1.379
+++ wxOptionsDlg.cpp    14 Sep 2003 14:10:13 -0000      1.380
@@ -355,5 +355,7 @@
    ConfigField_MsgViewerHelp,
    ConfigField_MsgViewer,
+#ifdef USE_VIEWER_BAR
    ConfigField_MsgViewerBar,
+#endif // USE_VIEWER_BAR
 #ifdef USE_FONT_DESC
    ConfigField_MessageViewFont,
@@ -1348,5 +1350,7 @@
    { gettext_noop("&Message viewer"),              Field_Combo |
                                                    Field_Advanced,    -1 },
+#ifdef USE_VIEWER_BAR
    { gettext_noop("Show viewer &bar"),             Field_Bool,    -1 },
+#endif // USE_VIEWER_BAR
 
 #ifdef USE_FONT_DESC
@@ -1896,8 +1900,10 @@
 #endif // USE_PYTHON
 
-   // message views
+   // message view
    CONFIG_NONE(),
    CONFIG_NONE(), // and not MP_MSGVIEW_VIEWER: we handle it specially
+#ifdef USE_VIEWER_BAR
    CONFIG_ENTRY(MP_MSGVIEW_SHOWBAR),
+#endif // USE_VIEWER_BAR
 #ifdef USE_FONT_DESC
    CONFIG_ENTRY(MP_MVIEW_FONT_DESC),



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to