Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: ANNOUNCE: vdr-osdteletext-0.1



On Wed, 5 Feb 2003 22:34:51 +0100, Marcel Wiesweg
<marcel.wiesweg@gmx.de> wrote:

> I sometimes thought that I'd like to quickly look up some things in the 
> teletext without losing picture and sound.
> So I have written a plugin that displays teletext directly on the OSD.
> It is an add-on to the teletext plugin (uses much of the code of this great 
> plugin), and you need to have the teletext plugin loaded additionally.
> 
> It is available from
> http://www.wiesweg-online.de/linux/vdr/vdr-osdteletext-0.1.tgz
> 
> It provides a zoom feature (blue key) and a half page OSD feature (yellow 
> key).

Here is a patch which improves navigation by cursor keys within the
available pages:

diff -Naur osdteletext-0.1.orig/menu.c osdteletext/menu.c
--- osdteletext-0.1.orig/menu.c 2003-02-04 19:46:33.000000000 +0100
+++ osdteletext/menu.c  2003-02-09 00:33:36.000000000 +0100
@@ -38,6 +38,62 @@
    DisplayClose();
 }

+void TeletextBrowser::ChangePageRelativ(int count)
+{
+   int oldpage = currentPage;
+
+   do  {
+     currentPage += count;
+     if (currentPage>899) currentPage=100;
+     if (currentPage<100) currentPage=899;
+     // sub page is always 0 if you change the site
+     currentSubPage=0;
+again:
+     if (CheckPage())
+       return;
+
+     if (currentPage == 100 && currentSubPage == 0)  {
+       currentSubPage=1;
+       goto again;
+     }
+   } while (currentPage != oldpage);
+
+   currentSubPage=0;
+   return;
+}
+
+void TeletextBrowser::ChangeSubPageRelativ(int count)
+{
+ int oldsubpage = currentSubPage;
+
+ // Add something to the sub page
+ // Only allowed if your cursor pos at the startup
+ do  {
+     currentSubPage += count;
+     if (currentSubPage > 99) currentSubPage=0;
+     if (currentSubPage < 0) currentSubPage=99;
+
+     if (CheckPage())
+       return;
+   } while (currentSubPage != oldsubpage);
+
+   return;
+}
+
+bool TeletextBrowser::CheckPage()
+{
+ char str[80];
+ FILE *fd;
+
+  sprintf(str, "%s/%0d/%3d_%02d.vtx", TXTROOT, channelNumber,
currentPage,
+               currentSubPage);
+  if (!(fd=fopen(str,"rb")))
+        return false;
+
+  fclose(fd);
+  return true;
+}
+
 void TeletextBrowser::Show(void) {
    DisplayOpen(2, mode);
    ShowPage();
@@ -62,8 +118,7 @@
       case k0: SetNumber(0);break;
       case kBack: return osEnd;
       case kUp:
-         currentPage++;
-         currentSubPage=0;
+        ChangePageRelativ(1);
          if (mode==ZoomLower)
             mode=ZoomUpper;
          if (mode==HalfLower)
@@ -72,8 +127,7 @@
          ShowPageNumber();
          break;
       case kDown:
-         currentPage--;
-         currentSubPage=0;
+        ChangePageRelativ(-1);
          if (mode==ZoomLower)
             mode=ZoomUpper;
          if (mode==HalfLower)
@@ -82,7 +136,7 @@
          ShowPageNumber();
          break;
       case kRight:
-         currentSubPage++;
+        ChangeSubPageRelativ(1);
          if (mode==ZoomLower)
             mode=ZoomUpper;
          if (mode==HalfLower)
@@ -91,7 +145,7 @@
          ShowPageNumber();
          break;
       case kLeft:
-         currentSubPage--;
+         ChangeSubPageRelativ(-1);
          if (mode==ZoomLower)
             mode=ZoomUpper;
          if (mode==HalfLower)
diff -Naur osdteletext-0.1.orig/menu.h osdteletext/menu.h
--- osdteletext-0.1.orig/menu.h 2003-01-31 19:38:48.000000000 +0100
+++ osdteletext/menu.h  2003-02-09 00:33:36.000000000 +0100
@@ -26,6 +26,9 @@
    virtual eOSState ProcessKey(eKeys Key);
    int channelNumber;
 private:
+   void ChangePageRelativ(int i);
+   void ChangeSubPageRelativ(int i);
+   bool CheckPage();
    void SetNumber(int i);
    void ShowPage();
    bool DecodePage();

Enjoy,

Emil


--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index