void selectBasedOnModifiers (TreeViewItem* const item, const ModifierKeys& modifiers) { TreeViewItem* firstSelected = 0; if (modifiers.isShiftDown() && ((firstSelected = owner.getSelectedItem (0)) != 0)) { TreeViewItem* const lastSelected = owner.getSelectedItem (owner.getNumSelectedItems() - 1); jassert (lastSelected != 0); int rowStart = firstSelected->getRowNumberInTree(); int rowEnd = lastSelected->getRowNumberInTree(); if (rowStart > rowEnd) swapVariables (rowStart, rowEnd); int ourRow = item->getRowNumberInTree(); int otherEnd = ourRow < rowEnd ? rowStart : rowEnd; if (ourRow > otherEnd) swapVariables (ourRow, otherEnd); for (int i = ourRow; i <= otherEnd; ++i) owner.getItemOnRow (i)->setSelected (true, false); } else { const bool cmd = modifiers.isCommandDown(); item->setSelected ((! cmd) || ! item->isSelected(), ! cmd); } }
void Ambix_encoderAudioProcessorEditor::modifierKeysChanged(const ModifierKeys &modifiers) { if (modifiers.isShiftDown()) { sld_el->setColour (Slider::thumbColourId, Colours::black); sld_el->setEnabled(false); } else { sld_el->setColour (Slider::thumbColourId, Colours::grey); sld_el->setEnabled(true); } if (modifiers.isCtrlDown()) { sld_az->setColour (Slider::thumbColourId, Colours::black); sld_az->setEnabled(false); } else { sld_az->setColour (Slider::thumbColourId, Colours::grey); sld_az->setEnabled(true); } }
void HoaMap::mouseDrag (const MouseEvent &event) { Point<float> mouse = event.getPosition().toFloat(); Point<float> newPos; ModifierKeys modifierKey = event.mods; // conversion en cartesien : //mouse.applyTransform(AffineTransform::translation(m_padding, m_padding)); mouse.applyTransform(AffineTransform::fromTargetPoints(0, 0, -1, 1, getPadWidth(), 0, 1, 1, getPadWidth(), getPadWidth(), 1, -1)); newPos = mouse; if (m_sourcePointed >= 0 && m_sourcePointed < m_nbSources) { setMouseCursor(MouseCursor::DraggingHandCursor); m_sources_dragState[m_sourcePointed] = -1; // reset dragging state m_sources_ValueChanged[m_sourcePointed] = 1; if (modifierKey.isShiftDown()) { // constrain move to distance setPolarCoordinates(m_sourcePointed, Tools::radius(newPos.x, newPos.y), m_sources[m_sourcePointed].getAzimuth()); } else if (modifierKey.isCtrlDown()) { // constrain move to angle setPolarCoordinates(m_sourcePointed, m_sources[m_sourcePointed].getRadius(), Tools::angle(newPos.x, newPos.y)); } else { setCartesianCoordinates(m_sourcePointed, newPos.x, newPos.y, sendNotificationSync); } } }
void ListBox::selectRowsBasedOnModifierKeys (const int row, const ModifierKeys& mods, const bool isMouseUpEvent) { if (multipleSelection && mods.isCommandDown()) { flipRowSelection (row); } else if (multipleSelection && mods.isShiftDown() && lastRowSelected >= 0) { selectRangeOfRows (lastRowSelected, row); } else if ((! mods.isPopupMenu()) || ! isRowSelected (row)) { selectRowInternal (row, false, ! (multipleSelection && (! isMouseUpEvent) && isRowSelected (row)), true); } }
bool ScumblerComponent::keyPressed(const KeyPress& key) { bool retval = false; if (key.isKeyCode(KeyPress::tabKey)) { ModifierKeys mod = key.getModifiers(); if (mod.isShiftDown()) { fScumbler->ActivatePreviousTrack(); } else { fScumbler->ActivateNextTrack(); } retval = true; } else { retval = false; } return retval; }