Index: apps/settings.c
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.c,v
retrieving revision 1.428
diff -u -r1.428 settings.c
--- apps/settings.c	11 Oct 2006 09:12:23 -0000	1.428
+++ apps/settings.c	17 Oct 2006 19:02:33 -0000
@@ -667,6 +667,9 @@
 
     /* If values are just added to the end, no need to bump the version. */
     /* new stuff to be added at the end */
+#ifdef HAVE_RECORDING
+    {2, S_O(rec_trigger_type), 0, "trigger type", "stop,pause,nf stp"},
+#endif
 
     /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */
 };
Index: apps/settings.h
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.h,v
retrieving revision 1.247
diff -u -r1.247 settings.h
--- apps/settings.h	9 Oct 2006 10:54:16 -0000	1.247
+++ apps/settings.h	17 Oct 2006 19:02:34 -0000
@@ -185,6 +185,7 @@
     int rec_stop_postrec;   /* negative: db, positive: % range -87 .. 100 */
     int rec_stop_gap;       /* index of trig_durations */
     int rec_trigger_mode;   /* see TRIG_MODE_XXX constants */
+    int rec_trigger_type;   /* what to do when trigger released */
 
 #ifdef HAVE_AGC
     int rec_agc_preset_mic; /* AGC mic preset modes:
Index: apps/sound_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/sound_menu.c,v
retrieving revision 1.117
diff -u -r1.117 sound_menu.c
--- apps/sound_menu.c	27 Sep 2006 21:36:49 -0000	1.117
+++ apps/sound_menu.c	17 Oct 2006 19:02:35 -0000
@@ -32,7 +32,7 @@
 #ifdef HAVE_LCD_BITMAP
 #include "icons.h"
 #include "font.h"
-#include "widgets.h"
+#include "scrollbar.h"
 #endif
 #include "lang.h"
 #include "sprintf.h"
@@ -45,7 +45,7 @@
 #include "radio.h"
 #endif
 #endif
-#if CONFIG_CODEC == MAS3587F
+#ifdef HAVE_RECORDING
 #include "peakmeter.h"
 #include "mas.h"
 #endif
@@ -671,6 +671,7 @@
 enum trigger_menu_option
 {
     TRIGGER_MODE,
+    TRIGGER_TYPE,
     PRERECORD_TIME,
     START_THRESHOLD,
     START_DURATION,
@@ -680,7 +681,7 @@
     TRIG_OPTION_COUNT,
 };
 
-#if !defined(SIMULATOR) && CONFIG_CODEC == MAS3587F
+#ifdef HAVE_RECORDING
 static char* create_thres_str(int threshold)
 {
     static char retval[6];
@@ -723,17 +724,6 @@
     }
 }
 
-/* Variable button definitions */
-#if CONFIG_KEYPAD == RECORDER_PAD
-#define TRIG_CANCEL BUTTON_OFF
-#define TRIG_ACCEPT BUTTON_PLAY
-#define TRIG_RESET_SIM BUTTON_F2
-
-#elif CONFIG_KEYPAD == ONDIO_PAD
-#define TRIG_CANCEL BUTTON_OFF
-#define TRIG_ACCEPT BUTTON_MENU
-#endif
-
 /**
  * Displays a menu for editing the trigger settings.
  */
@@ -742,7 +732,8 @@
     int exit_request = false;
     enum trigger_menu_option selected = TRIGGER_MODE;
     bool retval = false;
-    int old_x_margin, old_y_margin;
+    int old_x_margin[NB_SCREENS];
+    int old_y_margin[NB_SCREENS];
 
 #define TRIGGER_MODE_COUNT 3
     static const unsigned char *trigger_modes[] = {
@@ -759,8 +750,16 @@
         "30s"
     };
 
+#define TRIGGER_TYPE_COUNT 3
+    static const unsigned char *trigger_types[] = {
+        ID2P(LANG_RECORD_TRIGGER_STOP),
+        ID2P(LANG_RECORD_TRIGGER_PAUSE),
+        ID2P(LANG_RECORD_TRIGGER_NEWFILESTP),
+    };
+
     static const unsigned char *option_name[] = {
         [TRIGGER_MODE] =    ID2P(LANG_RECORD_TRIGGER_MODE),
+        [TRIGGER_TYPE] =    ID2P(LANG_RECORD_TRIGGER_TYPE),
         [PRERECORD_TIME] =  ID2P(LANG_RECORD_PRERECORD_TIME),
         [START_THRESHOLD] = ID2P(LANG_RECORD_START_THRESHOLD),
         [START_DURATION] =  ID2P(LANG_RECORD_MIN_DURATION),
@@ -776,37 +775,51 @@
     int old_stop_postrec = global_settings.rec_stop_postrec;
     int old_stop_gap = global_settings.rec_stop_gap;
     int old_trigger_mode = global_settings.rec_trigger_mode;
+    int old_trigger_type = global_settings.rec_trigger_type;
 
-    int offset = 0;
-    int option_lines;
-    int w, h;
-    /* array for y ordinate of peak_meter_draw_get_button
-       function in peakmeter.c*/
+    int offset[NB_SCREENS];
+    int option_lines[NB_SCREENS];
+    int w, h, i;
     int pm_y[NB_SCREENS];
+    int trig_xpos[NB_SCREENS];
+    int trig_ypos[NB_SCREENS];
+    int trig_width[NB_SCREENS];
 
+    FOR_NB_SCREENS(i)
+    {
+        offset[i] = 0;
+        trig_xpos[i] = 0;
+        trig_ypos[i] =  screens[i].height - 8 - TRIG_HEIGHT;
+        pm_y[i] = screens[i].height - 8;
+    }
     /* restart trigger with new values */
     settings_apply_trigger();
     peak_meter_trigger (global_settings.rec_trigger_mode != TRIG_MODE_OFF);
 
-    lcd_clear_display();
-
-    old_x_margin = lcd_getxmargin();
-    old_y_margin = lcd_getymargin();
-    if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
-    else
-        lcd_setmargins(0, 0);
-
-    lcd_getstringsize("M", &w, &h);
+    FOR_NB_SCREENS(i)
+    {
+        screens[i].clear_display();
 
-    // two lines are reserved for peak meter and trigger status
-    option_lines = (LCD_HEIGHT/h) - (global_settings.statusbar ? 1:0) - 2;
+        old_x_margin[i] = screens[i].getxmargin();
+        old_y_margin[i] = screens[i].getymargin();
+        if(global_settings.statusbar)
+           screens[i].setmargins(0, STATUSBAR_HEIGHT);
+      else
+          screens[i].setmargins(0, 0);
+
+      screens[i].getstringsize("M", &w, &h);
+
+      // two lines are reserved for peak meter and trigger status
+      option_lines[i] = MIN(((screens[i].height/h) -
+                          (global_settings.statusbar ? 1:0) - 2),
+                           TRIG_OPTION_COUNT);
+    }
 
     while (!exit_request) {
         int stat_height = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
-        int button, i;
+        int button, k;
         const char *str;
-        char option_value[TRIG_OPTION_COUNT][7];
+        char option_value[TRIG_OPTION_COUNT][10];
 
         snprintf(
             option_value[TRIGGER_MODE],
@@ -814,6 +827,12 @@
             "%s",
             P2STR(trigger_modes[global_settings.rec_trigger_mode]));
 
+        snprintf(
+            option_value[TRIGGER_TYPE],
+            sizeof option_value[TRIGGER_TYPE],
+            "%s",
+            P2STR(trigger_types[global_settings.rec_trigger_type]));
+
         snprintf (
             option_value[PRERECORD_TIME],
             sizeof option_value[PRERECORD_TIME],
@@ -862,44 +881,55 @@
             "%s",
             trig_durations[global_settings.rec_stop_gap]);
 
-        lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
-        lcd_fillrect(0, stat_height, LCD_WIDTH, LCD_HEIGHT - stat_height);
-        lcd_set_drawmode(DRMODE_SOLID);
+        FOR_NB_SCREENS(i)
+        {
+            screens[i].set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+            screens[i].fillrect(0, stat_height, screens[i].width,
+                                   screens[i].height - stat_height);
+            screens[i].set_drawmode(DRMODE_SOLID);
+        }
+
         gui_syncstatusbar_draw(&statusbars, true);
 
         /* reselect FONT_SYSFONT as status_draw has changed the font */
         /*lcd_setfont(FONT_SYSFIXED);*/
 
-        for (i = 0; i < option_lines; i++) {
-            int x, y;
-
-            str = P2STR(option_name[i + offset]);
-            lcd_putsxy(5, stat_height + i * h, str);
-
-            str = option_value[i + offset];
-            lcd_getstringsize(str, &w, &h);
-            y = stat_height + i * h;
-            x = LCD_WIDTH - w;
-            lcd_putsxy(x, y, str);
-            if ((int)selected == (i + offset)) {
-                lcd_set_drawmode(DRMODE_COMPLEMENT);
-                lcd_fillrect(x, y, w, h);
-                lcd_set_drawmode(DRMODE_SOLID);
+        FOR_NB_SCREENS(i)
+        {
+            for (k = 0; k < option_lines[i]; k++) {
+                int x, y;
+
+                str = P2STR(option_name[k + offset[i]]);
+                screens[i].putsxy((option_lines[i] < TRIG_OPTION_COUNT) ? 5 : 0,
+                                       stat_height + k * h, str);
+
+                str = option_value[k + offset[i]];
+                screens[i].getstringsize(str, &w, &h);
+                y = stat_height + k * h;
+                x = screens[i].width - w;
+                screens[i].putsxy(x, y, str);
+                if ((int)selected == (k + offset[i])) {
+                    screens[i].set_drawmode(DRMODE_COMPLEMENT);
+                    screens[i].fillrect(x, y, w, h);
+                    screens[i].set_drawmode(DRMODE_SOLID);
+                }
             }
-        }
 
-        scrollbar(0, stat_height,
-            4, LCD_HEIGHT - 16 - stat_height,
-            TRIG_OPTION_COUNT, offset, offset + option_lines,
-            VERTICAL);
-
-        peak_meter_draw_trig(0, LCD_HEIGHT - 8 - TRIG_HEIGHT);
+            if (option_lines[i] < TRIG_OPTION_COUNT)
+                gui_scrollbar_draw(&screens[i], 0, stat_height,
+                    4, screens[i].height - 16 - stat_height,
+                    TRIG_OPTION_COUNT, offset[i], offset[i] + option_lines[i],
+                    VERTICAL);
+        }
 
         FOR_NB_SCREENS(i)
-            pm_y[i] = screens[i].height - 8;
+            trig_width[i] = screens[i].width;
+
+        peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width);
         button = peak_meter_draw_get_btn(0, pm_y, 8, NB_SCREENS);
 
-        lcd_update();
+        FOR_NB_SCREENS(i)
+            screens[i].update();
 
         switch (button) {
             case ACTION_STD_CANCEL:
@@ -911,6 +941,7 @@
                 global_settings.rec_stop_postrec = old_stop_postrec;
                 global_settings.rec_stop_gap = old_stop_gap;
                 global_settings.rec_trigger_mode = old_trigger_mode;
+                global_settings.rec_trigger_type = old_trigger_type;
                 exit_request = true;
                 break;
 
@@ -921,15 +952,21 @@
             case ACTION_STD_PREV:
                 selected += TRIG_OPTION_COUNT - 1;
                 selected %= TRIG_OPTION_COUNT;
-                offset = MIN(offset, (int)selected);
-                offset = MAX(offset, (int)selected - option_lines + 1);
+                FOR_NB_SCREENS(i)
+                {
+                    offset[i] = MIN(offset[i], (int)selected);
+                    offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1);
+                }
                 break;
 
             case ACTION_STD_NEXT:
                 selected ++;
                 selected %= TRIG_OPTION_COUNT;
-                offset = MIN(offset, (int)selected);
-                offset = MAX(offset, (int)selected - option_lines + 1);
+                FOR_NB_SCREENS(i)
+                {
+                    offset[i] = MIN(offset[i], (int)selected);
+                    offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1);
+                }
                 break;
 
             case ACTION_SETTINGS_INC:
@@ -939,6 +976,11 @@
                         global_settings.rec_trigger_mode %= TRIGGER_MODE_COUNT;
                         break;
 
+                    case TRIGGER_TYPE:
+                        global_settings.rec_trigger_type ++;
+                        global_settings.rec_trigger_type %= TRIGGER_TYPE_COUNT;
+                        break;
+
                     case PRERECORD_TIME:
                         global_settings.rec_prerecord_time ++;
                         global_settings.rec_prerecord_time %= PRERECORD_TIMES_COUNT;
@@ -982,6 +1024,11 @@
                         global_settings.rec_trigger_mode %= TRIGGER_MODE_COUNT;
                         break;
 
+                    case TRIGGER_TYPE:
+                        global_settings.rec_trigger_type+=TRIGGER_TYPE_COUNT-1;
+                        global_settings.rec_trigger_type %= TRIGGER_TYPE_COUNT;
+                        break;
+
                     case PRERECORD_TIME:
                         global_settings.rec_prerecord_time += PRERECORD_TIMES_COUNT - 1;
                         global_settings.rec_prerecord_time %= PRERECORD_TIMES_COUNT;
@@ -1021,11 +1068,9 @@
                 settings_apply_trigger();
                 break;
 
-#ifdef TRIG_RESET_SIM
             case ACTION_REC_F2:
                 peak_meter_trigger(true);
                 break;
-#endif
 
             case SYS_USB_CONNECTED:
                 if(default_event_handler(button) == SYS_USB_CONNECTED) {
@@ -1037,8 +1082,11 @@
     }
 
     peak_meter_trigger(false);
-    lcd_setfont(FONT_UI);
-    lcd_setmargins(old_x_margin, old_y_margin);
+    FOR_NB_SCREENS(i)
+    {
+        screens[i].setfont(FONT_UI);
+        screens[i].setmargins(old_x_margin[i], old_y_margin[i]);
+    }
     action_signalscreenchange();
     return retval;
 }
@@ -1079,10 +1127,8 @@
     items[i].desc = ID2P(LANG_CLIP_LIGHT);
     items[i++].function = cliplight;
 #endif
-#if !defined(SIMULATOR) && CONFIG_CODEC == MAS3587F
     items[i].desc = ID2P(LANG_RECORD_TRIGGER);
     items[i++].function = rectrigger;
-#endif
 #ifdef HAVE_AGC
     items[i].desc = ID2P(LANG_RECORD_AGC_PRESET);
     items[i++].function = agc_preset;
Index: apps/lang/english.lang
===================================================================
RCS file: /cvsroot/rockbox/apps/lang/english.lang,v
retrieving revision 1.285
diff -u -r1.285 english.lang
--- apps/lang/english.lang	9 Oct 2006 11:22:42 -0000	1.285
+++ apps/lang/english.lang	17 Oct 2006 19:02:43 -0000
@@ -9940,3 +9940,55 @@
     *: "Random"
   </voice>
 </phrase>
+<phrase>
+  id: LANG_RECORD_TRIGGER_TYPE
+  desc: in recording trigger menu
+  <source>
+    *: "Trigtype"
+  </source>
+  <dest>
+    *: "Trigtype"
+  </dest>
+  <voice>
+    *: "Trigtype"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_RECORD_TRIGGER_STOP
+  desc: trigger types
+  <source>
+    *: "Stop"
+  </source>
+  <dest>
+    *: "Stop"
+  </dest>
+  <voice>
+    *: "Stop"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_RECORD_TRIGGER_PAUSE
+  desc: trigger types
+  <source>
+    *: "Pause"
+  </source>
+  <dest>
+    *: "Pause"
+  </dest>
+  <voice>
+    *: "Pause"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_RECORD_TRIGGER_NEWFILESTP
+  desc: trigger types
+  <source>
+    *: "Nf on stp"
+  </source>
+  <dest>
+    *: "Nf on stp"
+  </dest>
+  <voice>
+    *: "Nf on stp"
+  </voice>
+</phrase>
Index: apps/recorder/peakmeter.c
===================================================================
RCS file: /cvsroot/rockbox/apps/recorder/peakmeter.c,v
retrieving revision 1.41
diff -u -r1.41 peakmeter.c
--- apps/recorder/peakmeter.c	20 Aug 2006 21:33:40 -0000	1.41
+++ apps/recorder/peakmeter.c	17 Oct 2006 19:02:46 -0000
@@ -23,7 +23,7 @@
 #include "settings.h"
 #include "ata.h"
 #include "lcd.h"
-#include "widgets.h"
+#include "scrollbar.h"
 #include "gwps.h"
 #include "sprintf.h"
 #include "button.h"
@@ -595,25 +595,33 @@
     pm_max_right = MAX(pm_max_right, right);
 
 #ifdef HAVE_RECORDING
+#if CONFIG_CODEC == SWCODEC
+    /* Ignore any unread peakmeter data */
+#define MAX_DROP_TIME HZ/7 /* this value may need tweaking. Increase if you are
+                              getting trig events when you shouldn't with
+                              trig_stp_hold = 0 */
+    if (!trig_stp_hold)
+        trig_stp_hold = MAX_DROP_TIME;
+#endif
+
     switch (trig_status) {
         case TRIG_READY:
             /* no more changes, if trigger was activated as release trigger */
             /* threshold exceeded? */
             if ((left > trig_strt_threshold) 
                 || (right > trig_strt_threshold)) {
-                if (trig_strt_duration) {
                     /* reset trigger duration */
                     trig_hightime = current_tick;
 
                     /* reset dropout duration */
                     trig_lowtime = current_tick;
 
+                if (trig_strt_duration)
+                    set_trig_status(TRIG_STEADY);
+                else
                     /* if trig_duration is set to 0 the user wants to start
                      recording immediately */
-                    set_trig_status(TRIG_STEADY);
-                } else {
                     set_trig_status(TRIG_GO);
-                }
             }
             break;
 
@@ -654,7 +662,11 @@
                 || (right > trig_stp_threshold)) {
                 /* restart hold time countdown */
                 trig_lowtime = current_tick;
+#if CONFIG_CODEC == SWCODEC
+            } else if (current_tick - trig_lowtime > MAX_DROP_TIME){
+#else
             } else {
+#endif
                 set_trig_status(TRIG_POSTREC);
                 trig_hightime = current_tick;
             }
@@ -669,6 +681,7 @@
 
                     set_trig_status(TRIG_RETRIG);
                     trig_hightime = current_tick;
+                    trig_lowtime = current_tick;
                 }
                 else
 
@@ -711,6 +724,11 @@
             }
             break;
     }
+#if CONFIG_CODEC == SWCODEC
+    /* restore stop hold value */
+    if (trig_stp_hold == MAX_DROP_TIME)
+        trig_stp_hold = 0;
+#endif
 #endif
     /* check levels next time peakmeter drawn */
     level_check = true;
@@ -1155,55 +1173,81 @@
    return trig_status; /* & TRIG_PIT_MASK;*/
 }
 
-void peak_meter_draw_trig(int xpos, int ypos) 
+void peak_meter_draw_trig(int xpos[], int ypos[], int trig_width[]) 
 {
-    int barstart, barend;
-    int icon, ixpos;
+    int barstart[NB_SCREENS];
+    int barend[NB_SCREENS];
+    int icon;
+    int ixpos[NB_SCREENS];
     int i;
+    int trigbar_width[NB_SCREENS];
+
+    FOR_NB_SCREENS(i)
+        trigbar_width[i] = (trig_width[i] - (2 * (ICON_PLAY_STATE_WIDTH + 1)));
+
     switch (trig_status) {
 
         case TRIG_READY:
-            barstart = 0;
-            barend = 0;
+            FOR_NB_SCREENS(i){
+                barstart[i] = 0;
+                barend[i] = 0;
+            }
             icon = Icon_Stop;
-            ixpos = xpos;
+            FOR_NB_SCREENS(i)
+                ixpos[i] = xpos[i];
             break;
 
         case TRIG_STEADY:
-        case TRIG_RETRIG: 
-            barstart = 0;
-            barend = TRIGBAR_WIDTH * (current_tick - trig_hightime) 
-                   / trig_strt_duration;
+        case TRIG_RETRIG:
+            FOR_NB_SCREENS(i)
+            {
+                barstart[i] = 0;
+                barend[i] = (trig_strt_duration == 0) ? trigbar_width[i] :
+                              trigbar_width[i] *
+                             (current_tick - trig_hightime) / trig_strt_duration;
+            }
             icon = Icon_Stop;
-            ixpos = xpos;
+            FOR_NB_SCREENS(i)
+                ixpos[i] = xpos[i];
             break;
 
         case TRIG_GO:
         case TRIG_CONTINUE:
-            barstart = TRIGBAR_WIDTH;
-            barend = TRIGBAR_WIDTH;
+            FOR_NB_SCREENS(i)
+            {
+                barstart[i] = trigbar_width[i];
+                barend[i] = trigbar_width[i];
+            }
             icon = Icon_Record;
-            ixpos = TRIG_WIDTH - ICON_PLAY_STATE_WIDTH;
+            FOR_NB_SCREENS(i)
+                ixpos[i] = xpos[i]+ trig_width[i] - ICON_PLAY_STATE_WIDTH;
             break;
 
-        case TRIG_POSTREC: 
-            barstart = TRIGBAR_WIDTH
-                     - TRIGBAR_WIDTH * (current_tick - trig_lowtime)
-                       / trig_stp_hold;
-            barend = TRIGBAR_WIDTH;
+        case TRIG_POSTREC:
+            FOR_NB_SCREENS(i)
+            {
+                barstart[i] = (trig_stp_hold == 0) ? 0 :
+                               trigbar_width[i] - trigbar_width[i] *
+                              (current_tick - trig_lowtime) / trig_stp_hold;
+                barend[i] = trigbar_width[i];
+            }
             icon = Icon_Record;
-            ixpos = TRIG_WIDTH - ICON_PLAY_STATE_WIDTH;
+            FOR_NB_SCREENS(i)
+                ixpos[i] = xpos[i] + trig_width[i] - ICON_PLAY_STATE_WIDTH;
             break;
 
         default:
             return;
     }
-    scrollbar(xpos + ICON_PLAY_STATE_WIDTH + 1, ypos + 1,
-              TRIGBAR_WIDTH, TRIG_HEIGHT - 2,
-              TRIGBAR_WIDTH, barstart, barend, HORIZONTAL);
+
     FOR_NB_SCREENS(i)
     {
-        screens[i].mono_bitmap(bitmap_icons_7x8[icon], ixpos, ypos,
+        gui_scrollbar_draw(&screens[i], xpos[i] + ICON_PLAY_STATE_WIDTH + 1,
+                               ypos[i] + 1, trigbar_width[i], TRIG_HEIGHT - 2,
+                               trigbar_width[i], barstart[i], barend[i],
+                               HORIZONTAL);
+
+        screens[i].mono_bitmap(bitmap_icons_7x8[icon], ixpos[i], ypos[i],
                         ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
     }
 }
Index: apps/recorder/peakmeter.h
===================================================================
RCS file: /cvsroot/rockbox/apps/recorder/peakmeter.h,v
retrieving revision 1.10
diff -u -r1.10 peakmeter.h
--- apps/recorder/peakmeter.h	16 Aug 2006 23:26:54 -0000	1.10
+++ apps/recorder/peakmeter.h	17 Oct 2006 19:02:46 -0000
@@ -69,14 +69,9 @@
 extern int peak_meter_trigger_status(void);
 extern void peak_meter_set_trigger_listener(void (*listener)(int status));
 
-//#define TRIG_WIDTH 12
-//#define TRIG_HEIGHT 14
-
-#define TRIG_WIDTH 112
 #define TRIG_HEIGHT 8
-#define TRIGBAR_WIDTH (TRIG_WIDTH - (2 * (ICON_PLAY_STATE_WIDTH + 1)))
 
-extern void peak_meter_draw_trig(int x, int y);
+extern void peak_meter_draw_trig(int x[], int y[], int trig_width[]);
 
 extern unsigned short peak_meter_range_min;
 extern unsigned short peak_meter_range_max;
Index: apps/recorder/recording.c
===================================================================
RCS file: /cvsroot/rockbox/apps/recorder/recording.c,v
retrieving revision 1.143
diff -u -r1.143 recording.c
--- apps/recorder/recording.c	1 Oct 2006 10:04:40 -0000	1.143
+++ apps/recorder/recording.c	17 Oct 2006 19:02:50 -0000
@@ -763,9 +763,16 @@
             /* if we're already recording this is a retrigger */
             else
             {
-                rec_new_file();
-                /* tell recording_screen to reset the time */
-                last_seconds = 0;
+                if((audio_status() & AUDIO_STATUS_PAUSE) &&
+                       (global_settings.rec_trigger_type == 1))
+                    audio_resume_recording();
+                /* New file on trig start*/
+                else if (global_settings.rec_trigger_type != 2)
+                {
+                    rec_new_file();
+                    /* tell recording_screen to reset the time */
+                    last_seconds = 0;
+                }
             }
             break;
 
@@ -773,7 +780,27 @@
         case TRIG_READY:
             if(audio_status() & AUDIO_STATUS_RECORD)
             {
-                audio_stop();
+                switch(global_settings.rec_trigger_type)
+                {
+                    case 0: /* Stop */
+#if CONFIG_CODEC == SWCODEC
+                        audio_stop_recording();
+#else
+                        audio_stop();
+#endif
+                        break;
+
+                    case 1: /* Pause */
+                        audio_pause_recording();
+                        break;
+
+                    case 2: /* New file on trig stop*/
+                        rec_new_file();
+                        /* tell recording_screen to reset the time */
+                        last_seconds = 0;
+                        break;
+                 }
+
                 if (global_settings.rec_trigger_mode != TRIG_MODE_REARM)
                 {
                     peak_meter_set_trigger_listener(NULL);
@@ -823,6 +850,9 @@
     int i;
     int filename_offset[NB_SCREENS];
     int pm_y[NB_SCREENS];
+    int trig_xpos[NB_SCREENS];
+    int trig_ypos[NB_SCREENS];
+    int trig_width[NB_SCREENS];
 
     static const unsigned char *byte_units[] = {
         ID2P(LANG_BYTE),
@@ -1578,6 +1608,10 @@
                     line[i] = 3;
                     break;
 #endif
+                default:
+                    line[i] = 5; /* to prevent uninitialisation
+                                    warnings for line[0] */
+                    break;
                 } /* end switch */
 #ifdef HAVE_AGC
                 if (screens[i].height < h * (2 + filename_offset[i] + PM_HEIGHT + line[i]))
@@ -1723,12 +1757,27 @@
             }
 
             /* draw the trigger status */
+            FOR_NB_SCREENS(i)
+            {
+                trig_width[i] = ((screens[i].height < 64) ||
+                                ((screens[i].height < 72) && (PM_HEIGHT > 1))) ?
+                                  screens[i].width - 14 * w : screens[i].width;
+                trig_xpos[i] = screens[i].width - trig_width[i];
+                trig_ypos[i] =  ((screens[i].height < 72) && (PM_HEIGHT > 1)) ?
+                                  h*2 :
+                                  h*(1 + filename_offset[i] + PM_HEIGHT + line[i]
+#ifdef HAVE_AGC
+                               + 1
+#endif
+                               );
+            }
+
             if (peak_meter_trigger_status() != TRIG_OFF)
             {
-                peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, 4 * h);
+                peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width);
                 for(i = 0; i < screen_update; i++){
-                    screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h,
-                                    TRIG_WIDTH + 2, TRIG_HEIGHT);
+                    screens[i].update_rect(trig_xpos[i], trig_ypos[i],
+                                           trig_width[i] + 2, TRIG_HEIGHT);
                 }
             }
         }
