diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/default.ui | 100 | ||||
-rw-r--r-- | src/experiment-player.h | 4 | ||||
-rw-r--r-- | src/format-selection.c | 39 | ||||
-rw-r--r-- | src/main.c | 2 |
4 files changed, 123 insertions, 22 deletions
diff --git a/src/default.ui b/src/default.ui index ee9195e..d526dbd 100644 --- a/src/default.ui +++ b/src/default.ui @@ -13,7 +13,6 @@ <child> <object class="GtkVBox" id="player_window_vbox"> <property name="visible">True</property> - <property name="orientation">vertical</property> <child> <object class="GtkMenuBar" id="player_window_menubar"> <property name="visible">True</property> @@ -265,7 +264,6 @@ audio-volume-medium</property> <child> <object class="GtkVBox" id="info_window_vbox"> <property name="visible">True</property> - <property name="orientation">vertical</property> <child> <object class="GtkMenuBar" id="info_window_menubar"> <property name="visible">True</property> @@ -356,41 +354,107 @@ audio-volume-medium</property> </packing> </child> <child> - <object class="GtkEntry" id="transcript_wizard_entry"> + <object class="GtkComboBox" id="transcript_wizard_combo"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <signal name="changed" handler="generic_transcript_entry_changed_cb" object="transcript_wizard_widget"/> + <signal name="changed" handler="generic_transcript_combo_changed_cb" object="transcript_wizard_widget"/> </object> <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <object class="GtkEntry" id="transcript_proband_entry"> + <object class="GtkHBox" id="transcript_wizard_entry_hbox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <signal name="changed" handler="generic_transcript_entry_changed_cb" object="transcript_proband_widget"/> + <child> + <object class="GtkEntry" id="transcript_wizard_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="primary_icon_stock">gtk-apply</property> + <signal name="changed" handler="generic_transcript_entry_changed_cb" object="transcript_wizard_widget"/> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkVSeparator" id="transcript_wizard_entry_separator"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="padding">5</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="transcript_wizard_entry_check"> + <property name="label" translatable="yes">Markup</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="generic_transcript_entry_check_toggled_cb" object="transcript_wizard_entry"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> <property name="top_attach">2</property> <property name="bottom_attach">3</property> <property name="y_options">GTK_FILL</property> </packing> </child> <child> - <object class="GtkComboBox" id="transcript_wizard_combo"> + <object class="GtkHBox" id="transcript_proband_entry_hbox"> <property name="visible">True</property> - <signal name="changed" handler="generic_transcript_combo_changed_cb" object="transcript_wizard_widget"/> + <child> + <object class="GtkEntry" id="transcript_proband_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="primary_icon_stock">gtk-apply</property> + <signal name="changed" handler="generic_transcript_entry_changed_cb" object="transcript_proband_widget"/> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkVSeparator" id="transcript_proband_entry_separator"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="padding">5</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="transcript_proband_entry_check"> + <property name="label" translatable="yes">Markup</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="generic_transcript_entry_check_toggled_cb" object="transcript_proband_entry"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options">GTK_FILL</property> </packing> </child> diff --git a/src/experiment-player.h b/src/experiment-player.h index a7cda8a..018cabd 100644 --- a/src/experiment-player.h +++ b/src/experiment-player.h @@ -37,7 +37,9 @@ extern gchar *quickopen_directory; void format_selection_init(const gchar *dir); extern GtkWidget *transcript_wizard_combo, - *transcript_proband_combo; + *transcript_proband_combo, + *transcript_wizard_entry_check, + *transcript_proband_entry_check; #define BUILDER_INIT(BUILDER, VAR) do { \ VAR = GTK_WIDGET(gtk_builder_get_object(BUILDER, #VAR)); \ 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 @@ -287,6 +287,8 @@ main(int argc, char *argv[]) BUILDER_INIT(builder, transcript_wizard_combo); BUILDER_INIT(builder, transcript_proband_combo); + BUILDER_INIT(builder, transcript_wizard_entry_check); + BUILDER_INIT(builder, transcript_proband_entry_check); BUILDER_INIT(builder, navigator_scrolledwindow); BUILDER_INIT(builder, navigator_widget); |