34 #define INITDATA(key, type, name) data[key] = dashData_t(type, name)
36 DashBoardManager::DashBoardManager(
void) : visible(true)
137 MyGUI::ResourceManager::getInstance().load(
"MyGUI_FontsDash.xml");
152 const char* s = str.c_str();
153 for (
int i = 0; i <
DD_MAX; i++)
155 if (!strcmp(
data[i].name, s))
163 if (
id > 0 &&
id <
DD_MAX)
202 switch (
data[key].type)
219 if (!d->getIsTextureLayer())
221 d->setVisible(visibility);
230 if (d->getIsTextureLayer())
232 d->setVisible(visibility,
false);
252 , mainWidget(nullptr)
253 , textureLayer(_textureLayer)
256 prefix = MyGUI::utility::toString(
this,
"_");
267 MyGUI::LayoutManager::getInstance().unloadLayout(
widgets);
269 MyGUI::ResourceManager::getInstance().removeByName(
filename);
296 if (fabs(val -
controls[i].last) < 0.02f)
347 String fn = String(
controls[i].texture) + String(
"-") +
TOSTRING((
int)val) + String(
".png");
349 if (fabs(val -
controls[i].last) < 0.2f)
359 if (fabs(val -
controls[i].last) < 0.2f)
389 if (fabs(val -
controls[i].last) < 0.2f)
407 if (fabs(val -
controls[i].last) < 0.2f)
414 s = Ogre::StringConverter::toString(val);
422 if (strcmp(tmp,
controls[i].format_neg_zero) == 0)
427 s = MyGUI::UString(tmp);
448 TexturePtr tex = TextureManager::getSingleton().getByName(
"RTTTexture1");
450 mainWidget->setSize(tex->getWidth(), tex->getHeight());
454 MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();
461 std::string name =
w->getName();
462 std::string anim =
w->getUserString(
"anim");
463 std::string debug =
w->getUserString(
"debug");
464 std::string linkArgs =
w->getUserString(
"link");
467 w->setUserString(
"interactive",
"0");
471 w->setVisible(
false);
476 if (name.size() >
prefix.size())
478 std::string prefixLessName = name.substr(
prefix.size());
479 if (prefixLessName ==
"_Main")
487 if (prefixLessName ==
"DEBUG")
489 w->setVisible(
false);
495 if (!linkArgs.empty())
498 memset(&ctrl, 0,
sizeof(ctrl));
501 strncpy(ctrl.
name, name.c_str(), 255);
505 ctrl.
last = 1337.1337f;
512 String linkName =
"";
513 if (linkArgs.empty())
515 LOG(
"Dashboard ("+
filename+
"/"+name+
"): empty Link");
520 if (linkArgs.find(
">") != linkArgs.npos)
522 Ogre::StringVector args = Ogre::StringUtil::split(linkArgs,
">");
523 if (args.size() == 2)
531 LOG(
"Dashboard ("+
filename+
"/"+name+
"): error in conditional Link: " + linkArgs);
535 else if (linkArgs.find(
"<") != linkArgs.npos)
537 Ogre::StringVector args = Ogre::StringUtil::split(linkArgs,
"<");
538 if (args.size() == 2)
546 LOG(
"Dashboard ("+
filename+
"/"+name+
"): error in conditional Link: " + linkArgs);
561 LOG(
"Dashboard ("+
filename+
"/"+name+
"): unknown Link: " + linkName);
569 ctrl.
wmin = StringConverter::parseReal(
w->getUserString(
"min"));
570 ctrl.
wmax = StringConverter::parseReal(
w->getUserString(
"max"));
571 ctrl.
vmin = StringConverter::parseReal(
w->getUserString(
"vmin"));
572 ctrl.
vmax = StringConverter::parseReal(
w->getUserString(
"vmax"));
574 String texture =
w->getUserString(
"texture");
575 if (!texture.empty())
576 strncpy(ctrl.
texture, texture.c_str(), 255);
578 String
format =
w->getUserString(
"format");
582 String direction =
w->getUserString(
"direction");
583 if (direction ==
"right")
585 else if (direction ==
"left")
587 else if (direction ==
"down")
589 else if (direction ==
"up")
591 else if (!direction.empty())
593 LOG(
"Dashboard ("+
filename+
"/"+name+
"): unknown direction: " + direction);
597 if (anim ==
"rotate")
613 ctrl.
rotImg =
w->getSubWidgetMain()->castType<MyGUI::RotatingSkin>();
617 LOG(
"Dashboard ("+
filename+
"/"+name+
"): Rotating controls must use the RotatingSkin");
622 LOG(
"Dashboard ("+
filename+
"/"+name+
"): error loading rotation control");
627 ctrl.
rotImg->setCenter(MyGUI::IntPoint(
w->getHeight() * 0.5f,
w->getWidth() * 0.5f));
629 else if (anim ==
"scale")
634 LOG(
"Dashboard ("+
filename+
"/"+name+
"): direction empty: scale needs a direction");
638 else if (anim ==
"translate")
643 LOG(
"Dashboard ("+
filename+
"/"+name+
"): direction empty: translate needs a direction");
647 else if (anim ==
"series")
650 ctrl.
img = (MyGUI::ImageBox *)
w;
653 LOG(
"Dashboard ("+
filename+
"/"+name+
"): error loading series control");
657 else if (anim ==
"textcolor" || anim ==
"textcolour")
664 ctrl.
txt = (MyGUI::TextBox *)
w;
668 LOG(
"Dashboard ("+
filename+
"/"+name+
"): textcolor controls must use the TextBox Control");
672 else if (anim ==
"textformat")
677 ctrl.
txt = (MyGUI::TextBox *)
w;
681 LOG(
"Dashboard ("+
filename+
"/"+name+
"): Lamp controls must use the ImageBox Control");
688 if (std::strlen(ctrl.
format))
693 else if (anim ==
"textstring")
698 ctrl.
txt = (MyGUI::TextBox *)
w;
702 LOG(
"Dashboard ("+
filename+
"/"+name+
"): Lamp controls must use the ImageBox Control");
707 else if (anim ==
"lamp")
724 ctrl.
img = (MyGUI::ImageBox *)
w;
727 LOG(
"Dashboard ("+
filename+
"/"+name+
"): error loading Lamp control");
742 MyGUI::EnumeratorWidgetPtr e =
w->getEnumerator();
753 for (MyGUI::VectorWidgetPtr::iterator iter =
widgets.begin(); iter !=
widgets.end(); ++iter)
769 for (MyGUI::VectorWidgetPtr::iterator iter =
widgets.begin(); iter !=
widgets.end(); ++iter)
771 (*iter)->setVisible(v);