Esempio n. 1
0
void FormModifyWeight::WtDataChanged(int nEvent, int nId)
{
    int nIndex = ui->tableWidget->currentRow();
    if(nIndex == -1)
    {
        nIndex = 0;
    }
    int i =0;
    //qDebug() << "id is " << nId;
    switch(nEvent)
    {
    case dccNewVeh:
        //在底部插入一行
        ui->tableWidget->insertRow(ui->tableWidget->rowCount());
        ui->tableWidget->selectRow(nIndex);
        changeData();
        break;
    case dccInsertVeh:
        ui->tableWidget->insertRow(nId - 1);
        ui->tableWidget->selectRow(nIndex);
        changeData();
        break;
    case dccSpitVeh:
        ui->tableWidget->insertRow(nId);
        ui->tableWidget->selectRow(nIndex);
        changeData();
        break;
    case dccModifyVeh:
        ui->tableWidget->selectRow(nIndex);
        changeData();
        break;
    case dccBackVeh:
    case dccDeleteVeh:
    case dccMergeVeh:
        for(i = 0; i < ui->tableWidget->rowCount(); i++)
        {
            if(ui->tableWidget->item(i, 0)->text().toInt() == nId)
            {
                ui->tableWidget->removeRow(i);
                break;
            }
        }
        changeData();
        break;
    default:
        break;

    }
}
/** The function acceptPressed() is called, if changes are accepted.
	You have to reimplement this function, if you add new properties.
	If you do so, then first call function changeData() and than changed data!
  */
void ConvertBoolFloatPropertyGeneralWidget::acceptPressed()
{
	ComponentPropertyGeneralWidget::acceptPressed();
	
	if (getComponent()->getTrueValue() != m_trueValue->value())
	{
		changeData();
		getComponent()->setTrueValue(m_trueValue->value());
	}
	if (getComponent()->getFalseValue() != m_falseValue->value())
	{
		changeData();
		getComponent()->setFalseValue(m_falseValue->value());
	}
}
/** The function acceptPressed() is called, if changes are accepted.
	You have to reimplement this function, if you add new properties.
	If you do so, then first call function changeData() and than changed data!
  */
void ConvertIntegerBool::PropertyGeneralWidget::acceptPressed()
{
	ComponentPropertyGeneralWidget::acceptPressed();
	
	if (getConvertIntegerBool()->getTrueThreshold() != m_trueThreshold->value())
	{
		changeData();
		getConvertIntegerBool()->setTrueThreshold(m_trueThreshold->value());
	}
	if (getConvertIntegerBool()->getFalseThreshold() != m_falseThreshold->value())
	{
		changeData();
		getConvertIntegerBool()->setFalseThreshold(m_falseThreshold->value());
	}
}
Esempio n. 4
0
void BooleanLedPropertyWidget::acceptPressed()
{
	ComponentPropertyBaseWidget::acceptPressed();

	if (((BooleanLed*)getComponent())->getOnColor() != m_onColor->color())
	{
		changeData();
		((BooleanLed*)getComponent())->setOnColor(m_onColor->color());
	}
	
	if (((BooleanLed*)getComponent())->getOffColor() != m_offColor->color())
	{
		changeData();
		((BooleanLed*)getComponent())->setOffColor(m_offColor->color());
	}
}
Esempio n. 5
0
int main(int argc, const char * argv[]) {
    char string[4] = "abc";
    demonstrateParentheses();
    count; // unused expression, compiles
    chooseLanguage(0);
    
    int cuboid[][2][2] = {1,2,3,4,5,6,7,8};
//    int a[5] = {1,2,3}; // forbidden
    int * a = (int *)malloc(10 * sizeof(*a));
    for (int i = 0; i < 3; i++) {
        a[i] = i + 1;
    }
    
    int * p = NULL;
    p = (int *)realloc(a, 0); // a is freed and p was allocated to min size
    /*
    srand(); number generator
    int randomNumber = rand() % 50;
    int n = rand() % 50;
    */
    
    changeData(string);
    changeAddress(string);
    count();
    
    printf("%s\n", string);
    
    return 0;
}
Esempio n. 6
0
bool HeroSkillLayer::init(){
    if ( !CCLayer::init() )
    {
        return false;
    }
    this->setTouchEnabled(true);
    this->setTouchPriority(-128);
    this->setTouchMode(kCCTouchesAllAtOnce);
    //加载cocosbuilder
    CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary()->registerCCNodeLoader("HeroSkillccbi",HeroSkillccbiLoder::loader());
    /* Create an autorelease CCBReader. */
    CCBReader * ccbReader = new cocos2d::extension::CCBReader(CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary());
    ccbReader->autorelease();
    /* Read a ccbi file. */
    node2 = ccbReader->readNodeGraphFromFile("ccbi/HeroSkillccbi.ccbi", this);
    if(node2 != NULL) {
        this->addChild(node2);
    }
    this->setVisible(false);
    isSkillLayer = true;
    layervisable = false;
    curPage = 0;//当前页
    addsprite();
    changeData();
    scheduleUpdate();
    return true;
}
Esempio n. 7
0
bool StImagePlane::initCopy(const StImagePlane& theCopy) {
    if(initTrash(theCopy.getFormat(), theCopy.getSizeX(), theCopy.getSizeY(), theCopy.getSizeRowBytes())) {
        stMemCpy(changeData(), theCopy.getData(), theCopy.getSizeBytes());
        return true;
    }
    return false;
}
Esempio n. 8
0
/** The function acceptPressed() is called, if changes are accepted.
	You have to reimplement this function, if you add new properties.
	If you do so, then first call function changeData() and than changed data!
  */
void FloatLatchPropertyGeneralWidget::acceptPressed()
{
	ComponentPropertyGeneralWidget::acceptPressed();
	
	double reset = m_resetValue->value();
	if (getComponent()->getResetValue() != reset)
	{
		changeData();
		getComponent()->setResetValue(reset);
	}
	if (getComponent()->getInputPack()->getConnectorCount() != (unsigned int)m_channels->value())
	{
		changeData();
		getComponent()->setChannelCountDelayed(m_channels->value());
	}
}
void ComponentPropertyStyleWidget::acceptPressed()
{
	ComponentPropertyBaseWidget::acceptPressed();

	QColor foreColor = m_foreGround->color();
	QColor backColor = m_backGround->color();

	if (m_defaultColors->isChecked())
	{
		foreColor = QColor();
		backColor = QColor();
	}
	
	if (getCompStyle()->getForegroundColor() != foreColor)
	{
		changeData();
		getCompStyle()->setForegroundColor(foreColor);
	}

	if (getCompStyle()->getBackgroundColor() != backColor)
	{
		changeData();
		getCompStyle()->setBackgroundColor(backColor);
	}
	
	if (getCompStyle()->isFrameEnabled() != m_enaFrame->isChecked())
	{
		changeData();
		getCompStyle()->setFrameEnabled(m_enaFrame->isChecked());
	}

	
	if (getCompStyle()->getFont() != m_font)
	{
		changeData();
		getCompStyle()->setFont(m_font);
	}
	
	// First set font and then set
	if (getCompStyle()->isDefaultFontEnabled() != m_defaultFont->isChecked())
	{
		changeData();
		getCompStyle()->setDefaultFontEnabled(m_defaultFont->isChecked());
	}
}
Esempio n. 10
0
void HeroSkillLayer::update(float dt){
    if(curPage != config->heroPage){
        curPage = config->heroPage;
        scrolllabel1->removeFromParentAndCleanup(true);
        scrolllabel2->removeFromParentAndCleanup(true);
        changeData();
    }
    
}
/** The function acceptPressed() is called, if changes are accepted.
	You have to reimplement this function, if you add new properties.
	If you do so, then first call function changeData() and than changed data!
  */
void IntegerStyleRange1OutPropertyGeneralWidget::acceptPressed()
{
    IntegerStyle1OutPropertyGeneralWidget::acceptPressed();

    KSimBaseInt max(getMaxValueEdit()->value());
    if (getIntegerStyleRange1Out()->getMaxValue() != max)
    {
        changeData();
        getIntegerStyleRange1Out()->setMaxValue(max);
    }

    KSimBaseInt min(getMinValueEdit()->value());
    if (getIntegerStyleRange1Out()->getMinValue() != min)
    {
        changeData();
        getIntegerStyleRange1Out()->setMinValue(min);
    }
}
PProjectSettingDialog::PProjectSettingDialog ( PActualProject *pc_actual_project,  QWidget *parent ) :
    QDialog ( parent ),
    ui ( new Ui::PProjectSettingDialog ), pcActualProject ( pc_actual_project ) {
    ui->setupUi ( this );

    ui->NameLineEdit->setText ( pc_actual_project->project()->getName().constData() );

    connect ( ui->NameLineEdit, SIGNAL ( editingFinished() ), this, SLOT ( parseName() ) );
    connect ( this, SIGNAL ( accepted() ) , this, SLOT ( changeData() ) );
}
Esempio n. 13
0
bool StImagePlane::initSideBySide(const StImagePlane& theImageL,
                                  const StImagePlane& theImageR,
                                  const int theSeparationDx,
                                  const int theSeparationDy,
                                  const int theValue) {
    if(theImageL.isNull() || theImageR.isNull()) {
        // just ignore
        return true;
    }
    if(theImageL.getSizeX() != theImageR.getSizeX() ||
       theImageL.getSizeY() != theImageR.getSizeY()) {
        // currently unsupported operation
        return false;
    }
    size_t dxAbsPx = size_t(abs(theSeparationDx));
    size_t dxLeftRPx  = (theSeparationDx > 0) ?     dxAbsPx : 0;
    size_t dxLeftLPx  = (theSeparationDx < 0) ? 2 * dxAbsPx : 0;

    size_t dyAbsPx = size_t(abs(theSeparationDy));
    size_t dyTopLPx  = (theSeparationDy > 0) ? dyAbsPx : 0;
    size_t dyTopRPx  = (theSeparationDy < 0) ? dyAbsPx : 0;

    size_t outSizeX = (theImageL.getSizeX() + dxAbsPx) * 2;
    size_t outSizeY =  theImageL.getSizeY() + dyAbsPx  * 2;

    setFormat(theImageL.getFormat());
    if(!initZero(theImageL.getFormat(), outSizeX, outSizeY, outSizeX * theImageL.getSizePixelBytes(), theValue)) {
        return false;
    }

    // save cross-eyed
    for(size_t row = 0; row < theImageR.getSizeY(); ++row) {
        stMemCpy(changeData(dyTopRPx + row, dxLeftRPx),
                 theImageR.getData(row, 0),
                 theImageR.getSizeRowBytes());
    }
    for(size_t row = 0; row < theImageR.getSizeY(); ++row) {
        stMemCpy(changeData(dyTopLPx + row, theImageR.getSizeX() + dxLeftLPx + dxLeftRPx),
                 theImageL.getData(row, 0),
                 theImageL.getSizeRowBytes());
    }
    return true;
}
Esempio n. 14
0
void ExtConnIntegerIn::PropertyGeneralWidget::acceptPressed()
{
	ExternalConnectorPropertyGeneralWidget::acceptPressed();

	if (getExtConnIn()->getDefaultValue() != m_defaultValue->value())
	{
		changeData();
		getExtConnIn()->setDefaultValue( m_defaultValue->value() );
	}
}
void ConnectorBoolInEdgePropertyWidget::acceptPressed()
{
	ConnectorBoolInPropertyWidget::acceptPressed();
	
	if (m_edgeSensitive)
	{
		if (getConn()->isEdgeSensitive() != m_edgeSensitive->isChecked())
		{
			changeData();
			getConn()->setEdgeSensitive(m_edgeSensitive->isChecked());
		}
	}
}
Esempio n. 16
0
bool StImagePlane::fill(const StImagePlane& theCopy) {
    if(getSizeY()        != theCopy.getSizeY()
    || getSizeRowBytes() != theCopy.getSizeRowBytes()
    || getFormat()       != theCopy.getFormat()) {
        return initCopy(theCopy);
    }
    for(size_t row = 0; row < theCopy.getSizeY(); ++row) {
        stMemCpy(changeData(row, 0),
                 theCopy.getData(row, 0),
                 theCopy.getSizeRowBytes());
    }
    return true;
}
Esempio n. 17
0
void HexFileModel::changeData(qint64 pos)
{
    changeData(pos, pos);
}
void WindowConfiguration_Data_PCI_SPHSystem::setColor()
{
	QColorDialog *colorDialog = new QColorDialog();
	connect(colorDialog,SIGNAL(currentColorChanged(QColor)),this, SLOT(changeData(QColor)));
	colorDialog->open();
}
Esempio n. 19
0
void HexFileModel::focusIn()
{
    focused = true;
    changeData(focusPosition);
}
Esempio n. 20
0
void HexFileModel::focusOut()
{
    focused = false;
    changeData(focusPosition);
}
Esempio n. 21
0
void Keyboard::keyInputEvent(QChar ch)
{
	// if hexview
	//
	//

	ch = ch.toLower();
	int nibble = -1;
	if (ch.unicode() >= 'a' && ch.unicode() <= 'f') {
		nibble = ch.unicode() - 'a' + 10;
	} else if (ch.unicode() >= '0' && ch.unicode() <= '9') {
		nibble = ch.unicode() - '0';
	}
	if (nibble < 0) {
		return;
	}

	// match view
	Cursor &cursor = view_->cursor();

	if (cursor.insert()) {
		// Inserte mode
		const CursorSelection selection = cursor.getSelection();
		const quint64 pos = selection.begin;

		// Replace data if selected
		if (cursor.hasSelection()) {
			// TODO: lazy redrawing for insertion
			removeData(pos, selection.end - pos);

			cursor.setPosition(pos);
			cursor.resetAnchor();
		}

		if (cursor.nibble()) {
			// insert
			insertData(pos, nibble << 4);
			cursor.setNibble(false);
		} else {
			if (pos + 1 > document_->length()) {
				return;
			}
			// replace
			uchar currentCharacter;
			document_->get(pos, &currentCharacter, 1);
			uchar c = nibble | (currentCharacter & 0xf0);
			cursor.inverseNibble();

			view_->moveRelativePosition(1, false, false);
			changeData(cursor.position() - 1, 1, &c, 1);
		}
	} else {
		// Ovewrite mode
		if (cursor.position() + 1 > document_->length()) {
			// no buffer
			return;
		}

		uchar currentCharacter;
		document_->get(cursor.position(), &currentCharacter, 1);
		if (cursor.nibble()) {
			uchar c = (nibble << 4) | (currentCharacter & 0x0f);
			changeData(cursor.position(), 1, &c, 1);
			cursor.setNibble(false);
		} else {
			uchar c = nibble | (currentCharacter & 0xf0);
			cursor.inverseNibble();

			view_->moveRelativePosition(1, false, false);
			changeData(cursor.position() - 1, 1, &c, 1);
		}
	}

}