[Aptitude-svn-commit] r4261 - in branches/aptitude-0.3/aptitude: . doc/en src

Daniel Burrows dburrows at costa.debian.org
Sun Sep 25 18:51:17 UTC 2005


Author: dburrows
Date: Sun Sep 25 18:51:12 2005
New Revision: 4261

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/doc/en/aptitude.xml
   branches/aptitude-0.3/aptitude/src/defaults.cc
   branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Add keybindings and menu items to directly select the first and last generated solution.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun Sep 25 18:51:12 2005
@@ -1,5 +1,10 @@
 2005-09-25  Daniel Burrows  <dburrows at debian.org>
 
+	* doc/en/aptitude.xml, src/defaults.cc, src/ui.cc:
+
+	  Add keybindings and menu items to directly select the first and
+	  last generated solution.
+
 	* src/load_config.cc, src/vscreen/config/colors.cc, src/vscreen/config/colors.h, src/vscreen/config/style.cc, src/vscreen/config/style.h:
 
 	  Support using the default background color by encoding it in the

Modified: branches/aptitude-0.3/aptitude/doc/en/aptitude.xml
==============================================================================
--- branches/aptitude-0.3/aptitude/doc/en/aptitude.xml	(original)
+++ branches/aptitude-0.3/aptitude/doc/en/aptitude.xml	Sun Sep 25 18:51:12 2005
@@ -5394,6 +5394,15 @@
 	      </row>
 
 	      <row>
+		<entry><literal>FirstSolution</literal></entry>
+		<entry><literal>&lt;</literal></entry>
+		<entry>
+		  Select the first solution produced by the problem
+		  resolver.
+		</entry>
+	      </row>
+
+	      <row>
 		<entry><literal>ForbidUpgrade</literal></entry>
 		<entry>F</entry>
 		<entry>
@@ -5476,6 +5485,15 @@
 	      </row>
 
 	      <row>
+		<entry><literal>LastSolution</literal></entry>
+		<entry><literal>&lt;</literal></entry>
+		<entry>
+		  Select the last solution produced by the problem
+		  resolver.
+		</entry>
+	      </row>
+
+	      <row>
 		<entry><literal>Left</literal></entry>
 		<entry><literal>left,h</literal></entry>
 		<entry>
@@ -5578,15 +5596,11 @@
 		</entry>
 	      </row>
 
-	      <!-- TODO: this is a wording only a software engineer
-	           could love -->
 	      <row>
 		<entry><literal>NextSolution</literal></entry>
 		<entry><literal>.</literal></entry>
 		<entry>
-		  If some packages are broken and the currently
-		  selected solution is not the last solution, advances
-		  to the next solution.
+		  Advance the dependency resolver to the next solution.
 		</entry>
 	      </row>
 
@@ -5620,9 +5634,7 @@
 		<entry><literal>PrevSolution</literal></entry>
 		<entry><literal>,</literal></entry>
 		<entry>
-		  If some packages are broken and the currently
-		  selected solution is not the first solution, returns
-		  to the previous solution.
+		  Return the dependency resolver to the previous solution.
 		</entry>
 	      </row>
 

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	Sun Sep 25 18:51:12 2005
@@ -69,6 +69,8 @@
 
   global_bindings.set("NextSolution", key(L'.', false));
   global_bindings.set("PrevSolution", key(L',', false));
+  global_bindings.set("FirstSolution", key(L'<', false));
+  global_bindings.set("LastSolution", key(L'>', false));
   global_bindings.set("ExamineSolution", key(L'e', false));
   global_bindings.set("ApplySolution", key(L'!', false));
   global_bindings.set("DumpResolver", key(L'*', false));

Modified: branches/aptitude-0.3/aptitude/src/ui.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/ui.cc	Sun Sep 25 18:51:12 2005
@@ -1575,6 +1575,50 @@
     resman->select_previous_solution();
 }
 
+static bool do_first_solution_enabled()
+{
+  if(resman == NULL)
+    return false;
+
+  resolver_manager::state state = resman->state_snapshot();
+
+  return state.resolver_exists && state.selected_solution > 0;
+}
+
+static void do_first_solution()
+{
+  if(!do_first_solution_enabled())
+    beep();
+  else
+    resman->select_solution(0);
+}
+
+static bool do_last_solution_enabled()
+{
+  if(resman == NULL)
+    return false;
+
+  resolver_manager::state state = resman->state_snapshot();
+
+  return state.resolver_exists && state.selected_solution + 1 < state.generated_solutions;
+}
+
+static void do_last_solution()
+{
+  if(resman == NULL)
+    {
+      beep();
+      return;
+    }
+
+  resolver_manager::state state = resman->state_snapshot();
+
+  if(!(state.resolver_exists && state.selected_solution + 1 < state.generated_solutions))
+    beep();
+  else
+    resman->select_solution(state.generated_solutions - 1);
+}
+
 static bool do_apply_solution_enabled_from_state(const resolver_manager::state &state)
 {
   return
@@ -1585,6 +1629,9 @@
 
 static bool do_apply_solution_enabled()
 {
+  if(resman == NULL)
+    return false;
+
   resolver_manager::state state = resman->state_snapshot();
   return do_apply_solution_enabled_from_state(state);
 }
@@ -1833,6 +1880,14 @@
 	       "PrevSolution", N_("Select the previous solution to the dependency problems."),
 	       sigc::ptr_fun(do_previous_solution),
 	       sigc::ptr_fun(do_previous_solution_enabled)),
+  vs_menu_info(vs_menu_info::VS_MENU_ITEM, N_("^First Solution"),
+	       "FirstSolution", N_("Select the first solution to the dependency problems."),
+	       sigc::ptr_fun(do_first_solution),
+	       sigc::ptr_fun(do_first_solution_enabled)),
+  vs_menu_info(vs_menu_info::VS_MENU_ITEM, N_("^Last Solution"),
+	       "LastSolution", N_("Select the last solution to the dependency problems that has been generated so far."),
+	       sigc::ptr_fun(do_last_solution),
+	       sigc::ptr_fun(do_last_solution_enabled)),
 
   VS_MENU_SEPARATOR,
 
@@ -2135,6 +2190,12 @@
   main_stacked->connect_key_post("PrevSolution",
 				 &global_bindings,
 				 sigc::ptr_fun(do_previous_solution));
+  main_stacked->connect_key_post("FirstSolution",
+				 &global_bindings,
+				 sigc::ptr_fun(do_first_solution));
+  main_stacked->connect_key_post("LastSolution",
+				 &global_bindings,
+				 sigc::ptr_fun(do_last_solution));
   main_stacked->connect_key_post("ApplySolution",
 				 &global_bindings,
 				 sigc::ptr_fun(do_apply_solution));



More information about the Aptitude-svn-commit mailing list