summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwr61 <wr61@e10066b5-e1e2-0310-b819-94efdf66514b>2005-02-26 12:14:52 +0000
committerwr61 <wr61@e10066b5-e1e2-0310-b819-94efdf66514b>2005-02-26 12:14:52 +0000
commit85f2d81ff76906b6a042ad38b9a6c52206ab4de7 (patch)
tree15e53f1cbe8fac9e1911d537cea009a56717a768
parent8a51780b2992357ca083eaebd28269acc359d047 (diff)
downloadvdr-plugin-muggle-85f2d81ff76906b6a042ad38b9a6c52206ab4de7.tar.gz
vdr-plugin-muggle-85f2d81ff76906b6a042ad38b9a6c52206ab4de7.tar.bz2
framework for incremental filter
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/branches/0.1.3-wr@511 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r--mg_actions.c13
-rw-r--r--mg_actions.h8
-rw-r--r--vdr_menu.c32
-rw-r--r--vdr_menu.h7
4 files changed, 43 insertions, 17 deletions
diff --git a/mg_actions.c b/mg_actions.c
index 2100205..fcbf5ee 100644
--- a/mg_actions.c
+++ b/mg_actions.c
@@ -43,6 +43,12 @@ class mgOsdItem : public mgAction, public cOsdItem
};
+void
+mgAction::setHandle(unsigned int handle)
+{
+ m_handle = handle;
+}
+
eOSState
mgAction::ProcessKey(eKeys key)
{
@@ -208,8 +214,9 @@ mgAction::Enabled(mgActions on)
mgAction::mgAction()
{
- m = NULL;
- m_osd = NULL;
+ m = 0;
+ m_osd = 0;
+ m_handle = 0;
IgnoreNextEvent = false;
}
@@ -304,7 +311,7 @@ mgAction::Back()
void
mgEntry::Notify()
{
- selection()->setPosition(osd()->Current());
+ selection()->setPosition(m_handle);
selection()->gotoPosition();
osd()->SaveState();
mgAction::Notify(); // only after selection is updated
diff --git a/mg_actions.h b/mg_actions.h
index 3994b10..1763b15 100644
--- a/mg_actions.h
+++ b/mg_actions.h
@@ -137,6 +137,12 @@ class mgAction
* or in muggle ?
*/
bool IgnoreNextEvent;
+
+ /*! \brief defines a reference. Can be used depending on the
+ * concrete class type. Currently used only by mgEntry
+ */
+ void setHandle(unsigned int handle);
+
protected:
//! \brief returns the OSD owning the menu owning this item
@@ -157,6 +163,8 @@ class mgAction
virtual void Notify();
eOSState ProcessKey(eKeys key);
virtual eOSState Process(eKeys key) { return osUnknown; }
+
+ unsigned int m_handle;
private:
mgMainMenu *m_osd;
};
diff --git a/vdr_menu.c b/vdr_menu.c
index 50eef84..4789eb3 100644
--- a/vdr_menu.c
+++ b/vdr_menu.c
@@ -496,7 +496,18 @@ mgMenu::AddSelectionItems (mgSelection *sel,mgActions act)
{
mgAction *a = GenerateAction(act, actEntry);
if (!a) continue;
- a->SetText(a->MenuName(i+1,sel->values[i]),false);
+ const char *name = a->MenuName(i+1,sel->values[i]);
+ // add incremental filter here
+#if 0
+ // example:
+ if (name[0]!='C')
+ continue;
+#endif
+ // adapt newposition since it refers to position in mgSelection:
+ if ((signed int)i==osd()->newposition)
+ osd()->newposition = osd()->Count();
+ a->SetText(name,false);
+ a->setHandle(i);
osd()->AddItem(a);
}
if (osd()->ShowingCollections ())
@@ -800,7 +811,7 @@ otherkeys:
forcerefresh = false;
if (newposition<0)
newposition = selection()->gotoPosition();
- Menus.back ()->Display (newposition);
+ Menus.back ()->Display ();
}
pr_exit:
showMessage();
@@ -847,7 +858,8 @@ mgMainMenu::AddMenu (mgMenu * m,unsigned int position)
m->setParentIndex(Current());
if (Get(Current()))
m->setParentName(Get(Current())->Text());
- m->Display (position);
+ newposition = position;
+ m->Display ();
}
void
@@ -977,13 +989,13 @@ mgTreeRemoveFromCollSelector::mgTreeRemoveFromCollSelector(string title)
}
void
-mgMainMenu::DisplayGoto (unsigned int select)
+mgMainMenu::DisplayGoto ()
{
- if (select >= 0)
+ if (newposition >= 0)
{
- if ((int)select>=Count())
- select = Count() -1;
- SetCurrent (Get (select));
+ if ((int)newposition>=Count())
+ newposition = Count() -1;
+ SetCurrent (Get (newposition));
RefreshCurrent ();
}
Display ();
@@ -991,9 +1003,9 @@ mgMainMenu::DisplayGoto (unsigned int select)
void
-mgMenu::Display (const unsigned int position)
+mgMenu::Display ()
{
BuildOsd ();
- osd ()->DisplayGoto (position);
+ osd ()->DisplayGoto ();
}
diff --git a/vdr_menu.h b/vdr_menu.h
index 17df308..f34c071 100644
--- a/vdr_menu.h
+++ b/vdr_menu.h
@@ -157,9 +157,8 @@ class mgMainMenu:public cOsdMenu
string play_collection;
/*! \brief selects a certain line on the OSD and displays the OSD
- * \param select the line that we want to be selected
*/
- void DisplayGoto (unsigned int select);
+ void DisplayGoto ();
//! \brief external commands
cCommands *external_commands;
@@ -306,8 +305,8 @@ class mgMenu
//! \brief clears the screen, sets a title and the hotkey flag
void InitOsd (const char *title,const bool hashotkeys=true);
-//! \brief display OSD and go to position
- void Display (const unsigned int position);
+//! \brief display OSD and go to osd()->newposition
+ void Display ();
//! \brief BuildOsd() should be abstract but then we cannot compile
virtual void BuildOsd ()