Re: PATCH: Compose Coordinates *FINAL*



I've tested your patch (I'm still testing it in this compose window).
Everything seem's working.

One comment: I don't like so much to have all these info in one cell. I
would like it better if each info has a separate cell in the status bar. 

Christophe

PS: Ali I would apreciate if you can check my broken patch (xsysop) in my
last mail.

Le 2001.08.20 11:19:17 +0200, Ali Akcaagac a écrit :
> hi,
> 
> since christophe barbe mentioned some -Werror problems
> during compile, here is another reworked version. hope
> this solves all unbehaves (i hope).
> 
> you need a more or less recent CVS to use this patch.
> this patch is of its own and affects the file
> 
> src/sendmsg-window.c
> 
> please test, if there are still issues then please let
> me know (preferabely with 1-2 comments of howto solve)
> 
> thank you.
> 
> -- 
> Name....: Ali Akcaagac
> Status..: Student Of Computer & Economic Science
> E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
> WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
> 
> --- /mnt/private/temp/cvstree/balsa/src/sendmsg-window.c	Sun Aug
> 19 21:53:33 2001
> +++ balsa/src/sendmsg-window.c	Mon Aug 20 11:12:51 2001
> @@ -76,6 +76,8 @@
>  
>  #define GNOME_MIME_BUG_WORKAROUND 1
>  
> +GnomeAppBar *appbar2;
> +
>  static gchar *read_signature(BalsaSendmsg *msg);
>  static gint include_file_cb(GtkWidget *, BalsaSendmsg *);
>  static gint send_message_cb(GtkWidget *, BalsaSendmsg *);
> @@ -118,6 +120,8 @@
>  
>  static void sw_size_alloc_cb(GtkWidget * window, GtkAllocation * alloc);
>  
> +static gint balsa_key_press_event_cb(GtkWidget *widget, GdkEventKey
> *event, gpointer data);
> +
>  /* Standard DnD types */
>  enum {
>      TARGET_URI_LIST,
> @@ -1160,6 +1164,12 @@
>      GtkWidget *table;
>  
>      msg->text = gtk_text_new(NULL, NULL);
> +
> +    gtk_signal_connect_after(GTK_OBJECT(msg->text), "key_press_event",
> +			     GTK_SIGNAL_FUNC(balsa_key_press_event_cb),
> msg);
> +    gtk_signal_connect_after(GTK_OBJECT(msg->text), "map_event",
> +			     GTK_SIGNAL_FUNC(balsa_key_press_event_cb),
> msg);
> +
>      gtk_text_set_editable(GTK_TEXT(msg->text), TRUE);
>      gtk_text_set_word_wrap(GTK_TEXT(msg->text), TRUE);
>      balsa_spell_check_set_text(BALSA_SPELL_CHECK(msg->spell_checker),
> @@ -1176,6 +1186,97 @@
>      return table;
>  }
>  
> +static gint
> +balsa_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer
> data)
> +{
> +    gchar *message = NULL;
> +    gchar *symbol = NULL;
> +    gchar *statustext = NULL;
> +
> +    gint index = 0;
> +
> +    int lines = 1;
> +    int rows = 1;
> +    int words = 0;
> +    int size = 0;
> +    int x = 1;
> +    int y = 1;
> +
> +    int hexval = 0;
> +    int wordflag = 0;
> +
> +    /* initialize the power-ascii-table for chars < 0x20 */
> +    gchar *lowsymbols[] = {
> +	N_("Null"),			N_("Start of Heading"),
> +	N_("Start of Text"),		N_("End of Text"),
> +	N_("End of Transmission"),	N_("Enquiry"),
> +	N_("Acknowledge"),		N_("Bell"),
> +	N_("Backspace"),		N_("Horizontal Tabulation"),
> +	N_("Line Feed"),		N_("Vertical Tabulation"),
> +	N_("Form Feed"),		N_("Carriage Return"),
> +	N_("Shift Out"),		N_("Shift In"),
> +	N_("Data Link Escape"),		N_("Device Control 1"),
> +	N_("Device Control 2"),		N_("Device Control 3"),
> +	N_("Device Control 4"),		N_("Negative
> Acknowledge"),
> +	N_("Synchronous Idle"),		N_("End of Transmission
> Block"),
> +	N_("Cancel"),			N_("End of Medium"),
> +	N_("Substitute"),		N_("Escape"),
> +	N_("File Separator"),		N_("Group Separator"),
> +	N_("Record Separator"),		N_("Unit Separator")
> +    };
> +
> +    /* get the message body */
> +    message = gtk_editable_get_chars(GTK_EDITABLE(GTK_TEXT(((BalsaSendmsg
> *) data)->text)), 0, -1);
> +
> +    /* get the index of the cursor */
> +    index = gtk_editable_get_position(GTK_EDITABLE(GTK_TEXT(((BalsaSendmsg
> *) data)->text)));
> +
> +    /* lines: get the total lines of the message */
> +    /* words: get the total words of the message */
> +    /* size: get the total size of the message */
> +    /* x/y: get the x/y origin within the message */
> +    while (message[size] != '\0') {
> +	if (message[size] == '\n') {
> +	    lines++;
> +	    rows = 1;
> +	} else {
> +	    rows++;
> +	}
> +
> +	if (message[size] == '\n' || message[size] == '\t'||
> message[size] == ' ') {
> +	    wordflag = 0;
> +	} else if (wordflag == 0) {
> +	    wordflag = 1;
> +	    words++;
> +	}
> +
> +	if (size < (int)index) {
> +	    x = rows;
> +	    y = lines;
> +	}
> +
> +	size++;
> +    }
> +
> +    /* get the symbol within the text and the hexval */
> +    hexval = message[(int)index];
> +    symbol = g_strdup_printf("%c", hexval);
> +
> +    if (hexval <= 0x1f && hexval >= 0x00) {
> +	g_free(symbol);
> +	symbol = lowsymbols[hexval];
> +    }
> +
> +    /* output the stuff to the appbar */
> +    statustext = g_strdup_printf(_("Size: %d bytes, Lines: %d, Words:
> %d, Index: %d, X: %d, Y: %d, Char: 0x%x => '%s'."), size, lines, words,
> (int)index, x, y, hexval, symbol);
> +    gnome_appbar_set_default(appbar2, statustext);
> +
> +    g_free(message);
> +    g_free(statustext);
> +
> +    return TRUE;
> +}
> +
>  /* continueBody ---------------------------------------------------------
>     a short-circuit procedure for the 'Continue action'
>     basically copies the text over to the entry field.
> @@ -1523,6 +1624,10 @@
>      /* create text area for the message */
>      gtk_paned_add2(GTK_PANED(paned), create_text_area(msg));
>  
> +    /* FIXME: create statusbar, this is only temporarely and needs fix
> */
> +    appbar2 = GNOME_APPBAR(gnome_appbar_new(TRUE, TRUE,
> GNOME_PREFERENCES_USER));
> +    gnome_app_set_statusbar(GNOME_APP(window), GTK_WIDGET(appbar2));
> +
>      /* fill in that info: */
>  
>      /* To: */
> 
-- 
Christophe Barbé <christophe.barbe@online.fr>
GnuPG FingerPrint: E0F6 FADF 2A5C F072 6AF8  F67A 8F45 2F1E D72C B41E




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