]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Corrections to the MIDI menu
authorc vw <dl1ycf@darc.de>
Thu, 27 Jan 2022 08:20:31 +0000 (09:20 +0100)
committerc vw <dl1ycf@darc.de>
Thu, 27 Jan 2022 08:20:31 +0000 (09:20 +0100)
ext.h
midi_menu.c

diff --git a/ext.h b/ext.h
index 6c428025e2934d45470828de101b41c64470f39e..1d8770109f2295db5f23ec89b399709130064587 100644 (file)
--- a/ext.h
+++ b/ext.h
@@ -82,8 +82,6 @@ extern int ext_agc_update(void *data);
 extern int ext_split_toggle(void *data);
 
 
-extern int ext_cw_key(void *data);
-
 extern int ext_update_squelch(void *data);
 
 extern int ext_sliders_update(void *data);
index 3141e93a0f729b1993d756f1617202886a4912d5..e7f2bbdaf24be0986559c837612197857e532c06 100644 (file)
@@ -1434,6 +1434,7 @@ void midi_save_state() {
   struct desc *cmd;
   gint entry;
   int i;
+  char *cp;
 
   entry=0;
   for (i=0; i<n_midi_devices; i++) {
@@ -1461,6 +1462,14 @@ void midi_save_state() {
         setProperty(name,value);
         sprintf(name,"midi[%d].entry[%d].channel[%d].action",i,entry,cmd->channel);
         sprintf(value,"%s",ActionTable[cmd->action].str);
+        //
+        // ActionTable strings may contain '\n', convert this to '$'
+        //
+        cp=value;
+        while (*cp ) {
+          if (*cp == '\n') *cp='$';
+          cp++;
+        }
         setProperty(name,value);
         sprintf(name,"midi[%d].entry[%d].channel[%d].type",i,entry,cmd->channel);
         sprintf(value,"%s",midi_types[cmd->type]);
@@ -1552,6 +1561,7 @@ void midi_restore_state() {
   gint fr1, fr2;
   gint vfr1, vfr2;
   int i,j;
+  char *cp;
 
   get_midi_devices();
   MidiReleaseCommands();
@@ -1612,6 +1622,12 @@ void midi_restore_state() {
          }
           sprintf(name,"midi[%d].entry[%d].channel[%d].action",i,entry,channel);
           value=getProperty(name);
+          // convert '$' back to '\n' in action name before comparing
+          cp=value;
+          while (*cp) {
+            if (*cp == '$') *cp='\n';
+            cp++;
+          }
          action=NO_ACTION;
           if(value) {
            for(j=0;j<ACTIONS;j++) {