[Aptitude-devel] r3159 - in branches/aptitude-0.3/aptitude: . src/vscreen
Daniel Burrows
dburrows@costa.debian.org
Thu, 28 Apr 2005 00:45:18 +0000
Author: dburrows
Date: Thu Apr 28 00:45:15 2005
New Revision: 3159
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc
branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.h
Log:
Add a routine to allow users of vs_text_layout to append fragments
to it.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Thu Apr 28 00:45:15 2005
@@ -1,5 +1,9 @@
2005-04-27 Daniel Burrows <dburrows@debian.org>
+ * src/vscreen/vs_text_layout.cc, src/vscreen/vs_text_layout.h:
+
+ Add a way to append text to a vs_text_layout 'after the fact'.
+
* src/generic/apt.cc:
Hackily avoid discarding the error list by instead asking the UI
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.cc Thu Apr 28 00:45:15 2005
@@ -87,6 +87,14 @@
vscreen_queuelayout();
}
+void vs_text_layout::append_fragment(fragment *_f)
+{
+ f=sequence_fragment(f, _f, NULL);
+ stale=true;
+
+ vscreen_queuelayout();
+}
+
void vs_text_layout::set_start(unsigned int new_start)
{
if(new_start!=start)
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.h (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_text_layout.h Thu Apr 28 00:45:15 2005
@@ -46,6 +46,22 @@
/** Change the fragment being displayed in this layout widget. */
void set_fragment(fragment *f);
+ /** Append the given fragment to the current fragment.
+ *
+ * \note this is slightly less efficient than placing the two
+ * fragments into the text_layout up-front via a single
+ * sequence_fragment. Normally this isn't a problem, but if you
+ * want to append hundreds of fragments this way, it might be.
+ *
+ * \todo this is only needed for memory-management reasons
+ * (otherwise I could safely extract the current fragment and
+ * create my own sequence). Would refcounting help?
+ *
+ * \todo if this becomes very useful, it would be better to just
+ * explicitly store a sequence of fragments in the layout.
+ */
+ void append_fragment(fragment *f);
+
/** Return the requested width of this widget. The requested width
* will be the largest possible width of any line.
*/