Ejemplo n.º 1
0
// Respond to change in zoom spin box
void TumblerWindow::zoomChanged(int value)
{
  if (mTum->closing)
    return;
  setFocus();
  mTum->zoom = value;
  setSlice(mTum);
  draw(mTum);
}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SobelEdge::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setSelectedCellArrayPath( reader->readDataArrayPath( "SelectedCellArrayPath", getSelectedCellArrayPath() ) );
  setNewCellArrayName( reader->readString( "NewCellArrayName", getNewCellArrayName() ) );
  setSaveAsNewArray( reader->readValue( "SaveAsNewArray", getSaveAsNewArray() ) );
  setSlice( reader->readValue( "Slice", getSlice() ) );
  reader->closeFilterGroup();
}
Ejemplo n.º 3
0
void drawFrame(const uint8_t frame[8][8])
{
	uint8_t i;
	for(i = 0; i < 8; i++)
	{
		setSlice(i);
		drawSlice(frame[i]);
		SysCtlDelay( 1000 * WAIT_1US );
	}
}
Ejemplo n.º 4
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void Threshold::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setSelectedCellArrayName( reader->readValue( "SelectedCellArrayName", getSelectedCellArrayName() ) );
  setNewCellArrayName( reader->readValue( "NewCellArrayName", getNewCellArrayName() ) );
  setOverwriteArray( reader->readValue( "OverwriteArray", getOverwriteArray() ) );
  setSlice( reader->readValue( "Slice", getSlice() ) );
  setManualParameter( reader->readValue( "ManualParameter", getManualParameter() ) );
  reader->closeFilterGroup();
}
Ejemplo n.º 5
0
// Respond to change in size through spin boxes
void TumblerWindow::sizeChanged(int which)
{
  if (mTum->closing)
    return;
  setFocus();
  if (!which)
    mTum->nx = mSizeBoxes[0]->value();
  else if (which == 1)
    mTum->ny = mSizeBoxes[1]->value();
  else
    mTum->nz = mSizeBoxes[2]->value();
  mTum->ms = (int)(sqrt((double)(mTum->nx * mTum->nx + mTum->ny * mTum->ny +
				mTum->nz * mTum->nz)) + 0.9);
  setSlice(mTum);
  draw(mTum);
}
Ejemplo n.º 6
0
/*
 * 读取sstable文件的Footer
 */
int readFooter(sequentialFile* psFile,Footer* pfooter)
{
	unsigned char footerSpace[48];
	long filesize;
	Slice r;
	initSlice(&r,20);
	int i;
	filesize = getFilesize(psFile);
	readSFile(48,filesize-48,psFile,footerSpace);
	setSlice(&r,footerSpace,48);
	decodeFooter(pfooter,&r);
	for(i = 0;i < 48;i++){
		printXchar(r.data_[i]);
	}
	freeSlice(&r);
	printf("file size = %ld,footersize = %zd\n",filesize,r.size_);
	return 0;
}
Ejemplo n.º 7
0
// Respond to change in one of the toggle buttons
void TumblerWindow::toggleClicked(int index)
{
  int state = mToggleButs[index]->isChecked() ? 1 : 0;
  mToggleStates[index] = state;
  if (!index) {

    // High res button toggled
    mTum->highres = state;
    setSlice(mTum);
    draw(mTum);
  } else {

    // Lock button toggled: draw if unlocking, set new position
    mTum->locked = state;
    if (!state) {
      mTum->cx = (int)mTum->vi->xmouse;
      mTum->cy = (int)mTum->vi->ymouse;
      mTum->cz = (int)(mTum->vi->zmouse + 0.5);
      newData(mTum);
      draw(mTum);
    }
  }
}
Ejemplo n.º 8
0
uint32_t getBlockEntryInfo(const unsigned char* data,Entrykey* entrykey)
{
	size_t offset = 0;
	//uint64_t i = 0;
	uint32_t sharedKeyLen = decodeVarint32(data,&offset);
	uint32_t nosharedKeyLen = decodeVarint32(data,&offset);
	uint32_t valueLen = decodeVarint32(data,&offset);
	if(entrykey->nosharedkey.data_ == NULL){
		entrykey->nosharedkey.data_ = (unsigned char*)malloc(nosharedKeyLen);
		assert(entrykey->nosharedkey.data_);
		entrykey->nosharedkey.length = nosharedKeyLen;
		memcpy(entrykey->nosharedkey.data_,data+offset,nosharedKeyLen);
		entrykey->nosharedkey.size_ = nosharedKeyLen;
		entrykey->offset = offset;
		return valueLen;
	}
	setSlice(&entrykey->nosharedkey,data+offset,nosharedKeyLen);
	entrykey->entrysize = offset+nosharedKeyLen+valueLen;
	entrykey->sharedkeylen = sharedKeyLen;
	entrykey->offset = offset;
	
	return valueLen;
}
Ejemplo n.º 9
0
int main()
{
	FILE* fp;
	size_t i = 0;
	size_t offset;
	fp = fopen("src.ldb","r");
	if(fp == NULL){
		printf("error!\n");
		return 1;
	}
	unsigned char a[] = "src.ldb";
	
	unsigned char b[] = "1-959-250-4279";
	//"1-114-560-9305";
	
	Slice filename;
	Slice lastKey;/* 用于存储最后一次读取到的key */
	Slice srckey; /* 存储要查找、删除、修改、添加的key */
	DBhandle dbhandle;
	
	Footer footer;
	Block dataIndexBlock;
	Block* blockArray;
	BlockEntry blockEntry;
	
	initSlice(&filename,10);
	initSlice(&lastKey,20);
	initBlockEntry(&blockEntry);
	initDBhandle(&dbhandle);
	setSlice(&dbhandle.key_,b,22);

	
	setSlice(&filename,a,strlen((char*)a));
	sequentialFile* psFile = (sequentialFile*)malloc(sizeof(sequentialFile));
	setSequentialFile(psFile,fp,&filename);
	
	readFooter(psFile,&footer);
	
	showFooter(&footer);
	
	/* 读取data index block,存储在dataBlock中 */
	readBlock(psFile,&dataIndexBlock,footer.dataIndexHandle);
	
	blockArray = (Block*)malloc(sizeof(Block)*dataIndexBlock.restartNum);
	if(blockArray == NULL){
		printf("error:blockArray is NULL.\n");
		return 1;
	}
	readAllBlock(psFile,blockArray,&dataIndexBlock);

	/*设置操作为Read*/
	dbhandle.type = 1;	
	dbcmd(blockArray,&dataIndexBlock,&dbhandle);
	
	/* 
	 * 至此,所有的block都已经读取到内存中,data block的内容存储在blockarray中,
	 * data block的索引信息存储在dataIndexBlock中 
	 */
	
	/*
	 * 
	 */
	 //showBlokRestart(&dataIndexBlock);
	 
	
	for(i = 0;i < dataIndexBlock.restartNum;i++){
		//showBlockData(&(blockArray[i]));
	}
	
	
	freeBlockEntry(&blockEntry);
	freeDBhandle(&dbhandle);
	fclose(fp); 
	printf("Hello World!\n");

	return 0;
}
Ejemplo n.º 10
0
Archivo: VM.cpp Proyecto: preda/pepper
// extern __thread jmp_buf jumpBuf;
int VM::call(Value A, int nEffArgs, Value *regs, Stack *stack) {
    Vector<RetInfo> retInfo; // only used if FAST_CALL

    if (!(IS_O_TYPE(A, O_FUNC) || IS_CF(A) || IS_O_TYPE(A, O_CFUNC))) { return -1; }
    regs  = stack->maybeGrow(regs, 256);
    int nExpectedArgs = IS_O_TYPE(A, O_FUNC) ? ((Func *)GET_OBJ(A))->proto->nArgs : NARGS_CFUNC;
    nEffArgs = prepareStackForCall(regs, nExpectedArgs, nEffArgs, gc);

    if (IS_CF(A) || IS_O_TYPE(A, O_CFUNC)) {
        if (IS_CF(A)) {
            tfunc f = GET_CF(A);
            *regs = f(this, CFunc::CFUNC_CALL, 0, regs, nEffArgs);
        } else {
            ((CFunc *) GET_OBJ(A))->call(this, regs, nEffArgs);
        }
        return 0;
    }

    unsigned code = 0;
    Value B;
    Value *ptrC;
    Func *activeFunc = (Func *) GET_OBJ(A);
    unsigned *pc = (unsigned *) activeFunc->proto->code.buf();

    static void *dispatch[] = {
#define _(name) &&name
#include "opcodes.inc"
#undef _
    };

    assert(sizeof(dispatch)/sizeof(dispatch[0]) == N_OPCODES);

    copyUpvals(activeFunc, regs);

    STEP;

 JMP:  pc += OD(code);    STEP;
 JT:   if (!IS_FALSE(*ptrC)) { pc += OD(code);  } STEP;
 JF:   if ( IS_FALSE(*ptrC)) { pc += OD(code);  } STEP;
 JLT:  if (lessThan(A, B))   { pc += OSC(code); } STEP;
 JNIS: if (A != B)           { pc += OSC(code); } STEP;

 FOR: 
    A = *(ptrC + 1);
    B = *(ptrC + 2);
    if (!IS_NUM(A) || !IS_NUM(B)) { goto error; } // E_FOR_NOT_NUMBER
    *ptrC = B;
    if (!(GET_NUM(B) < GET_NUM(A))) { pc += OD(code); }
    STEP;

 LOOP: {
        const double counter = GET_NUM(*ptrC) + 1;
        if (counter < GET_NUM(*(ptrC+1))) { pc += OD(code); }
        *ptrC = VAL_NUM(counter);
        STEP;
    }

 FUNC:
    assert(IS_PROTO(A));
    *ptrC = VAL_OBJ(Func::alloc(gc, PROTO(A), regs + 256, regs, OB(code)));
    STEP;

    // index, A[B]
 GETI: *ptrC = types->type(A)->indexGet(A, B); if (*ptrC == VERR) { goto error; } STEP;
 GETF: *ptrC = types->type(A)->fieldGet(A, B); if (*ptrC == VERR) { goto error; } STEP;
    
 SETI: if (!types->type(*ptrC)->indexSet(*ptrC, A, B)) { goto error; } STEP;
 SETF: if (!types->type(*ptrC)->fieldSet(*ptrC, A, B)) { goto error; } STEP;
    /*
      const int oa = OA(code);
      const int ob = OB(code);
      int top = max(oa, ob) + 1;
      top = max(top, activeFunc->proto->localsTop);
      Value *base = regs + top;
      printf("top %d\n", top);
      base[0] = A;
      base[1] = B;
      int cPos = ptrC - regs;
      DO_CALL(v, 2, regs, base, stack);
      regs[cPos] = base[0];
      break;
      if (*ptrC == VERR) { goto error; }
    */
        
 GETS: *ptrC = getSlice(gc, A, B, regs[OB(code)+1]); if (*ptrC==VERR) { goto error; } STEP;
 SETS: if (setSlice(*ptrC, A, regs[OA(code)+1], B)) { goto error; } STEP;

 RET: {
        regs[0] = A;
        Value *root = stack->base;
        gc->maybeCollect(root, regs - root + 1);
#if FAST_CALL
        if (!retInfo.size()) {
            return 0;
        }
        RetInfo *ri = retInfo.top();
        pc         = ri->pc;
        regs       = stack->base + ri->base;
        activeFunc = ri->func;
        retInfo.pop();
        copyUpvals(activeFunc, regs);
        STEP;
#else
        return 0;
#endif
    }

CALL: { 
        if (!IS_OBJ(A) && !IS_CF(A)) { goto error; } // E_CALL_NOT_FUNC
        int nEffArgs = OSB(code);
        assert(nEffArgs != 0);
        Value *base = ptrC;
#if FAST_CALL
        if (IS_O_TYPE(A, O_FUNC)) {
            Func *f = (Func *) GET_OBJ(A);
            Proto *proto = f->proto;
            prepareStackForCall(base, proto->nArgs, nEffArgs, gc);
            RetInfo *ret = retInfo.push();
            ret->pc    = pc;
            ret->base  = regs - stack->base;
            ret->func  = activeFunc;
            regs = stack->maybeGrow(base, 256);
            copyUpvals(f, regs);
            pc   = proto->code.buf();
            activeFunc = f;
        } else {
#endif
            int ret = DO_CALL(A, nEffArgs, regs, base, stack);
            if (ret) { goto error; }
#if FAST_CALL
        }
#endif
        STEP;
    }
    
 MOVEUP: {
        const int slot = regs + 256 - ptrC;
        activeFunc->setUp(slot, A);
    }
    
 MOVE_R: *ptrC = A; STEP;
 MOVE_I: *ptrC = VAL_NUM(OD(code)); STEP;
 MOVE_V: {
        int id = OA(code);
        *ptrC =
            id == CONST_NIL          ? VNIL :
            id == CONST_EMPTY_STRING ? EMPTY_STRING :
            id == CONST_EMPTY_ARRAY  ? VAL_OBJ(emptyArray->copy(gc)) :
            VAL_OBJ(emptyMap->copy(gc));
        STEP;
    }
    
 MOVE_C: {
        Value v = *pc | (((u64) *(pc+1)) << 32);
        pc += 2;
        if (IS_ARRAY(v)) {
            v = VAL_OBJ(ARRAY(v)->copy(gc));
        } else if (IS_MAP(v)) {
            v = VAL_OBJ(MAP(v)->copy(gc));
        }
        *ptrC = v;
        STEP;
    }
 LEN:    *ptrC = VAL_NUM(len(A)); STEP;
 NOTL:   *ptrC = IS_FALSE(A) ? TRUE : FALSE; STEP;
    // notb: *ptrC = IS_INT(A)? VAL_INT(~getInteger(A)):ERROR(E_WRONG_TYPE); STEP;

 ADD: *ptrC = doAdd(gc, A, B); if (*ptrC == VERR) { goto error; } STEP;
 SUB: *ptrC = BINOP(-, A, B); STEP;
 MUL: *ptrC = BINOP(*, A, B); STEP;
 DIV: *ptrC = BINOP(/, A, B); STEP;
 MOD: *ptrC = doMod(A, B); if (*ptrC == VERR) { goto error; } STEP;
 POW: *ptrC = doPow(A, B); if (*ptrC == VERR) { goto error; } STEP;

 AND: *ptrC = BITOP(&,  A, B); STEP;
 OR:  *ptrC = BITOP(|,  A, B); STEP;
 XOR: *ptrC = BITOP(^,  A, B); STEP;

 SHL_RR: ERR(!IS_NUM(B), E_WRONG_TYPE); *ptrC = doSHL(A, (int)GET_NUM(B)); STEP;
 SHR_RR: ERR(!IS_NUM(B), E_WRONG_TYPE); *ptrC = doSHR(A, (int)GET_NUM(B)); STEP;
 SHL_RI: *ptrC = doSHL(A, OSB(code));       STEP;
 SHR_RI: *ptrC = doSHR(A, OSB(code));       STEP;

 EQ:  *ptrC = equals(A, B)  ? TRUE : FALSE; STEP;
 NEQ: *ptrC = !equals(A, B) ? TRUE : FALSE; STEP;
 IS:  *ptrC = A == B ? TRUE : FALSE; STEP;
 NIS: *ptrC = A != B ? TRUE : FALSE; STEP;

 LT:  *ptrC = lessThan(A, B) ? TRUE : FALSE; STEP;
 LE:  *ptrC = (equals(A, B) || lessThan(A, B)) ? TRUE : FALSE; STEP;

 error: return pc - (unsigned *) activeFunc->proto->code.buf();
}
Ejemplo n.º 11
0
//-----------------------------------------------------------------------------
void DatPanel::last()	{	setSlice(nz-1);	}
Ejemplo n.º 12
0
//-----------------------------------------------------------------------------
void DatPanel::next()	{	setSlice(kz+1);	}
Ejemplo n.º 13
0
int main(void)
{
	// enable GPIO peripheral
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);

	// set pins as outputs
	GPIO_PORTA_DIR_R = 0b11100000;
	GPIO_PORTB_DIR_R = 0b00010011;
	GPIO_PORTD_DIR_R = 0b00001000;
	GPIO_PORTE_DIR_R = 0b00100110;
	GPIO_PORTF_DIR_R = LED_RED|LED_BLUE|LED_GREEN;

	// enable digital outputs
	GPIO_PORTA_DEN_R = 0b11100000;
	GPIO_PORTB_DEN_R = 0b00010011;
	GPIO_PORTD_DEN_R = 0b00001000;
	GPIO_PORTE_DEN_R = 0b00100110;
	GPIO_PORTF_DEN_R = LED_RED|LED_BLUE|LED_GREEN;

	// clear all PORT F pins
	GPIO_PORTF_DATA_R = 0;

	SysCtlDelay( 1000 * WAIT_1MS );

	// Init lines go here...

	SysCtlDelay( 10 * WAIT_1MS );

	//	cpu_message_init();


	/*
	// sys tick setup - overflow every 2 seconds
	SysTickPeriodSet( 2 * SysCtlClockGet() );
	SysTickEnable();

	// Watchdog setup
	WatchdogReloadSet( WATCHDOG0_BASE, SysCtlClockGet() / 2 );
	WatchdogResetEnable( WATCHDOG0_BASE );
	WatchdogIntEnable( WATCHDOG0_BASE );
	WatchdogIntRegister( WATCHDOG0_BASE, watchdog_int );

	// Lock and start it
	WatchdogEnable( WATCHDOG0_BASE );
	WatchdogLock( WATCHDOG0_BASE );
	 */

	SysCtlDelay( 10 * WAIT_1MS );

	//jaguar_control_mode_set( SPEED_CONTROL, RIGHT_MOTOR, 20<<16 );
	//jaguar_control_mode_set( SPEED_CONTROL, LEFT_MOTOR, 20<<16 );

	//pwm_init();

	// loop forever
	setSlice(0);
	volatile uint8_t fCnt = 0;
	for(;;)
	{
		//GPIO_PORTF_DATA_R |= LED_GREEN|LED_BLUE|LED_RED;
		uint32_t i;
		//uint8_t values1[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
		//uint8_t values2[8] = {0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
		for(i=0; i<((1<<4)-1); i++)
		{
			drawFrame(frames[fCnt]);		
		}
		fCnt++;
		if(fCnt > 7) fCnt = 0;
	}
}
Ejemplo n.º 14
0
void B9Print::exposeTBaseLayer(){
    //发布暨复位周期内完成,时间露出新的图层
    if(m_iPrintState==PRINT_NO || m_iPrintState == PRINT_ABORT)return;

    if(m_iPrintState==PRINT_SETUP1){
        //我们使用 - getHardZDownMM()过渡,并获得在这里,
        //现在重置当前位置为0,并拉升至+ getZFlushMM
        m_pTerminal->rcResetCurrentPositionPU(0);
        m_pTerminal->rcBasePrint(m_pTerminal->getZFlushMM());
        m_iPrintState = PRINT_SETUP2;
        return;
    }

    if(m_iPrintState==PRINT_SETUP2){
        //现在,我们应复位当前位置为0,并继续
        m_pTerminal->rcResetCurrentPositionPU(0);
        m_iPrintState = PRINT_RELEASING;
    }

    if(m_iPrintState == PRINT_DONE){
        m_iPrintState=PRINT_NO;
        m_pTerminal->setEnabled(true);
        if(m_pTerminal->getPrintPreview()){
            m_pTerminal->setPrintPreview(false);
            m_pTerminal->setUsePrimaryMonitor(false);
        }
        m_pTerminal->onScreenCountChanged();
        hide();
        return;
    }

    if(m_bAbort){
        //完成后释放和提高
        m_pTerminal->rcSetCPJ(NULL); //空白
        ui->pushButtonAbort->setText("Abort");
         m_iPrintState = PRINT_ABORT;
        on_signalAbortPrint();
        return;
    }

    //启动TBASE打印曝光
    ui->progressBarPrintProgress->setValue(m_iCurLayerNumber+1);
    ui->lineEditLayerCount->setText("Creating Layer "+QString::number(m_iCurLayerNumber+1)+" of "+QString::number(m_iLastLayer)+",  "+QString::number(100.0*(double)(m_iCurLayerNumber+1)/(double)m_iLastLayer,'f',1)+"% Complete");
    setSlice(m_iCurLayerNumber);
    m_vClock.start(); //图像就在那里,启动时钟运行!
    QString sTimeUpdate = updateTimes();
    if(m_iPaused==PAUSE_WAIT){
        ui->lineEditLayerCount->setText("Pausing...");
        setProjMessage("Pausing...");
    }
    else{
        setProjMessage("(Press'p' to pause, 'A' to ABORT)  " + sTimeUpdate+"  Creating Layer "+QString::number(m_iCurLayerNumber+1)+" of "+QString::number(m_iLastLayer));
    }
    m_iPrintState = PRINT_EXPOSING;
    //设置计时器
    int iAdjExposure = m_pTerminal->getLampAdjustedExposureTime(m_iTbase);
    if(m_iCurLayerNumber<m_iNumAttach) iAdjExposure = m_pTerminal->getLampAdjustedExposureTime(m_iTattach);  //第一层可以具有不同的曝光时延
    if(iAdjExposure>0){
        QTimer::singleShot(iAdjExposure-m_vClock.elapsed(), this, SLOT(startExposeTOverLayers()));
        return;
    }
    else
    {
        startExposeTOverLayers(); // 如果这是获取调用,我们正在获取太长时间了!
        qDebug() << "EXPOSURE TIMING ERROR:  Tbase exposed for too long!, Tbase is set too small or computer too slow?" << iAdjExposure;
        return;
    }
}
Ejemplo n.º 15
0
void TumblerWindow::keyPressEvent ( QKeyEvent * event)
{
  TumblerStruct *xtum = mTum;
  float tstep = xtum->tstep;
  int key = event->key();
  int shift = event->modifiers() & Qt::ShiftModifier;
  int ctrl = event->modifiers() & Qt::ControlModifier;
  int keypad = event->modifiers() & Qt::KeypadModifier;
  int dodraw = 1;
  int handled = 1;
  int newdata = 1;
  float xrot, yrot, zrot;
  
  if (inputTestMetaKey(event))
    return;

  if (utilCloseKey(event)) {
    close();
    return;
  }    

  inputConvertNumLock(key, keypad);

  if (key == hotSliderKey()) {
    mCtrlPressed = true;
    grabKeyboard();
    return;
  }

  switch(key){
  case Qt::Key_B:
    xtum->bbox = 1 - xtum->bbox;
    newdata = 0;
    break;
               
  case Qt::Key_S:
    if (shift || ctrl){
      
      // Snapshots
      draw(xtum);
      b3dKeySnapshot("tumbler", shift, ctrl, NULL);
      dodraw = 0;
    } else {

      // Toggle stereo
      xtum->stereo = 1 - xtum->stereo;
      setSlice(xtum);
      newdata = 0;
    }
    break;

  case Qt::Key_Comma:
    xtum->tstep /= sqrt(2.);
    if (xtum->tstep < 1.)
      xtum->tstep = 1.;
    break;

  case Qt::Key_Period:
    xtum->tstep *= sqrt(2.);
    if (xtum->tstep > 16.)
      xtum->tstep = 16.;
    break;

  case Qt::Key_Plus:
  case Qt::Key_Equal:
    if (xtum->zoom < XTUM_MAX_ZOOM) {
      xtum->zoom++;
      diaSetSpinBox(mZoomBox, xtum->zoom);
      setSlice(xtum);
      newdata = 0;
    } else
      dodraw = 0;
    break;
  case Qt::Key_Minus:
    if (xtum->zoom > 1) {
      xtum->zoom--;
      diaSetSpinBox(mZoomBox, xtum->zoom);
      setSlice(xtum);
      newdata = 0;
    } else
      dodraw = 0;
    break;
    
  case Qt::Key_PageDown:
  case Qt::Key_PageUp:
  case Qt::Key_Up:
  case Qt::Key_Down:
  case Qt::Key_Right:
  case Qt::Key_Left:
    if (keypad) {

      // Someone with a better eye than mine may see that the directions
      // of X and Y need to be reversed
      xrot = (key == Qt::Key_Up ? tstep : 0.) - 
        (key == Qt::Key_Down ? tstep : 0.); 
      yrot = (key == Qt::Key_Right ? tstep : 0.) - 
        (key == Qt::Key_Left ? tstep : 0.);
      zrot = (key == Qt::Key_PageUp ? tstep : 0.) - 
        (key == Qt::Key_PageDown ? tstep : 0.);
      computeRotation(xrot, yrot, zrot);
    } else
      handled = 0;
    break;
    
  case Qt::Key_F5:
    if (xtum->minval >= 3) {
      xtum->minval -= 3;
      mSliders->setValue(0, xtum->minval);
    } else
      dodraw = 0;
    break;
  case Qt::Key_F6:
    if (xtum->minval < xtum->maxval - 3) {
      xtum->minval += 3;
      mSliders->setValue(0, xtum->minval);
    } else
      dodraw = 0;
    break;
  case Qt::Key_F7:
    if (xtum->maxval > xtum->minval + 3) {
      xtum->maxval -= 3;
      mSliders->setValue(1, xtum->maxval);
    } else
      dodraw = 0;
    break;
  case Qt::Key_F8:
    if (xtum->maxval <= 255 -  3) {
      xtum->maxval += 3;
      mSliders->setValue(1, xtum->maxval);
    } else
      dodraw = 0;
    break;

  default:
    handled = 0;
    break;
  }

  // If key not handled, call the default processor
  if (!handled) {
    inputQDefaultKeys(event, xtum->vi);
    return;
  }
  
  // Do the draws as needed
  if (dodraw && newdata)
    newData(xtum);
  if (dodraw)
    draw(xtum);
}
Ejemplo n.º 16
0
//-----------------------------------------------------------------------------
void DatPanel::first()	{	setSlice(0);	}
Ejemplo n.º 17
0
//-----------------------------------------------------------------------------
void DatPanel::prev()	{	setSlice(kz-1);	}
Ejemplo n.º 18
0
//-----------------------------------------------------------------------------
void DatPanel::gosl()
{
	bool ok;
	QString s = QInputDialog::getText(this, tr("UDAV - Go to slice"), tr("Enter slice id:"), QLineEdit::Normal, "0", &ok);
	if(ok)	setSlice(s.toInt());
}