int csFindCommon(commands_e command, bool error) { char word[100] = {0}; int refs = 0; if (!projectOpened) { ::MessageBox(NULL, TEXT("Project Not opened"), TEXT("SourceNav"), MB_OK); return refs; } getCurrentWord(word, sizeof(word)); exec_command(command, word); refs = buildCrossRefs(); if (refs) { if (refs > 1) { pushHistory(); csOutputDiag(refs); } else { /* Jump to file and line number */ pushHistory(); jumpTo (refInfo[0].filename, refInfo[0].lineno - 1); } } else { if (error) ::MessageBox(NULL, TEXT("No references found"), TEXT("SourceNav"), MB_OK); } //gCommand = command_none; return refs; }
void csGooo (TCHAR *text) { int refs = 0; char word[100]; if (!projectOpened) { ::MessageBox(NULL, TEXT("Project Not opened"), TEXT("SourceNav"), MB_OK); } wcstombs(word, text, wcslen(text) + 1); exec_command(gCommand, word); refs = buildCrossRefs(); if (refs) { if (refs > 1) { pushHistory(); csOutputDiag(refs); } else { /* Jump to file and line number */ pushHistory(); jumpTo (refInfo[0].filename, refInfo[0].lineno - 1); } } else { ::MessageBox(NULL, TEXT("No references found"), TEXT("SourceNav"), MB_OK); } //gCommand = command_none; gCommand = command_none; }
void ChatLineEdit::keyPressEvent(QKeyEvent *event) { if(event->key() == Qt::Key_Up) { if(_historypos>0) { if(_historypos==_history.count()) _current = text(); --_historypos; setText(_history[_historypos]); } } else if(event->key() == Qt::Key_Down) { if(_historypos<_history.count()-1) { ++_historypos; setText(_history[_historypos]); } else if(_historypos==_history.count()-1) { ++_historypos; setText(_current); } } else if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { QString txt = trimmedText(); if(!txt.isEmpty()) { pushHistory(txt); _historypos = _history.count(); setText(QString()); emit returnPressed(txt); } } else { QLineEdit::keyPressEvent(event); } }
int CommandProcessor::executeCommand(const char* commandLine) { int argc; char** argv = NULL; int returnStatus = COMMAND_FAILED; int argIndex; parseCommandLine(commandLine, &argc, &argv); //printf("found %d arguments\n", argc); if(argc && argv) { returnStatus = executeCommand(argc, argv); //printf("CommandProcessor::executeCommand(const char* commandLine) exiting with status: %d\n", returnStatus); if(returnStatus == COMMAND_NOT_FOUND) { printf("Command: \"%s\" not found\n", argv[0]); } for(argIndex = 0; argIndex < argc; argIndex++) { delete[] argv[argIndex]; } delete[] argv; pushHistory(commandLine); } //printf("CommandProcessor::executeCommand(const char* commandLine) exiting with status: %d\n", returnStatus); return(returnStatus); }
void SqlLineEdit::keyPressEvent(QKeyEvent *event) { if(event->key() == Qt::Key_Up) { if(m_historypos>0) { if(m_historypos==m_history.count()) m_current = text(); --m_historypos; setText(m_history[m_historypos]); } } else if(event->key() == Qt::Key_Down) { if(m_historypos<m_history.count()-1) { ++m_historypos; setText(m_history[m_historypos]); } else if(m_historypos==m_history.count()-1) { ++m_historypos; setText(m_current); } } else if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { QString txt = text().trimmed(); if(!txt.isEmpty()) { pushHistory(txt); m_historypos = m_history.count(); setText(QString()); } emit returnPressed(txt); } else { KLineEdit::keyPressEvent(event); } }
void EditorApplication::mousePressedObjectsPalettePreview(const OIS::MouseEvent &arg, OIS::MouseButtonID id) { if (id == OIS::MB_Left) { // Update nodes to be under the mouse mouseMovedObjectsPalettePreview(arg); clearSelection(); HistoryActionWrapper *wrapper = new HistoryActionWrapper(); for (list<ObjectNode *>::iterator it=current_palette_nodes.begin(); it!=current_palette_nodes.end(); it++) { LibGens::Object *object_from_preview = (*it)->getObject(); if (object_from_preview) { LibGens::Object *new_object = new LibGens::Object(object_from_preview); if (current_level) { if (current_level->getLevel()) { new_object->setID(current_level->getLevel()->newObjectID()); } } if (current_set) { current_set->addObject(new_object); if (!current_level) { new_object->setID(current_set->newObjectID()); } } // Create ObjectNode *new_object_node = object_node_manager->createObjectNode(new_object); // Push to History HistoryActionCreateObjectNode *action = new HistoryActionCreateObjectNode(new_object, object_node_manager); wrapper->push(action); // Add to current selection HistoryActionSelectNode *action_select = new HistoryActionSelectNode(new_object_node, false, true, &selected_nodes); new_object_node->setSelect(true); selected_nodes.push_back(new_object_node); wrapper->push(action_select); } } pushHistory(wrapper); updateSelection(); if (!keyboard->isModifierDown(OIS::Keyboard::Ctrl) && !keyboard->isModifierDown(OIS::Keyboard::Shift)) { clearObjectsPalettePreviewGUI(); } } if (id == OIS::MB_Right) { clearObjectsPalettePreviewGUI(); } }
//static int makeEntry ( PUZZLE *puzzle, int i, int j, int entry ) static int makeEntry ( PUZZLE *puzzle, int i, int j, short *pentry ) { int status = 0; //int bit = digit2bit ( entry ); short bit = digit2bit ( star(pentry) ); short *pbit = &bit; IFT(pbit, pentry); #if defined(DEBUG) //fprintf ( logFile, "makeEntry ( %p, %d, %d, %d ) {\n", puzzle, i, j, entry ); fprintf ( logFile, "makeEntry ( %p, %d, %d, %p ) {\n", puzzle, i, j, pentry ); fflush ( logFile ); #endif /* Is this a legal entry? */ if ( puzzle->rowMasks [i] & puzzle->columnMasks [j] & puzzle->blockMasks [i/3][j/3] & bit ) { status = 1; puzzle->rowMasks [i] ^= bit; puzzle->columnMasks [j] ^= bit; puzzle->blockMasks [i/3][j/3] ^= bit; //puzzle->grid [i][j] = entry; puzzle->grid [i][j] = star(pentry); puzzle->masks [i][j] = 0; IFT(puzzle->prowMasks [i], pbit); IFT(puzzle->pcolumnMasks [j], pbit); IFT(puzzle->pblockMasks [i/3][j/3], pbit); IFT(puzzle->pgrid [i][j], pentry); if ( puzzle->history ) pushHistory ( puzzle->history, i, j ); } #if defined(DEBUG) fprintf ( logFile, "} = %d /* makeEntry () */\n", status ); fflush ( logFile ); #endif return ( status ); }
void CProtoHapticDoc::saveState() { pushHistory(this->clone()); }