MythTV  master
TokenGroup.cpp
Go to the documentation of this file.
1 /* TokenGroup.cpp
2 
3  Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  as published by the Free Software Foundation; either version 2
8  of the License, or (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18  Or, point your browser to http://www.gnu.org/copyleft/gpl.html
19 
20 */
21 
22 
23 #include "TokenGroup.h"
24 
25 #include <algorithm>
26 
27 #include "Presentable.h"
28 #include "Ingredients.h"
29 #include "Root.h"
30 #include "BaseClasses.h"
31 #include "ParseNode.h"
32 #include "ASN1Codes.h"
33 #include "Engine.h"
34 
36 {
37  // A pair consisting of an object reference and an optional action slot sequence.
38  m_Object.Initialise(p->GetSeqN(0), engine);
39 
40  if (p->GetSeqCount() > 1)
41  {
42  MHParseNode *pSlots = p->GetSeqN(1);
43 
44  for (int i = 0; i < pSlots->GetSeqCount(); i++)
45  {
46  MHParseNode *pAct = pSlots->GetSeqN(i);
47  auto *pActions = new MHActionSequence;
48  m_ActionSlots.Append(pActions);
49 
50  // The action slot entry may be NULL.
51  if (pAct->m_nNodeType != MHParseNode::PNNull)
52  {
53  pActions->Initialise(pAct, engine);
54  }
55  }
56  }
57 }
58 
59 void MHTokenGroupItem::PrintMe(FILE *fd, int nTabs) const
60 {
61  PrintTabs(fd, nTabs);
62  fprintf(fd, "( ");
63  m_Object.PrintMe(fd, nTabs + 1);
64  fprintf(fd, "\n");
65 
66  if (m_ActionSlots.Size() != 0)
67  {
68  PrintTabs(fd, nTabs + 1);
69  fprintf(fd, ":ActionSlots (\n");
70 
71  for (int i = 0; i < m_ActionSlots.Size(); i++)
72  {
73  PrintTabs(fd, nTabs + 2);
74  fprintf(fd, "( // slot %d\n", i);
75  MHActionSequence *pActions = m_ActionSlots.GetAt(i);
76 
77  if (pActions->Size() == 0)
78  {
79  PrintTabs(fd, nTabs + 2);
80  fprintf(fd, "NULL\n");
81  }
82  else
83  {
84  pActions->PrintMe(fd, nTabs + 2);
85  }
86 
87  PrintTabs(fd, nTabs + 2);
88  fprintf(fd, ")\n");
89  }
90 
91  PrintTabs(fd, nTabs + 1);
92  fprintf(fd, ")\n");
93  }
94 
95  PrintTabs(fd, nTabs);
96  fprintf(fd, ")\n");
97 }
98 
100 {
101  for (int i = 0; i < p->GetSeqCount(); i++)
102  {
103  m_movement.Append(p->GetSeqN(i)->GetIntValue());
104  }
105 }
106 
107 void MHMovement::PrintMe(FILE *fd, int nTabs) const
108 {
109  PrintTabs(fd, nTabs);
110  fprintf(fd, "( ");
111 
112  for (int i = 0; i < m_movement.Size(); i++)
113  {
114  fprintf(fd, "%d ", m_movement.GetAt(i));
115  }
116 
117  fprintf(fd, ")\n");
118 }
119 
121 {
122  MHPresentable::Initialise(p, engine);
123  MHParseNode *pMovements = p->GetNamedArg(C_MOVEMENT_TABLE);
124 
125  if (pMovements)
126  {
127  for (int i = 0; i < pMovements->GetArgCount(); i++)
128  {
129  auto *pMove = new MHMovement;
130  m_movementTable.Append(pMove);
131  pMove->Initialise(pMovements->GetArgN(i), engine);
132  }
133  }
134 
135  MHParseNode *pTokenGrp = p->GetNamedArg(C_TOKEN_GROUP_ITEMS);
136 
137  if (pTokenGrp)
138  {
139  for (int i = 0; i < pTokenGrp->GetArgCount(); i++)
140  {
141  auto *pToken = new MHTokenGroupItem;
142  m_tokenGrpItems.Append(pToken);
143  pToken->Initialise(pTokenGrp->GetArgN(i), engine);
144  }
145  }
146 
147  MHParseNode *pNoToken = p->GetNamedArg(C_NO_TOKEN_ACTION_SLOTS);
148 
149  if (pNoToken)
150  {
151  for (int i = 0; i < pNoToken->GetArgCount(); i++)
152  {
153  MHParseNode *pAct = pNoToken->GetArgN(i);
154  auto *pActions = new MHActionSequence;
155  m_noTokenActionSlots.Append(pActions);
156 
157  // The action slot entry may be NULL.
158  if (pAct->m_nNodeType != MHParseNode::PNNull)
159  {
160  pActions->Initialise(pAct, engine);
161  }
162  }
163  }
164 }
165 
166 // This is used to print the contents of the token group.
167 void MHTokenGroup::PrintContents(FILE *fd, int nTabs) const
168 {
169  MHPresentable::PrintMe(fd, nTabs + 1);
170 
171  if (m_movementTable.Size() != 0)
172  {
173  PrintTabs(fd, nTabs + 1);
174  fprintf(fd, ":MovementTable (\n");
175 
176  for (int i = 0; i < m_movementTable.Size(); i++)
177  {
178  m_movementTable.GetAt(i)->PrintMe(fd, nTabs + 2);
179  }
180 
181  PrintTabs(fd, nTabs + 1);
182  fprintf(fd, ")\n");
183  }
184 
185  if (m_tokenGrpItems.Size() != 0)
186  {
187  PrintTabs(fd, nTabs + 1);
188  fprintf(fd, ":TokenGroupItems (\n");
189 
190  for (int i = 0; i < m_tokenGrpItems.Size(); i++)
191  {
192  m_tokenGrpItems.GetAt(i)->PrintMe(fd, nTabs + 2);
193  }
194 
195  PrintTabs(fd, nTabs + 1);
196  fprintf(fd, ")\n");
197  }
198 
199  if (m_noTokenActionSlots.Size() != 0)
200  {
201  PrintTabs(fd, nTabs + 1);
202  fprintf(fd, ":NoTokenActionSlots (\n");
203 
204  for (int i = 0; i < m_noTokenActionSlots.Size(); i++)
205  {
207 
208  if (pActions->Size() == 0)
209  {
210  PrintTabs(fd, nTabs + 2);
211  fprintf(fd, "NULL ");
212  }
213  else
214  {
215  pActions->PrintMe(fd, nTabs + 2);
216  }
217  }
218 
219  PrintTabs(fd, nTabs + 1);
220  fprintf(fd, ")\n");
221  }
222 
223 }
224 
225 void MHTokenGroup::PrintMe(FILE *fd, int nTabs) const
226 {
227  PrintTabs(fd, nTabs);
228  fprintf(fd, "{:TokenGroup ");
229  PrintContents(fd, nTabs);
230  PrintTabs(fd, nTabs);
231  fprintf(fd, "}\n");
232 }
233 
234 // Activate the token group following the standard.
236 {
237  if (m_fRunning)
238  {
239  return;
240  }
241 
243 
244  // We're supposed to apply Activation to each of the "items" but it isn't clear
245  // exactly what that means. Assume it means each of the visibles.
246  for (int i = 0; i < m_tokenGrpItems.Size(); i++)
247  {
248  MHObjectRef *pObject = &m_tokenGrpItems.GetAt(i)->m_Object;
249 
250  // The object reference may be the null reference.
251  // Worse: it seems that sometimes in BBC's MHEG the reference simply doesn't exist.
252  if (pObject->IsSet())
253  {
254  try
255  {
256  engine->FindObject(m_tokenGrpItems.GetAt(i)->m_Object)->Activation(engine);
257  }
258  catch (...)
259  {
260  }
261  }
262  }
263 
265  m_fRunning = true;
266  engine->EventTriggered(this, EventIsRunning);
267 }
268 
270 {
271  if (! m_fRunning)
272  {
273  return;
274  }
275 
278 }
279 
280 // Internal function to generate the appropriate events.
281 void MHTokenGroup::TransferToken(int newPos, MHEngine *engine)
282 {
283  if (newPos != m_nTokenPosition)
284  {
286  m_nTokenPosition = newPos;
288  }
289 }
290 
291 // Perform the actions depending on where the token is.
293 {
294  if (m_nTokenPosition == 0) // No slot has the token.
295  {
296  if (n > 0 && n <= m_noTokenActionSlots.Size())
297  {
298  engine->AddActions(*(m_noTokenActionSlots.GetAt(n - 1)));
299  }
300  }
301  else
302  {
304  {
306 
307  if (n > 0 && n <= pGroup->m_ActionSlots.Size())
308  {
309  engine->AddActions(*(pGroup->m_ActionSlots.GetAt(n - 1)));
310  }
311  }
312  }
313 }
314 
315 void MHTokenGroup::Move(int n, MHEngine *engine)
316 {
317  if (m_nTokenPosition == 0 || n < 1 || n > m_movementTable.Size())
318  {
319  TransferToken(0, engine); // Not in the standard
320  }
321  else
322  {
324  }
325 }
326 
327 // ListGroup. This is a complex class and the description was extensively revised in the MHEG corrigendum.
328 // It doesn't seem to be used a great deal in practice and quite a few of the actions haven't been tested.
329 
331 {
332  while (!m_itemList.isEmpty())
333  {
334  delete m_itemList.takeFirst();
335  }
336 }
337 
339 {
340  MHTokenGroup::Initialise(p, engine);
341  MHParseNode *pPositions = p->GetNamedArg(C_POSITIONS);
342 
343  if (pPositions)
344  {
345  for (int i = 0; i < pPositions->GetArgCount(); i++)
346  {
347  MHParseNode *pPos = pPositions->GetArgN(i);
348  QPoint pos(pPos->GetSeqN(0)->GetIntValue(), pPos->GetSeqN(1)->GetIntValue());
349  m_positions.Append(pos);
350  }
351  }
352 
353  MHParseNode *pWrap = p->GetNamedArg(C_WRAP_AROUND);
354 
355  if (pWrap)
356  {
357  m_fWrapAround = pWrap->GetArgN(0)->GetBoolValue();
358  }
359 
360  MHParseNode *pMultiple = p->GetNamedArg(C_WRAP_AROUND);
361 
362  if (pMultiple)
363  {
364  m_fMultipleSelection = pMultiple->GetArgN(0)->GetBoolValue();
365  }
366 }
367 
368 void MHListGroup::PrintMe(FILE *fd, int nTabs) const
369 {
370  PrintTabs(fd, nTabs);
371  fprintf(fd, "{:ListGroup ");
372  MHTokenGroup::PrintContents(fd, nTabs);
373  PrintTabs(fd, nTabs + 1);
374  fprintf(fd, ":Positions (");
375 
376  for (int i = 0; i < m_positions.Size(); i++)
377  {
378  fprintf(fd, " ( %d %d )", m_positions.GetAt(i).x(), m_positions.GetAt(i).y());
379  }
380 
381  fprintf(fd, ")\n");
382 
383  if (m_fWrapAround)
384  {
385  PrintTabs(fd, nTabs + 1);
386  fprintf(fd, ":WrapAround true\n");
387  }
388 
390  {
391  PrintTabs(fd, nTabs + 1);
392  fprintf(fd, ":MultipleSelection true\n");
393  }
394 
395  PrintTabs(fd, nTabs);
396  fprintf(fd, "}\n");
397 }
398 
400 {
402 
403  for (int i = 0; i < m_tokenGrpItems.Size(); i++)
404  {
405  // Find the item and add it to the list if it isn't already there.
406  try
407  {
408  MHRoot *pItem = engine->FindObject(m_tokenGrpItems.GetAt(i)->m_Object);
409  MHListItem *p = nullptr;
410 
411  for (auto *item : std::as_const(m_itemList))
412  {
413  p = item;
414 
415  if (p->m_pVisible == pItem)
416  {
417  break;
418  }
419  }
420 
421  if (!p)
422  {
423  m_itemList.append(new MHListItem(pItem));
424  }
425  }
426  catch (...) // Ignore invalid or null objects.
427  {
428  }
429  }
430 }
431 
433 {
434  // Reset the positions of the visibles.
435  for (auto *item : std::as_const(m_itemList))
436  item->m_pVisible->ResetPosition();
437 
439 }
440 
442 {
444  MHTokenGroup::Activation(engine);
445  Update(engine);
446 }
447 
448 
450 {
451  // Deactivate the visibles.
452  for (auto *item : std::as_const(m_itemList))
453  item->m_pVisible->Deactivation(engine);
454 
456 }
457 
458 // Update action - set the position of the cells to be displayed and deactivate those
459 // which aren't.
461 {
462  if (m_itemList.isEmpty()) // Special cases when the list becomes empty
463  {
465  {
466  m_fFirstItemDisplayed = false;
467  engine->EventTriggered(this, EventFirstItemPresented, false);
468  }
469 
471  {
472  m_fLastItemDisplayed = false;
473  engine->EventTriggered(this, EventLastItemPresented, false);
474  }
475  }
476  else // Usual case.
477  {
478  for (int i = 0; i < m_itemList.size(); i++)
479  {
480  MHRoot *pVis = m_itemList.at(i)->m_pVisible;
481  int nCell = i + 1 - m_nFirstItem; // Which cell does this item map onto?
482 
483  if (nCell >= 0 && nCell < m_positions.Size())
484  {
485  if (i == 0 && ! m_fFirstItemDisplayed)
486  {
487  m_fFirstItemDisplayed = true;
488  engine->EventTriggered(this, EventFirstItemPresented, true);
489  }
490 
491  if (i == m_itemList.size() - 1 && ! m_fLastItemDisplayed)
492  {
493  m_fLastItemDisplayed = true;
494  engine->EventTriggered(this, EventLastItemPresented, true);
495  }
496 
497  try
498  {
499  pVis->SetPosition(m_positions.GetAt(i - m_nFirstItem + 1).x(), m_positions.GetAt(i - m_nFirstItem + 1).y(), engine);
500  }
501  catch (...) {}
502 
503  if (! pVis->GetRunningStatus())
504  {
505  pVis->Activation(engine);
506  }
507  }
508  else
509  {
510  if (i == 0 && m_fFirstItemDisplayed)
511  {
512  m_fFirstItemDisplayed = false;
513  engine->EventTriggered(this, EventFirstItemPresented, false);
514  }
515 
516  if (i == m_itemList.size() - 1 && m_fLastItemDisplayed)
517  {
518  m_fLastItemDisplayed = false;
519  engine->EventTriggered(this, EventLastItemPresented, false);
520  }
521 
522  if (pVis->GetRunningStatus())
523  {
524  pVis->Deactivation(engine);
525  pVis->ResetPosition();
526  }
527  }
528  }
529  }
530 
531  // Generate the HeadItems and TailItems events. Even in the MHEG corrigendum this is unclear.
532  // I'm not at all sure this is right.
534  {
536  }
537 
539  {
540  engine->EventTriggered(this, EventTailItems,
541 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
542  (m_itemList.size()) - m_nFirstItem);
543 #else
544  static_cast<int>(m_itemList.size()) - m_nFirstItem);
545 #endif
546  }
547 
548  m_nLastCount = m_itemList.size();
550 }
551 
552 // Add an item to the list
553 void MHListGroup::AddItem(int nIndex, MHRoot *pItem, MHEngine *engine)
554 {
555  // See if the item is already there and ignore this if it is.
556  for (auto *item : std::as_const(m_itemList))
557  {
558  if (item->m_pVisible == pItem)
559  {
560  return;
561  }
562  }
563 
564  // Ignore this if the index is out of range
565  if (nIndex < 1 || nIndex > m_itemList.size() + 1)
566  {
567  return;
568  }
569 
570  // Insert it at the appropriate position (MHEG indexes count from 1).
571  m_itemList.insert(nIndex - 1, new MHListItem(pItem));
572 
573  if (nIndex <= m_nFirstItem && m_nFirstItem < m_itemList.size())
574  {
575  m_nFirstItem++;
576  }
577 
578  Update(engine); // Apply the update behaviour
579 }
580 
581 // Remove an item from the list
582 void MHListGroup::DelItem(MHRoot *pItem, MHEngine * /*engine*/)
583 {
584  // See if the item is already there and ignore this if it is.
585  for (int i = 0; i < m_itemList.size(); i++)
586  {
587  if (m_itemList.at(i)->m_pVisible == pItem) // Found it - remove it from the list and reset the posn.
588  {
589  delete m_itemList.takeAt(i);
590  pItem->ResetPosition();
591 
592  if (i + 1 < m_nFirstItem && m_nFirstItem > 1)
593  {
594  m_nFirstItem--;
595  }
596 
597  return;
598  }
599  }
600 }
601 
602 // Set the selection status of the item to true
603 void MHListGroup::Select(int nIndex, MHEngine *engine)
604 {
605  MHListItem *pListItem = m_itemList.at(nIndex - 1);
606 
607  if (pListItem == nullptr || pListItem->m_fSelected)
608  {
609  return; // Ignore if already selected.
610  }
611 
612  if (! m_fMultipleSelection)
613  {
614  // Deselect any existing selections.
615  for (int i = 0; i < m_itemList.size(); i++)
616  {
617  if (m_itemList.at(i)->m_fSelected)
618  {
619  Deselect(i + 1, engine);
620  }
621  }
622  }
623 
624  pListItem->m_fSelected = true;
625  engine->EventTriggered(this, EventItemSelected, nIndex);
626 }
627 
628 // Set the selection status of the item to false
629 void MHListGroup::Deselect(int nIndex, MHEngine *engine)
630 {
631  MHListItem *pListItem = m_itemList.at(nIndex - 1);
632 
633  if (pListItem == nullptr || ! pListItem->m_fSelected)
634  {
635  return; // Ignore if not selected.
636  }
637 
638  pListItem->m_fSelected = false;
639  engine->EventTriggered(this, EventItemDeselected, nIndex);
640 }
641 
642 // Return the reference to the visible at the particular position.
643 void MHListGroup::GetCellItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine)
644 {
645  nCell = std::clamp(nCell, 1, m_positions.Size());
646 
647  int nVisIndex = nCell + m_nFirstItem - 2;
648 
649  if (nVisIndex >= 0 && nVisIndex < m_itemList.size())
650  {
651  MHRoot *pVis = m_itemList.at(nVisIndex)->m_pVisible;
652  engine->FindObject(itemDest)->SetVariableValue(pVis->m_ObjectReference);
653  }
654  else
655  {
656  engine->FindObject(itemDest)->SetVariableValue(MHObjectRef::Null);
657  }
658 }
659 
660 int MHListGroup::AdjustIndex(int nIndex) // Added in the MHEG corrigendum
661 {
662  int nItems = m_itemList.size();
663 
664  if (nItems == 0)
665  {
666  return 1;
667  }
668 
669  if (nIndex > nItems)
670  {
671  return ((nIndex - 1) % nItems) + 1;
672  }
673  if (nIndex < 0)
674  {
675  return nItems - ((-nIndex) % nItems);
676  }
677  return nIndex;
678 }
679 
680 void MHListGroup::GetListItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine)
681 {
682  if (m_fWrapAround)
683  {
684  nCell = AdjustIndex(nCell);
685  }
686 
687  if (nCell < 1 || nCell > m_itemList.size())
688  {
689  return; // Ignore it if it's out of range and not wrapping
690  }
691 
692  engine->FindObject(itemDest)->SetVariableValue(m_itemList.at(nCell - 1)->m_pVisible->m_ObjectReference);
693 }
694 
695 void MHListGroup::GetItemStatus(int nCell, const MHObjectRef &itemDest, MHEngine *engine)
696 {
697  if (m_fWrapAround)
698  {
699  nCell = AdjustIndex(nCell);
700  }
701 
702  if (nCell < 1 || nCell > m_itemList.size())
703  {
704  return;
705  }
706 
707  engine->FindObject(itemDest)->SetVariableValue(m_itemList.at(nCell - 1)->m_fSelected);
708 }
709 
710 void MHListGroup::SelectItem(int nCell, MHEngine *engine)
711 {
712  if (m_fWrapAround)
713  {
714  nCell = AdjustIndex(nCell);
715  }
716 
717  if (nCell < 1 || nCell > m_itemList.size())
718  {
719  return;
720  }
721 
722  Select(nCell, engine);
723 }
724 
725 void MHListGroup::DeselectItem(int nCell, MHEngine *engine)
726 {
727  if (m_fWrapAround)
728  {
729  nCell = AdjustIndex(nCell);
730  }
731 
732  if (nCell < 1 || nCell > m_itemList.size())
733  {
734  return;
735  }
736 
737  Deselect(nCell, engine);
738 }
739 
740 void MHListGroup::ToggleItem(int nCell, MHEngine *engine)
741 {
742  if (m_fWrapAround)
743  {
744  nCell = AdjustIndex(nCell);
745  }
746 
747  if (nCell < 1 || nCell > m_itemList.size())
748  {
749  return;
750  }
751 
752  if (m_itemList.at(nCell - 1)->m_fSelected)
753  {
754  Deselect(nCell, engine);
755  }
756  else
757  {
758  Select(nCell, engine);
759  }
760 }
761 
762 void MHListGroup::ScrollItems(int nCell, MHEngine *engine)
763 {
764  nCell += m_nFirstItem;
765 
766  if (m_fWrapAround)
767  {
768  nCell = AdjustIndex(nCell);
769  }
770 
771  if (nCell < 1 || nCell > m_itemList.size())
772  {
773  return;
774  }
775 
776  m_nFirstItem = nCell;
777  Update(engine);
778 }
779 
780 void MHListGroup::SetFirstItem(int nCell, MHEngine *engine)
781 {
782  if (m_fWrapAround)
783  {
784  nCell = AdjustIndex(nCell);
785  }
786 
787  if (nCell < 1 || nCell > m_itemList.size())
788  {
789  return;
790  }
791 
792  m_nFirstItem = nCell;
793  Update(engine);
794 }
795 
796 
797 
798 // Actions
800 {
801  MHElemAction::Initialise(p, engine);
802  m_index.Initialise(p->GetArgN(1), engine);
803  m_item.Initialise(p->GetArgN(2), engine);
804 }
805 
806 void MHAddItem::PrintArgs(FILE *fd, int /*nTabs*/) const
807 {
808  m_index.PrintMe(fd, 0);
809  m_item.PrintMe(fd, 0);
810 }
811 
813 {
814  MHObjectRef item;
815  m_item.GetValue(item, engine);
816  Target(engine)->AddItem(m_index.GetValue(engine), engine->FindObject(item), engine);
817 }
818 
820 {
821  MHElemAction::Initialise(p, engine);
822  m_index.Initialise(p->GetArgN(1), engine);
823  m_result.Initialise(p->GetArgN(2), engine);
824 }
825 
826 void MHGetListActionData::PrintArgs(FILE *fd, int /*nTabs*/) const
827 {
828  m_index.PrintMe(fd, 0);
829  m_result.PrintMe(fd, 0);
830 }
MHRoot::Activation
virtual void Activation(MHEngine *engine)
Definition: Root.cpp:70
MHObjectRef
Definition: BaseClasses.h:153
MHParseNode::m_nNodeType
enum NodeType m_nNodeType
Definition: ParseNode.h:46
MHListGroup::m_positions
MHSequence< QPoint > m_positions
Definition: TokenGroup.h:143
MHListGroup::Select
void Select(int nIndex, MHEngine *engine)
Definition: TokenGroup.cpp:603
MHTokenGroup::Deactivation
void Deactivation(MHEngine *engine) override
Definition: TokenGroup.cpp:269
Presentable.h
MHObjectRef::Initialise
void Initialise(MHParseNode *p, MHEngine *engine)
Definition: BaseClasses.cpp:263
MHTokenGroup::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: TokenGroup.cpp:225
MHRoot::GetRunningStatus
virtual bool GetRunningStatus()
Definition: Root.h:77
MHMovement::Initialise
void Initialise(MHParseNode *p, MHEngine *engine)
Definition: TokenGroup.cpp:99
EventItemDeselected
@ EventItemDeselected
Definition: Root.h:39
MHRoot::ResetPosition
virtual void ResetPosition()
Definition: Root.h:172
MHRoot::Deactivation
virtual void Deactivation(MHEngine *engine)
Definition: Root.cpp:86
MHIngredient::Preparation
void Preparation(MHEngine *engine) override
Definition: Ingredients.cpp:160
MHTokenGroup::m_noTokenActionSlots
MHOwnPtrSequence< MHActionSequence > m_noTokenActionSlots
Definition: TokenGroup.h:85
ASN1Codes.h
MHEngine
Definition: Engine.h:72
MHListGroup::m_fFirstItemDisplayed
bool m_fFirstItemDisplayed
Definition: TokenGroup.h:149
MHParseNode::GetIntValue
int GetIntValue()
Definition: ParseNode.cpp:170
MHTokenGroup::Activation
void Activation(MHEngine *engine) override
Definition: TokenGroup.cpp:235
MHParseNode::GetSeqN
MHParseNode * GetSeqN(int n)
Definition: ParseNode.cpp:152
MHListItem::m_fSelected
bool m_fSelected
Definition: TokenGroup.h:98
MHListGroup::m_fMultipleSelection
bool m_fMultipleSelection
Definition: TokenGroup.h:145
MHIngredient::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Ingredients.cpp:50
MHRoot::SetPosition
virtual void SetPosition(int, int, MHEngine *)
Definition: Root.h:158
MHTokenGroup::TransferToken
void TransferToken(int newPos, MHEngine *engine)
Definition: TokenGroup.cpp:281
MHAddItem::PrintArgs
void PrintArgs(FILE *fd, int) const override
Definition: TokenGroup.cpp:806
MHTokenGroup::Move
void Move(int n, MHEngine *engine) override
Definition: TokenGroup.cpp:315
MHGenericInteger::Initialise
void Initialise(MHParseNode *p, MHEngine *engine)
Definition: BaseClasses.cpp:382
MHListGroup::Activation
void Activation(MHEngine *engine) override
Definition: TokenGroup.cpp:441
MHMovement
Definition: TokenGroup.h:49
MHListGroup::ScrollItems
void ScrollItems(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:762
MHObjectRef::Null
static MHObjectRef Null
Definition: BaseClasses.h:159
EventItemSelected
@ EventItemSelected
Definition: Root.h:39
MHTokenGroup::CallActionSlot
void CallActionSlot(int n, MHEngine *engine) override
Definition: TokenGroup.cpp:292
MHRoot::SetVariableValue
virtual void SetVariableValue(const MHUnion &)
Definition: Root.h:109
MHAddItem::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:799
MHTokenGroup::m_movementTable
MHOwnPtrSequence< MHMovement > m_movementTable
Definition: TokenGroup.h:83
MHElemAction::Initialise
virtual void Initialise(MHParseNode *p, MHEngine *engine)
Definition: BaseActions.cpp:31
MHListGroup::DeselectItem
void DeselectItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:725
MHListGroup::Destruction
void Destruction(MHEngine *engine) override
Definition: TokenGroup.cpp:432
MHListGroup::~MHListGroup
~MHListGroup() override
Definition: TokenGroup.cpp:330
MHListGroup::SelectItem
void SelectItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:710
MHListGroup::Deselect
void Deselect(int nIndex, MHEngine *engine)
Definition: TokenGroup.cpp:629
MHListGroup::GetCellItem
void GetCellItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine) override
Definition: TokenGroup.cpp:643
mythburn.FILE
int FILE
Definition: mythburn.py:139
MHObjectRef::IsSet
bool IsSet() const
Definition: BaseClasses.h:164
MHRoot::m_fRunning
bool m_fRunning
Definition: Root.h:253
MHRoot::m_ObjectReference
MHObjectRef m_ObjectReference
Definition: Root.h:248
MHGenericObjectRef::Initialise
void Initialise(MHParseNode *p, MHEngine *engine)
Definition: BaseClasses.cpp:518
MHTokenGroupItem::Initialise
void Initialise(MHParseNode *p, MHEngine *engine)
Definition: TokenGroup.cpp:35
MHListGroup::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:338
MHListItem
Definition: TokenGroup.h:94
MHEngine::EventTriggered
void EventTriggered(MHRoot *pSource, enum EventType ev)
Definition: Engine.h:94
MHTokenGroupItem::m_ActionSlots
MHOwnPtrSequence< MHActionSequence > m_ActionSlots
Definition: TokenGroup.h:46
MHListGroup::ToggleItem
void ToggleItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:740
MHParseNode::PNNull
@ PNNull
Definition: ParseNode.h:41
MHGetListActionData::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:819
hardwareprofile.config.p
p
Definition: config.py:33
MHAddItem::Perform
void Perform(MHEngine *engine) override
Definition: TokenGroup.cpp:812
MHParseNode::GetSeqCount
int GetSeqCount()
Definition: ParseNode.cpp:141
ParseNode.h
MHListGroup::m_fWrapAround
bool m_fWrapAround
Definition: TokenGroup.h:144
C_WRAP_AROUND
@ C_WRAP_AROUND
Definition: ASN1Codes.h:110
PrintTabs
void PrintTabs(FILE *fd, int n)
Definition: ParseNode.cpp:34
EventTailItems
@ EventTailItems
Definition: Root.h:39
MHMovement::m_movement
MHSequence< int > m_movement
Definition: TokenGroup.h:54
MHParseNode::GetArgN
MHParseNode * GetArgN(int n)
Definition: ParseNode.cpp:78
MHIngredient::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: Ingredients.cpp:108
EventIsRunning
@ EventIsRunning
Definition: Root.h:34
MHEngine::FindObject
MHRoot * FindObject(const MHObjectRef &oRef, bool failOnNotFound=true)
Definition: Engine.cpp:573
MHListGroup::GetListItem
void GetListItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine) override
Definition: TokenGroup.cpp:680
MHListGroup::m_fLastItemDisplayed
bool m_fLastItemDisplayed
Definition: TokenGroup.h:150
MHListGroup::AdjustIndex
int AdjustIndex(int nIndex)
Definition: TokenGroup.cpp:660
MHGetListActionData::m_result
MHObjectRef m_result
Definition: TokenGroup.h:216
MHTokenGroup::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:120
MHListGroup::m_itemList
QList< MHListItem * > m_itemList
Definition: TokenGroup.h:147
Engine.h
MHListGroup::Update
void Update(MHEngine *engine)
Definition: TokenGroup.cpp:460
clamp
static eu8 clamp(eu8 value, eu8 low, eu8 high)
Definition: pxsup2dast.c:204
C_NO_TOKEN_ACTION_SLOTS
@ C_NO_TOKEN_ACTION_SLOTS
Definition: ASN1Codes.h:108
MHTokenGroupItem
Definition: TokenGroup.h:39
MHGetListActionData::m_index
MHGenericInteger m_index
Definition: TokenGroup.h:215
MHListGroup::m_nLastFirstItem
int m_nLastFirstItem
Definition: TokenGroup.h:152
Ingredients.h
C_TOKEN_GROUP_ITEMS
@ C_TOKEN_GROUP_ITEMS
Definition: ASN1Codes.h:107
MHListGroup::SetFirstItem
void SetFirstItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:780
MHElemAction::Target
MHRoot * Target(MHEngine *engine)
Definition: BaseActions.cpp:46
MHParseNode::GetArgCount
int GetArgCount()
Definition: ParseNode.cpp:60
C_POSITIONS
@ C_POSITIONS
Definition: ASN1Codes.h:109
MHTokenGroup::m_tokenGrpItems
MHOwnPtrSequence< MHTokenGroupItem > m_tokenGrpItems
Definition: TokenGroup.h:84
MHEngine::AddActions
void AddActions(const MHActionSequence &actions)
Definition: Engine.cpp:723
C_MOVEMENT_TABLE
@ C_MOVEMENT_TABLE
Definition: ASN1Codes.h:106
MHListGroup::Preparation
void Preparation(MHEngine *engine) override
Definition: TokenGroup.cpp:399
MHParseNode::GetBoolValue
bool GetBoolValue()
Definition: ParseNode.cpp:192
Root.h
MHTokenGroup::PrintContents
void PrintContents(FILE *fd, int nTabs) const
Definition: TokenGroup.cpp:167
EventHeadItems
@ EventHeadItems
Definition: Root.h:39
MHMovement::PrintMe
void PrintMe(FILE *fd, int nTabs) const
Definition: TokenGroup.cpp:107
MHGetListActionData::PrintArgs
void PrintArgs(FILE *fd, int) const override
Definition: TokenGroup.cpp:826
MHAddItem::m_item
MHGenericObjectRef m_item
Definition: TokenGroup.h:197
MHAddItem::m_index
MHGenericInteger m_index
Definition: TokenGroup.h:196
TokenGroup.h
BaseClasses.h
MHActionSequence
Definition: Actions.h:28
MHListGroup::m_nLastCount
int m_nLastCount
Definition: TokenGroup.h:151
MHSequence::Size
int Size() const
Definition: BaseClasses.h:47
MHListGroup::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: TokenGroup.cpp:368
MHParseNode
Definition: ParseNode.h:38
MHActionSequence::PrintMe
virtual void PrintMe(FILE *fd, int nTabs) const
Definition: Actions.cpp:456
MHIngredient::Destruction
void Destruction(MHEngine *engine) override
Definition: Ingredients.cpp:176
MHGenericInteger::GetValue
int GetValue(MHEngine *engine) const
Definition: BaseClasses.cpp:411
MHListGroup::Deactivation
void Deactivation(MHEngine *engine) override
Definition: TokenGroup.cpp:449
MHRoot::AddItem
virtual void AddItem(int, MHRoot *, MHEngine *)
Definition: Root.h:139
EventTokenMovedFrom
@ EventTokenMovedFrom
Definition: Root.h:36
MHSequence::GetAt
BASE GetAt(int i) const
Definition: BaseClasses.h:49
EventLastItemPresented
@ EventLastItemPresented
Definition: Root.h:38
MHSequence::Append
void Append(BASE b)
Definition: BaseClasses.h:64
MHGenericInteger::PrintMe
void PrintMe(FILE *fd, int nTabs) const
Definition: BaseClasses.cpp:397
MHGenericObjectRef::GetValue
void GetValue(MHObjectRef &ref, MHEngine *engine) const
Definition: BaseClasses.cpp:547
EventTokenMovedTo
@ EventTokenMovedTo
Definition: Root.h:36
MHTokenGroup::m_nTokenPosition
int m_nTokenPosition
Definition: TokenGroup.h:88
MHTokenGroupItem::PrintMe
void PrintMe(FILE *fd, int nTabs) const
Definition: TokenGroup.cpp:59
MHListGroup::AddItem
void AddItem(int nIndex, MHRoot *pItem, MHEngine *engine) override
Definition: TokenGroup.cpp:553
MHListGroup::m_nFirstItem
int m_nFirstItem
Definition: TokenGroup.h:148
MHListGroup::DelItem
void DelItem(MHRoot *pItem, MHEngine *engine) override
Definition: TokenGroup.cpp:582
MHGenericObjectRef::PrintMe
void PrintMe(FILE *fd, int nTabs) const
Definition: BaseClasses.cpp:533
EventFirstItemPresented
@ EventFirstItemPresented
Definition: Root.h:38
MHObjectRef::PrintMe
void PrintMe(FILE *fd, int nTabs) const
Definition: BaseClasses.cpp:284
MHTokenGroupItem::m_Object
MHObjectRef m_Object
Definition: TokenGroup.h:45
MHListGroup::GetItemStatus
void GetItemStatus(int nCell, const MHObjectRef &itemDest, MHEngine *engine) override
Definition: TokenGroup.cpp:695
MHRoot
Definition: Root.h:44