//------------------------------------------------------------------------------ // reformat() -- convert the numerical value into an ascii character string //------------------------------------------------------------------------------ void NumericReadout::reformat(const char* const example) { if (reformatter->convertNumber(example) != ReformatScanner::DataType::invalid) { setExample(example); base::utStrcpy(format,FORMAT_LENGTH,reformatter->getFormat()); postSign = reformatter->isPostSign(); redisplay(); } }
//------------------------------------------------------------------------------ // reformat() -- convert the numerical value into an ascii character string //------------------------------------------------------------------------------ void OctalReadout::reformat(const char* const example) { if (reformatter->convertOctal(example) != Reformat::invalid) { setExample(example); lcStrcpy(format,FORMAT_LENGTH,reformatter->getFormat()); postSign = reformatter->isPostSign(); redisplay(); } }
//------------------------------------------------------------------------------ // reformat() -- convert the numerical value into an ascii character string //------------------------------------------------------------------------------ void DirectionReadout::reformat(const char* const example) { DirMode results = reformatter->convertDirection(example); if (results != invalid) { setExample(example); lcStrcpy(format,FORMAT_LENGTH,reformatter->getFormat()); tmode = results; postSign = reformatter->isPostSign(); redisplay(); } }
KDvoid Controller::onNext ( CCObject* pSender ) { KDint nMax = sizeof ( l_aExamples ) / sizeof ( struct Example ); m_nIndex++; if ( m_nIndex == nMax ) { m_nIndex = 0; } setExample ( m_nIndex ); }
KDvoid Controller::onPrev ( CCObject* pSender ) { KDint nMax = sizeof ( l_aExamples ) / sizeof ( struct Example ); m_nIndex--; if ( m_nIndex < 0 ) { m_nIndex = nMax - 1; } setExample ( m_nIndex ); }
void AbstractParam::readParameters(const YAML::Node &yamlNode) { for ( YAML::const_iterator it = yamlNode.begin(); it != yamlNode.end(); ++it ) { std::string key = READ_NODE_AS_STRING(it->first); if (key == Keys::Description) setDescription(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Default) setDefaultValue(READ_NODE_AS_STRING(it->second)); else if (key == Keys::DisplayName) setDisplayName(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Example) setExample(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Maximum) setMaximum(READ_NODE_AS_LONG(it->second)); else if (key == Keys::Minimum) setMinimum(READ_NODE_AS_LONG(it->second)); else if (key == Keys::MaxLength) setMaxLength(READ_NODE_AS_INT(it->second)); else if (key == Keys::MinLength) setMinLength(READ_NODE_AS_INT(it->second)); else if (key == Keys::Pattern) setPattern(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Repeat) setRepeat(READ_NODE_AS_BOOL(it->second)); else if (key == Keys::Required) setRequired(READ_NODE_AS_BOOL(it->second)); else if (key == Keys::Type) setType(READ_NODE_AS_STRING(it->second)); else if (key == Keys::Enum) { YAML::Node enumNode = it->second; for ( YAML::const_iterator tt = enumNode.begin(); tt != enumNode.end(); ++tt ) setEnumeration(READ_NODE_AS_STRING(*tt)); } } }
KDvoid Controller::onRestart ( CCObject* pSender ) { setExample ( m_nIndex ); }
KDbool Controller::init ( KDvoid ) { g_pController = this; CCLayer::init ( ); const CCSize& tSize = CCDirector::sharedDirector ( )->getWinSize ( ); CCMenu* pMenu = CCMenu::create ( CCMenuItemImage::create ( "image/btn_prev_0.png" , "image/btn_prev_1.png" , this, menu_selector ( Controller::onPrev ) ), CCMenuItemImage::create ( "image/btn_restart_0.png", "image/btn_restart_1.png", this, menu_selector ( Controller::onRestart ) ), CCMenuItemImage::create ( "image/btn_next_0.png" , "image/btn_next_1.png" , this, menu_selector ( Controller::onNext ) ), KD_NULL ); do { CC_BREAK_IF ( !pMenu ); pMenu->setPosition ( ccp ( tSize.cx / 2, 35 ) ); pMenu->alignItemsHorizontally ( 50 ); this->addChild ( pMenu ); } while ( 0 ); m_pTitle = CCLabelTTF::create ( "", "font/Schwarzwald Regular.ttf", 34, CCSize ( tSize.cx - 20.f, 0 ), kCCTextAlignmentCenter ); do { CC_BREAK_IF ( !m_pTitle ); m_pTitle->setPosition ( ccp ( tSize.cx / 2, tSize.cy - 50 ) ); m_pTitle->setColor ( ccGREEN ); this->addChild ( m_pTitle ); } while ( 0 ); m_pSubTitle = CCLabelTTF::create ( "", "font/arial.ttf", 26, CCSize ( tSize.cx - 20.f, 0 ), kCCTextAlignmentCenter ); do { CC_BREAK_IF ( !m_pSubTitle ); m_pSubTitle->setPosition ( ccp ( tSize.cx / 2, tSize.cy - 100 ) ); m_pSubTitle->setColor ( ccYELLOW ); this->addChild ( m_pSubTitle ); } while ( 0 ); m_pMessage = CCLabelTTF::create ( "", "font/arial.ttf", 14, CCSize ( tSize.cx - 20.f, 190 ), kCCTextAlignmentLeft ); do { CC_BREAK_IF ( !m_pMessage ); m_pMessage->setAnchorPoint ( ccp ( 0, 0 ) ); m_pMessage->setPosition ( ccp ( 10.f, 60.f ) ); m_pMessage->setColor ( ccRED ); this->addChild ( m_pMessage ); } while ( 0 ); setShaderProgram ( CCShaderCache::sharedShaderCache ( )->programForKey ( kCCShader_PositionTexture ) ); glGenTextures ( 1, &m_uTexture ); ccGLBindTexture2D ( m_uTexture ); glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); m_nIndex = 0; m_pDrawFunc = KD_NULL; m_pExitFunc = KD_NULL; setExample ( 0 ); return KD_TRUE; }