Re: Customizing balsa (scrolling while selecting)




On 2001.11.03 11:47 Philip Van Hoof wrote:

Ehm .. this patch adds a vertical scrollbar 
(gtk_scrolled_window_new) to widgets which are 
created to view normal text (mimetext).

This way `my' problem with selecting text is solved. 
I don't know if this patch is "okay" for the official 
balsa release however..

So first check this because it `does` change some
default behaviour of balsa. (if you have a small
screen and an E-Mail with attachments which have 
long filenames.. the "item" widget -for displaying
mimetext- is to small).

Btw .. balsa maintainers

	part_info_init and
	part_info_init_mimetext and
	part_info_init_*

.. are horrible functions to read and
understand how they work :). (and some tabs
are wrong there.. not four spaces) :

Sample code from part_info_init_mimetext where
a space is replaced with _ and a tab is \t :

____if (ishtml) {
#ifdef HAVE_GTKHTML
\tpart_info_init_html(bm, info, ptr, alloced);
#else
\tpart_info_init_unknown(bm, info);
#endif
____} else {
\tregex_t rex;
\tGtkWidget *item = NULL;
\tGdkFont *fnt = NULL;
\tGList *url_list = NULL;

In my editor, the result is ugly :) (oh well..)


-- 
Philip van Hoof aka freax (http://www.freax.eu.org)
irc: irc.openprojects.net mailto:freax @ linux.be
--- balsa/src/balsa-message.c	Thu Oct 18 11:47:29 2001
+++ balsa-oddfreax/src/balsa-message.c	Sat Nov  3 16:58:46 2001
@@ -1819,11 +1819,12 @@
 	part_info_init_unknown(bm, info);
 #endif
     } else {
-	regex_t rex;
+    regex_t rex;
+    GtkWidget *scrolledwindow = NULL;
 	GtkWidget *item = NULL;
 	GdkFont *fnt = NULL;
 	GList *url_list = NULL;
-	
+
 	fnt = find_body_font(info->body);
 
     if (bm->wrap_text) {
@@ -1839,7 +1840,9 @@
 	if (!fnt)
 	    fnt = gdk_fontset_load(balsa_app.message_font);
 	
+
 	item = gtk_text_new(NULL, NULL);
+    scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
 	
 	/* get the widget's default font for those people who did not set up a 
 	   custom one */
@@ -1857,7 +1860,7 @@
 			   (gpointer) bm);
 	gtk_signal_connect(GTK_OBJECT(item), "size_request",
 			   (GtkSignalFunc)balsa_gtk_text_size_request,
-			   (gpointer) bm);
+			   (gpointer) bm);	   
 	
 	allocate_quote_colors(GTK_WIDGET(bm), balsa_app.quoted_color,
 			      0, MAX_QUOTED_COLOR - 1);
@@ -1894,7 +1897,7 @@
 	    g_strfreev(l);
 	    regfree(&rex);
 	}
-	
+
 	gtk_signal_connect_after(GTK_OBJECT(item), "realize",
 				 (GtkSignalFunc)fix_text_widget, url_list);
 	if (url_list) {
@@ -1911,16 +1914,31 @@
 	}
 
 	gtk_text_set_editable(GTK_TEXT(item), FALSE);
-	
+
+    gtk_widget_show(scrolledwindow);
 	gtk_widget_show(item);
+
+/* Ehm, Looks like this ain't nessesairy if you use that info->.. stuff
+    gtk_container_add (GTK_CONTAINER(bm->content), scrolledwindow); */
+	gtk_container_add (GTK_CONTAINER (scrolledwindow), item);
+/*	
 	info->focus_widget = item;
 	info->widget = item;
 	info->can_display = TRUE;
+	
+	Well.. item is now under scrolledwindow, so ..
+*/
+	info->focus_widget = scrolledwindow;
+	info->widget = scrolledwindow;
+	info->can_display = TRUE;
+
     }
     g_free(ptr);
     
     fclose(fp);
 }
+
+
 
 #ifdef HAVE_GTKHTML
 static void


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