From d506f120e462825cbb8e79e9a497d1460ea6fc4f Mon Sep 17 00:00:00 2001 From: Ben Hart Date: Mon, 2 Mar 2020 23:57:11 -0600 Subject: [PATCH 1/4] Fixed segfault on startup. --- src/gui_widgy_editor.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gui_widgy_editor.c b/src/gui_widgy_editor.c index 78597cf..4ae09ff 100644 --- a/src/gui_widgy_editor.c +++ b/src/gui_widgy_editor.c @@ -864,22 +864,29 @@ on_combo_changed(GtkComboBox *widget, static void place_combo(GtkObject *adj, GtkWidget *table, int x, int y, int type) { - const char **labels; + /* -FIX- this is still kinda ugly */ + const char* labelsLfoWave[] = { "Tri", "Saw+", "Saw-", "Square", "Sine", "S/H", NULL }; + const char* labelsCurve[] = { "-Lin", "-Exp", "+Exp", "+Lin", NULL }; + int i; - /* -FIX- this is kinda ugly */ + GtkWidget *w = gtk_combo_box_new_text(); + switch (type) { default: case PEPT_LFOWave: - labels = (const char *[]){ "Tri", "Saw+", "Saw-", "Square", "Sine", "S/H", NULL }; + for (i = 0; labelsLfoWave[i]; i++) + { + gtk_combo_box_append_text(GTK_COMBO_BOX(w), labelsLfoWave[i]); + } break; case PEPT_Curve: - labels = (const char *[]){ "-Lin", "-Exp", "+Exp", "+Lin", NULL }; + for (i = 0; labelsCurve[i]; i++) + { + gtk_combo_box_append_text(GTK_COMBO_BOX(w), labelsCurve[i]); + } break; } - GtkWidget *w = gtk_combo_box_new_text(); - for (i = 0; labels[i]; i++) - gtk_combo_box_append_text(GTK_COMBO_BOX(w), labels[i]); gtk_combo_box_set_active((GtkComboBox *)w, 0); gtk_table_attach (GTK_TABLE (table), w, x, x + 1, y, y + 1, (GtkAttachOptions) (0), From 08aa22d2f00dfd51d29e127c6c4845ee05a1cfe9 Mon Sep 17 00:00:00 2001 From: Ben Hart Date: Tue, 3 Mar 2020 00:03:39 -0600 Subject: [PATCH 2/4] Made it less ugly. --- src/gui_widgy_editor.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/gui_widgy_editor.c b/src/gui_widgy_editor.c index 4ae09ff..9a0fa41 100644 --- a/src/gui_widgy_editor.c +++ b/src/gui_widgy_editor.c @@ -861,29 +861,31 @@ on_combo_changed(GtkComboBox *widget, g_signal_handlers_unblock_by_func(G_OBJECT(adj), on_combo_adjustment_changed, (gpointer)widget); } +static void +combo_box_append_text(GtkWidget *w, const char** labels) +{ + int i; + for (i = 0; labels[i]; i++) + { + gtk_combo_box_append_text(GTK_COMBO_BOX(w), labels[i]); + } +} + static void place_combo(GtkObject *adj, GtkWidget *table, int x, int y, int type) { /* -FIX- this is still kinda ugly */ - const char* labelsLfoWave[] = { "Tri", "Saw+", "Saw-", "Square", "Sine", "S/H", NULL }; - const char* labelsCurve[] = { "-Lin", "-Exp", "+Exp", "+Lin", NULL }; + const char* labelsLfoWave[] = { "Tri", "Saw+", "Saw-", "Square", "Sine", "S/H", 0 }; + const char* labelsCurve[] = { "-Lin", "-Exp", "+Exp", "+Lin", 0 }; - int i; GtkWidget *w = gtk_combo_box_new_text(); - switch (type) { default: case PEPT_LFOWave: - for (i = 0; labelsLfoWave[i]; i++) - { - gtk_combo_box_append_text(GTK_COMBO_BOX(w), labelsLfoWave[i]); - } + combo_box_append_text(w, labelsLfoWave); break; case PEPT_Curve: - for (i = 0; labelsCurve[i]; i++) - { - gtk_combo_box_append_text(GTK_COMBO_BOX(w), labelsCurve[i]); - } + combo_box_append_text(w, labelsCurve); break; } From 548913bc2cd708377246d804c8de43a71860e2f5 Mon Sep 17 00:00:00 2001 From: Sean Bolton Date: Fri, 1 Jan 2021 16:16:39 -0800 Subject: [PATCH 3/4] Add jmechmech's style cleanup --- src/gui_widgy_editor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui_widgy_editor.c b/src/gui_widgy_editor.c index 9a0fa41..af170bc 100644 --- a/src/gui_widgy_editor.c +++ b/src/gui_widgy_editor.c @@ -875,17 +875,17 @@ static void place_combo(GtkObject *adj, GtkWidget *table, int x, int y, int type) { /* -FIX- this is still kinda ugly */ - const char* labelsLfoWave[] = { "Tri", "Saw+", "Saw-", "Square", "Sine", "S/H", 0 }; - const char* labelsCurve[] = { "-Lin", "-Exp", "+Exp", "+Lin", 0 }; + const char* labels_lfo_wave[] = { "Tri", "Saw+", "Saw-", "Square", "Sine", "S/H", 0 }; + const char* labels_curve[] = { "-Lin", "-Exp", "+Exp", "+Lin", 0 }; GtkWidget *w = gtk_combo_box_new_text(); switch (type) { default: case PEPT_LFOWave: - combo_box_append_text(w, labelsLfoWave); + combo_box_append_text(w, labels_lfo_wave); break; case PEPT_Curve: - combo_box_append_text(w, labelsCurve); + combo_box_append_text(w, labels_curve); break; } From 1a953a34d3930b8ef248683b2ebfa6ef67655dde Mon Sep 17 00:00:00 2001 From: Sean Bolton Date: Fri, 1 Jan 2021 16:18:46 -0800 Subject: [PATCH 4/4] Makefile.am and configure.ac fixes from jmechmech. See https://bugs.archlinux.org/task/67872 --- Makefile.am | 1 + configure.ac | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 769cc63..3a0ba86 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,4 +26,5 @@ dist_pkgdata_DATA = extra/dx7_roms.dx7 \ extra/tx7_roms.dx7 AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 diff --git a/configure.ac b/configure.ac index c9f7e48..565c233 100644 --- a/configure.ac +++ b/configure.ac @@ -3,8 +3,9 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(hexter, 1.1.0, sean-at-smbolton-dot-com) AC_CONFIG_SRCDIR(src/hexter.c) -AM_INIT_AUTOMAKE -AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE([subdir-objects]) +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_MACRO_DIRS([m4]) AC_PROG_CC