2011-03-03 Stefan Jahn <stefan@lkcc.org>

* octave_window.cpp (startOctave): First implementation of
	GNU Octave connection to qucs.  Thank you very much Michael!


git-svn-id: https://qucs.svn.sourceforge.net/svnroot/qucs/trunk@1804 b5b04e8c-4942-46c9-ab4f-83783d557d1c
This commit is contained in:
ela 2011-03-03 18:09:11 +00:00
parent 75824c9966
commit 04d19b4d2a
29 changed files with 832 additions and 13 deletions

3
NEWS
View File

@ -1,7 +1,7 @@
--
-- NEWS
--
-- Copyright (C) 2003-2010 Stefan Jahn <stefan@lkcc.org>
-- Copyright (C) 2003-2011 Stefan Jahn <stefan@lkcc.org>
--
-- This is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -26,6 +26,7 @@ files.
Version 0.0.16
--------------
* implementation of interactive GNU Octave connection
* support for C++ code export of symbol drawings associated with
Verilog-A files
* direct association of symbol drawings to Verilog-HDL, Verilog-A

View File

@ -1,3 +1,8 @@
2011-03-03 Stefan Jahn <stefan@lkcc.org>
* octave_window.cpp (startOctave): First implementation of
GNU Octave connection to qucs. Thank you very much Michael!
2011-03-01 Stefan Jahn <stefan@lkcc.org>
* qucs.cpp (QucsApp): Fixed usage for "qucs <filename>" on command

View File

@ -4,7 +4,7 @@
#
# Automake input file.
#
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Stefan Jahn <stefan@lkcc.org>
# Copyright (C) 2004-2011 Stefan Jahn <stefan@lkcc.org>
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -32,13 +32,13 @@ endif
bin_PROGRAMS = qucs
MOCHEADERS = qucs.h schematic.h textdoc.h
MOCHEADERS = qucs.h schematic.h textdoc.h octave_window.h
MOCFILES = $(MOCHEADERS:.h=.moc.cpp)
qucs_SOURCES = node.cpp element.cpp qucsdoc.cpp wire.cpp mouseactions.cpp \
qucs.cpp main.cpp wirelabel.cpp qucs_init.cpp qucs_actions.cpp \
viewpainter.cpp mnemo.cpp schematic.cpp schematic_element.cpp textdoc.cpp \
schematic_file.cpp syntax.cpp module.cpp
schematic_file.cpp syntax.cpp module.cpp octave_window.cpp
nodist_qucs_SOURCES = $(MOCFILES)

164
qucs/octave_window.cpp Normal file
View File

@ -0,0 +1,164 @@
/***************************************************************************
copyright : (C) 2010 by Michael Margraf
email : michael.margraf@alumni.tu-berlin.de
***************************************************************************/
#include "octave_window.h"
#include "main.h"
#include <qsize.h>
#include <qvbox.h>
#include <qcolor.h>
#include <qaccel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qtextedit.h>
#include <qdockwindow.h>
extern QDir QucsWorkDir; // current project path
OctaveWindow::OctaveWindow(QDockWindow *parent_): QWidget(parent_, 0)
{
vBox = new QVBoxLayout(this);
output = new QTextEdit(this);
output->setReadOnly(true);
output->setUndoRedoEnabled(false);
output->setTextFormat(Qt::LogText);
output->setMaxLogLines(2000);
output->setWordWrap(QTextEdit::NoWrap);
output->setPaletteBackgroundColor(QucsSettings.BGColor);
vBox->addWidget(output, 10);
input = new QLineEdit(this);
connect(input, SIGNAL(returnPressed()), SLOT(slotSendCommand()));
vBox->addWidget(input);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
parent_->setWidget(this);
parent_->setResizeEnabled(true);
parent_->setHorizontallyStretchable(true);
histIterator = cmdHistory.end();
}
// -----------------------------------------------------------------
OctaveWindow::~OctaveWindow()
{
if(octProcess.isRunning())
octProcess.kill();
}
// -----------------------------------------------------------------
QSize OctaveWindow::sizeHint()
{
QSize Size;
int w=0, h=0;
Size = output->sizeHint();
w = Size.width();
h = Size.height() + input->sizeHint().height();
return QSize(w, h);
}
// ------------------------------------------------------------------------
bool OctaveWindow::startOctave()
{
if(octProcess.isRunning())
return true;
QStringList CommandLine;
CommandLine << "octave" << "--no-history" << "-i";
octProcess.setArguments(CommandLine);
disconnect(&octProcess, 0, 0, 0);
connect(&octProcess, SIGNAL(readyReadStderr()), SLOT(slotDisplayErr()));
connect(&octProcess, SIGNAL(readyReadStdout()), SLOT(slotDisplayMsg()));
connect(&octProcess, SIGNAL(processExited()), SLOT(slotOctaveEnded()));
if(!octProcess.start()) {
output->setText(tr("ERROR: Cannot start Octave!"));
return false;
}
output->clear();
octProcess.writeToStdin("cd \"" + QucsWorkDir.absPath() + "\"\n");
return true;
}
// ------------------------------------------------------------------------
void OctaveWindow::runOctaveScript(const QString& name)
{
QFileInfo info(name);
int par = output->paragraphs() - 1;
int idx = output->paragraphLength(par);
output->insertAt(info.baseName(true) + "\n", par, idx);
octProcess.writeToStdin(info.baseName(true) + "\n");
output->scrollToBottom();
}
// ------------------------------------------------------------------------
void OctaveWindow::slotSendCommand()
{
int par = output->paragraphs() - 1;
int idx = output->paragraphLength(par);
output->insertAt(input->text() + "\n", par, idx);
output->scrollToBottom();
octProcess.writeToStdin(input->text() + "\n");
if(!input->text().stripWhiteSpace().isEmpty())
cmdHistory.append(input->text());
histIterator = cmdHistory.end();
input->clear();
}
// ------------------------------------------------------------------------
void OctaveWindow::keyPressEvent(QKeyEvent *event)
{
if(event->key() == Qt::Key_Up) {
if(histIterator == cmdHistory.begin())
return;
histIterator--;
input->setText(*histIterator);
return;
}
if(event->key() == Qt::Key_Down) {
if(histIterator == cmdHistory.end())
return;
histIterator++;
input->setText(*histIterator);
return;
}
}
// ------------------------------------------------------------------------
// Is called when the process sends an output to stdout.
void OctaveWindow::slotDisplayMsg()
{
int par = output->paragraphs() - 1;
int idx = output->paragraphLength(par);
output->insertAt(QString(octProcess.readStdout()), par, idx);
output->scrollToBottom();
}
// ------------------------------------------------------------------------
// Is called when the process sends an output to stderr.
void OctaveWindow::slotDisplayErr()
{
if(!isVisible())
((QDockWindow*)parent())->show(); // always show an error
int par = output->paragraphs() - 1;
int idx = output->paragraphLength(par);
output->insertAt(QString(octProcess.readStderr()), par, idx);
output->scrollToBottom();
}
// ------------------------------------------------------------------------
// Is called when the simulation process terminates.
void OctaveWindow::slotOctaveEnded()
{
output->clear();
}

49
qucs/octave_window.h Normal file
View File

@ -0,0 +1,49 @@
/***************************************************************************
copyright : (C) 2010 by Michael Margraf
email : michael.margraf@alumni.tu-berlin.de
***************************************************************************/
#ifndef OCTAVE_WINDOW_H
#define OCTAVE_WINDOW_H
#include <qwidget.h>
#include <qprocess.h>
#include <qstringlist.h>
class QLineEdit;
class QTextEdit;
class QVBoxLayout;
class QDockWindow;
class OctaveWindow : public QWidget {
Q_OBJECT
public:
OctaveWindow(QDockWindow*);
~OctaveWindow();
QSize sizeHint();
bool startOctave();
void runOctaveScript(const QString&);
private slots:
void slotDisplayMsg();
void slotDisplayErr();
void slotOctaveEnded();
void slotSendCommand();
protected:
void keyPressEvent(QKeyEvent*);
private:
QVBoxLayout *vBox;
QTextEdit *output;
QLineEdit *input;
QProcess octProcess;
QStringList cmdHistory;
QStringList::Iterator histIterator;
};
#endif

View File

@ -1,7 +1,7 @@
#
# qucs/qucs.ap - Autodsp input file.
#
# Copyright (C) 2005, 2006, 2009 Stefan Jahn <stefan@lkcc.org>
# Copyright (C) 2005, 2006, 2009, 2011 Stefan Jahn <stefan@lkcc.org>
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -27,10 +27,10 @@ NAME = qucs
SOURCES = node.cpp element.cpp qucsdoc.cpp wire.cpp mouseactions.cpp \
qucs.cpp main.cpp wirelabel.cpp qucs_init.cpp qucs_actions.cpp \
viewpainter.cpp mnemo.cpp schematic.cpp schematic_element.cpp textdoc.cpp \
schematic_file.cpp syntax.cpp module.cpp
schematic_file.cpp syntax.cpp module.cpp octave_window.cpp
# List of special Qt files.
MOCHEADERS = qucs.h schematic.h textdoc.h
MOCHEADERS = qucs.h schematic.h textdoc.h octave_window.h
# Additional libraries.
LIBS = -lcomponents -ldiagrams -lpaintings -ldialogs \

View File

@ -83,6 +83,7 @@
#include "dialogs/simmessage.h"
#include "dialogs/vtabwidget.h"
#include "dialogs/vtabbeddockwidget.h"
#include "octave_window.h"
extern const char *empty_xpm[];
@ -129,6 +130,7 @@ QucsApp::QucsApp()
tr("VHDL Sources")+" (*.vhdl *.vhd);;"+
tr("Verilog Sources")+" (*.v);;"+
tr("Verilog-A Sources")+" (*.va);;"+
tr("Octave Scripts")+" (*.m *.oct);;"+
tr("Any File")+" (*)";
QucsWorkDir.setPath(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs"));
QucsHomeDir.setPath(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs"));
@ -144,6 +146,7 @@ QucsApp::QucsApp()
viewToolBar->setOn(true);
viewStatusBar->setOn(true);
viewBrowseDock->setOn(true);
slotViewOctaveDock(false);
initCursorMenu();
HierarchyHistory.setAutoDelete(true);
Module::registerModules ();
@ -200,6 +203,7 @@ void QucsApp::initContentListView()
ConOthers = new QListViewItem(Content, tr("Others"));
ConDatasets = new QListViewItem(Content, tr("Datasets"));
ConDisplays = new QListViewItem(Content, tr("Data Displays"));
ConOctave = new QListViewItem(Content, tr("Octave"));
ConVerilog = new QListViewItem(Content, tr("Verilog"));
ConVerilogA = new QListViewItem(Content, tr("Verilog-A"));
ConSources = new QListViewItem(Content, tr("VHDL"));
@ -292,6 +296,14 @@ void QucsApp::initView()
moveDockWindow(dock,DockLeft);
TabView->setCurrentPage(0);
// ----------------------------------------------------------
// Octave docking window
octDock = new QDockWindow(QDockWindow::InDock, this);
octDock->setCloseMode(QDockWindow::Always);
connect(octDock, SIGNAL(visibilityChanged(bool)), SLOT(slotToggleOctave(bool)));
octave = new OctaveWindow(octDock);
moveDockWindow(octDock, Qt::DockBottom);
// ............................................
readProjects(); // reads all projects and inserts them into the ListBox
}
@ -755,6 +767,8 @@ void QucsApp::readProjectFiles()
delete ConVerilogA->firstChild();
while(ConOthers->firstChild())
delete ConOthers->firstChild();
while(ConOctave->firstChild())
delete ConOctave->firstChild();
int n;
// put all files into "Content"-ListView
@ -782,6 +796,8 @@ void QucsApp::readProjectFiles()
new QListViewItem(ConVerilog, (*it).ascii());
else if(Str == "va")
new QListViewItem(ConVerilogA, (*it).ascii());
else if((Str == "m") || (Str == "oct"))
new QListViewItem(ConOctave, (*it).ascii());
else
new QListViewItem(ConOthers, (*it).ascii());
}
@ -1188,6 +1204,8 @@ bool QucsApp::saveAs()
Content->setSelected(new QListViewItem(ConVerilog, s), true);
else if(ext == "va")
Content->setSelected(new QListViewItem(ConVerilogA, s), true);
else if(ext == "m" || ext == "oct")
Content->setSelected(new QListViewItem(ConOctave, s), true);
else
Content->setSelected(new QListViewItem(ConOthers, s), true);
}
@ -1662,8 +1680,8 @@ void QucsApp::slotSimulate()
if(!saveAs()) return; // ... save schematic before
// Perhaps the document was modified from another program ?
QFileInfo Info(Doc->DocName);
if(Doc->lastSaved.isValid()) {
QFileInfo Info(Doc->DocName);
if(Doc->lastSaved < Info.lastModified()) {
int No = QMessageBox::warning(this, tr("Warning"),
tr("The document was modified by another program !") + '\n' +
@ -1675,6 +1693,16 @@ void QucsApp::slotSimulate()
}
slotResetWarnings();
if(Info.extension(false) == "m" || Info.extension(false) == "oct") {
// It is an Octave script.
if(Doc->DocChanged)
Doc->save();
slotViewOctaveDock(true);
octave->runOctaveScript(Doc->DocName);
return;
}
SimMessage *sim = new SimMessage(w, this);
// disconnect is automatically performed, if one of the involved objects
// is destroyed !
@ -1714,7 +1742,13 @@ void QucsApp::slotAfterSimulation(int Status, SimMessage *sim)
}
else if(sim->SimOpenDpl) {
// switch to data display
slotChangePage(sim->DocName, sim->DataDisplay);
if(sim->DataDisplay.right(2) == ".m" ||
sim->DataDisplay.right(4) == ".oct") { // Is it an Octave script?
octave->startOctave();
octave->runOctaveScript(sim->DataDisplay);
}
else
slotChangePage(sim->DocName, sim->DataDisplay);
sim->slotClose(); // close and delete simulation window
}
else
@ -1808,7 +1842,11 @@ void QucsApp::slotToPage()
return;
}
slotChangePage(d->DocName, d->DataDisplay);
if(d->DocName.right(2) == ".m" ||
d->DocName.right(4) == ".oct")
slotViewOctaveDock(true);
else
slotChangePage(d->DocName, d->DataDisplay);
}
// -------------------------------------------------------------------
@ -1834,7 +1872,8 @@ void QucsApp::slotOpenContent(QListViewItem *item)
QString Suffix = Info.extension(false);
if (Suffix == "sch" || Suffix == "dpl" || Suffix == "vhdl" ||
Suffix == "v" || Suffix == "va") {
Suffix == "v" || Suffix == "va" ||
Suffix == "m" || Suffix == "oct") {
gotoPage(Info.absFilePath());
if(item->text(1).isEmpty()) // is subcircuit ?

View File

@ -43,6 +43,7 @@ class QIconView;
class QIconViewItem;
class VTabbedDockWidget;
class VTabWidget;
class OctaveWindow;
typedef bool (Schematic::*pToggleFunc) ();
typedef void (MouseActions::*pMouseFunc) (Schematic*, QMouseEvent*);
@ -162,11 +163,13 @@ private:
// ********* Widgets on the main area **********************************
VTabbedDockWidget *dock;
VTabWidget *TabView;
QDockWindow *octDock;
OctaveWindow *octave;
QListBox *Projects;
QListView *Content;
QListViewItem *ConSchematics, *ConSources, *ConDisplays, *ConDatasets,
*ConOthers, *ConVerilog, *ConVerilogA;
*ConOthers, *ConVerilog, *ConVerilogA, *ConOctave;
QComboBox *CompChoose;
@ -209,6 +212,8 @@ private slots:
void slotViewToolBar(bool toggle); // toggle the toolbar
void slotViewStatusBar(bool toggle); // toggle the statusbar
void slotViewBrowseDock(bool toggle); // toggle the dock window
void slotViewOctaveDock(bool); // toggle the dock window
void slotToggleOctave(bool);
void slotToggleDock(bool);
void slotHelpAbout(); // shows an about dialog
void slotHelpAboutQt(); // shows the standard about dialog for Qt
@ -220,7 +225,7 @@ private:
void initStatusBar(); // setup the statusbar
QAction *helpAboutApp, *helpAboutQt, *viewToolBar, *viewStatusBar,
*viewBrowseDock;
*viewBrowseDock, *viewOctaveDock;
// menus contain the items of their menubar
QPopupMenu *fileMenu, *editMenu, *insMenu, *projMenu, *simMenu, *viewMenu,

View File

@ -1390,6 +1390,13 @@ but is %1 !</source>
<translation>إلغاء</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9107,6 +9114,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1526,6 +1526,13 @@ pero es %1!</translation>
<translation>Cancel·lar</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9777,6 +9784,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1625,6 +1625,13 @@ je ale %1 !</translation>
<translation>Zrušit</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -10188,6 +10195,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1633,6 +1633,13 @@ ist aber %1 !</translation>
<translation>Abbrechen</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -10262,6 +10269,28 @@ Konvertiert Datendatei in verschiedene Datenformate</translation>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1527,6 +1527,13 @@ pero es %1!</translation>
<translation>Cancelar</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9829,6 +9836,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1521,6 +1521,13 @@ or elle vaut %1 !</translation>
<translation>Annuler</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9889,6 +9896,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1472,6 +1472,13 @@ but is %1 !</source>
<translation>בטל</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9498,6 +9505,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1535,6 +1535,13 @@ de %1 !</translation>
<translation>Mégsem</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9867,6 +9874,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -32,6 +32,7 @@
#include "main.h"
#include "qucs.h"
#include "dialogs/vtabbeddockwidget.h"
#include "octave_window.h"
// ----------------------------------------------------------
// initializes all QActions of the application
@ -609,6 +610,13 @@ void QucsApp::initActions()
tr("Browse Window\n\nEnables/disables the browse dock window"));
connect(viewBrowseDock, SIGNAL(toggled(bool)), SLOT(slotViewBrowseDock(bool)));
viewOctaveDock = new QAction(tr("&Octave Window"), 0, this, 0);
viewOctaveDock->setToggleAction(true);
viewOctaveDock->setStatusTip(tr("Shows/hides the Octave dock window"));
viewOctaveDock->setWhatsThis(
tr("Octave Window\n\nShows/hides the Octave dock window"));
connect(viewOctaveDock, SIGNAL(toggled(bool)), SLOT(slotViewOctaveDock(bool)));
helpIndex = new QAction("Help Index...", tr("Help Index..."), Key_F1, this);
helpIndex->setStatusTip(tr("Index of Qucs Help"));
helpIndex->setWhatsThis(tr("Help Index\n\nIndex of intern Qucs help"));
@ -740,6 +748,7 @@ void QucsApp::initMenuBar()
viewToolBar->addTo(viewMenu);
viewStatusBar->addTo(viewMenu);
viewBrowseDock->addTo(viewMenu);
viewOctaveDock->addTo(viewMenu);
helpMenu = new QPopupMenu(); // menuBar entry helpMenu
helpIndex->addTo(helpMenu);
@ -909,6 +918,26 @@ void QucsApp::slotToggleDock(bool on)
viewBrowseDock->blockSignals(false);
}
// ----------------------------------------------------------
// turn Octave Dock Window on or off
void QucsApp::slotViewOctaveDock(bool toggle)
{
if(toggle) {
octDock->show();
octave->startOctave();
}
else
octDock->hide();
}
// ----------------------------------------------------------
void QucsApp::slotToggleOctave(bool on)
{
viewOctaveDock->blockSignals(true);
viewOctaveDock->setOn(on);
viewOctaveDock->blockSignals(false);
}
// ----------------------------------------------------------
void QucsApp::slotHelpAbout()
{

View File

@ -1650,6 +1650,13 @@ ma è %1 !</translation>
<translation>Annulla</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -10239,6 +10246,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1517,6 +1517,13 @@ but is %1 !</source>
<translation></translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9720,6 +9727,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1369,6 +1369,13 @@ but is %1 !</source>
<translation>Артқа қайтару</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9043,6 +9050,28 @@ Trolltech Qt жайлы</translation>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1524,6 +1524,13 @@ a jest %1 !</translation>
<translation>Porzuć</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9872,6 +9879,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1457,6 +1457,13 @@ but is %1 !</source>
<translation>Cancelar</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9000,6 +9007,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1463,6 +1463,13 @@ but is %1 !</source>
<translation type="unfinished">Revocare</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9588,6 +9595,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1632,6 +1632,13 @@ but is %1 !</source>
<translation>Отменить</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -10243,6 +10250,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1422,6 +1422,13 @@ men är nu %1 !</translation>
<translation>Avbryt</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9476,6 +9483,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1437,6 +1437,13 @@ olmalı fakat şu anda %1 !</translation>
<translation>İptal</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9582,6 +9589,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -1429,6 +1429,13 @@ but is %1 !</source>
<translation>Скасувати</translation>
</message>
</context>
<context>
<name>OctaveWindow</name>
<message>
<source>ERROR: Cannot start Octave!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptimizeDialog</name>
<message>
@ -9691,6 +9698,28 @@ Convert data file to various file formats</source>
<source>Cannot delete %1: &quot;%2&quot;!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Octave Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Octave Window
Shows/hides the Octave dock window</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QucsAttenuator</name>

View File

@ -79,6 +79,9 @@ QucsDoc::QucsDoc(QucsApp *App_, const QString& Name_)
QString base = Info.baseName(true);
QString ext = Info.extension(false);
if(ext == "m" || ext == "oct")
SimTime = "1";
DataSet = base + ".dat"; // name of the default dataset
if(ext != "dpl")
DataDisplay = base + ".dpl"; // name of default data display

View File

@ -188,6 +188,8 @@ void TextDoc::setName (const QString& Name_)
DataSet = Info.baseName (true) + ".dat";
DataDisplay = Info.baseName (true) + ".dpl";
if(Info.extension(false) == "m" || Info.extension(false) == "oct")
SimTime = "1";
}
// ---------------------------------------------------