From ba2aa5167b2157c99f3be4861c11717cd1b4cc6f Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <calcurse@cryptocrack.de>
Date: Mon, 3 Oct 2011 23:58:39 +0000
Subject: Add count parameter to *_{in,de}crease()

This allows for moving more than one item up/down.

This currently isn't used anywhere but will be bound to a key with one
of the following patches.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
---
 src/apoint.c   |  8 ++++----
 src/calcurse.c | 16 ++++++++--------
 src/calcurse.h | 12 ++++++------
 src/todo.c     | 16 ++++++++--------
 4 files changed, 26 insertions(+), 26 deletions(-)

(limited to 'src')

diff --git a/src/apoint.c b/src/apoint.c
index f99b94d..9700c1b 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -103,15 +103,15 @@ apoint_hilt_set (int highlighted)
 }
 
 void
-apoint_hilt_decrease (void)
+apoint_hilt_decrease (int n)
 {
-  hilt--;
+  hilt -= n;
 }
 
 void
-apoint_hilt_increase (void)
+apoint_hilt_increase (int n)
 {
-  hilt++;
+  hilt += n;
 }
 
 /* Return which appointment is highlighted. */
diff --git a/src/calcurse.c b/src/calcurse.c
index 05d8f6a..44fc0fe 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -300,7 +300,7 @@ main (int argc, char **argv)
         case KEY_GENERIC_ADD_TODO:
           todo_new_item ();
           if (todo_hilt () == 0 && todo_nb () == 1)
-            todo_hilt_increase ();
+            todo_hilt_increase (1);
           wins_update (FLAG_TOD | FLAG_STA);
           break;
 
@@ -315,7 +315,7 @@ main (int argc, char **argv)
             case TOD:
               todo_new_item ();
               if (todo_hilt () == 0 && todo_nb () == 1)
-                todo_hilt_increase ();
+                todo_hilt_increase (1);
               wins_update (FLAG_TOD | FLAG_STA);
               break;
             default:
@@ -504,15 +504,15 @@ main (int argc, char **argv)
             }
           else if ((wins_slctd () == APP) && (apoint_hilt () > 1))
             {
-              apoint_hilt_decrease ();
+              apoint_hilt_decrease (1);
               apoint_scroll_pad_up (inday.nb_events);
               wins_update (FLAG_APP);
             }
           else if ((wins_slctd () == TOD) && (todo_hilt () > 1))
             {
-              todo_hilt_decrease ();
+              todo_hilt_decrease (1);
               if (todo_hilt_pos () < 0)
-                todo_first_decrease ();
+                todo_first_decrease (1);
               wins_update (FLAG_TOD);
             }
           break;
@@ -528,15 +528,15 @@ main (int argc, char **argv)
           else if ((wins_slctd () == APP) &&
               (apoint_hilt () < inday.nb_events + inday.nb_apoints))
             {
-              apoint_hilt_increase ();
+              apoint_hilt_increase (1);
               apoint_scroll_pad_down (inday.nb_events, win[APP].h);
               wins_update (FLAG_APP);
             }
           else if ((wins_slctd () == TOD) && (todo_hilt () < todo_nb ()))
             {
-              todo_hilt_increase ();
+              todo_hilt_increase (1);
               if (todo_hilt_pos () == win[TOD].h - 4)
-                todo_first_increase ();
+                todo_first_increase (1);
               wins_update (FLAG_TOD);
             }
           break;
diff --git a/src/calcurse.h b/src/calcurse.h
index 37bf2c2..047a392 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -568,8 +568,8 @@ void               apoint_free_bkp (void);
 void               apoint_llist_init (void);
 void               apoint_llist_free (void);
 void               apoint_hilt_set (int);
-void               apoint_hilt_decrease (void);
-void               apoint_hilt_increase (void);
+void               apoint_hilt_decrease (int);
+void               apoint_hilt_increase (int);
 int                apoint_hilt (void);
 struct apoint     *apoint_new (char *, char *, long, long, char);
 void               apoint_add (void);
@@ -836,14 +836,14 @@ unsigned  sigs_set_hdlr (int, void (*)(int));
 /* todo.c */
 extern llist_t todolist;
 void          todo_hilt_set (int);
-void          todo_hilt_decrease (void);
-void          todo_hilt_increase (void);
+void          todo_hilt_decrease (int);
+void          todo_hilt_increase (int);
 int           todo_hilt (void);
 int           todo_nb (void);
 void          todo_set_nb (int);
 void          todo_set_first (int);
-void          todo_first_increase (void);
-void          todo_first_decrease (void);
+void          todo_first_increase (int);
+void          todo_first_decrease (int);
 int           todo_hilt_pos (void);
 char         *todo_saved_mesg (void);
 void          todo_new_item (void);
diff --git a/src/todo.c b/src/todo.c
index 8977a06..017fa9a 100644
--- a/src/todo.c
+++ b/src/todo.c
@@ -61,15 +61,15 @@ todo_hilt_set (int highlighted)
 }
 
 void
-todo_hilt_decrease (void)
+todo_hilt_decrease (int n)
 {
-  hilt--;
+  hilt -= n;
 }
 
 void
-todo_hilt_increase (void)
+todo_hilt_increase (int n)
 {
-  hilt++;
+  hilt += n;
 }
 
 /* Return which todo is highlighted. */
@@ -101,15 +101,15 @@ todo_set_first (int nb)
 }
 
 void
-todo_first_increase (void)
+todo_first_increase (int n)
 {
-  first++;
+  first += n;
 }
 
 void
-todo_first_decrease (void)
+todo_first_decrease (int n)
 {
-  first--;
+  first -= n;
 }
 
 /*
-- 
cgit v1.2.3-70-g09d2