예제 #1
0
void MainWindow::createQuickAccessBar()
{
    if (Qtitan::RibbonQuickAccessBar* quickAccessBar = ribbonBar()->quickAccessBar())
    {
        QAction* action = quickAccessBar->actionCustomizeButton();
        action->setToolTip(tr("Customize Quick Access Bar"));

        QAction* smallButton = quickAccessBar->addAction(QIcon(":/res/smallNew.png"), tr("New"));
        smallButton->setToolTip(tr("Create a new document"));
        connect(smallButton, SIGNAL(triggered()), this, SLOT(pressButton()));
        quickAccessBar->setActionVisible(smallButton, false);

        smallButton = quickAccessBar->addAction(QIcon(":/res/smallOpen.png"), tr("Open"));
        smallButton->setToolTip(tr("Open an existing document"));
        connect(smallButton, SIGNAL(triggered()), this, SLOT(pressButton()));
        quickAccessBar->setActionVisible(smallButton, false);

        smallButton = quickAccessBar->addAction(QIcon(":/res/smallSave.png"), tr("Save"));
        smallButton->setToolTip(tr("Save the active document"));
        connect(smallButton, SIGNAL(triggered()), this, SLOT(pressButton()));

        smallButton = quickAccessBar->addAction(QIcon(":/res/smallUndo.png"), tr("&Undo"));
        smallButton->setShortcut(QKeySequence::Undo);
        smallButton->setEnabled(false);

        smallButton = quickAccessBar->addAction(QIcon(":/res/smallRedo.png"), tr("&Redo"));
        smallButton->setShortcut(QKeySequence::Redo);
        smallButton->setEnabled(false);

        ribbonBar()->showQuickAccess(true);
    }
}
예제 #2
0
void SD_LED2(){
	int blink;
	static uint32_t previousTime = 0;
	static State state = Initial;
	if(pressButton() == 1){
		blink = 5;
	}else{
		blink = 20;
	}
	switch(state){
		case Initial:
			if(delay(blink,previousTime)){
				turnOFFLED2();
				state = STATE_A;
				previousTime = updateTimer();
			}
			break;
		case STATE_A:
			if(delay(blink,previousTime)){
				turnONLED2();
				state = STATE_B;
				previousTime = updateTimer();
			}
			break;
		case STATE_B:
			if(delay(blink,previousTime)){
				turnOFFLED2();
				state = STATE_A;
				previousTime = updateTimer();
			}
			break;
	}
}
예제 #3
0
  void processAudio(AudioBuffer &buffer){
    data.numSamps = getParameterValue(PARAMETER_A) * (KP_NUM_SAMPLES-8)+8;
    data.amp = getParameterValue(PARAMETER_B);
    data.g = getParameterValue(PARAMETER_C)*(0.5-0.48)+0.48;
    data.duration = getParameterValue(PARAMETER_D) * KP_NUM_BUFFER;

    if(isButtonPressed(PUSHBUTTON) && !data.noteOn){
      data.noteOn = true;
      pressButton(RED_BUTTON);
    }

    int size = buffer.getSize();
    float* left = buffer.getSamples(0);
    float* right = buffer.getChannels() > 1 ? buffer.getSamples(1) : left;
    for(int i=0; i<size; ++i){
      if(data.noteOn){
	if(data.phase > (data.numSamps +  1)){
	  // if we have filled up our delay line, y(n) = g * (y(n-N) + y( n-(N+1) ))
	  data.pluck[data.phase] = data.g * ( data.pluck[data.phase-data.numSamps]
					      + data.pluck[data.phase - (data.numSamps + 1)] );
	}else{
	  // computing the first N samples, y(n) = x(n)
	  if(data.noiseType == KP_NOISETYPE_GAUSSIAN)
	    data.pluck[data.phase] = data.noise[data.phase]; // use gaussian white noise
	  if(data.noiseType == KP_NOISETYPE_RANDOM)
	    data.pluck[data.phase] = rand()%100000/100000.;  // use random noise
	}
	left[i] = data.amp * data.pluck[data.phase];  // left channel
	right[i] = data.amp * data.pluck[data.phase];  // right channel
	if(data.phase >= data.duration){
	  // if we have reached the end of our duration
	  data.phase = 0;
	  data.noteOn = false;
	  pressButton(GREEN_BUTTON);
	}else{
	  data.phase++;
	}
      }else{
	left[i] = right[i] = 0;
      }
    }
  }
예제 #4
0
// This method checks if any button is pressed, similar to the highlight method.
void RunManager::handleEvents(float x, float y) {
    pressButton(x, y, &encryptButton, "encrypt", &encryptText);
    pressButton(x, y, &decryptButton, "decrypt", &decryptText);
    pressButton(x, y, &ECBButton, "ECB", &ECBText);
    pressButton(x, y, &CBCButton, "CBC", &CBCText);
    pressButton(x, y, &CTRButton, "CTR", &CTRText);
    pressButton(x, y, &encryptFileSelector, "eFile", &encryptFileLocationText);
    pressButton(x, y, &decryptFileSelector, "dFile", &decryptFileLocationText);
}
예제 #5
0
void Joystick_::setButton(uint8_t button, uint8_t value)
{
  if (value == 0)
  {
    releaseButton(button);
  }
  else
  {
    pressButton(button);
  }
}
예제 #6
0
파일: elo_input.cpp 프로젝트: blow05/elo
void touch (int fd, const unsigned char *data, int size){
    switch (data[0]){
	case 13: pressButton(fd, data); break;
	case 5: releaseButton(fd, data); break;
	default: 
	    /*printf("size: %2d\n",size); 
	    for (int i=0; i<size; i++){
		printf("%02hhx ",data[i]);
	    }
	    printf("\n");*/
	break;
    }
    
    /*for (int j=0; j<size; j++){
	    printf("%02hhx ", data[j]);
    }
    printf("\n");*/
    
}
예제 #7
0
void SD_LED3(){

		static uint32_t previousTime = 0;
		static State state = Initial;
		static uint32_t counter = 0;
		switch(state){
			case Initial:
				turnOFFLED3();
					if(pressButton() == 1){
						counter = 0;
						state = STATE_A;
					}else{
						state = Initial;
					}
				break;
			case STATE_A:
				if(counter == 5){
					state = Initial;
				}else{
					if(delay(20,previousTime)){
						turnONLED3();
						state = STATE_B;
						previousTime = currentTime;
					}
				}
				break;
			case STATE_B:
					if(delay(20,previousTime)){
						turnOFFLED3();
						state = STATE_A;
						counter = counter + 1;
						previousTime = currentTime;
					}
				break;
		}

}
예제 #8
0
파일: main.c 프로젝트: Remmy/afterstep
void
DispatchEvent (ASEvent * event)
{
	ASVolume *event_volume = NULL;
  SHOW_EVENT_TRACE(event);

	if( (event->eclass & ASE_POINTER_EVENTS) != 0 ) {
    XKeyEvent *xk = &(event->x.xkey);
		int pointer_root_x = xk->x_root;
		int pointer_root_y = xk->y_root;
		event_volume = position2Volume (pointer_root_x,// - (int)AppState.mainCanvas->bw,
                                    pointer_root_y);// - (int)AppState.mainCanvas->bw);
	
		LOCAL_DEBUG_OUT ("event_volume = %p, name = \"%s\"", event_volume, event_volume ? event_volume->name : "(none)");
		if(is_balloon_click( &(event->x) ) )
		{
			withdraw_balloon(NULL);
			return;
		}
		if (event_volume)
			event->context = check_astbar_point( event_volume->contents, pointer_root_x, pointer_root_y );
	}

  event->client = NULL ;

  switch (event->x.type)  {
		case ConfigureNotify:
				{
	        ASFlagType changes = handle_canvas_config (AppState.mainCanvas);
          if( changes != 0 )
					{
						volumeWindowMoved_AuxData aux;
						aux.backgroundChanged = False;
	          set_root_clip_area( AppState.mainCanvas );
						iterate_asbidirlist (AppState.volumes, volumeWindowMoved, &aux, NULL, False);
					}
					show_activity ("changes = 0x%lx", changes);
				}
        break;
    case KeyPress :
         return ;
    case KeyRelease :
				return ;
    case ButtonPress:
			  pressButton (event_volume, event);				
				return;
    case ButtonRelease:
LOCAL_DEBUG_OUT( "state(0x%X)->state&ButtonAnyMask(0x%X)", event->x.xbutton.state, event->x.xbutton.state&ButtonAnyMask );
        if( (event->x.xbutton.state&ButtonAnyMask) == (Button1Mask<<(event->x.xbutton.button-Button1)) )
					releaseButton();
			return ;
    case EnterNotify :
			if( event->x.xcrossing.window == Scr.Root )
				withdraw_active_balloon();
			return ;
    case LeaveNotify :
    case MotionNotify :
			{
				static Bool root_pointer_moved = True ;
				if( event->x.type == MotionNotify ) 
					root_pointer_moved = True ; 
    	  if (event_volume)	{	
        	on_astbar_pointer_action (event_volume->contents, event->context, (event->x.type == LeaveNotify), root_pointer_moved);
					root_pointer_moved = False ; 
				}
				return ;
			}
    case ClientMessage:
      LOCAL_DEBUG_OUT("ClientMessage(\"%s\",format = %d, data=(%8.8lX,%8.8lX,%8.8lX,%8.8lX,%8.8lX)", XGetAtomName( dpy, event->x.xclient.message_type ), event->x.xclient.format, event->x.xclient.data.l[0], event->x.xclient.data.l[1], event->x.xclient.data.l[2], event->x.xclient.data.l[3], event->x.xclient.data.l[4]);
      if ( event->x.xclient.format == 32 &&
           event->x.xclient.data.l[0] == _XA_WM_DELETE_WINDOW )
			{
	      DeadPipe(0);
      }
			return ;
	  case PropertyNotify:
    	if( event->x.xproperty.atom == _XA_NET_WM_STATE )
      {
				LOCAL_DEBUG_OUT( "_XA_NET_WM_STATE updated!%s","");
				return;
			}
			handle_wmprop_event (Scr.wmprops, &(event->x));
      if( event->x.xproperty.atom == _AS_BACKGROUND )
      {
				volumeWindowMoved_AuxData aux;
				aux.backgroundChanged = True;

				LOCAL_DEBUG_OUT( "root background updated!%s","");
        safe_asimage_destroy( Scr.RootImage );
        Scr.RootImage = NULL ;
				
				iterate_asbidirlist (AppState.volumes, volumeWindowMoved, &aux, NULL, False);
      }else if( event->x.xproperty.atom == _AS_STYLE )
			{
				volumeWindowMoved_AuxData aux;
				aux.backgroundChanged = False;

				LOCAL_DEBUG_OUT( "AS Styles updated!%s","");
				mystyle_list_destroy_all(&(Scr.Look.styles_list));
				LoadColorScheme();
				SetASMountLook();
	/* now we need to update everything */
				redecorateVolumes ();	
				iterate_asbidirlist (AppState.volumes, volumeWindowMoved, &aux, NULL, False);
			}
			return ;	
		default:
#ifdef XSHMIMAGE
			LOCAL_DEBUG_OUT( "XSHMIMAGE> EVENT : completion_type = %d, event->type = %d ", Scr.ShmCompletionEventType, event->x.type );
			if( event->x.type == Scr.ShmCompletionEventType )
				handle_ShmCompletion( event );
#endif /* SHAPE */
      return;
	}
  /*update_pager_shape();*/
}
예제 #9
0
void Change::pressButton7(){
    emit pressButton(7);
}
예제 #10
0
void Change::pressButton6(){
    emit pressButton(6);
}
예제 #11
0
void Change::pressButton5(){
    emit pressButton(5);
}
예제 #12
0
void Change::pressButton4(){
    emit pressButton(4);
}
예제 #13
0
/* main */
int main(int argc, char *argv[]){
    int devfd = 0; // input device node
    int sockfd = 0; //socket descriptor
    int connfd = 0; // client socket
    struct sockaddr_in serv_addr; // server address
    char sockBuff[1024]; // buffer for socket
    char *tPtr; // tokenizer pointer
    /*  */
    struct pState state;
    state.isDown = 0;
    state.x = -1;
    state.y = -1;

    /* create socket */
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd == -1){
        fprintf(stderr, "Could not create socket\n");
        return 1;
    }

    /* set memory to 0 */
    memset(&serv_addr, 0, sizeof(serv_addr));

    /* set and bind server */
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = INADDR_ANY;
    serv_addr.sin_port = htons(atoi(argv[1]));
    if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0){
        fprintf(stderr, "ERROR on binding\n");
        return 1;
    }

    /* socket listen on server */
    listen(sockfd, 1);
    connfd = accept(sockfd, (struct sockaddr*)NULL, NULL); 

    /*  */
    char e;
    int x;
    int y;
    /* loop while connected */
    while (1){
        /* get message from client */
        memset(sockBuff, 0, sizeof(sockBuff)); 
        read(connfd, sockBuff, sizeof(sockBuff));
        printf("%s\n",sockBuff);
        tPtr = strtok(sockBuff, "#");
        while(tPtr != NULL) {
            e = *tPtr;
            switch(e){
                case 'B':
                    pressButton(BACK);
                    break;
                case 'H':
                    pressButton(HOME);
                    break;
                case 'M':
                    pressButton(MENU);
                    break;
                case 'L':
                    pressButton(VOLUP);
                    break;
                case 'Q':
                    pressButton(VOLDOWN);
                    break;
                case 'P':
                    pressButton(POWER);
                    break;

                case 'D':
                case 'S':
                case 'U':
                    tPtr = strtok(NULL, "#");
                    x = atoi(tPtr);
                    tPtr = strtok(NULL, "#");
                    y = atoi(tPtr) + Y_OFFSET;

                    setCoord(&state, x, y);

                    /* event */
                    if(e == 'D' && !state.isDown){
                        sendEvent(1, TOUCHSCREEN, 1);
                        state.isDown = 1;
                        sendEvent(0, 0, 0);
                    }
                    else if(e == 'U' && state.isDown){
                        sendEvent(1, TOUCHSCREEN, 0);
                        state.isDown = 0;
                        sendEvent(0, 0, 0);
                    }
                    break;

                default:
                    break;
            }
            tPtr = strtok(NULL, "#");
        }
    } 

    /* close connection */
    sleep(1);
    close(connfd);
    close(sockfd);

    return 0;
}
예제 #14
0
void MainWindow::createRibbon()
{
    if (Qtitan::RibbonPage* pageGallery = ribbonBar()->addPage( tr("&Galleries 1")))
    {
        if (Qtitan::RibbonGroup* groupPopup = pageGallery->addGroup(tr("Popup Galleries")))
        {
            groupPopup->setOptionButtonVisible();
            QAction* act = groupPopup->optionButtonAction();
            act->setToolTip(tr("Popup Galleries"));
            connect(act, SIGNAL(triggered()), this, SLOT(pressButton()));

            groupPopup->setControlsCentering(true);

            OfficePopupMenu* popup = OfficePopupMenu::createPopupMenu(this);
            Qtitan::RibbonGallery* popupGallery = new Qtitan::RibbonGallery;
            popupGallery->setBaseSize(QSize(307, 168));
            popupGallery->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
            popupGallery->setGalleryGroup(m_itemsStyles);
            popup->addWidget(popupGallery);
            popup->addSeparator();
            popup->addAction(tr("Save Style"));
            popup->addAction(tr("Apply Style"));
            groupPopup->addAction(QIcon(":/res/largeStyleButton.png"), tr("Styles"), 
                Qt::ToolButtonTextUnderIcon, popup, QToolButton::InstantPopup);

            popup = OfficePopupMenu::createPopupMenu(this);
            m_popupTableGallery = new Qtitan::RibbonGallery;
            m_popupTableGallery->setBaseSize(QSize(193, 175));
            m_popupTableGallery->setLabelsVisible(true);
            m_popupTableGallery->setScrollBarPolicy(Qt::ScrollBarAlwaysOff);
            m_popupTableGallery->setGalleryGroup(m_itemsTable);
            popup->addWidget(m_popupTableGallery);
            groupPopup->addAction(QIcon(":/res/largeTable.png"), tr("Table"), 
                Qt::ToolButtonTextUnderIcon, popup, QToolButton::InstantPopup);
            connect(m_popupTableGallery, SIGNAL(itemPressed(RibbonGalleryItem*)), 
                this, SLOT(itemTablePressed(RibbonGalleryItem*)));

            popup = OfficePopupMenu::createPopupMenu(this);
            popupGallery = new Qtitan::RibbonGallery();
            popupGallery->setBaseSize(QSize(173, 145));
            popupGallery->setLabelsVisible(true);
            popupGallery->setScrollBarPolicy(Qt::ScrollBarAlwaysOff);
            popupGallery->setGalleryGroup(m_itemsFontTextColor);
            popup->addWidget(popupGallery);
            groupPopup->addAction(QIcon(":/res/largeColorButton.png"), 
                tr("Color"), Qt::ToolButtonTextUnderIcon, popup, QToolButton::InstantPopup);

            popup = OfficePopupMenu::createPopupMenu(this);
            popup->setGripVisible(false);
            m_popupUndoGallery = new WidgetGalleryUndo();
            m_popupUndoGallery->setGalleryGroup(m_itemsUndo);
            m_popupUndoGallery->setBaseSize(QSize(120, m_itemsUndo->getSize().height() * m_itemsUndo->getItemCount() + 2));
            m_popupUndoGallery->setScrollBarPolicy(Qt::ScrollBarAlwaysOff);
            popup->addWidget(m_popupUndoGallery);

            QLabel* label = new QLabel();
            label->setAlignment(Qt::AlignCenter);
            label->setMinimumWidth(118);
            popup->addWidget(label);
            m_popupUndoGallery->selectedItemChanged();

            m_actionUndo = groupPopup->addAction(QIcon(":/res/largeUndo.png"), 
                tr("Undo"), Qt::ToolButtonTextUnderIcon, popup);
            connect(popup, SIGNAL(aboutToHide()), this, SLOT(aboutToHideUndo()));

            connect(m_popupUndoGallery, SIGNAL(itemPressed(RibbonGalleryItem*)), 
                this, SLOT(itemUndoPressed(RibbonGalleryItem*)));
        }

        if (Qtitan::RibbonGroup* groupInline = pageGallery->addGroup(tr("Inline Galleries")))
        {
            groupInline->setOptionButtonVisible();
            QAction* act = groupInline->optionButtonAction();
            act->setToolTip(tr("Inline Galleries"));
            connect(act, SIGNAL(triggered()), this, SLOT(pressButton()));

            groupInline->setControlsCentering(true);

            m_widgetFontTextColor = new Qtitan::RibbonGallery;
            m_widgetFontTextColor->setBaseSize(QSize(190, 60));
            m_widgetFontTextColor->setLabelsVisible(false);
            m_widgetFontTextColor->setScrollBarPolicy(Qt::ScrollBarAlwaysOn);
            m_widgetFontTextColor->setBorderVisible(true);
            m_widgetFontTextColor->setGalleryGroup(m_itemsFontTextColor);
            m_widgetFontTextColor->setCheckedIndex(1);
            act = groupInline->addWidget(m_widgetFontTextColor);
            act->setText(tr("&Color"));
            connect(m_widgetFontTextColor, SIGNAL(itemPressed(RibbonGalleryItem*)), 
                this, SLOT(itemColorPressed(RibbonGalleryItem*)));

            groupInline->addSeparator();

            m_widgetStyleFont = new Qtitan::RibbonGallery;
            m_widgetStyleFont->setBaseSize(QSize(632, 60));
            m_widgetStyleFont->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
            m_widgetStyleFont->setLabelsVisible(false);
            m_widgetStyleFont->setContentsMargins(0, 1, 0, 1);
            m_widgetStyleFont->setBorderVisible(true);
            m_widgetStyleFont->setGalleryGroup(m_itemsStyles);
            m_widgetStyleFont->setCheckedIndex(0);

            connect(m_widgetStyleFont, SIGNAL(itemPressed(RibbonGalleryItem*)), 
                this, SLOT(itemStyleFontPressed(RibbonGalleryItem*)));

            OfficePopupMenu* popup = OfficePopupMenu::createPopupMenu(this);
            m_widgetStyleFont->setPopupMenu(popup);

            m_popupStyleFont = new Qtitan::RibbonGallery;
            m_popupStyleFont->setBaseSize(QSize(307, 168));
            m_popupStyleFont->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
            m_popupStyleFont->setGalleryGroup(m_itemsStyles);
            m_popupStyleFont->setCheckedIndex(0);
            connect(m_popupStyleFont, SIGNAL(itemPressed(RibbonGalleryItem*)), 
                this, SLOT(itemStyleFontPressed(RibbonGalleryItem*)));
            popup->addWidget(m_popupStyleFont);
            popup->addSeparator();

            // hide page, if enabled minimization signal - released()
            QAction* actSaveStyle = popup->addAction(tr("&Save Style"));
            QObject::connect(actSaveStyle, SIGNAL(triggered()), groupInline, SIGNAL(released()));

            QAction* actApplyStyle = popup->addAction(tr("&Apply Style"));
            QObject::connect(actApplyStyle, SIGNAL(triggered()), groupInline, SIGNAL(released()));
            
            act = groupInline->addWidget(m_widgetStyleFont);
            act->setText(tr("&Style"));
        }
예제 #15
0
void Change::pressButton1(){
    emit pressButton(1);
}
예제 #16
0
void SD_LED3(LED *state){
	static int rememberPress = 0;
	static int counter = 0;
	
	switch(state->stateLED){
		case Initial:
			state->getLEDStatus = LED_OFF;
			if(rememberPress == 0){
				if(pressButton() == 1){
					rememberPress = 1;
					counter = 0;
					state->stateLED = STATE_A;
				}else{
					state->stateLED = Initial;
				}
			}else{
					if(pressButton() == 0){
						rememberPress = 0;
						state->stateLED = Initial;
					}else{
						state->getLEDStatus = LED_OFF;
						state->stateLED = Initial;
					}
			}
			break;
		case STATE_A:	
			if(counter < 5){
				if(pressButton() == 0){
					rememberPress = 1;
				}else{
					rememberPress = 0;
				}
			}else{
				if(pressButton() == 0){
					rememberPress = 0;
				}else{
					rememberPress = 1;
				}
			}
			if(counter >= 5){
				state->stateLED = Initial;
			}else{
				if(delay()>=200){
					state->getLEDStatus = LED_ON;
					state->stateLED = STATE_B;
				}else{
					state->getLEDStatus = LED_OFF;
					state->stateLED = STATE_A;	
				}
			}
			break;
		case STATE_B:		
			if(delay()>=200){
				state->getLEDStatus = LED_OFF;
				state->stateLED = STATE_A;	
				counter = counter + 1;
			}else{
				state->getLEDStatus = LED_ON;
				state->stateLED = STATE_B;
			}	
			break;
	}
}
예제 #17
0
bool MouseDevice::buttonClick(Button button)
{
	return (pressButton(button) && releaseButton(button));
}
예제 #18
0
void Change::pressButton2(){
    emit pressButton(2);
}
예제 #19
0
void Change::pressButton3(){
    emit pressButton(3);
}