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);