Update of /cvsroot/mahogany/M/src/modules/viewflt
In directory sc8-pr-cvs1:/tmp/cvs-serv22025/src/modules/viewflt
Modified Files:
QuoteURL.cpp Signature.cpp
Log Message:
fixed applying viewer filter options (didn't take place immediately)
Index: QuoteURL.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/QuoteURL.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -b -u -2 -r1.8 -r1.9
--- QuoteURL.cpp 18 Sep 2003 16:31:02 -0000 1.8
+++ QuoteURL.cpp 30 Sep 2003 23:00:59 -0000 1.9
@@ -96,20 +96,10 @@
: ViewFilter(msgView, next, enable)
{
- ReadOptions(msgView->GetProfile());
+ ReadOptions(m_options, msgView->GetProfile());
}
-protected:
- // the main work function
- virtual void DoProcess(String& text,
- MessageViewer *viewer,
- MTextStyle& style);
-
- // fill m_options using the values from the given profile
- void ReadOptions(Profile *profile);
-
- // helpers
- size_t GetQuotedLevel(const wxChar *text) const;
- wxColour GetQuoteColour(size_t qlevel) const;
+ virtual bool UpdateOptions(Profile *profile);
+protected:
struct Options
{
@@ -134,5 +124,40 @@
/// highlight URLs?
bool highlightURLs:1;
- } m_options;
+
+ bool operator==(const Options& o) const
+ {
+ bool eq = quotedMaxWhitespace == o.quotedMaxWhitespace &&
+ quotedColourize == o.quotedColourize &&
+ quotedCycleColours == o.quotedCycleColours &&
+ highlightURLs == o.highlightURLs;
+ if ( eq && quotedColourize )
+ {
+ for ( size_t n = 0; n <= QUOTE_LEVEL_MAX; n++ )
+ {
+ if ( QuotedCol[n] != o.QuotedCol[n] )
+ {
+ eq = false;
+ break;
+ }
+ }
+ }
+
+ return eq;
+ }
+ };
+
+ // the main work function
+ virtual void DoProcess(String& text,
+ MessageViewer *viewer,
+ MTextStyle& style);
+
+ // fill m_options using the values from the given profile
+ void ReadOptions(Options& options, Profile *profile);
+
+ // helpers
+ size_t GetQuotedLevel(const wxChar *text) const;
+ wxColour GetQuoteColour(size_t qlevel) const;
+
+ Options m_options;
};
@@ -216,5 +241,6 @@
void
-QuoteURLFilter::ReadOptions(Profile *profile)
+QuoteURLFilter::ReadOptions(QuoteURLFilter::Options& options,
+ Profile *profile)
{
// a macro to make setting many colour options less painful
@@ -224,19 +250,32 @@
GetStringDefault(MP_MVIEW_##name))
- GET_COLOUR_FROM_PROFILE(m_options.QuotedCol[1], QUOTED_COLOUR1);
- GET_COLOUR_FROM_PROFILE(m_options.QuotedCol[2], QUOTED_COLOUR2);
- GET_COLOUR_FROM_PROFILE(m_options.QuotedCol[3], QUOTED_COLOUR3);
+ GET_COLOUR_FROM_PROFILE(options.QuotedCol[1], QUOTED_COLOUR1);
+ GET_COLOUR_FROM_PROFILE(options.QuotedCol[2], QUOTED_COLOUR2);
+ GET_COLOUR_FROM_PROFILE(options.QuotedCol[3], QUOTED_COLOUR3);
#undef GET_COLOUR_FROM_PROFILE
- m_options.quotedColourize =
+ options.quotedColourize =
READ_CONFIG_BOOL(profile, MP_MVIEW_QUOTED_COLOURIZE);
- m_options.quotedCycleColours =
+ options.quotedCycleColours =
READ_CONFIG_BOOL(profile, MP_MVIEW_QUOTED_CYCLE_COLOURS);
- m_options.quotedMaxWhitespace =
+ options.quotedMaxWhitespace =
READ_CONFIG_BOOL(profile, MP_MVIEW_QUOTED_MAXWHITESPACE);
- m_options.quotedMaxAlpha = READ_CONFIG(profile, MP_MVIEW_QUOTED_MAXALPHA);
+ options.quotedMaxAlpha = READ_CONFIG(profile, MP_MVIEW_QUOTED_MAXALPHA);
+
+ options.highlightURLs = READ_CONFIG_BOOL(profile, MP_HIGHLIGHT_URLS);
+}
+
+bool QuoteURLFilter::UpdateOptions(Profile *profile)
+{
+ Options optionsNew;
+ ReadOptions(optionsNew, profile);
+
+ if ( optionsNew == m_options )
+ return false;
+
+ m_options = optionsNew;
- m_options.highlightURLs = READ_CONFIG_BOOL(profile, MP_HIGHLIGHT_URLS);
+ return true;
}
Index: Signature.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/Signature.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -u -2 -r1.10 -r1.11
--- Signature.cpp 18 Sep 2003 16:31:02 -0000 1.10
+++ Signature.cpp 30 Sep 2003 23:00:59 -0000 1.11
@@ -49,8 +49,18 @@
: ViewFilter(msgView, next, enable)
{
- ReadOptions(msgView->GetProfile());
+ ReadOptions(m_options, msgView->GetProfile());
}
+ virtual bool UpdateOptions(Profile *profile);
+
protected:
+ struct Options
+ {
+ // the colour to use for signatures
+ wxColour SigCol;
+
+ bool operator==(const Options& o) const { return SigCol == o.SigCol; }
+ };
+
virtual void DoProcess(String& text,
MessageViewer *viewer,
@@ -58,11 +68,8 @@
// fill m_options using the values from the given profile
- void ReadOptions(Profile *profile);
+ void ReadOptions(Options& options, Profile *profile);
- struct Options
- {
- // the colour to use for signatures
- wxColour SigCol;
- } m_options;
+
+ Options m_options;
};
@@ -76,5 +83,6 @@
void
-SignatureFilter::ReadOptions(Profile *profile)
+SignatureFilter::ReadOptions(SignatureFilter::Options& options,
+ Profile *profile)
{
// a macro to make setting many colour options less painful
@@ -84,5 +92,5 @@
GetStringDefault(MP_MVIEW_##name))
- GET_COLOUR_FROM_PROFILE(m_options.SigCol, SIGCOLOUR);
+ GET_COLOUR_FROM_PROFILE(options.SigCol, SIGCOLOUR);
#undef GET_COLOUR_FROM_PROFILE
@@ -92,4 +100,32 @@
Enable(false);
}
+}
+
+bool SignatureFilter::UpdateOptions(Profile *profile)
+{
+ Options optionsNew;
+ ReadOptions(optionsNew, profile);
+
+ bool changed;
+ if ( optionsNew == m_options )
+ {
+ changed = false;
+ }
+ else
+ {
+ changed = true;
+
+ m_options = optionsNew;
+ }
+
+ bool enabled = READ_CONFIG_BOOL(profile, MP_HIGHLIGHT_SIGNATURE);
+ if ( enabled != IsEnabled() )
+ {
+ changed = true;
+
+ Enable(enabled);
+ }
+
+ return changed;
}
-------------------------------------------------------
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