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

Daniel Burrows dburrows at costa.debian.org
Thu Sep 22 18:22:42 UTC 2005


Author: dburrows
Date: Thu Sep 22 18:22:38 2005
New Revision: 4174

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/pkg_item.cc
   branches/aptitude-0.3/aptitude/src/pkg_item.h
   branches/aptitude-0.3/aptitude/src/reason_fragment.cc
Log:
Realize the full product set of package states in the style domain.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Thu Sep 22 18:22:38 2005
@@ -1,5 +1,15 @@
 2005-09-22  Daniel Burrows  <dburrows at debian.org>
 
+	* doc/en/aptitude.xml, src/defaults.cc, src/pkg_item.cc, src/pkg_item.h, src/reason_fragment.cc:
+
+	  Make a separate named style for each and every possible package
+	  item state, including both highlighted and non-highlighted
+	  styles.  Among other things, this makes xterm display reasonable
+	  cursor colors for highlighted packages (by removing the
+	  A_REVERSE flag, which seems to confuse it in some cases).  Of
+	  course, it also means that people have much more flexibility in
+	  customizing the colors of the package list.
+
 	* src/generic/resolver_manager.cc:
 
 	  Optimize for the case of block_steps == 0 (so users can

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	Thu Sep 22 18:22:38 2005
@@ -6605,6 +6605,52 @@
 		</row>
 
 		<row>
+		  <entry><literal>PkgBrokenHighlighted</literal></entry>
+		  <entry><literal>fg red; bg black;</literal></entry>
+		  <entry>
+		    The style of highlighted packages in the package
+		    list which have unfulfilled dependencies.
+		  </entry>
+		</row>
+
+		<row>
+		  <entry><literal>PkgNotInstalled</literal></entry>
+		  <entry></entry>
+		  <entry>
+		    The style of packages which are not currently
+		    installed and will not be installed.
+		  </entry>
+		</row>
+
+		<row>
+		  <entry><literal>PkgNotInstalledHighlighted</literal></entry>
+		  <entry></entry>
+		  <entry>
+		    The style of highlighted packages which are not
+		    currently installed and will not be installed.
+		  </entry>
+		</row>
+
+		<row>
+		  <entry><literal>PkgIsInstalled</literal></entry>
+		  <entry><literal>set bold;</literal></entry>
+		  <entry>
+		    The style of packages which are currently
+		    installed and for which no actions are scheduled.
+		  </entry>
+		</row>
+
+		<row>
+		  <entry><literal>PkgIsInstalledHighlighted</literal></entry>
+		  <entry><literal>set bold; flip reverse;</literal></entry>
+		  <entry>
+		    The style of highlighted packages which are
+		    currently installed and for which no actions are
+		    scheduled.
+		  </entry>
+		</row>
+
+		<row>
 		  <entry><literal>PkgToHold</literal></entry>
 		  <entry><literal>fg black; bg white;</literal></entry>
 		  <entry>
@@ -6614,6 +6660,16 @@
 		</row>
 
 		<row>
+		  <entry><literal>PkgToHoldHighlighted</literal></entry>
+		  <entry><literal>fg white; bg black;</literal></entry>
+		  <entry>
+		    The style of highlighted packages in the package
+		    list which are <link linkend='pkgCmdHold'>on
+		    hold</link>.
+		  </entry>
+		</row>
+
+		<row>
 		  <entry><literal>PkgToInstall</literal></entry>
 		  <entry><literal>fg black; bg green;</literal></entry>
 		  <entry>
@@ -6626,6 +6682,18 @@
 		</row>
 
 		<row>
+		  <entry><literal>PkgToInstallHighlighted</literal></entry>
+		  <entry><literal>fg green; bg black;</literal></entry>
+		  <entry>
+		    The style of highlighted packages in the package
+		    list which are being <link
+		    linkend='pkgCmdInstall'>installed</link> (not
+		    upgraded) or <link
+		    linkend='pkgCmdReinstall'>reinstalled</link>.
+		  </entry>
+		</row>
+
+		<row>
 		  <entry><literal>PkgToRemove</literal></entry>
 		  <entry><literal>fg black; bg magenta;</literal></entry>
 		  <entry>
@@ -6635,6 +6703,16 @@
 		    linkend='pkgCmdPurge'>purged</link>.
 		  </entry>
 		</row>
+		<row>
+		  <entry><literal>PkgToRemoveHighlighted</literal></entry>
+		  <entry><literal>fg magenta; bg black;</literal></entry>
+		  <entry>
+		    The style of highlighted packages in the package
+		    list which will be <link
+		    linkend='pkgCmdRemove'>removed</link> or <link
+		    linkend='pkgCmdPurge'>purged</link>.
+		  </entry>
+		</row>
 
 		<row>
 		  <entry><literal>PkgToUpgrade</literal></entry>
@@ -6646,6 +6724,15 @@
 		</row>
 
 		<row>
+		  <entry><literal>PkgToUpgradeHighlighted</literal></entry>
+		  <entry><literal>fg cyan; bg black;</literal></entry>
+		  <entry>
+		    The style of packages in the package list which
+		    will be upgraded.
+		  </entry>
+		</row>
+
+		<row>
 		  <entry><literal>Progress</literal></entry>
 		  <entry><literal>fg blue; bg yellow;</literal></entry>
 		  <entry>

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	Thu Sep 22 18:22:38 2005
@@ -83,12 +83,33 @@
 
 static void init_styles()
 {
+  set_style("PkgNotInstalled", style());
+  set_style("PkgIsInstalled", style_attrs_on(A_BOLD));
   set_style("PkgToHold", style_fg(COLOR_BLACK)+style_bg(COLOR_WHITE));
   set_style("PkgToRemove", style_fg(COLOR_BLACK)+style_bg(COLOR_MAGENTA));
   set_style("PkgBroken", style_fg(COLOR_BLACK)+style_bg(COLOR_RED));
   set_style("PkgToInstall", style_fg(COLOR_BLACK)+style_bg(COLOR_GREEN));
   set_style("PkgToUpgrade", style_fg(COLOR_BLACK)+style_bg(COLOR_CYAN));
 
+
+  set_style("PkgNotInstalledHighlighted",
+	    style_attrs_flip(A_REVERSE));
+  set_style("PkgIsInstalledHighlighted",
+	    style_attrs_on(A_BOLD) + style_attrs_flip(A_REVERSE));
+  set_style("PkgToHoldHighlighted",
+	    style_fg(COLOR_WHITE) + style_bg(COLOR_BLACK));
+  set_style("PkgToRemoveHighlighted",
+	    style_fg(COLOR_MAGENTA) + style_bg(COLOR_BLACK));
+  set_style("PkgBrokenHighlighted",
+	    style_fg(COLOR_RED) + style_bg(COLOR_BLACK));
+  set_style("PkgToInstallHighlighted",
+	    style_fg(COLOR_GREEN) + style_bg(COLOR_BLACK));
+  set_style("PkgToUpgradeHighlighted",
+	    style_fg(COLOR_CYAN) + style_bg(COLOR_BLACK));
+
+
+
+
   set_style("DepBroken", style_fg(COLOR_BLACK)+style_bg(COLOR_RED));
 
   set_style("MediaChange", style_fg(COLOR_YELLOW)+style_bg(COLOR_RED)+style_attrs_on(A_BOLD));

Modified: branches/aptitude-0.3/aptitude/src/pkg_item.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_item.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_item.cc	Thu Sep 22 18:22:38 2005
@@ -233,12 +233,19 @@
    view_changelog(visible_version());
 }
 
+style pkg_item::get_highlight_style()
+{
+  return vs_treeitem::get_normal_style() + pkg_style(package, true);
+}
+
 style pkg_item::get_normal_style()
 {
-  return vs_treeitem::get_normal_style() + pkg_style(package);
+  return vs_treeitem::get_normal_style() + pkg_style(package, false);
 }
 
-style pkg_item::pkg_style(pkgCache::PkgIterator package)
+#define MAYBE_HIGHLIGHTED(x) (highlighted ? (x "Highlighted") : (x))
+
+style pkg_item::pkg_style(pkgCache::PkgIterator package, bool highlighted)
 {
   if(package.VersionList().end())
     {
@@ -257,13 +264,13 @@
 	}
 
       if(present_now && present_inst)
-	return style_attrs_on(A_BOLD);
+	return get_style(MAYBE_HIGHLIGHTED("PkgIsInstalled"));
       else if(present_now)
-	return get_style("PkgToRemove");
+	return get_style(MAYBE_HIGHLIGHTED("PkgToRemove"));
       else if(present_inst)
-	return get_style("PkgToInstall");
+	return get_style(MAYBE_HIGHLIGHTED("PkgToInstall"));
       else
-	return style();
+	return get_style(MAYBE_HIGHLIGHTED("PkgNotInstalled"));
     }
   else
     {
@@ -271,21 +278,21 @@
 
       if(!state.InstBroken() &&
 	 (state.NewInstall() || (state.iFlags&pkgDepCache::ReInstall)))
-	return get_style("PkgToInstall");
+	return get_style(MAYBE_HIGHLIGHTED("PkgToInstall"));
       else if(state.Status!=2 && // Not being upgraded
 	      (*apt_cache_file)->get_ext_state(package).selection_state==pkgCache::State::Hold // Flagged for hold
 	      && !state.InstBroken()) // Not currently broken.
-	return get_style("PkgToHold");
+	return get_style(MAYBE_HIGHLIGHTED("PkgToHold"));
       else if(state.Delete())
-	return get_style("PkgToRemove");
+	return get_style(MAYBE_HIGHLIGHTED("PkgToRemove"));
       else if(state.InstBroken())
-	return get_style("PkgBroken");
+	return get_style(MAYBE_HIGHLIGHTED("PkgBroken"));
       else if(state.Upgrade())
-	return get_style("PkgToUpgrade");
+	return get_style(MAYBE_HIGHLIGHTED("PkgToUpgrade"));
       else if(package.CurrentVer().end())
-	return style();
+	return get_style(MAYBE_HIGHLIGHTED("PkgNotInstalled"));
       else
-	return style_attrs_on(A_BOLD);
+	return get_style(MAYBE_HIGHLIGHTED("PkgIsInstalled"));
     }
 }
 

Modified: branches/aptitude-0.3/aptitude/src/pkg_item.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_item.h	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_item.h	Thu Sep 22 18:22:38 2005
@@ -69,6 +69,7 @@
   virtual void highlighted(vs_tree *win);
   virtual void unhighlighted(vs_tree *win);
 
+  virtual style get_highlight_style();
   virtual style get_normal_style();
 
   void show_changelog();
@@ -82,8 +83,11 @@
 
   /** Returns the style that would be used to display the given
    *  package.
+   *
+   *  \param package the package to generate a style for
+   *  \param highlighted if \b true, the package is highlighted
    */
-  static style pkg_style(pkgCache::PkgIterator package);
+  static style pkg_style(pkgCache::PkgIterator package, bool highlighted);
 };
 
 #endif

Modified: branches/aptitude-0.3/aptitude/src/reason_fragment.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/reason_fragment.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/reason_fragment.cc	Thu Sep 22 18:22:38 2005
@@ -137,7 +137,7 @@
 	 (currver.end() || provided_curr) &&
 	 (provided_cand || provided_curr))
 	fragments.push_back(text_fragment(P->Name(),
-					  pkg_item::pkg_style(*P)));
+					  pkg_item::pkg_style(*P, false)));
       else if(provided_cand || provided_curr)
 	{
 	  pkgCache::VerIterator &pv=provided_cand?candver:currver;
@@ -235,7 +235,7 @@
 
   return fragf("%F%s%F%F%s",
 	       text_fragment(dep.TargetPkg().Name(),
-			     pkg_item::pkg_style(dep.TargetPkg())),
+			     pkg_item::pkg_style(dep.TargetPkg(), false)),
 	       sec.empty() || sec=="main"?"":(" ["+sec+']').c_str(),
 	       verfrag,
 	       prvfrag(dep.TargetPkg(),
@@ -274,7 +274,7 @@
 
   return fragf(_("%F%s %F %F"),
 	       text_fragment(dep.ParentPkg().Name(),
-			     pkg_item::pkg_style(dep.ParentPkg())),
+			     pkg_item::pkg_style(dep.ParentPkg(), false)),
 	       sec.empty() || sec=="main"?"":(" ["+sec+']').c_str(),
 	       depname_frag(dep),
 	       sequence_fragment(fragments));



More information about the Aptitude-svn-commit mailing list