void DebugFormClass::update(Genie &genie){

	//BMS
	if (channelsBuffer.isValueUpdated(CanID::BMS_STATUS)){
		updateString(genie, BMS_STATUS_STRING, channelsBuffer.getValueAsString(CanID::BMS_STATUS));
	}
	else{
		updateString(genie, BMS_STATUS_STRING, F("---"));
	}
	
	updateWidget(genie, GENIE_OBJ_LED_DIGITS, BATTERY_V_DIGITS, channelsBuffer.getValueAs<float>(CanID::PACK_VOLTAGE, 0) * 100.0);

	byte cell;
	for (int i = 0; i < CELLS_BARS_NUM; i++){
		cell = channelsBuffer.getValueAs<float>(CanID::BATTERY_CELL_0 + i, 0) / CELLS_MAX_VOLT * 100.0;
		updateWidget(genie, GENIE_OBJ_SPECTRUM, CELLS_BARS, ((i << 8) | cell));
	}
	
	//Driver
	byte map = channelsBuffer.getValueAs<byte>(CanID::MOTOR_MAP, INVALID_MAP);
	if (map != INVALID_MAP){
		updateWidget(genie, GENIE_OBJ_LED_DIGITS, DRIVER_MAP_DIGIT, map);
	}
	else{
		Log.e(MAPSEL_TAG) << F("Current map is invalid") << Endl;
	}
}
Example #2
0
WordCounts::WordCounts(QWidget* parent)
	: QScrollArea(parent), m_show_max(false)
{
	setBackgroundRole(QPalette::Mid);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	QWidget* contents = new QWidget(this);
	setWidget(contents);
	setWidgetResizable(true);

	QLabel* label = new QLabel(QString("<small><b>%1<br>%2</b></small>").arg(tr("Letters:"), tr("Found:")), contents);
	label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

	QHBoxLayout* layout = new QHBoxLayout(contents);
	layout->setSpacing(12);
	layout->addWidget(label);

	for (int i = 0; i < 26; ++i) {
		Group group;
		group.length = i;
		group.count = 0;
		group.max = 0;
		group.label = new QLabel(contents);
		group.label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
		group.label->setVisible(false);
		layout->addWidget(group.label);
		m_groups.append(group);
	}
	layout->addStretch();

	updateString();
	setMinimumHeight(contents->sizeHint().height() + horizontalScrollBar()->sizeHint().height());
}
Example #3
0
// time label
GameTimeLabel::GameTimeLabel(int _min, int _sec) {
	switch(Settings::getInstance()->theme) {
		case SettingsThemeHacker:
			fontName = std::string("FontCourierNew16");
			font = IGResourceManager::getInstance()->getFont(fontName);
			set(IGPoint(240,15), IGRect(180,30));
			setColor(107,247,100,255);
			break;
		case SettingsThemeDetective:
			fontName = std::string("FontCourierNew14");
			font = IGResourceManager::getInstance()->getFont(fontName);
			set(IGPoint(400,15), IGRect(100,30));
			setColor(0,0,0,196);
			break;
		case SettingsThemeEspionage:
			fontName = std::string("FontCourierNew18");
			font = IGResourceManager::getInstance()->getFont(fontName);
			set(IGPoint(290,18), IGRect(120,24));
			setColor(72,72,72,196);
			break;
	}
	z = 2;
	tag = SceneGameTagTimeLabel;

	// time
	min = _min;
	sec = _sec;
	updateString();

	// start
	start = s3eTimerGetMs();
	stop = false;
}
Example #4
0
void WordCounts::findWord(const QString& word)
{
	Q_ASSERT(word.length() < 26);
	Group& group = m_groups[word.length()];
	group.count++;
	updateString();
}
//----------------------------------------------------------------------------//
Size FormattedListboxTextItem::getPixelSize(void) const
{
	if (!d_owner) return Size(0, 0);

	updateString();

	return Size(d_formattedRenderedString->getHorizontalExtent(),
		d_formattedRenderedString->getVerticalExtent());
}
void VectorProperty::updateFromChildren()
{
  if( !ignore_child_updates_ )
  {
    vector_.x = x_->getValue().toFloat();
    vector_.y = y_->getValue().toFloat();
    vector_.z = z_->getValue().toFloat();
    updateString();
    Q_EMIT changed();
  }
}
Example #7
0
void UIRichTextArea::update(const std::string& name,const std::string& content)
{
	for (CONTENTS_ITER iter = _contents.begin(); iter != _contents.end();++iter)
	{
		if (iter->name == name)
		{
			iter->content = content;
		}
	}
	 updateString(true);
}
Example #8
0
void QuaternionProperty::updateFromChildren()
{
  if( !ignore_child_updates_ )
  {
    quaternion_.x = x_->getValue().toFloat();
    quaternion_.y = y_->getValue().toFloat();
    quaternion_.z = z_->getValue().toFloat();
    quaternion_.w = w_->getValue().toFloat();
    updateString();
    Q_EMIT changed();
  }
}
Example #9
0
void GameTimeLabel::update() {
	if(stop)
		return;
	if(s3eTimerGetMs() - start >= 1000) {
		start = s3eTimerGetMs();
		sec++;
		if(sec == 60) {
			sec = 0;
			min++;
		}
		updateString();
	}
}
 ParameterGroupDataPrivate::~ParameterGroupDataPrivate( )
 {
   for ( ParameterGroupSpec::iterator it = getParameterGroupSpec()->beginParameterSpecs() ; it != getParameterGroupSpec()->endParameterSpecs() ; ++it )
   {
     if ( isParameterPointer( it->first ) )
     {
       size_t arraySize = std::max( 1u, it->first.getArraySize() );
       for ( size_t index = 0; index < arraySize; ++index )
       {
         updateString( it, index, nullptr );
       }
     }
   }
 }
Example #11
0
void WordCounts::setWords(const QStringList& words)
{
	for (int i = 0; i < 26; ++i) {
		Group& group = m_groups[i];
		group.count = 0;
		group.max = 0;
	}

	for (const QString& word : words) {
		Q_ASSERT(word.length() < 26);
		Group& group = m_groups[word.length()];
		group.max++;
	}

	updateString();
}
Example #12
0
int FloatBinding::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = DataBinding::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: updateInt((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: updateString((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 2: intChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: stringChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Example #13
0
bool QuaternionProperty::setQuaternion( const Ogre::Quaternion& new_quaternion )
{
  if( new_quaternion != quaternion_ ) {
    Q_EMIT aboutToChange();
    quaternion_ = new_quaternion;
    ignore_child_updates_ = true;
    x_->setValue( quaternion_.x );
    y_->setValue( quaternion_.y );
    z_->setValue( quaternion_.z );
    w_->setValue( quaternion_.w );
    ignore_child_updates_ = false;
    updateString();
    Q_EMIT changed();
    return true;
  }
  return false;
}
void Ut_MInputContext::testUpdatePreedit()
{
    WidgetStub widget(0);
    QList<QInputMethodEvent::Attribute> attributes;
    QInputMethodEvent event;
    QString updateString("preedit string");

    //test preedit with traditional style
    m_subject->setFocusWidget(&widget);
    gFocusedWidget = &widget;
    QList<MInputMethod::PreeditTextFormat> preeditFormats;
    MInputMethod::PreeditTextFormat preeditFormat(0, updateString.length(),
                                                  MInputMethod::PreeditDefault);
    preeditFormats << preeditFormat;
    m_subject->updatePreedit(updateString, preeditFormats, -1);

    waitAndProcessEvents(0);

    QCOMPARE(widget.inputMethodEventCount(), 1);
    event = widget.lastInputMethodEvent();
    QVERIFY(event.preeditString() == updateString);
    QVERIFY(event.commitString() == "");
    attributes = event.attributes();
    QVERIFY(attributes.count() > 0);

    //test preedit with alternate style
    preeditFormats.clear();
    preeditFormat.start = 0;
    preeditFormat.length = updateString.length();
    preeditFormat.preeditFace = MInputMethod::PreeditNoCandidates;
    preeditFormats << preeditFormat;
    m_subject->updatePreedit(updateString, preeditFormats, -1);

    waitAndProcessEvents(50);

    QCOMPARE(widget.inputMethodEventCount(), 2);
    event = widget.lastInputMethodEvent();
    QVERIFY(event.preeditString() == updateString);
    QVERIFY(event.commitString() == "");
    attributes = event.attributes();
    QVERIFY(attributes.count() > 0);

    gFocusedWidget = 0;
}
//----------------------------------------------------------------------------//
void FormattedListboxTextItem::draw(GeometryBuffer& buffer,
	const Rect& targetRect,
	float alpha, const Rect* clipper) const
{
	updateString();

	// draw selection imagery
	if (d_selected && d_selectBrush != 0)
		d_selectBrush->draw(buffer, targetRect, clipper,
		getModulateAlphaColourRect(d_selectCols, alpha));

	// factor the window alpha into our colours.
	const ColourRect final_colours(
		getModulateAlphaColourRect(ColourRect(0xFFFFFFFF), alpha));

	// draw the formatted text
	d_formattedRenderedString->draw(buffer, targetRect.getPosition(),
		&final_colours, clipper);
}
    void ParameterGroupDataPrivate::setParameter( dp::fx::ParameterGroupSpec::iterator it, const void * value )
    {
      DP_ASSERT( it != m_parameterGroupSpec->endParameterSpecs() );

      if ( isParameterPointer( it->first ) )
      {
        DP_ASSERT( it->first.getArraySize() == 0 );
        updateString( it, 0, reinterpret_cast<const char*>(value) );
      }
      else
      {
        unsigned int elementSize = it->first.getElementSizeInBytes();
        const char * charValue = reinterpret_cast<const char *>(value);
        unsigned int count = std::max( dp::checked_cast<unsigned int>(it->first.getArraySize()), (unsigned int)(1) );
        for ( unsigned int i=0 ; i<count ; i++ )
        {
          updateValue( it, i, charValue );
          charValue += elementSize;
        }
      }
    }
Example #17
0
QuaternionProperty::QuaternionProperty( const QString& name,
                                        const Ogre::Quaternion& default_value,
                                        const QString& description,
                                        Property* parent,
                                        const char *changed_slot,
                                        QObject* receiver )
  : Property( name, QVariant(), description, parent, changed_slot, receiver )
  , quaternion_( default_value )
  , ignore_child_updates_( false )
{
  x_ = new Property( "X", quaternion_.x, "X coordinate", this );
  y_ = new Property( "Y", quaternion_.y, "Y coordinate", this );
  z_ = new Property( "Z", quaternion_.z, "Z coordinate", this );
  w_ = new Property( "W", quaternion_.w, "W coordinate", this );
  updateString();
  connect( x_, SIGNAL( aboutToChange() ), this, SLOT( emitAboutToChange() ));
  connect( y_, SIGNAL( aboutToChange() ), this, SLOT( emitAboutToChange() ));
  connect( z_, SIGNAL( aboutToChange() ), this, SLOT( emitAboutToChange() ));
  connect( w_, SIGNAL( aboutToChange() ), this, SLOT( emitAboutToChange() ));
  connect( x_, SIGNAL( changed() ), this, SLOT( updateFromChildren() ));
  connect( y_, SIGNAL( changed() ), this, SLOT( updateFromChildren() ));
  connect( z_, SIGNAL( changed() ), this, SLOT( updateFromChildren() ));
  connect( w_, SIGNAL( changed() ), this, SLOT( updateFromChildren() ));
}
Example #18
0
void 
PropertyManager::updateGrid(wxPropertyGridManager *pg, nau::AttribSet &attribs, AttributeValues *attribVal) {

	std::map<std::string, std::unique_ptr<Attribute>> & attributes = attribs.getAttributes();

	pg->ClearSelection();

	for (auto &attrib : attributes) {

		std::unique_ptr<Attribute> &a = attrib.second;
		switch (a->getType()) {

		case Enums::ENUM: updateEnum(pg, a->getName(), attribVal->getPrope((AttributeValues::EnumProperty)a->getId())); break;
		case Enums::BOOL: updateBool(pg, a->getName(), attribVal->getPropb((AttributeValues::BoolProperty)a->getId())); break;
		case Enums::BVEC4: updateBVec4(pg, a->getName(), attribVal->getPropb4((AttributeValues::Bool4Property)a->getId())); break;
		case Enums::INT: updateInt(pg, a->getName(), attribVal->getPropi((AttributeValues::IntProperty)a->getId())); break;
		case Enums::IVEC3: updateIVec3(pg, a->getName(), attribVal->getPropi3((AttributeValues::Int3Property)a->getId())); break;
		case Enums::UINT: updateInt(pg, a->getName(), attribVal->getPropui((AttributeValues::UIntProperty)a->getId())); break;
		case Enums::UIVEC2: updateUIVec2(pg, a->getName(), attribVal->getPropui2((AttributeValues::UInt2Property)a->getId())); break;
		case Enums::UIVEC3: updateUIVec3(pg, a->getName(), attribVal->getPropui3((AttributeValues::UInt3Property)a->getId())); break;
		case Enums::FLOAT: updateFloat(pg, a->getName(), attribVal->getPropf((AttributeValues::FloatProperty)a->getId())); break;
		case Enums::VEC2: updateVec2(pg, a->getName(), attribVal->getPropf2((AttributeValues::Float2Property)a->getId())); break;
		case Enums::VEC3: updateVec3(pg, a->getName(), attribVal->getPropf3((AttributeValues::Float3Property)a->getId())); break;
		case Enums::VEC4: 
			if (a->getSemantics() == Attribute::Semantics::COLOR)
				updateVec4Color(pg, a->getName(), attribVal->getPropf4((AttributeValues::Float4Property)a->getId()));
			else
				updateVec4(pg, a->getName(), attribVal->getPropf4((AttributeValues::Float4Property)a->getId()));
			break;
		case Enums::MAT3: updateMat3(pg, a->getName(), attribVal->getPropm3((AttributeValues::Mat3Property)a->getId())); break;
		case Enums::MAT4: updateMat4(pg, a->getName(), attribVal->getPropm4((AttributeValues::Mat4Property)a->getId())); break;
		case Enums::STRING: updateString(pg, a->getName(), attribVal->getProps((AttributeValues::StringProperty)a->getId())); break;
		default: assert(false && "Missing datatype in property manager");
		}
	}
}
Example #19
0
int main(int argc, char **argv) {
    printf("                              \n");
    printf("------------------------------\n");
    printf("                              \n");

    int i = 0;
    printf("initial value = %d\n", i);
    update(&i);
    printf("final value = %d\n", i);

    printf("                              \n");
    printf("------------------------------\n");
    printf("                              \n");

    PAIR pair = { 0, 0 };
    printf("initial pair value = { %d, %d }\n", pair.x, pair.y);
    updatePair(&pair);
    printf("final pair value = { %d, %d }\n", pair.x, pair.y);

    printf("                              \n");
    printf("------------------------------\n");
    printf("                              \n");

    int aInt[5]; 
    memset(&aInt, 0, sizeof(aInt));
    printf("initial 1st element of array = %d\n", aInt[0]);
    printf("initial 5th element of array = %d\n", aInt[4]);
    updateArray(aInt);  // aInt is of type int *, therefore I should pass aInt itself, not the reference
    printf("final 1st element of array = %d\n", aInt[0]);
    printf("final 5th element of array = %d\n", aInt[4]);

    printf("                              \n");
    printf("------------------------------\n");
    printf("                              \n");

    char *str = "initial string";
    printf("initial str = %s\n", str);
    updateString(&str);
    printf("final str = %s\n", str);

    printf("                              \n");
    printf("------------------------------\n");
    printf("                              \n");

    int nbrPairs = 5;
    PAIR aPairs[nbrPairs];
    memset(&aPairs, 0, sizeof(aPairs));
    printf("aPairs[1].x = %d\n", aPairs[1].x);
    updateArrOfStructs(aPairs);
    printf("aPairs[1].x = %d\n", aPairs[1].x);

    printf("                              \n");
    printf("------------------------------\n");
    printf("                              \n");

    int *aEntries, numEntries = 0;
    updateDynamicArray(&aEntries, &numEntries);
    if (numEntries != 0) {
        printf("got %d entries\n", numEntries);
        int j;
        for (j = 0; j < numEntries; j++)
            printf("aEntries[%d] = %d\n", j, aEntries[j]);
    }


    exit(EXIT_SUCCESS);
}
Example #20
0
void WordCounts::setMaximumsVisible(bool visible)
{
	m_show_max = visible;
	updateString();
}
InputStrList::InputStrList( const QString & label, 
                            QWidget *parent, QStrList &sl, ListMode lm)
  : QWidget(parent), strList(sl)
{
  QGridLayout *layout = new QGridLayout( this, 2, 2, 5 );
  lab = new QLabel( label, this );
  lab->setMinimumSize( lab->sizeHint() );
  layout->addWidget( lab,0,0 );

  QWidget *dw = new QWidget(this); /* dummy widget used for layouting */
  QHBoxLayout *boxlayout = new QHBoxLayout( dw, 0, 5 );
  le  = new QLineEdit( dw );
  le->setMinimumSize( le->sizeHint() );
  boxlayout->addWidget( le, 1 );

  add = new QPushButton( dw );
  //add->setPixmap( QPixmap( add_xpm ));
  add->setText( "+" );
  add->setMinimumSize( add->sizeHint() );
  QToolTip::add(add,"Add item");
  boxlayout->addWidget( add );

  del = new QPushButton( dw );
  //del->setPixmap( QPixmap( del_xpm ));
  del->setText( "-" );
  del->setMinimumSize( del->sizeHint() );
  QToolTip::add(del,"Delete selected item");
  boxlayout->addWidget( del );

  upd = new QPushButton( dw ); 
  //upd->setPixmap( QPixmap( update_xpm ));
  upd->setText( "*" );
  upd->setMinimumSize( upd->sizeHint() );
  QToolTip::add(upd,"Update selected item");
  boxlayout->addWidget( upd );

  lb  = new QListBox( this );
  lb->setMinimumSize(400,100);
  init();
  lb->setVScrollBarMode(QScrollView::Auto);
  lb->setHScrollBarMode(QScrollView::Auto);

  brFile=0;
  brDir=0;
  if (lm!=ListString)
  {
    if (lm&ListFile)
    {
      brFile = new QPushButton(dw);
      //brFile->setPixmap( QPixmap(file_xpm) );
      brFile->setText("Select...");
      brFile->setMinimumSize(brFile->sizeHint());
      QToolTip::add(brFile,"Browse to a file");
      boxlayout->addWidget( brFile );
    } 
    if (lm&ListDir)
    {
      brDir = new QPushButton(dw);
      //brDir->setPixmap( QPixmap(folder_xpm) );
      brDir->setText("Select...");
      brDir->setMinimumSize(brDir->sizeHint());
      QToolTip::add(brDir,"Browse to a folder");
      boxlayout->addWidget( brDir );
    }
  }
  layout->addWidget( dw, 0,1 );
  layout->addWidget( lb,1,1 );
  layout->activate();
  setMinimumSize( sizeHint() );

  connect(le,   SIGNAL(returnPressed()), 
          this, SLOT(addString()) );
  connect(add,  SIGNAL(clicked()), 
          this, SLOT(addString()) );
  connect(del,  SIGNAL(clicked()), 
          this, SLOT(delString()) );
  connect(upd,  SIGNAL(clicked()), 
          this, SLOT(updateString()) );
  if (brFile)
  {
    connect(brFile, SIGNAL(clicked()),
            this, SLOT(browseFiles()));
  }
  if (brDir)
  {
    connect(brDir, SIGNAL(clicked()),
            this, SLOT(browseDir()));
  }
  connect(lb,   SIGNAL(selected(const QString &)), 
          this, SLOT(selectText(const QString &)));
}
Example #22
0
InputStrList::InputStrList( QGridLayout *layout,int &row,
                            const QString & id, 
                            const QStringList &sl, ListMode lm,
                            const QString & docs)
  : m_default(sl), m_strList(sl), m_docs(docs), m_id(id)
{
  m_lab = new HelpLabel( id );

  m_le  = new QLineEdit;
  m_le->clear();

  QToolBar *toolBar = new QToolBar;
  toolBar->setIconSize(QSize(24,24));
  m_add = toolBar->addAction(QIcon(QString::fromAscii(":/images/add.png")),QString(),
                             this,SLOT(addString()));
  m_add->setToolTip(tr("Add item"));
  m_del = toolBar->addAction(QIcon(QString::fromAscii(":/images/del.png")),QString(),
                             this,SLOT(delString()));
  m_del->setToolTip(tr("Delete selected item"));
  m_upd = toolBar->addAction(QIcon(QString::fromAscii(":/images/refresh.png")),QString(),
                             this,SLOT(updateString()));
  m_upd->setToolTip(tr("Update selected item"));

  m_lb  = new QListWidget;
  //m_lb->setMinimumSize(400,100);
  foreach (QString s, m_strList) m_lb->addItem(s);
  
  m_brFile=0;
  m_brDir=0;
  if (lm!=ListString)
  {
    if (lm&ListFile)
    {
      m_brFile = toolBar->addAction(QIcon(QString::fromAscii(":/images/file.png")),QString(),
                                    this,SLOT(browseFiles()));
      m_brFile->setToolTip(tr("Browse to a file"));
    } 
    if (lm&ListDir)
    {
      m_brDir = toolBar->addAction(QIcon(QString::fromAscii(":/images/folder.png")),QString(),
                                   this,SLOT(browseDir()));
      m_brDir->setToolTip(tr("Browse to a folder"));
    }
  }
  QHBoxLayout *rowLayout = new QHBoxLayout;
  rowLayout->addWidget( m_le );
  rowLayout->addWidget( toolBar );
  layout->addWidget( m_lab,      row,0 );
  layout->addLayout( rowLayout,  row,1,1,2 );
  layout->addWidget( m_lb,       row+1,1,1,2 );
  row+=2;

  m_value = m_strList;

  connect(m_le,   SIGNAL(returnPressed()), 
          this, SLOT(addString()) );
  connect(m_lb,   SIGNAL(currentTextChanged(const QString &)), 
          this, SLOT(selectText(const QString &)));
  connect( m_lab, SIGNAL(enter()), SLOT(help()) );
  connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
}
Example #23
0
LRESULT StringEditorWindow::Command(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	switch ( HIWORD(wParam) )
	{
	case LBN_SELCHANGE:
		if ( LOWORD(wParam) == LB_STRINGS ) // Change selection, update info boxes and so fourth
		{
			if ( currSelString != 0 )
				updateString(currSelString);

			currSelString = 0;
			listUsage.ClearItems();
			int lbIndex;
			if ( listStrings.GetCurSel(lbIndex) )
			{
				ChkdString str;
				if ( listStrings.GetItemData(lbIndex, currSelString) && chkd.maps.curr != nullptr &&
					chkd.maps.curr->GetString(str, currSelString) && str.length() > 0 )
				{
					editString.SetText(str.c_str());

					u32 locs, trigs, briefs, props, forces, wavs, units, switches;
					chkd.maps.curr->getStringUse(currSelString, locs, trigs, briefs, props, forces, wavs, units, switches);
					addUseItem("Locations", locs);
					addUseItem("Triggers", trigs);
					addUseItem("Briefing Triggers", briefs);
					addUseItem("Map Properties", props);
					addUseItem("Forces", forces);
					addUseItem("WAVs", wavs);
					addUseItem("Units", units);
					addUseItem("Switches", switches);
					chkd.mapSettingsWindow.SetTitle((std::string("Map Settings - [String #") +
						std::to_string(currSelString) + ']').c_str());
				}
				else
					chkd.mapSettingsWindow.SetTitle("Map Settings");
				return 0;
			}
			else
				chkd.mapSettingsWindow.SetTitle("Map Settings");
			editString.SetText("");
		}
		break;
	case LBN_KILLFOCUS: // String list box item may have lost focus, check if string should be updated
		if ( LOWORD(wParam) == LB_STRINGS && currSelString != 0 && updateString(currSelString) )
			chkd.maps.curr->refreshScenario();
		break;
	case EN_KILLFOCUS: // String edit box may have lost focus, check if string should be updated
		if ( LOWORD(wParam) == EDIT_STRING && currSelString != 0 && updateString(currSelString) )
			chkd.maps.curr->refreshScenario();
		break;
	case BN_CLICKED:
		if ( LOWORD(wParam) == DELETE_STRING  &&
			MessageBox(hWnd, "Forcefully deleting a string could cause problems, continue?", "Warning", MB_ICONEXCLAMATION | MB_YESNO) == IDYES &&
			chkd.maps.curr != nullptr && currSelString != 0 && chkd.maps.curr->stringExists(currSelString)
			)
		{
			chkd.maps.curr->forceDeleteString(currSelString);
			chkd.maps.curr->refreshScenario();
		}
		else if ( LOWORD(wParam) == SAVE_TO && chkd.maps.curr != nullptr )
			saveStrings();
		break;
	}
	return 0;
}
Example #24
0
LRESULT StringEditorWindow::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg )
	{
		case WM_SHOWWINDOW:
			if ( wParam == TRUE )
				RefreshWindow();
			else if ( wParam == FALSE )
				updateString(currSelString);
			break;

		case WM_MOUSEWHEEL:
			listStrings.SetTopIndex(listStrings.GetTopIndex()-(int((s16(HIWORD(wParam)))/WHEEL_DELTA)));
			break;

		case WM_PREMEASUREITEMS: // Measuring is time sensative, load necessary items for measuring all strings once
			stringListDC = listStrings.getDC();
			break;

		case WM_MEASUREITEM:
			{
				MEASUREITEMSTRUCT* mis = (MEASUREITEMSTRUCT*)lParam;
				RawString str;

				if ( chkd.maps.curr->GetString(str, mis->itemData) && str.size() > 0 &&
					 GetStringDrawSize(stringListDC, mis->itemWidth, mis->itemHeight, str) )
				{
					mis->itemWidth += 5;
					mis->itemHeight += 2;
				}
				return TRUE;
			}
			break;

		case WM_POSTMEASUREITEMS: // Release items loaded for measurement
			listStrings.ReleaseDC(stringListDC);
			stringListDC = NULL;
			break;

		case WM_PREDRAWITEMS:
			break;

		case WM_DRAWITEM:
			{
				PDRAWITEMSTRUCT pdis = (PDRAWITEMSTRUCT)lParam;
				bool isSelected = ((pdis->itemState&ODS_SELECTED) == ODS_SELECTED),
					 drawSelection = ((pdis->itemAction&ODA_SELECT) == ODA_SELECT),
					 drawEntire = ((pdis->itemAction&ODA_DRAWENTIRE) == ODA_DRAWENTIRE);

				if ( pdis->itemID != -1 && ( drawSelection || drawEntire ) )
				{	
					RawString str;
					if ( chkd.maps.curr != nullptr && chkd.maps.curr->GetString(str, pdis->itemData) && str.size() > 0 )
					{
						HBRUSH hBackground = CreateSolidBrush(RGB(0, 0, 0)); // Same color as in WM_CTLCOLORLISTBOX
						if ( hBackground != NULL )
						{
							FillRect(pdis->hDC, &pdis->rcItem, hBackground); // Draw far background
							DeleteObject(hBackground);
							hBackground = NULL;
						}
						SetBkMode(pdis->hDC, TRANSPARENT);
						DrawString(pdis->hDC, pdis->rcItem.left+3, pdis->rcItem.top+1, pdis->rcItem.right-pdis->rcItem.left,
							RGB(16, 252, 24), str);
					}
					if ( isSelected )
						DrawFocusRect(pdis->hDC, &pdis->rcItem);
				}
				return TRUE;
			}
			break;

		case WM_POSTDRAWITEMS:
			break;

		default:
			return ClassWindow::WndProc(hWnd, msg, wParam, lParam);
			break;
	}
	return 0;
}
void textInputRenderComponent::recieveMessage(msgType code) {
  
    if(code.compare("UPDATEPROMPT") == 0){
		updateString("> ");
    }
}
Example #26
0
 int updateText(const char* context, const char* key, const char* value=NULL, time_t expiration=0, int version=0) {
   return updateString(context, key, value, expiration, version);
 }