[Aptitude-svn-commit] r3887 - in branches/aptitude-0.3/aptitude: .
src
Daniel Burrows
dburrows at costa.debian.org
Wed Aug 17 16:30:59 UTC 2005
Author: dburrows
Date: Wed Aug 17 16:30:56 2005
New Revision: 3887
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/defaults.cc
branches/aptitude-0.3/aptitude/src/solution_screen.cc
Log:
Add support for showing either 'stories' or 'solutions' in the visual UI.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Wed Aug 17 16:30:56 2005
@@ -1,5 +1,10 @@
2005-08-17 Daniel Burrows <dburrows at debian.org>
+ * src/defaults.cc, src/solution_screen.cc:
+
+ Add support for switching between a 'solution' viewing mode and
+ a 'story' viewing mode.
+
* src/vscreen/vs_tree.cc:
Clean up line_up and line_down (NB: it's not quite clear that
Modified: branches/aptitude-0.3/aptitude/src/defaults.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/defaults.cc (original)
+++ branches/aptitude-0.3/aptitude/src/defaults.cc Wed Aug 17 16:30:56 2005
@@ -26,6 +26,8 @@
global_bindings.set("ChangePkgTreeGrouping", key(L'G', false));
global_bindings.set("ChangePkgTreeSorting", key(L'S', false));
+ global_bindings.set("CycleOrder", key(L'o', false));
+
global_bindings.set("Install", key(L'+', false));
global_bindings.set("Remove", key(L'-', false));
global_bindings.set("Hold", key(L'=', false));
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 16:30:56 2005
@@ -28,6 +28,7 @@
#include <generic/util.h>
#include <vscreen/transcode.h>
+#include <vscreen/vs_multiplex.h>
#include <vscreen/vs_staticitem.h>
#include <vscreen/vs_subtree.h>
#include <vscreen/vs_tree.h>
@@ -792,10 +793,13 @@
return root;
}
-class solution_screen : public vs_tree
+class solution_screen : public vs_multiplex
{
aptitude_solution last_sol;
+ vs_tree_ref solution_tree;
+ vs_tree_ref story_tree;
+
void attach_apt_cache_signals()
{
if(apt_cache_file)
@@ -813,9 +817,21 @@
update();
}
+ void set_static_root(const wstring &s)
+ {
+ solution_tree->set_root(new vs_staticitem(s, L""), true);
+ story_tree->set_root(new vs_staticitem(s, L""), true);
+ }
+
protected:
solution_screen()
+ : vs_multiplex(false),
+ solution_tree(vs_tree::create()), story_tree(vs_tree::create())
{
+ add_visible_widget(solution_tree, true);
+ add_visible_widget(story_tree, true);
+ solution_tree->show();
+
attach_apt_cache_signals();
cache_closed.connect(sigc::mem_fun(*this, &solution_screen::update));
@@ -824,6 +840,15 @@
update();
}
+ bool handle_key(const key &k)
+ {
+ if(global_bindings.key_matches(k, "CycleOrder"))
+ cycle_forward();
+ else
+ return vs_multiplex::handle_key(k);
+
+ return true;
+ }
public:
static ref_ptr<solution_screen> create()
{
@@ -834,9 +859,7 @@
{
if(!apt_cache_file)
{
- set_root(new vs_staticitem(transcode(_("The package cache is not available.")),
- L""),
- true);
+ set_static_root(transcode(_("The package cache is not available.")));
return;
}
@@ -857,21 +880,21 @@
last_sol = sol;
if(sol.get_actions().empty())
- set_root(new vs_staticitem(transcode(_("Internal error: unexpected null solution.")),
- L""));
+ set_static_root(transcode(_("Internal error: unexpected null solution.")));
else
- set_root(make_story_tree(sol));
+ {
+ solution_tree->set_root(make_solution_tree(sol));
+ story_tree->set_root(make_story_tree(sol));
+ }
}
catch(NoMoreSolutions)
{
- set_root(new vs_staticitem(transcode(_("No resolution found.")),
- L""));
+ set_static_root(transcode(_("No resolution found.")));
}
catch(NoMoreTime)
{
- set_root(new vs_staticitem(transcode(ssprintf(_("Time exhausted while searching for a solution (you can select \"Next Solution\" or press %s to try harder)."),
- global_bindings.readable_keyname("NextSolution").c_str())),
- L""));
+ set_static_root(transcode(ssprintf(_("Time exhausted while searching for a solution (you can select \"Next Solution\" or press %s to try harder)."),
+ global_bindings.readable_keyname("NextSolution").c_str())));
}
}
};
More information about the Aptitude-svn-commit
mailing list