// ----------------------------------------------------------------------- // Is called when the select toolbar button is pressed. void QucsApp::slotSelect(bool on) { QWidget *w = DocumentTab->currentWidget(); if(isTextDocument(w)) { ((TextDoc*)w)->viewport()->setFocus(); select->blockSignals(true); select->setChecked(true); select->blockSignals(false); return; } // goto to insertWire mode if ESC pressed during wiring Schematic *Doc = (Schematic*)DocumentTab->currentWidget(); if(MouseMoveAction == &MouseActions::MMoveWire2) { MouseMoveAction = &MouseActions::MMoveWire1; MousePressAction = &MouseActions::MPressWire1; Doc->viewport()->update(); view->drawn = false; select->blockSignals(true); select->setChecked(false); select->blockSignals(false); return; } if(performToggleAction(on, select, 0, 0, &MouseActions::MPressSelect)) { MouseReleaseAction = &MouseActions::MReleaseSelect; MouseDoubleClickAction = &MouseActions::MDoubleClickSelect; } }
// ----------------------------------------------------------------------- void QucsApp::slotEditPaste(bool on) { // get the current document QWidget *Doc = DocumentTab->currentWidget(); // if the current document is a text document paste in // the contents of the clipboard as text if(isTextDocument (Doc)) { ((TextDoc*)Doc)->paste(); editPaste->blockSignals(true); editPaste->setChecked(false); // release toolbar button editPaste->blockSignals(false); return; } else { // if it's not a text doc, prevent the user from editing // while we perform the paste operation slotHideEdit(); if(!on) { MouseMoveAction = 0; MousePressAction = 0; MouseReleaseAction = 0; MouseDoubleClickAction = 0; activeAction = 0; // no action active if(view->drawn) { ((Schematic *)Doc)->viewport()->update(); } return; } if(!view->pasteElements((Schematic *)Doc)) { editPaste->blockSignals(true); // do not call toggle slot editPaste->setChecked(false); // set toolbar button off editPaste->blockSignals(false); return; // if clipboard empty } if(activeAction) { activeAction->blockSignals(true); // do not call toggle slot activeAction->setChecked(false); // set last toolbar button off activeAction->blockSignals(false); } activeAction = editPaste; view->drawn = false; MouseMoveAction = &MouseActions::MMovePaste; view->movingRotated = 0; MousePressAction = 0; MouseReleaseAction = 0; MouseDoubleClickAction = 0; } }
// -------------------------------------------------------------------- void QucsApp::slotEditCopy() { statusBar()->showMessage(tr("Copying selection to clipboard...")); QWidget *Doc = DocumentTab->currentWidget(); if(isTextDocument (Doc)) { ((TextDoc *)Doc)->copy(); } else { ((Schematic *)Doc)->copy(); } statusBar()->showMessage(tr("Ready.")); }
// ----------------------------------------------------------------------- // Is called, when "Zoom in" action is triggered. void QucsApp::slotZoomIn(bool on) { TextDoc *Doc = (TextDoc*)DocumentTab->currentWidget(); if(isTextDocument(Doc)) { Doc->zoomBy(1.5f); magPlus->blockSignals(true); magPlus->setChecked(false); magPlus->blockSignals(false); } else performToggleAction(on, magPlus, 0, &MouseActions::MMoveZoomIn, &MouseActions::MPressZoomIn); }
// -------------------------------------------------------------------- void QucsApp::slotEditCut() { statusBar()->showMessage(tr("Cutting selection...")); slotHideEdit(); // disable text edit of component property QWidget *Doc = DocumentTab->currentWidget(); if(isTextDocument (Doc)) { ((TextDoc *)Doc)->cut(); } else { ((Schematic *)Doc)->cut(); } statusBar()->showMessage(tr("Ready.")); }
// -------------------------------------------------------------- // Is called, when "Undo"-Button is pressed. void QucsApp::slotEditRedo() { Schematic *Doc = (Schematic*)DocumentTab->currentWidget(); if(isTextDocument(Doc)) { ((TextDoc*)Doc)->viewport()->setFocus(); ((TextDoc*)Doc)->redo(); return; } slotHideEdit(); // disable text edit of component property Doc->redo(); Doc->viewport()->update(); view->drawn = false; }
// ----------------------------------------------------------------------- // Is called when the activate/deactivate toolbar button is pressed. void QucsApp::slotEditActivate (bool on) { TextDoc * Doc = (TextDoc *) DocumentTab->currentPage (); if (isTextDocument (Doc)) { Doc->clearParagraphBackground (Doc->tmpPosX); Doc->commentSelected (); editActivate->blockSignals (true); editActivate->setOn (false); // release toolbar button editActivate->blockSignals (false); } else performToggleAction (on, editActivate, &Schematic::activateSelectedComponents, &MouseActions::MMoveActivate, &MouseActions::MPressActivate); }
// --------------------------------------------------------------------- // Is called when the "select all" action is triggered. void QucsApp::slotSelectAll() { slotHideEdit(); // disable text edit of component property QWidget *Doc = DocumentTab->currentWidget(); if(isTextDocument(Doc)) { ((TextDoc*)Doc)->viewport()->setFocus(); //((TextDoc*)Doc)->selectAll(true); ((TextDoc*)Doc)->selectAll(); } else { ((Schematic*)Doc)->selectElements(INT_MIN, INT_MIN, INT_MAX, INT_MAX, true); ((Schematic*)Doc)->viewport()->update(); view->drawn = false; } }
// ------------------------------------------------------------------------ // Is called if "Delete"-Button is pressed. void QucsApp::slotEditDelete(bool on) { TextDoc *Doc = (TextDoc*)DocumentTab->currentWidget(); if(isTextDocument(Doc)) { Doc->viewport()->setFocus(); //Doc->del(); Doc->textCursor().deleteChar(); editDelete->blockSignals(true); editDelete->setChecked(false); // release toolbar button editDelete->blockSignals(false); } else performToggleAction(on, editDelete, &Schematic::deleteElements, &MouseActions::MMoveDelete, &MouseActions::MPressDelete); }
// -------------------------------------------------------------- void QucsApp::slotChangeProps() { QWidget *Doc = DocumentTab->currentWidget(); if(isTextDocument(Doc)) { ((TextDoc*)Doc)->viewport()->setFocus(); SearchDia->initSearch(Doc, ((TextDoc *)Doc)->textCursor().selectedText(), true); } else { ChangeDialog *d = new ChangeDialog((Schematic*)Doc); if(d->exec() == QDialog::Accepted) { ((Schematic*)Doc)->setChanged(true, true); ((Schematic*)Doc)->viewport()->update(); } } }