void MainWindow::OpenImage(const QString &fileName)
{
	QScrollArea* area = new QScrollArea();
	ImageWidget* img = new ImageWidget();

	// Nur les- und schreibbare Bildformate werden unterstützt
	if (img->OpenImage(fileName)) {
		QString shortFileName = ParseFileName(fileName);
		shortFileName = shortFileName.mid(0, shortFileName.lastIndexOf('.'));

		// Bild in die ScrollArea laden
		area->setWidget(img);
		area->setStyleSheet("background: qlineargradient(x1: 0, y0: 1, x2:1, y2: 0, stop: 0.96 #383838, stop: 0.99 #2e2e2e);");

		// neuen Tab hinzufügen
		int index = ui->imagetab->addTab(area, shortFileName);
		ui->imagetab->setTabToolTip(index, shortFileName);
		ui->imagetab->setCurrentIndex(index);

		// schließlich Signalhandler setzen
		connect(this, SIGNAL(Arguments(QHash<QString,QString>)), img, SLOT(Arguments(QHash<QString,QString>)));
		connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>)), img, SLOT(Operation(IOperation*,QHash<QString,QString>)));
		connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>,OperationType)), img, SLOT(Operation(IOperation*,QHash<QString,QString>,OperationType)));
		emit Operation(mOperation, GetArgs());
	}
SnpRunnable::Operations _SnpRunnableObjectActionHelper::GetOperations() const
{
	SnpRunnable::Operations operations;
	operations.push_back(Operation("CopySelection", "document containing art", kSnpRunPathContext));
	operations.push_back(Operation("PasteClipboard", "document", kSnpRunNewDocumentContext));
	return operations;
}
Example #3
0
COLORREF CALLBACK OpBlitProc(COLORREF dest, COLORREF src, DWORD lParam)
{
	LPRDATA rdPtr = (LPRDATA)lParam;

	BYTE* srcBytes = (BYTE*)&src;
	BYTE* destBytes = (BYTE*)&dest;

	TCHAR* op = rdPtr->b.procOp;

	float cr = srcBytes[0]*rdPtr->b.procOpSrc;
	float cg = srcBytes[1]*rdPtr->b.procOpSrc;
	float cb = srcBytes[2]*rdPtr->b.procOpSrc;

	//Hardcode *, **, /
	if(*op=='*'||*op=='/')
	{
		cr /= 255.0f;
		cg /= 255.0f;
		cb /= 255.0f;
	}
	//Prevent division by zero
	if(*op=='/'||*op=='%')
	{
		if(!cr) cr = 0.001f;
		if(!cg) cg = 0.001f;
		if(!cb) cb = 0.001f;
	}

	Operation(op,destBytes,cr);
	Operation(op,destBytes+1,cg);
	Operation(op,destBytes+2,cb);

	return dest;
}
Example #4
0
bool DataSpace::InsertKV( char* key, int keylen, char* val, int vallen, bool ops )
{
	void* pkey = JK_MALLOC( keylen+1 );
	void* pval = JK_MALLOC( vallen+1 );
	JK_MEMCPY_S(pkey,keylen+1,key,keylen+1);
	JK_MEMCPY_S(pval,vallen+1,val,vallen+1);
	if ( m_normalDict.GetElement(pkey) )
	{
		m_normalDict.UpdateElement(pkey, pval );
		if ( ops )
		{
			Operation	( LOG_CMD_STRING_UPD, pkey, pval );
			Replication	( LOG_CMD_STRING_UPD, key, pval );
		}
		return true;
	}

	if (  m_normalDict.AddElement( pkey, pval ) )
	{
		if ( ops )
		{
			Operation	( LOG_CMD_STRING_ADD, pkey, pval );
			Replication	( LOG_CMD_STRING_ADD, key, pval );
		}
		return true;
	}
	JK_FREE( pkey );
	JK_FREE( pval );
	return false;
}
Example #5
0
bool Algorithm::Search_Check()
{
	bool ret = false;
	for (int i = 0; i < m_rows; ++i)
		for (int j = 0; j < m_columns; ++j)
			switch (m_MineMatrix[i][j])
			{
			case ORIGINAL:
				if (m_Search_NotMine[i][j] ^ m_Search_Mine[i][j])
				{
					if (m_Search_NotMine[i][j])
					{
						AddOperation(Operation(Operation::OPEN, i, j));
						NewWaitForIdentify(i, j);
					}
					if (m_Search_Mine[i][j])
					{
						m_MineMatrix[i][j] = MINE;
						AddOperation(Operation(Operation::MARKMINE, i, j));
					}
					ret = true;
				}
				break;
			}
	
	return ret;
}
SnpRunnable::Operations _SnpRunnableSelectionHelper::GetOperations() const
{
	SnpRunnable::Operations operations;
	operations.push_back(Operation("IsDocumentSelected", "", kSnpRunNewDocumentContext));	
	operations.push_back(Operation("IsArtSelected", "", kSnpRunPathContext));	
	operations.push_back(Operation("IsTextRangeSelected", "", kSnpRunCharactersContext));	
	operations.push_back(Operation("SelectArtOnLayer", "document", kSnpRunUnitTestDocumentContext));	
	return operations;
}
Example #7
0
uint16_t CanonPS::Capture()
{
  uint16_t        ptp_error = PTP_RC_GeneralError;
  
  if ((ptp_error = Operation(PS_OC_FocusLock, 0, NULL)) != PTP_RC_OK)
            PTPTRACE2("Focus Lock Error: ", ptp_error);
  delay(500);
  if ((ptp_error = Operation(PS_OC_InitiateCaptureInMemory, 0, NULL)) != PTP_RC_OK)
            PTPTRACE2("Capture Error: ", ptp_error);
   return ptp_error;
}
uint16_t CanonPS::Capture()
{
	uint16_t	ptp_error;

	if ((ptp_error = Operation(PTP_OC_PS_FocusLock, 0, NULL)) != PTP_RC_OK)
		Message(PSTR("Focus Lock: Error: "), ptp_error);

	if ((ptp_error = Operation(PTP_OC_PS_InitiateCaptureInMemory, 0, NULL)) != PTP_RC_OK)
		Message(PSTR("Capture: Error: "), ptp_error);

	return ptp_error;
}
int main(void)
{
    int i;
    pthread_t handles[1];
    Obj *items = malloc(4*sizeof(Obj));

    for (i = 0; i < 4; i++)
    {
        Init_ObjType(&items[i]);
    }

    WorkStealQueue q;
    Init_WorkStealQueue(&q, 2);

    for (i = 0; i < 1; i++)
    {
        pthread_create(&handles[i], 0, Stealer, &q);
    }

    for (i = 0; i < 4 / 2; i++)
    {
        Push(&q, &items[2 * i]);
        Push(&q, &items[2 * i + 1]);
        Obj *r;
        if (Pop(&q, &r))
        {
            Operation(r);
        }
    }

    for (i = 0; i < 4 / 2; i++)
    {
        Obj *r;
        if (Pop(&q, &r))
        {
            Operation(r);
        }
    }

    for (i = 0; i < 1; i++)
    {
        pthread_join(handles[i], 0);
    }

    for (i = 0; i < 4; i++)
    {
        Check(&items[i]);
    }

    free(items);
    return 0;
}
Example #10
0
int _tmain(int argc, _TCHAR* argv[])
{
    auto implementationA = std::make_shared<ImplementationA>();
    auto implementationB = std::make_shared<ImplementationB>();

    auto abstractionA = std::make_shared<RefinedAbstractionA>(implementationA);
    abstractionA->Operation();

    auto abstractionB = std::make_shared<RefinedAbstractionB>(implementationB);
    abstractionB->Operation();

	return 0;
}
int main(void)
{
    int i;
    pthread_t handles[nStealers];
    int *items = malloc(nItems*sizeof(int));

    for (i = 0; i < nItems; i++)
    {
        Init_ObjType(&items[i]);
    }

    Init_WorkStealQueue(INITQSIZE);

    for (i = 0; i < nStealers; i++)
    {
        pthread_create(&handles[i], NULL, Stealer, NULL);
    }

    for (i = 0; i < nItems / 2; i++)
    {
        Push(&items[2 * i]);
        Push(&items[2 * i + 1]);
        int *r;
        if (Pop(&r))
        {
            Operation(r);
        }
    }

    for (i = 0; i < nItems / 2; i++)
    {
        int *r;
        if (Pop(&r))
        {
            Operation(r);
        }
    }

    for (i = 0; i < nStealers; i++)
    {
        pthread_join(handles[i], NULL);
    }

    for (i = 0; i < nItems; i++)
    {
        Check(&items[i]);
    }

    free(items);
    return 0;
}
Example #12
0
uint16_t CanonEOS::StartBulb()
{
	uint32_t	params[3];

	params[0] = 0xfffffff8;
	params[1] = 0x00001000;
	params[2] = 0x00000000;

	Operation(0x911A, 3, params);
	Operation(0x911B, 0, NULL);
	Operation(0x9125, 0, NULL);

	return PTP_RC_OK;
}
Example #13
0
uint16_t CanonEOS::StopBulb()
{
	uint32_t	params[3];

    params[0] = 0xffffffff;
	params[1] = 0x00001000;
	params[2] = 0x00000000;
	Operation(0x911A, 3, params);
    
    params[0] = 0xfffffffc;
	Operation(0x911A, 3, params);
	Operation(0x9126, 0, NULL);
	Operation(0x911C, 0, NULL);

	return PTP_RC_OK;
}
Example #14
0
uint16_t CanonPS::Initialize(bool binit)
{
  uint16_t        ptp_error = PTP_RC_GeneralError;
  
  if (binit)
  {
    if ((ptp_error = Operation(PS_OC_StartShootingMode, 0, NULL)) != PTP_RC_OK)
            PTPTRACE2("StartShootingMode failed: ", ptp_error);
  }
  else
  {
     if ((ptp_error = Operation(PS_OC_EndShootingMode, 0, NULL)) != PTP_RC_OK)
            PTPTRACE2("EndShootingMode failed: ", ptp_error);
  }
  return ptp_error;
}
uint16_t CanonPS::Initialize(bool binit)
{
	uint16_t	ptp_error;

	if (binit)
	{
		if ((ptp_error = Operation(PTP_OC_PS_StartShootingMode, 0, NULL)) != PTP_RC_OK)
			Message(PSTR("PC Connect mode failed: "), ptp_error);
	}
	else
	{
		if ((ptp_error = Operation(PTP_OC_PS_EndShootingMode, 0, NULL)) != PTP_RC_OK)
			Message(PSTR("PC Connect mode failed: "), ptp_error);
	}
	return ptp_error;
}
void Component::ProcessPrototypes(int paramX1, int paramY1, int paramY2)
{
    auto objectX = factory_->CreatePrototypeX(paramX1);
    auto objectY = factory_->CreatePrototypeY(paramY1, paramY2);
    objectX->Operation();
    objectY->Action();
}
Example #17
0
uint16_t CanonEOS::ResetTransfer(uint32_t object_id)
{
	uint32_t	params[1];
	params[0] = object_id;

	return Operation(EOS_OC_ResetTransfer, 1, params);
}
Example #18
0
UnaryConstraint& UnaryConstraint::addOperation(FloatVar& start, double duration)
{
	operationsVec_.push_back(
		Operation(start.getLocalIndex(), DurPair(-1, duration)));

	return *this;
}
uint16_t CanonEOS::StopBulb()
{
	uint32_t	params[3];

    params[0] = 0xffffffff;
	params[1] = 0x00001000;
	params[2] = 0x00000000;
	Operation(0x911A, 3, params);
    
    params[0] = 0xfffffffc;
	Operation(0x911A, 3, params);
    
	Operation(0x9126, 0, NULL);
    delay(50);
	Operation(0x911C, 0, NULL);
    delay(50);
}
Example #20
0
int main(int argc, char *argv[]) {
    void *fileSys = New(MyFileSys);
    void *dec1 = New(ZipDecorator, fileSys);
    void *dec2 = New(KillVirDecorator, dec1);
    void *dec3 = New(EncryptDecorator, dec2);

    Operation(dec3);

    return 0;
}
SnpRunnable::Operations _SnpRunnableTemplate::GetOperations() const
{
	// TODO - edit as required.
	SnpRunnable::Operations operations;
	operations.push_back(Operation("Do", "myPreconditions", kSnpRunAnyContext));
	// Add a line as above for each operation your snippet wants to advertise to the framework.
	// Operation(const std::string& name, const std::string& preconditions, eSnpRunContextType unitTestContext)
	// name - name of the operation 
	// preconditions - description of preconditions to be displayed in SnippetRunner panel
	// unitTestContext - context you want the framework to automatically set for your snippet during unit test.
	return operations;
}
void *Stealer(void *param)
{
    int i;
    int *r;
    for (i = 0; i < nStealAttempts; i++)
    {
        if (Steal(&r))
        {
            Operation(r);
        }
    }
    return 0;
}
Example #23
0
bool DataSpace::RemoveKV(void* key, bool ops )
{
	if ( m_normalDict.RemoveElement(key) )
	{
		if ( ops )
		{
			Operation	( LOG_CMD_STRING_DEL, key, "" );
			Replication	( LOG_CMD_STRING_DEL, key, "" );
		}
		return true;
	}
	return false;
}
void *Stealer(void *param)
{
    WorkStealQueue *q = (WorkStealQueue*) param;

    int i;
    // Obj *r;
    int r;   // r is a position
    // for (i = 0; i < nStealAttempts; i++)
    {
        if (Steal(q, &r))
        {
            Operation(r);
        }
    }
    {
        if (Steal(q, &r))
        {
            Operation(r);
        }
    }
    return 0;
}
void *Stealer(void *param)
{
    WorkStealQueue *q = (WorkStealQueue*) param;

    int i;
    Obj *r;
    for (i = 0; i < 2; i++)
    {
        if (Steal(q, &r))
        {
            Operation(r);
        }
    }
    return 0;
}
Example #26
0
Operation ClientChannel::info(InfoCallback *cb, const std::string& subfld)
{
    if(!impl) throw std::logic_error("Dead Channel");

    std::tr1::shared_ptr<Infoer> ret(Infoer::build(cb, getChannel()));

    {
        Guard G(ret->mutex);
        getChannel()->getField(ret, subfld);
        // getField is an oddity as it doesn't have an associated Operation class,
        // and is thus largely out of our control.  (eg. can't cancel)
    }

    return Operation(ret);
}
Example #27
0
void* DataSpace::ListPopRight( char* key, bool ops /*= true */ )
{
	moly_list_type* pDList = (moly_list_type*)m_normalDict.GetElement( key );
	if ( !pDList )
	{
		return NULL;
	}
	void* ptemp = pDList->RPop();
	if ( ptemp && ops )
	{
		Operation	( LOG_CMD_LIST_RPOP, key, "" );
		Replication	( LOG_CMD_LIST_RPOP, key, "" );
	}
	return ptemp;
}
Example #28
0
MX UnaryMX::create(int op, const MX& x){
  /*if(x.isConstant()){
    // Constant folding
    const DMatrix& x_val = x.getConstant();
    DMatrix y_val; // Dummy argument
    DMatrix r_val;
    casadi_math<DMatrix>::fun(op,x_val,y_val,r_val);
    return r_val;
  } else*/ if(operation_checker<F0XChecker>(op) && isZero(x)){
    // If identically zero
    return MX::sparse(x.size1(),x.size2());
  } else {
    // Create a new node
    return MX::create(new UnaryMX(Operation(op),x));
  }
}
Example #29
0
int Border(const char ch,LinkQueue &head)//判断 界符
{
	
	
	int num = 0;
	while(Bor[num])
	{
		if(ch==Bor[num])
		{
			
			return num+20;
		}
		num++;
	}
	if(!Bor[num])
	   Operation(ch,head);//非界符 调用运算符判断函数
	
}
Example #30
0
bool DataSpace::UpdateKV( void* key, void* val, int vallen, bool ops /*= true */)
{
	void* pval = JK_MALLOC( vallen+1 );
	if ( !pval )
	{
		DISPMSG_ERROR( "malloc memory failed!\n");
		return false;
	}
	JK_MEMCPY_S(pval,vallen+1,val,vallen+1);
	if( false == m_normalDict.UpdateElement( key, pval ) )
	{
		JK_FREE( pval );
		return false;
	}
	if (ops)
	{
		Operation(LOG_CMD_STRING_UPD, key, pval);
		Replication(LOG_CMD_STRING_UPD, key, pval);
	}
	return true;
}