//! Force l'objet à croire qu'il est nouveau void CDObjState::SetNouveau() { m_bInitaliser = false; m_bAcquis = false; m_bSupprimer = false; SetModifier(true); SetPourSupprimer(false); }
//! Indique si l'objet est marqué pour suppression void CDObjState::SetPourSupprimer( bool bPourSupprimer ) { bool bNotifer = (m_bPourSupprimer != bPourSupprimer); // Le changement d'état de suppression // implique que l'item est modifié. if (bNotifer) SetModifier(true); m_bPourSupprimer = bPourSupprimer; }
//! Indique si l'objet à été acquis void CDObjState::SetAcquis(bool bAcquis) { if (bAcquis) { m_bInitaliser = true; m_bAcquis = true; SetModifier(false); SetPourSupprimer(false); } else { m_bAcquis = false; } }
bool CProjet::SetUuidClsGen(std::string uuid) { // L'objet doit être initialisé if (!Initialiser()) return false; // Le champ est modifié uniquement si sa valeur change. if (m_uuidClsGen.toString() != uuid) { // Affectation de la nouvelle valeur. m_uuidClsGen = Poco::UUID(uuid); // Marquer l'objet comme modifié. SetModifier(); } // Le changement de valeur a réussi. return true; }
bool CProjet::SetCppFolder(Poco::Path ptCppFolder) { // L'objet doit être initialisé if (!Initialiser()) return false; // Le champ est modifié uniquement si sa valeur change. if (m_ptCppFolder.toString() != ptCppFolder.toString()) { // Affectation de la nouvelle valeur. m_ptCppFolder = ptCppFolder; // Marquer l'objet comme modifié. SetModifier(); } // Le changement de valeur a réussi. return true; }
bool CProjet::SetDescription(std::string sDescription) { // L'objet doit être initialisé if (!Initialiser()) return false; // Le champ est modifié uniquement si sa valeur change. if (m_sDescription != sDescription) { // Affectation de la nouvelle valeur. m_sDescription = sDescription; // Marquer l'objet comme modifié. SetModifier(); } // Le changement de valeur a réussi. return true; }
bool CFiltreListe::SetFtrIdent(unsigned long ulFtrIdent) { if (!Initialiser()) return false; // Mise à jour de la variable if (m_ulFtrIdent != ulFtrIdent) { m_ulFtrIdent = ulFtrIdent; SetModifier(); } // Mise à jour de la liste for (int i = 0; i < GetSize(); i++) if (GetAt(i)->SetFtrIdent(ulFtrIdent) == false) return false; return true; }
bool CFiltre::SetFtrIdent(unsigned long ulFtrIdent) { // L'objet doit être initialisé if (!Initialiser()) return false; // Le champ est modifié uniquement si sa valeur change. if (m_ulFtrIdent != ulFtrIdent) { // Affectation de la nouvelle valeur. m_ulFtrIdent = ulFtrIdent; // Marquer l'objet comme modifié. SetModifier(); } // Le changement de valeur a réussi. return true; }
bool CFiltre::SetType(GDSAPI::FiltreType iType) { // L'objet doit être initialisé if (!Initialiser()) return false; // Le champ est modifié uniquement si sa valeur change. if (m_iType != iType) { // Affectation de la nouvelle valeur. m_iType = iType; // Marquer l'objet comme modifié. SetModifier(); } // Le changement de valeur a réussi. return true; }
bool CFiltre::SetLibelle(std::string sName) { // L'objet doit être initialisé if (!Initialiser()) return false; // Le champ est modifié uniquement si sa valeur change. if (m_sLibelle != sName) { // Affectation de la nouvelle valeur. m_sLibelle = sName; // Marquer l'objet comme modifié. SetModifier(); } // Le changement de valeur a réussi. return true; }
/****************************************************************** Function: InitiateControllers Purpose: This function initialises how each of the controllers should be handled. input: - A controller structure that needs to be filled for the emulator to know how to handle each controller. output: none *******************************************************************/ EXPORT void CALL InitiateControllers (CONTROL_INFO ControlInfo) #endif // SPECS_VERSION { DebugWriteA("CALLED: InitiateControllers\n"); if( !prepareHeap()) return; #if SPECS_VERSION == 0x0100 g_strEmuInfo.hMainWindow = hMainWindow; // g_strEmuInfo.HEADER = NULL; #elif SPECS_VERSION >= 0x0101 g_strEmuInfo.hMainWindow = ControlInfo.hMainWindow; // g_strEmuInfo.MemoryBswaped = ControlInfo.MemoryBswaped; // g_strEmuInfo.HEADER = ControlInfo.HEADER; // UNDONE: Instead of just storing the header, figure out what ROM we're running and save that information somewhere #endif // SPECS_VERSION // The emulator expects us to tell what controllers are plugged in and what their paks are at this point. if( !g_pDIHandle ) // if we don't have a directinput handle, we need to make one, attach it to the main window (so it will die if our emulator dies), and enumerate devices { if( InitDirectInput( g_strEmuInfo.hMainWindow )) { EnterCriticalSection ( &g_critical ); InitMouse(); g_pDIHandle->EnumDevices( DI8DEVCLASS_ALL, EnumMakeDeviceList, NULL, DIEDFL_ATTACHEDONLY ); LeaveCriticalSection ( &g_critical ); DebugWriteA("InitDirectInput run in InitiateControllers, g_nDevices=%d\n", g_nDevices); } else return; } int iDevice; EnterCriticalSection( &g_critical ); // ZeroMemory( g_apFFDevice, sizeof(g_apFFDevice) ); // NO, we'll reinit the existing reference if it's already loaded // ZeroMemory( g_apdiEffect, sizeof(g_apdiEffect) ); // NO, we'll release it with CloseControllerPak for( int i = 3; i >= 0; i-- ) { SaveControllerPak( i ); CloseControllerPak( i ); // freePakData( &g_pcControllers[i] ); // already called by CloseControllerPak freeModifiers( &g_pcControllers[i] ); SetControllerDefaults( &g_pcControllers[i] ); } g_pcControllers[0].fPlugged = true; if (! LoadConfigFromINI() ) { DebugWriteA("\tINI load failed, loading defaults from resource\n"); for ( int i = 0; i < 4; i++ ) LoadProfileFromResource( i, false ); LoadShortcutsFromResource(false); } for( int i = 0; i < 4; i++) // initiate xinput controller and plug then if connected --tecnicors { InitiateXInputController( &g_pcControllers[i].xiController, i ); if( g_pcControllers[i].xiController.bConnected ) { g_pcControllers[i].fPlugged = true; g_pcControllers[i].fGamePad = true; } } // END // Init: Find force-feedback devices and init for( int i = 3; i >= 0; i-- ) { DebugWriteA("Controller %d: ", i+1); if( g_pcControllers[i].xiController.bConnected && g_pcControllers[i].fXInput) // if xinput connected, we don't need other config --tecnicors continue; if( g_pcControllers[i].fPlugged ) { // Search for right Controller iDevice = FindDeviceinList( g_pcControllers[i].guidFFDevice ); if( iDevice != -1 && g_devList[iDevice].bEffType ) { DebugWriteA("rumble device set, "); } else // we couldn't find the device specified in the INI file, or it was already null { g_pcControllers[i].guidFFDevice = GUID_NULL; DebugWriteA("no rumble device/effect type set, "); } if( g_pcControllers[i].nModifiers > 0) SetModifier( &g_pcControllers[i] ); g_iFirstController = i; DebugWriteA("plugged in, with paktype %d, ", g_pcControllers[i].PakType); DebugWriteA("RawMode is %d\n", g_pcControllers[i].fRawData); } else { DebugWriteA("unplugged\n"); freePakData( &g_pcControllers[i] ); // we don't need to do this again, but there's not much overhead so I'll leave it --rabid freeModifiers( &g_pcControllers[i] ); } } PrepareInputDevices(); if( g_bExclusiveMouse ) { // g_sysMouse.didHandle->Unacquire(); // g_sysMouse.didHandle->SetCooperativeLevel( g_strEmuInfo.hMainWindow, DIB_MOUSE ); // PrepareInputDevices does this. g_sysMouse.didHandle->Acquire(); } InitiatePaks( true ); g_strEmuInfo.fInitialisedPlugin = true; LeaveCriticalSection( &g_critical ); #if SPECS_VERSION == 0x0100 FillControls(Controls); #elif SPECS_VERSION >= 0x0101 FillControls(ControlInfo.Controls); #endif // SPECS_VERSION return; } // end InitiateControllers
Creator::Creator(QWidget *parent) : QWidget(parent) { _modifier = 0; qRegisterMetaType<MessageLevel>("MessageLevel"); qRegisterMetaType<cv::Mat>("cv::Mat"); qRegisterMetaType<CalibrationSet>("CalibrationSet"); qRegisterMetaType<QMatrix4x4>("QMatrix4x4"); qRegisterMetaType<PositionDesc>("PositionDesc"); ui.setupUi(this); // populate values to comboboxes ui.modifierCombo->addItem("None", QVariant(NoneModifier)); ui.modifierCombo->addItem("Canny", QVariant(CannyModifier)); // connections // Global application // shortcuts _shortcuts.push_back(new QShortcut(QKeySequence("Ctrl+s"), this)); _shortcuts.push_back(new QShortcut(QKeySequence("Alt+a"), this)); _shortcuts.push_back(new QShortcut(QKeySequence("Alt+n"), this)); connect(_shortcuts[0], SIGNAL(activated()), this, SLOT(SaveSettings())); connect(_shortcuts[1], SIGNAL(activated()), this, SLOT(AddPoint())); connect(_shortcuts[2], SIGNAL(activated()), this, SLOT(AddNewPoint())); // worker connects connect(this, SIGNAL(modeChangedSignal(int)), _capturer.GetWorker(), SLOT(SetMode(int))); connect(ui.renderer, SIGNAL( DescChangedSignal(PositionDesc&)), this, SLOT(FillActive(PositionDesc&))); // rendered connects connect(ui.renderGroup, SIGNAL(buttonClicked(int)), ui.renderer, SLOT(ChangeRenderStyle(int))); ui.renderGroup->setId(ui.renderPointsButton, RenderPoints); ui.renderGroup->setId(ui.renderWireframeButton, RenderWireframe); ui.renderGroup->setId(ui.renderFullButton, RenderComplete); connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(LoadModel())); connect(ui.renderer, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.infobox, SLOT(Report(MessageLevel, const QString&))); connect(ui.reloadShadersButton, SIGNAL(clicked()), ui.renderer, SLOT(ChangeShaders())); connect(ui.lockGroup, SIGNAL(buttonClicked(int)), ui.renderer, SLOT(ChangeActiveKeyPos(int))); ui.lockGroup->setId(ui.cameraRadioButton, PositionCamera); ui.lockGroup->setId(ui.modelRadioButton, PositionModel); ui.lockGroup->setId(ui.lightRadioButton, PositionLight); // videorender connections connect(ui.applyDescButton, SIGNAL(clicked()), this, SLOT(ChangeActiveDesc())); connect(ui.saveSettingsButton, SIGNAL(clicked(void)), this, SLOT(SaveSettings())); connect(ui.playButton, SIGNAL(clicked(void)), this, SLOT(PlayVideo())); connect(ui.pauseButton, SIGNAL(clicked(void)), this, SLOT(Pause(void))); connect(ui.cloudPoints, SIGNAL(Finished(void)), this, SLOT(EnablePlay())); connect(ui.cloudPoints, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.infobox, SLOT(Report(MessageLevel, const QString&))); connect(ui.createMeshButton, SIGNAL(clicked()),this, SLOT(StartCreating())); //connect(ui.nextFrameButton, SIGNAL(clicked(void)), ui.cloudPoints, SLOT(RequestNextFrame())); //connect(ui.prevFrameButton, SIGNAL(clicked(void)), ui.cloudPoints, SLOT(RequestPrevFrame())); ui.nextFrameButton->setDisabled(true); ui.prevFrameButton->setDisabled(true); connect(ui.stopButton, SIGNAL(clicked(void)), this, SLOT(Stop(void))); connect(ui.featuresCheckbox, SIGNAL(clicked(void)), this, SLOT(FeaturesFromFrame())); connect(ui.stopButton, SIGNAL(clicked(void)), this, SLOT(Stop())); connect(ui.greyCheckBox, SIGNAL(clicked(void)), this, SLOT(ShowGreyFrame(void))); connect(ui.newButton, SIGNAL(clicked(void)), this, SLOT(CreateNew(void))); //calibration connects connect(ui.loadCalibrationButton, SIGNAL(clicked()), this, SLOT(LoadCalibration(void))); connect(ui.runCalibrationButton, SIGNAL(clicked()), this, SLOT(RunCalibration(void))); connect(ui.calibrationFolderButton, SIGNAL(clicked()), this, SLOT(LoadCalibrationImages())); connect(ui.applyCalibrationButton, SIGNAL(clicked()), this, SLOT(SendParameters())); connect(ui.playUndistortedButton, SIGNAL(clicked()), this, SLOT(ShowUndistorted())); connect(ui.saveCalibrationButton, SIGNAL(clicked()), this, SLOT(SaveCalibration())); connect(&_capturer, SIGNAL(imageReadySignal(cv::Mat)), ui.cloudPoints, SLOT(setImage(cv::Mat))); connect(&_capturer, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.cloudPoints, SLOT(Report(MessageLevel, const QString &))); connect(_capturer.GetWorker(), SIGNAL(camParametersSignal(cv::Mat, cv::Mat)), ui.cloudPoints, SLOT(ShowParameters(cv::Mat, cv::Mat))); connect(ui.cloudPoints, SIGNAL(setCalibrationSignal(CalibrationSet)), _capturer.GetWorker(), SLOT(ChangeCalibration(CalibrationSet))); // comparer connects connect(ui.compareNext, SIGNAL(clicked()), this, SLOT(GetNextImagePair())); connect(this, SIGNAL(PreparePairSignal(int, int)), _capturer.GetWorker(), SLOT(PreparePair(int,int))); connect(_capturer.GetWorker(), SIGNAL(imagePairSignal(cv::Mat, cv::Mat)), this, SLOT(SetCompare(cv::Mat, cv::Mat))); connect(ui.applyModifierButton, SIGNAL(clicked()), this, SLOT(SetModifier())); //connect(ui.comparePrev, SIGNAL(clicked()), this, SLOT(GetPrevImagePair())); // rest of the initialization LoadSettings(); }
void KeyMap::PCtoX(BYTE virtKey, DWORD keyData, ClientConnection* clientCon) { bool down = ((keyData & 0x80000000) == 0); bool extended = ((keyData & 0x1000000) != 0); bool repeated = ((keyData & 0xc0000000) == 0x40000000); UINT extVkey = virtKey + (extended ? 256 : 0); // exclude winkey when not scroll-lock if (virtKey==91 || virtKey==92) return; vnclog.Print(8, _T("\nPCtoX: %svirtKey 0x%02x%s%s, keyData 0x%08x\n"), (extended ? _T("extended ") : _T("")), virtKey, (repeated ? _T(" repeated") : _T("")), (down ? _T(" down") : _T(" up")), keyData); // If this is a key release then just send the associated sent KeySym when // this key was pressed if (!down) { vnclog.Print(8, _T("Release the associated KeySym when this VirtKey was pressed\n")); if (downUnicode[extVkey]) { vnclog.Print(8, _T(" 0x%04x (%c): "), downUnicode[extVkey], downUnicode[extVkey]); downUnicode[extVkey] = NULL; } else { vnclog.Print(8, _T(" Control character: ")); } releaseKey(clientCon, extVkey); vnclog.Print(8, _T("\n")); GetKeyboardState(KBKeysState); if (!((KBKeysState[VK_MENU] & 0x80) && (KBKeysState[VK_CONTROL] & 0x80))) { if (storedDeadChar && reset) { reset=false; keybd_event(VK_SPACE, 0, 0, 0); keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0); } } return; } // We try to look it up in our key table // Look up the desired code in the keyMap table try to find the exact match according to // the extended flag, then try the opposite of the extended flag CARD32 foundXCode = XK_VoidSymbol; bool exactMatched = false; vnclog.Print(8, _T("Looking in key table ")); for (UINT i = 0; i < (sizeof(keyMap) / sizeof(vncKeyMapping_t)); i++) { if (keyMap[i].WinCode == virtKey) { foundXCode = keyMap[i].XCode; if (extended == keyMap[i].extVK) { exactMatched = true; break; } } } if (foundXCode != XK_VoidSymbol) { vnclog.Print(8, _T("-> keyMap gives (from %s extended flag) KeySym %u (0x%08x)\n"), (exactMatched ? _T("matched") : _T("opposite")), foundXCode, foundXCode); pressKey(clientCon, extVkey, foundXCode); vnclog.Print(8, _T("\n")); return; } else { vnclog.Print(8, _T("-> not in special keyMap\n")); } // Under CE, we're not so concerned about this bit because we handle a WM_CHAR message later #ifndef UNDER_CE GetKeyboardState(KBKeysState); ModifierKeyReleaser lctrl(clientCon, VK_CONTROL, 0); ModifierKeyReleaser lalt(clientCon, VK_MENU, 0); ModifierKeyReleaser ralt(clientCon, VK_MENU, 1); if ((KBKeysState[VK_MENU] & 0x80) && (KBKeysState[VK_CONTROL] & 0x80)) { // This is a Ctrl-Alt (AltGr) key on international keyboards (= LCtrl-RAlt) // Ex. Ctrl-Alt-Q gives '@' on German keyboards vnclog.Print(8, _T("Ctrl-Alt pressed:\n")); // We must release Control and Alt (AltGr) if they were both pressed, so the character // is seen without them by the VNC server // We don't release the Right Control; this allows German users // to use it for doing Ctrl-AltGr-x, e.g. Ctl-@, etc lctrl.release(downKeysym); lalt.release(downKeysym); ralt.release(downKeysym); } else { // This is not a Ctrl-Alt (AltGr) key vnclog.Print(8, _T("Ctrl-Alt not pressed, fake release any Ctrl key\n")); // There are no KeySym corresponding to control characters, e.g. Ctrl-F // The server has already known whether the Ctrl key is pressed from the previouse key event // So we are interested in the key that would be there if the Ctrl key were not pressed KBKeysState[VK_CONTROL] = KBKeysState[VK_LCONTROL] = KBKeysState[VK_RCONTROL] = 0; } int ret; if (storedDeadChar) { SHORT virtDeadKey; BYTE prevModifierState = 0; vnclog.Print(8, _T("[Storing base character modifier(s)]\n")); StoreModifier(&prevModifierState, KBKeysState); virtDeadKey = VkKeyScanW(storedDeadChar); vnclog.Print(8, _T("[A dead key was stored, restoring the dead key state:") _T(" 0x%02x (%c) using virtDeadKey 0x%02x] "), storedDeadChar, storedDeadChar, virtDeadKey); SetModifier(HIBYTE(virtDeadKey), KBKeysState); vnclog.Print(8, _T("\n")); ToUnicode((virtDeadKey & 0xff), 0, KBKeysState, ucsChar, (sizeof(ucsChar) / sizeof(WCHAR)), 0); vnclog.Print(8, _T("[Restoring base character modifier(s)] ")); SetModifier(prevModifierState, KBKeysState); vnclog.Print(8, _T("\n")); storedDeadChar = 0; ret = ToUnicode(virtKey, 0, KBKeysState, ucsChar, (sizeof(ucsChar) / sizeof(WCHAR)), 0); } else ret = ToUnicode(virtKey, 0, KBKeysState, ucsChar, (sizeof(ucsChar) / sizeof(WCHAR)), 0); if (ucsChar[0]==8364) { //euro // return; } if (ret < 0 || ret==2) { // It is a dead key vnclog.Print(8, _T("ToUnicode returns dead key: 0x%02x (%c) "), *ucsChar, *ucsChar); if (sendDeadKey) { // We try to look it up in our dead key table // Look up the desired code in the deadKeyMap table foundXCode = XK_VoidSymbol; for (UINT i = 0; i < (sizeof(deadKeyMap) / sizeof(vncDeadKeyMapping_t)); i++) { if (deadKeyMap[i].deadKeyChar == *ucsChar) { foundXCode = deadKeyMap[i].XCode; break; } } if (foundXCode != XK_VoidSymbol) { vnclog.Print(8, _T("-> deadKeyMap gives KeySym %u (0x%08x)\n"), foundXCode, foundXCode); pressKey(clientCon, extVkey, foundXCode); } else { vnclog.Print(8, _T("-> not in deadKeyMap\n")); } } else { storedDeadChar = *ucsChar; reset=true; vnclog.Print(8, _T("-> Store the dead key state, wait for next key-stroke\n")); } FlushDeadKey(KBKeysState); } else if (ret > 0) { vnclog.Print(8, _T("ToUnicode returns %d character(s):\n"), ret); for (int i = 0; i < ret; i++) { CARD32 xChar = UCS2X(*(ucsChar+i)); if (xChar != XK_VoidSymbol) { downUnicode[extVkey] = *(ucsChar+i); pressKey(clientCon, extVkey, xChar); } } } else { vnclog.Print(8, _T("No character is generated by this key event\n")); } #endif vnclog.Print(8, _T("\n")); };