aboutsummaryrefslogtreecommitdiff
path: root/src/format-selection.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-05-31 19:07:16 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-05-31 19:07:16 +0200
commitd76fdf9cb931d6d189938102a98a71030ea907ad (patch)
tree74b06c42185705beab93f24ecb2adc66c3f2800c /src/format-selection.c
parentf6963e8221643daa152b0fe26886e327e1a7f8b3 (diff)
downloadexperiment-player-d76fdf9cb931d6d189938102a98a71030ea907ad.tar.gz
allow transcript formatting without markup (like search-as-you type)
* controlled via checkbox * if markup is disabled the entered text is only regular expressions * default text attributes are used according to some constants (in configure.ac, later they will be configurable via config file) * fixed return value of gtk_experiment_transcript_load_formats() * care about possible capture mismatches in regular expressions (capture braces are inserted automatically - the user is not allowed specify own captures) * display state of interactive format via icon (successful/error)
Diffstat (limited to 'src/format-selection.c')
-rw-r--r--src/format-selection.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/format-selection.c b/src/format-selection.c
index 8a11ae1..2e14028 100644
--- a/src/format-selection.c
+++ b/src/format-selection.c
@@ -17,7 +17,9 @@
static void refresh_formats_store(GtkListStore *store);
GtkWidget *transcript_wizard_combo,
- *transcript_proband_combo;
+ *transcript_proband_combo,
+ *transcript_wizard_entry_check,
+ *transcript_proband_entry_check;
static gchar *formats_directory;
@@ -93,14 +95,45 @@ generic_transcript_combo_changed_cb(gpointer user_data, GtkComboBox *combo)
#endif
}
+
+
void
generic_transcript_entry_changed_cb(gpointer user_data, GtkEditable *editable)
{
GtkExperimentTranscript *trans = GTK_EXPERIMENT_TRANSCRIPT(user_data);
const gchar *text = gtk_entry_get_text(GTK_ENTRY(editable));
- /** @todo enable/disable markup */
- gtk_experiment_transcript_set_interactive_format(trans, text, TRUE);
+ GtkToggleButton *toggle;
+ gboolean isMarkup;
+
+ gboolean res;
+
+ toggle = trans == GTK_EXPERIMENT_TRANSCRIPT(transcript_wizard_widget)
+ ? GTK_TOGGLE_BUTTON(transcript_wizard_entry_check)
+ : GTK_TOGGLE_BUTTON(transcript_proband_entry_check);
+ isMarkup = gtk_toggle_button_get_active(toggle);
+
+ res = gtk_experiment_transcript_set_interactive_format(trans, text,
+ isMarkup);
+
+ gtk_entry_set_icon_from_stock(GTK_ENTRY(editable),
+ GTK_ENTRY_ICON_PRIMARY,
+ res ? "gtk-dialog-error" : "gtk-apply");
+ gtk_entry_set_icon_sensitive(GTK_ENTRY(editable),
+ GTK_ENTRY_ICON_PRIMARY,
+ text != NULL && *text);
+}
+
+void
+generic_transcript_entry_check_toggled_cb(gpointer user_data,
+ GtkToggleButton *widget __attribute__((unused)))
+{
+ gint position = 0;
+
+ /*
+ * Hack to update the transcript's interactive format
+ */
+ gtk_editable_insert_text(GTK_EDITABLE(user_data), "", 0, &position);
}
static void