[ANNOUNCE] vdr-iaxphone-0.0.3 - a softphone for vdr

Message ID 42F610BE.7020202@ventoso.org
State New
Headers

Commit Message

Luca Olivetti Aug. 7, 2005, 1:46 p.m. UTC
  Luca Olivetti wrote:

> 
> - Reworked the osd (using own cStatusMenu class instead of cOsdMenu, the
>   former reserves some lines on top to show status information)

Btw, if you could do something like the following patch I wouldn't need 
to reimplement the whole cOsdMenu in my plugin ;-)

Bye
  

Comments

Klaus Schmidinger Aug. 7, 2005, 2 p.m. UTC | #1
Luca Olivetti wrote:
> Luca Olivetti wrote:
> 
>>
>> - Reworked the osd (using own cStatusMenu class instead of cOsdMenu, the
>>   former reserves some lines on top to show status information)
> 
> 
> Btw, if you could do something like the following patch I wouldn't need 
> to reimplement the whole cOsdMenu in my plugin ;-)
> 
> Bye
> 
> 
> ------------------------------------------------------------------------
> 
> diff --unified --recursive orig/osdbase.c new/osdbase.c
> --- orig/osdbase.c	2005-08-04 16:07:10.745702589 +0200
> +++ new/osdbase.c	2005-08-05 10:05:49.449609914 +0200
> @@ -67,7 +67,7 @@
>  int cOsdMenu::displayMenuCount = 0;
>  int cOsdMenu::displayMenuItems = 0;//XXX dynamic???
>  
> -cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
> +cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4, int res)
>  {
>    isMenu = true;
>    digit = 0;
> @@ -77,6 +77,7 @@
>    SetCols(c0, c1, c2, c3, c4);
>    first = 0;
>    current = marked = -1;
> +  reserved = res;
>    subMenu = NULL;
>    helpRed = helpGreen = helpYellow = helpBlue = NULL;
>    status = NULL;
> @@ -84,6 +85,7 @@
>       displayMenu = Skins.Current()->DisplayMenu();
>       displayMenuItems = displayMenu->MaxItems();
>       }
> +  displayMenuItems -= reserved;   
>  }
>  
>  cOsdMenu::~cOsdMenu()
> @@ -93,6 +95,7 @@
>    free(status);
>    displayMenu->Clear();
>    cStatus::MsgOsdClear();
> +  displayMenuItems += reserved;
>    if (!--displayMenuCount)
>       DELETENULL(displayMenu);
>  }
> @@ -121,6 +124,13 @@
>    cols[4] = c4;
>  }
>  
> +void cOsdMenu::SetReserved(int res)
> +{
> +  displayMenuItems += reserved;
> +  reserved = res;
> +  displayMenuItems -= reserved;
> +}
> +
>  void cOsdMenu::SetHasHotkeys(void)
>  {
>    hasHotkeys = true;
> @@ -207,10 +217,12 @@
>          if (first < 0)
>             first = 0;
>          }
> +     //text2skin doesn't cope well with out of order menu items   

Am I getting this right? You want me to make this change because
text2skin doesn't behave correctly?

Klaus

> +     if(reserved) for (int kk=0; kk<reserved; kk++) displayMenu->SetItem("",kk,false,false);
>       int i = first;
>       int n = 0;
>       for (cOsdItem *item = Get(first); item; item = Next(item)) {
> -         displayMenu->SetItem(item->Text(), i - first, i == current, item->Selectable());
> +         displayMenu->SetItem(item->Text(), i - first + reserved, i == current, item->Selectable());
>           if (i == current)
>              cStatus::MsgOsdCurrentItem(item->Text());
>           if (++n == displayMenuItems)
> @@ -238,7 +250,7 @@
>  {
>    cOsdItem *item = Get(current);
>    if (item) {
> -     displayMenu->SetItem(item->Text(), current - first, Current, item->Selectable());
> +     displayMenu->SetItem(item->Text(), current - first + reserved, Current, item->Selectable());
>       if (Current)
>          cStatus::MsgOsdCurrentItem(item->Text());
>       if (!Current)
> diff --unified --recursive orig/osdbase.h new/osdbase.h
> --- orig/osdbase.h	2005-08-04 16:07:10.745702589 +0200
> +++ new/osdbase.h	2005-08-04 16:04:28.254938058 +0200
> @@ -89,7 +89,7 @@
>    static int displayMenuItems;
>    char *title;
>    int cols[cSkinDisplayMenu::MaxTabs];
> -  int first, current, marked;
> +  int first, current, marked, reserved;
>    cOsdMenu *subMenu;
>    const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
>    char *status;
> @@ -99,6 +99,7 @@
>    cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; }
>    const char *hk(const char *s);
>    void SetCols(int c0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
> +  void SetReserved(int res);
>    void SetHasHotkeys(void);
>    virtual void Clear(void);
>    bool SelectableItem(int idx);
> @@ -119,7 +120,7 @@
>    void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
>    virtual void Del(int Index);
>  public:
> -  cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
> +  cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0, int res=0);
>    virtual ~cOsdMenu();
>    int Current(void) { return current; }
>    void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
  
Luca Olivetti Aug. 7, 2005, 2:06 p.m. UTC | #2
Klaus Schmidinger wrote:
> 
> Am I getting this right? You want me to make this change because
> text2skin doesn't behave correctly?

No, I want to keep some lines reserved at the top of the display, so I 
can use them for status information (e.g. while the remaining lines 
would scroll, the reserved ones won't, in fact they won't be touched by 
cOsdBase at all, only by descendent classes). However this change 
doesn't work well with text2skin since it doesn't respect the Index 
parameter in the SetItem call after a Clear()  :-(
At the moment I just copied the whole cOsdMenu implementation in my 
plugin (calling it cStatusMenu) making the changes in this patch 
(basically adding a "reserved" field).

Bye
  
Klaus Schmidinger Aug. 7, 2005, 2:09 p.m. UTC | #3
Luca Olivetti wrote:
> Klaus Schmidinger wrote:
> 
>>
>> Am I getting this right? You want me to make this change because
>> text2skin doesn't behave correctly?
> 
> 
> No, I want to keep some lines reserved at the top of the display, so I 
> can use them for status information (e.g. while the remaining lines 
> would scroll, the reserved ones won't, in fact they won't be touched by 
> cOsdBase at all, only by descendent classes). However this change 
> doesn't work well with text2skin since it doesn't respect the Index 
> parameter in the SetItem call after a Clear()  :-(
> At the moment I just copied the whole cOsdMenu implementation in my 
> plugin (calling it cStatusMenu) making the changes in this patch 
> (basically adding a "reserved" field).

Well, I guess then a first step would be to fix text2skin to make
it behave as it is supposed to.

Klaus
  
Luca Olivetti Aug. 7, 2005, 2:15 p.m. UTC | #4
Klaus Schmidinger wrote:

> Well, I guess then a first step would be to fix text2skin to make
> it behave as it is supposed to.

sure, that's why I reported this problem earlier this week.

Bye
  
Luca Olivetti Aug. 7, 2005, 2:19 p.m. UTC | #5
Luca Olivetti wrote:
> Klaus Schmidinger wrote:
> 
>> Well, I guess then a first step would be to fix text2skin to make
>> it behave as it is supposed to.
> 
> 
> sure, that's why I reported this problem earlier this week.

OTOH text2skin appears to work fine with current cOsdMenu 
implementation, since it always call SetItem sequentially starting from 
Index 0.
I smell a chicken and egg problem here ;-)

Bye
  
Klaus Schmidinger Aug. 7, 2005, 2:23 p.m. UTC | #6
Luca Olivetti wrote:
> Luca Olivetti wrote:
> 
>> Klaus Schmidinger wrote:
>>
>>> Well, I guess then a first step would be to fix text2skin to make
>>> it behave as it is supposed to.
>>
>>
>>
>> sure, that's why I reported this problem earlier this week.
> 
> 
> OTOH text2skin appears to work fine with current cOsdMenu 
> implementation, since it always call SetItem sequentially starting from 
> Index 0.
> I smell a chicken and egg problem here ;-)

cSkinDisplayMenu:

   virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable) = 0;
        ///< Sets the item at the given Index to Text...

There is no place where it says that the SetItem() calls are made in
any particular sequence. A cSkinDisplayMenu has to dispay the given item
at position Index, no matter which calls were before this one, or will come
after it.

Klaus
  

Patch

diff --unified --recursive orig/osdbase.c new/osdbase.c
--- orig/osdbase.c	2005-08-04 16:07:10.745702589 +0200
+++ new/osdbase.c	2005-08-05 10:05:49.449609914 +0200
@@ -67,7 +67,7 @@ 
 int cOsdMenu::displayMenuCount = 0;
 int cOsdMenu::displayMenuItems = 0;//XXX dynamic???
 
-cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
+cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4, int res)
 {
   isMenu = true;
   digit = 0;
@@ -77,6 +77,7 @@ 
   SetCols(c0, c1, c2, c3, c4);
   first = 0;
   current = marked = -1;
+  reserved = res;
   subMenu = NULL;
   helpRed = helpGreen = helpYellow = helpBlue = NULL;
   status = NULL;
@@ -84,6 +85,7 @@ 
      displayMenu = Skins.Current()->DisplayMenu();
      displayMenuItems = displayMenu->MaxItems();
      }
+  displayMenuItems -= reserved;   
 }
 
 cOsdMenu::~cOsdMenu()
@@ -93,6 +95,7 @@ 
   free(status);
   displayMenu->Clear();
   cStatus::MsgOsdClear();
+  displayMenuItems += reserved;
   if (!--displayMenuCount)
      DELETENULL(displayMenu);
 }
@@ -121,6 +124,13 @@ 
   cols[4] = c4;
 }
 
+void cOsdMenu::SetReserved(int res)
+{
+  displayMenuItems += reserved;
+  reserved = res;
+  displayMenuItems -= reserved;
+}
+
 void cOsdMenu::SetHasHotkeys(void)
 {
   hasHotkeys = true;
@@ -207,10 +217,12 @@ 
         if (first < 0)
            first = 0;
         }
+     //text2skin doesn't cope well with out of order menu items   
+     if(reserved) for (int kk=0; kk<reserved; kk++) displayMenu->SetItem("",kk,false,false);
      int i = first;
      int n = 0;
      for (cOsdItem *item = Get(first); item; item = Next(item)) {
-         displayMenu->SetItem(item->Text(), i - first, i == current, item->Selectable());
+         displayMenu->SetItem(item->Text(), i - first + reserved, i == current, item->Selectable());
          if (i == current)
             cStatus::MsgOsdCurrentItem(item->Text());
          if (++n == displayMenuItems)
@@ -238,7 +250,7 @@ 
 {
   cOsdItem *item = Get(current);
   if (item) {
-     displayMenu->SetItem(item->Text(), current - first, Current, item->Selectable());
+     displayMenu->SetItem(item->Text(), current - first + reserved, Current, item->Selectable());
      if (Current)
         cStatus::MsgOsdCurrentItem(item->Text());
      if (!Current)
diff --unified --recursive orig/osdbase.h new/osdbase.h
--- orig/osdbase.h	2005-08-04 16:07:10.745702589 +0200
+++ new/osdbase.h	2005-08-04 16:04:28.254938058 +0200
@@ -89,7 +89,7 @@ 
   static int displayMenuItems;
   char *title;
   int cols[cSkinDisplayMenu::MaxTabs];
-  int first, current, marked;
+  int first, current, marked, reserved;
   cOsdMenu *subMenu;
   const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
   char *status;
@@ -99,6 +99,7 @@ 
   cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; }
   const char *hk(const char *s);
   void SetCols(int c0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
+  void SetReserved(int res);
   void SetHasHotkeys(void);
   virtual void Clear(void);
   bool SelectableItem(int idx);
@@ -119,7 +120,7 @@ 
   void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
   virtual void Del(int Index);
 public:
-  cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
+  cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0, int res=0);
   virtual ~cOsdMenu();
   int Current(void) { return current; }
   void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);