int Picker::restoreOpenCategories(const std::list<std::list<std::string> >& idList) { int numRestored=0; PickerCell *selectedCell = NULL; for (std::list<std::list<std::string> >::const_iterator catIt = idList.begin(); catIt!=idList.end(); ++catIt) { PickerCells *celllist = cells(); for (std::list<std::string>::const_iterator travIt = (*catIt).begin(); travIt!=(*catIt).end(); ++travIt) { PickerCell *cell = celllist->cellWithId((*travIt)); if (!cell) { break; } celllist = cell->children(); if (!celllist || celllist->count() == 0) { selectedCell = cell; break; } cell->setHideChildren(false); } } setMustRecalc(); if (selectedCell) { selectCell(selectedCell, true); } return numRestored; }
void ParticleContainerLC::resetIterator() { //resetDomainIterator for (int i = 0; i < DIM; i++) { centralCellIndex[i] = 0; } neighborCells = 0; selectCell(centralCellIndex); //LOG4CXX_DEBUG(particlelog, "reseted"); }
Particle& ParticleContainerLC::next() { //nextInDomain while (!hasNextInCell()) { // switch to next cell if no particles left in centralCell int idx = calcIndex(centralCellIndex, cellNums) + 1; // 1D index of next cell numToIndex(idx, centralCellIndex, cellNums); // convert 1D to 3D index neighborCells = 0; selectCell(centralCellIndex); } return nextInCell(); }
void QAccessibleTableCell::doAction(const QString& actionName) { if (actionName == toggleAction()) { if (isSelected()) unselectCell(); else selectCell(); } }
void AspFrame::modifyRoi(spAspRoi_t roi, int x, int y) { if(roi == nullAspRoi) return; spAspCell_t cell = selectCell(x,y); if(cell == nullAspCell) return; roi->modify(cell,x, y, AspMouse::prevX, AspMouse::prevY); displayTop(); }
void AspFrame::deleteRoi(int x, int y) { spAspCell_t cell = selectCell(x,y); if(cell == nullAspCell) return; spAspRoi_t roi = roiList->selectRoi(cell, x,y); if(roi != nullAspRoi) { deleteRoi(roi); } }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: New_Scene(); break; case 1: ExportObj(); break; case 2: ExportMaya(); break; case 3: ExecuteTool01(); break; case 4: ExecuteTool02(); break; case 5: ExecuteTool03(); break; case 6: ExecuteTool04(); break; case 7: ExecuteTool05(); break; case 8: ExecuteTool06(); break; case 9: ExecuteTool07(); break; case 10: ExecuteTool08(); break; case 11: ExecuteTool09(); break; case 12: ExecuteTool10(); break; case 13: ExecuteTool11(); break; case 14: ExecuteTool12(); break; case 15: ExecuteTool13(); break; case 16: ExecuteTool14(); break; case 17: ExecuteTool15(); break; case 18: ExecuteTool16(); break; case 19: ExecuteTool17(); break; case 20: ExecuteTool18(); break; case 21: ExecuteTool19(); break; case 22: ExecuteTool20(); break; case 23: ExecuteTool21(); break; case 24: ExecuteTool22(); break; case 25: ExecuteTool23(); break; case 26: ExecuteTool24(); break; case 27: ExecuteTool25(); break; case 28: ExecuteTool26(); break; case 29: ExecuteTool27(); break; case 30: ExecuteTool28(); break; case 31: ExecuteTool29(); break; case 32: ExecuteTool30(); break; case 33: ExecuteTool31(); break; case 34: ExecuteTool32(); break; case 35: ExecuteTool33(); break; case 36: ExecuteTool34(); break; case 37: ExecuteTool35(); break; case 38: modifySelectedButton((*reinterpret_cast< int(*)>(_a[1]))); break; case 39: editingSceneLeft((*reinterpret_cast< const Vector(*)>(_a[1]))); break; case 40: editingSceneRight((*reinterpret_cast< const Vector(*)>(_a[1]))); break; case 41: selectCell((*reinterpret_cast< const Vector(*)>(_a[1]))); break; case 42: editingHeight((*reinterpret_cast< const Vector(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; } _id -= 43; } return _id; }
spAspRoi_t AspFrame::selectRoi(int x, int y, bool handle) { spAspCell_t cell = selectCell(x,y); if(cell == nullAspCell) return nullAspRoi; spAspRoi_t roi = roiList->selectRoi(cell, x,y,handle); if(roi != prevRoi || (roi != nullAspRoi && roi->mouseOverChanged)) displayTop(); prevRoi = roi; return roi; }
void MVListBase::selectRange(int left,int top,int right,int bottom) /**************************************************************************** * * Function: MVListBase::selectRange * Parameters: left,top,right,bottom - Range of cells to select * * Description: Selects all the cells that lie within the specified range. * ****************************************************************************/ { int _left = MAX(range.left(), left); int _top = MAX(range.top(), top); int _right = MIN(range.right(), right); int _bottom = MIN(range.bottom(), bottom); for (int i = _left; i < _right; i++) for (int j = _top; j < _bottom; j++) selectCell(i,j); }
void PageItem_Table::selectCells(int startRow, int startColumn, int endRow, int endColumn) { if (!validCell(startRow, startColumn) || !validCell(endRow, endColumn)) return; const TableCell startCell = cellAt(startRow, startColumn); const TableCell endCell = cellAt(endRow, endColumn); const int topRow = qMin(startCell.row(), endCell.row()); const int bottomRow = qMax(startCell.row() + startCell.rowSpan() - 1, endCell.row() + endCell.rowSpan() - 1); const int leftCol = qMin(startCell.column(), endCell.column()); const int rightCol = qMax(startCell.column() + startCell.columnSpan() - 1, endCell.column() + endCell.columnSpan() - 1); for (int row = topRow; row <= bottomRow; ++row) for (int col = leftCol; col <= rightCol; ++col) selectCell(row, col); emit selectionChanged(); }
// Mouse button up. bool Picker::processMouseUp(const InputEvent& event) { if(m_cellPressed && event.code == LEFT_MOUSE_BUTTON) { // Select if the mouse goes up inside the pressed cell. // If not, consider the action cancelled. const bool newSelection = ( cellForMouse(event.loc) == m_cellPressed ); // Make sure we get off the event chain. globalEventManager().removeResponder(this, true); setModal(false); // Select a new cell, after we've cleaned up the event handling. if(newSelection) { selectCell(m_cellPressed); } m_cellPressed = NULL; return true; } return Control::processMouseUp(event); }
void AspFrame::selectRoiHandle(spAspRoi_t roi, int x, int y,bool handle) { spAspCell_t cell = selectCell(x,y); if(cell == nullAspCell) return; bool creating = AspMouse::creating; int prevX=AspMouse::prevX; int prevY=AspMouse::prevY; if(creating && roi->getRank() > 1) { if(x >= prevX && y >= prevY) roi->mouseOver = HANDLE3; else if(x >= prevX) roi->mouseOver = HANDLE2; else if(y >= prevY) roi->mouseOver = HANDLE4; else roi->mouseOver = HANDLE1; } else if(creating) { if(x >= prevX) roi->mouseOver = LINE2; else roi->mouseOver = LINE1; } else { roi->selectHandle(cell,x, y,handle); } displayTop(); }
spAspRoi_t AspFrame::addRoi(int type, int x, int y) { spAspCell_t cell = selectCell(x,y); if(cell == nullAspCell) return nullAspRoi; spAspRoi_t roi = nullAspRoi; spAspCursor_t cursor1, cursor2; if(type == ROI_BOX) { double vx = cell->pix2val(HORIZ,x); double vy = cell->pix2val(VERT,y); cursor1 = spAspCursor_t(new AspCursor(vx,vy,cell->getXname(),cell->getYname())); cursor2 = spAspCursor_t(new AspCursor(vx,vy,cell->getXname(),cell->getYname())); roi = spAspRoi_t(new AspRoi(cursor1,cursor2,roiList->getRoiMap()->size())); roiList->addRoi(roi); } else if(type == ROI_BAND) { double vx = cell->pix2val(HORIZ,x); cursor1 = spAspCursor_t(new AspCursor(vx,cell->getXname())); cursor2 = spAspCursor_t(new AspCursor(vx,cell->getXname())); roi = spAspRoi_t(new AspRoi(cursor1,cursor2,roiList->getRoiMap()->size())); roiList->addRoi(roi); } setAnnoFlag(ANN_ROIS); return roi; }
void MVListBase::handleEvent(MVEvent& event,phaseType phase) /**************************************************************************** * * Function: MVListBase::handleEvent * Parameters: event - Event to handle * phase - Current phase for the event (pre,focus,post) * * Description: Event handling mechanism for the MVListBase class. * ****************************************************************************/ { MVView::handleEvent(event,phase); switch (event.what) { case evMouseDown: if (range.isEmpty()) return; if (event.mouse.buttons & mbLeftButton) { while (event.what != evMouseUp) { switch (event.what) { case evMouseDown: if (!(event.mouse.modifiers & mdShift) && !(flags & lsDisjointSelect)) { clearSelection(); selectCell(cursor); refresh(); } if (event.mouse.doubleClick) { MV_message(owner,evBroadcast,cmListItemSelected,this); goto doneMouse; } case evMouseAuto: case evMouseMove: MVPoint loc; uint modifiers = mdShift; if (event.what == evMouseDown) modifiers = event.mouse.modifiers; if (flags & lsDisjointSelect) modifiers = 0; uint pos = findCellHit(event.where,loc); if (pos == lsInside && event.what != evMouseAuto) { // Selection within the list if (loc == cursor && event.what == evMouseDown) { // Post a message to ensure updates // occur for the first mouse down event // in the list box. MV_message(owner,evBroadcast, cmListCursorChanged,this); } if (loc.x < cursor.x) selectLeft(cursor.x - loc.x,modifiers); else if (loc.x > cursor.x) selectRight(loc.x - cursor.x,modifiers); if (loc.y < cursor.y) selectUp(cursor.y - loc.y,modifiers); else if (loc.y > cursor.y) selectDown(loc.y - cursor.y,modifiers); } else if (event.what == evMouseAuto) { // Auto selection outside window to scroll if (pos & lsAbove) selectUp(1,modifiers); if (pos & lsBelow) selectDown(1,modifiers); if (pos & lsLeft) selectLeft(1,modifiers); if (pos & lsRight) selectRight(1,modifiers); } if (event.what == evMouseDown && flags & lsDisjointSelect) { toggleCell(cursor); refresh(); } break; } getEvent(event); } doneMouse: clearEvent(event); } break; case evKeyDown: case evKeyAuto: if (range.isEmpty()) return; switch (event.key.charScan.scanCode) { case kbSpace: if (event.what == evKeyAuto) break; if (flags & lsDisjointSelect) { toggleCell(cursor); refresh(); } break; case kbLeft: selectLeft(1,event.key.modifiers); break; case kbRight: selectRight(1,event.key.modifiers); break; case kbUp: selectUp(1,event.key.modifiers); break; case kbDown: selectDown(1,event.key.modifiers); break; case kbHome: selectNext(lsLeft | lsAbove,range.bottom(), event.key.modifiers); break; case kbEnd: selectNext(lsRight | lsBelow,range.bottom(), event.key.modifiers); break; case kbPgUp: selectUp(visible.bottom()-visible.top(), event.key.modifiers,true); break; case kbPgDn: selectDown(visible.bottom()-visible.top(), event.key.modifiers,true); default: // Key press is not handled by us, so simply return. return; } clearEvent(event); break; case evBroadcast: if (options & ofSelectable) { if (event.message.command == cmScrollBarClicked && (event.message.infoPtr == hScroll || event.message.infoPtr == vScroll)) select(); else if (event.message.command == cmScrollBarChanged) { if (range.isEmpty()) return; if (event.message.infoPtr == hScroll) hScrollTo(hScroll->getValue()); else if (event.message.infoPtr == vScroll) vScrollTo(vScroll->getValue()); } } break; } }
void MVListBase::selectNext(uint direction,int count,ulong modifiers, ibool toTop) /**************************************************************************** * * Function: MVListBase::selectNext * Parameters: direction - Flags indicating the direction to move * count - Number of cells to move down * modifiers - Keyboard shift modifiers * toTop - True if the cell should be moved to the top * * Description: Adjusts the selection by the specified number of cells in * the specified direction. If the shift modifiers are set, * then the selection is extended. * ****************************************************************************/ { MVPoint oldCursor(cursor); int maxv = maxV(),minv = minV(); int maxh = maxH(),minh = minH(); if (direction & lsBelow) if ((cursor.y += count) > maxv) cursor.y = maxv; if (direction & lsAbove) if ((cursor.y -= count) < minv) cursor.y = minv; if (direction & lsRight) if ((cursor.x += count) > maxh) cursor.x = maxh; if (direction & lsLeft) if ((cursor.x -= count) < minh) cursor.x = minh; if (cursor != oldCursor || (flags & lsExtending)) { if ((flags & lsMultipleSelect) && (modifiers & mdShift)) { if (cursor == oldCursor) return; if (direction & lsLeft) { if (flags & lsExtendRight) { // We are currently extending in the opposite direction, // so clear all of the cells from the old cursor position // to one above the new cursor position. If the selection // is only one high, then turn off the extending flags. if (cursor.x <= selection.left()) { flags &= ~lsExtendHoriz; selection.right() = selection.left()+1; selection.left() = cursor.x; if (selection.left() != selection.right()-1) { flags |= lsExtendLeft; selectRange(selection); } } else selection.right() = cursor.x+1; clearRange(selection.right(),selection.top(), oldCursor.x+1,selection.bottom()); } else { // We are currently extending the selection in the same // direction, or have just started to extend the selection flags |= lsExtendLeft; selection.left() = cursor.x; selectRange(cursor.x,selection.top(), oldCursor.x,selection.bottom()); } } if (direction & lsRight) { if (flags & lsExtendLeft) { if (cursor.x >= selection.right()-1) { flags &= ~lsExtendHoriz; selection.left() = selection.right()-1; selection.right() = cursor.x+1; if (selection.left() != selection.right()-1) { flags |= lsExtendRight; selectRange(selection); } } else selection.left() = cursor.x; clearRange(oldCursor.x,selection.top(), selection.left(),selection.bottom()); } else { flags |= lsExtendRight; selection.right() = cursor.x+1; selectRange(oldCursor.x+1,selection.top(), cursor.x+1,selection.bottom()); } } if (direction & lsAbove) { if (flags & lsExtendDown) { if (cursor.y <= selection.top()) { flags &= ~lsExtendVert; selection.bottom() = selection.top()+1; selection.top() = cursor.y; if (selection.top() != selection.bottom()-1) { flags |= lsExtendUp; selectRange(selection); } } else selection.bottom() = cursor.y+1; clearRange(selection.left(),selection.bottom(), selection.right(),oldCursor.y+1); } else { flags |= lsExtendUp; selection.top() = cursor.y; selectRange(selection.left(),cursor.y, selection.right(),oldCursor.y); } } if (direction & lsBelow) { if (flags & lsExtendUp) { if (cursor.y >= selection.bottom()-1) { flags &= ~lsExtendVert; selection.top() = selection.bottom()-1; selection.bottom() = cursor.y+1; if (selection.top() != selection.bottom()-1) { flags |= lsExtendDown; selectRange(selection); } } else selection.top() = cursor.y; clearRange(selection.left(),oldCursor.y, selection.right(),selection.top()); } else { flags |= lsExtendDown; selection.bottom() = cursor.y+1; selectRange(selection.left(),oldCursor.y+1, selection.right(),cursor.y+1); } } dirtyCell(oldCursor); } else { // The selection is not being extended, so clear any previous // selection and turn extending off, and reselect the cell // under the cursor. flags &= ~lsExtending; if (!(flags & lsDisjointSelect)) { clearSelection(); selectCell(cursor); } else { dirtyCell(oldCursor); dirtyCell(cursor); } } MV_message(owner,evBroadcast,cmListCursorChanged,this); refresh(); } focusCurrent(toTop); }