67 if(Function)
if((Doc->*Function)()) {
68 Action->blockSignals(
true);
70 Action->blockSignals(
false);
71 Doc->viewport()->update();
89 Doc->viewport()->update();
152 if(Doc->inherits(
"QPlainTextEdit")) {
153 Doc->viewport()->setFocus();
155 Doc->textCursor().deleteChar();
201 if(Doc->inherits(
"QPlainTextEdit")) {
223 if(w->inherits(
"QPlainTextEdit")) {
224 ((
TextDoc*)w)->viewport()->setFocus();
225 select->blockSignals(
true);
227 select->blockSignals(
false);
236 Doc->viewport()->update();
239 select->blockSignals(
true);
241 select->blockSignals(
false);
259 if(Doc->inherits(
"QPlainTextEdit"))
261 ((
TextDoc*)Doc)->viewport()->setFocus();
280 if(
view->
drawn) Doc->viewport()->update();
312 Doc->viewport()->setFocus ();
350 if(
view->
drawn) Doc->viewport()->update();
383 if(
view->
drawn) Doc->viewport()->update();
416 if(
view->
drawn) Doc->viewport()->update();
427 if(Doc->inherits(
"QPlainTextEdit")) {
428 ((
TextDoc*)Doc)->viewport()->setFocus();
436 Doc->viewport()->update();
445 if(Doc->inherits(
"QPlainTextEdit")) {
446 ((
TextDoc*)Doc)->viewport()->setFocus();
454 Doc->viewport()->update();
466 QMessageBox::information(
this, tr(
"Info"),
467 tr(
"At least two elements must be selected !"));
468 Doc->viewport()->update();
480 QMessageBox::information(
this, tr(
"Info"),
481 tr(
"At least two elements must be selected !"));
482 Doc->viewport()->update();
494 QMessageBox::information(
this, tr(
"Info"),
495 tr(
"At least two elements must be selected !"));
496 Doc->viewport()->update();
508 QMessageBox::information(
this, tr(
"Info"),
509 tr(
"At least two elements must be selected !"));
510 Doc->viewport()->update();
522 Doc->viewport()->update();
534 Doc->viewport()->update();
546 QMessageBox::information(
this, tr(
"Info"),
547 tr(
"At least two elements must be selected !"));
548 Doc->viewport()->update();
560 QMessageBox::information(
this, tr(
"Info"),
561 tr(
"At least two elements must be selected !"));
562 Doc->viewport()->update();
573 if(Doc->inherits(
"QPlainTextEdit")) {
574 ((
TextDoc*)Doc)->viewport()->setFocus();
579 ((
Schematic*)Doc)->selectElements(INT_MIN, INT_MIN, INT_MAX, INT_MAX,
true);
593 Doc->viewport()->update();
608 if (File.isEmpty()) {
615 statusBar()->message(tr(
"Opening file..."));
617 QFileInfo finfo(File);
620 statusBar()->message(tr(
"Opening aborted, file not found."), 2000);
624 statusBar()->message(tr(
"Ready."));
637 prog =
"qucsedit.exe";
639 prog =
"qucsedit.app/Contents/MacOS/qucsedit";
645 prog = QDir::toNativeSeparators(editor.canonicalFilePath());
649 prog = QDir::toNativeSeparators(editor.canonicalFilePath());
652 if (!File.isEmpty()) {
656 QProcess *QucsEditor =
new QProcess();
657 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
658 env.insert(
"PATH", env.value(
"PATH") );
659 QucsEditor->setProcessEnvironment(env);
661 qDebug() <<
"Command: " << prog << args.join(
" ");
663 QucsEditor->start(prog, args);
665 if( !QucsEditor->waitForStarted(1000) ) {
666 QMessageBox::critical(
this, tr(
"Error"), tr(
"Cannot start text editor! \n\n%1").arg(prog));
670 qDebug() << QucsEditor->readAllStandardError();
705 prog =
"qucsfilter.exe";
707 prog =
"qucsfilter.app/Contents/MacOS/qucsfilter";
712 QProcess *QucsFilter =
new QProcess();
715 QucsFilter->start(prog);
718 qDebug() <<
"Command :" << prog;
720 if( !QucsFilter->waitForStarted(1000) ) {
721 QMessageBox::critical(
this, tr(
"Error"),
722 tr(
"Cannot start filter synthesis program! \n\n%1").arg(prog));
737 prog =
"qucstrans.exe";
739 prog =
"qucstrans.app/Contents/MacOS/qucstrans";
743 QProcess *QucsLine =
new QProcess();
746 QucsLine->start(prog);
749 qDebug() <<
"Command :" << prog;
751 if( !QucsLine->waitForStarted(1000) ) {
752 QMessageBox::critical(
this, tr(
"Error"),
753 tr(
"Cannot start line calculation program! \n\n%1").arg(prog));
768 prog =
"qucslib.exe";
770 prog =
"qucslib.app/Contents/MacOS/qucslib";
775 QProcess *QucsLibrary =
new QProcess();
778 QucsLibrary->start(prog);
781 qDebug() <<
"Command :" << prog;
783 if( !QucsLibrary->waitForStarted(1000) ) {
785 QMessageBox::critical(
this, tr(
"Error"),
786 tr(
"Cannot start library program! \n\n%1").arg(prog));
809 prog =
"qucsattenuator.exe";
811 prog =
"qucsattenuator.app/Contents/MacOS/qucsattenuator";
813 prog =
"qucsattenuator";
816 QProcess *QucsAtt =
new QProcess();
819 QucsAtt->start(prog);
822 qDebug() <<
"Command :" << prog;
824 if( !QucsAtt->waitForStarted(1000) ) {
825 QMessageBox::critical(
this, tr(
"Error"),
826 tr(
"Cannot start attenuator calculation program! \n\n%1").arg(prog));
840 prog =
"qucsrescodes.exe";
842 prog =
"qucsrescodes.app/Contents/MacOS/qucsrescodes";
844 prog =
"qucrescodes";
847 QProcess *QucsRes =
new QProcess();
850 QucsRes->start(prog);
853 qDebug() <<
"Command :" << prog;
855 if( !QucsRes->waitForStarted(1000) ) {
856 QMessageBox::critical(
this, tr(
"Error"),
857 tr(
"Cannot start resistor color code calculation program! \n\n%1").arg(prog));
883 prog =
"qucshelp.exe";
885 prog =
"qucshelp.app/Contents/MacOS/qucshelp";
893 QProcess *QucsHelp =
new QProcess();
896 QucsHelp->start(com.join(
" "));
898 qDebug() <<
"Command :" << com.join(
" ");
899 if( !QucsHelp->waitForStarted(1000) ) {
900 QMessageBox::critical(
this, tr(
"Error"), tr(
"Cannot start qucshelp! \n\n%1").arg(com.join(
" ")));
927 if(Doc->inherits(
"QPlainTextEdit")) {
928 ((
TextDoc*)Doc)->viewport()->setFocus();
933 if(d->exec() == QDialog::Accepted) {
934 ((
Schematic*)Doc)->setChanged(
true,
true);
946 QMessageBox::critical(
this, tr(
"Error"), tr(
"No project open!"));
951 QStringList List = QFileDialog::getOpenFileNames(
this, tr(
"Select files to copy"),
955 statusBar()->message(tr(
"No files copied."), 2000);
960 char *Buffer = (
char*)malloc(0x10000);
964 QStringList::Iterator it = FileList.begin();
970 QFile origFile, destFile;
971 while(it != FileList.end()) {
973 origFile.setName(*it);
975 QDir::separator() + Info.fileName());
977 if(!origFile.open(QIODevice::ReadOnly)) {
978 QMessageBox::critical(
this, tr(
"Error"), tr(
"Cannot open \"%1\" !").arg(*it));
983 if(destFile.exists())
984 if(QMessageBox::information(
this, tr(
"Overwrite"),
985 tr(
"File \"%1\" already exists.\nOverwrite ?").arg(*it), QMessageBox::Yes,
986 QMessageBox::No|QMessageBox::Default|QMessageBox::Escape)
987 != QMessageBox::Yes) {
993 if(!destFile.open(QIODevice::WriteOnly)) {
994 QMessageBox::critical(
this, tr(
"Error"), tr(
"Cannot create \"%1\" !").arg(*it));
1002 Num = origFile.readBlock(Buffer, 0x10000);
1004 QMessageBox::critical(
this, tr(
"Error"), tr(
"Cannot read \"%1\" !").arg(*it));
1007 Num = destFile.writeBlock(Buffer, Num);
1009 QMessageBox::critical(
this, tr(
"Error"), tr(
"Cannot write \"%1\" !").arg(*it));
1012 }
while(Num == 0x10000);
1021 statusBar()->message(tr(
"Ready."));
1029 Q3PtrList<Element> movingElements;
1033 if((movingElements.count() - markerCount) < 1) {
1034 if(markerCount > 0) {
1036 movingElements.clear();
1039 if(Doc->
scrollLeft(Doc->horizontalScrollBar()->lineStep()))
1040 Doc->scrollBy(-Doc->horizontalScrollBar()->lineStep(), 0);
1043 Doc->viewport()->update();
1058 Q3PtrList<Element> movingElements;
1062 if((movingElements.count() - markerCount) < 1) {
1063 if(markerCount > 0) {
1065 movingElements.clear();
1068 if(Doc->
scrollRight(-Doc->horizontalScrollBar()->lineStep()))
1069 Doc->scrollBy(Doc->horizontalScrollBar()->lineStep(), 0);
1072 Doc->viewport()->update();
1089 int Begin = pp->Description.find(
'[');
1090 if(Begin < 0)
return;
1091 int End = pp->Description.find(
editText->text(), Begin);
1093 End = pp->Description.findRev(
',', End);
1094 if(End < Begin)
return;
1096 int Pos = pp->Description.findRev(
',', End);
1097 if(Pos < Begin) Pos = Begin;
1099 if(pp->Description.at(Pos) ==
' ') Pos++;
1100 editText->setText(pp->Description.mid(Pos, End-Pos+1));
1105 Q3PtrList<Element> movingElements;
1109 if((movingElements.count() - markerCount) < 1) {
1110 if(markerCount > 0) {
1112 movingElements.clear();
1115 if(Doc->
scrollUp(Doc->verticalScrollBar()->lineStep()))
1116 Doc->scrollBy(0, -Doc->verticalScrollBar()->lineStep());
1119 Doc->viewport()->update();
1136 int Pos = pp->Description.find(
'[');
1138 Pos = pp->Description.find(
editText->text(), Pos);
1140 Pos = pp->Description.find(
',', Pos);
1143 if(pp->Description.at(Pos) ==
' ') Pos++;
1144 int End = pp->Description.find(
',', Pos);
1146 End = pp->Description.find(
']', Pos);
1149 editText->setText(pp->Description.mid(Pos, End-Pos));
1154 Q3PtrList<Element> movingElements;
1158 if((movingElements.count() - markerCount) < 1) {
1159 if(markerCount > 0) {
1161 movingElements.clear();
1164 if(Doc->
scrollDown(-Doc->verticalScrollBar()->lineStep()))
1165 Doc->scrollBy(0, Doc->verticalScrollBar()->lineStep());
1168 Doc->viewport()->update();
1187 f.setPointSizeFloat( Doc->
Scale *
float(f.pointSize()) );
1197 pp = pc->
Props.first();
1204 pp = pc->
Props.next();
1238 Doc->viewport()->update();
1249 pp = pc->
Props.next();
1280 z =
editText->fontMetrics().lineSpacing();
1295 editText->fontMetrics().lineSpacing());
1304 QMessageBox::critical(
this, tr(
"Error"), tr(
"Please open project with subcircuits!"));
1318 QMessageBox::critical(
this, tr(
"Error"), tr(
"Please open project first!"));
1323 if(d->exec() == QDialog::Accepted)
1337 QMessageBox::critical(
this, tr(
"Error"), tr(
"Please select a diagram graph!"));
1346 QString s = QFileDialog::getSaveFileName(
this, tr(
"Enter an Output File Name"),
1347 lastDir.isEmpty() ? QString(
".") :
lastDir, tr(
"CSV file")+
" (*.csv);;" + tr(
"Any File")+
" (*)");
1354 if(Info.extension().isEmpty())
1359 if(QMessageBox::information(
this, tr(
"Info"),
1360 tr(
"Output file already exists!")+
"\n"+tr(
"Overwrite it?"),
1361 tr(
"&Yes"), tr(
"&No"), 0,1,1))
1364 if(!File.open(QIODevice::WriteOnly)) {
1365 QMessageBox::critical(
this, QObject::tr(
"Error"),
1366 QObject::tr(
"Cannot create output file!"));
1370 QTextStream Stream(&File);
1377 Stream <<
'\"' << pD->
Var <<
"\";";
1378 Stream <<
"\"r " << g->
Var <<
"\";\"i " << g->
Var <<
"\"\n";
1384 for(n = 0; n < Count; n++) {
1391 Stream << *(py) <<
';' << *(py+1) <<
'\n';
1429 QSignalMapper* mapper =
new QSignalMapper(
this);
1430 QList<QAction*> recent_docs;
1434 recent_docs.prepend(
new QAction(file,
this));
1435 connect(recent_docs.first(),SIGNAL(triggered()),mapper,SLOT(map()));
1440 for (
int i=0; i<recent_docs.count(); i++) {
1441 mapper->setMapping(recent_docs.at(i),(recent_docs.count() - 1)-i);
1444 connect(mapper,SIGNAL(mapped(
int)),
this,SLOT(
slotOpenRecent(
int)));
1463 qDebug() <<
"slotLoadModule";
1474 QString fileSuffix =
"*_symbol.json";
1476 files = projDir.entryList(QStringList(fileSuffix),
1477 QDir::Files | QDir::NoSymLinks);
1481 QMessageBox::critical(
this, tr(
"Error"),
1482 tr(
"Symbol files not found in: %1\n\n"
1483 "Is the project open?\n"
1484 "Have you saved the Verilog-A symbols?")
1485 .arg(QString(projDir.absolutePath())));
1501 if (ld->exec() == QDialog::Accepted) {
1518 for( ; it.current(); ++it ){
1519 if (it.current()->category == QObject::tr(
"verilog-a user devices"))
1520 remove << it.currentKey();
1522 for (
int i = 0; i <
remove.size(); ++i){
1559 qDebug() <<
"slotBuildModule";
1571 make =
"mingw32-make.exe";
1584 QDir::setCurrent(workDir);
1586 QProcess *builder =
new QProcess();
1587 builder->setProcessChannelMode(QProcess::MergedChannels);
1595 admsXml = QDir::toNativeSeparators(admsXml+
"/"+
"admsXml.exe");
1597 admsXml = QDir::toNativeSeparators(admsXml+
"/"+
"admsXml");
1601 QStringList Arguments;
1602 Arguments <<
"-f" << QDir::toNativeSeparators(include.absoluteFilePath(
"va2cpp.makefile"))
1603 << QString(
"ADMSXML=%1").arg(admsXml)
1604 << QString(
"PREFIX=%1").arg(QDir::toNativeSeparators(prefix.absolutePath()))
1605 << QString(
"MODEL=%1").arg(vaModule);
1607 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
1608 env.insert(
"PATH", env.value(
"PATH") );
1609 builder->setProcessEnvironment(env);
1612 QString cmdString = QString(
"%1 %2\n").arg(make, Arguments.join(
" "));
1615 qDebug() <<
"Command :" << make << Arguments.join(
" ");
1616 builder->start(make, Arguments);
1620 if (!builder->waitForFinished()) {
1621 vaStatus = builder->errorString();
1622 qDebug() <<
"Make failed:" << vaStatus;
1625 vaStatus = builder->readAll();
1626 qDebug() <<
"Make stdout" << vaStatus;
1630 qDebug() <<
"\nbuild libs\n";
1634 Arguments <<
"-f" << QDir::toNativeSeparators(include.absoluteFilePath(
"cpp2lib.makefile"))
1635 << QString(
"PREFIX=\"%1\"").arg(QDir::toNativeSeparators(prefix.absolutePath()))
1636 << QString(
"PROJDIR=\"%1\"").arg(QDir::toNativeSeparators(workDir))
1637 << QString(
"MODEL=%1").arg(vaModule);
1640 cmdString = QString(
"%1 %2\n").arg(make, Arguments.join(
" "));
1643 builder->start(make, Arguments);
1647 if (!builder->waitForFinished()) {
1648 cppStatus = builder->errorString();
1649 qDebug() <<
"Make failed:" << cppStatus;
1652 cppStatus = builder->readAll();
1653 qDebug() <<
"Make output:" << cppStatus;
void slotResizePropEdit(const QString &)
MessageDock * messageDock
void slotCenterVertical()
void slotCursorPosChanged()
TextDoc::slotCursorPosChanged update status bar with line:column.
void slotInsertPort(bool)
void MPressElement(Schematic *, QMouseEvent *, float, float)
bool distributeVertical()
void slotClearRecentFiles()
void MMoveLabel(Schematic *, QMouseEvent *)
MouseActions::MMoveLabel Paints a label above the mouse cursor for "set wire label".
static QString fileBase(const QString &)
void MMoveActivate(Schematic *, QMouseEvent *)
MouseActions::MMoveActivate Paints a crossed box mouse cursor to "(de)activate" components.
Definition of the TextDoc class.
bool gotoPage(const QString &)
void showHTML(const QString &)
void slotShowLastNetlist()
void slotInsertLabel(bool)
void slotInsertEquation(bool)
void(MouseActions::* MouseMoveAction)(Schematic *, QMouseEvent *)
void MMoveMirrorY(Schematic *, QMouseEvent *)
MouseActions::MMoveMirrorX Paints rounded "mirror about y axis" mouse cursor.
void MMoveElement(Schematic *, QMouseEvent *)
float zoomBy(float)
TextDoc::zoomBy increases/decreases the text font size.
tQucsSettings QucsSettings
void MMoveMirrorX(Schematic *, QMouseEvent *)
MouseActions::MMoveMirrorX Paints rounded "mirror about x axis" mouse cursor.
void(MouseActions::* MousePressAction)(Schematic *, QMouseEvent *, float, float)
void MPressActivate(Schematic *, QMouseEvent *, float, float)
void MMoveOnGrid(Schematic *, QMouseEvent *)
MouseActions::MMoveOnGrid Paints a grid beside the mouse cursor, put "on grid" mode.
void MMoveMoveTextB(Schematic *, QMouseEvent *)
MouseActions::MMoveMoveTextB Paints mouse symbol for "move component text" mode.
The MessageDock class definiion.
void(MouseActions::* pMouseFunc2)(Schematic *, QMouseEvent *, float, float)
void MPressLabel(Schematic *, QMouseEvent *, float, float)
void slotEditDelete(bool)
void MPressMirrorX(Schematic *, QMouseEvent *, float, float)
void MMoveRotate(Schematic *, QMouseEvent *)
MouseActions::MMoveMirrorX Paints "rotate" mouse cursor.
static Q3Dict< Module > Modules
void endElementMoving(Schematic *, Q3PtrList< Element > *)
void MPressDelete(Schematic *, QMouseEvent *, float, float)
bool activateSelectedComponents()
void MPressMarker(Schematic *, QMouseEvent *, float, float)
QucsDoc * getDoc(int No=-1)
QPlainTextEdit * admsOutput
admsOutput holds the make output of running admsXml
Definitions and declarations for the main application.
void MPressWire1(Schematic *, QMouseEvent *, float, float)
MouseActions::MPressWire1 Is called if starting point of wire is pressed.
QRegExpValidator Val_CompProp(Expr_CompProp, 0)
void slotInsertGround(bool)
void MMoveWire1(Schematic *, QMouseEvent *)
MouseActions::MMoveWire1 Paint hair cross for "insert wire" mode.
void MMovePaste(Schematic *, QMouseEvent *)
MouseActions::MMovePaste Moves components after paste from clipboard.
int copySelectedElements(Q3PtrList< Element > *)
QMap< QString, QString > selectedComponents
Q3PtrList< Component > * Components
void reset()
MessageDock::reset clear the text and tab icons.
void MReleaseSelect(Schematic *, QMouseEvent *)
Q3PtrList< Property > Props
void slotLoadModule()
QucsApp::slotLoadModule launches the dialog to select dynamic modueles.
void MMoveMarker(Schematic *, QMouseEvent *)
MouseActions::MMoveMarker Paints a triangle above the mouse for "set marker on graph".
void slotExtractPackage()
bool performToggleAction(bool, QAction *, pToggleFunc, pMouseFunc, pMouseFunc2)
void slotCenterHorizontal()
void MPressOnGrid(Schematic *, QMouseEvent *, float, float)
bool distributeHorizontal()
void slotBuildModule()
QucsApp::slotBuildModule runs admsXml, C++ compiler to build library.
bool(Schematic::* pToggleFunc)()
void slotOpenRecent(int num)
QPlainTextEdit * cppOutput
cppOutput holds the make output of running a C++ compiler
void MPressRotate(Schematic *, QMouseEvent *, float, float)
void(MouseActions::* MouseReleaseAction)(Schematic *, QMouseEvent *)
void searchText(bool, int)
void initSearch(bool replace=false)
void slotExportGraphAsCsv()
static QMap< QString, QString > vaComponents
void updateRecentFilesList(QString s)
void MMoveDelete(Schematic *, QMouseEvent *)
MouseActions::MMoveDelete Paints a cross under the mouse cursor to show the delete mode...
QTreeWidgetItem * ConSchematics
void markerLeftRight(bool, Q3PtrList< Element > *)
bool isTextDocument(QWidget *)
void markerUpDown(bool, Q3PtrList< Element > *)
void insertSkeleton()
TextDoc::insertSkeleton adds a basic skeleton for type of text file.
void slotEditMirrorX(bool)
void editFile(const QString &)
void slotUpdateRecentFiles()
void MPressMoveText(Schematic *, QMouseEvent *, float, float)
void(MouseActions::* MouseDoubleClickAction)(Schematic *, QMouseEvent *)
The TextDoc class definition.
void slotEditMirrorY(bool)
static void registerDynamicComponents(void)
void slotSetCompView(int)
void slotEditRotate(bool)
bool pasteElements(Schematic *)
void slotGettingStarted()
void commentSelected()
TextDoc::commentSelected toggles the comment of selected text See also QucsApp::slotEditActivate.
void moveElements(Schematic *, int &, int &)
void MPressMirrorY(Schematic *, QMouseEvent *, float, float)
void recreateComponent(Component *)
void slotEditActivate(bool)
Q3PtrList< DataX > cPointsX
void MDoubleClickSelect(Schematic *, QMouseEvent *)
void MMoveWire2(Schematic *, QMouseEvent *)
MouseActions::MMoveWire2 Paint wire as it is being drawn with mouse.
void MPressSelect(Schematic *, QMouseEvent *, float, float)
void MMoveZoomIn(Schematic *, QMouseEvent *)
MouseActions::MMoveZoomIn Paints symbol beside the mouse to show the "Zoom in" modus.
void(MouseActions::* pMouseFunc)(Schematic *, QMouseEvent *)
void setChanged(bool, bool fillStack=false, char Op='*')
void MPressZoomIn(Schematic *, QMouseEvent *, float, float)