Exemplo n.º 1
0
Mickey::Mickey() : updateTimer(this), btnThread(this), state(STANDBY), 
  calDlg(), aplDlg(), recenterFlag(true), dw(NULL) 
{
  trans = new MickeyTransform();
  //QObject::connect(onOffSwitch, SIGNAL(activated()), this, SLOT(onOffSwitch_activated()));
  //QObject::connect(&lbtnSwitch, SIGNAL(activated()), &btnThread, SLOT(on_key_pressed()));
  QObject::connect(this, SIGNAL(mouseHotKey_activated(int, bool)), 
		   &btnThread, SLOT(on_mouseHotKey_activated(int, bool)));
  QObject::connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateTimer_activated()));
  QObject::connect(&aplDlg, SIGNAL(keep()), this, SLOT(keepSettings()));
  QObject::connect(&aplDlg, SIGNAL(revert()), this, SLOT(revertSettings()));

  QObject::connect(&calDlg, SIGNAL(recenterNow(bool)), this, SLOT(recenterNow(bool)));
  QObject::connect(&calDlg, SIGNAL(startCalibration()), this, SLOT(startCalibration()));
  QObject::connect(&calDlg, SIGNAL(finishCalibration()), this, SLOT(finishCalibration()));
  QObject::connect(&calDlg, SIGNAL(cancelCalibration(bool)), this, SLOT(cancelCalibration(bool)));
  
  if(!mouse.init()){
    exit(1);
  }
  dw = QApplication::desktop();
//  screenBBox = dw->screenGeometry();
  screenBBox = QRect(0, 0, dw->width(), dw->height());
  screenCenter = screenBBox.center();
  updateTimer.setSingleShot(false);
  updateTimer.setInterval(8);
  btnThread.start();
  linuxtrack_init((char *)"Mickey");
  changeState(TRACKING);
}
Exemplo n.º 2
0
pp_int32 SectionQuickOptions::handleEvent(PPObject* sender, PPEvent* event)
{
	bool b;

	if (event->getID() == eCommand || event->getID() == eCommandRepeat)
	{

		switch (reinterpret_cast<PPControl*>(sender)->getID())
		{
			case QUICKOPTIONS_BUTTON_EXIT:
				if (event->getID() != eCommand)
					break;

				show(false);
				break;

			case QUICKOPTIONS_CHECKBOX_ALLOW8XX:
				if (event->getID() != eCommand)
					break;

				b = tracker.playerController->isPlayModeOptionEnabled(PlayerController::PlayModeOptionPanning8xx);
				tracker.playerController->enablePlayModeOption(PlayerController::PlayModeOptionPanning8xx, !b);
				break;

			case QUICKOPTIONS_CHECKBOX_ALLOWE8X:
				if (event->getID() != eCommand)
					break;

				b = tracker.playerController->isPlayModeOptionEnabled(PlayerController::PlayModeOptionPanningE8x);
				tracker.playerController->enablePlayModeOption(PlayerController::PlayModeOptionPanningE8x, !b);
				break;

			case QUICKOPTIONS_CHECKBOX_PTPERIODRANGE:
				if (event->getID() != eCommand)
					break;

				b = tracker.playerController->isPlayModeOptionEnabled(PlayerController::PlayModeOptionForcePTPitchLimit);
				tracker.playerController->enablePlayModeOption(PlayerController::PlayModeOptionForcePTPitchLimit, !b);
				break;
			
			case QUICKOPTIONS_BUTTON_SETDEFAULTPANNING:
			{
				if (event->getID() != eCommand)
					break;
				
				saveOldPanning();
				
				for (pp_int32 i = 0; i < TrackerConfig::numPlayerChannels; i++)
					dialogPanning->setPanning((pp_uint8)i, tracker.playerController->getPanning((pp_uint8)i), false);
					
				dialogPanning->show(true);
				break;
			}
				
			case QUICKOPTIONS_CHECKBOX_KEEPOPTIONS:
				if (event->getID() != eCommand)
					break;

				if (checkBoxKeepSettings->isChecked())
					tracker.showMessageBoxSized(MESSAGEBOX_UNIVERSAL, "Play mode auto-switching is now OFF\nRemember, these settings will now\napply to all loaded modules.", Tracker::MessageBox_OK);
				break;
		}
		
	}
	else if (event->getID() == eSelection)
	{
		switch (reinterpret_cast<PPControl*>(sender)->getID())
		{
			case QUICKOPTIONS_RADIOGROUP_PLAYBACKMODE:
				switch (reinterpret_cast<PPRadioGroup*>(sender)->getChoice())
				{
					case 0:
						tracker.playerController->switchPlayMode(PlayerController::PlayMode_FastTracker2, !keepSettings());
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_CHECKBOX_PTPERIODRANGE)->enable(false);
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_STATICTEXT_PTPERIODRANGE)->enable(false);
						
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_STATICTEXT_SETDEFAULTPANNING)->enable(false);
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_BUTTON_SETDEFAULTPANNING)->enable(false);
						break;
					case 1:
						tracker.playerController->switchPlayMode(PlayerController::PlayMode_ProTracker2, !keepSettings());						
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_CHECKBOX_PTPERIODRANGE)->enable(true);
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_STATICTEXT_PTPERIODRANGE)->enable(true);

						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_STATICTEXT_SETDEFAULTPANNING)->enable(true);
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_BUTTON_SETDEFAULTPANNING)->enable(true);
						break;
					case 2:
						tracker.playerController->switchPlayMode(PlayerController::PlayMode_ProTracker3, !keepSettings());						
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_CHECKBOX_PTPERIODRANGE)->enable(true);
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_STATICTEXT_PTPERIODRANGE)->enable(true);

						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_STATICTEXT_SETDEFAULTPANNING)->enable(true);
						static_cast<PPContainer*>(sectionContainer)->getControlByID(QUICKOPTIONS_BUTTON_SETDEFAULTPANNING)->enable(true);
						break;
					default:
						ASSERT(false);
				}
				
				update();
				break;
		}
		
	}
	else if (event->getID() == eValueChanged && 
			 reinterpret_cast<DialogPanning*>(sender) == dialogPanning)
	{
		pp_uint32 i = *(reinterpret_cast<const pp_uint32*>(event->getDataPtr()));
		
		tracker.playerController->setPanning((pp_uint8)i, dialogPanning->getPanning(i));
	}
	else if (event->getID() == eCanceled)
	{
		if (reinterpret_cast<DialogPanning*>(sender) == dialogPanning)
		{	
			restoreOldPanning();
		}
	}

	return 0;
}