Update of /cvsroot/mahogany/M/src/modules/viewflt
In directory sc8-pr-cvs1:/tmp/cvs-serv2949/src/modules/viewflt

Modified Files:
        Rot13.cpp Signature.cpp Trailer.cpp 
Added Files:
        QuoteURL.cpp 
Log Message:
1. moved the URL highlighting and quote level detection logic to a separate
   view filter
2. view filters now get a pointer to the associated MessageView


***** Error reading new file: [Errno 2] No such file or directory: 'QuoteURL.cpp'
Index: Rot13.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/Rot13.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -u -2 -r1.1 -r1.2
--- Rot13.cpp   30 Nov 2002 01:47:40 -0000      1.1
+++ Rot13.cpp   1 Dec 2002 00:27:34 -0000       1.2
@@ -34,5 +34,6 @@
 {
 public:
-   Rot13Filter(ViewFilter *next, bool enable) : ViewFilter(next, enable) { }
+   Rot13Filter(MessageView *msgView, ViewFilter *next, bool enable)
+      : ViewFilter(msgView, next, enable) { }
 
 protected:

Index: Signature.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/Signature.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -u -2 -r1.2 -r1.3
--- Signature.cpp       30 Nov 2002 23:14:29 -0000      1.2
+++ Signature.cpp       1 Dec 2002 00:27:34 -0000       1.3
@@ -26,6 +26,15 @@
 
 #include "MTextStyle.h"
-
 #include "ViewFilter.h"
+#include "MessageView.h"
+
+#include "miscutil.h"         // for GetColourByName()
+
+// ----------------------------------------------------------------------------
+// options we use here
+// ----------------------------------------------------------------------------
+
+extern const MOption MP_HIGHLIGHT_SIGNATURE;
+extern const MOption MP_MVIEW_SIGCOLOUR;
 
 // ----------------------------------------------------------------------------
@@ -36,5 +45,9 @@
 {
 public:
-   SignatureFilter(ViewFilter *next, bool enable) : ViewFilter(next, enable) { }
+   SignatureFilter(MessageView *msgView, ViewFilter *next, bool enable)
+      : ViewFilter(msgView, next, enable)
+   {
+      ReadOptions(msgView->GetProfile());
+   }
 
 protected:
@@ -42,12 +55,44 @@
                           MessageViewer *viewer,
                           MTextStyle& style);
+
+   // fill m_options using the values from the given profile
+   void ReadOptions(Profile *profile);
+
+   struct Options
+   {
+      // the colour to use for signatures
+      wxColour SigCol;
+   } m_options;
 };
 
 // ============================================================================
-// implementation
+// SignatureFilter implementation
 // ============================================================================
 
 // ----------------------------------------------------------------------------
-// SignatureFilter
+// SignatureFilter options
+// ----------------------------------------------------------------------------
+
+void
+SignatureFilter::ReadOptions(Profile *profile)
+{
+   // a macro to make setting many colour options less painful
+   #define GET_COLOUR_FROM_PROFILE(col, name) \
+      GetColourByName(&col, \
+                      READ_CONFIG(profile, MP_MVIEW_##name), \
+                      GetStringDefault(MP_MVIEW_##name))
+
+   GET_COLOUR_FROM_PROFILE(m_options.SigCol, SIGCOLOUR);
+
+   #undef GET_COLOUR_FROM_PROFILE
+
+   if ( !READ_CONFIG_BOOL(profile, MP_HIGHLIGHT_SIGNATURE) )
+   {
+      Enable(false);
+   }
+}
+
+// ----------------------------------------------------------------------------
+// SignatureFilter work function
 // ----------------------------------------------------------------------------
 
@@ -129,5 +174,5 @@
       // and now show the trailer in special style
       wxColour colOld = style.GetTextColour();
-      style.SetTextColour(*wxBLUE);
+      style.SetTextColour(m_options.SigCol);
 
       m_next->Process(signature, viewer, style);

Index: Trailer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/Trailer.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -u -2 -r1.3 -r1.4
--- Trailer.cpp 30 Nov 2002 23:14:30 -0000      1.3
+++ Trailer.cpp 1 Dec 2002 00:27:34 -0000       1.4
@@ -36,5 +36,6 @@
 {
 public:
-   TrailerFilter(ViewFilter *next, bool enable) : ViewFilter(next, enable) { }
+   TrailerFilter(MessageView *msgView, ViewFilter *next, bool enable)
+      : ViewFilter(msgView, next, enable) { }
 
 protected:
@@ -90,5 +91,5 @@
       // (a) checking that it consists solely of delimiter characters
       //     if there is a chance that this is a delimiter line
-      while ( *pc != '\n' && pc >= start )
+      while ( chDel != '\0' && *pc != '\n' && pc >= start )
       {
          if ( *pc-- != chDel )
@@ -96,7 +97,4 @@
             // it's not a delimiter line, finally
             chDel = '\0';
-
-            // we can go faster now
-            break;
          }
       }



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to