Beispiel #1
0
	void Txtr::duplicateColumn(int x, int y, int length, int duplicateStep, int nDuplicates)
	{
		if (nDuplicates <= 0 || length <= 0) return;

		int xStart;
		if (duplicateStep > 0)
		{
			xStart = x + duplicateStep;
		}
		else
		{
			xStart = x + duplicateStep*nDuplicates;
			duplicateStep = -duplicateStep;
		}

		dAssert(duplicateStep >= 0);
		
		for(int i=0; i<length; ++i)
		{			
			Pixel4 *toPixels =&getPixel(xStart, y+i);
			Pixel4 pixel(getPixel(x, y+i));

			if (duplicateStep == 1)
			{
				//fillRow(y+i, xStart, nDuplicates, pixel);
				assignAll(toPixels, pixel, nDuplicates);
			}
			else
			{
				assignAll(toPixels, duplicateStep, pixel, nDuplicates);
			}
		}
	}
Beispiel #2
0
ShortcutConfig::ShortcutConfig(QWidget* parent)
: QDialog(parent)
{
	setupUi(this);
	connect(cgListView, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
			this, SLOT(categorySelChanged(QTreeWidgetItem*, int)));
	connect(cgListView, SIGNAL(itemClicked(QTreeWidgetItem*, int)),
			this, SLOT(categorySelChanged(QTreeWidgetItem*, int)));
	connect(scListView, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
			this, SLOT(shortcutSelChanged(QTreeWidgetItem*, int)));

	connect(defineButton, SIGNAL(pressed()), this, SLOT(assignShortcut()));
	connect(clearButton, SIGNAL(pressed()), this, SLOT(clearShortcut()));
	connect(applyButton, SIGNAL(pressed()), this, SLOT(assignAll()));

	current_category = ALL_SHRT;
	cgListView->sortItems(SHRT_CATEGORY_COL, Qt::AscendingOrder);
	_config_changed = false;

	//Fill up category listview:
	SCListViewItem* newItem;
	SCListViewItem* selItem = 0;
	for (int i = 0; i < SHRT_NUM_OF_CATEGORIES; i++)
	{
		newItem = new SCListViewItem(cgListView, i);
		newItem->setText(SHRT_CATEGORY_COL, shortcut_category[i].name);
		if (shortcut_category[i].id_flag == current_category)
			selItem = newItem;
	}
	if (selItem)
		cgListView->setCurrentItem(selItem); // Tim
	updateSCListView();
}
Beispiel #3
0
	void Txtr::fillArea(int x, int y, int width, int height, const Pixel4 &pixel)
	{
		int yStop = y + height;
		for(int i=y; i<yStop; ++i)
		{
			assignAll(&getPixel(x, i), pixel, width);
		}
	}
Beispiel #4
0
Data::Data(Data::Type type, int n1, int n2, int n3, int n4)
:	mData(0), mElems(0), mStride(1), mType(type)
{
	int s[] = {n1,n2,n3,n4};
	shape(s,4);
	clone();
	if(isNumerical()) assignAll(0);
	PDEBUG;
}
Beispiel #5
0
// Assignment operator
CLHelper::DeviceInfo& CLHelper::DeviceInfo::operator=(const DeviceInfo& obj)
{
	if(this != &obj)
	{
		deleteAll();
		assignAll(obj);
	}

	return *this;
}
Beispiel #6
0
// if sizes==0, then keep current shape
int Data::realloc(Data::Type t, const int * sizes, int n){
	Data old(*this); // REV0

	if(sizes){		// new shape requested
		clear();
		shape(sizes, n);
	}
	else{			// just changing type, leave shape unchanged
//		Data old(*this); // REV0
		clear();
		shape(old.mSizes, old.maxDim());
	}	

	if(size()){
		mType  = t;
		mStride= 1;
		switch(type()){
		case Data::BOOL:	mData = pointer(new bool[size()]); break;
		case Data::INT:		mData = pointer(new int[size()]); break;
		case Data::FLOAT:	mData = pointer(new float[size()]); break;
		case Data::DOUBLE:	mData = pointer(new double[size()]); break;
		case Data::STRING:	mData = pointer(new std::string[size()]); break;
		default:			goto end;
		}
		acquire(mData);
		offset(0);
//		if(hasData() && isNumerical()) assignAll(0); // REV0

		if(hasData() && isNumerical()){
			if(old.hasData()){
				assign(old);	// copy over as many old elements as possible
				if(size() > old.size()) slice(old.size()).assignAll(0);
			}
			else{
				assignAll(0);
			}
		}
	}

	end:
	return sizeBytes() - old.sizeBytes();
}
Beispiel #7
0
// Copy constructor
CLHelper::DeviceInfo::DeviceInfo(const DeviceInfo &obj)
{
	assignAll(obj);
}