Patch for gnome-terminal; use_bold option



I just started using gnome-terminal so I could benefit from the terminal
factory. However, I find the way bright colours are emboldened unaesthetic
(especially for small fonts), and I've spoken to others, who agree.

I made a small patch which adds an option to toggle the emboldening of bright
colours (the default is off).

The diff (against CVS) is attached. I can send a patch in whatever format to
whoever, or I can wait until my CVS account comes through :)

It would be nice to add colour replacements for underline and bold, like
rxvt's rxvt*color[UL|BD], too. That implies changes to zvt, however. 

-- 
coffeecocacolagravitywars - Hans Petter Jansson - amigadracoempirefluxstuff
toomuchsugarkingcrimsonemperorcrimzgoodbadandonedayitsallgonnaendupinflames
Index: gnome-terminal.c
===================================================================
RCS file: /cvs/gnome/gnome-core/gnome-terminal/gnome-terminal.c,v
retrieving revision 1.167
diff -u -r1.167 gnome-terminal.c
--- gnome-terminal.c	2000/03/27 21:17:11	1.167
+++ gnome-terminal.c	2000/04/22 21:46:26
@@ -94,6 +94,7 @@
 #ifdef ZVT_BACKGROUND_SCROLL
 	int scroll_background:1; 		/* background will scroll */
 #endif
+  int use_bold         :1;  /* Use bold on bright colours */
 	enum palette_enum color_type; 			/* The color mode */
 	enum color_set_enum color_set;
 	char *font; 				/* Font used by the terminals */
@@ -141,6 +142,7 @@
 	GtkWidget *scroll_out_checkbox;
 	GtkWidget *swapkeys_checkbox;
 	GtkWidget *login_by_default_checkbox;
+  GtkWidget *use_bold_checkbox;
 	GtkWidget *wordclass_entry;
 	GtkWidget *pixmap_checkbox;
 	GtkWidget *pixmap_file_entry;
@@ -287,7 +289,7 @@
  * Keep a copy of the current font name
  */
 static void
-gnome_term_set_font (ZvtTerm *term, char *font_name)
+gnome_term_set_font (ZvtTerm *term, char *font_name, const int use_bold)
 {
 	char *s;
 	GdkFont *font;
@@ -295,7 +297,8 @@
 	font = gdk_font_load (font_name);
 	if (font) {
 #ifdef ZVT_TERM_EMBOLDEN_SUPPORT
-		if (zvt_term_get_capabilities(term) & ZVT_TERM_EMBOLDEN_SUPPORT)
+		if (zvt_term_get_capabilities(term) & ZVT_TERM_EMBOLDEN_SUPPORT &&
+        use_bold)
 			zvt_term_set_fonts  (term, font, 0);
 		else
 #endif
@@ -509,6 +512,7 @@
 	cfg->swap_keys         = gnome_config_get_bool ("swap_del_and_backspace=0");
 
 	cfg->login_by_default  = gnome_config_get_bool ("login_by_default=0");
+  cfg->use_bold          = gnome_config_get_bool ("use_bold=0");
 
 #ifdef ZVT_BACKGROUND_SCROLL
 	cfg->scroll_background = gnome_config_get_bool ("scroll_background=0");
@@ -578,6 +582,7 @@
 	newcfg->scroll_key     = GTK_TOGGLE_BUTTON (prefs->scroll_kbd_checkbox)->active;
 	newcfg->scrollback = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (prefs->scrollback_spin));
 	newcfg->login_by_default = GTK_TOGGLE_BUTTON (prefs->login_by_default_checkbox)->active;
+  newcfg->use_bold = GTK_TOGGLE_BUTTON(prefs->use_bold_checkbox)->active;
 
 	newcfg->transparent = GTK_TOGGLE_BUTTON (prefs->transparent_checkbox)->active;
 	newcfg->shaded = GTK_TOGGLE_BUTTON (prefs->shaded_checkbox)->active;
@@ -654,7 +659,7 @@
 	cfg = terminal_config_dup (newcfg);
 	gtk_object_set_data (GTK_OBJECT (term), "config", cfg);
 
-	gnome_term_set_font (term, cfg->font);
+	gnome_term_set_font (term, cfg->font, cfg->use_bold);
 	zvt_term_set_wordclass (term, (guchar *)cfg->wordclass);
 	zvt_term_set_bell(term, !cfg->bell);
 	zvt_term_set_blink (term, cfg->blink);
@@ -983,12 +988,13 @@
 	BACKCOLOR_ROW   = 4,
 	CLASS_ROW       = 1,
 	FONT_ROW        = 2,
-	BLINK_ROW       = 3,
-	MENUBAR_ROW     = 4,
-	BELL_ROW        = 5,
-	SWAPKEYS_ROW    = 6,
-	LOGIN_ROW       = 7,
-	WORDCLASS_ROW	= 8,
+  BOLDTOGGLE_ROW  = 3,
+	BLINK_ROW       = 4,
+	MENUBAR_ROW     = 5,
+	BELL_ROW        = 6,
+	SWAPKEYS_ROW    = 7,
+	LOGIN_ROW       = 8,
+	WORDCLASS_ROW	= 9,
 	BACKGROUND_ROW	= 1,
 	PIXMAP_FILE_ROW	= 2,
 	SHADED_ROW      = 4,
@@ -1024,6 +1030,7 @@
 	gnome_config_set_bool   ("blinking", cfg->blink);
 	gnome_config_set_bool   ("swap_del_and_backspace", cfg->swap_keys);
 	gnome_config_set_bool   ("login_by_default", cfg->login_by_default);
+  gnome_config_set_bool   ("use_bold", cfg->use_bold);
 	gnome_config_set_int    ("scrollbacklines", cfg->scrollback);
 	gnome_config_set_int    ("color_set", cfg->color_set);
 	if (cfg->color_type>=4)
@@ -1171,6 +1178,23 @@
 	gtk_table_attach (GTK_TABLE (table), prefs->class_box,
 			  2, 3, CLASS_ROW, CLASS_ROW+1, GTK_FILL, 0, GNOME_PAD, GNOME_PAD);
 	
+  /* Toggle bold for bright colours */
+  
+  prefs->use_bold_checkbox = gtk_check_button_new_with_label (_("Embolden bright colours"));
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->use_bold_checkbox),
+                                cfg->use_bold ? 1 : 0);
+
+#ifdef ZVT_TERM_EMBOLDEN_SUPPORT
+  if (!(zvt_term_get_capabilities(term) & ZVT_TERM_EMBOLDEN_SUPPORT))
+#endif
+    gtk_widget_set_sensitive(prefs->use_bold_checkbox, FALSE);
+
+  gtk_signal_connect (GTK_OBJECT (prefs->use_bold_checkbox), "toggled",
+                      GTK_SIGNAL_FUNC (prop_changed), prefs);
+  gtk_table_attach(GTK_TABLE(table), prefs->use_bold_checkbox,
+                   2, 3, BOLDTOGGLE_ROW, BOLDTOGGLE_ROW+1, GTK_FILL, 0,
+                   GNOME_PAD, GNOME_PAD);
+
 	/* Blinking status */
 	prefs->blink_checkbox = gtk_check_button_new_with_label (_("Blinking cursor"));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->blink_checkbox),
@@ -2114,7 +2138,7 @@
 				  GTK_OBJECT(term));
 
 	zvt_term_set_scrollback (term, cfg->scrollback);
-	gnome_term_set_font (term, cfg->font);
+	gnome_term_set_font (term, cfg->font, cfg->use_bold);
 	zvt_term_set_wordclass  (term, (guchar *)cfg->wordclass);
 	zvt_term_set_bell  (term, !cfg->bell);
 	zvt_term_set_blink (term, cfg->blink);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]