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

Daniel Burrows dburrows at costa.debian.org
Wed Sep 21 22:30:17 UTC 2005


Author: dburrows
Date: Wed Sep 21 22:30:15 2005
New Revision: 4159

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/broken_indicator.cc
Log:
Dim unavailable actions in the broken hint line.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Sep 21 22:30:15 2005
@@ -1,5 +1,9 @@
 2005-09-21  Daniel Burrows  <dburrows at debian.org>
 
+	* src/broken_indicator.cc:
+
+	  Dim out the unavailable actions in the broken hint line.
+
 	* src/vscreen/fragment.cc:
 
 	  Make column fragments always have a final newline.

Modified: branches/aptitude-0.3/aptitude/src/broken_indicator.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/broken_indicator.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/broken_indicator.cc	Wed Sep 21 22:30:15 2005
@@ -96,23 +96,42 @@
   }
 
 private:
-  static fragment *key_hint_fragment()
+  static fragment *key_hint_fragment(const resolver_manager::state &state)
   {
     wstring next=global_bindings.readable_keyname("NextSolution");
     wstring prev=global_bindings.readable_keyname("PrevSolution");
     wstring examine=global_bindings.readable_keyname("ExamineSolution");
     wstring apply=global_bindings.readable_keyname("ApplySolution");
 
+
+
+    style st_normal;
+    style st_disabled;
+    st_disabled.attrs_off(A_BOLD);
+    st_disabled.attrs_on(A_DIM);
+    st_disabled.set_fg(COLOR_BLACK);
+
     vector<fragment *> key_hints;
 
     key_hints.push_back(fragf(_("%s: Examine"),
 			      examine.c_str()));
-    key_hints.push_back(fragf(_("%s: Apply"),
-			      apply.c_str()));
-    key_hints.push_back(fragf(_("%s: Next"),
-			      next.c_str()));
-    key_hints.push_back(fragf(_("%s: Previous"),
-			      prev.c_str()));
+
+
+    bool can_apply = (state.selected_solution < state.generated_solutions);
+    bool can_next = (state.selected_solution < state.generated_solutions &&
+		     !(state.selected_solution + 1 == state.generated_solutions && state.solutions_exhausted));
+
+    key_hints.push_back(style_fragment(fragf(_("%s: Apply"),
+					     apply.c_str()),
+				       can_apply ? st_normal : st_disabled));
+    key_hints.push_back(style_fragment(fragf(_("%s: Next"),
+					     next.c_str()),
+				       can_next ? st_normal : st_disabled));
+
+    bool can_prev = (state.selected_solution > 0);
+    key_hints.push_back(style_fragment(fragf(_("%s: Previous"),
+					     prev.c_str()),
+				       can_prev ? st_normal : st_disabled));
 
     return join_fragments(key_hints, L"  ");
   }
@@ -224,7 +243,9 @@
 
 	columns.push_back(fragment_column_entry(false, 1, fragment_column_entry::top, text_fragment(spin_string(state))));
 
-	set_fragment(fragment_columns(columns));
+	set_fragment(sequence_fragment(fragment_columns(columns),
+				       key_hint_fragment(state),
+				       NULL));
 	last_sol.nullify();
 	show();
 	return;
@@ -349,7 +370,7 @@
 	  }
 	else
 	  fragments.push_back(newline_fragment());
-	fragments.push_back(hardwrapbox(key_hint_fragment()));
+	fragments.push_back(hardwrapbox(key_hint_fragment(state)));
 
 	fragment *f=sequence_fragment(fragments);
 	set_fragment(f);



More information about the Aptitude-svn-commit mailing list