Update of /cvsroot/mahogany/M/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12991/include

Modified Files:
        MessageView.h Moptions.h 
Log Message:
automatically select the viewer best fit for the shown message

Index: MessageView.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MessageView.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -b -u -2 -r1.61 -r1.62
--- MessageView.h       23 Jun 2005 20:57:37 -0000      1.61
+++ MessageView.h       23 Jun 2005 23:44:35 -0000      1.62
@@ -371,4 +371,16 @@
       bool showFaces:1;
 
+      /// choose the viewer automatically?
+      bool autoViewer:1;
+
+      /// prefer HTML to plain text?
+      bool preferHTML:1;
+
+      /// allow HTML as last resort?
+      bool allowHTML:1;
+
+      /// switch viewer to be able to show images inline?
+      bool allowImages:1;
+
       //@}
 
@@ -434,5 +446,6 @@
    /// update GUI to show the new viewer window
    virtual void OnViewerChange(const MessageViewer *viewerOld,
-                               const MessageViewer *viewerNew) = 0;
+                               const MessageViewer *viewerNew,
+                               const String& nameViewer) = 0;
 
    /// update GUI to indicate the new "show headers" options state
@@ -672,8 +685,30 @@
 
    /// create the viewer we'll use
-   void CreateViewer(wxWindow *parent);
+   void CreateViewer();
+
+   /**
+      Set the viewer.
+
+      @param viewer the viewer to use, may be NULL, then CreateDefaultViewer()
+                    is used; this viewer will be deleted automatically when
+                    this function is called the next time
+      @param viewerName the name of the viewer
+      @param parent the parent window for the viewer, we may find it ourselves
+                    once we're fully created so it can be left NULL except for
+                    the initial call
+    */
+   void SetViewer(MessageViewer *viewer,
+                  const String& viewerName,
+                  wxWindow *parent = NULL);
+
+   /**
+      Reset the viewer to the default one.
 
-   /// set the viewer (may be NULL, then CreateDefaultViewer() is used)
-   void SetViewer(MessageViewer *viewer, wxWindow *parent);
+      @param parent the parent window, may be NULL
+    */
+   void ResetViewer(wxWindow *parent = NULL)
+   {
+      SetViewer(NULL, String(), parent);
+   }
 
    /**
@@ -687,7 +722,29 @@
    bool HasRealViewer() const { return m_viewer && !m_usingDefViewer; }
 
+   /// this is a private function used to study what kind of contents we have
+   int DeterminePartContent(const MimePart *mimepart);
+
+   /**
+      Adjusts the viewer to correspond to the given MIME structure.
+
+      We may want to choose a specific viewer for this message, e.g. we
+      currently use HTML viewer for the HTML messages without any plain text
+      part (of course, this is subject to user-defined options). When this
+      function changes the viewer, it saves the old one as m_viewerOld and when
+      it's called the next time, it restores it.
+    */
+   void AutoAdjustViewer(const MimePart *mimepart);
+
+
    /// the viewer we use
    MessageViewer *m_viewer;
 
+   /// the last viewer we used, before temporarily switching to the above one
+   MessageViewer *m_viewerOld;
+
+   /// the names of the current and old viewer (may be empty)
+   String m_viewerName,
+          m_viewerNameOld;
+
    /// is it the default one?
    bool m_usingDefViewer;

Index: Moptions.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/Moptions.h,v
retrieving revision 1.98
retrieving revision 1.99
diff -b -u -2 -r1.98 -r1.99
--- Moptions.h  15 May 2005 21:18:23 -0000      1.98
+++ Moptions.h  23 Jun 2005 23:44:35 -0000      1.99
@@ -254,4 +254,8 @@
 extern const MOption MP_MSGVIEW_SHOWBAR;
 extern const MOption MP_MSGVIEW_VIEWER;
+extern const MOption MP_MSGVIEW_AUTO_VIEWER;
+extern const MOption MP_MSGVIEW_PREFER_HTML;
+extern const MOption MP_MSGVIEW_ALLOW_HTML;
+extern const MOption MP_MSGVIEW_ALLOW_IMAGES;
 extern const MOption MP_MSGVIEW_HEADERS;
 extern const MOption MP_MSGVIEW_ALL_HEADERS;
@@ -911,4 +915,12 @@
 /// which viewer to use in the message view?
 #define MP_MSGVIEW_VIEWER_NAME _T("MsgViewer")
+/// select the "best" viewer automatically?
+#define MP_MSGVIEW_AUTO_VIEWER_NAME _T("AutoViewer")
+/// use HTML viewer whenever there is HTML content?
+#define MP_MSGVIEW_PREFER_HTML_NAME _T("PreferHTML")
+/// allow HTML viewer when there is only HTML content?
+#define MP_MSGVIEW_ALLOW_HTML_NAME _T("AllowHTML")
+/// allow image-capable viewer when there are inline images?
+#define MP_MSGVIEW_ALLOW_IMAGES_NAME _T("AllowImages")
 /// which headers to show in the message view?
 #define   MP_MSGVIEW_HEADERS_NAME     _T("MsgViewHeaders")
@@ -1762,4 +1774,12 @@
 /// which viewer to use in the message view?
 #define MP_MSGVIEW_VIEWER_DEFVAL _T("LayoutViewer")
+/// select the "best" viewer automatically?
+#define MP_MSGVIEW_AUTO_VIEWER_DEFVAL 1l
+/// use HTML viewer whenever there is HTML content?
+#define MP_MSGVIEW_PREFER_HTML_DEFVAL 0l
+/// allow HTML viewer when there is only HTML content?
+#define MP_MSGVIEW_ALLOW_HTML_DEFVAL 1l
+/// allow image-capable viewer when there are inline images?
+#define MP_MSGVIEW_ALLOW_IMAGES_DEFVAL 1l
 /// which headers to show in the message view?
 #define   MP_MSGVIEW_HEADERS_DEFVAL     \



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to