Ejemplo n.º 1
0
// -----------------------------------------------------------
void QucsApp::slotCursorRight()
{
  if(!editText->isHidden()) return;  // for edit of component property ?

  QPtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentPage();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) {
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerLeftRight(false, &movingElements);
      movingElements.clear();
    }
    else {
      if(Doc->scrollRight(-Doc->horizontalScrollBar()->lineStep()))
        Doc->scrollBy(Doc->horizontalScrollBar()->lineStep(), 0);
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  }

  view->moveElements(&movingElements, Doc->GridX, 0);  // move "GridX" to right
  view->MAx3 = 1;  // sign for moved elements
  view->endElementMoving(Doc, &movingElements);
}
Ejemplo n.º 2
0
// -----------------------------------------------------------
void QucsApp::slotCursorLeft(bool left)
{
  int sign = 1;
  if(left){
    sign = -1;
  }
  if(!editText->isHidden()) return;  // for edit of component property ?

  Q3PtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) {
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerLeftRight(left, &movingElements);
    } else if(left) {
      if(Doc->scrollLeft(Doc->horizontalScrollBar()->singleStep()))
        Doc->scrollBy(-Doc->horizontalScrollBar()->singleStep(), 0);
    }else{ // right
      if(Doc->scrollRight(-Doc->horizontalScrollBar()->singleStep()))
        Doc->scrollBy(Doc->horizontalScrollBar()->singleStep(), 0);
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  } else { // random selection. move all of them
    view->moveElements(&movingElements, sign*Doc->GridX, 0);
    view->MAx3 = 1;  // sign for moved elements
    view->endElementMoving(Doc, &movingElements);
  }
}