void GameSessionInput::selectUnit() { if(!leftShiftPressed) unselectAll(); vec3 clickPos = Root::shared().getDepthResult(); vec2 clickPos2(clickPos.x, clickPos.z); Faction* lf = session->getLocalFaction(); if(!lf) return; Unit* best_unit = 0; float best_distance = 100.0; float dist; for(list<Unit*>::iterator it = lf->getUnits().begin(); it != lf->getUnits().end(); ++it) { dist = glm::distance((*it)->getPosition2(), clickPos2); if(dist < 2.0 * (*it)->getInfo()->radius && dist < best_distance) { best_distance = dist; best_unit = (*it); } } if(best_unit) { SoundManager::shared().play(best_unit->getInfo()->selectionSound); best_unit->setSelected(true); if(leftControlPressed) best_unit->getDebugText(); } }
void GUIResourceTreeView::dropTargetDragDropped(INT32 x, INT32 y) { const GUITreeView::InteractableElement* element = findElementUnderCoord(Vector2I(x, y)); TreeElement* treeElement = nullptr; if(element != nullptr) { if(element->isTreeElement()) treeElement = element->getTreeElement(); else treeElement = element->parent; } if(mDropTarget->getDropType() == OSDropType::FileList) { Vector<WString> fileList = mDropTarget->getFileList(); mDraggedResources = bs_new<InternalDraggedResources>((UINT32)fileList.size()); for(UINT32 i = 0; i < (UINT32)fileList.size(); i++) mDraggedResources->resourcePaths[i] = fileList[i]; dragAndDropEnded(treeElement); bs_delete(mDraggedResources); mDraggedResources = nullptr; unselectAll(); } mDragInProgress = false; mDropTargetDragActive = false; _markLayoutAsDirty(); }
void Dashboard::selectCard(const QString &pattern, bool forward){ if(selected) selected->select(); // adjust the position // find all cards that match the card type QList<CardItem*> matches; foreach(CardItem *card_item, card_items){ if(card_item->isEnabled() && card_item->getCard()->match(pattern)) matches << card_item; } if(matches.isEmpty()){ unselectAll(); return; } int index = matches.indexOf(selected); int n = matches.length(); if(forward) index = (index + 1) % n; else index = (index - 1 + n) % n; CardItem *to_select = matches[index]; if(to_select != selected){ if(selected) selected->unselect(); to_select->select(); selected = to_select; emit card_selected(selected->getCard()); } }
// -------------------------------------------------------------------------------------------------------- void KSelectionHandler::unpicked () { if ((SDL_GetModState() & KMOD_SHIFT) == false) { unselectAll(); } }
//------------------------------------------------------------------------- void MainWindow::keyPressEvent( QKeyEvent * event ) { if ( mLanguageTextEdit->hasFocus() ) return; int key = event->key(); if ( key == Qt::Key_Shift ) { if ( selectedLanguageItems().size() == 0 ) { //Cancel any previous export process. finalizeExport(true); //Start the export process. //Go in first state of export process. mExportState = WaitRectStart; unselectAll(); QApplication::setOverrideCursor( Qt::CrossCursor ); event->accept(); } } else if ( key == Qt::Key_Escape ) { finalizeExport(true); event->accept(); } }
void selectAdd(FileWindowRec *fw, String pattern, Boolean replace_sel) { SelectionRec *sel = &fw->selected; FileRec *file; int i, j; Boolean changed = False; if (replace_sel && fw->selected.n_sel) { unselectAll(fw); changed = True; } for (i=0; i < fw->n_files; i++) { if ((replace_sel || getSelNr(fw, i) == -1) && fnmultimatch(pattern, (file = fw->files[i])->name)) { changed = True; if ((j = sel->n_sel++) >= sel->n_alloc) sel->file = (FileSpec *) XTREALLOC(sel->file, (sel->n_alloc += 10) * sizeof(FileSpec)); sel->file[j].nr = i; sel->file[j].name = XtNewString(file->name); sel->n_bytes += file->stats.st_size; XtVaSetValues(file->form, XmNborderColor, resources.select_color, NULL); } } if (changed) updateStatus(fw); XTFREE(pattern); }
void GameSessionInput::selectUnits(float x_min, float x_max, float y_min, float y_max) { if(!leftShiftPressed) unselectAll(); Faction* lf = session->getLocalFaction(); bool firstUnitSelected = false; if(!lf) return; for(list<Unit*>::iterator it = lf->getUnits().begin(); it != lf->getUnits().end(); ++it) { vec2 onScreen = (*it)->getScreenPosition(); if((onScreen.x > x_min && onScreen.x < x_max) && (onScreen.y > y_min && onScreen.y < y_max)) { (*it)->setSelected(true); if(!firstUnitSelected) { SoundManager::shared().play((*it)->getInfo()->selectionSound); } firstUnitSelected = true; if(leftControlPressed) (*it)->getDebugText(); } } }
void GUIResourceTreeView::setSelection(const Vector<Path>& paths) { unselectAll(); Stack<ResourceTreeElement*> todo; todo.push(&mRootElement); while (!todo.empty()) { ResourceTreeElement* currentElem = todo.top(); todo.pop(); auto iterFind = std::find(paths.begin(), paths.end(), currentElem->mFullPath); if (iterFind != paths.end()) { expandToElement(currentElem); selectElement(currentElem); } for (auto& child : currentElem->mChildren) { ResourceTreeElement* sceneChild = static_cast<ResourceTreeElement*>(child); todo.push(sceneChild); } } }
void NodeList_sV::select(const Node_sV *node, bool newSelection) { if (newSelection) { unselectAll(); const_cast<Node_sV*>(node)->select(true); } else { const_cast<Node_sV*>(node)->select(!node->selected()); } }
Kfind::Kfind( QWidget *parent, const char *name, const char *searchPath ) : QWidget( parent, name ) { // init IO buffer iBuffer = 0; //create tabdialog tabDialog = new KfindTabDialog(this,"dialog",searchPath); //prepare window for find results win = new KfindWindow(this,"window"); win->hide(); //and hide it firstly winsize=1; connect(win ,SIGNAL(resultSelected(bool)), this,SIGNAL(resultSelected(bool))); connect(win ,SIGNAL(statusChanged(const char *)), this,SIGNAL(statusChanged(const char *))); connect(this,SIGNAL(deleteFile()), win,SLOT(deleteFiles())); connect(this,SIGNAL(properties()), win,SLOT(fileProperties())); connect(this,SIGNAL(openFolder()), win,SLOT(openFolder())); connect(this,SIGNAL(saveResults()), win,SLOT(saveResults())); connect(this,SIGNAL(addToArchive()), win,SLOT(addToArchive())); connect(this,SIGNAL(open()), win,SLOT(openBinding())); connect(parentWidget(),SIGNAL(selectAll()), win,SLOT(selectAll())); connect(parentWidget(),SIGNAL(unselectAll()), win,SLOT(unselectAll())); connect(parentWidget(),SIGNAL(invertSelection()), win,SLOT(invertSelection())); connect(&findProcess,SIGNAL(processExited(KProcess *)), this,SLOT(processResults())); connect(&findProcess,SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(handleStdout(KProcess *, char *, int))) ; resize(sizeHint()); //emit haveResults(false); // we're not connectd to anything yet!? };
void Dashboard::selectAll(){ if(view_as_skill){ unselectAll(); foreach(CardItem *card_item, card_items){ selectCard(".", true); pendings << card_item; } updatePending(); }
//------------------------------------------------------------------------- void MainWindow::exportRect(const QRectF& exportRectangle , const QString& fileName , const QString& fileType ) { QList<QLanguageItem*> selectedItems = selectedLanguageItems(); unselectAll(); QPainter painter; if ( fileType == PNG_FILE_FILTER ) { int result = QResolutionDialog( exportRectangle , EXPORT_MIN_DETAIL , EXPORT_MAX_DETAIL , EXPORT_DEFAULT_DETAIL , EXPORT_DETAIL_TO_SCALE_FACTOR ).exec(); if ( result ) { //Create a new QImage, with a size corresponding to the Guido Score page QSizeF size( exportRectangle.width() , exportRectangle.height() ); size.setWidth( result * EXPORT_DETAIL_TO_SCALE_FACTOR * size.width() ); size.setHeight( result * EXPORT_DETAIL_TO_SCALE_FACTOR * size.height() ); QImage image( size.width() , size.height() , QImage::Format_ARGB32); image.fill( QColor(Qt::white).rgb() ); painter.begin( &image ); //Paint in the QImage paintSceneRect( exportRectangle , &painter ); painter.end(); image.save( fileName , "PNG" ); } } else if ( ( fileType == PDF_FILE_FILTER ) || ( fileType == PS_FILE_FILTER ) ) { QPrinter printer; printer.setFullPage(true); printer.setOutputFileName( fileName ); if ( fileType == PS_FILE_FILTER ) { printer.setOutputFormat( QPrinter::PostScriptFormat ); } else if ( fileType == PDF_FILE_FILTER ) { printer.setOutputFormat( QPrinter::PdfFormat ); } printer.setPaperSize( QSizeF( exportRectangle.width() , exportRectangle.height() ) , QPrinter::Millimeter ); painter.setWindow( exportRectangle.toRect() ); painter.begin( &printer ); paintSceneRect( exportRectangle , &painter ); painter.end(); } for ( int i = 0 ; i < selectedItems.size() ; i++ ) selectedItems[i]->setSelected(true); }
/*! * Constructeur * */ CNiveauTraceModules::CNiveauTraceModules(QWidget *parent) : QDialog(parent), m_table_created(false) { ui.setupUi(this); ui.table_niveau_aff_modules->setColumnWidth(0, 155); connect(this->ui.pb_select_all, SIGNAL(clicked()), this, SLOT(selectAll())); connect(this->ui.pb_deselect_all, SIGNAL(clicked()), this, SLOT(unselectAll())); connect(this->ui.table_niveau_aff_modules, SIGNAL(cellChanged(int,int)), this, SLOT(refreshMemory(int,int))); connect(this->ui.table_niveau_aff_modules, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(refreshLine(int,int))); }
void RadioList::onToggleClicked(bool & toggleValue){ unselectAll(); // Search for the actual toggle triggering the event int i; for(i = 0; i < guiGroup.getNumControls(); i++){ ofxToggle * toggle = static_cast <ofxToggle *>(guiGroup.getControl(i)); ofParameter <bool> * paramPtr = static_cast <ofParameter <bool> *>(&toggle->getParameter()); if(&(paramPtr->get()) == &toggleValue){ selectItem(i); break; } } }
void RadioList::selectItem(int index){ if(index >= guiGroup.getNumControls()){ return; } unselectAll(); ofxToggle * toggle = static_cast <ofxToggle *>(guiGroup.getControl(index)); toggle->removeListener(this, &RadioList::onToggleClicked); *toggle = true; // Select the specific radio button toggle->addListener(this, &RadioList::onToggleClicked); //string name = toggle->getName(); // Throw event with value that is image path instead of name string value = storedValues[index]; ofNotifyEvent(onRadioSelected, value, this); storedSelectedItem = index; }
void ItemDocument::canvasRightClick(const QPoint &pos, QCanvasItem* item) { if (item) { if (dynamic_cast<CNItem*>(item) && !item->isSelected()) { unselectAll(); select(item); } } KTechlab::self()->unplugActionList("alignment_actionlist"); KTechlab::self()->unplugActionList("orientation_actionlist"); fillContextMenu(pos); QPopupMenu *pop = static_cast<QPopupMenu*>(KTechlab::self()->factory()->container("item_popup", KTechlab::self())); if (!pop) return; pop->popup(pos); }
void ItemDocument::paste() { QString xml = KApplication::clipboard()->text(QClipboard::Clipboard); if (xml.isEmpty()) return; unselectAll(); ItemDocumentData data(type()); if (!data.fromXML(xml)) return; data.generateUniqueIDs(this); // data.translateContents( 64, 64 ); data.mergeWithDocument(this, true); // Get rid of any garbage that shouldn't be around / merge connectors / etc flushDeleteList(); requestStateSave(); }
void ViewCollection::selectAll(bool allShowState) { unselectAll(); ViewInstancesHash::iterator iNode= m_ViewInstanceHash.begin(); while (iNode != m_ViewInstanceHash.end()) { ViewInstance *pCurrentInstance= &(iNode.value()); const unsigned int instanceId= pCurrentInstance->id(); if (allShowState || (pCurrentInstance->isVisible() == m_IsInShowSate)) { pCurrentInstance->select(false); m_SelectedInstances.insert(instanceId, pCurrentInstance); m_MainInstances.remove(instanceId); if(isInAShadingGroup(instanceId)) { m_ShadedPointerViewInstanceHash.value(shadingGroup(instanceId))->remove(instanceId); } } iNode++; } }
bool RadioList::selectItemByValue(string itemValue){ if(itemValue == ""){ ofLogNotice("RadioList") << "Item value empty"; return false; } unselectAll(); int itemIndex = -1; for(int i = 0; i < storedValues.size(); i++){ if(itemValue == storedValues[i]){ itemIndex = i; break; } } if(itemIndex >= 0){ ofxToggle * toggle = static_cast <ofxToggle *>(guiGroup.getControl(itemIndex)); toggle->removeListener(this, &RadioList::onToggleClicked); *toggle = true; // Select the specific radio button toggle->addListener(this, &RadioList::onToggleClicked); return true; } ofLogNotice("RadioList") << "Item with value " << itemValue << " not found"; return false; }
// -------------------------------------------------------------------------------------------------------- void KSelectionHandler::picked () { KSelectable * selectable; if (picked_pickable->getClassId() >= KSelectable::classId()) { selectable = (KSelectable *)picked_pickable; } else // try to find selectable parent { const KPickable * parent = picked_pickable; while (parent = getParentOfPickable(parent)) { if (parent->getClassId() >= KSelectable::classId()) { break; } } if (!parent) return; selectable = (KSelectable*)parent; } if (selectable->isSelected()) { unselect(selectable); } else { if ((SDL_GetModState() & KMOD_SHIFT) == false) { unselectAll(); } select(selectable); } }
void ofApp::guiEvent_DropDownList(ofxUIEventArgs &e) { string m_nomWidget = e.widget->getName(); int m_kindWidget = e.widget->getKind(); if (m_kindWidget == OFX_UI_WIDGET_DROPDOWNLIST) { if (m_nomWidget == "Elements 2D") { ofxUIToggle *toggle = (ofxUIToggle*)e.widget; m_DDL_1->setShowCurrentSelected(toggle->getValue()); ofxUIDropDownList *m_DDL_Temp = (ofxUIDropDownList*)e.widget; vector<ofxUIWidget *> &m_selectedDDL = m_DDL_Temp->getSelected(); list<Primitive*>::iterator it = this->primitives.begin(); for (it; it != this->primitives.end(); it++) { (*it)->SetSelected(false); } if (m_selectedDDL.size() > 0) { unselectAll(m_nomWidget); it = this->primitives.begin(); for (it; it != this->primitives.end(); it++) { if (m_selectedDDL.at(0)->getName() == (*it)->GetNom()) { (*it)->SetSelected(true); m_positionX = (*it)->GetX(); m_positionY = (*it)->GetY(); m_positionZ = (*it)->GetZ(); m_rotationX = (*it)->GetRotationX(); m_rotationY = (*it)->GetRotationY(); m_rotationZ = (*it)->GetRotationZ(); m_couleurR = (float)(*it)->GetColor().r; m_couleurG = (float)(*it)->GetColor().g; m_couleurB = (float)(*it)->GetColor().b; m_couleurA = (float)(*it)->GetColor().a; } } } /*for (int i = 0; i < m_selectedDDL.size(); i++) { if (m_selectedDDL.at(i)->getName() == (*it)->GetNom()) { (*it)->SetSelected(true); } it++; }*/ } else if (m_nomWidget == "Elements 3D") { ofxUIToggle *toggle = (ofxUIToggle*)e.widget; m_DDL_2->setShowCurrentSelected(toggle->getValue()); ofxUIDropDownList *m_DDL_Temp = (ofxUIDropDownList*)e.widget; vector<ofxUIWidget *> &m_selectedDDL = m_DDL_Temp->getSelected(); list<Form*>::iterator it = this->forms.begin(); for (it; it != this->forms.end(); it++) { (*it)->SetSelected(false); } if (m_selectedDDL.size() > 0) { unselectAll(m_nomWidget); it = this->forms.begin(); for (it; it != this->forms.end(); it++) { if (m_selectedDDL.at(0)->getName() == (*it)->GetNom()) { (*it)->SetSelected(true); m_positionX = (*it)->GetX(); m_positionY = (*it)->GetY(); m_positionZ = (*it)->GetZ(); m_rotationX = (*it)->GetRotationX(); m_rotationY = (*it)->GetRotationY(); m_rotationZ = (*it)->GetRotationZ(); m_couleurR = (float)(*it)->GetColor().r; m_couleurG = (float)(*it)->GetColor().g; m_couleurB = (float)(*it)->GetColor().b; m_couleurA = (float)(*it)->GetColor().a; } } } /*for (int i = 0; i < m_selectedDDL.size(); i++) { if (m_selectedDDL.at(i)->getName() == (*it)->GetNom()) { (*it)->SetSelected(true); } it++; }*/ } else if (m_nomWidget == "Groupes") { ofxUIToggle *toggle = (ofxUIToggle*)e.widget; m_DDL_3->setShowCurrentSelected(toggle->getValue()); ofxUIDropDownList *m_DDL_Temp = (ofxUIDropDownList*)e.widget; vector<ofxUIWidget *> &m_selectedDDL = m_DDL_Temp->getSelected(); list<Group*>::iterator it = this->groups.begin(); if (m_selectedDDL.size() > 0) unselectAll(m_nomWidget); for (it; it != this->groups.end(); it++) { (*it)->SetSelected(false); } if (m_selectedDDL.size() > 0) { unselectAll(m_nomWidget); it = this->groups.begin(); for (it; it != this->groups.end(); it++) { if (m_selectedDDL.at(0)->getName() == (*it)->GetNom()) { (*it)->SetSelected(true); m_positionX = (*it)->GetX(); m_positionY = (*it)->GetY(); m_positionZ = (*it)->GetZ(); m_rotationX = (*it)->GetRotationX(); m_rotationY = (*it)->GetRotationY(); m_rotationZ = (*it)->GetRotationZ(); m_couleurR = (float)(*it)->GetColor().r; m_couleurG = (float)(*it)->GetColor().g; m_couleurB = (float)(*it)->GetColor().b; m_couleurA = (float)(*it)->GetColor().a; } } } /*for (int i = 0; i < m_selectedDDL.size(); i++) { if (m_selectedDDL.at(i)->getName() == (*it)->GetNom()) { (*it)->SetSelected(true); } it++; }*/ } } }
void ofxTLCameraTrack::sample() { unselectAll(); track.sample(timeline->getCurrentFrame()); save(); }
SelectZLayers::SelectZLayers(QDialog *parent) : QDialog(parent) { setupUi(this); connect(btSelAll, SIGNAL(released()), this, SLOT(selectAll())); connect(btUnselAll, SIGNAL(released()), this, SLOT(unselectAll())); }
void deselectCb(Widget w, XtPointer client_data, XtPointer call_data) { unselectAll((FileWindowRec *) client_data); updateStatus((FileWindowRec *) client_data); }
void xQGanttBarViewPort::initMenu() ///////////////////////////////// { _menu = new KPopupMenu(this); /* select */ _selectMenu = new KPopupMenu(_menu); QPixmap pix = _iconloader->loadIcon("ganttSelect.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("ganttSelect.png not found !\n"); _selectMenu->insertItem(pix, i18n("Select Mode"), this, SLOT(setSelect())); _selectMenu->insertSeparator(); pix = _iconloader->loadIcon("ganttSelecttask.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("ganttSelecttask.png not found !\n"); _selectMenu->insertItem(pix, i18n("Select All"), this, SLOT(selectAll())); pix = _iconloader->loadIcon("ganttUnselecttask", KIcon::Toolbar , 16); if(pix.isNull()) printf("ganttUnselecttask.png not found !\n"); _selectMenu->insertItem(pix, i18n("Unselect All"), this, SLOT(unselectAll())); _menu->insertItem(i18n("Select"), _selectMenu); /* zoom */ KPopupMenu *_zoomMenu = new KPopupMenu(_menu); pix = _iconloader->loadIcon("viewmag.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("viewmag.png not found !\n"); _zoomMenu->insertItem(i18n("Zoom Mode"), this, SLOT(setZoom())); _zoomMenu->insertSeparator(); _zoomMenu->insertItem(pix, i18n("Zoom All"), this, SLOT(zoomAll())); _zoomMenu->insertSeparator(); pix = _iconloader->loadIcon("viewmag+.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("viewmag+.png not found !\n"); _zoomMenu->insertItem(pix, i18n("Zoom In +"), this, SLOT(zoomIn())); pix = _iconloader->loadIcon("viewmag-.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("viewmag-.png not found !\n"); _zoomMenu->insertItem(pix, i18n("Zoom Out -"), this, SLOT(zoomOut())); _menu->insertItem("Zoom", _zoomMenu); pix = _iconloader->loadIcon("move.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("move.png not found !\n"); _menu->insertItem(pix, i18n("Move Mode"), this, SLOT(setMove())); _menu->insertSeparator(); pix = _iconloader->loadIcon("configure.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("configure.png not found !\n"); _menu->insertItem(pix, i18n("Configure Gantt..."), _parent, SLOT(showConfig())); }
KToolBar * xQGanttBarViewPort::toolbar(QMainWindow *mw) { if(_toolbar || mw == 0) return _toolbar; _toolbar = new KToolBar(mw, QMainWindow::DockTop); mw->addToolBar(_toolbar); // KIconLoader* iconloader = new KIconLoader("kgantt"); _toolbar->insertButton("ganttSelect.png", 0, SIGNAL(clicked()), this, SLOT(setSelect()), true, i18n("Select")); KPopupMenu *selectMenu = new KPopupMenu(_toolbar); /* select all items */ QPixmap pix = _iconloader->loadIcon("ganttSelecttask.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("ganttSelecttask.png not found !\n"); selectMenu->insertItem(pix, i18n("Select All"), this, SLOT(selectAll())); /* unselect all items */ pix = _iconloader->loadIcon("ganttUnselecttask", KIcon::Toolbar , 16); if(pix.isNull()) printf("ganttUnselecttask.png not found !\n"); selectMenu->insertItem(pix, i18n("Unselect All"), this, SLOT(unselectAll())); KToolBarButton *b = _toolbar->getButton(0); b->setDelayedPopup(selectMenu); _toolbar->insertButton("viewmag.png", 1, SIGNAL(clicked()), this, SLOT(setZoom()), true, i18n("Zoom")); KPopupMenu *zoomMenu = new KPopupMenu(_toolbar); pix = _iconloader->loadIcon("viewmag.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("viewmag.png not found !\n"); zoomMenu->insertItem(pix, i18n("Zoom All"), this, SLOT(zoomAll())); zoomMenu->insertSeparator(); pix = _iconloader->loadIcon("viewmag+.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("viewmag+.png not found !\n"); zoomMenu->insertItem(pix, i18n("Zoom In +"), this, SLOT(zoomIn())); pix = _iconloader->loadIcon("viewmag-.png", KIcon::Toolbar , 16); if(pix.isNull()) printf("viewmag-.png not found !\n"); zoomMenu->insertItem(pix, i18n("Zoom Out -"), this, SLOT(zoomOut())); b = _toolbar->getButton(1); b->setDelayedPopup(zoomMenu); _toolbar->insertButton("move.png", 2, SIGNAL(clicked()), this, SLOT(setMove()), true, i18n("Move")); return _toolbar; }
//------------------------------------------------------------------------- void MainWindow::combineItems( QGraphicsItem * droppedItem , QGraphicsItem* targetItem , int,int, int interactionId ) { QGuidoItemContainer * itemA = dynamic_cast<QGuidoItemContainer *>(targetItem); QGuidoItemContainer * itemB = dynamic_cast<QGuidoItemContainer *>(droppedItem); if ( !itemA || !itemB ) return; //Asking for building a new QGuidoItem or QGuidoSPageItem (depending on "isPageMode" parameter) QString gmnCode; switch ( interactionId ) { case COMBINATION_UNDER_ALIGN_LEFT : gmnCode = QGuidoAR::parallel( itemA->code() , itemB->code() , QGuidoAR::Left ); break; case COMBINATION_UNDER_ALIGN_RIGHT : gmnCode = QGuidoAR::parallel( itemA->code() , itemB->code() , QGuidoAR::Right ); break; case COMBINATION_OVER_ALIGN_LEFT : gmnCode = QGuidoAR::parallel( itemB->code() , itemA->code() , QGuidoAR::Left ); break; case COMBINATION_OVER_ALIGN_RIGHT : gmnCode = QGuidoAR::parallel( itemB->code() , itemA->code() , QGuidoAR::Right ); break; case COMBINATION_BEFORE : gmnCode = QGuidoAR::sequence( itemB->code() , itemA->code() ); break; case COMBINATION_AFTER : gmnCode = QGuidoAR::sequence( itemA->code() , itemB->code() ); break; case COMBINATION_HEAD : gmnCode = QGuidoAR::head( itemA->code() , itemB->code() ); break; case COMBINATION_TAIL : gmnCode = QGuidoAR::tail( itemA->code() , itemB->code() ); break; case COMBINATION_VOICE_HEAD : gmnCode = QGuidoAR::top( itemA->code() , itemB->code() ); break; case COMBINATION_VOICE_TAIL : gmnCode = QGuidoAR::bottom( itemA->code() , itemB->code() ); break; case COMBINATION_INTERLEAVE : gmnCode = QGuidoAR::interleave( itemA->code() , itemB->code() ); break; case COMBINATION_TRANSPOSE : gmnCode = QGuidoAR::transpose( itemA->code() , itemB->code() ); break; case COMBINATION_DURATION : gmnCode = QGuidoAR::duration( itemA->code() , itemB->code() ); break; case COMBINATION_RYTHM : gmnCode = QGuidoAR::rythm( itemA->code() , itemB->code() ); break; case COMBINATION_PITCH : gmnCode = QGuidoAR::pitch( itemA->code() , itemB->code() ); break; default: return; } //Set the code of the target item with the code computed by GuidoAR itemA->setCode( gmnCode ); //It's a fusion of 2 items, so we remove the dropped item (only if it was in the main scene: history&storage items are not affected). if ( itemB->scene() == mGraphicsScene ) { itemB->deleteLater(); itemRemoved( itemB ); } unselectAll(); itemA->setSelected( true ); //Don't forget to call QGraphicsSceneMainWindow::addToHistory, because we changed the code GraphicsSceneMainWindow::addToHistory(itemA); }
void KfindTop::menuInit() { KStdAccel stdAccel; _fileMenu = new QPopupMenu; _editMenu = new QPopupMenu; _optionMenu = new QPopupMenu; _helpMenu = new QPopupMenu; fileStart = _fileMenu->insertItem(i18n("&Start search"), _kfind, SLOT(startSearch()), stdAccel.find()); fileStop = _fileMenu->insertItem(i18n("S&top search"), _kfind, SLOT(stopSearch()), Key_Escape); _fileMenu->setItemEnabled(fileStop, FALSE); _fileMenu->insertSeparator(); openWithM = _fileMenu->insertItem(i18n("&Open"), this,SIGNAL(open()), stdAccel.open()); toArchM = _fileMenu->insertItem(i18n("&Add to archive"), this,SIGNAL(addToArchive())); _fileMenu ->insertSeparator(); deleteM = _fileMenu->insertItem(i18n("&Delete"), this,SIGNAL(deleteFile())); propsM = _fileMenu->insertItem(i18n("&Properties"), this,SIGNAL(properties())); _fileMenu ->insertSeparator(); openFldrM = _fileMenu->insertItem(i18n("Open Containing &Folder"), this,SIGNAL(openFolder())); _fileMenu ->insertSeparator(); saveSearchM= _fileMenu->insertItem(i18n("&Save Search"), this,SIGNAL(saveResults()),stdAccel.save()); _fileMenu ->insertSeparator(); quitM = _fileMenu->insertItem(i18n("&Quit"),qApp, SLOT(quit()),stdAccel.quit()); for(int i=openWithM;i>quitM;i--) _fileMenu->setItemEnabled(i,FALSE); int undo = _editMenu->insertItem(i18n("&Undo"), this, SIGNAL(undo()), stdAccel.undo() ); _editMenu ->insertSeparator(); int cut = _editMenu->insertItem(i18n("&Cut"), this, SIGNAL(cut()), stdAccel.cut() ); editCopy = _editMenu->insertItem(i18n("&Copy"), this, SLOT(copySelection()), stdAccel.copy() ); _editMenu->insertSeparator(); editSelectAll = _editMenu->insertItem(i18n("&Select All"), this,SIGNAL(selectAll()) ); editUnselectAll = _editMenu->insertItem(i18n("Unse&lect All"), this,SIGNAL(unselectAll()) ); editInvertSelection = _editMenu->insertItem(i18n("&Invert Selection"), this,SIGNAL(invertSelection()) ); _editMenu->setItemEnabled( undo , FALSE ); _editMenu->setItemEnabled( cut , FALSE ); _editMenu->setItemEnabled( editCopy , FALSE ); _editMenu->setItemEnabled( editSelectAll, FALSE ); _editMenu->setItemEnabled( editUnselectAll, FALSE ); _editMenu->setItemEnabled( editInvertSelection, FALSE ); CHECK_PTR( _optionMenu ); _optionMenu->insertItem(i18n("&Preferences ..."), this,SLOT(prefs())); //_optionMenu->insertItem("Configure key bindings",this,SIGNAL(keys())); QString tmp; tmp.sprintf(i18n("KFind %s\nFrontend to find utility\nMiroslav Flídr <*****@*****.**>\n\nSpecial thanks to Stephan Kulow\n<*****@*****.**>"), KFIND_VERSION); _helpMenu=kapp->getHelpMenu( true, tmp ); _mainMenu = new KMenuBar(this, "_mainMenu"); _mainMenu->insertItem( i18n("&File"), _fileMenu); _mainMenu->insertItem( i18n("&Edit"), _editMenu); _mainMenu->insertItem( i18n("&Options"), _optionMenu); _mainMenu->insertSeparator(); _mainMenu->insertItem( i18n("&Help"), _helpMenu ); };