[mythtv] Re: [mythtv-users] FF/REW key binding confusion

David Engel dlengel at attbi.com
Thu Jun 19 00:16:36 EDT 2003


Please note the move from mythtv-users to mythtv-dev.

On Mon, Jun 16, 2003 at 09:02:59PM -0400, Isaac Richards wrote:
> On Monday 16 June 2003 02:03 pm, David Engel wrote:
> > Here's the beginnings of a patch I've started to make the key bindings
> > better suit my universal remote and Tivo-influenced tastes.  Feel free
> > to use or ignore it.
> 
> Would you mind updating this so it's against CVS?  I'd be happy to apply it..

Here's the same patch against current CVS.  

This keeps the previous behavior where repeatedly pressing the rew/ff
key increases the speed until it wraps and pressing the opposite key
switches to the normal speed in the other direction.  Would anyone
object to me changing this so pressing the opposite key decreases the
speed without changing the direction?

David
-- 
David Engel
dlengel at attbi.com

Index: keys.txt
===================================================================
RCS file: /var/lib/mythcvs/mythtv/keys.txt,v
retrieving revision 1.22
diff -u -r1.22 keys.txt
--- keys.txt	17 Jun 2003 01:16:40 -0000	1.22
+++ keys.txt	19 Jun 2003 03:58:36 -0000
@@ -38,7 +38,9 @@
 
 - Left arrow to rewind the configured number of seconds.  (default is 5)
 - Right arrow to fast forward the configured number of seconds. (default is 30)
+- < starts rewind mods as if stickykeys are selected.
+- > starts fast forward mode as if stickykeys are selected.
 
 With the stickykeys option selected:
 
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.68
diff -u -r1.68 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	17 Jun 2003 01:16:40 -0000	1.68
+++ libs/libmythtv/tv_play.cpp	19 Jun 2003 03:58:46 -0000
@@ -633,8 +633,7 @@
     }
 
     paused = false;
-    doing_ff = false;
-    doing_rew = false;
+    doing_ff_rew = 0;
     ff_rew_index = SSPEED_NORMAL;
     ff_rew_scaling = 1.0;
 
@@ -683,8 +682,7 @@
     int keypressed;
 
     stickykeys = gContext->GetNumSetting("StickyKeys");
-    doing_ff = false;
-    doing_rew = false;
+    doing_ff_rew = 0;
     ff_rew_scaling = 1.0;
     ff_rew_index = SSPEED_NORMAL;
 
@@ -716,12 +714,12 @@
 
                 ProcessKeypress(keypressed);
             }
-            else if (stickykeys)
+            else if (doing_ff_rew)
             {
-                if (doing_ff)
-                    DoFF();
-                else if (doing_rew)
-                    DoRew();
+                if (doing_ff_rew > 0)
+                    DoFF(1);
+                else
+                    DoRew(1);
                 if (ff_rew_index > SSPEED_NORMAL)
                     usleep(50000);
             }
@@ -887,8 +885,7 @@
         }
         case Key_Z:
         {
-            doing_ff = false;
-            doing_rew = false;
+            doing_ff_rew = 0;
             DoSkipCommercials(1);
             break;
         }
@@ -899,56 +896,62 @@
         }
         case Key_Q:
         {
-            doing_ff = false;
-            doing_rew = false;
+            doing_ff_rew = 0;
             DoSkipCommercials(-1);
             break;
         }
         case Key_S: case Key_P: 
         {
-            doing_ff = false;
-            doing_rew = false;
+            doing_ff_rew = 0;
             DoPause();
             break;
         }
         case Key_Right: case Key_D: case Key_F8: 
         {
-            if (stickykeys)
+            if (!stickykeys)
             {
-                if (doing_ff)
-                    ff_rew_index = (++ff_rew_index % SSPEED_MAX);
-                else
-                {
-                    doing_ff = true;
-                    ff_rew_index = SSPEED_NORMAL;
-                }
-            }
-            else
-                ff_rew_index = SSPEED_NORMAL;
-
-            doing_rew = false;
-            DoFF(); 
-            break;
-        }
+		doing_ff_rew = 0;
+		ff_rew_index = SSPEED_NORMAL;
+		DoFF(fftime); 
+		break;
+	    }
+	    // fall through
+        }
+	case '>': case '.':
+	{
+	    if (doing_ff_rew > 0)
+		ff_rew_index = (++ff_rew_index % SSPEED_MAX);
+	    else
+	    {
+		doing_ff_rew = 1;
+		ff_rew_index = SSPEED_NORMAL;
+	    }
+	    DoFF(1); 
+	    break;
+	}
         case Key_Left: case Key_A: case Key_F5:
         {
-            if (stickykeys)
+            if (!stickykeys)
             {
-                if (doing_rew)
-                    ff_rew_index = (++ff_rew_index % SSPEED_MAX);
-                else
-                {
-                    doing_rew = true;
-                    ff_rew_index = SSPEED_NORMAL;
-                }
-            }
-            else
-                ff_rew_index = SSPEED_NORMAL;
-
-            doing_ff = false;
-            DoRew(); 
-            break;
-        }
+		doing_ff_rew = 0;
+		ff_rew_index = SSPEED_NORMAL;
+		DoRew(rewtime);
+		break;
+            }
+	    // fall through
+        }
+	case '<': case ',':
+	{
+	    if (doing_ff_rew < 0)
+		ff_rew_index = (++ff_rew_index % SSPEED_MAX);
+	    else
+	    {
+		doing_ff_rew = -1;
+		ff_rew_index = SSPEED_NORMAL;
+	    }
+	    DoRew(1);
+	    break;
+	}
         case Key_PageUp:
         {
             DoJumpBack(); 
@@ -990,7 +993,7 @@
 
         default: 
         {
-            if (doing_ff || doing_rew)
+            if (doing_ff_rew)
             {
                 switch (keypressed)
                 {
@@ -1006,8 +1009,7 @@
                     case Key_9: ff_rew_index = SSPEED_FAST_6; break;
 
                     default:
-                       doing_ff = false;
-                       doing_rew = false;
+                       doing_ff_rew = 0;
                        was_doing_ff_rew = true;
                        break;
                 }
@@ -1323,7 +1325,7 @@
     }
 }
 
-void TV::DoFF(void)
+void TV::DoFF(int time)
 {
     bool slidertype = false;
     if (internalState == kState_WatchingLiveTV)
@@ -1336,14 +1338,14 @@
     if (activenvp == nvp)
     {
         QString desc = "";
-        int pos = calcSliderPos((int)(fftime * ff_rew_scaling), desc);
+        int pos = calcSliderPos((int)(time * ff_rew_scaling), desc);
         osd->StartPause(pos, slidertype, scaleString, desc, 2);
     }
 
-    activenvp->FastForward(fftime * ff_rew_scaling);
+    activenvp->FastForward(time * ff_rew_scaling);
 }
 
-void TV::DoRew(void)
+void TV::DoRew(int time)
 {
     bool slidertype = false;
     if (internalState == kState_WatchingLiveTV)
@@ -1356,11 +1358,11 @@
     if (activenvp == nvp)
     {
         QString desc = "";
-        int pos = calcSliderPos(0 - (int)(rewtime * ff_rew_scaling), desc);
+        int pos = calcSliderPos(0 - (int)(time * ff_rew_scaling), desc);
         osd->StartPause(pos, slidertype, scaleString, desc, 2);
     }
 
-    activenvp->Rewind(rewtime * ff_rew_scaling);
+    activenvp->Rewind(time * ff_rew_scaling);
 }
 
 void TV::DoJumpAhead(void)
Index: libs/libmythtv/tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.32
diff -u -r1.32 tv_play.h
--- libs/libmythtv/tv_play.h	16 Jun 2003 02:51:25 -0000	1.32
+++ libs/libmythtv/tv_play.h	19 Jun 2003 03:58:48 -0000
@@ -110,8 +110,8 @@
 
     void DoInfo(void);
     void DoPause(void);
-    void DoFF(void);
-    void DoRew(void);
+    void DoFF(int time);
+    void DoRew(int time);
     void DoJumpAhead(void);
     void DoJumpBack(void);
     void DoSkipCommercials(int direction);
@@ -175,9 +175,8 @@
     int fftime;
     int rewtime;
     int stickykeys;
-    bool doing_ff;
-    bool doing_rew;
+    int doing_ff_rew;
     int ff_rew_index;
     float ff_rew_scaling;
 


More information about the mythtv-dev mailing list