[Aptitude-svn-commit] r3321 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Mon, 06 Jun 2005 18:11:59 +0000


Author: dburrows
Date: Mon Jun  6 18:11:57 2005
New Revision: 3321

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:
Ok, include style information in the text layout widget's cache and inherit styles from the surrounding environment.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Jun  6 18:11:57 2005
@@ -1,5 +1,11 @@
 2005-06-06  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_text_layout.cc, src/vscreen/vs_text_layout.h:
+
+	Finish updating the text_layout widget: include style information
+	in its cache and handle the enclosing style environment in
+	paint().
+
 	* src/vscreen/vscreen_widget.cc:
 
 	Always set the display attributes of a widget to its basic style,

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	Mon Jun  6 18:11:57 2005
@@ -128,7 +128,7 @@
  */
 bool vs_text_layout::focus_me()
 {
-  freshen_contents();
+  freshen_contents(lastst);
 
   if(start>0 || contents.size()>(unsigned) getmaxy())
     return true;
@@ -139,9 +139,9 @@
 /** Paint by refreshing the contents [if necessary], then drawing,
  *  starting from the current line.
  */
-void vs_text_layout::paint()
+void vs_text_layout::paint(const style &st)
 {
-  freshen_contents();
+  freshen_contents(st);
 
   if(start>=contents.size())
     {
@@ -155,13 +155,14 @@
     mvaddnstr(i, 0, contents[i+start], contents[i+start].size());
 }
 
-void vs_text_layout::freshen_contents()
+void vs_text_layout::freshen_contents(const style &st)
 {
-  if(stale || lastw != getmaxx())
+  if(stale || lastw != getmaxx() || lastst != st)
     {
-      contents=f->layout(getmaxx(), getmaxx(), style());
+      contents=f->layout(getmaxx(), getmaxx(), st);
       stale=false;
       lastw=getmaxx();
+      lastst=st;
 
       do_signal();
     }
@@ -169,7 +170,7 @@
 
 void vs_text_layout::line_down()
 {
-  freshen_contents();
+  freshen_contents(lastst);
 
   if(start+getmaxy()<contents.size())
     set_start(start+1);
@@ -177,7 +178,7 @@
 
 void vs_text_layout::line_up()
 {
-  freshen_contents();
+  freshen_contents(lastst);
 
   if(start>0)
     set_start(start-1);
@@ -191,7 +192,7 @@
 
 void vs_text_layout::move_to_bottom()
 {
-  freshen_contents();
+  freshen_contents(lastst);
 
   set_start(max(start, contents.size()-getmaxy()));
 }
@@ -206,7 +207,7 @@
 
 void vs_text_layout::page_down()
 {
-  freshen_contents();
+  freshen_contents(lastst);
 
   if(start+getmaxy()<contents.size())
     set_start(start+getmaxy());

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	Mon Jun  6 18:11:57 2005
@@ -82,7 +82,7 @@
   bool focus_me();
 
   /** Paint this widget. */
-  void paint();
+  void paint(const style &st);
 
   /** Move the view one line down. */
   void line_down();
@@ -147,6 +147,9 @@
 
   /** The width of the widget the last time we updated the cached contents. */
   int lastw;
+
+  /** The enclosing display style the last time we updated the cached contents. */
+  const style lastst;
 };
 
 #endif