Update of /cvsroot/mahogany/M/src/modules
In directory usw-pr-cvs1:/tmp/cvs-serv32682a/src/modules
Modified Files:
HtmlViewer.cpp LayoutViewer.cpp TextViewer.cpp
Log Message:
highlight the URLs in the headers as well
Index: HtmlViewer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/HtmlViewer.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -b -u -2 -r1.34 -r1.35
--- HtmlViewer.cpp 16 Apr 2002 19:32:15 -0000 1.34
+++ HtmlViewer.cpp 3 May 2002 17:01:07 -0000 1.35
@@ -85,7 +85,10 @@
virtual void StartHeaders();
virtual void ShowRawHeaders(const String& header);
- virtual void ShowHeader(const String& name,
- const String& value,
+ virtual void ShowHeaderName(const String& name);
+ virtual void ShowHeaderValue(const String& value,
wxFontEncoding encoding);
+ virtual void ShowHeaderURL(const String& text,
+ const String& url);
+ virtual void EndHeader();
virtual void ShowXFace(const wxBitmap& bitmap);
virtual void EndHeaders();
@@ -98,5 +101,5 @@
virtual void InsertRawContents(const String& data);
virtual void InsertText(const String& text, const MTextStyle& style);
- virtual void InsertURL(const String& url);
+ virtual void InsertURL(const String& text, const String& url);
virtual void InsertSignature(const String& signature);
virtual void EndPart();
@@ -725,12 +728,6 @@
}
-void HtmlViewer::ShowHeader(const String& headerName,
- const String& headerValue,
- wxFontEncoding encHeader)
+void HtmlViewer::ShowHeaderName(const String& name)
{
- // don't show empty headers at all
- if ( headerValue.empty() )
- return;
-
if ( m_firstheader )
{
@@ -741,27 +738,35 @@
}
- const ProfileValues& profileValues = GetOptions();
-
- // first column: header names (width=1 means minimal width)
+ // create the first column: header names (width=1 means minimal width)
m_htmlText += "<tr>"
"<td align=\"right\" width=\"1\">";
- {
- FontColourChanger colChanger(profileValues.HeaderNameCol, m_htmlText);
+ FontColourChanger colChanger(GetOptions().HeaderNameCol, m_htmlText);
- m_htmlText << "<tt>" << headerName << ": </tt>";
- }
+ m_htmlText << "<tt>" << name << ": </tt>";
+}
+void HtmlViewer::ShowHeaderValue(const String& value,
+ wxFontEncoding encoding)
+{
// second column: header values
m_htmlText += "</td><td>";
- {
- FontColourChanger colChanger(profileValues.HeaderValueCol, m_htmlText);
+ FontColourChanger colChanger(GetOptions().HeaderValueCol, m_htmlText);
- EncodingChanger encChanger(encHeader, m_htmlText);
+ EncodingChanger encChanger(encoding, m_htmlText);
- m_htmlText += MakeHtmlSafe(headerValue);
- }
+ m_htmlText += MakeHtmlSafe(value);
+}
+
+void HtmlViewer::ShowHeaderURL(const String& text,
+ const String& url)
+{
+ InsertURL(text, url);
+}
+void HtmlViewer::EndHeader()
+{
+ // terminate the header row
m_htmlText += "</td></tr>";
}
@@ -863,11 +868,11 @@
}
-void HtmlViewer::InsertURL(const String& url)
+void HtmlViewer::InsertURL(const String& text, const String& url)
{
// URLs may contain special characters which must be replaced by HTML
- // entities (i.e. '&' -> "&")
- String htmlizedUrl = MakeHtmlSafe(url);
-
- m_htmlText << "<a href=\"" << htmlizedUrl << "\">" << htmlizedUrl << "</a>";
+ // entities (i.e. '&' -> "&") so use MakeHtmlSafe()
+ m_htmlText << "<a href=\"" << MakeHtmlSafe(url) << "\">"
+ << MakeHtmlSafe(text)
+ << "</a>";
}
Index: LayoutViewer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/LayoutViewer.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -b -u -2 -r1.21 -r1.22
--- LayoutViewer.cpp 13 Mar 2002 22:30:03 -0000 1.21
+++ LayoutViewer.cpp 3 May 2002 17:01:07 -0000 1.22
@@ -79,7 +79,10 @@
virtual void StartHeaders();
virtual void ShowRawHeaders(const String& header);
- virtual void ShowHeader(const String& name,
- const String& value,
+ virtual void ShowHeaderName(const String& name);
+ virtual void ShowHeaderValue(const String& value,
wxFontEncoding encoding);
+ virtual void ShowHeaderURL(const String& text,
+ const String& url);
+ virtual void EndHeader();
virtual void ShowXFace(const wxBitmap& bitmap);
virtual void EndHeaders();
@@ -92,5 +95,5 @@
virtual void InsertRawContents(const String& data);
virtual void InsertText(const String& text, const MTextStyle& style);
- virtual void InsertURL(const String& url);
+ virtual void InsertURL(const String& text, const String& url);
virtual void InsertSignature(const String& signature);
virtual void EndPart();
@@ -417,35 +420,42 @@
}
-void LayoutViewer::ShowHeader(const String& headerName,
- const String& headerValue,
- wxFontEncoding encHeader)
+void LayoutViewer::ShowHeaderName(const String& name)
{
wxLayoutList *llist = m_window->GetLayoutList();
- const ProfileValues& profileValues = GetOptions();
- // don't show the header at all if there is no value
- if ( !headerValue.empty() )
- {
// insert the header name
llist->SetFontWeight(wxBOLD);
- SetTextColour(profileValues.HeaderNameCol);
+ SetTextColour(GetOptions().HeaderNameCol);
// always terminate the header names with ": " - configurability
// cannot be endless neither
- llist->Insert(headerName + ": ");
+ llist->Insert(name + ": ");
- // insert the header value
llist->SetFontWeight(wxNORMAL);
- SetTextColour(profileValues.HeaderValueCol);
+}
+
+void LayoutViewer::ShowHeaderValue(const String& value,
+ wxFontEncoding encoding)
+{
+ SetTextColour(GetOptions().HeaderValueCol);
+
+ wxLayoutImportText(m_window->GetLayoutList(), value, encoding);
+}
+
+void LayoutViewer::ShowHeaderURL(const String& text,
+ const String& url)
+{
+ InsertURL(text, url);
+}
+
+void LayoutViewer::EndHeader()
+{
+ wxLayoutList *llist = m_window->GetLayoutList();
- wxLayoutImportText(llist, headerValue, encHeader);
llist->LineBreak();
- if ( encHeader != wxFONTENCODING_SYSTEM )
- {
- // restore the default encoding
+ // restore the default encoding after possibly changing it in
+ // ShowHeaderValue()
llist->SetFontEncoding(wxFONTENCODING_DEFAULT);
- }
- }
}
@@ -538,7 +548,7 @@
}
-void LayoutViewer::InsertURL(const String& url)
+void LayoutViewer::InsertURL(const String& text, const String& url)
{
- wxLayoutObject *obj = new wxLayoutObjectText(url);
+ wxLayoutObject *obj = new wxLayoutObjectText(text);
LayoutUserData* data = new LayoutUserData(new ClickableInfo(url));
obj->SetUserData(data);
Index: TextViewer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/TextViewer.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -b -u -2 -r1.30 -r1.31
--- TextViewer.cpp 27 Apr 2002 11:32:51 -0000 1.30
+++ TextViewer.cpp 3 May 2002 17:01:07 -0000 1.31
@@ -77,7 +77,10 @@
virtual void StartHeaders();
virtual void ShowRawHeaders(const String& header);
- virtual void ShowHeader(const String& name,
- const String& value,
+ virtual void ShowHeaderName(const String& name);
+ virtual void ShowHeaderValue(const String& value,
wxFontEncoding encoding);
+ virtual void ShowHeaderURL(const String& text,
+ const String& url);
+ virtual void EndHeader();
virtual void ShowXFace(const wxBitmap& bitmap);
virtual void EndHeaders();
@@ -90,5 +93,5 @@
virtual void InsertRawContents(const String& data);
virtual void InsertText(const String& text, const MTextStyle& style);
- virtual void InsertURL(const String& url);
+ virtual void InsertURL(const String& text, const String& url);
virtual void InsertSignature(const String& signature);
virtual void EndPart();
@@ -489,14 +492,15 @@
}
-void TextViewer::ShowHeader(const String& headerName,
- const String& headerValue,
- wxFontEncoding encHeader)
+void TextViewer::ShowHeaderName(const String& name)
{
- if ( headerValue.empty() )
- return;
-
const ProfileValues& profileValues = GetOptions();
- InsertText(headerName + ": ", wxTextAttr(profileValues.HeaderNameCol));
+ InsertText(name + ": ", wxTextAttr(profileValues.HeaderNameCol));
+}
+
+void TextViewer::ShowHeaderValue(const String& value,
+ wxFontEncoding encoding)
+{
+ const ProfileValues& profileValues = GetOptions();
wxColour col = profileValues.HeaderValueCol;
@@ -505,11 +509,22 @@
wxTextAttr attr(col);
- if ( encHeader != wxFONTENCODING_SYSTEM )
+ if ( encoding != wxFONTENCODING_SYSTEM )
{
- wxFont font = profileValues.GetFont(encHeader);
+ wxFont font = profileValues.GetFont(encoding);
attr.SetFont(font);
}
- InsertText(headerValue + "\n", attr);
+ InsertText(value, attr);
+}
+
+void TextViewer::ShowHeaderURL(const String& text,
+ const String& url)
+{
+ InsertURL(text, url);
+}
+
+void TextViewer::EndHeader()
+{
+ InsertText("\n", wxTextAttr());
}
@@ -570,5 +585,5 @@
}
-void TextViewer::InsertURL(const String& url)
+void TextViewer::InsertURL(const String& text, const String& url)
{
m_window->InsertClickable(url, new ClickableInfo(url), GetOptions().UrlCol);
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates