Update of /cvsroot/mahogany/M/src/modules
In directory usw-pr-cvs1:/tmp/cvs-serv7378/src/modules
Modified Files:
LayoutViewer.cpp
Log Message:
fixed the bug with showing boxes instead of the newlines in the wrapped URLs
Index: LayoutViewer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/LayoutViewer.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -b -u -2 -r1.22 -r1.23
--- LayoutViewer.cpp 3 May 2002 17:01:07 -0000 1.22
+++ LayoutViewer.cpp 3 May 2002 23:02:49 -0000 1.23
@@ -548,15 +548,49 @@
}
-void LayoutViewer::InsertURL(const String& text, const String& url)
+void LayoutViewer::InsertURL(const String& textOrig, const String& url)
{
- wxLayoutObject *obj = new wxLayoutObjectText(text);
+ wxLayoutList *llist = m_window->GetLayoutList();
+
LayoutUserData* data = new LayoutUserData(new ClickableInfo(url));
+ SetTextColour(GetOptions().UrlCol);
+
+ // the text can contain newlines (when we have a wrapped URL) but a single
+ // wxLayoutObject can't span several lines
+ String text = textOrig,
+ textRest;
+ do
+ {
+ const char *p0 = text;
+ const char *p = strchr(p0, '\n');
+ if ( p )
+ {
+ textRest = text.substr(p - p0 + 1);
+
+ if ( p > p0 && *(p - 1) == '\r' )
+ {
+ p--;
+ }
+
+ text.erase(p - p0);
+ }
+ else // no newline
+ {
+ textRest.clear();
+ }
+
+ wxLayoutObject *obj = new wxLayoutObjectText(text);
obj->SetUserData(data);
+ llist->Insert(obj);
+
+ if ( p )
+ llist->LineBreak();
+
+ text = textRest;
+ }
+ while ( !text.empty() );
+
// SetUserData has incremented the refCount, which is now 2
// (it was already 1 right after creation)
data->DecRef();
-
- SetTextColour(GetOptions().UrlCol);
- m_window->GetLayoutList()->Insert(obj);
}
_______________________________________________________________
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