[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xlog-discussion] Contest message forwarding
From: |
Jon Kåre Hellan |
Subject: |
Re: [Xlog-discussion] Contest message forwarding |
Date: |
Thu, 25 Dec 2008 13:49:06 +0100 |
User-agent: |
Thunderbird 2.0.0.18 (X11/20081125) |
OK, I'm attaching the patch in its current form. Choosing the initial
message is still on the todo list.
Joop Stakenborg wrote:
Op maandag 22-12-2008 om 15:19 uur [tijdzone +0100], schreef Jon K
Hellan:
Hi
There is a Norwegian contest where you forward the last message received.
Me: 599 ABC LA9XX: 599 XYZ
next QSO
Me: 599 XYZ LA1YY: 599 FOO
etc.
I implemented this in xlog. Is there any interest in including the patch?
Sure, it won't hurt including it and at least people in Norway can use
it.. ;-)
Details:
1. We need a way to invoke the functionality. Quite arbitrarily, I chose '~' in
the keyer and the defaults
dialog to stand for last message received. xlog already uses % for my call, @
for his call, etc. May be we want
something like $LASTMSG instead of grabbing a character for each new function.
~ is fine. It is not a morse character, so it should work.
2. We need to initialize the message for the first contest QSO. This could be
another preference field,
an init file preference without a GUI, or an environment variable.
I would suggest an entry in the preference dialog, but how to explain
what it is used for? Any suggestions for a text label next to the entry
that could describe it?
Or may be the functionality is too exotic to be of interest?
73
Jon LA4RT
Joop PG4I
Index: src/callbacks_mainwindow_menu.c
===================================================================
RCS file: /sources/xlog/xlog/src/callbacks_mainwindow_menu.c,v
retrieving revision 1.35
diff -u -r1.35 callbacks_mainwindow_menu.c
--- src/callbacks_mainwindow_menu.c 21 Dec 2008 09:17:13 -0000 1.35
+++ src/callbacks_mainwindow_menu.c 25 Dec 2008 12:35:47 -0000
@@ -238,7 +238,7 @@
*bandoptionmenu, *modeoptionmenu;
GtkTextBuffer *b;
guint c, bandenum, modeenum;
- gchar *countstr, *str;
+ gchar *countstr, *lastmsg, *str;
GtkWidget *mhzbutton, *modebutton, *rstbutton, *powerbutton;
datebutton = lookup_widget (mainwindow, "datebutton");
@@ -331,6 +331,14 @@
gtk_entry_set_text (GTK_ENTRY
(rstentry), str);
g_free (str);
}
+ else if (keyerwindow && g_strrstr
(preferences.defaulttxrst, "~"))
+ {
+ lastmsg = get_last_msg ();
+ str = my_strreplace
(preferences.defaulttxrst, "~", lastmsg);
+ g_free (lastmsg);
+ gtk_entry_set_text (GTK_ENTRY
(rstentry), str);
+ g_free (str);
+ }
else
gtk_entry_set_text (GTK_ENTRY
(rstentry), preferences.defaulttxrst);
}
Index: src/callbacks_mainwindow_qsoframe.c
===================================================================
RCS file: /sources/xlog/xlog/src/callbacks_mainwindow_qsoframe.c,v
retrieving revision 1.57
diff -u -r1.57 callbacks_mainwindow_qsoframe.c
--- src/callbacks_mainwindow_qsoframe.c 19 Dec 2008 19:44:42 -0000 1.57
+++ src/callbacks_mainwindow_qsoframe.c 25 Dec 2008 12:35:47 -0000
@@ -443,7 +443,7 @@
{
GtkWidget *rstentry, *count;
gint c;
- gchar *str, *countstr;
+ gchar *str, *countstr, *lastmsg;
rstentry = lookup_widget (mainwindow, "rstentry");
if (strlen (preferences.defaulttxrst) > 0)
@@ -463,6 +463,14 @@
gtk_entry_set_text (GTK_ENTRY (rstentry), str);
g_free (str);
}
+ else if (keyerwindow && g_strrstr (preferences.defaulttxrst,
"~"))
+ {
+ lastmsg = get_last_msg ();
+ str = my_strreplace (preferences.defaulttxrst, "~",
lastmsg);
+ g_free (lastmsg);
+ gtk_entry_set_text (GTK_ENTRY (rstentry), str);
+ g_free (str);
+ }
else
gtk_entry_set_text (GTK_ENTRY (rstentry),
preferences.defaulttxrst);
}
Index: src/gui_netkeyer.c
===================================================================
RCS file: /sources/xlog/xlog/src/gui_netkeyer.c,v
retrieving revision 1.37
diff -u -r1.37 gui_netkeyer.c
--- src/gui_netkeyer.c 22 Dec 2008 10:44:44 -0000 1.37
+++ src/gui_netkeyer.c 25 Dec 2008 12:35:47 -0000
@@ -95,7 +95,7 @@
void cw (GtkButton *button, gpointer user_data)
{
GtkWidget *entry, *callentry, *count;
- gchar *entryname, *sendstr, *call, *countstr;
+ gchar *entryname, *sendstr, *call, *countstr, *lastmsg;
gint i, result = 0;
entryname = g_strdup_printf("%sentry", (gchar *)user_data);
@@ -123,6 +123,15 @@
g_free (countstr);
sendstr = my_strreplace (sendstr, "%", preferences.callsign);
+
+ lastmsg = get_last_msg ();
+ if (strlen (lastmsg) > 0)
+ {
+ sendstr = my_strreplace (sendstr, "~", lastmsg);
+ g_free (lastmsg);
+ }
+ else
+ sendstr = my_strreplace (sendstr, "~", "?");
if (strlen (call) > 0)
{
sendstr = my_strreplace (sendstr, "@", call);
Index: src/gui_utils.c
===================================================================
RCS file: /sources/xlog/xlog/src/gui_utils.c,v
retrieving revision 1.20
diff -u -r1.20 gui_utils.c
--- src/gui_utils.c 16 May 2008 07:04:31 -0000 1.20
+++ src/gui_utils.c 25 Dec 2008 12:35:47 -0000
@@ -31,9 +31,9 @@
#include "xlog_enum.h"
extern GtkUIManager *ui_manager;
+extern GtkWidget *mainnotebook;
extern GList *logwindowlist;
extern preferencestype preferences;
-
/* configure "Tabs" menu */
void set_tabs_menu (void)
{
@@ -153,3 +153,33 @@
}
if (spl) g_strfreev (spl);
}
+
+/* TODO: Find last msg. use a default if none found
+ * from mainwindow -> page -> model ->
+ * gtk_list_store_get -> QSO
+ */
+gchar*
+get_last_msg (void)
+{
+ guint page;
+ logtype *logw;
+ GtkListStore *model;
+ GtkTreeIter iter;
+ gchar *rst, *suffix;
+ gchar *res = "ABC";
+
+ page = gtk_notebook_get_current_page (GTK_NOTEBOOK (mainnotebook));
+ logw = g_list_nth_data (logwindowlist, page);
+ model = GTK_LIST_STORE(gtk_tree_view_get_model
(GTK_TREE_VIEW(logw->treeview)));
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL(model), &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL(model), &iter, MYRST, &rst,
-1);
+ suffix = g_strrstr (rst, " ");
+ if (suffix) {
+ suffix++;
+ if (*suffix)
+ res = suffix;
+ }
+ }
+ return g_strdup (res);
+}
Index: src/gui_utils.h
===================================================================
RCS file: /sources/xlog/xlog/src/gui_utils.h,v
retrieving revision 1.13
diff -u -r1.13 gui_utils.h
--- src/gui_utils.h 16 May 2008 07:04:32 -0000 1.13
+++ src/gui_utils.h 25 Dec 2008 12:35:47 -0000
@@ -29,3 +29,4 @@
void set_font (gchar * font);
void activate_bandoption_by_enum (GtkWidget *combo, gchar *prefs, gint
bandenum);
void activate_modeoption_by_enum (GtkWidget *combo, gchar *prefs, gint
modeenum);
+gchar *get_last_msg (void);