Exemple #1
0
void CToggleButton::clickLeft(tribool down, bool previousState)
{
	// force refresh
	hover(false);
	hover(true);

	if(isBlocked())
		return;

	if (down && canActivate())
	{
		CCS->soundh->playSound(soundBase::button);
		setState(PRESSED);
	}

	if(previousState)//mouse up
	{
		if(down == false && getState() == PRESSED && canActivate())
		{
			onButtonClicked();
			setSelected(!selected);
		}
		else
			doSelect(selected); // restore
	}
}
Exemple #2
0
void SelLum::select(TimeValue t, CompMap &compMap, Bitmap *bm, RenderGlobalContext *gc)
{
	float fTemp;
	int type;

	mp_srcAlpha = (WORD*)bm->GetAlphaPtr(&type);
	mp_srcMap = (WORD*)bm->GetStoragePtr(&type);
	assert(type == BMM_TRUE_48);

	// if source bitmap has changed since last call
	if ( m_lastBMModifyID != bm->GetModifyID() )
	{
		m_lastBMModifyID = bm->GetModifyID();
		m_selectValid = m_featherValid = m_compValid = false;
		if ( (bm->Width() != m_imageW) || (bm->Height() != m_imageH) )
		{
			m_imageW = bm->Width();
			m_imageH = bm->Height();
			m_imageSz = m_imageW * m_imageH;
			if (m_imageSz > m_mapSz)
			{
				if (mp_radMap)
					delete[] mp_radMap;
				mp_radMap = new float[m_imageSz];
				m_mapSz = m_imageSz;
			}
		}
	}

	if (!m_selectValid)
	{
		mp_blurMgr->getSelValue(prmLumMin, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
		m_min = fTemp*PERCENT2DEC;

		mp_blurMgr->getSelValue(prmLumMax, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
		m_max = fTemp*PERCENT2DEC;

		m_selectValid = doSelect();
	}
	
	if (!m_featherValid)
	{
		mp_blurMgr->getSelValue(prmLumFeathRad, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 1000.0f); // mjm - 9.30.99
		m_feathRad = (int)floor(max(m_imageW, m_imageH)*(fTemp*PERCENT2DEC));
		m_featherValid = SelLum::doFeather();
	}

	mp_blurMgr->getSelValue(prmLumBrighten, t, fTemp, FOREVER);
	LimitValue(fTemp, 0.0f, 1000.0f); // mjm - 9.30.99
	m_brighten = fTemp*PERCENT2DEC;

	mp_blurMgr->getSelValue(prmLumBlend, t, fTemp, FOREVER);
	LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
	m_blend = fTemp*PERCENT2DEC;

	m_compValid = SelLum::doComposite(t, compMap);
}
void UnixSelectorImpl::selectImpl(int timeout)
{
    struct timeval tval;
    tval.tv_sec = (timeout / 1000);
    tval.tv_usec = (timeout % 1000) * 1000;
    doSelect(&tval);
}
Exemple #4
0
Int32 SQScratchFile::redriveIO(Int32 index, Lng32& count, Lng32 timeout)
{
  Int32 err = 0;
  RESULT result;
  Int32 retval;

  switch (type_)
  {
  case PEND_READ:
  case PEND_WRITE:
    result = doSelect(index, timeout, type_, err);
    if(result == SCRATCH_SUCCESS)
    {
      err = redriveVectorIO(index);
      if(err < 0)
        err = obtainError();
    }
    break;
  
  case PEND_NONE:
  default:
    err = 0;     //Nothing to do.
  }
  
  if (err == 0)  //IO_COMPLETED
  {
   count = bytesCompleted_;
   reset();
  }
  
  // return errno or 0 to indicate success.
  return err;
}
Exemple #5
0
void runProcModel (){
	for (uint32_t n=0; n<globalNCmds; n++){
		switch (globalCmdEntryBuff[n].op){
			case SELECT:
				doSelect(globalCmdEntryBuff[n]);
				break;
			case PROJECT:
				doProject(globalCmdEntryBuff[n]);
				break;
			case UNION:
				doUnion(globalCmdEntryBuff[n]);
				break;
			case DIFFERENCE:
				doDiff(globalCmdEntryBuff[n]);
				break;
			case XPROD:
				doXprod(globalCmdEntryBuff[n]);
				break;
			case DEDUP:
				doDedup(globalCmdEntryBuff[n]);
				break;
			default:
				printf("ERROR: runProcModel: invalid command\n");
				break;
		}
	}
}
Exemple #6
0
static SQLRETURN doWork(char op, char *arg, SQLHENV henv, SQLHDBC hdbc, SQLHSTMT shdl, test_req_t *resp) 
{
	SQLRETURN status = SQL_ERROR;
	int empno = (*arg ? atoi(arg) : 8000);
	char buf1[512];
	char buf2[512];
	int rcnt = 0;   // no of matching records

	sprintf(buf2, "%d", empno);
	(resp->data)[0] = 0;

	if (op == '0') {
		(void) strsub((const char*) ISQL, buf1, sizeof (buf1), "?", buf2);
		status = doSql(henv, hdbc, shdl, (SQLCHAR *) buf1);
	} else if (op == '1') {
		(void) strsub((const char*) SSQL, buf1, sizeof (buf1), "?", buf2);
		status = doSelect(henv, hdbc, shdl, (SQLCHAR *) buf1, &rcnt);
		btlogger_snprintf(resp->data, sizeof (resp->data), "%d", rcnt);
	} else if (op == '2') {
		(void) strsub((const char*) USQL, buf1, sizeof (buf1), "?", buf2);
		status = doSql(henv, hdbc, shdl, (SQLCHAR *) buf1);
	} else if (op == '3') {
		(void) strsub((const char*) DSQL, buf1, sizeof (buf1), "?", buf2);
		status = doSql(henv, hdbc, shdl, (SQLCHAR *) buf1);
	}

	return status;
}
Exemple #7
0
/* the test: insert some data, update it and finally delete it */
static sword doWork(char op, char *arg, OCISvcCtx *svcCtx, OCIStmt *stmthp, OCIError *errhp, test_req_t *resp) {
	sword status = OCI_SUCCESS;
	int empno;

	btlogger_debug( "TxLog doWork op=%c arg=%s", op, arg);
	empno = (*arg ? atoi(arg) : 8000);
	(resp->data)[0] = 0;

	if (op == '0') {
		status = doInsert(svcCtx, stmthp, errhp, empno);
	} else if (op == '1') {
		int rcnt = 0;	// no of matching records
		status = doSelect(svcCtx, stmthp, errhp, empno, &rcnt);
	   	btlogger_snprintf(resp->data, sizeof (resp->data), "%d", rcnt);
	} else if (op == '2') {
		status = doUpdate(svcCtx, stmthp, errhp, empno);
	} else if (op == '3') {
		status = doDelete(svcCtx, stmthp, errhp, empno);
	}

	if (status != OCI_SUCCESS)
		get_error(resp, errhp, status);

	return status;
}
Exemple #8
0
int database::queryProvider::select(abstractQuery* q,QList<int> order,Qt::SortOrder sortOrder )
{
    resultsList.clear();
    _lastError=QSqlError();
    return doSelect(q,order,sortOrder);
    
}
void LH_CursorController::doReselect(QString key,int flags,int value)
{
    if( cursor_data_.active )
    {
        updateLocation(cursor_data_.lastSelX, cursor_data_.lastSelY, true);
        doSelect(key,flags,value);
    }
}
Exemple #10
0
void CToggleBase::setSelected(bool on)
{
	bool changed = (on != selected);
	selected = on;
	doSelect(on);
	if (changed)
		callback(on);
}
void LH_CursorController::virtualKeyPress(QString s)
{
    qDebug() << "LH_CursorController: Virtual Key Press - " << s;
    if( s == "up" ) doMoveUp();
    else if( s == "down" ) doMoveDown();
    else if( s == "left" ) doMoveLeft();
    else if( s == "right" ) doMoveRight();
    else if( s == "sel" ) doSelect();
    else if( s == "act" ) doActivate();
    else if( s == "resel" ) doReselect();
}
void LH_CursorController::processPostback()
{
    QString key = setup_link_json_data_->link().remove(QRegExp("^(@|=)"));
    //qDebug() << "INCOMING Postback:" << key;
    if(postback_data.contains(key))
    {
        //qDebug() << "CURSOR POSTBACK: " << cursor_data_.deserialize(postback_data.value(key));
        postback_data.remove(key);
        if(cursor_data_.sendSelect) doSelect("",0,0);
        updateLocation(0,0);
        //setup_coordinate_->setValue(QString("%1,%2").arg(cursor_data_.x).arg(cursor_data_.y));
    }
}
Exemple #13
0
static int
awaitMonitors (const MonitorGroup *monitors, int timeout) {
  fd_set *readSet = getSelectSet(&selectDescriptor_read);
  fd_set *writeSet = getSelectSet(&selectDescriptor_write);
  fd_set *exceptionSet = getSelectSet(&selectDescriptor_exception);

  int setSize = selectDescriptor_read.size;
  setSize = MAX(setSize, selectDescriptor_write.size);
  setSize = MAX(setSize, selectDescriptor_exception.size);

#ifdef __MSDOS__
  int elapsed = 0;

  do {
    fd_set readSet1, writeSet1, exceptionSet1;

    if (readSet) readSet1 = *readSet;
    if (writeSet) writeSet1 = *writeSet;
    if (exceptionSet) exceptionSet1 = *exceptionSet;

    if (doSelect(setSize,
                 (readSet? &readSet1: NULL),
                 (writeSet? &writeSet1: NULL),
                 (exceptionSet? &exceptionSet1: NULL),
                 0)) {
      if (readSet) *readSet = readSet1;
      if (writeSet) *writeSet = writeSet1;
      if (exceptionSet) *exceptionSet = exceptionSet1;
      return 1;
    }
  } while ((elapsed += msdosUSleep(USECS_PER_MSEC)) < timeout);
#else /* __MSDOS__ */
  if (doSelect(setSize, readSet, writeSet, exceptionSet, timeout)) return 1;
#endif /* __MSDOS__ */

  return 0;
}
Exemple #14
0
int main(int argc, char *argv[]){
  int index = 0;
  int currentOpt = 0;
  int multiplexVal = 1;
  char* commandsAndArgs = NULL;
  char* logFileName = NULL;

  currentOpt = getopt_long( argc, argv, "", opts, &index );
  while (currentOpt != -1) {
   if (index == 0) {
     logFileName = optarg;
   }else if (index == 1){
     commandsAndArgs = optarg;
   }else if(index == 2){
      multiplexVal = atoi(optarg);
   }
   currentOpt = getopt_long( argc, argv, "", opts, &index );
 }

 printf("Логгируем сюда: %s\n",logFileName);
 printf("В режиме: %d\n",multiplexVal);

 char* command = strtok(commandsAndArgs," ");
 printf("Выполняем её: %s\n",command);

 char** arguments = (char**)malloc(strlen(commandsAndArgs)*sizeof(char*));
 char* currentArgument = strtok(NULL," ");
 arguments[0] = command;
 arguments[1] = currentArgument;
 printf("С аргументом: %s\n",arguments[1]);
 int i=2;
 while (currentArgument!= NULL) {
   currentArgument = strtok(NULL," ");
   arguments[i] = currentArgument;
   printf("С аргументом: %s\n",arguments[i]);
   i++;
 }


 if(multiplexVal == 1){
   doSelect(logFileName, command, arguments);
 }else{
   doSignals(logFileName, command, arguments);
  }

}
void
AsyncInitializationPolicy::select(mbus::RoutingContext& context)
{
    if (_syncInit && _state != State::DONE) {
        initSynchronous();
    }

    {
        vespalib::MonitorGuard lock(_lock);

        if (_state == State::NOT_STARTED || _state == State::FAILED) {
            // Only 1 task may be queued to the executor at any point in time.
            // This is maintained by only scheduling a task when either no task
            // has been created before or the previous task has signalled it is
            // entirely done with accessing the state of this policy (including
            // the mutex). After setting _state == RUNNING, only the task
            // is allowed to mutate _state.
            _executor->execute(vespalib::Executor::Task::UP(new Task(*this)));
            _state = State::RUNNING;
        }

        if (_state != State::DONE) {
            mbus::Reply::UP reply(new mbus::EmptyReply());
            reply->addError(currentPolicyInitError());
            context.setReply(std::move(reply));
            return;
        }
        // We have the mutex in state DONE and since no task may be queued
        // up for execution at this point, it's not possible for this to
        // deadlock (executor will stall until all its tasks have finished
        // executing, and any queued tasks would attempt to take the mutex
        // we're currently holding, deadlocking both threads).
        _executor.reset(nullptr);
    }

    doSelect(context);
}
ContactManagerDlg::ContactManagerDlg(PsiAccount *pa) :
	QDialog(0, Qt::Window),
	pa_(pa),
	um(0)
{
	setAttribute(Qt::WA_DeleteOnClose, true);
	ui_.setupUi(this);
	pa_->dialogRegister(this);
	setWindowTitle(tr("Contacts Manager")+" - "+pa->jid().bare());
	setWindowIcon(IconsetFactory::icon("psi/action_contacts_manager").icon());

	um = new ContactManagerModel(this, pa_);
	um->reloadUsers();
	ui_.usersView->setModel(um);
	ui_.usersView->init();

	ui_.cbAction->addItem(IconsetFactory::icon("psi/sendMessage").icon(), tr("Message"), 1);
	ui_.cbAction->addItem(IconsetFactory::icon("psi/remove").icon(), tr("Remove"), 2);
	ui_.cbAction->addItem(IconsetFactory::icon("status/ask").icon(), tr("Auth request"), 3);
	ui_.cbAction->addItem(IconsetFactory::icon("status/ask").icon(), tr("Auth grant"), 4);
	ui_.cbAction->addItem(IconsetFactory::icon("psi/command").icon(), tr("Change domain"), 5);
	ui_.cbAction->addItem(IconsetFactory::icon("psi/info").icon(), tr("Resolve nicks"), 6);
	ui_.cbAction->addItem(IconsetFactory::icon("psi/browse").icon(), tr("Move to group"), 7);
	ui_.cbAction->addItem(IconsetFactory::icon("psi/export").icon(), tr("Export"), 8);
	ui_.cbAction->addItem(IconsetFactory::icon("psi/import").icon(), tr("Import"), 9);
	connect(ui_.cbAction, SIGNAL(currentIndexChanged(int)), this, SLOT(showParamField(int)));
	showParamField(0); // 0 - default index of combobox

	ui_.cmbField->insertItems(0, um->manageableFields());
	ui_.cmbMatchType->addItem(tr("Simple"), ContactManagerModel::SimpleMatch);
	ui_.cmbMatchType->addItem(tr("RegExp"), ContactManagerModel::RegexpMatch);
	connect(ui_.btnExecute, SIGNAL(clicked()), this, SLOT(executeCurrent()));
	connect(ui_.btnSelect, SIGNAL(clicked()), this, SLOT(doSelect()));

	connect(pa_->client(), SIGNAL(rosterRequestFinished(bool,int,QString)), this, SLOT(client_rosterUpdated(bool,int,QString)));
}
Exemple #17
0
int main() {
	u16 i, newJoy = 0, oldJoy = 0, autoRepeatDelay = 0, redraw = 1;
	s16 choice = 0;
	const char *str;
	struct FileSystem fs;
	u16 numFiles;

	// Init the screen, display message
	VDP_setScreenWidth320();
	VDP_setHInterrupt(0);
	VDP_setHilightShadow(0);
	VDP_setTextPalette(PAL0);
	VDP_drawText("MakeStuff USB MegaDrive Dev Kit v2", 3, 10);
	VDP_drawText("Reading SD-card...", 11, 12);

	// Initialise the SD card
	sdInit();

	// Get the geometry of the first SD-card partition
	fatOpenFileSystem(&fs);

	// Initialise workspace for the directory list
	initFiles((u16*)0x440000);

	// Get the list of game ROMs
	fatListDirectory(&fs, fs.rootDirCluster, storeFile);

	// Sort the list alphabetically
	numFiles = dirPtr - dirList;
	quickSort((CVPtr *)dirList, 0, numFiles, (CompareFunc)myFileComp);

	// Display the list
	for ( ; ; ) {
		newJoy = JOY_readJoypad(0);
		if ( newJoy & BUTTON_UP && choice > 0 ) {
			if ( !(oldJoy & BUTTON_UP) ) {
				choice--; redraw = 1;
				autoRepeatDelay = 0;
			} else {
				if ( autoRepeatDelay == 10 ) {
					choice--; redraw = 1;
				} else {
					autoRepeatDelay++;
				}
			}
		}
		if ( newJoy & BUTTON_DOWN && choice < numFiles-1 ) {
			if ( !(oldJoy & BUTTON_DOWN) ) {
				choice++; redraw = 1;
				autoRepeatDelay = 0;
			} else {
				if ( autoRepeatDelay == 10 ) {
					choice++; redraw = 1;
				} else {
					autoRepeatDelay++;
				}
			}
		}
		if ( newJoy & BUTTON_START ) {
			doSelect(&fs, choice);
		}
		oldJoy = newJoy;
		
		VDP_waitVSync();
		if ( redraw ) {
			VDP_clearPlan(VDP_PLAN_A, 1);
			VDP_waitDMACompletion();
			for ( i = 2; i < 26; i++ ) {
				if ( i >= 11-choice && i < numFiles-choice+11 ) {
					str = dirList[choice+i-11]->fileName;
					if ( i == 11 ) {
						VDP_setTextPalette(PAL1);
						VDP_drawText(str, 2, i);
						VDP_setTextPalette(PAL0);
					} else {
						VDP_drawText(str, 2, i);
					}
				}
			}
		}
		redraw = 0;
	}
}
Exemple #18
0
void SelMaps::select(TimeValue t, CompMap &compMap, Bitmap *bm, RenderGlobalContext *gc)
{
	int type;

	mp_srcAlpha = (WORD*)bm->GetAlphaPtr(&type);
	mp_srcMap = (WORD*)bm->GetStoragePtr(&type);
	assert(type == BMM_TRUE_48);
	m_shadeContext.globContext = gc;

	// if source bitmap has changed since last call
	if ( m_lastBMModifyID != bm->GetModifyID() )
	{
		m_lastBMModifyID = bm->GetModifyID();
		m_selectValid = m_featherValid = m_compValid = false;
		if ( (bm->Width() != m_imageW) || (bm->Height() != m_imageH) )
		{
			m_imageW = bm->Width();
			m_imageH = bm->Height();
			m_imageSz = m_imageW * m_imageH;
			if (m_imageSz > m_mapSz)
			{
				if (mp_radMap)
					delete[] mp_radMap;
				mp_radMap = new float[m_imageSz];
				m_mapSz = m_imageSz;
			}
		}
	}

	float fTemp;
	if (!m_selectValid)
	{
		m_brightenMap = NULL;
		mp_blurMgr->getSelValue(prmMaskMap, 0, m_brightenMap, FOREVER);
		if (!m_brightenMap)
			return;
		m_shadeContext.scale = 1.0f;
		m_shadeContext.duvw  = Point3(1.0f/float(m_imageW), 1.0f/float(m_imageH), 0.0f);
		m_shadeContext.uvw.z = 0.0f;
		m_shadeContext.filterMaps = TRUE;
		m_brightenMap->Update(t, Interval());
		m_brightenMap->LoadMapFiles(t);

		mp_blurMgr->getSelValue(prmMaskChannel, t, m_channel, FOREVER);
		mp_blurMgr->getSelValue(prmMaskMin, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
		m_min = fTemp*PERCENT2DEC;

		mp_blurMgr->getSelValue(prmMaskMax, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
		m_max = fTemp*PERCENT2DEC;

		m_selectValid = doSelect();
	}

	if (!m_featherValid)
	{
		mp_blurMgr->getSelValue(prmMaskFeathRad, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 1000.0f); // mjm - 9.30.99
		m_feathRad = (int)floor(max(m_imageW, m_imageH)*(fTemp*PERCENT2DEC));
		m_featherValid = doFeather();
	}

	mp_blurMgr->getSelValue(prmMaskBrighten, t, fTemp, FOREVER);
	LimitValue(fTemp, 0.0f, 1000.0f); // mjm - 9.30.99
	m_brighten = fTemp*PERCENT2DEC;

	mp_blurMgr->getSelValue(prmMaskBlend, t, fTemp, FOREVER);
	LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
	m_blend = fTemp*PERCENT2DEC;

	m_compValid = doComposite(t, compMap);
}
void LH_CursorController::updateLocation(int xMod, int yMod, bool absolute)
{
    QStringList boundsList = setup_boundry_->value().split(',');
    QStringList badPoints = setup_invalid_coordinates_->value().split(';');

    bool moved = false;

    int newX = cursor_data_.x;
    int newY = cursor_data_.y;

    if (boundsList.length()>=4)
    {
        cursor_data_.range.x = (minmax){boundsList.at(0).toInt(), boundsList.at(2).toInt()};
        cursor_data_.range.y = (minmax){boundsList.at(1).toInt(), boundsList.at(3).toInt()};

        if (absolute)
        {
            if(xMod >= cursor_data_.range.x.min &&
               xMod <= cursor_data_.range.x.max &&
               yMod >= cursor_data_.range.y.min &&
               yMod <= cursor_data_.range.y.max
               )
            {
                newX = xMod;
                newY = yMod;
                QString point = QString::number(newX) + "," + QString::number(newY);
                if(!badPoints.contains(point)) moved = true;
            }
        } else
        if(xMod!=0 || yMod!=0)
        {
            int loops = 0;
            while (loops<=1 && !moved)
            {
                loops++;
                while(!moved &&
                      newX+xMod >= cursor_data_.range.x.min &&
                      newX+xMod <= cursor_data_.range.x.max &&
                      newY+yMod >= cursor_data_.range.y.min &&
                      newY+yMod <= cursor_data_.range.y.max
                      )
                {
                    newX += xMod;
                    newY += yMod;
                    QString point = QString::number(newX) + "," + QString::number(newY);
                    if(!badPoints.contains(point)) moved = true;
                    if(!setup_jump_invalid_->value()) break;


                }
                if(!setup_boundry_loop_->value()) break;
                else if(!moved)
                {
                    if(xMod==1)  newX = cursor_data_.range.x.min - xMod;
                    if(xMod==-1) newX = cursor_data_.range.x.max - xMod;
                    if(yMod==1)  newY = cursor_data_.range.y.min - yMod;
                    if(yMod==-1) newY = cursor_data_.range.y.max - yMod;
                }
            }
        }
    }

    if(moved) {
        cursor_data_.x = newX;
        cursor_data_.y = newY;
        if(setup_mode_->value()!=-1)
            if(cursorModes[setup_mode_->value()].select==smNone) doSelect("",0,0);
    }

    persistSelection();
    updateLinkData();

    setup_coordinate_->setValue(QString("%1,%2").arg(cursor_data_.x).arg(cursor_data_.y));
}
void MultiReader::waitForLine() {
  while(hasLine() == false) {
    doSelect(NULL);
  }
}
void MultiReader::poll(struct timeval* timeout) {
  doSelect(timeout);
}
bool k9batch::exec(int argc, char** argv)
{
    bool isBatch=false;
    for (int i=0; i < argc; i++) 
      if (strcmp(argv[i],"--batch")==0)
	isBatch=true;
    
    if (!isBatch)
      return false;
      
      
    QApplication app(argc,argv,false);
    for (int i=0 ;i < app.arguments().count();i++) {
        QString arg=app.arguments().at(i);
        QString nextArg="";
        if (i< app.arguments().count() -1)
            nextArg=app.arguments().at(i+1);
        if (arg.startsWith("--"))
            args[arg.replace("--","")]= nextArg.startsWith("--") ? "" : nextArg;
    }

    if (args.contains("help")){
      showHelp();
      return true;
    }

    k9Tools::setBatchCopy(true);
    k9DVD dvd(NULL);
    dvd.scandvd(args["input"],true);
    k9ExecCopy execCopy;
    execCopy.setDvd ( &dvd );
    QString path;
    execCopy.setCopyMenus ( args.contains("backup-menus"));
    if (args.contains("output-size")) {
      bool ok;
      int size;
      size=args["output-size"].toInt(&ok);
      if (ok)
	execCopy.setDvdSize(qMin(size,8500));
    }
    doSelect(dvd);
    //execCopy.setSpeed ( Ui_MainDlg.cbBurnSpeed->currentText() );
    bool bFolder,bISO;
    bISO=args["output"].endsWith(".iso");
    bFolder =!bISO;

    if ( bFolder) {
        execCopy.setOutput ( k9ExecCopy::oFolder );
        // changed from home to preferred output directory (bkp)
        path= args["output"];
        if ( path=="" )
            return true;
    } else if ( bISO) {
        // changed QDir::homePath() to m_prefOutput (bkp)
        path= args["output"];
        if ( path =="" )
            return true;
        execCopy.setOutput ( k9ExecCopy::oISO );
    }
    execCopy.setPath ( path );
    execCopy.copyDVD();
    return true;
}
void *listen_messages(void *x_void_ptr)
{

    int sockfd, newsockfd, clilen;
    char buffer[256];
    struct sockaddr_in serv_addr, cli_addr;
    int  n;

    /* First call to socket() function */
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd < 0) 
    {
		fprintf( stderr, "[%d]RM _STARTING SERVER SOCKET_ ERROR opening socket\n", get_clock() );
        exit(1);
    }
    /* Initialize socket structure */
    bzero((char *) &serv_addr, sizeof(serv_addr));

    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = INADDR_ANY;
    serv_addr.sin_port = htons(global_port);	//port defined in main.h
 
    /* Now bind the host address using bind() call.*/
    if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
    {
		fprintf( stderr, "[%d]RM _STARTING SERVER SOCKET_ ERROR on binding\n", get_clock() );
         exit(1);
    }
    
    /* Now start listening for the clients, here 
     * process will go in sleep mode and will wait 
     * for the incoming connection
     */
    listen(sockfd,5);
    clilen = sizeof(cli_addr);

    int test=0;
    while (1) 
    {

    	test = doSelect(sockfd);
    	if( test < 0 )
    	{
    		fprintf( stderr, "[%d]RM[%d] BIG ERROR on accept\n", get_clock , newsockfd );
			exit(1);
    	}
    	if( test == 0 )
		{
    		sleep(1);
    		continue;
		}

        newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
	
		printf("[%d]RM[%d] Connection started port: %d \n", get_clock(), newsockfd, global_port);

        if (newsockfd < 0 || test < 0)
        {
            fprintf( stderr, "[%d]RM[%d] ERROR on accept\n", get_clock , newsockfd );
            exit(1);
        }

		/* this variable is our reference to the second thread */
		pthread_t process_thread;

		/* create a receive data struct to sent to thread. Thread frees this data */
		receive_thread_data * rd = malloc(sizeof(receive_thread_data));
		rd->sockfd = newsockfd;
		rd->ip = cli_addr.sin_addr.s_addr;
		rd->port = ntohs(cli_addr.sin_port);
			
		/* execute in separate thread */
		if(pthread_create(& process_thread, NULL, receive_message, rd)) {
			fprintf(stderr, "[%d]RM[%d] Error creating thread\n", get_clock(), newsockfd );
			exit(1);
		}

    } /* end of while */

    return NULL;

}
KRegExpEditorPrivate::KRegExpEditorPrivate(TQWidget *parent, const char *name)
    : TQWidget(parent, name), _updating( false ), _autoVerify( true )
{
  setMinimumSize(730,300);
  TQDockArea* area = new TQDockArea(Qt::Horizontal, TQDockArea::Normal, this );
  area->setMinimumSize(2,2);
  TQDockArea* verArea1 = new TQDockArea(Qt::Vertical, TQDockArea::Normal, this );
  verArea1->setMinimumSize(2,2);
  TQDockArea* verArea2 = new TQDockArea(Qt::Vertical, TQDockArea::Reverse, this );
  verArea2->setMinimumSize(2,2);

  // The DockWindows.
  _regExpButtons = new RegExpButtons( area, "KRegExpEditorPrivate::regExpButton" );
  _verifyButtons = new VerifyButtons( area, "KRegExpEditorPrivate::VerifyButtons" );
  _auxButtons = new AuxButtons( area, "KRegExpEditorPrivate::AuxButtons" );
  _userRegExps = new UserDefinedRegExps( verArea1, "KRegExpEditorPrivate::userRegExps" );
  _userRegExps->setResizeEnabled( true );
  TQWhatsThis::add( _userRegExps, i18n( "In this window you will find predefined regular expressions. Both regular expressions "
                                       "you have developed and saved, and regular expressions shipped with the system." ));

  // Editor window
  _editor = new TQSplitter(Qt::Vertical, this, "KRegExpEditorPrivate::_editor" );

  _scrolledEditorWindow =
    new RegExpScrolledEditorWindow( _editor, "KRegExpEditorPrivate::_scrolledEditorWindow" );
  TQWhatsThis::add( _scrolledEditorWindow, i18n( "In this window you will develop your regular expressions. "
                                               "Select one of the actions from the action buttons above, and click the mouse in this "
                                               "window to insert the given action."));

  _info = new InfoPage( this, "_info" );
  _verifier = new Verifier( _editor, "KRegExpEditorPrivate::_verifier" );
  connect( _verifier, TQT_SIGNAL( textChanged() ), this, TQT_SLOT( maybeVerify() ) );
  TQWhatsThis::add( _verifier, i18n("Type in some text in this window, and see what the regular expression you have developed matches.<p>"
                                   "Each second match will be colored in red and each other match will be colored blue, simply so you "
                                   "can distinguish them from each other.<p>"
                                   "If you select part of the regular expression in the editor window, then this part will be "
                                   "highlighted - This allows you to <i>debug</i> your regular expressions") );

  _editor->hide();
  _editor->setSizes( TQValueList<int>() << _editor->height()/2 << _editor->height()/2 );

  TQVBoxLayout *topLayout = new TQVBoxLayout( this, 0, 6, "KRegExpEditorPrivate::topLayout" );
  topLayout->addWidget( area );
  TQHBoxLayout* rows = new TQHBoxLayout; // I need to cal addLayout explicit to get stretching right.
  topLayout->addLayout( rows, 1 );

  rows->addWidget( verArea1 );
  rows->addWidget( _editor, 1 );
  rows->addWidget( _info, 1 );
  rows->addWidget( verArea2 );

  // Connect the buttons
  connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ),   _scrolledEditorWindow, TQT_SLOT( slotInsertRegExp( int ) ) );
  connect( _regExpButtons, TQT_SIGNAL( doSelect() ), _scrolledEditorWindow, TQT_SLOT( slotDoSelect() ) );
  connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ),    _scrolledEditorWindow, TQT_SLOT( slotInsertRegExp( RegExp*  ) ) );

  connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), _userRegExps,   TQT_SLOT( slotUnSelect() ) );
  connect( _regExpButtons, TQT_SIGNAL( doSelect() ),     _userRegExps,   TQT_SLOT( slotUnSelect() ) );
  connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ),  _regExpButtons, TQT_SLOT( slotUnSelect() ) );

  connect( _scrolledEditorWindow, TQT_SIGNAL( doneEditing() ), _regExpButtons, TQT_SLOT( slotSelectNewAction() ) );
  connect( _scrolledEditorWindow, TQT_SIGNAL( doneEditing() ), _userRegExps, TQT_SLOT( slotSelectNewAction() ) );

  connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), this, TQT_SLOT( slotShowEditor() ) );
  connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ), this, TQT_SLOT( slotShowEditor() ) );
  connect( _regExpButtons, TQT_SIGNAL( doSelect() ), this, TQT_SLOT( slotShowEditor() ) );

  connect( _scrolledEditorWindow, TQT_SIGNAL( savedRegexp() ), _userRegExps, TQT_SLOT( slotPopulateUserRegexps() ) );

  connect( _auxButtons, TQT_SIGNAL( undo() ), this, TQT_SLOT( slotUndo() ) );
  connect( _auxButtons, TQT_SIGNAL( redo() ), this, TQT_SLOT( slotRedo() ) );
  connect( _auxButtons, TQT_SIGNAL( cut() ), _scrolledEditorWindow, TQT_SLOT( slotCut() ) );
  connect( _auxButtons, TQT_SIGNAL( copy() ), _scrolledEditorWindow, TQT_SLOT( slotCopy() ) );
  connect( _auxButtons, TQT_SIGNAL( paste() ), _scrolledEditorWindow, TQT_SLOT( slotPaste() ) );
  connect( _auxButtons, TQT_SIGNAL( save() ), _scrolledEditorWindow, TQT_SLOT( slotSave() ) );
  connect( _verifyButtons, TQT_SIGNAL( autoVerify( bool ) ), this, TQT_SLOT( setAutoVerify( bool ) ) );
  connect( _verifyButtons, TQT_SIGNAL( verify() ), this, TQT_SLOT( doVerify() ) );
  connect( _verifyButtons, TQT_SIGNAL( changeSyntax( const TQString& ) ), this, TQT_SLOT( setSyntax( const TQString& ) ) );

  connect( this, TQT_SIGNAL( canUndo( bool ) ), _auxButtons, TQT_SLOT( slotCanUndo( bool ) ) );
  connect( this, TQT_SIGNAL( canRedo( bool ) ), _auxButtons, TQT_SLOT( slotCanRedo( bool ) ) );
  connect( _scrolledEditorWindow, TQT_SIGNAL( anythingSelected( bool ) ), _auxButtons, TQT_SLOT( slotCanCut( bool ) ) );
  connect( _scrolledEditorWindow, TQT_SIGNAL( anythingSelected( bool ) ), _auxButtons, TQT_SLOT( slotCanCopy( bool ) ) );
  connect( _scrolledEditorWindow, TQT_SIGNAL( anythingOnClipboard( bool ) ), _auxButtons, TQT_SLOT( slotCanPaste( bool ) ) );
  connect( _scrolledEditorWindow, TQT_SIGNAL( canSave( bool ) ), _auxButtons, TQT_SLOT( slotCanSave( bool ) ) );

  connect( _scrolledEditorWindow, TQT_SIGNAL( verifyRegExp() ), this, TQT_SLOT( maybeVerify() ) );

  connect( _verifyButtons, TQT_SIGNAL( loadVerifyText( const TQString& ) ), this, TQT_SLOT( setVerifyText( const TQString& ) ) );

  // connect( _verifier, TQT_SIGNAL( countChanged( int ) ), _verifyButtons, TQT_SLOT( setMatchCount( int ) ) );

  // TQt anchors do not work for <pre>...</pre>, thefore scrolling to next/prev match
  // do not work. Enable this when they work.
  // connect( _verifyButtons, TQT_SIGNAL( gotoFirst() ), _verifier, TQT_SLOT( gotoFirst() ) );
  // connect( _verifyButtons, TQT_SIGNAL( gotoPrev() ), _verifier, TQT_SLOT( gotoPrev() ) );
  // connect( _verifyButtons, TQT_SIGNAL( gotoNext() ), _verifier, TQT_SLOT( gotoNext() ) );
  // connect( _verifyButtons, TQT_SIGNAL( gotoLast() ), _verifier, TQT_SLOT( gotoLast() ) );
  // connect( _verifier, TQT_SIGNAL( goForwardPossible( bool ) ), _verifyButtons, TQT_SLOT( enableForwardButtons( bool ) ) );
  // connect( _verifier, TQT_SIGNAL( goBackwardPossible( bool ) ), _verifyButtons, TQT_SLOT( enableBackwardButtons( bool ) ) );

  _auxButtons->slotCanPaste( false );
  _auxButtons->slotCanCut( false );
  _auxButtons->slotCanCopy( false );
  _auxButtons->slotCanSave( false );


  // Line Edit
  TQHBoxLayout* layout = new TQHBoxLayout( topLayout, 6 );
  TQLabel* label = new TQLabel( i18n("ASCII syntax:"), this );
  layout->addWidget( label );
  clearButton = new TQToolButton( this );
  const TQString icon( TQString::fromLatin1( TQApplication::reverseLayout() ? "clear_left" : "locationbar_erase" ) );
  TQIconSet clearIcon = SmallIconSet( icon );
  clearButton->setIconSet( clearIcon );
  layout->addWidget( clearButton );
  TQToolTip::add( clearButton, i18n("Clear expression") );
  _regexpEdit = new TQLineEdit( this );
  layout->addWidget( _regexpEdit );
  TQWhatsThis::add( _regexpEdit, i18n( "This is the regular expression in ASCII syntax. You are likely only "
				      "to be interested in this if you are a programmer, and need to "
				      "develop a regular expression using TQRegExp.<p>"
                                      "You may develop your regular expression both by using the graphical "
				      "editor, and by typing the regular expression in this line edit.") );

#ifdef TQT_ONLY
  TQPixmap pix( "icons/error.png" );
#else
  TQPixmap pix = TDEGlobal::iconLoader()->loadIcon(locate("data", TQString::fromLatin1("kregexpeditor/pics/error.png") ), TDEIcon::Toolbar );
#endif
  _error = new TQLabel( this );
  _error->setPixmap( pix );
  layout->addWidget( _error );
  _error->hide();

  _timer = new TQTimer(this);

  connect( _scrolledEditorWindow, TQT_SIGNAL( change() ), this, TQT_SLOT( slotUpdateLineEdit() ) );
  connect( _regexpEdit, TQT_SIGNAL(textChanged( const TQString& ) ), this, TQT_SLOT( slotTriggerUpdate() ) );
  connect( _timer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotTimeout() ) );
  connect( clearButton, TQT_SIGNAL( clicked() ), _regexpEdit, TQT_SLOT( clear() ) );

  // Push an initial empty element on the stack.
  _undoStack.push( _scrolledEditorWindow->regExp() );
  _redoStack.setAutoDelete( true );

  TQAccel* accel = new TQAccel( this );
  accel->connectItem( accel->insertItem( CTRL+Key_Z ), this, TQT_SLOT( slotUndo() ) );
  accel->connectItem( accel->insertItem( CTRL+Key_R ), this, TQT_SLOT( slotRedo() ) );

  setSyntax( TQString::fromLatin1( "TQt" ) );
}
void UnixSelectorImpl::selectImpl()
{
    doSelect(NULL);
}
Exemple #26
0
void SelObjIds::select(TimeValue t, CompMap &compMap, Bitmap *bm, RenderGlobalContext *gc)
{
	float fTemp;
	ULONG chanType;

	mp_srcObjId = (WORD *)bm->GetChannel(BMM_CHAN_NODE_ID, chanType);
	if (chanType != BMM_CHAN_TYPE_16)
		mp_blurMgr->blurError(IDS_ERR_GBUF_INVALID);
	mp_srcColor = (Color24*)bm->GetChannel(BMM_CHAN_COLOR, chanType);
	if (chanType != BMM_CHAN_TYPE_24)
		mp_blurMgr->blurError(IDS_ERR_GBUF_INVALID);

	// if source bitmap has changed since last call
	if ( m_lastBMModifyID != bm->GetModifyID() )
	{
		m_lastBMModifyID = bm->GetModifyID();
		m_selectValid = m_featherValid = m_compValid = false;
		if ( (bm->Width() != m_imageW) || (bm->Height() != m_imageH) )
		{
			m_imageW = bm->Width();
			m_imageH = bm->Height();
			m_imageSz = m_imageW * m_imageH;
			if (m_imageSz > m_mapSz)
			{
				if (mp_radMap)
					delete[] mp_radMap;
				mp_radMap = new float[m_imageSz];
				m_mapSz = m_imageSz;
			}
		}
	}

	if (!m_selectValid)
	{
		// make list of desired ids
		m_idCount = mp_blurMgr->getSelTabCount(prmObjIdsIds);
		if (m_idCount > m_idListSz)
		{
			if (mp_idList)
				delete[] mp_idList;
			mp_idList = new int[m_idCount];
			m_idListSz = m_idCount;
		}
		for (int i=0; i<m_idCount; i++)
			mp_blurMgr->getSelValue(prmObjIdsIds, t, mp_idList[i], FOREVER, i);

		// get luminance parameters
		mp_blurMgr->getSelValue(prmObjIdsLumMin, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
		m_min = fTemp*PERCENT2DEC;

		mp_blurMgr->getSelValue(prmObjIdsLumMax, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
		m_max = fTemp*PERCENT2DEC;

		// select the appropriate pixels
		m_selectValid = doSelect();
	}
	
	if (!m_featherValid)
	{
		mp_blurMgr->getSelValue(prmObjIdsFeathRad, t, fTemp, FOREVER);
		LimitValue(fTemp, 0.0f, 1000.0f); // mjm - 9.30.99
		m_feathRad = (int)floor(max(m_imageW, m_imageH)*(fTemp*PERCENT2DEC));
		m_featherValid = doFeather();
	}

	mp_blurMgr->getSelValue(prmObjIdsBrighten, t, fTemp, FOREVER);
	LimitValue(fTemp, 0.0f, 1000.0f); // mjm - 9.30.99
	m_brighten = fTemp*PERCENT2DEC;

	mp_blurMgr->getSelValue(prmObjIdsBlend, t, fTemp, FOREVER);
	LimitValue(fTemp, 0.0f, 100.0f); // mjm - 9.30.99
	m_blend = fTemp*PERCENT2DEC;

	m_compValid = doComposite(t, compMap);
}
int
main (
    int 			argc,
    char 			* argv[])
{
    int 			* pm_listen_array;
    fd_set 			readable, writable, rinit, winit;
    int				nfds = 0;
    int 			nready = 0;
    struct ICE_setup_info 	pm_conn_setup;
    IceListenObj *		listen_objects;
    struct config *		config_info;

    /*
     * setup the global client data struct; we need to do this in order
     * to access program data in the ICE FWPprocessMessages() callback
     * without making everything global!  See FWPprotocolSetupProc() for
     * the rest of what we are doing
     */
    if ((config_info = malloc(sizeof(struct config))) == NULL)
    {
	fprintf(stderr, "Memory allocation failed, exiting\n");
	exit(1);
    }

    global_data.config_info = config_info;
    global_data.nfds =  &nfds;
    global_data.rinit = &rinit;
    global_data.winit = &winit;

    /*
     * complete the setup
     */
    doProcessInputArgs(config_info, argc, argv);

    if ((doHandleConfigFile(config_info)) == FAILURE)
	exit(1);

    if ((doInitDataStructs(config_info,
			   &pm_conn_setup)) == FAILURE)
	exit(1);

    /*
     * install the ICE i/o error handler
     */
    doInstallIOErrorHandler();

    /*
     * zero the select() read/write masks
     */
    FD_ZERO(&readable);
    FD_ZERO(&writable);
    FD_ZERO(&rinit);
    FD_ZERO(&winit);

    /*
     * create listener socket(s) for PM connections
     */
    if (!doSetupPMListen(config_info->pm_listen_port,
			 &config_info->num_pm_listen_ports,
			 &pm_listen_array,
			 &listen_objects,
			 &nfds,
			 &rinit))
	exit(1);

    while(1)
    {
	readable = rinit;
	writable = winit;

	doSelect (config_info,
		  &nfds,
		  &nready,
		  &readable,
		  &writable);

	doCheckTimeouts (config_info,
			 &nready,
			 &rinit,
			 &winit,
			 &readable,
			 &writable);

	doProcessSelect (&nfds,
			 &nready,
			 &readable,
			 &writable,
			 &rinit,
			 &winit,
			 pm_listen_array,
			 config_info,
			 &listen_objects);
    }
}
		void ManipTool::onRenderFrame( Leap::Frame const &aFrame )
		{
			clearSelection();
			doSelect(  );
		}