Thread: [Gpredict-svn] SF.net SVN: gpredict:[62] trunk/src/sat-pref-rig-editor.c
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <cs...@us...> - 2008-08-22 09:34:48
|
Revision: 62 http://gpredict.svn.sourceforge.net/gpredict/?rev=62&view=rev Author: csete Date: 2008-08-22 09:34:58 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Removed unnecessary data fields. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2008-08-22 09:27:01 UTC (rev 61) +++ trunk/src/sat-pref-rig-editor.c 2008-08-22 09:34:58 UTC (rev 62) @@ -51,14 +51,8 @@ /* private widgets */ static GtkWidget *dialog; /* dialog window */ -static GtkWidget *name; /* Configuration name */ -static GtkWidget *model; /* radio model, e.g. TS-2000 */ -static GtkWidget *civ; /* Icom CI-V address */ -static GtkWidget *ext; /* Built-in extensions */ -static GtkWidget *type; /* radio type */ -static GtkWidget *port; /* port selector */ -static GtkWidget *speed; /* serial speed selector */ -static GtkWidget *dtr,*rts; /* DTR and RTS line states */ +static GtkWidget *name; /* config name */ +static GtkWidget *host; /* host */ static GtkWidget *create_editor_widgets (radio_conf_t *conf); @@ -66,16 +60,6 @@ static void clear_widgets (void); static gboolean apply_changes (radio_conf_t *conf); static void name_changed (GtkWidget *widget, gpointer data); -static GtkTreeModel *create_rig_model (void); -static gint rig_list_add (const struct rig_caps *, void *); -static gint rig_list_compare_mfg (gconstpointer, gconstpointer); -static gint rig_list_compare_mod (gconstpointer, gconstpointer); -static void is_rig_model (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gpointer data); -static void select_rig (guint rigid); /** \brief Add or edit a radio configuration. @@ -152,21 +136,18 @@ { GtkWidget *table; GtkWidget *label; - GtkTreeModel *riglist; - GtkCellRenderer *renderer; - gchar *buff; - guint i; - table = gtk_table_new (5, 5, FALSE); + + table = gtk_table_new (2, 4, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); gtk_table_set_row_spacings (GTK_TABLE (table), 5); /* Config name */ label = gtk_label_new (_("Name")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 4, 0, 1); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); name = gtk_entry_new (); gtk_entry_set_max_length (GTK_ENTRY (name), 25); @@ -180,150 +161,17 @@ */ g_signal_connect (name, "changed", G_CALLBACK (name_changed), NULL); - /* Model */ - label = gtk_label_new (_("Model")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + /* Host */ + label = gtk_label_new (_("Host")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); -/* riglist = create_rig_model (); - model = gtk_combo_box_new_with_model (riglist); - g_object_unref (riglist); - gtk_table_attach_defaults (GTK_TABLE (table), model, 1, 2, 1, 2); - - renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (model), renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (model), renderer, - "text", 0, - NULL); - gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (model), - renderer, - is_rig_model, - NULL, NULL); - gtk_widget_set_tooltip_text (model, _("Click to select a radio.")); - select_rig (1); - */ - /* ICOM CI-V adress */ - label = gtk_label_new (_("ICOM CI-V")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 1, 2); - -#if 0 - civ = gtk_combo_box_new_text (); - gtk_widget_set_tooltip_text (civ, - _("Select ICOM CI-V address of the radio.")); - - /* works, but pretty lame... */ - gtk_combo_box_append_text (GTK_COMBO_BOX (civ), _("Default")); - for (i = 1; i < 0xF0; i++) { - if (i < 0x10) - buff = g_strdup_printf ("0x0%X", i); - else - buff = g_strdup_printf ("0x%X", i); - gtk_combo_box_append_text (GTK_COMBO_BOX (civ), buff); - g_free (buff); - } - gtk_combo_box_set_active (GTK_COMBO_BOX (civ), 0); - gtk_table_attach_defaults (GTK_TABLE (table), civ, 4, 5, 1, 2); -#endif + host = gtk_entry_new (); + gtk_entry_set_max_length (GTK_ENTRY (host), 50); + gtk_widget_set_tooltip_text (host, _("Enter host:port")); + gtk_table_attach_defaults (GTK_TABLE (table), host, 1, 4, 1, 2); - /* Type */ - label = gtk_label_new (_("Type")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); -/* type = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Receiver")); - gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Transmitter")); - gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("RX + TX")); - gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Full Duplex")); - gtk_combo_box_set_active (GTK_COMBO_BOX (type), 0); - gtk_widget_set_tooltip_text (type, - _("Select radio type. Consult the user manual, if unsure")); - gtk_table_attach_defaults (GTK_TABLE (table), type, 1, 2, 2, 3); -*/ - /* Enable built-in extensions */ -/* ext = gtk_check_button_new_with_label (_("Extended CAT")); - gtk_widget_set_tooltip_text (ext, - _("Enable built-in gpredict CAT extensions if they are "\ - "available. This allows the use of commands that are "\ - "not supported by hamlib, but are necessary for full "\ - "duplex operation with IC-910, FT-847, etc.")); - gtk_table_attach_defaults (GTK_TABLE (table), ext, 3, 5, 2, 3); - */ - - /* Port */ - label = gtk_label_new (_("Port")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); - -/* port = gtk_combo_box_entry_new_text (); - if (conf->port != NULL) { - gtk_combo_box_append_text (GTK_COMBO_BOX (port), conf->port); - } - gtk_combo_box_append_text (GTK_COMBO_BOX (port), "/dev/ttyS0"); - gtk_combo_box_append_text (GTK_COMBO_BOX (port), "/dev/ttyS1"); - gtk_combo_box_append_text (GTK_COMBO_BOX (port), "/dev/ttyS2"); - gtk_combo_box_append_text (GTK_COMBO_BOX (port), "/dev/ttyUSB0"); - gtk_combo_box_append_text (GTK_COMBO_BOX (port), "/dev/ttyUSB1"); - gtk_combo_box_append_text (GTK_COMBO_BOX (port), "/dev/ttyUSB2"); - gtk_combo_box_set_active (GTK_COMBO_BOX (port), 0); - gtk_widget_set_tooltip_text (port, _("Select or enter communication port")); - gtk_table_attach_defaults (GTK_TABLE (table), port, 1, 2, 3, 4); -*/ - - /* DTR State */ - label = gtk_label_new (_("DTR Line")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 3, 4); - -/* dtr = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (dtr), _("Undefined")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dtr), _("OFF")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dtr), _("ON")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dtr), _("PTT")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dtr), _("CW")); - gtk_combo_box_set_active (GTK_COMBO_BOX (dtr), 0); - gtk_widget_set_tooltip_text (dtr, _("Select status and use of DTR line")); - gtk_table_attach_defaults (GTK_TABLE (table), dtr, 4, 5, 3, 4); - */ - - /* Speed */ - label = gtk_label_new (_("Rate")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5); -/* speed = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "300"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "1200"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "2400"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "4800"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "9600"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "19200"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "38400"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "57600"); - gtk_combo_box_append_text (GTK_COMBO_BOX (speed), "115200"); - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 4); - gtk_widget_set_tooltip_text (speed, _("Select serial port speed")); - gtk_table_attach_defaults (GTK_TABLE (table), speed, 1, 2, 4, 5); -*/ - /* RTS State */ - label = gtk_label_new (_("RTS Line")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 4, 5); - -/* rts = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (rts), _("Undefined")); - gtk_combo_box_append_text (GTK_COMBO_BOX (rts), _("OFF")); - gtk_combo_box_append_text (GTK_COMBO_BOX (rts), _("ON")); - gtk_combo_box_append_text (GTK_COMBO_BOX (rts), _("PTT")); - gtk_combo_box_append_text (GTK_COMBO_BOX (rts), _("CW")); - gtk_combo_box_set_active (GTK_COMBO_BOX (rts), 0); - gtk_widget_set_tooltip_text (rts, _("Select status and use of RTS line")); - gtk_table_attach_defaults (GTK_TABLE (table), rts, 4, 5, 4, 5); -*/ - /* separator between port/speed and DTR/RTS */ - gtk_table_attach (GTK_TABLE (table), gtk_vseparator_new(), 2, 3, 1, 5, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 0); - if (conf->name != NULL) update_widgets (conf); @@ -342,61 +190,10 @@ /* configuration name */ gtk_entry_set_text (GTK_ENTRY (name), conf->name); -#if 0 - /* model */ - select_rig (conf->id); - - /* type */ - gtk_combo_box_set_active (GTK_COMBO_BOX (type), conf->type); - - /* port */ - gtk_combo_box_prepend_text (GTK_COMBO_BOX (port), conf->port); - gtk_combo_box_set_active (GTK_COMBO_BOX (port), 0); + /* host name and port */ + if (conf->host) + gtk_entry_set_text (GTK_ENTRY (host), conf->host); - /*serial speed */ - switch (conf->speed) { - case 300: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 0); - break; - case 1200: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 1); - break; - case 2400: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 2); - break; - case 4800: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 3); - break; - case 9600: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 4); - break; - case 19200: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 5); - break; - case 38400: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 6); - break; - case 57600: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 7); - break; - case 115200: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 8); - break; - default: - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 4); - break; - } - - /* CI-V */ - gtk_combo_box_set_active (GTK_COMBO_BOX (civ), conf->civ); - - /* Extension */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ext), conf->ext); - - /* DTR and RTS lines */ - gtk_combo_box_set_active (GTK_COMBO_BOX (dtr), conf->dtr); - gtk_combo_box_set_active (GTK_COMBO_BOX (rts), conf->rts); -#endif } @@ -410,14 +207,8 @@ clear_widgets () { gtk_entry_set_text (GTK_ENTRY (name), ""); -/* select_rig (1); - gtk_combo_box_set_active (GTK_COMBO_BOX (type), 0); - gtk_combo_box_set_active (GTK_COMBO_BOX (port), 0); - gtk_combo_box_set_active (GTK_COMBO_BOX (speed), 4); - gtk_combo_box_set_active (GTK_COMBO_BOX (civ), 0); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ext), FALSE); - gtk_combo_box_set_active (GTK_COMBO_BOX (dtr), 0); - gtk_combo_box_set_active (GTK_COMBO_BOX (rts), 0);*/ + gtk_entry_set_text (GTK_ENTRY (host), ""); + } @@ -429,92 +220,21 @@ static gboolean apply_changes (radio_conf_t *conf) { - GtkTreeIter iter1,iter2; - GtkTreeModel *riglist; - gchar *b1,*b2; - guint id; + - /* name */ if (conf->name) g_free (conf->name); conf->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (name))); -#if 0 - /* model */ - if (conf->model) - g_free (conf->model); + /* host */ + if (conf->host) + g_free (conf->host); - /* iter1 is needed to construct full model name */ - gtk_combo_box_get_active_iter (GTK_COMBO_BOX (model), &iter2); - riglist = gtk_combo_box_get_model (GTK_COMBO_BOX (model)); - gtk_tree_model_iter_parent (riglist, &iter1, &iter2); - - /* build model string */ - gtk_tree_model_get (riglist, &iter1, 0, &b1, -1); - gtk_tree_model_get (riglist, &iter2, 0, &b2, -1); - conf->model = g_strconcat (b1, " ", b2, NULL); - g_free (b1); - g_free (b2); - - /* ID */ - gtk_tree_model_get (riglist, &iter2, 1, &id, -1); - conf->id = id; + conf->host = g_strdup (gtk_entry_get_text (GTK_ENTRY (host))); - /* radio type */ - conf->type = gtk_combo_box_get_active (GTK_COMBO_BOX (type)); - - /* port / device */ - if (conf->port) - g_free (conf->port); - - conf->port = gtk_combo_box_get_active_text (GTK_COMBO_BOX (port)); - /* CI-V */ - conf->civ = gtk_combo_box_get_active (GTK_COMBO_BOX (civ)); - - /* Extensions */ - conf->ext = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ext)); - - /* serial speed */ - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (speed))) { - case 0: - conf->speed = 300; - break; - case 1: - conf->speed = 1200; - break; - case 2: - conf->speed = 2400; - break; - case 3: - conf->speed = 4800; - break; - case 4: - conf->speed = 9600; - break; - case 5: - conf->speed = 19200; - break; - case 6: - conf->speed = 38400; - break; - case 7: - conf->speed = 57600; - break; - case 8: - conf->speed = 115200; - break; - default: - conf->speed = 9600; - break; - } - - /* DTR and RTS */ - conf->dtr = gtk_combo_box_get_active (GTK_COMBO_BOX (dtr)); - conf->rts = gtk_combo_box_get_active (GTK_COMBO_BOX (rts)); -#endif return TRUE; } @@ -577,271 +297,4 @@ } } -#if 0 -/** \brief Radio info to be used when building the rig model */ -typedef struct { - gint id; /*!< Model ID. */ - gchar *mfg; /*!< Manufacurer name (eg. KENWOOD). */ - gchar *model; /*!< Radio model (eg. TS-440). */ -} rig_info_t; - -/** \brief Build tree model containing radios. - * \return A tree model where the radios are ordered according to - * manufacturer. - * - */ -static GtkTreeModel *create_rig_model () -{ - GArray *array; - rig_info_t *info; - GtkTreeIter iter1; /* iter used for manufacturer */ - GtkTreeIter iter2; /* iter used for model */ - GtkTreeStore *store; - gchar *buff; - gint status; - gint i; - - - /* create araay containing rigs */ - array = g_array_new (FALSE, FALSE, sizeof (rig_info_t)); - rig_load_all_backends(); - - /* fill list using rig_list_foreach */ - status = rig_list_foreach (rig_list_add, (void *) array); - - /* sort the array, first by model then by mfg */ - g_array_sort (array, rig_list_compare_mod); - g_array_sort (array, rig_list_compare_mfg); - - sat_log_log (SAT_LOG_LEVEL_DEBUG, - _("%s:%d: Read %d distinct radios into array."), - __FILE__, __LINE__, array->len); - - /* create a tree store with two cols (name and ID) */ - store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT); - - /* add array contents to treestore */ - for (i = 0; i < array->len; i++) { - - /* get rig info struct */ - info = &g_array_index (array, rig_info_t, i); - - if (gtk_tree_store_iter_is_valid (store, &iter1)) { - /* iter1 is valid, i.e. we already have a manufacturer */ - gtk_tree_model_get (GTK_TREE_MODEL (store), &iter1, - 0, &buff, - -1); - if (g_ascii_strcasecmp (buff, info->mfg)) { - /* mfg different, add new mfg */ - gtk_tree_store_append (store, &iter1, NULL); - gtk_tree_store_set (store, &iter1, 0, info->mfg, -1); - } - /* else: mfg are identical; nothing to do */ - } - else { - /* iter1 is not valid, so add the first manufacturer */ - gtk_tree_store_append (store, &iter1, NULL); - gtk_tree_store_set (store, &iter1, 0, info->mfg, -1); - } - - /* iter1 points to the parent mfg; insert this rig */ - gtk_tree_store_append (store, &iter2, &iter1); - gtk_tree_store_set (store, &iter2, - 0, info->model, - 1, info->id, - -1); - - /* done with this model */ - g_free (info->mfg); - g_free (info->model); - } - - g_array_free (array,TRUE); - - return GTK_TREE_MODEL (store); -} - - -/** \brief Add new entry to list of radios. - * \param caps Structure with the capablities of thecurrent radio. - * \param array Pointer to the GArray into which the new entry should be - * stored. - * \return Always 1 to keep rig_list_foreach running. - * - * This function is called by the rig_list_foreach hamlib function for each - * supported radio. It copies the relevant data into a grig_rig_info_t - * structure and adds the new entry to the GArray containing the list of - * supported radios. - * - * \sa rig_list_compare - */ -static gint -rig_list_add (const struct rig_caps *caps, void *array) -{ - rig_info_t *info; - - /* create new entry */ - info = g_malloc (sizeof (rig_info_t)); - - /* fill values */ - info->id = caps->rig_model; - info->mfg = g_strdup (caps->mfg_name); - info->model = g_strdup (caps->model_name); - - /* append new element to array */ - array = (void *) g_array_append_vals ((GArray *) array, info, 1); - - /* keep on running */ - return 1; -} - - - -/** \brief Compare two rig info entries. - * \param a Pointer to the first entry. - * \param b Pointer to the second entry. - * \return Negative value if a < b; zero if a = b; positive value if a > b. - * - * This function is used to compare two rig entries in the list of radios - * when the list is sorted. It compares the manufacturer of the two radios. - * - * \sa rig_list_add - */ -static gint -rig_list_compare_mfg (gconstpointer a, gconstpointer b) -{ - gchar *ida, *idb; - - ida = ((rig_info_t *) a)->mfg; - idb = ((rig_info_t *) b)->mfg; - - if (g_ascii_strcasecmp(ida,idb) < 0) { - return -1; - } - else if (g_ascii_strcasecmp(ida,idb) > 0) { - return 1; - } - else { - return 0; - } - -} - - - -/** \brief Compare two rig info entries. - * \param a Pointer to the first entry. - * \param b Pointer to the second entry. - * \return Negative value if a < b; zero if a = b; positive value if a > b. - * - * This function is used to compare two rig entries in the list of radios - * when the list is sorted. It compares the model of the two radios. - * - * \sa rig_list_add - */ -static gint -rig_list_compare_mod (gconstpointer a, gconstpointer b) -{ - gchar *ida, *idb; - - ida = ((rig_info_t *) a)->model; - idb = ((rig_info_t *) b)->model; - - if (g_ascii_strcasecmp(ida,idb) < 0) { - return -1; - } - else if (g_ascii_strcasecmp(ida,idb) > 0) { - return 1; - } - else { - return 0; - } - -} - - -/** \brief Set cell sensitivity. - * - * This function is used to disable the sensitive of manifacturer entries - * as children. Otherwise, the manufacturer would appear as the first entry - * in a submenu. - * */ -static void -is_rig_model (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gpointer data) -{ - gboolean sensitive; - - sensitive = !gtk_tree_model_iter_has_child (tree_model, iter); - - g_object_set (cell, "sensitive", sensitive, NULL); -} - - -/** \brief Select a radio in the combo box. - * \param rigid The hamlib id of the radio. - * - * This function selects the specified radio in the combobox. This is done - * by looping over all items in the tree model until a match is reached - * (or there are no more items left). - */ -static void -select_rig (guint rigid) -{ - GtkTreeIter iter1,iter2; - GtkTreeModel *riglist; - guint i,j,n,m; - guint thisrig = 0; - - - /* get the tree model */ - riglist = gtk_combo_box_get_model (GTK_COMBO_BOX (model)); - - /* get the number of toplevel nodes */ - n = gtk_tree_model_iter_n_children (riglist, NULL); - for (i = 0; i < n; i++) { - - /* get the i'th toplevel node */ - if (gtk_tree_model_iter_nth_child (riglist, &iter1, NULL, i)) { - - /* get the number of children */ - m = gtk_tree_model_iter_n_children (riglist, &iter1); - for (j = 0; j < m; j++) { - - /* get the j'th child */ - if (gtk_tree_model_iter_nth_child (riglist, &iter2, &iter1, j)) { - - /* get ID of this model */ - gtk_tree_model_get (riglist, &iter2, 1, &thisrig, -1); - - if (thisrig == rigid) { - /* select this rig and terminate loop */ - gtk_combo_box_set_active_iter (GTK_COMBO_BOX (model), &iter2); - j = m; - i = n; - } - } - else { - sat_log_log (SAT_LOG_LEVEL_BUG, - _("%s:%s: NULL child node at index %d:%d"), - __FILE__, __FUNCTION__, i, j); - - } - } - - } - else { - sat_log_log (SAT_LOG_LEVEL_BUG, - _("%s:%s: NULL toplevel node at index %d"), - __FILE__, __FUNCTION__, i); - } - } - - -} - -#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2008-09-06 14:34:07
|
Revision: 91 http://gpredict.svn.sourceforge.net/gpredict/?rev=91&view=rev Author: csete Date: 2008-09-06 14:34:18 +0000 (Sat, 06 Sep 2008) Log Message: ----------- Be slightly less ambitious with frequency converage. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2008-09-06 13:31:47 UTC (rev 90) +++ trunk/src/sat-pref-rig-editor.c 2008-09-06 14:34:18 UTC (rev 91) @@ -191,7 +191,7 @@ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); - lo = gtk_spin_button_new_with_range (-40000, 40000, 1); + lo = gtk_spin_button_new_with_range (-10000, 10000, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (lo), 0); gtk_spin_button_set_digits (GTK_SPIN_BUTTON (lo), 0); gtk_widget_set_tooltip_text (lo, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2010-07-11 11:55:02
|
Revision: 635 http://gpredict.svn.sourceforge.net/gpredict/?rev=635&view=rev Author: csete Date: 2010-07-11 11:54:55 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Better logic for PTT selection Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2010-07-11 11:52:10 UTC (rev 634) +++ trunk/src/sat-pref-rig-editor.c 2010-07-11 11:54:55 UTC (rev 635) @@ -533,14 +533,17 @@ type_changed (GtkWidget *widget, gpointer data) { /* PTT consistency */ - if ((gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_TRX) || - (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_TOGGLE_AUTO) || - (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_TOGGLE_MAN)) - { + if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_TRX) { if (gtk_combo_box_get_active (GTK_COMBO_BOX (ptt)) == PTT_TYPE_NONE) { gtk_combo_box_set_active (GTK_COMBO_BOX (ptt), PTT_TYPE_CAT); } } + + if ((gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_TOGGLE_AUTO) || + (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_TOGGLE_MAN)) { + gtk_combo_box_set_active (GTK_COMBO_BOX (ptt), PTT_TYPE_CAT); + } + /* VFO consistency */ if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_DUPLEX) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2008-12-27 22:06:26
|
Revision: 179 http://gpredict.svn.sourceforge.net/gpredict/?rev=179&view=rev Author: csete Date: 2008-12-27 21:43:37 +0000 (Sat, 27 Dec 2008) Log Message: ----------- Fixed small typo. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2008-12-27 19:56:34 UTC (rev 178) +++ trunk/src/sat-pref-rig-editor.c 2008-12-27 21:43:37 UTC (rev 179) @@ -171,8 +171,9 @@ host = gtk_entry_new (); gtk_entry_set_max_length (GTK_ENTRY (host), 50); gtk_widget_set_tooltip_text (host, - _("Enter the host where rogctld is running. You can use both host name "\ - " and IP address, e.g. 192.168.1.100")); + _("Enter the host where rigctld is running. "\ + "You can use both host name and IP address, "\ + "e.g. 192.168.1.100")); gtk_table_attach_defaults (GTK_TABLE (table), host, 1, 4, 1, 2); /* port */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2008-12-28 11:06:57
|
Revision: 181 http://gpredict.svn.sourceforge.net/gpredict/?rev=181&view=rev Author: csete Date: 2008-12-28 11:06:54 +0000 (Sun, 28 Dec 2008) Log Message: ----------- Added widget for editing radio type and ptt. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2008-12-27 23:57:42 UTC (rev 180) +++ trunk/src/sat-pref-rig-editor.c 2008-12-28 11:06:54 UTC (rev 181) @@ -54,6 +54,8 @@ static GtkWidget *name; /* config name */ static GtkWidget *host; /* host */ static GtkWidget *port; /* port number */ +static GtkWidget *type; /* rig type */ +static GtkWidget *ptt; /* PTT */ static GtkWidget *lo; /* local oscillator */ @@ -62,6 +64,7 @@ static void clear_widgets (void); static gboolean apply_changes (radio_conf_t *conf); static void name_changed (GtkWidget *widget, gpointer data); +static void type_changed (GtkWidget *widget, gpointer data); /** \brief Add or edit a radio configuration. @@ -141,7 +144,7 @@ - table = gtk_table_new (4, 4, FALSE); + table = gtk_table_new (6, 4, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); gtk_table_set_row_spacings (GTK_TABLE (table), 5); @@ -188,21 +191,62 @@ _("Enter the port number where rigctld is listening")); gtk_table_attach_defaults (GTK_TABLE (table), port, 1, 3, 2, 3); + /* radio type */ + label = gtk_label_new (_("Type")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); + + type = gtk_combo_box_new_text (); + gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("RX only")); + gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("TX only")); + gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("RX/TX")); + gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Duplex")); + gtk_combo_box_set_active (GTK_COMBO_BOX (type), RIG_TYPE_RX); + g_signal_connect (type, "changed", G_CALLBACK (type_changed), NULL); + gtk_widget_set_tooltip_markup (type, + _("<b>RX only:</b> The radio shall only be used as receiver. "\ + "If <i>Monitor PTT status</i> is checked the doppler tuning "\ + "will be suspended while PTT is ON (manual TX). "\ + "If not, the controller will always perform doppler tuning and "\ + "you cannot use the same RIG for uplink.\n"\ + "<b>TX only:</b> The radio shall only be used for uplink. "\ + "If <i>Monitor PTT status</i> is checked the doppler tuning "\ + "will be suspended while PTT is OFF (manual RX).\n"\ + "<b>RX/TX:</b> The radio should be used for both up- and downlink "\ + "but in simplex mode only. This option requires that the PTT status "\ + "is monitored (otherwise gpredict cannot know whether to tune the "\ + "RX or the TX).\n"\ + "<b>Duplex:</b> The radio is a full duplex radio, such as the IC910H. "\ + "Gpredict will be continuously tuning both uplink and downlink "\ + "simultaneously and not care about PTT setting.")); + gtk_table_attach_defaults (GTK_TABLE (table), type, 1, 3, 3, 4); + + /* ptt */ + ptt = gtk_check_button_new_with_label (_("Monitor PTT status")); + gtk_widget_set_tooltip_text (ptt, + _("If checked, the radio controller will monitor the status of"\ + " the PTT and act accordingly. For example, the doppler tuning "\ + "on an RX only radio will be suspended while PTT is active. This"\ + " functionality is also required for radios that are used as both"\ + " TX and RX (simplex)")); + gtk_table_attach_defaults (GTK_TABLE (table), ptt, 1, 4, 4, 5); + + /* LO frequency */ label = gtk_label_new (_("LO")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6); lo = gtk_spin_button_new_with_range (-10000, 10000, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (lo), 0); gtk_spin_button_set_digits (GTK_SPIN_BUTTON (lo), 0); gtk_widget_set_tooltip_text (lo, _("Enter the frequency of the local oscillator, if any.")); - gtk_table_attach_defaults (GTK_TABLE (table), lo, 1, 3, 3, 4); + gtk_table_attach_defaults (GTK_TABLE (table), lo, 1, 3, 5, 6); label = gtk_label_new (_("MHz")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 3, 4); + gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 5, 6); if (conf->name != NULL) update_widgets (conf); @@ -232,6 +276,40 @@ else gtk_spin_button_set_value (GTK_SPIN_BUTTON (port), 4532); /* hamlib default? */ + /* ptt */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt), conf->ptt); + + /* rig type */ + switch (conf->type) { + case RIG_TYPE_RX: + gtk_combo_box_set_active (GTK_COMBO_BOX (type), conf->type); + gtk_widget_set_sensitive (ptt, TRUE); + break; + + case RIG_TYPE_TX: + gtk_combo_box_set_active (GTK_COMBO_BOX (type), conf->type); + gtk_widget_set_sensitive (ptt, TRUE); + break; + + case RIG_TYPE_TRX: + gtk_combo_box_set_active (GTK_COMBO_BOX (type), conf->type); + /* force ptt to TRUE */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt), TRUE); + gtk_widget_set_sensitive (ptt, FALSE); + break; + + case RIG_TYPE_DUPLEX: + gtk_combo_box_set_active (GTK_COMBO_BOX (type), conf->type); + gtk_widget_set_sensitive (ptt, FALSE); + break; + + default: + gtk_combo_box_set_active (GTK_COMBO_BOX (type), RIG_TYPE_RX); + gtk_widget_set_sensitive (ptt, TRUE); + break; + } + + /* lo in MHz */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (lo), conf->lo / 1000000.0); } @@ -244,12 +322,14 @@ * */ static void -clear_widgets () +clear_widgets () { gtk_entry_set_text (GTK_ENTRY (name), ""); gtk_entry_set_text (GTK_ENTRY (host), ""); gtk_spin_button_set_value (GTK_SPIN_BUTTON (port), 4532); /* hamlib default? */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (lo), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (type), RIG_TYPE_RX); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt), FALSE); } @@ -281,6 +361,12 @@ /* lo freq */ conf->lo = 1000000.0*gtk_spin_button_get_value (GTK_SPIN_BUTTON (lo)); + /* rig type */ + conf->type = gtk_combo_box_get_active (GTK_COMBO_BOX (type)); + + /* ptt */ + conf->ptt = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ptt)); + return TRUE; } @@ -344,3 +430,36 @@ } +/** \brief Manage type changed signals. + * \param widget The GtkComboBox that received the signal. + * \param data User data (always NULL). + * + * This function is called when the user selects a new radio type. + */ +static void +type_changed (GtkWidget *widget, gpointer data) +{ + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (widget))) { + case RIG_TYPE_RX: + gtk_widget_set_sensitive (ptt, TRUE); + break; + + case RIG_TYPE_TX: + gtk_widget_set_sensitive (ptt, TRUE); + break; + + case RIG_TYPE_TRX: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt), TRUE); + gtk_widget_set_sensitive (ptt, FALSE); + break; + + case RIG_TYPE_DUPLEX: + gtk_widget_set_sensitive (ptt, FALSE); + break; + + default: + gtk_widget_set_sensitive (ptt, TRUE); + break; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2008-12-28 13:14:50
|
Revision: 183 http://gpredict.svn.sourceforge.net/gpredict/?rev=183&view=rev Author: csete Date: 2008-12-28 13:14:46 +0000 (Sun, 28 Dec 2008) Log Message: ----------- Force PTT to FALSE for full duplex rigs. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2008-12-28 11:08:48 UTC (rev 182) +++ trunk/src/sat-pref-rig-editor.c 2008-12-28 13:14:46 UTC (rev 183) @@ -454,6 +454,7 @@ break; case RIG_TYPE_DUPLEX: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt), FALSE); gtk_widget_set_sensitive (ptt, FALSE); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-03-21 10:08:45
|
Revision: 206 http://gpredict.svn.sourceforge.net/gpredict/?rev=206&view=rev Author: csete Date: 2009-03-21 10:08:44 +0000 (Sat, 21 Mar 2009) Log Message: ----------- Changed radio typoe labels. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2009-03-21 10:06:23 UTC (rev 205) +++ trunk/src/sat-pref-rig-editor.c 2009-03-21 10:08:44 UTC (rev 206) @@ -199,8 +199,8 @@ type = gtk_combo_box_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("RX only")); gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("TX only")); - gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("RX/TX")); - gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Duplex")); + gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Simplex TRX")); + gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Duplex TRX")); gtk_combo_box_set_active (GTK_COMBO_BOX (type), RIG_TYPE_RX); g_signal_connect (type, "changed", G_CALLBACK (type_changed), NULL); gtk_widget_set_tooltip_markup (type, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-12 23:52:31
|
Revision: 263 http://gpredict.svn.sourceforge.net/gpredict/?rev=263&view=rev Author: csete Date: 2009-04-12 23:52:30 +0000 (Sun, 12 Apr 2009) Log Message: ----------- Fixed a bug that was introduced while adding the new PTT config. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2009-04-12 23:45:43 UTC (rev 262) +++ trunk/src/sat-pref-rig-editor.c 2009-04-12 23:52:30 UTC (rev 263) @@ -309,6 +309,9 @@ else gtk_spin_button_set_value (GTK_SPIN_BUTTON (port), 4532); /* hamlib default? */ + /* radio type */ + gtk_combo_box_set_active (GTK_COMBO_BOX (type), conf->type); + /* ptt */ gtk_combo_box_set_active (GTK_COMBO_BOX (ptt), conf->ptt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-05-10 00:45:35
|
Revision: 290 http://gpredict.svn.sourceforge.net/gpredict/?rev=290&view=rev Author: csete Date: 2009-05-10 00:45:26 +0000 (Sun, 10 May 2009) Log Message: ----------- Added selector for VFO up/down combination for duplex radios. Modified Paths: -------------- trunk/src/sat-pref-rig-editor.c Modified: trunk/src/sat-pref-rig-editor.c =================================================================== --- trunk/src/sat-pref-rig-editor.c 2009-05-09 23:54:06 UTC (rev 289) +++ trunk/src/sat-pref-rig-editor.c 2009-05-10 00:45:26 UTC (rev 290) @@ -56,6 +56,7 @@ static GtkWidget *port; /* port number */ static GtkWidget *type; /* rig type */ static GtkWidget *ptt; /* PTT */ +static GtkWidget *vfo; /* VFO Up/Down selector */ static GtkWidget *lo; /* local oscillator of downconverter */ static GtkWidget *loup; /* local oscillator of upconverter */ @@ -67,6 +68,7 @@ static void name_changed (GtkWidget *widget, gpointer data); static void type_changed (GtkWidget *widget, gpointer data); static void ptt_changed (GtkWidget *widget, gpointer data); +static void vfo_changed (GtkWidget *widget, gpointer data); /** \brief Add or edit a radio configuration. @@ -146,7 +148,7 @@ - table = gtk_table_new (7, 4, FALSE); + table = gtk_table_new (8, 4, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); gtk_table_set_row_spacings (GTK_TABLE (table), 5); @@ -178,7 +180,9 @@ gtk_widget_set_tooltip_text (host, _("Enter the host where rigctld is running. "\ "You can use both host name and IP address, "\ - "e.g. 192.168.1.100")); + "e.g. 192.168.1.100\n\n"\ + "If gpredict and rigctld are running on the "\ + "same computer use localhost")); gtk_table_attach_defaults (GTK_TABLE (table), host, 1, 4, 1, 2); /* port */ @@ -245,11 +249,32 @@ "read squelch status and send it via CTS.")); gtk_table_attach_defaults (GTK_TABLE (table), ptt, 1, 3, 4, 5); + /* VFO Up/Down */ + label = gtk_label_new (_("VFO Up/Down")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6); + vfo = gtk_combo_box_new_text (); + gtk_combo_box_append_text (GTK_COMBO_BOX (vfo), _("Not applicable")); + gtk_combo_box_append_text (GTK_COMBO_BOX (vfo), _("MAIN \342\206\221 / SUB \342\206\223")); + gtk_combo_box_append_text (GTK_COMBO_BOX (vfo), _("SUB \342\206\221 / MAIN \342\206\223")); + gtk_combo_box_append_text (GTK_COMBO_BOX (vfo), _("A \342\206\221 / B \342\206\223")); + gtk_combo_box_append_text (GTK_COMBO_BOX (vfo), _("B \342\206\221 / A \342\206\223")); + gtk_combo_box_set_active (GTK_COMBO_BOX (vfo), 0); + g_signal_connect (vfo, "changed", G_CALLBACK (vfo_changed), NULL); + gtk_widget_set_tooltip_markup (vfo, + _("Select which VFO to use for uplink and downlink. "\ + "This setting is used for full-duplex radios only, "\ + "such as the IC-910H, FT-847 and the TS-2000.\n\n"\ + "<b>IC-910H:</b> MAIN\342\206\221 / SUB\342\206\223\n"\ + "<b>FT-847:</b> SUB\342\206\221 / MAIN\342\206\223\n"\ + "<b>TS-2000:</b> B\342\206\221 / A\342\206\223")); + gtk_table_attach_defaults (GTK_TABLE (table), vfo, 1, 3, 5, 6); + /* Downconverter LO frequency */ label = gtk_label_new (_("LO Down:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 6, 7); lo = gtk_spin_button_new_with_range (-10000, 10000, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (lo), 0); @@ -257,16 +282,16 @@ gtk_widget_set_tooltip_text (lo, _("Enter the frequency of the local oscillator "\ " of the downconverter, if any.")); - gtk_table_attach_defaults (GTK_TABLE (table), lo, 1, 3, 5, 6); + gtk_table_attach_defaults (GTK_TABLE (table), lo, 1, 3, 6, 7); label = gtk_label_new (_("MHz")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 5, 6); + gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 6, 7); /* Upconverter LO frequency */ label = gtk_label_new (_("LO Up:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 6, 7); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 7, 8); loup = gtk_spin_button_new_with_range (-10000, 10000, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (loup), 0); @@ -274,11 +299,11 @@ gtk_widget_set_tooltip_text (loup, _("Enter the frequency of the local oscillator "\ "of the upconverter, if any.")); - gtk_table_attach_defaults (GTK_TABLE (table), loup, 1, 3, 6, 7); + gtk_table_attach_defaults (GTK_TABLE (table), loup, 1, 3, 7, 8); label = gtk_label_new (_("MHz")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 6, 7); + gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, 7, 8); if (conf->name != NULL) @@ -314,6 +339,18 @@ /* ptt */ gtk_combo_box_set_active (GTK_COMBO_BOX (ptt), conf->ptt); + + /* vfo up/down */ + if (conf->type == RIG_TYPE_DUPLEX) { + if (conf->vfoUp == VFO_MAIN) + gtk_combo_box_set_active (GTK_COMBO_BOX (vfo), 1); + else if (conf->vfoUp == VFO_SUB) + gtk_combo_box_set_active (GTK_COMBO_BOX (vfo), 2); + else if (conf->vfoUp == VFO_A) + gtk_combo_box_set_active (GTK_COMBO_BOX (vfo), 3); + else + gtk_combo_box_set_active (GTK_COMBO_BOX (vfo), 4); + } /* lo down in MHz */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (lo), conf->lo / 1000000.0); @@ -340,6 +377,7 @@ gtk_spin_button_set_value (GTK_SPIN_BUTTON (loup), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (type), RIG_TYPE_RX); gtk_combo_box_set_active (GTK_COMBO_BOX (ptt), PTT_TYPE_NONE); + gtk_combo_box_set_active (GTK_COMBO_BOX (vfo), 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ptt), FALSE); } @@ -381,6 +419,37 @@ /* ptt */ conf->ptt = gtk_combo_box_get_active (GTK_COMBO_BOX (ptt)); + /* vfo up/down */ + if (conf->type == RIG_TYPE_DUPLEX) { + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (vfo))) { + + case 1: + conf->vfoUp = VFO_MAIN; + conf->vfoDown = VFO_SUB; + break; + + case 2: + conf->vfoUp = VFO_SUB; + conf->vfoDown = VFO_MAIN; + break; + + case 3: + conf->vfoUp = VFO_A; + conf->vfoDown = VFO_B; + break; + + case 4: + conf->vfoUp = VFO_B; + conf->vfoDown = VFO_A; + break; + + default: + conf->vfoUp = VFO_MAIN; + conf->vfoDown = VFO_SUB; + break; + } + } + return TRUE; } @@ -453,12 +522,20 @@ static void type_changed (GtkWidget *widget, gpointer data) { - + /* PTT consistency */ if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_TRX) { if (gtk_combo_box_get_active (GTK_COMBO_BOX (ptt)) == PTT_TYPE_NONE) { gtk_combo_box_set_active (GTK_COMBO_BOX (ptt), PTT_TYPE_CAT); } } + + /* VFO consistency */ + if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == RIG_TYPE_DUPLEX) { + if (gtk_combo_box_get_active (GTK_COMBO_BOX (vfo)) == 0) { + gtk_combo_box_set_active (GTK_COMBO_BOX (vfo), 1); + } + } + } /** \brief Manage ptt type changed signals. @@ -479,5 +556,22 @@ } } +/** \brief Manage VFO changed signals. + * \param widget The GtkComboBox that received the signal. + * \param data User data (always NULL). + * + * This function is called when the user selects a new VFO up/down combination. + */ +static void +vfo_changed (GtkWidget *widget, gpointer data) +{ + + if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == 0) { + if (gtk_combo_box_get_active (GTK_COMBO_BOX (type)) == RIG_TYPE_DUPLEX) { + /* not good, we need to have proper VFO combi for this type */ + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1); + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |