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

Daniel Burrows dburrows at costa.debian.org
Wed Aug 17 01:50:00 UTC 2005


Author: dburrows
Date: Wed Aug 17 01:49:56 2005
New Revision: 3884

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/solution_screen.cc
Log:
Add initial support for displaying a 'story' about a solution to the visual mode.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Aug 17 01:49:56 2005
@@ -1,5 +1,11 @@
 2005-08-16  Daniel Burrows  <dburrows at debian.org>
 
+	* src/solution_screen.cc:
+
+	  Add and activate support for displaying a "story" in the visual
+	  interface (currently you can't switch between story and
+	  non-story mode, though).
+
 	* src/cmdline/cmdline_resolver.cc, src/solution_fragment.cc, src/solution_fragment.h:
 
 	  Change dep_fragment to dep_text, returning a wstring, not a

Modified: branches/aptitude-0.3/aptitude/src/solution_screen.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/solution_screen.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/solution_screen.cc	Wed Aug 17 01:49:56 2005
@@ -163,9 +163,11 @@
 {
   wstring my_label;
 public:
-  label_tree(wstring _label, bool _expanded = true)
+  label_tree(wstring _label, bool _expanded = true,
+	     bool selectable = true)
     :vs_subtree_generic(_expanded), my_label(_label)
   {
+    set_selectable(selectable);
   }
 
   void paint(vs_tree *win, int y, bool hierarchical,
@@ -669,6 +671,30 @@
   }
 };
 
+vs_subtree_generic *make_story_tree(const aptitude_solution &sol)
+{
+  vector<aptitude_solution::action> actions;
+
+  for(map<aptitude_universe::package, aptitude_solution::action>::const_iterator
+	i = sol.get_actions().begin() ; i != sol.get_actions().end(); ++i)
+    actions.push_back(i->second);
+
+  sort(actions.begin(), actions.end(), aptitude_solution::action_id_compare());
+
+  vs_subtree_generic *root = new label_tree(L"");
+
+  for(vector<aptitude_solution::action>::const_iterator
+	i = actions.begin(); i != actions.end(); ++i)
+    {
+      vs_subtree_generic *tree = new label_tree(dep_text(i->d.get_dep()), true, false);
+
+      tree->add_child(new solution_act_item(*i));
+      root->add_child(tree);
+    }
+
+  return root;
+}
+
 vs_subtree_generic *make_solution_tree(const aptitude_solution &sol)
 {
   // Bin packages according to what will happen to them.
@@ -834,7 +860,7 @@
 	  set_root(new vs_staticitem(transcode(_("Internal error: unexpected null solution.")),
 				     L""));
 	else
-	  set_root(make_solution_tree(sol));
+	  set_root(make_story_tree(sol));
       }
     catch(NoMoreSolutions)
       {



More information about the Aptitude-svn-commit mailing list