Skip to content

Commit

Permalink
- Support for simulation flags.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11557 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Mar 26, 2012
1 parent 40550d9 commit 26c0f4b
Show file tree
Hide file tree
Showing 14 changed files with 978 additions and 706 deletions.
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Component.cpp
Expand Up @@ -431,7 +431,7 @@ void Component::mousePressEvent(QGraphicsSceneMouseEvent *event)
return;

// if component is a connector type then emit the componentClicked signal
if (event->button() == Qt::LeftButton && pMainWindow->connectAction->isChecked() && mIsConnector)
if (event->button() == Qt::LeftButton && pMainWindow->mpConnectAction->isChecked() && mIsConnector)
{
emit componentClicked(this);
}
Expand Down
6 changes: 5 additions & 1 deletion OMEdit/OMEditGUI/Helper.cpp
Expand Up @@ -44,6 +44,8 @@ QString Helper::omFileTypes = "Modelica Files (*.mo)";
QString Helper::omnotebookFileTypes = "OMNotebook Files (*.onb *.onbz *.nb)";
QString Helper::imageFileTypes = "Image Files (*.png *.svg *.bmp *.jpg)";
QString Helper::fmuFileTypes = "FMU Files (*.fmu)";
QString Helper::xmlFileTypes = "XML Files (*.xml)";
QString Helper::matFileTypes = "MAT Files (*.mat)";
QString Helper::readOnly = QString("Read-Only");
QString Helper::writeAble = QString("Writeable");
QString Helper::iconView = QString("Icon View");
Expand Down Expand Up @@ -132,7 +134,9 @@ QString Helper::exportAsImage = QString("Exporting model as an Image");
QString Helper::exportToOMNotebook = QString("Exporting model to OMNotebook");
QString Helper::importFromOMNotebook = QString("Importing model from OMNotebook");
/* Simulation Messages */
QString Helper::ModelicaSimulationMethods = "DASSL,DASSL2,Euler,RungeKutta";
QString Helper::ModelicaSimulationMethods = "dassl,dassl2,euler,rungekutta,dopri5,inline-euler,inline-rungekutta";
QString Helper::ModelicaInitializationMethods = "none,state";
QString Helper::ModelicaOptimizationMethods = "nelder_mead_ex,nelder_mead_ex2,simplex,newuoa";
QString Helper::ModelicaSimulationOutputFormats = "mat,plt,csv,empty";

QString Helper::fontSizes = QString("6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72");
Expand Down
4 changes: 4 additions & 0 deletions OMEdit/OMEditGUI/Helper.h
Expand Up @@ -51,6 +51,8 @@ class Helper
static QString omnotebookFileTypes;
static QString imageFileTypes;
static QString fmuFileTypes;
static QString xmlFileTypes;
static QString matFileTypes;
static QString readOnly;
static QString writeAble;
static QString iconView;
Expand All @@ -65,6 +67,8 @@ class Helper
static qreal globalIconYScale;
static QString ModelicaSimulationMethods;
static QString ModelicaSimulationOutputFormats;
static QString ModelicaInitializationMethods;
static QString ModelicaOptimizationMethods;
static int treeIndentation;
static QSize iconSize;
static QSize buttonIconSize;
Expand Down
6 changes: 3 additions & 3 deletions OMEdit/OMEditGUI/LibraryWidget.cpp
Expand Up @@ -876,7 +876,7 @@ void LibraryTree::showComponent()
void LibraryTree::viewDocumentation()
{
MainWindow *pMainWindow = mpParentLibraryWidget->mpParentMainWindow;
pMainWindow->documentationdock->show();
pMainWindow->mpDocumentationDockWidget->show();
LibraryTreeNode *pItem = dynamic_cast<LibraryTreeNode*>(mpParentLibraryWidget->mSelectedLibraryNode);
pMainWindow->mpDocumentationWidget->setIsCustomModel(false);
pMainWindow->mpDocumentationWidget->show(pItem->mNameStructure);
Expand Down Expand Up @@ -1186,8 +1186,8 @@ void MSLSuggestCompletion::showCompletion(const QStringList &choices)
mpPopup->setUpdatesEnabled(true);

// subtract -3 from width and -40 from height to make the suggestion box best fit :D
mpPopup->resize(mpMSLSearchBox->mpSearchMSLWidget->mpParentMainWindow->searchMSLdock->width() - 3,
mpMSLSearchBox->mpSearchMSLWidget->mpParentMainWindow->searchMSLdock->height() - 40);
mpPopup->resize(mpMSLSearchBox->mpSearchMSLWidget->mpParentMainWindow->mpSearchMSLDockWidget->width() - 3,
mpMSLSearchBox->mpSearchMSLWidget->mpParentMainWindow->mpSearchMSLDockWidget->height() - 40);

// adjust the position of popup tree
mpPopup->move(mpMSLSearchBox->mapToGlobal(QPoint(0, mpMSLSearchBox->height())));
Expand Down
9 changes: 9 additions & 0 deletions OMEdit/OMEditGUI/OMCProxy.cpp
Expand Up @@ -98,6 +98,15 @@ OMCProxy::~OMCProxy()
delete mpOMCLogger;
}

void OMCProxy::enableCustomExpression(bool enable)
{
if (!enable)
{
mpExpressionTextBox->hide();
mpSendButton->hide();
}
}

//! Puts the previous send OMC command in the send command text box.
//! Invoked by the up arrow key.
void OMCProxy::getPreviousCommand()
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/OMCProxy.h
Expand Up @@ -68,6 +68,7 @@ class OMCProxy : public QObject
public:
OMCProxy(MainWindow *pParent, bool displayErrors = true);
~OMCProxy();
void enableCustomExpression(bool enable);
void getPreviousCommand();
void getNextCommand();
void addExpressionInCommandMap(QString expression, QString result);
Expand Down
68 changes: 55 additions & 13 deletions OMEdit/OMEditGUI/OptionsWidget.cpp
Expand Up @@ -221,8 +221,13 @@ void OptionsWidget::readSettings()
//! Reads the General section settings from omedit.ini
void OptionsWidget::readGeneralSettings()
{
// read the plotting view mode
if (mSettings.contains("plotting/viewmode"))
mpGeneralSettingsPage->setViewMode(mSettings.value("plotting/viewmode").toString());
// read the working directory
if (mSettings.contains("workingDirectory"))
mpParentMainWindow->mpOMCProxy->changeDirectory(mSettings.value("workingDirectory").toString());
mpGeneralSettingsPage->setWorkingDirectory(mpParentMainWindow->mpOMCProxy->changeDirectory());
}

//! Reads the ModelicaText settings from omedit.ini
Expand Down Expand Up @@ -334,12 +339,15 @@ void OptionsWidget::readLibrariesSettings()
//! Saves the General section settings to omedit.ini
void OptionsWidget::saveGeneralSettings()
{
// save plotting view mode
mSettings.setValue("plotting/viewmode", mpGeneralSettingsPage->getViewMode());

if (mpGeneralSettingsPage->getViewMode().compare("SubWindow") == 0)
mpParentMainWindow->mpPlotWindowContainer->setViewMode(QMdiArea::SubWindowView);
else
mpParentMainWindow->mpPlotWindowContainer->setViewMode(QMdiArea::TabbedView);
// save working directory
mpParentMainWindow->mpOMCProxy->changeDirectory(mpGeneralSettingsPage->getWorkingDirectory());
mSettings.setValue("workingDirectory", mpParentMainWindow->mpOMCProxy->changeDirectory());
}

//! Saves the ModelicaText settings to omedit.ini
Expand Down Expand Up @@ -519,28 +527,39 @@ GeneralSettingsPage::GeneralSettingsPage(OptionsWidget *pParent)
: QWidget(pParent)
{
mpParentOptionsWidget = pParent;

mpPlottingGroup = new QGroupBox(tr("Plotting"));

mpViewModeLabel = new QLabel(tr("View Mode:"));
// Plotting View Mode
mpGeneralGroup = new QGroupBox(tr("General"));
mpPlottingViewModeLabel = new QLabel(tr("Plotting View Mode:"));
mpTabbedViewRadioButton = new QRadioButton(tr("Tabbed View"));
mpTabbedViewRadioButton->setChecked(true);
mpSubWindowViewRadioButton = new QRadioButton(tr("SubWindow View"));
QButtonGroup *pViewModeGroup = new QButtonGroup;
pViewModeGroup->addButton(mpTabbedViewRadioButton);
pViewModeGroup->addButton(mpSubWindowViewRadioButton);

// horizontal line
QFrame *pHorizontalLine = new QFrame();
pHorizontalLine->setFrameShape(QFrame::HLine);
pHorizontalLine->setFrameShadow(QFrame::Sunken);
// Working Directory
mpWorkingDirectoryLabel = new QLabel(tr("Working Directory:"));
mpWorkingDirectoryTextBox = new QLineEdit(mpParentOptionsWidget->mpParentMainWindow->mpOMCProxy->changeDirectory());
mpWorkingDirectoryBrowseButton = new QPushButton(Helper::browse);
connect(mpWorkingDirectoryBrowseButton, SIGNAL(clicked()), SLOT(selectWorkingDirectory()));
// set the layout of plotting group
QGridLayout *mainLayout = new QGridLayout;
mainLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
mainLayout->addWidget(mpViewModeLabel, 0, 0);
mainLayout->addWidget(mpTabbedViewRadioButton, 1, 0);
mainLayout->addWidget(mpSubWindowViewRadioButton, 2, 0);
mpPlottingGroup->setLayout(mainLayout);

mainLayout->addWidget(mpPlottingViewModeLabel, 0, 0, 1, 3);
mainLayout->addWidget(mpTabbedViewRadioButton, 1, 0, 1, 3);
mainLayout->addWidget(mpSubWindowViewRadioButton, 2, 0, 1, 3);
mainLayout->addWidget(pHorizontalLine, 3, 0, 1, 3);
mainLayout->addWidget(mpWorkingDirectoryLabel, 4, 0);
mainLayout->addWidget(mpWorkingDirectoryTextBox, 4, 1);
mainLayout->addWidget(mpWorkingDirectoryBrowseButton, 4, 2);
mpGeneralGroup->setLayout(mainLayout);
// set the layout
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(mpPlottingGroup);

layout->addWidget(mpGeneralGroup);
setLayout(layout);
}

Expand All @@ -566,6 +585,29 @@ void GeneralSettingsPage::setViewMode(QString value)
mpTabbedViewRadioButton->setChecked(true);
}

//! Returns the working directory text box value.
//! @return working directory as string.
//! @see setWorkingDirectory();
QString GeneralSettingsPage::getWorkingDirectory()
{
return mpWorkingDirectoryTextBox->text();
}

//! Sets the working directory text box value.
//! @param value the working directory value.
//! @see getWorkingDirectory();
void GeneralSettingsPage::setWorkingDirectory(QString value)
{
mpWorkingDirectoryTextBox->setText(value);
}

//! Slot activated when mpWorkingDirectoryBrowseButton clicked signal is raised.
//! Allows user to choose a new working directory.
void GeneralSettingsPage::selectWorkingDirectory()
{
mpWorkingDirectoryTextBox->setText(StringHandler::getExistingDirectory(this, tr("Choose Working Directory"), NULL));
}

//! @class ModelicaTextEditorPage
//! @brief Creats an interface for Modelica Text settings.

Expand Down
11 changes: 9 additions & 2 deletions OMEdit/OMEditGUI/OptionsWidget.h
Expand Up @@ -127,13 +127,20 @@ class GeneralSettingsPage : public QWidget
GeneralSettingsPage(OptionsWidget *pParent);
QString getViewMode();
void setViewMode(QString value);
QString getWorkingDirectory();
void setWorkingDirectory(QString value);

OptionsWidget *mpParentOptionsWidget;
private:
QGroupBox *mpPlottingGroup;
QLabel *mpViewModeLabel;
QGroupBox *mpGeneralGroup;
QLabel *mpPlottingViewModeLabel;
QLabel *mpWorkingDirectoryLabel;
QLineEdit *mpWorkingDirectoryTextBox;
QPushButton *mpWorkingDirectoryBrowseButton;
QRadioButton *mpTabbedViewRadioButton;
QRadioButton *mpSubWindowViewRadioButton;
public slots:
void selectWorkingDirectory();
};

class ModelicaTextEditorPage : public QWidget
Expand Down

0 comments on commit 26c0f4b

Please sign in to comment.