changeset 1441:5c67b8794991

[gaim-migrate @ 1451] patch from decklin to have default font size. yum. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 29 Jan 2001 01:19:24 +0000
parents 6330d0bb309f
children 2f4e6269b001
files src/buddy_chat.c src/conversation.c src/gaim.h src/gaimrc.c src/prefs.c src/util.c
diffstat 6 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy_chat.c	Mon Jan 29 01:13:31 2001 +0000
+++ b/src/buddy_chat.c	Mon Jan 29 01:19:24 2001 +0000
@@ -811,6 +811,8 @@
 	b->log_dialog = NULL;
 	sprintf(b->fontface, "%s", fontface);
 	b->hasfont = 0;
+	b->fontsize = fontsize;
+	b->hassize = 0;
 	b->bgcol = bgcolor;
 	b->hasbg = 0;
 	b->fgcol = fgcolor;
--- a/src/conversation.c	Mon Jan 29 01:13:31 2001 +0000
+++ b/src/conversation.c	Mon Jan 29 01:19:24 2001 +0000
@@ -61,6 +61,7 @@
 GdkBitmap *dark_icon_bm = NULL;
 
 char fontface[64];
+int fontsize = 3;
 extern GdkColor bgcolor;
 extern GdkColor fgcolor;
 
@@ -638,6 +639,11 @@
 			strcpy(buf, buf2);
 		}
 
+		if ((font_options & OPT_FONT_SIZE) || c->hassize) {
+			g_snprintf(buf2, limit, "<FONT SIZE=\"%d\">%s</FONT>", c->fontsize, buf);
+			strcpy(buf, buf2);
+		}
+
 		if ((font_options & OPT_FONT_FGCOL) || c->hasfg) {
 			g_snprintf(buf2, limit, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", c->fgcol.red,
 				   c->fgcol.green, c->fgcol.blue, buf);
@@ -1689,6 +1695,8 @@
 	c->log_dialog = NULL;
 	sprintf(c->fontface, "%s", fontface);
 	c->hasfont = 0;
+	c->fontsize = fontsize;
+	c->hassize = 0;
 	c->bgcol = bgcolor;
 	c->hasbg = 0;
 	c->fgcol = fgcolor;
--- a/src/gaim.h	Mon Jan 29 01:13:31 2001 +0000
+++ b/src/gaim.h	Mon Jan 29 01:19:24 2001 +0000
@@ -321,6 +321,8 @@
 	int makesound;
 	char fontface[128];
 	int hasfont;
+	int fontsize;
+	int hassize;
 	GdkColor bgcol;
 	int hasbg;
 	GdkColor fgcol;
@@ -410,6 +412,7 @@
 
 /* Globals in dialog.c */
 extern char fontface[64];
+extern int fontsize;
 extern GdkColor bgcolor;
 extern GdkColor fgcolor;
 extern int smiley_array[FACE_TOTAL];
@@ -512,6 +515,7 @@
 #define OPT_FONT_FACE            0x00000020
 #define OPT_FONT_FGCOL           0x00000040
 #define OPT_FONT_BGCOL           0x00000080
+#define OPT_FONT_SIZE            0x00000100
 
 #define OPT_USR_AUTO		0x00000001
 #define OPT_USR_KEEPALV		0x00000002
--- a/src/gaimrc.c	Mon Jan 29 01:13:31 2001 +0000
+++ b/src/gaimrc.c	Mon Jan 29 01:19:24 2001 +0000
@@ -633,6 +633,8 @@
 		} else if (!strcmp(p->option, "font_face")) {
 			if (p->value[0] != NULL)
 				g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]);
+		} else if (!strcmp(p->option, "font_size")) {
+			fontsize = atoi(p->value[0]);
 		} else if (!strcmp(p->option, "foreground")) {
 			fgcolor.red = atoi(p->value[0]);
 			fgcolor.green = atoi(p->value[1]);
@@ -670,6 +672,7 @@
 	fprintf(f, "\tfont_options { %d }\n", font_options);
 	if (fontface)
 		fprintf(f, "\tfont_face { %s }\n", fontface);
+	fprintf(f, "\tfont_size { %d }\n", fontsize);
 	fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue);
 	fprintf(f, "\tbackground { %d } { %d } { %d }\n", bgcolor.red, bgcolor.green, bgcolor.blue);
 	fprintf(f, "\treport_idle { %d }\n", report_idle);
--- a/src/prefs.c	Mon Jan 29 01:13:31 2001 +0000
+++ b/src/prefs.c	Mon Jan 29 01:19:24 2001 +0000
@@ -803,6 +803,11 @@
 	gtk_style_unref(style);
 }
 
+static void set_font_size(GtkWidget *w, GtkWidget *spin)
+{
+	fontsize = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
+}
+
 static void font_page()
 {
 	GtkWidget *parent;
@@ -812,6 +817,8 @@
 	GtkWidget *hbox;
 	GtkWidget *button;
 	GtkWidget *select;
+	GtkWidget *spin;
+	GtkObject *adjust;
 
 	parent = prefdialog->parent;
 	gtk_widget_destroy(prefdialog);
@@ -892,6 +899,23 @@
 
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select);
 
+	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+	button = gaim_button(_("Font Size for Text"), &font_options, OPT_FONT_SIZE, hbox);
+
+	adjust = gtk_adjustment_new(fontsize, 1, 7, 1, 1, 1);
+	spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
+	gtk_widget_set_usize(spin, 50, -1);
+	if (!(font_options & OPT_FONT_SIZE))
+		gtk_widget_set_sensitive(GTK_WIDGET(spin), FALSE);
+	gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), spin);
+	gtk_signal_connect(GTK_OBJECT(adjust), "value-changed", GTK_SIGNAL_FUNC(set_font_size),
+			   GTK_WIDGET(spin));
+	gtk_widget_show(spin);
+
 	gtk_widget_show(prefdialog);
 }
 
--- a/src/util.c	Mon Jan 29 01:13:31 2001 +0000
+++ b/src/util.c	Mon Jan 29 01:19:24 2001 +0000
@@ -1050,6 +1050,11 @@
 		strcpy(buf, tmp);
 	}
 
+	if (font_options & OPT_FONT_SIZE) {
+		g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
+		strcpy(buf, tmp);
+	}
+
 	if (font_options & OPT_FONT_FGCOL) {
 		g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red,
 			   fgcolor.green, fgcolor.blue, buf);