From 53abf682108ceaa9c288c98acb69281023d20582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Sat, 2 May 2015 12:29:41 +0200 Subject: [PATCH] Remove unused directories --- OMNotebook_QT3/OMNotebook/application.h | 82 - OMNotebook_QT3/OMNotebook/cell.cpp | 570 ------- OMNotebook_QT3/OMNotebook/cell.h | 231 --- OMNotebook_QT3/OMNotebook/cellapplication.cpp | 234 --- OMNotebook_QT3/OMNotebook/cellapplication.h | 92 -- .../OMNotebook/cellcommandcenter.cpp | 109 -- OMNotebook_QT3/OMNotebook/cellcommandcenter.h | 76 - OMNotebook_QT3/OMNotebook/cellcommands.cpp | 441 ------ OMNotebook_QT3/OMNotebook/cellcommands.h | 164 -- OMNotebook_QT3/OMNotebook/cellcursor.cpp | 455 ------ OMNotebook_QT3/OMNotebook/cellcursor.h | 113 -- OMNotebook_QT3/OMNotebook/celldocument.cpp | 555 ------- OMNotebook_QT3/OMNotebook/celldocument.h | 175 -- OMNotebook_QT3/OMNotebook/celldocumentview.h | 92 -- OMNotebook_QT3/OMNotebook/cellfactory.cpp | 175 -- OMNotebook_QT3/OMNotebook/cellfactory.h | 79 - OMNotebook_QT3/OMNotebook/cellgrammar.cpp | 108 -- OMNotebook_QT3/OMNotebook/cellgroup.cpp | 343 ---- OMNotebook_QT3/OMNotebook/cellgroup.h | 118 -- .../OMNotebook/cellparserfactory.cpp | 92 -- OMNotebook_QT3/OMNotebook/command.h | 133 -- OMNotebook_QT3/OMNotebook/commandcenter.h | 73 - OMNotebook_QT3/OMNotebook/copytest.cpp | 77 - OMNotebook_QT3/OMNotebook/cursorcommands.h | 220 --- OMNotebook_QT3/OMNotebook/document.h | 136 -- OMNotebook_QT3/OMNotebook/documentview.h | 76 - OMNotebook_QT3/OMNotebook/factory.h | 84 - OMNotebook_QT3/OMNotebook/imagecell.cpp | 115 -- OMNotebook_QT3/OMNotebook/imagecell.h | 88 - OMNotebook_QT3/OMNotebook/inputcell.cpp | 516 ------ OMNotebook_QT3/OMNotebook/inputcell.h | 134 -- OMNotebook_QT3/OMNotebook/inputcelldelegate.h | 76 - OMNotebook_QT3/OMNotebook/moc_cell.cpp | 311 ---- .../OMNotebook/moc_cellapplication.cpp | 94 -- OMNotebook_QT3/OMNotebook/moc_cellcursor.cpp | 147 -- .../OMNotebook/moc_celldocument.cpp | 184 --- OMNotebook_QT3/OMNotebook/moc_cellgroup.cpp | 126 -- OMNotebook_QT3/OMNotebook/moc_document.cpp | 92 -- .../OMNotebook/moc_documentview.cpp | 92 -- OMNotebook_QT3/OMNotebook/moc_imagecell.cpp | 92 -- OMNotebook_QT3/OMNotebook/moc_inputcell.cpp | 151 -- OMNotebook_QT3/OMNotebook/moc_notebook.cpp | 164 -- .../OMNotebook/moc_omc_communicator.cpp | 92 -- .../moc_smlinteractiveenvironment.cpp | 106 -- OMNotebook_QT3/OMNotebook/moc_stylesheet.cpp | 92 -- OMNotebook_QT3/OMNotebook/moc_textcell.cpp | 282 ---- OMNotebook_QT3/OMNotebook/moc_treeview.cpp | 128 -- OMNotebook_QT3/OMNotebook/modelicacolors.xml | 23 - .../OMNotebook/modelicahighlighter.h | 259 --- OMNotebook_QT3/OMNotebook/nbparser.h | 65 - OMNotebook_QT3/OMNotebook/notebook.cpp | 689 -------- OMNotebook_QT3/OMNotebook/notebook.h | 142 -- OMNotebook_QT3/OMNotebook/notebookcommands.h | 197 --- OMNotebook_QT3/OMNotebook/notebookparser.cpp | 170 -- OMNotebook_QT3/OMNotebook/notebookparser.h | 74 - .../OMNotebook/omc_communicator.cpp | 1411 ----------------- .../OMNotebook/omc_communicator.hpp | 200 --- .../OMNotebook/omcinteractiveenvironment.cpp | 87 - .../OMNotebook/omcinteractiveenvironment.h | 71 - OMNotebook_QT3/OMNotebook/parserfactory.h | 81 - OMNotebook_QT3/OMNotebook/qtapp.cpp | 89 -- OMNotebook_QT3/OMNotebook/rule.h | 95 -- .../OMNotebook/selectingvisitor.cpp | 68 - OMNotebook_QT3/OMNotebook/selectingvisitor.h | 80 - .../OMNotebook/serializingvisitor.cpp | 171 -- .../OMNotebook/serializingvisitor.h | 107 -- OMNotebook_QT3/OMNotebook/smlhighlighter.h | 123 -- .../OMNotebook/smlinteractiveenvironment.cpp | 125 -- .../OMNotebook/smlinteractiveenvironment.h | 81 - .../OMNotebook/smlsyntaxhighlighter.cpp | 300 ---- .../OMNotebook/smlsyntaxhighlighter.h | 146 -- OMNotebook_QT3/OMNotebook/stylesheet.cpp | 649 -------- OMNotebook_QT3/OMNotebook/stylesheet.h | 104 -- OMNotebook_QT3/OMNotebook/stylesheet.xml | 114 -- .../OMNotebook/syntax_highlighter.cpp | 303 ---- .../OMNotebook/syntax_highlighter.hpp | 151 -- OMNotebook_QT3/OMNotebook/syntaxhighlighter.h | 69 - OMNotebook_QT3/OMNotebook/textcell.cpp | 378 ----- OMNotebook_QT3/OMNotebook/textcell.h | 132 -- OMNotebook_QT3/OMNotebook/treeview.cpp | 204 --- OMNotebook_QT3/OMNotebook/treeview.h | 112 -- OMNotebook_QT3/OMNotebook/trunk.pro | 96 -- OMNotebook_QT3/OMNotebook/trunk.sln | 39 - OMNotebook_QT3/OMNotebook/trunk.vcproj | 704 -------- OMNotebook_QT3/OMNotebook/visitor.h | 97 -- OMNotebook_QT3/OMNotebook/xmlparser.cpp | 197 --- OMNotebook_QT3/OMNotebook/xmlparser.h | 73 - 87 files changed, 16461 deletions(-) delete mode 100644 OMNotebook_QT3/OMNotebook/application.h delete mode 100644 OMNotebook_QT3/OMNotebook/cell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cell.h delete mode 100644 OMNotebook_QT3/OMNotebook/cellapplication.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cellapplication.h delete mode 100644 OMNotebook_QT3/OMNotebook/cellcommandcenter.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cellcommandcenter.h delete mode 100644 OMNotebook_QT3/OMNotebook/cellcommands.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cellcommands.h delete mode 100644 OMNotebook_QT3/OMNotebook/cellcursor.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cellcursor.h delete mode 100644 OMNotebook_QT3/OMNotebook/celldocument.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/celldocument.h delete mode 100644 OMNotebook_QT3/OMNotebook/celldocumentview.h delete mode 100644 OMNotebook_QT3/OMNotebook/cellfactory.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cellfactory.h delete mode 100644 OMNotebook_QT3/OMNotebook/cellgrammar.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cellgroup.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cellgroup.h delete mode 100644 OMNotebook_QT3/OMNotebook/cellparserfactory.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/command.h delete mode 100644 OMNotebook_QT3/OMNotebook/commandcenter.h delete mode 100644 OMNotebook_QT3/OMNotebook/copytest.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/cursorcommands.h delete mode 100644 OMNotebook_QT3/OMNotebook/document.h delete mode 100644 OMNotebook_QT3/OMNotebook/documentview.h delete mode 100644 OMNotebook_QT3/OMNotebook/factory.h delete mode 100644 OMNotebook_QT3/OMNotebook/imagecell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/imagecell.h delete mode 100644 OMNotebook_QT3/OMNotebook/inputcell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/inputcell.h delete mode 100644 OMNotebook_QT3/OMNotebook/inputcelldelegate.h delete mode 100644 OMNotebook_QT3/OMNotebook/moc_cell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_cellapplication.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_cellcursor.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_celldocument.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_cellgroup.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_document.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_documentview.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_imagecell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_inputcell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_notebook.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_omc_communicator.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_smlinteractiveenvironment.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_stylesheet.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_textcell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/moc_treeview.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/modelicacolors.xml delete mode 100644 OMNotebook_QT3/OMNotebook/modelicahighlighter.h delete mode 100644 OMNotebook_QT3/OMNotebook/nbparser.h delete mode 100644 OMNotebook_QT3/OMNotebook/notebook.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/notebook.h delete mode 100644 OMNotebook_QT3/OMNotebook/notebookcommands.h delete mode 100644 OMNotebook_QT3/OMNotebook/notebookparser.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/notebookparser.h delete mode 100644 OMNotebook_QT3/OMNotebook/omc_communicator.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/omc_communicator.hpp delete mode 100644 OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.h delete mode 100644 OMNotebook_QT3/OMNotebook/parserfactory.h delete mode 100644 OMNotebook_QT3/OMNotebook/qtapp.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/rule.h delete mode 100644 OMNotebook_QT3/OMNotebook/selectingvisitor.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/selectingvisitor.h delete mode 100644 OMNotebook_QT3/OMNotebook/serializingvisitor.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/serializingvisitor.h delete mode 100644 OMNotebook_QT3/OMNotebook/smlhighlighter.h delete mode 100644 OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.h delete mode 100644 OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.h delete mode 100644 OMNotebook_QT3/OMNotebook/stylesheet.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/stylesheet.h delete mode 100644 OMNotebook_QT3/OMNotebook/stylesheet.xml delete mode 100644 OMNotebook_QT3/OMNotebook/syntax_highlighter.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/syntax_highlighter.hpp delete mode 100644 OMNotebook_QT3/OMNotebook/syntaxhighlighter.h delete mode 100644 OMNotebook_QT3/OMNotebook/textcell.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/textcell.h delete mode 100644 OMNotebook_QT3/OMNotebook/treeview.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/treeview.h delete mode 100644 OMNotebook_QT3/OMNotebook/trunk.pro delete mode 100644 OMNotebook_QT3/OMNotebook/trunk.sln delete mode 100644 OMNotebook_QT3/OMNotebook/trunk.vcproj delete mode 100644 OMNotebook_QT3/OMNotebook/visitor.h delete mode 100644 OMNotebook_QT3/OMNotebook/xmlparser.cpp delete mode 100644 OMNotebook_QT3/OMNotebook/xmlparser.h diff --git a/OMNotebook_QT3/OMNotebook/application.h b/OMNotebook_QT3/OMNotebook/application.h deleted file mode 100644 index 5e937acd19d..00000000000 --- a/OMNotebook_QT3/OMNotebook/application.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _APPLICATION_H -#define _APPLICATION_H - -#include - -#include - -#include "commandcenter.h" -#include "cell.h" - -using namespace std; - -namespace IAEX -{ - //class CommandCenter; - - /*!\interface Application - * \brief Describes the core application. - * - * See qtapp.cpp for more information about how to use this class. - * - */ - class Application - { - public: - virtual CommandCenter *commandCenter() = 0; - virtual void setCommandCenter(CommandCenter *) = 0; - virtual void addToPasteboard(Cell *cell) = 0; - virtual void clearPasteboard() = 0; - virtual vector pasteboard() = 0; - virtual void open(const QString filename) = 0; - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/cell.cpp b/OMNotebook_QT3/OMNotebook/cell.cpp deleted file mode 100644 index 71048b78aed..00000000000 --- a/OMNotebook_QT3/OMNotebook/cell.cpp +++ /dev/null @@ -1,570 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - - - -//STD Headers -//af#include -//at#include -//af#include - -//QT Headers -#include - -//IAEX Headers -#include "cell.h" -//#include "notebookcommands.h" - -using namespace IAEX; - -namespace IAEX{ - - /*! \class Cell - * \author Ingemar Axelsson - * \brief Cellinterface contains all functionality required to be a cell. - * - * It implements the cells core functionality. Objects of this - * class should never be created. Instead tailored objects from - * subclasses such as TextCell, InputCell, CellGroup or ImageCell - * should be used. - * - * To extend the Qt Notebook application with new type of cells - * subclass this class. Then subclass or reimplement a CellFactory - * so it creates the new type of cell. Examples of adding new cell - * look at InputCell and ImageCell. - * - * Cells contains of two parts, a mainwidget containing the cells - * data, and the treewidget containing the treeview at the right side - * of the cell. - * - * \todo Implement a widgetstack for the treeview. This to make it - * possible to implement other treeview structures. - * - */ - Cell::Cell(QWidget *parent, const char *name) - : QWidget(parent, name), //Node(), - selected_(false), - treeviewVisible_(true), - backgroundColor_(QColor(255,255,255)), - parent_(0), - next_(0), - last_(0), - previous_(0), - child_(0), - style_(""), //AF - references_(0) - { - setMouseTracking(TRUE); - - mainlayout_ = new QGridLayout(this,1,2); - setLabel(new QLabel(this, "")); - - setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - setBackgroundMode(Qt::PaletteBase); - setPaletteBackgroundColor(backgroundColor()); - setTreeWidget(new TreeView(this)); - } - - Cell::Cell(Cell &c) : QWidget() - { - setMouseTracking(TRUE); - - mainlayout_ = new QGridLayout(this,1,2); - setLabel(new QLabel(this, "")); - - setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - setBackgroundMode(Qt::PaletteBase); - setPaletteBackgroundColor(c.backgroundColor()); - setTreeWidget(new TreeView(this)); - } - - Cell::~Cell() - { - //Delete if there are no references to this cell. - if(references_ <= 0) - { - setMouseTracking(FALSE); - - delete treeView_; - delete mainWidget_; - delete label_; - } - } - - /*! \brief Set the cells mainwidget. - * - * \todo Delete old widget. - * - * \param newWidget A pointer to the cells new mainwidget. - */ - void Cell::setMainWidget(QWidget *newWidget) - { - if(newWidget != 0) - { - mainWidget_ = newWidget; - mainlayout_->addWidget(newWidget,1,1); - - mainWidget_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding)); - - mainWidget_->setPaletteBackgroundColor(backgroundColor()); - } - else - mainWidget_= 0; - } - - /*! - * \author Ingemar Axelsson - * \return A pointer to the mainwidget for the cell. - */ - QWidget *Cell::mainWidget() - { - if(!mainWidget_) - throw logic_error("Cell::mainWidget(): No mainWidget set."); - - return mainWidget_; - } - - - void Cell::setLabel(QLabel *label) - { - label_ = label; - mainlayout_->addWidget(label,1,0); - label_->setPaletteBackgroundColor(backgroundColor()); - label_->hide(); - } - - QLabel *Cell::label() - { - return label_; - } - - /*! - * \brief Add a treeview widget to the cell. - */ - void Cell::setTreeWidget(TreeView *newTreeWidget) - { - treeView_ = newTreeWidget; - treeView_->setFocusPolicy(QWidget::NoFocus); - mainlayout_->addWidget(newTreeWidget,1,2, Qt::AlignTop); - treeView_->setBackgroundColor(backgroundColor()); - treeView_->show(); - - connect(this, SIGNAL(selected(const bool)), - treeView_, SLOT(setSelected(const bool))); - } - - TreeView *Cell::treeView() - { - if(!treeView_) - throw logic_error("Cell::treeView(): No treeView set."); - - return treeView_; - } - - /*! - * \todo The treewidget should not only be hidden, the mainwidget - * should be resized. - * - *\todo test if repaint is needed here. - */ - void Cell::hideTreeView(const bool hidden) - { - if(hidden) - { - treeView_->hide(); - } - else - { - treeView_->show(); - } - - treeviewVisible_ = !hidden; - repaint(); - } - - /*! \return TRUE if treeview is hidden. Otherwise FALSE. - */ - const bool Cell::isTreeViewVisible() const - { - return treeviewVisible_; - } - - /*! \brief Sets the height of the cell. - * \author Ingemar Axelsson - * - * \param height New height for cell. - */ - void Cell::setHeight(const int height) - { - int h = height; - - //! \bug Implement Cell::setHeight() in a correct way. Does not work for - //! widgets larger than 30000. - if(height > 30000) - h = 30000; - - setFixedHeight(h); - - if(!treeView_) - throw logic_error("SetHeight(const int height): TreeView is not set."); - - treeView_->setFixedHeight(h); - - emit heightChanged(); - } - - - /*! \brief Describes what will happen if a mousebutton is released - * when the mouse is over the treeview widget. - * \author Ingemar Axelsson - * - * \bug Should be done in the TreeView instead. Then a - * signal could be emitted. - */ - void Cell::mouseReleaseEvent(QMouseEvent *event) - { - if(treeView_->hasMouse()) - { - this->setSelected(!isSelected()); - emit cellselected(this, event->state()); - } - else - { - //Do nothing. - } - } - - /*! \brief - * Mouse move event is triggered when the mouse is moved. - * - * This method must be implemented when adding support for drag and - * drop. Also look at the QT manual for more information about drag - * and drop. - * - * \param event QMouseEvent sent from widgets parent. - * - * \todo Needs a cursor->moveBefore member. - */ - void Cell::mouseMoveEvent(QMouseEvent *event) - { -// cout << "Event (X:Y): (" << event->pos().x() -// << ":" << event->pos().y() << ")" << endl; - - if(event->pos().x() < 0 || event->pos().x() > this->width()) - { - //Not inside widget. Do not care - } - else - { - if(event->pos().y() < 0) - { - //if(hasPrevious()) -// doc()->executeCommand(new CursorMoveAfterCommand(previous())) -// doc()->executeCommand(new CursorMoveAfterCommand(this)); - // else -// { -// if(parentCell()->hasParentCell()) //Check for errors -// doc()->executeCommand(new CursorMoveAfterCommand(parentCell()->previous())); -// else -// { -// //Do nothing! -// } -// } - } - -// else // if(event->pos().y() < height()) -// { -// doc()->executeCommand(new CursorMoveAfterCommand(this)); -// } - -// if((doc()->getCursor())->currentCell() != this) -// { -// doc()->executeCommand(new CursorMoveAfterCommand(this)); -// } - } - } - - void Cell::resizeEvent(QResizeEvent *event) - { - setHeight(height()); - QWidget::resizeEvent(event); - } - - /*! - * \return true if cell is selected, false otherwise. - */ - const bool Cell::isSelected() const - { - return selected_; - } - - /*! \brief Set the value for selectec_ to true if the cell is - * selected. - * \author Ingemar Axelsson - * - * This slot is used to change the state of the cell. - * - * \todo Tell the treeview that the cell has changed state. Should the - * cell be responsible to decide if it has been selected or should the - * treeview decide? Probably better if the cell decides. - * - * \param selected true if cell should be selected, false otherwise - */ - void Cell::setSelected(const bool sel) - { - selected_ = sel; - emit selected(selected_); - } - - /*! \brief Set the cells background color. - * \author Ingemar Axelsson - * - * Sets cells backgroundcolor. Also propagates the background color to - * the cells child widgets. - * - * \param color new color. - */ - void Cell::setBackgroundColor(const QColor color) - { - backgroundColor_ = color; - setPaletteBackgroundColor(color); - } - - /*!\brief get the current backgroundcolor. - * \author Ingemar Axelsson - * - * \return current background color. - */ - const QColor Cell::backgroundColor() const - { - return backgroundColor_; - } - - void Cell::setStyle(const QString &style) - { - style_ = style; - } - - void Cell::setStyle(const QString &name, const QString &val) - { - addRule(new Rule(name, val)); - } - - QString Cell::style() const - { - return style_; - } - - void Cell::addRule(Rule *r) - { - rules_.push_back(r); - } - - Cell::rules_t Cell::rules() const - { - return rules_; - } - -/////VIRTUALS //////////////////////////////// - - - /*! \brief Implements visitor acceptability. - * - */ - void Cell::accept(Visitor &v) - { - v.visitCellNodeBefore(this); - - if(hasChilds()) - child()->accept(v); - - v.visitCellNodeAfter(this); - - //Move along. - if(hasNext()) - next()->accept(v); - } - - void Cell::addCellWidget(Cell *newCell) - { - cerr << "AddCellWidget" << endl; - parentCell()->addCellWidget(newCell); - } - -////// DATASTRUCTURE IMPLEMENTATION /////////////////////////// - - void Cell::setNext(Cell *nxt) - { - next_ = nxt; - } - - Cell *Cell::next() - { - return next_; - } - - bool Cell::hasNext() - { - return next_ != 0; - } - - void Cell::setLast(Cell *last) - { - last_ = last; - } - - Cell *Cell::last() - { - return last_; - } - - bool Cell::hasLast() - { - return hasChilds(); - } - - void Cell::setPrevious(Cell *prev) - { - previous_ = prev; - } - - Cell *Cell::previous() - { - return previous_; - } - - bool Cell::hasPrevious() - { - return previous_ != 0; - } - - Cell *Cell::parentCell() - { - return parent_; - } - - void Cell::setParentCell(Cell *parent) - { - parent_ = parent; - } - - bool Cell::hasParentCell() - { - return parent_ != 0; - } - - void Cell::setChild(Cell *child) - { - child_ = child; - } - - Cell *Cell::child() - { - return child_; - } - - bool Cell::hasChilds() - { - return child_ != 0; - } - - void Cell::printCell(Cell *current) - { - cout << "This: " << current << endl - << "Parent: " << current->parentCell() << endl - << "Child: " << current->child() << endl - << "Last: " << current->last() << endl - << "Next: " << current->next() << endl - << "Prev: " << current->previous() << endl; - } - - void Cell::printSurrounding(Cell *current) - { - cout << "CURRENT CELL:" << endl; - printCell(current); - - //Print surroundings - if(current->hasNext()) - { - cout << "Next: " << endl; - printCell(current->next()); - cout << endl; - } - - if(current->hasPrevious()) - { - cout << "Previous: " << endl; - printCell(current->previous()); - cout << endl; - } - - if(current->hasParentCell()) - { - cout << "Parent: " << endl; - printCell(current->parentCell()); - cout << endl; - } - - if(current->hasChilds()) - { - cout << "Child: " << endl; - printCell(current->child()); - cout << endl; - } - } - -// void Cell::retain() -// { -// references_ += 1; -// } - -// void Cell::release() -// { -// references_ -= 1; -// } -} diff --git a/OMNotebook_QT3/OMNotebook/cell.h b/OMNotebook_QT3/OMNotebook/cell.h deleted file mode 100644 index 2fe966e83d9..00000000000 --- a/OMNotebook_QT3/OMNotebook/cell.h +++ /dev/null @@ -1,231 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file cell.h - * \author Ingemar Axelsson - * \brief Definition of the cellinterface. - * - * This file contains the definition of the cellinterface. - */ -#ifndef CELL_H -#define CELL_H - -//STD Headers -//af#include -#include - -//QT Headers -#include -#include -#include -#include -#include - -//IAEX Headers -//#include "document.h" -#include "visitor.h" -#include "treeview.h" -#include "rule.h" -#include "inputcelldelegate.h" -#include "syntaxhighlighter.h" - -using namespace IAEX; - -namespace IAEX{ - -// class CellInterface -// { -// public: -// virtual void accept(Visitor &v) = 0; - -// //Interface from cellgroup -// virtual void addChild(CellInterface *child) = 0; -// virtual void height() = 0; -// virtual void setClosed(const bool closed) = 0; //public slot -// virtual void adjustHeight() = 0; //public slot - -// //Interface from textedit -// virtual void setText(QString text) = 0; -// virtual QString text() = 0; -// virtual void clear() = 0; - -// virtual void clickEvent(int para, int pos); -// virtual void setReadOnly(const bool readonly); -// virtual void setFocused(const bool focused); -// virtual void openLink(QUrl *link); -// virtual void setStyle(const QString &style); -// virtual void setStyle(const QString &name, const QString &val); - -// //Interface from inputcell -// }; - - class Cell : public QWidget //, public Node - { - Q_OBJECT - public: - typedef vector rules_t; - public: - Cell(QWidget *parent=0, const char *name=0); - Cell(Cell &c); - virtual ~Cell(); - - //Datastructure interface. - void setNext(Cell *nxt); - Cell *next(); - bool hasNext(); - - void setLast(Cell *last); - Cell *last(); - bool hasLast(); - - void setPrevious(Cell *prev); - Cell *previous(); - bool hasPrevious(); - - Cell *parentCell(); - void setParentCell(Cell *parent); - bool hasParentCell(); - - void setChild(Cell *child); - Cell *child(); - bool hasChilds(); - - void printCell(Cell *current); - void printSurrounding(Cell *current); - - //Document *doc() const; - - //TextCell interface. - virtual QString text() = 0;//{return QString::null;} - virtual void viewExpression(const bool){}; - - //Cellgroup interface. - virtual void addChild(Cell *){} - virtual void removeChild(Cell *){} - virtual bool isClosed() const{ return false;} - virtual void setClosed(const bool){} - - virtual void addCellWidget(Cell *newCell); //Protected? - - //Rename to insertCellWidgets() instead. - virtual void addCellWidgets(){parentCell()->addCellWidgets();} - virtual void removeCellWidgets(){parentCell()->removeCellWidgets();} - - //Traversal methods - virtual void accept(Visitor &v); - - //Flags - const bool isSelected() const; - const bool isTreeViewVisible() const; - - //Properties - const QColor backgroundColor() const; - virtual QString style() const; - virtual rules_t rules() const; - QWidget *mainWidget(); - TreeView *treeView(); - QLabel *label(); - - public slots: - virtual void addRule(Rule *r); - virtual void setStyle(const QString &style); - virtual void setStyle(const QString &name, const QString &val); - virtual void setText(QString text){} - - virtual void setReadOnly(const bool){} - - virtual void setBackgroundColor(const QColor color); - virtual void setSelected(const bool selected); - virtual void setFocus(const bool focus) = 0; - virtual void setHeight(const int height); - void hideTreeView(const bool hidden); - - protected slots: - void setLabel(QLabel *label); - void setTreeWidget(TreeView *newTreeWidget); - void setMainWidget(QWidget *newWidget); - - signals: - void clicked(Cell*); - void doubleClicked(int); - void changedWidth(const int); - void selected(const bool); - void cellselected(Cell *, Qt::ButtonState); - void heightChanged(); - void openLink(QUrl *link); - void cellOpened(Cell *, const bool); - - protected: - //Events - void resizeEvent(QResizeEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - - private: - QGridLayout *mainlayout_; - TreeView *treeView_; - QWidget *mainWidget_; - QLabel *label_; - QString style_; - - //Document *doc_; - bool selected_; - bool treeviewVisible_; - QColor backgroundColor_; - - rules_t rules_; - - Cell *parent_; - Cell *next_; - Cell *last_; - Cell *previous_; - Cell *child_; - - int references_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/cellapplication.cpp b/OMNotebook_QT3/OMNotebook/cellapplication.cpp deleted file mode 100644 index 204e2278bc8..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellapplication.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include "windows.h" - -#include -#include -#include - -#include "cellapplication.h" -#include "celldocument.h" -#include "commandcenter.h" -#include "cellcommandcenter.h" -#include "cursorcommands.h" -#include "notebook.h" -#include "omcinteractiveenvironment.h" - -namespace IAEX -{ - /*! \class CellApplication - * - * \brief Implements the application interface. This class is the - * main controller of the program. - * - * This class has the responsibility to open new windows, open new - * documents and handle commands. Commands are sent to a - * commandCenter object where they are executed and stored (they - * should be stored). - * - * \todo replace with QString::NULL! before shipping!! - * - * \todo Make it possible to open from commandline, give a filename. - */ - CellApplication::CellApplication(int &argc, char **argv) - : QObject() - { - app_ = new QApplication(argc, argv); - - // 2005-10-25 AF, added a check if omc is running - try - { - new OmcInteractiveEnvironment(); - } - catch( exception &e ) - { -#ifdef WIN32 - - try - { - STARTUPINFO startinfo; - PROCESS_INFORMATION procinfo; - memset(&startinfo, 0, sizeof(startinfo)); - memset(&procinfo, 0, sizeof(procinfo)); - startinfo.cb = sizeof(STARTUPINFO); - startinfo.wShowWindow = SW_MINIMIZE; - startinfo.dwFlags = STARTF_USESHOWWINDOW; - - string parameter = "\"omc.exe\" +d=interactiveCorba"; - char *pParameter = new char[parameter.size() + 1]; - const char *cpParameter = parameter.c_str(); - strcpy(pParameter, cpParameter); - - bool flag = CreateProcess(NULL,pParameter,NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,NULL,&startinfo,&procinfo); - - Sleep(2000); - - if( !flag ) - throw std::exception("Unable to start OMC"); - } - catch( exception &e ) - { - QString msg = e.what(); - msg += "\nWas unable to start OMC! Closeing OMNotebook!"; - QMessageBox::warning( 0, "Error", msg, "OK" ); - std::exit(-1); - } - -#else - - QString msg = e.what(); - msg += "\nOMC not started! Closeing OMNotebook!"; - QMessageBox::warning( 0, "Error", msg, "OK" ); - std::exit(-1); - -#endif - } - - - QObject::connect(app_, SIGNAL(lastWindowClosed()), - app_, SLOT(quit())); - - //Create a commandCenter. - cmdCenter_ = new CellCommandCenter(this); - - //open(QString("drmodelica.xml")); - - QDir dir; - if( dir.exists( "DrModelica/DrModelica.nb" )) - open(QString("DrModelica/DrModelica.nb")); - else - open(QString::null); - //open(QString("anders.xml")); - //open(QString("HelloWorld.nb")); - //open(QString::null); - } - - int CellApplication::exec() - { - return app_->exec(); - } - - CellApplication::~CellApplication() - { - // 2005-11-24 AF, - // check if omc server is still runing, if its runing -> send quit() command - try - { - OmcInteractiveEnvironment *omc = new OmcInteractiveEnvironment(); - omc->evalExpression( QString("quit()") ); - //omc->getResult(); - //delete omc; - } - catch( exception &e ) - { return; } - } - - void CellApplication::add(Document *d) - { - documents_.push_back(d); - } - - void CellApplication::add(DocumentView *d) - { - views_.push_back(d); - d->show(); - } - - CommandCenter *CellApplication::commandCenter() - { - return cmdCenter_; - } - - void CellApplication::setCommandCenter(CommandCenter *c) - { - cmdCenter_ = c; - cmdCenter_->setApplication(this); - } - - void CellApplication::open(const QString filename) - { - //1. Create a new document. - Document *d = new CellDocument(this, filename); - add(d); - - //2. Create a new View. - // 2005-09-22 AF: Added 'filename' in NotebookWindow() call - DocumentView *v = new NotebookWindow(d, filename); - add(v); - v->show(); - //commandCenter()->executeCommand(new OpenFileCommand()); - } - - /*! - * \todo Create a pasteboard class as a Singleton that should be - * used instead of having a singleton inside the application class. - * Other things to do is to use the systemwide pasteboard instead. - */ - void CellApplication::addToPasteboard(Cell *c) - { - pasteboard_.push_back(c); - } - - /*! - * This is used to clear the pasteboard. This is an ugly solution. - */ - void CellApplication::clearPasteboard() - { - pasteboard_.clear(); - } - - /*! - * returns a vector with all content of the pasteboard. - * - * When requesting the pasteboard, clear pasteboard. - */ - vector CellApplication::pasteboard() - { - return pasteboard_; - } -} diff --git a/OMNotebook_QT3/OMNotebook/cellapplication.h b/OMNotebook_QT3/OMNotebook/cellapplication.h deleted file mode 100644 index 09fb0174b01..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellapplication.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _CELLAPPLICATION_H -#define _CELLAPPLICATION_H - -#include -#include - -#include "application.h" -#include "commandcenter.h" -#include "documentview.h" - -namespace IAEX -{ - class CellApplication : public QObject, public Application - { - Q_OBJECT - public: - CellApplication(int &argc, char **argv); - virtual ~CellApplication(); - - virtual CommandCenter *commandCenter(); - virtual void setCommandCenter(CommandCenter *c); - - virtual void addToPasteboard(Cell *c); - virtual void clearPasteboard(); - vector pasteboard(); - - int exec(); - void add(Document *doc); - void add(DocumentView *view); - - void open(const QString filename); - - protected: - //bool eventFilter(QObject *o, QEvent *e); - - private: - QApplication *app_; - vector documents_; - vectorviews_; - CommandCenter *cmdCenter_; - vector pasteboard_; - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/cellcommandcenter.cpp b/OMNotebook_QT3/OMNotebook/cellcommandcenter.cpp deleted file mode 100644 index 0b715c945cc..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellcommandcenter.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include - -#include "cellcommandcenter.h" - -using namespace std; - -namespace IAEX -{ - /*! \class CellCommandCenter - * - * \brief Executes and store commands. - * - * This class has the responsibility of storing and executing - * commands. Support for undo is not implemented yet. - * - * \todo implement undo/redo functionality. This needs some changes - * in the command classes. - */ - CellCommandCenter::CellCommandCenter(Application *a) - : app_(a) - { - } - - CellCommandCenter::~CellCommandCenter() - { - storeCommands(); - } - - void CellCommandCenter::executeCommand(Command *cmd) - { - cmd->setApplication(application()); - - //Save for undo redo, or atleast for printing. - storage_.push_back(cmd); - - cmd->execute(); - } - - Application *CellCommandCenter::application() - { - return app_; - } - - void CellCommandCenter::setApplication(Application *app) - { - app_ = app; - } - - void CellCommandCenter::storeCommands() - { - ofstream diskstorage("lastcommands.txt"); - - vector::iterator i = storage_.begin(); - - for(;i!= storage_.end();++i) - { - diskstorage << (*i)->commandName() << endl; - } - } -} - diff --git a/OMNotebook_QT3/OMNotebook/cellcommandcenter.h b/OMNotebook_QT3/OMNotebook/cellcommandcenter.h deleted file mode 100644 index 3f6aaca8dd5..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellcommandcenter.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _CELLCOMMANDCENTER_H -#define _CELLCOMMANDCENTER_H - -#include "commandcenter.h" -#include "command.h" -#include "application.h" - -namespace IAEX -{ - class CellCommandCenter : public CommandCenter - { - public: - CellCommandCenter(Application *a); - virtual ~CellCommandCenter(); - - virtual void executeCommand(Command *cmd); - virtual Application *application(); - - virtual void setApplication(Application *app); - - private: - void storeCommands(); - - Application *app_; - vector storage_; - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/cellcommands.cpp b/OMNotebook_QT3/OMNotebook/cellcommands.cpp deleted file mode 100644 index 3e625e7c2ae..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellcommands.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include - -#include "cellcommands.h" - -namespace IAEX -{ - /*! \class AddCellCommand - * - * \brief Command for adding a new cell to the cellstructure. - */ - void AddCellCommand::execute() - { - try - { - CellCursor *cursor = document()->getCursor(); - - Factory *fac = document()->cellFactory(); - - QString style; - - if(cursor->currentCell()->hasChilds()) - style = cursor->currentCell()->child()->style(); - else - style = cursor->currentCell()->style(); - - //qDebug( "Add style:" ); - //qDebug( style ); - - //This does not work. - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(true); - cursor->currentCell()->child()->setFocus(false); - } - } - else - { - cursor->currentCell()->setReadOnly(true); - cursor->currentCell()->setFocus(false); - } - - cursor->addBefore(fac->createCell(style)); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(false); - cursor->currentCell()->child()->setFocus(true); - } - } - else - { - cursor->currentCell()->setReadOnly(false); - cursor->currentCell()->setFocus(true); - } - } - catch(exception &e) - { - cerr << "AddCellCommand(), Exception: " << e.what() << endl; - } - } - - /*! \class CreateNewCellCommand - * - * \brief Command for creating a new cell. - */ - void CreateNewCellCommand::execute() - { - try - { - CellCursor *cursor = document()->getCursor(); - - Factory *fac = document()->cellFactory(); - - //This does not work. - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(true); - cursor->currentCell()->child()->setFocus(false); - } - } - else - { - cursor->currentCell()->setReadOnly(true); - cursor->currentCell()->setFocus(false); - } - - cursor->addBefore(fac->createCell(style_)); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(false); - cursor->currentCell()->child()->setFocus(true); - } - } - else - { - cursor->currentCell()->setReadOnly(false); - cursor->currentCell()->setFocus(true); - } - } - catch(exception &e) - { - cerr << "CreateNewCommand(), Exception: " << e.what() << endl; - } - } - - - /*! class CopySelectedCellsCommand - * \brief copy a cell. Adds a copy of the cell on the pasteboard. - * - * \todo Implement some kind of internal state or copy constructors - * for all cells. This to make the copy process more general. - * - * \todo Implement release from cellgroup. It should be possible to - * remove pointers to the cell structure without deleting the - * object. That needs reparenting of all subcells. - */ - void CopySelectedCellsCommand::execute() - { - CellCursor *c = document()->getCursor(); - vector cells = document()->getSelection(); - - if(cells.empty()) - { - //Empty pasteboard. - application()->clearPasteboard(); - application()->addToPasteboard(c->currentCell()); - } - else - { - document()->clearSelection(); //Notice - application()->clearPasteboard(); - - vector::iterator i = cells.begin(); - for(;i != cells.end();++i) - { - application()->addToPasteboard((*i)); - } - } - } - - /*! What happens if a Groupcell is removed? - */ - void DeleteCurrentCellCommand::execute() - { - try - { - CellCursor *c = document()->getCursor(); - vector cells = document()->getSelection(); - - if(cells.empty()) - { - //Empty pasteboard. - application()->clearPasteboard(); - application()->addToPasteboard(c->currentCell()); - - c->removeCurrentCell(); - } - else - { - - document()->clearSelection(); //Notice - application()->clearPasteboard(); - - vector::iterator i = cells.begin(); - for(;i != cells.end();++i) - { - c->moveAfter((*i)); - - //1. Copy cell to pasteboard. - application()->addToPasteboard(c->currentCell()); - - //2. Delete Cell. - c->removeCurrentCell(); - } - } - - } - catch(exception &e) - { - cerr << "DeleteCurrentCellsCommand(), Exception: " << e.what() << endl; - } - } - - //Det borde vara möjligt att titta på stylen för att avgöra om en - //cell är en grupp cell. Då borde det gå att kopiera in underceller - //också. - // - // Kontrollera på stylen hur cellerna ska kopieras. Speciellt ska - // gruppceller specialbehandlas så att deras subceller också - // kopieras. Just nu funkar det att kopiera enstaka celler. Men - // inte gruppceller. - void PasteCellsCommand::execute() - { - try - { - vector cells = application()->pasteboard(); - - //1. Get current position. - CellCursor *cursor = document()->getCursor(); - - //2. Insert new cells before this position. - if(!cells.empty()) - { - //Reverse iterator!!!!! - vector::reverse_iterator i = cells.rbegin(); - for(;i != cells.rend();++i) - { - cout << "PASTEBOARD: " << (*i)->style() << endl; - Factory *fac = document()->cellFactory(); - - QString style = (*i)->style(); - - //Create a new cell. - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(true); - cursor->currentCell()->child()->setFocus(false); - } - } - else - { - cursor->currentCell()->setReadOnly(true); - cursor->currentCell()->setFocus(false); - } - - cursor->addBefore(fac->createCell(style)); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(false); - cursor->currentCell()->child()->setFocus(true); - } - } - else - { - cursor->currentCell()->setReadOnly(false); - cursor->currentCell()->setFocus(true); - } - - //Copy its content. - //This is a problem! - if(style == "cellgroup") - { - //Copy content of cellgroup. - //add all subcells. - } - else if(style == "imagecell") - { - //This should be treated in some way. - } - else - { - cursor->currentCell()->setText((*i)->text()); - } - } - } - } - catch(exception &e) - { - cerr << " PasteCellsCommand(), Exception: " << e.what() << endl; - } - } - - /*! \class DeleteSelectedCellsCommand - * - * Deletes all selected cells. If no cell is selected the cell that - * is before the cursor is deleted. - * - * What happens when all cells in a cellgroup is empty? Should the - * cellgroup be deleted? Or what to do with it? - * - * Notice that the selection must be cleared. - * - * - * \bug When all cells within a cellgroup is deleted. The cellgroup - * should also be deleted then. What if all but one cell is deleted? - */ - void DeleteSelectedCellsCommand::execute() - { - try - { - vector cells = document()->getSelection(); - if(cells.empty()) - { - document()->getCursor()->deleteCurrentCell(); - } - else - { - document()->clearSelection(); //Notice - - vector::iterator i = cells.begin(); - for(;i != cells.end();++i) - { - (document()->getCursor())->moveAfter((*i)); - (document()->getCursor())->deleteCurrentCell(); - } - } - } - catch(exception &e) - { - cerr << "DeleteSelectedCellsCommand(), Exception: " << e.what() << endl; - } - } - - /*! \class ChangeStyleOnSelectedCellsCommand - * - * \brief Changes style on selected cells. - * - * This does not work on selected Cellgroups. This because I have - * not defined what will happen if I change style on a - * cellgroup. Probably all its children will get the same style. - * - *\todo implement setStyle for cellgroups. - */ - void ChangeStyleOnSelectedCellsCommand::execute() - { - try - { - //qDebug("entered ChangeStyleOnSelectedCellsCommand"); - vector cells = document()->getSelection(); - - if(cells.empty()) - { - //qDebug("No selection"); - document()->getCursor()->currentCell()->setStyle(style_); - } - else - { - //qDebug("For all cells"); - vector::iterator i = cells.begin(); - - for(;i != cells.end() ;++i) - { - //qDebug("setting style"); - (*i)->setStyle(style_);//This makes an segfault. Do not now why? - } - - } - //qDebug("Leaving"); - } - catch(exception &e) - { - cerr << "ChangeStyleOnSelectedCellsCommand(), Exception: " << e.what() << endl; - } - } - - void ChangeStyleOnCurrentCellCommand::execute() - { - try - { - document()->getCursor()->currentCell()->setStyle(style_); - } - catch(exception &e) - { - cerr << "ChangeStyleOnCurrentCellCommand(), Exception: " << e.what() << endl; - } - } - - - void MakeGroupCellCommand::execute() - { - try - { - Factory *fac = document()->cellFactory(); - CellCursor *cursor = document()->getCursor(); - - Cell *prev = cursor->currentCell(); - cursor->currentCell()->parentCell()->removeChild(prev); - - Cell *group = fac->createCell("cellgroup", cursor->parentCell()); - - group->addChild(prev); - cursor->addBefore(group); - cursor->moveToLastChild(group); - } - catch(exception &e) - { - cerr << "MakeGroupCellCommand(), Exception: " << e.what() << endl; - } - } -}; diff --git a/OMNotebook_QT3/OMNotebook/cellcommands.h b/OMNotebook_QT3/OMNotebook/cellcommands.h deleted file mode 100644 index df09771647b..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellcommands.h +++ /dev/null @@ -1,164 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _CELLCOMMANDS_H -#define _CELLCOMMANDS_H - -#include - -#include "command.h" -#include "factory.h" -#include "cellcursor.h" -#include "document.h" -#include "application.h" - -using namespace std; - -namespace IAEX -{ - class AddCellCommand : public Command - { - public: - AddCellCommand(){} - virtual ~AddCellCommand(){} - virtual QString commandName(){ return QString("AddCellCommand");} - void execute(); - }; - - class CreateNewCellCommand : public Command - { - public: - CreateNewCellCommand(const QString &style) : style_(style){} - virtual ~CreateNewCellCommand(){} - virtual QString commandName(){ return QString("CreateNewCellCommand");} - void execute(); - private: - QString style_; - }; - - //\todo rename to cut command instead.o - class DeleteCurrentCellCommand : public Command - { - public: - DeleteCurrentCellCommand(){} - virtual ~DeleteCurrentCellCommand(){} - void execute(); - virtual QString commandName(){ return QString("DeleteCurrentCellCommand");} - }; - - class PasteCellsCommand : public Command - { - public: - PasteCellsCommand(){} - virtual ~PasteCellsCommand(){} - void execute(); - QString commandName(){return QString("PasteCellsCommand");} - private: - }; - - class CopySelectedCellsCommand : public Command - { - public: - CopySelectedCellsCommand(){} - virtual ~CopySelectedCellsCommand(){} - void execute(); - QString commandName(){return QString("CopySelectedCellsCommand");} - private: - }; - - - - class DeleteSelectedCellsCommand : public Command - { - public: - DeleteSelectedCellsCommand(){} - virtual ~DeleteSelectedCellsCommand(){} - void execute(); - virtual QString commandName(){ return QString("DeleteSelectedCellsCommand");} - }; - - - class ChangeStyleOnSelectedCellsCommand : public Command - { - public: - ChangeStyleOnSelectedCellsCommand(const QString &style):style_(style){} - virtual ~ChangeStyleOnSelectedCellsCommand(){} - void execute(); - virtual QString commandName(){ return QString("ChangeStyleOnSelectedCellsCommand");} - private: - QString style_; - }; - - class ChangeStyleOnCurrentCellCommand : public Command - { - public: - ChangeStyleOnCurrentCellCommand(const QString &style):style_(style){} - virtual ~ChangeStyleOnCurrentCellCommand(){} - void execute(); - virtual QString commandName(){ return QString("ChangeStyleOnCurrentCellCommand");} - private: - QString style_; - }; - - /*! Makes a groupcell of current cell. Just move the cell down. - * - * \todo Create a command for converting selected cells into a - * groupcell. - * - * \todo Create commands for moving a cell. - * - * \todo Implement DRAG and DROP with cells. - */ - class MakeGroupCellCommand : public Command - { - public: - MakeGroupCellCommand(){} - virtual ~MakeGroupCellCommand(){} - void execute(); - }; -}; -#endif diff --git a/OMNotebook_QT3/OMNotebook/cellcursor.cpp b/OMNotebook_QT3/OMNotebook/cellcursor.cpp deleted file mode 100644 index 4e385521e99..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellcursor.cpp +++ /dev/null @@ -1,455 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include - -#include -#include - -#include "cellcursor.h" -#include "visitor.h" - -namespace IAEX -{ - - /*! \class CellCursor - * \brief Implements a special type of cell that - * is used as a cursor within the document. - * - * The cellcursor class acts like a ordinary cell. It extends a - * cell with the functionality to move around in the celltree. See - * moveUp and moveDown members. - * - * This class should be inherited with a lot of precaution. It has - * a lot of responsibility and dependency within the - * application. So change it with caution. - * - * To change the cursors look reimplement the CursorWidget to have - * the desired look. - * - */ - CellCursor::CellCursor(QWidget *parent, const char *name) - : Cell(parent, name) - { - setHeight(3); - QWidget *content = new CursorWidget(this); - - setMainWidget(content); - hideTreeView(true); - setBackgroundMode(Qt::PaletteBase); - setBackgroundColor(QColor(100,100,100)); - } - - CellCursor::~CellCursor() - { - - } - - /*! - * \bug This does not work correctly. - */ - void CellCursor::accept(Visitor &v) - { - //Does not have any childs! - v.visitCellCursorNodeBefore(this); - v.visitCellCursorNodeAfter(this); - - if(hasNext()) - next()->accept(v); - } - - - void CellCursor::addBefore(Cell *newCell) - { - if(parentCell()->child() == this) - { //first in line. - newCell->setParentCell(parentCell()); - newCell->setNext(this); - newCell->setPrevious(0); - parentCell()->setChild(newCell); - setPrevious(newCell); - } - else - { - newCell->setParentCell(parentCell()); - newCell->setPrevious(previous()); - previous()->setNext(newCell); - setPrevious(newCell); - newCell->setNext(this); - } - - parentCell()->addCellWidget(newCell); - //emit changedPosition(); - } - - /*! \brief Replaces current cell with a new cell. - * - * \todo create a cellcopy operation. - * \todo test! - * - */ - void CellCursor::replaceCurrentWith(Cell *newCell) - { -// newCell->setParent(currentCell()->parentCell()); -// newCell->setChild(currentCell()->child()); -// newCell->setLast(currentCell()->last()); -// newCell->setPrevious(currentCell()->previous()); -// newCell->setNext(currentCell()->next()); - qDebug("replaceWithCurrent"); - - newCell->setText(currentCell()->text()); - - //Replace cell. - deleteCurrentCell(); - addBefore(newCell); - qDebug("End replaceWithCurrent"); - } - - void CellCursor::removeFromCurrentPosition() - { - //remove all widgets from parents layout. - Cell *par = parentCell(); - par->removeCellWidgets(); - - if(parentCell()->child() == this) - parentCell()->setChild(next()); - - if(parentCell()->last() == this) - parentCell()->setLast(previous()); - - if(hasNext()) - next()->setPrevious(previous()); - - if(hasPrevious()) - previous()->setNext(next()); - - //Insert all widgets again. - par->addCellWidgets(); - } - - /*! - * Removes a cell and all its subcells from the tree. - * - * This should work for all cells. But it will leave an empty - * cellgroup if last cell is deleted in cellgroup. - * - * This does not delete the cell, it just removes the cell from the - * celltree. - */ - void CellCursor::removeCurrentCell() - { - if(hasPrevious()) //If cursor has previous - { - Cell *current = previous(); - - removeFromCurrentPosition(); - - if(current->hasPrevious()) - current->previous()->setNext(this); - else - parentCell()->setChild(this); - - setPrevious(current->previous()); - - current->setParentCell(0); - current->setPrevious(0); - current->setNext(0); - current->setChild(0); - current->setLast(0); - - current->hide(); - parentCell()->addCellWidgets(); - } - } - - /*! \bug Segfault in cellgroups. Probably a parent, child or last. - * \bug Deletion of last cell in cellgroup should be taken care of. - */ - void CellCursor::deleteCurrentCell() - { - if(hasPrevious()) //If cursor has previous - { - //removeCurrentCell(); - - //OLD CODE - //Remove currentCell. - Cell *current = previous(); //Save a pointer to the cell being deleted. - - removeCurrentCell(); - // removeFromCurrentPosition(); - -// if(current->hasPrevious()) -// current->previous()->setNext(this); -// else -// parentCell()->setChild(this); - -// setPrevious(current->previous()); - -// current->setParentCell(0); -// current->setPrevious(0); -// current->setNext(0); -// current->setChild(0); -// current->setLast(0); - - //Segfault on delete. - delete current; - - //parentCell()->addCellWidgets(); - } - //emit changedPosition(); - } - - /*! Returns current cell. - */ - Cell *CellCursor::currentCell() - { - if(!hasPrevious()) //First in group. - return parentCell(); //Will always work. - else - return previous(); - } - - void CellCursor::moveUp() - { - - if(!hasPrevious()) - { - if(parentCell()->hasParentCell()) - moveBefore(parentCell()); - else - { - //Do nothing. Can not move before root. - } - } - else //previous() exists. - { - if(previous()->hasChilds()) - { - if(!previous()->isClosed()) - moveToLastChild(previous()); - else - moveBefore(previous()); - } - else - { - moveBefore(previous()); - } - } - emit positionChanged(x(), y(), 5,5); - //emit changedPosition(); - } - - /*! - * \bug Segmentationfault when last cell. - * - * \todo It is better that Commands take care of how to change - * state of cells. - */ - void CellCursor::moveDown() - { - if(!hasNext()) - { - if(parentCell()->hasParentCell()) - moveAfter(parentCell()); - else - { - //Do nothing. Can not move before root. - } - } - else //Has next. - { - if(next()->hasChilds()) - { - if(!next()->isClosed()) - moveToFirstChild(next()); - else - moveAfter(next()); - } - else - { - moveAfter(next()); - } - } - //emit changedPosition(); - emit positionChanged(x(), y(), 5,5); - } - - /*! Insert this cell as first child of parent. - * - * \bug This does not seem to work correctly. - */ - void CellCursor::moveToFirstChild(Cell *parent) - { - if(parent->hasChilds()) - { - parent->removeCellWidgets(); - moveBefore(parent->child()); - parent->addCellWidgets(); - } - else //No child. - { - //Become first child. - parent->removeCellWidgets(); - parent->setChild(this); - parent->setLast(this); - parent->addCellWidgets(); - } - - //emit changedPosition(); - } - - /*! - * \bug This does not seem to work correctly. - */ - void CellCursor::moveToLastChild(Cell *parent) - { - if(parent->hasChilds()) - { - parent->removeCellWidgets(); - moveAfter(parent->last()); - parent->addCellWidgets(); - } - else - { - throw runtime_error("LAST CHILD: Tried to move to a child that did not exist."); - } - - //emit changedPosition(); - } - - /*! - * \bug Fel vid flytt så cursor hamnar som sista barn. - */ - void CellCursor::moveAfter(Cell *current) - { - removeFromCurrentPosition(); - - //if(!current->hasParentCell()) - // throw runtime_error("Could not insert after root"); - - if(current->hasParentCell()) - { - current->parentCell()->removeCellWidgets(); - - if(current->hasNext() == 0) - { - current->parentCell()->setLast(this); - } - else - current->next()->setPrevious(this); - - setParentCell(current->parentCell()); - setNext(current->next()); - current->setNext(this); - setPrevious(current); - - //insert widgets to parents layout. - parentCell()->addCellWidgets(); - } - else - { - //If current does not have a parent. That is current is not - //in the celltree at all or that current is the root of the - //tree. It should not be possible to move after the root of - //the tree. Do nothing! - } - // emit changedPosition(); -// emit positionChanged(x(), y(), 5,5); - } - - - /* - * \bug fel om vi flyttas till att vara första barn.. - */ - void CellCursor::moveBefore(Cell *current) - { - removeFromCurrentPosition(); - - //Remove all widgets from currents parent. - current->parentCell()->removeCellWidgets(); - - //Move to new position. - if(current->hasParentCell()) - { - setParentCell(current->parentCell()); - if(!current->hasPrevious()) - current->parentCell()->setChild(this); - else - current->previous()->setNext(this); - - } - else - throw runtime_error("Could not insert before root"); - - setPrevious(current->previous()); - current->setPrevious(this); - setNext(current); - - //Insert widgets to parents layout. - parentCell()->addCellWidgets(); - //emit changedPosition(); -// emit positionChanged(x(), y(), 5, 5); - } - - - /*! \class CursorWidget - * - * \brief CursorWidget describes how the cursor should be painted. - */ - void CursorWidget::paintEvent(QPaintEvent *event) - { - QPainter painter(this); - - this->setPaletteBackgroundColor(QColor(0,0,0)); - painter.setPen(QPen(black,1, SolidLine)); - - QWidget::paintEvent(event); - - painter.drawRect(0, 0, width(), height()); - } -} diff --git a/OMNotebook_QT3/OMNotebook/cellcursor.h b/OMNotebook_QT3/OMNotebook/cellcursor.h deleted file mode 100644 index 72b80769a30..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellcursor.h +++ /dev/null @@ -1,113 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file cellcursor.h - * \author Ingemar Axelsson - * \brief Implementation of a marker made as an Cell. - */ - -#ifndef _CELLCURSOR_H -#define _CELLCURSOR_H - -#include "cell.h" -//#include "cursor.h" - -namespace IAEX -{ - class CellCursor : public Cell - { - Q_OBJECT - public: - CellCursor(QWidget *parent=0, const char *name=0); - virtual ~CellCursor(); - - //Insertion - void addBefore(Cell *newCell); - void deleteCurrentCell(); - void removeCurrentCell(); - void replaceCurrentWith(Cell *newCell); - - Cell *currentCell(); - - //Movment - void moveUp(); - void moveDown(); - - void moveToFirstChild(Cell *parent); - void moveToLastChild(Cell *parent); - void moveBefore(Cell *current); - void moveAfter(Cell *current); - - virtual void accept(Visitor &v); - - virtual QString text(){return QString::null;} - - public slots: - virtual void setFocus(const bool){} - - signals: - void changedPosition(); - void positionChanged(int x, int y, int xm, int ym); - - private: - void removeFromCurrentPosition(); - - }; - - - class CursorWidget : public QWidget - { - public: - CursorWidget(QWidget *parent=0, const char *name=0) - :QWidget(parent, name){} - virtual ~CursorWidget(){} - - protected: - void paintEvent(QPaintEvent *event); - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/celldocument.cpp b/OMNotebook_QT3/OMNotebook/celldocument.cpp deleted file mode 100644 index 88acb05ae08..00000000000 --- a/OMNotebook_QT3/OMNotebook/celldocument.cpp +++ /dev/null @@ -1,555 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file celldocument.cpp - * \author Ingemar Axelsson - * \brief Implementation of CellDocument class. - */ - -//STD Headers -#include -#include -#include - -//QT Headers -#include - -//IAEX Headers -#include "celldocument.h" -#include "cellfactory.h" -#include "serializingvisitor.h" -#include "nbparser.h" -#include "parserfactory.h" -#include "notebookcommands.h" -#include "cursorcommands.h" -#include "cellcommands.h" - - -namespace IAEX{ - - /*! - * \class CellDocument - * \brief Main widget for the cell workspace. - * - * This class represents the mainwidget for the application. It has - * functionality to open files and create cells from them. It also - * knows which cells that are selected. - * - * CellDocument acts like a mediator between the application and all - * cells. It knows how to do stuff with cells. - * - * The CellDocument does not have any menu. So to use menus for - * doing stuff with the application look at the slots that exists in - * this class. - * - * For more information about how to use this widget in an application - * look at the documentation for every signal and slot in this class. - * - * - * \todo Implement an interface for applications. Also sort the - * includes in a better way. So developers does not have to include a - * lot of strange headerfiles. Just one headerfile should be enough. - * - * \todo Fix the windowsize so it is more appropriate. Also fix so that - * the cellgroup is redrawn when the application is first started, not - * only when it is resized. - * - * \todo Implement functionality for dragging cells around. - * - * \todo Make it possible to change celltype. From textcell to - * inputcell for example. Inputcell should only be a decorator of a - * textcell. - * - * \bug When opening a second file, some connections is missing. - * - * \bug Closing a document does not work correctly. - * - */ - - /*! - * \brief Constructor, initialize a CellGroup as maincontent. - * - * \todo Remove the dependency of QFrame from document. - */ - CellDocument::CellDocument(Application *a, const QString filename) - : open_(false), saved_(false), app_(a), filename_(filename) - { - //New code. - mainFrame_ = new QFrame(); - mainFrame_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding)); - mainLayout_ = new QGridLayout(mainFrame_, 1, 1); - - //Old code. -// mainLayout_ = new QGridLayout(this, 1, 1); - -// setSizePolicy(QSizePolicy(QSizePolicy::Expanding, -// QSizePolicy::Expanding)); - - - factory_ = new CellFactory(this); - - //Initialize workspace. - setWorkspace(factory_->createCell("cellgroup")); - - if(filename_ != 0) - open(filename_); - - - open_ = true; // 2005-09-26 AF, not sure if this should be here - } - - CellDocument::~CellDocument() - { - //destroy(FALSE, TRUE); //Delete all subwindows and myself. - - delete vp_; - delete mainLayout_; - delete workspace_; - //delete mainFrame_; - delete factory_; - - } - - void CellDocument::mouseClickedOnCell(Cell *clickedCell) - { - //Deselect all selection - clearSelection(); - - //Remove focus from old cell. - if(getCursor()->currentCell()->isClosed()) - { - getCursor()->currentCell()->child()->setReadOnly(true); - getCursor()->currentCell()->child()->setFocus(false); - } - else - { - getCursor()->currentCell()->setReadOnly(true); - } - - //Add focus to the cell clicked on. - if(clickedCell->parentCell()->isClosed()) - { - getCursor()->moveAfter(clickedCell->parentCell()); - } - else - { - getCursor()->moveAfter(clickedCell); //Results in bus error why? - } - - clickedCell->setReadOnly(false); - clickedCell->setFocus(true); - - emit cursorChanged(); - //qDebug("Clicked on cell"); - } - - /*! What to do when a link is clicked? - */ - void CellDocument::linkClicked(QUrl *link) - { - cout << "PATH: " << link->path() << "ENDPATH" << endl; - //executeCommand(new OpenFileCommand(link->path())); - - // 2005-10-25 AF, temp fix so links works correctly, links are - // relative the location of the current document - executeCommand(new OpenFileCommand( QFileInfo(filename_).dirPath() + - "/" + link->path() )); - } - - /*! - * Problem with the eventfilter. Should be listening to the - mainwidget of the cell also. Not only to the workspace. - */ - bool CellDocument::eventFilter(QObject *o, QEvent *e) - { - if(o == workspace_) - { - if(e->type() == QEvent::MouseButtonPress) - { - qDebug("Clicked"); - } - } - - return QObject::eventFilter(o,e); - } - - CellCursor *CellDocument::getCursor() - { - return current_; - } - - /*! - * \todo Save all commands. Also implement undo. Where should the - * undo be set? Global in application or local in document? Or - * should different commands be stored in different places. - * - * \todo implement a commandCenter interface that takes care of - * this. A problem with this conversion is the commands dependency - * for the document reference. - */ - void CellDocument::executeCommand(Command *cmd) - { - cmd->setDocument(this); - application()->commandCenter()->executeCommand(cmd); - } - - void CellDocument::open(const QString &filename) - { - filename_ = filename; - ParserFactory *parserFactory = new CellParserFactory(); - NBParser *parser = parserFactory->createParser(filename, factory_); - setWorkspace(parser->parse()); - - //Delete the parser after it is used. - delete parser; - - // 2005-09-22 AF: Added this... - open_ = true; - saved_ = false; - } - - /*! - * \todo Check if factory is instantiated. - */ - Factory *CellDocument::cellFactory() - { - return factory_; - } - - QString CellDocument::getFilename() - { - return filename_; - } - - void CellDocument::setFilename( QString filename ) - { - filename_ = filename; - } - - void CellDocument::setSaved( bool saved ) - { - saved_ = saved; - } - - /*! \todo Implement hasChanged correctly. - * - * Does it belong here? - */ - bool CellDocument::hasChanged() const - { - return true; - } - - bool CellDocument::isOpen() const - { - return open_; - } - - bool CellDocument::isSaved() const - { - return saved_; - } - - /*! Hmmm check this later. - */ - void CellDocument::close() - { - //workspace_->close(true); //Close widget - //mainLayout_->deleteLater(); - workspace_->close(); - - setWorkspace(factory_->createCell("cellgroup")); - workspace_->hide(); - open_ = false; - } - - /*! \brief Toggles the main workspace treeview. - * - * Shows or hides the outermost treeview. This is just used for - * testing. Should not be used by anyone else. - * - * \deprecated - */ - void CellDocument::toggleMainTreeView() - { - workspace_->hideTreeView(!workspace_->isTreeViewVisible()); - } - - - /*! \brief Attach a CellGroup to be the main workspace for cells. - * - * Connects a cellgroup to the scrollview. Does some reparent stuff - * also so all subcells will be drawn. This must be done every time - * this member is changed. - * - * \param[in] newWorkspace A pointer to the CellGroup that will be seen as - * the main cellworkspace in the application. - * - * \todo The old workspace must be deleted! - * - */ - void CellDocument::setWorkspace(Cell *newWorkspace) - { - //New Code - vp_ = new QScrollView(mainFrame_); - - vp_->enableClipper(TRUE); - vp_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding)); - vp_->setResizePolicy(QScrollView::AutoOneFit); - mainLayout_->addWidget(vp_, 1, 1); - - workspace_ = newWorkspace; - workspace_->reparent(vp_->viewport(), QPoint(0,0), true); - - vp_->addChild(workspace_); - - //?? Should this be done by the factory? - current_ = dynamic_cast(factory_->createCell("cursor", workspace_)); - - //Make the cursor visible at all time. - QObject::connect(current_, SIGNAL(positionChanged(int, int, int, int)), - vp_, SLOT(ensureVisible(int, int, int, int))); - - workspace_->addChild(current_); - - //To hide the outhermost treeview. - workspace_->hideTreeView(true); - workspace_->show(); - } - - //Ever used? - void CellDocument::cursorChangedPosition() - { -// emit cursorChanged(); - } - - /*! - * \todo Check if ever used. It does seem to be deprecated. - */ - void CellDocument::setEditable(bool editable) - { - if(current_->hasPrevious()) - { - current_->previous()->setReadOnly(!editable); - } - } - - /*! \brief Runs a visitor on the cellstructure. - * - * Traverses the tree in preorder. For more usage information \see visitor. - * - * \param v Visitor to run on the treestructure. - */ - void CellDocument::runVisitor(Visitor &v) - { - //For all workspace_ child! Not ws itself. - workspace_->accept(v); - } - - ////SELECTION HANDLING///////////////////////// - - void CellDocument::clearSelection() - { - vector::iterator i = selectedCells_.begin(); - for(;i!= selectedCells_.end();++i) - (*i)->setSelected(false); - selectedCells_.clear(); - } - - void CellDocument::selectedACell(Cell *selected, Qt::ButtonState state) - { - vector::iterator found = std::find(selectedCells_.begin(), - selectedCells_.end(), - selected); - if(found != selectedCells_.end()) - { - //State - 1 is QT stuff. - if(state-1 == Qt::ControlButton) - { - (*found)->setSelected(false); - } - else - { - clearSelection(); - } - } - else - { //if not selected - if(state - 1 == Qt::ControlButton) - { //add to selection. - selectedCells_.push_back(selected); - } - else - { - clearSelection(); - - //Add new cell to selected. - selectedCells_.push_back(selected); - } - } - } - - vector CellDocument::getSelection() - { - return selectedCells_; - } - -/////OBSERVER IMPLEMENTATION////////////// - - void CellDocument::attach(DocumentView *d) - { - observers_.push_back(d); - } - - void CellDocument::detach(DocumentView *d) - { - observers_t::iterator found = find(observers_.begin(), - observers_.end(), - d); - if(found != observers_.end()) - observers_.erase(found); - } - - void CellDocument::notify() - { - observers_t::iterator i = observers_.begin(); - for(;i != observers_.end(); ++i) - { - (*i)->update(); - } - } - -///////CURSOR METHODS/////////////////////////////// - - QFrame *CellDocument::getState() - { - return mainFrame_; - } - - void CellDocument::cursorStepUp() - { - executeCommand(new CursorMoveUpCommand()); - emit cursorChanged(); - } - - void CellDocument::cursorStepDown() - { - executeCommand(new CursorMoveDownCommand()); - emit cursorChanged(); - } - - void CellDocument::cursorAddCell() - { - // 2005-10-03 AF, added try-catch - try - { - executeCommand(new AddCellCommand()); - open_ = true; - emit cursorChanged(); - } - catch( exception &e ) - { - throw e; - } - } - - void CellDocument::cursorDeleteCell() - { - executeCommand(new DeleteSelectedCellsCommand()); - qDebug("cursorDeleteCell"); - - //emit cursorChanged(); //This causes an untracable segfault. - - qDebug("Finished"); - } - - /*! Notice that it does not work on selected cells. - */ - void CellDocument::cursorCutCell() - { - executeCommand(new DeleteCurrentCellCommand()); - } - - void CellDocument::cursorCopyCell() - { - executeCommand(new CopySelectedCellsCommand()); - } - - void CellDocument::cursorPasteCell() - { - executeCommand(new PasteCellsCommand()); - } - - void CellDocument::cursorChangeStyle(const QString &style) - { - //Invoke style changes to all selected cells. - executeCommand(new ChangeStyleOnSelectedCellsCommand(style)); - //executeCommand(new ChangeStyleOnCurrentCellCommand(style)); - } - - void CellDocument::cursorMoveAfter(Cell *aCell, const bool open) - { - //if(!open) - executeCommand(new CursorMoveAfterCommand(aCell)); - // else -// { -// if(aCell->hasChilds()) -// executeCommand(new CursorMoveAfterCommand(aCell->child())); -// else -// executeCommand(new CursorMoveAfterCommand(aCell)); -// } - - emit cursorChanged(); - } - - void CellDocument::showHTML(bool b) - { - getCursor()->currentCell()->viewExpression(b); - } -}; diff --git a/OMNotebook_QT3/OMNotebook/celldocument.h b/OMNotebook_QT3/OMNotebook/celldocument.h deleted file mode 100644 index e2355a7056c..00000000000 --- a/OMNotebook_QT3/OMNotebook/celldocument.h +++ /dev/null @@ -1,175 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file celldocument.h - * \author Ingemar Axelsson - * \brief Describes the mainwidget used in other applications. - */ - -#ifndef CELLDOCUMENT_H -#define CELLDOCUMENT_H - -//STD Headers -#include - -//QT Headers -#include -#include -#include -#include -#include - -//IAEX Headers -#include "application.h" -#include "cell.h" -#include "visitor.h" -#include "factory.h" -#include "document.h" -#include "command.h" -#include "documentview.h" -//#include "cursor.h" -#include "cellcursor.h" - - -namespace IAEX{ - - class CellDocument : public Document//, public QObject - { - Q_OBJECT - public: - //typedef unsigned int cellpos; - typedef vector observers_t; - public: - CellDocument(Application *a, const QString filename); - virtual ~CellDocument(); - - void setApplication(Application *app){app_ = app;} - Application *application(){ return app_;} - - //Document implementations - virtual void open(const QString &filename); - virtual void close(); - virtual QString getFilename(); - virtual void setFilename( QString filename ); //AF - virtual void setSaved( bool saved ); //AF - - virtual void attach(DocumentView *d); - virtual void detach(DocumentView *d); - virtual void notify(); - - //Cursor methods - virtual void cursorStepUp(); - virtual void cursorStepDown(); - virtual void cursorAddCell(); - virtual void cursorDeleteCell(); - virtual void cursorCutCell(); - virtual void cursorCopyCell(); - virtual void cursorPasteCell(); - virtual void cursorChangeStyle(const QString &style); - - //State operations - virtual bool hasChanged() const; - bool isOpen() const; - bool isSaved() const; - - //Cursor operations - CellCursor *getCursor(); - Factory *cellFactory(); - vector getSelection(); - - //Command - void executeCommand(Command *cmd); - - //Traversals. - void runVisitor(Visitor &v); - - //observer - QFrame *getState(); - - public slots: - void toggleMainTreeView(); - void setEditable(bool editable); - void cursorChangedPosition(); - void selectedACell(Cell *selected, Qt::ButtonState); - void clearSelection(); - void mouseClickedOnCell(Cell *clickedCell); - void linkClicked(QUrl *url); - virtual void cursorMoveAfter(Cell *aCell, const bool open); - void showHTML(bool b); - signals: - /*! \brief Signals when the celldocument width has changed. - */ - void widthChanged(const int); - void cursorChanged(); - void viewExpression(const bool); - - protected: - void setWorkspace(Cell *newWorkspace); - bool eventFilter(QObject *o, QEvent *e); - - private: - bool open_; - bool saved_; - - Application *app_; - QString filename_; - - Cell *workspace_; //This should alwas be a cellgroup. - QFrame *mainFrame_; - QScrollView *vp_; - QGridLayout *mainLayout_; - - CellCursor *current_; - Factory *factory_; - - vector selectedCells_; - - observers_t observers_; - }; -} - -#endif diff --git a/OMNotebook_QT3/OMNotebook/celldocumentview.h b/OMNotebook_QT3/OMNotebook/celldocumentview.h deleted file mode 100644 index ef9fb9ab055..00000000000 --- a/OMNotebook_QT3/OMNotebook/celldocumentview.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ -s -#ifndef _CELLDOCUMENTVIEW_H -#define _CELLDOCUMENTVIEW_H - -#include "documentview.h" - -namespace IAEX -{ - - /*!\class CellDocumentView - * \brief Describes the document window. - * - * Describes how a document should look like. The application uses - * the Single Document Interface. That is all documents has a - * window that looks like the main window. - * - * \deprecated - */ - class CellDocumentView : public QMainWindow, public DocumentView - { - public: - CellDocumentView(Document *subject) : subject_(subject) - { - //Connect view to document. - subject_->attach(this); - } - - virtual ~CellDocumentView(){} - - void update() - { - if(centralWidget()) - { - //remove currentwidget. - } - - //Update with new widget. - setCentralWidget(subject_->getState()); - } - - private: - Document *subject_; - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/cellfactory.cpp b/OMNotebook_QT3/OMNotebook/cellfactory.cpp deleted file mode 100644 index dd6539421ee..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellfactory.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include - -#include "cellfactory.h" -#include "textcell.h" -#include "inputcell.h" -#include "imagecell.h" -#include "cellgroup.h" -#include "cellcursor.h" -#include "stylesheet.h" - -//MODEQ Headersm -//#ifdef MODEQ -#include "omcinteractiveenvironment.h" -#include "modelicahighlighter.h" -//#else -//#include "smlinteractiveenvironment.h" -//#include "smlhighlighter.h" -//#endif - -namespace IAEX -{ - - CellFactory::CellFactory(Document *doc) : doc_(doc){} - - CellFactory::~CellFactory() - {} - - /*! - * - * \todo Remove document dependency from Cellstructure. It is only - * used to point to a commandcenter (in this case the current - * document) and for the click event to get the current - * cursor. This can be done in some better way. Maybe by sending a - * signal to the document instead. - * - * \todo Refactor the creation of image cells. Where should the - * filename come from? As it is now it is hardcoded. A possible - * solution is to add a new createCell method that adds a parameter - * for the filename. Check for the correct style. If it is not a - * correct style that uses the filename parameter then send the - * style to the original createCell method. There is a lot of - * problems with this method. - * - */ - Cell *CellFactory::createCell(const QString &style, Cell *parent) - { - if(style == "input" || style == "Input" || style == "ModelicaInput") - { - InputCell *text = new InputCell(parent); - text->setStyle("Input"); - - text->setDelegate(new OmcInteractiveEnvironment()); - - // 2005-10-03 AF, added this try-catch check - try - { - text->setSyntaxHighlighter(new ModelicaHighlighter()); - } - catch( exception &e ) - { - QString msg = e.what(); - msg += "\nNo syntax highlighting will be avalible."; - QMessageBox::warning( 0, "Warning", msg, "OK" ); - } - - QObject::connect(text, SIGNAL(cellselected(Cell *,Qt::ButtonState)), - doc_, SLOT(selectedACell(Cell*,Qt::ButtonState))); - QObject::connect(text, SIGNAL(clicked(Cell *)), - doc_, SLOT(mouseClickedOnCell(Cell*))); - //QObject::connect(text, SIGNAL(openLink(QUrl*)), - // doc_, SLOT(linkClicked(QUrl*))); - - return text; - } - else if( style == "cursor") - { - return new CellCursor(parent); - } - else if(style == "cellgroup") - { - Cell *text = new CellGroup(parent); - QObject::connect(text, SIGNAL(cellOpened(Cell *, const bool)), - doc_, SLOT(cursorMoveAfter(Cell*, const bool))); - QObject::connect(text, SIGNAL(cellselected(Cell *, Qt::ButtonState)), - doc_, SLOT(selectedACell(Cell*, Qt::ButtonState))); - QObject::connect(text, SIGNAL(clicked(Cell *)), - doc_, SLOT(mouseClickedOnCell(Cell*))); - QObject::connect(text, SIGNAL(openLink(QUrl*)), - doc_, SLOT(linkClicked(QUrl*))); - return text; - } - else //All other styles will be implemented with a TextCell. - { - TextCell *text = new TextCell(parent); - QObject::connect(text, SIGNAL(cellselected(Cell *, Qt::ButtonState)), - doc_, SLOT(selectedACell(Cell*, Qt::ButtonState))); - QObject::connect(text, SIGNAL(clicked(Cell *)), - doc_, SLOT(mouseClickedOnCell(Cell*))); - QObject::connect(text, SIGNAL(openLink(QUrl*)), - doc_, SLOT(linkClicked(QUrl*))); - // QObject::connect(doc_, SIGNAL(viewExpression(const bool)), - // text, SLOT(viewExpression(const bool))); - - QString style_ = style; - - if(style_ == QString::null) - style_ = QString("Text"); - - //Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); - //stylesheet->getStyle(text, style_); - text->setStyle(style_); - - return text; - } - } - - Cell *CellFactory::createCell(const QString &filename, - const QString &style, Cell *parent) - { - if( style == "Image") - { - return new ImageCell(filename, parent); - } - else - return createCell(style, parent); - } -} diff --git a/OMNotebook_QT3/OMNotebook/cellfactory.h b/OMNotebook_QT3/OMNotebook/cellfactory.h deleted file mode 100644 index 0eade3626ed..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellfactory.h +++ /dev/null @@ -1,79 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _CELLFACTORY_H -#define _CELLFACTORY_H - -#include - -#include "factory.h" -#include "document.h" -#include "cell.h" -#include "imagecell.h" -#include "inputcell.h" -#include "textcell.h" -#include "cellgroup.h" - -namespace IAEX -{ - /*! \breif Interface for all cellfactories. - */ - class CellFactory : public Factory - { - public: - CellFactory(Document *doc); - virtual ~CellFactory(); - - virtual Cell *createCell(const QString &style, Cell *parent=0); - virtual Cell *createCell(const QString &filename, - const QString &style, Cell *parent=0); -// virtual Cell *copyCell(const Cell *c); - private: - Document *doc_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/cellgrammar.cpp b/OMNotebook_QT3/OMNotebook/cellgrammar.cpp deleted file mode 100644 index 8010bc84474..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellgrammar.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -//#include -#include "AntlrNotebookLexer.hpp" -#include "AntlrNotebookParser.hpp" -#include "AntlrNotebookTreeParser.hpp" -#include -#include -#include - - - -using namespace antlr; - -int main(int argc, char **argv) -{ - char *filename = 0; - - if(argc == 2) - { - filename = argv[argc-1]; - } - else - { - filename = "test.nb"; - } - - std::ifstream mynb(filename); - - if(!mynb) - { - std::cerr << "ERROR: Could not open file: " << filename; - return 1; - } - - try{ - ASTFactory myFactory; - NotebookLexer lexer(mynb); - NotebookParser parser(lexer); - - parser.initializeASTFactory(myFactory); - parser.setASTFactory(&myFactory); - - parser.document(); - - antlr::RefAST t = parser.getAST(); - - //std::cout << t->toStringList() << std::endl; - - NotebookTreeParser *walker = new NotebookTreeParser(); - - walker->document(t); - - } - catch(std::exception &e) - { - std::cerr << "exception: " << e.what() << std::endl; - } - - mynb.close(); - - return 0; -} diff --git a/OMNotebook_QT3/OMNotebook/cellgroup.cpp b/OMNotebook_QT3/OMNotebook/cellgroup.cpp deleted file mode 100644 index 1611df157aa..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellgroup.cpp +++ /dev/null @@ -1,343 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -//STD Headers -#include -#include -#include - -//IAEX Headers -#include "cellgroup.h" - - -namespace IAEX{ - - /*! \class CellGroup - * - * \brief CellGroup implements the functionality to - * be a Cell and contain a lot of subcells. - * - * - * \todo Reimplement as a composite instead. That is much much - * cleaner. Also look at CellWorkspace and rename CellContainer to - * CellDocument. CellWorkspace should dissappear. - * - * \todo Analyse class and find out what is different from the - * Cell class. Is it possible that cell and cellgroup should be - * integrated as one class? - * It should be easy to convert from a cell to a cellgroup. - */ - CellGroup::CellGroup(QWidget *parent, const char *name) - : Cell(parent, name), - closed_(false), - newIndex_(0) - { - main_ = new QWidget(this); - layout_ = new QGridLayout(main_, 1, 1); - setMainWidget(main_); - - mainWidget()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - } - - CellGroup::~CellGroup() - { - } - - void CellGroup::adjustHeight() - { - setHeight(height()); - } - - /*! \brief calculates the height of the cellgroup. - * - * Calculates the height of the cellgroup. The calculated height - * depends on the state of the group. Is the group closed then the - * height is just the first cell otherwise the height is a sum of - * the height of all cells. - * - * \returns height of cellgroup. - * - * \bug HeightVisitor does not return correct height value. I do - * not know why, so I implemented another way to traverse subcells - * and asking for heights. - */ - int CellGroup::height() - { - int height = 0; - - if(closed_) //Height of the first cell. - height = child()->height(); - else - { - Cell *current = child(); - int h = 0; - while(current != 0) - { - h += current->height(); - current = current->next(); - } - - height = h; - } - - return height; - } - - /*! \todo Should this be moved to treeview? How does cell take care - * of this event? - */ - void CellGroup::mouseDoubleClickEvent(QMouseEvent *event) - { - if(treeView()->hasMouse()) - { - closed_ = !closed_; - setClosed(closed_); - setSelected(false); - } - else - { - //Do nothing. - } - } - - /*! \brief This function hides/shows the content of a groupcell. - * - * This member hides/shows the content of a cellgroup. The height of - * the cellgroup is calculated depending on wich case it is. - * - * \todo Add some signals when this happens. It can be possible that - * someone will do some fun stuff when a cell is closing. - * - * \bug This function could create a segmentation fault in some - * special cases. Try to find them. - * - * \todo reimplement with removing and adding to the layout instead. - * - * \param closed tells if the cells should be visible or hidden. - */ - void CellGroup::setClosed(const bool closed) - { - if(hasChilds()) - child()->hideTreeView(closed); - - treeView()->setClosed(closed); - setHeight(height()); //Sends a signal - - closed_ = closed; - - emit cellOpened(this, closed_); - } - - bool CellGroup::isClosed() const - { - return closed_; - } - - void CellGroup::setFocus(const bool focus) - { - if(hasChilds()) - child()->setFocus(focus); - } - - /*! \brief Decides if a visitor is allowed to visit the object. - * - * Traverses the structure in preorder. - * - * \todo Could the traversing order be decided in the visitor instead - * without to much dirt added to the code class? This is definitly not - * important. - * - * \todo Implement an Iterator for the cell structure. This could be - * nice. - * - */ - void CellGroup::accept(Visitor &v) - { - v.visitCellGroupNodeBefore(this); - - if(hasChilds()) - child()->accept(v); - - v.visitCellGroupNodeAfter(this); - - if(hasNext()) - next()->accept(v); - } - - - /*! - * \todo Try to get rid of the dependency of the doc() member. One - way should be to use the cursor when opening a document. Use the - cursors add functionality. Then this could be removed. The - dependency should only be in the cursor then. - */ - void CellGroup::addChild(Cell *newCell) - { - newCell->setParentCell(this); - - if(hasChilds()) - { - Cell *previous = last(); - - newCell->setPrevious(previous); - newCell->setNext(0); - - previous->setNext(newCell); - setLast(newCell); - } - else - { //First in line. - setChild(newCell); - setLast(newCell); - newCell->setNext(0); - newCell->setPrevious(0); - } - - addCellWidget(newCell); - } - - /*! - * \brief Removes a cell from a cellgroup. But does not delete the cell! - */ - void CellGroup::removeChild(Cell *aCell) - { - - //remove all widgets from parents layout. - Cell *par = aCell->parentCell(); - par->removeCellWidgets(); - - Cell *prev = aCell->previous(); - Cell *next = aCell->next(); - - if(aCell->parentCell()->child() == aCell) - aCell->parentCell()->setChild(aCell->next()); - - if(aCell->parentCell()->last() == aCell) - aCell->parentCell()->setLast(aCell->previous()); - - if(next) - { - if(prev) - next->setPrevious(prev); - } - - if(prev) - { - if(next) - prev->setNext(next); - } - //Insert all widgets again. - par->addCellWidgets(); - } - - //Just add widget. Don´t forget to repaint. - void CellGroup::addCellWidget(Cell *newCell) - { - newCell->reparent(mainWidget(), QPoint(0,0), true); - connect(newCell, SIGNAL(heightChanged()), - this, SLOT(adjustHeight())); - - removeCellWidgets(); - addCellWidgets(); - } - - void CellGroup::removeCellWidgets() - { - Cell *current = child(); - - while(current != 0) - { - layout_->remove(current); - current = current->next(); - } - } - - void CellGroup::addCellWidgets() - { - Cell *current = child(); - int i = 0; - - while(current != 0) - { - if(current->parentWidget() != mainWidget()) - { - current->reparent(mainWidget(), QPoint(0,0), true); - connect(current, SIGNAL(heightChanged()), - this, SLOT(adjustHeight())); - } - - layout_->addWidget(current,i,0); - ++i; - current = current->next(); - } - - adjustHeight(); - } - - //Delegate some properties. - - void CellGroup::setStyle(const QString &style) - { - if(closed_) - child()->setStyle(style); - } - - void CellGroup::setStyle(const QString &name, const QString &val) - { - if(closed_) - child()->setStyle(name, val); - } - - QString CellGroup::style() - { - if(closed_) - return child()->style(); - else - return QString::null; - } -} diff --git a/OMNotebook_QT3/OMNotebook/cellgroup.h b/OMNotebook_QT3/OMNotebook/cellgroup.h deleted file mode 100644 index 6aa3774b4fd..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellgroup.h +++ /dev/null @@ -1,118 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file cellgroup.h - * - */ -#ifndef CELLGROUP_H -#define CELLGROUP_H - -//STD Headers -#include -#include - -//QT Headers -#include -#include -#include -#include - -//IAEX Headers -#include "cell.h" -#include "visitor.h" - -using namespace std; -using namespace IAEX; - -namespace IAEX{ - - class CellGroup : public Cell - { - Q_OBJECT - public: - CellGroup(QWidget *parent=0,const char *name=0); - virtual ~CellGroup(); - - virtual void viewExpression(const bool){}; - - //Traversals implementation - virtual void accept(Visitor &v); - - //Datastructure implementation. - virtual void addChild(Cell *newCell); - virtual void removeChild(Cell *aCell); - - virtual void addCellWidget(Cell *newCell); - virtual void addCellWidgets(); - virtual void removeCellWidgets(); - - int height(); - bool isClosed() const; - QString style(); - virtual QString text(){return QString::null;} - - public slots: - virtual void setStyle(const QString &style); - virtual void setStyle(const QString &name, const QString &val); - void setClosed(const bool closed); - virtual void setFocus(const bool focus); - - protected: - void mouseDoubleClickEvent(QMouseEvent *event); - - protected slots: - void adjustHeight(); - - private: - bool closed_; - - QWidget *main_; - QGridLayout *layout_; - unsigned long newIndex_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/cellparserfactory.cpp b/OMNotebook_QT3/OMNotebook/cellparserfactory.cpp deleted file mode 100644 index ef795b3673e..00000000000 --- a/OMNotebook_QT3/OMNotebook/cellparserfactory.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include - -#include "parserfactory.h" -#include "xmlparser.h" -#include "notebookparser.h" - - -namespace IAEX -{ - - /*! \class CellParserFactory - * \brief Nows how to open xml and nb files. - * - * This factory class knows how to open different fileformats. If a - * new fileformat should be added the code for parsing the new format. - * - * Do not forget to delete a parser when it is not used anymore. - * - * - * \todo Check for whitespaces in filename. Whitespaces at the end - * of a file should be taken care of in some way. - * - */ - CellParserFactory::CellParserFactory(){} - CellParserFactory::~CellParserFactory(){} - - NBParser *CellParserFactory::createParser(QString filename, Factory *f) - { - filename = filename.stripWhiteSpace(); - - if(filename.endsWith(".xml")) - { - return new XMLParser(filename, f);//openXMLFile(filename); - } - else if(filename.endsWith(".nb")) - { - return new NotebookParser(filename, f); //openNotebookFile(filename); - } - else - { - throw runtime_error("Can only open files ending with .xml or .nb"); - } - } -}; diff --git a/OMNotebook_QT3/OMNotebook/command.h b/OMNotebook_QT3/OMNotebook/command.h deleted file mode 100644 index 0082a6366cb..00000000000 --- a/OMNotebook_QT3/OMNotebook/command.h +++ /dev/null @@ -1,133 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file command.h - * \author Ingemar Axelsson - * \brief Interface for creating cellcommands. - */ - -#ifndef COMMAND_H -#define COMMAND_H - -#include "document.h" - -namespace IAEX -{ - - /*!\inteface Command - * \brief Interface for creating cell commands. - * - * Every command will have access to a cursor when executed. This - * cursor is set by the executing environment. - * - * it should probably have access to the document instead. This - * would give the commands much more usable. - * - * \todo Define some atomic commands that could be used to build up - * more advanced commands. For example move up down. Select cell at - * cursor position. Add/delete cell and so on. Just so there is a - * base to work with. Then this could be really powerful. - * - * \todo Add a composite command. With composite command and a - * ifcommand a quite powerful macro environment. - * - */ - class Command - { - public: - virtual void execute() = 0; - - virtual QString commandName(){ return QString("NoCommandNameSet");} - - void setDocument(Document *document){document_ = document;} - void setApplication(Application *app){application_ = app;} - - protected: - Document *document(){ return document_;} - Application *application(){return application_;} - - private: - Document *document_; - Application *application_; - }; - - - /*! \class CompositeCommand - * - * \brief Allows composite commands to be created. - * - * This is not fully implemented. It is just a template for the - * composite command. - * - * One command could execute a lot of things. Notice that commands - * are executed in the order that they are added (or see STL - * vector). This command could be used to make some kind of macro - * of other commands. It seems to be very powerful. - * - * Use this class with caution. - */ - class CompositeCommand : public Command - { - public: - CompositeCommand(){} - virtual ~CompositeCommand(){} - void add(Command *c){commands_.push_back(c);} - - virtual void execute() - { - vector::iterator i = commands_.begin(); - for(;i != commands_.end(); ++i) - { - (*i)->execute(); - } - } - - private: - vector commands_; - }; -}; -#endif diff --git a/OMNotebook_QT3/OMNotebook/commandcenter.h b/OMNotebook_QT3/OMNotebook/commandcenter.h deleted file mode 100644 index c4675dba426..00000000000 --- a/OMNotebook_QT3/OMNotebook/commandcenter.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _COMMANDCENTER_H -#define _COMMANDCENTER_H - -#include "command.h" -//#include "application.h" - -namespace IAEX -{ - class Application; - - - /*! \interface CommandCenter - * - * This interface describes all methods a commandcenter should - * implement. - */ - class CommandCenter - { - public: - virtual void executeCommand(Command *) = 0; - virtual Application *application() = 0; - virtual void setApplication(Application *) = 0; - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/copytest.cpp b/OMNotebook_QT3/OMNotebook/copytest.cpp deleted file mode 100644 index 1285664831c..00000000000 --- a/OMNotebook_QT3/OMNotebook/copytest.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -//#include "cell.h" -#include "textcell.h" -#include "cellfactory.h" - -using namespace std; -using namespace IAEX; - - -int main(int argc, char *argv[]) -{ - - CellFactory *f = new CellFactory(); - - TextCell *t = f->createCell("text"); //new TextCell(); - - t->setText("Hello COPY"); - - TextCell *c = f->copyCell(t); - - - cout << "Original: " << t->text() << endl; - cout << "Copied text: " << c->text() << endl; - - t->setText("Changed"); - - cout << "Changed orig: " << t->text() << endl; - cout << "copy " << c->text() << endl; - - return 0; -} diff --git a/OMNotebook_QT3/OMNotebook/cursorcommands.h b/OMNotebook_QT3/OMNotebook/cursorcommands.h deleted file mode 100644 index c6d3c87ba40..00000000000 --- a/OMNotebook_QT3/OMNotebook/cursorcommands.h +++ /dev/null @@ -1,220 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _CURSORCOMMANDS_H -#define _CURSORCOMMANDS_H - -#include "command.h" -#include "factory.h" -#include "document.h" -#include "cellcursor.h" -#include "serializingvisitor.h" - -using namespace std; - -namespace IAEX -{ - /*! \class CursorMoveUpCommand - * - * \brief Moves the cursor up one step. - */ - class CursorMoveUpCommand : public Command - { - public: - CursorMoveUpCommand(){} - virtual ~CursorMoveUpCommand(){} - void execute() - { - try - { - CellCursor *cursor = document()->getCursor(); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(true); - cursor->currentCell()->child()->setFocus(false); - } - } - else - { - cursor->currentCell()->setReadOnly(true); - cursor->currentCell()->setFocus(false); - } - - cursor->moveUp(); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(false); - cursor->currentCell()->child()->setFocus(true); - } - } - else - { - cursor->currentCell()->setReadOnly(false); - cursor->currentCell()->setFocus(true); - } - } - catch(exception &e) - { - cerr << "CursorMoveUpCommand(), Exception: " << e.what() << endl; - } - } - }; - - /*! \class CursorMoveDownCommand - * - * \brief Moves the cursor down one step. - */ - class CursorMoveDownCommand : public Command - { - public: - CursorMoveDownCommand(){} - virtual ~CursorMoveDownCommand(){} - void execute() - { - try - { - CellCursor *cursor = document()->getCursor(); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(true); - cursor->currentCell()->child()->setFocus(false); - } - } - else - { - cursor->currentCell()->setReadOnly(true); - cursor->currentCell()->setFocus(false); - } - - cursor->moveDown(); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(false); - cursor->currentCell()->child()->setFocus(true); - } - } - else - { - cursor->currentCell()->setReadOnly(false); - cursor->currentCell()->setFocus(true); - } - } - catch(exception &e) - { - cerr << "CursorMoveDownCommand(), Exception: " << e.what() << endl; - } - } - }; - - /*! \class CursorMoveAfterCommand - * - * \brief Moves the cursor after a specific cell. - */ - class CursorMoveAfterCommand : public Command - { - public: - CursorMoveAfterCommand(Cell *cell):cell_(cell){} - virtual ~CursorMoveAfterCommand(){} - void execute() - { - try - { - CellCursor *cursor = document()->getCursor(); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(true); - cursor->currentCell()->child()->setFocus(false); - } - } - else - { - cursor->currentCell()->setReadOnly(true); - cursor->currentCell()->setFocus(false); - } - - cursor->moveAfter(cell_); - - if(cursor->currentCell()->isClosed()) - { - if(cursor->currentCell()->hasChilds()) - { - cursor->currentCell()->child()->setReadOnly(false); - cursor->currentCell()->child()->setFocus(true); - } - } - else - { - cursor->currentCell()->setReadOnly(false); - cursor->currentCell()->setFocus(true); - } - - } - catch(exception &e) - { - cerr << "CursorMoveAfterCommand(), Exception: " << e.what() << endl; - } - } - private: - Cell *cell_; - }; -}; -#endif diff --git a/OMNotebook_QT3/OMNotebook/document.h b/OMNotebook_QT3/OMNotebook/document.h deleted file mode 100644 index 0af24afc29e..00000000000 --- a/OMNotebook_QT3/OMNotebook/document.h +++ /dev/null @@ -1,136 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file document.h - * \author Ingemar Axelsson - * \brief Describes a celldocument. - */ - -#ifndef DOCUMENT_H -#define DOCUMENT_H - -#include - -#include - -#include - -#include "visitor.h" - -#include "documentview.h" - -using namespace std; - -namespace IAEX -{ - - //Forward declaration - class Command; - class CellCursor; - class Factory; - class DocumentView; - class Application; - - - /*! \interface Document - * - * \brief Describes all operations that is needed by a document. - * - * The Document interface describes all methods that must be - * implemented by a concrete document class. - */ - class Document : public QObject - { - Q_OBJECT - public: - //Application - virtual Application *application() = 0; - //State - virtual bool hasChanged() const = 0; - virtual bool isOpen() const = 0; - virtual bool isSaved() const = 0; // AF - - //File operations - virtual void open(const QString &filename) = 0; - virtual void close() = 0; - //virtual void save() = 0; - virtual QString getFilename() = 0; - virtual void setFilename( QString filename ) = 0; //AF - virtual void setSaved( bool saved ) = 0; //AF - - //Cursor operations - virtual CellCursor *getCursor() = 0; - virtual void cursorStepUp() = 0; - virtual void cursorStepDown() = 0; - virtual void cursorMoveAfter(Cell *aCell, const bool open) = 0; - virtual void cursorAddCell() = 0; - virtual void cursorDeleteCell() = 0; - virtual void cursorCutCell() = 0; - virtual void cursorCopyCell() = 0; - virtual void cursorPasteCell() = 0; - - virtual void cursorChangeStyle(const QString &style) = 0; - - //Utility operations - virtual Factory *cellFactory() = 0; - virtual vector getSelection() = 0; - virtual void clearSelection() = 0; - - //command operations - virtual void executeCommand(Command *cmd) = 0; - - //Observer interface - virtual void attach(DocumentView *d) = 0; - virtual void detach(DocumentView *d) = 0; - virtual void notify() = 0; - virtual QFrame *getState() = 0; - - //Visitor Initializations - virtual void runVisitor(Visitor &v) = 0; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/documentview.h b/OMNotebook_QT3/OMNotebook/documentview.h deleted file mode 100644 index a2919b109ef..00000000000 --- a/OMNotebook_QT3/OMNotebook/documentview.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _DOCUMENTVIEW_H -#define _DOCUMENTVIEW_H - -#include - -namespace IAEX -{ - - /*! \interface DocumentView - * - * \brief Describes what a documentView should implement. - * - * Base interface for document views. - * - */ - class DocumentView : public QMainWindow - { - Q_OBJECT - public: - DocumentView(QWidget *parent=0, const char *name=0) - : QMainWindow(parent, name, WDestructiveClose){} - virtual ~DocumentView(){} - - virtual void update() = 0; - - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/factory.h b/OMNotebook_QT3/OMNotebook/factory.h deleted file mode 100644 index 09362d6bf1f..00000000000 --- a/OMNotebook_QT3/OMNotebook/factory.h +++ /dev/null @@ -1,84 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _FACTORY_H -#define _FACTORY_H - -#include -#include "cell.h" - -namespace IAEX -{ - /*! \interface Factory - * - * \brief Describes all methods for a factory that creates - * cells. See cell.h for information about cells. - * - */ - class Factory - { - public: - virtual Cell *createCell(const QString &style, Cell *parent=0) = 0; - virtual Cell *createCell(const QString &filename, - const QString &style, Cell *parent=0) = 0; - - //Fulhack to compile on VC++ - // virtual Cell *createCell(const std::string &style, Cell *parent=0) - // { createCell(QString(style.c_str()), parent);} - }; - - /*! \class NullFactory - * \brief Describes an empty factory. - */ - class NullFactory : public Factory - { - public: - virtual Cell *createCell(const QString &style, Cell *parent=0) - {return 0;}//new NullCell();} - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/imagecell.cpp b/OMNotebook_QT3/OMNotebook/imagecell.cpp deleted file mode 100644 index c6df32f8d52..00000000000 --- a/OMNotebook_QT3/OMNotebook/imagecell.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include - - -#include "imagecell.h" - -using namespace std; - -namespace IAEX -{ - /*! \class ImageCell - * \brief Shows an image in the celltree. - * - * This class is responsible for cells that displays images. It can - * display jpeg images and some other formats, see Qt documentation - * at trolltech for more information. - * - * \todo Implement scaling and more appropriate sizes for images. - * - * \todo Implement margins so images is displayed at the center of - * the widget. - */ - ImageCell::ImageCell(const QString &filename, QWidget *parent, const char *name) - : Cell(parent, name), filename_(filename) - { - if(!picture_.load(filename_)) - throw runtime_error("could not load pixmap"); - - setHeight(picture_.height()); - } - - ImageCell::~ImageCell() - { - } - - const QString ImageCell::filename() const - { - return filename_; - } - - void ImageCell::accept(Visitor &v) - { - v.visitImageCellNodeBefore(this); - - if(hasChilds()) - child()->accept(v); - - v.visitImageCellNodeAfter(this); - - //Move along. - if(hasNext()) - next()->accept(v); - } - - - /*! - * \todo Move image into the center. Then change it to the correct - * size. Scale down if needed. - */ - void ImageCell::paintEvent(QPaintEvent *event) - { - QPainter p(this); - - //if(picture_.width() < width()) - //scale down picture to width. - - p.drawPixmap(0,0, picture_); - } -} diff --git a/OMNotebook_QT3/OMNotebook/imagecell.h b/OMNotebook_QT3/OMNotebook/imagecell.h deleted file mode 100644 index 560eaaa521d..00000000000 --- a/OMNotebook_QT3/OMNotebook/imagecell.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file inputcell.h - * \author Ingemar Axelsson - * - * \brief Describes a inputcell. - */ - -#ifndef _IMAGECELL_H_ -#define _IMAGECELL_H_ - -//QT Headers -#include -#include - -//IAEX Headers -#include "cell.h" -#include "visitor.h" - -namespace IAEX -{ - class ImageCell : public Cell - { - Q_OBJECT - public: - ImageCell(const QString &filename, QWidget *parent=0, const char *name=0); - virtual ~ImageCell(); - - virtual void accept(Visitor &v); - - const QString filename() const; - void setFocus(const bool){} - virtual QString text(){return filename_;} - - protected: - void paintEvent(QPaintEvent *event); - - private: - QString filename_; - QPixmap picture_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/inputcell.cpp b/OMNotebook_QT3/OMNotebook/inputcell.cpp deleted file mode 100644 index 93dc7ca5c54..00000000000 --- a/OMNotebook_QT3/OMNotebook/inputcell.cpp +++ /dev/null @@ -1,516 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -//STD Headers -#include -#include -#include - -#include - -//IAEX Headers -#include "inputcell.h" -//#include "cellcursor.h" -#include "treeview.h" -#include "stylesheet.h" - -namespace IAEX{ - - /*! \class NullHighlighter - * \brief This class is used if no SyntaxHighlighter is set. - * - */ - class NullHighlighter : public SyntaxHighlighter - { - public: - virtual void rehighlight(){} - virtual void setTextEdit(QTextEdit *){} - }; - - - /*! \class InputCell - * \brief Describes how an inputcell works. - * - * Input cells is places where the user can do input. To evaluate - * the content of an inputcell just press shift+enter. It will - * throw an exception if it cant find modeq. Start modeq with - * following commandline: - * - * # modeq +d=interactiveCorba - * - * For other environments such as SML environment no process is - * needed. See the actual environment for more information about - * this topic. - * - * \todo Create a state for the inputcell. If it is evaluated or - * not. This should reflect the drawing of its content. Notis when - * the evaluation is invalidated. This could be done with the - * state-pattern. With a DFA it is easier to track errors. - * - * \todo Make it possible to add cells within a inputcell? - * \todo Make it possiblee to add and change syntax coloring of code. - */ - - int InputCell::numEvals_ = 1; - - InputCell::InputCell(QWidget *parent, const char *name) - : Cell(parent, name), - evaluated_(false), - closed_(true), - delegate_(0) - { - QWidget *main = new QWidget(this); - setMainWidget(main); - layout_ = new QGridLayout(mainWidget(), 2, 1); - - setTreeWidget(new InputTreeView(this)); - - setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - setFocusPolicy(QWidget::NoFocus); - - setSyntaxHighlighter(new NullHighlighter()); - - createInputCell(); - createOutputCell(); - - setBackgroundColor(QColor(200,200,255)); - - //input_->setText(""); - //setHeight(20); - //setClosed(true); - } - - InputCell::~InputCell() - { - delete input_; -// if(output_) - delete output_; - delete syntaxHighlighter_; - } - - /*! \brief Sets the evaulator delegate. - */ - void InputCell::setDelegate(InputCellDelegate *d) - { - delegate_ = d; - } - - InputCellDelegate *InputCell::delegate() - { - if(!hasDelegate()) - throw runtime_error("No delegate."); - - return delegate_; - } - - /*! \brief Sets the syntaxhighlighter. - * - * - * \param h Syntax highlighter to use. If 0 a NullHighlighter is - * used. - */ - void InputCell::setSyntaxHighlighter(SyntaxHighlighter *h) - { - if(!h) - { - h = new NullHighlighter(); - } - - h->setTextEdit(input_); - syntaxHighlighter_ = h; - } - - bool InputCell::hasDelegate() - { - return delegate_ != 0; - } - - /*! - * Sizehint is not implemented correctly. This method makes - * inputcell behaive strange. - */ -// QSize InputCell::sizeHint() const -// { -// QSize size = QSize(width(), input_->heightForWidth(width())); - -// if(evaluated_ && !closed_) -// size += QSize(width(), output_->heightForWidth(width())); - -// return size; -// } - - - void InputCell::createInputCell() - { - input_ = new QTextEdit(mainWidget(), "input textedit"); - layout_->addWidget(input_, 1,1); - - input_->setTextFormat(Qt::PlainText); - //input_->setTextFormat(Qt::RichText); //AF - input_->setReadOnly(false); - input_->setFrameShape(QFrame::Panel); - //input_->setFrameStyle(QFrame::Panel); - input_->setHScrollBarMode(QScrollView::AlwaysOff); - input_->setVScrollBarMode(QScrollView::AlwaysOff); - input_->setResizePolicy(QScrollView::AutoOneFit); - input_->setAutoFormatting(QTextEdit::AutoNone); - //input_->setStyleSheet(QStyleSheet::defaultSheet()); - //input_->setAutoFormatting(QTextEdit::AutoAll); - input_->setPaletteBackgroundColor(QColor(200,200,255)); - - //input_->setFrameShadow(QFrame::Sunken); - input_->installEventFilter(this); - - input_->setPointSize(12); - input_->setFixedHeight(12); - - //Can theese signals be converted to events? - connect(input_, SIGNAL(returnPressed()), - this, SLOT(contentChanged())); - - connect(input_, SIGNAL(textChanged()), - this, SLOT(contentChanged())); - - connect(input_, SIGNAL(clicked(int, int)), - this, SLOT(clickEvent(int, int))); - - contentChanged(); - } - - void InputCell::createOutputCell() - { - output_ = new QTextEdit(mainWidget(), "output textedit"); - layout_->addWidget(output_, 2,1); - output_->setReadOnly(false); - output_->setFrameShape(QFrame::Panel); - //output_->setFrameShadow(QFrame::Sunken); - //output_->installEventFilter(this); - output_->setHScrollBarMode(QScrollView::AlwaysOff); - output_->setVScrollBarMode(QScrollView::AlwaysOff); - //output_->setResizePolicy(QScrollView::AutoOneFit); - //output_->setStyleSheet(QStyleSheet::defaultSheet()); - //output_->setAutoFormatting(QTextEdit::AutoAll); - output_->setReadOnly(true); - output_->hide(); - - //Can theese signals be converted to use events instead? - connect(input_, SIGNAL(returnPressed()), - this, SLOT(contentChanged())); - - connect(input_, SIGNAL(textChanged()), - this, SLOT(contentChanged())); - - connect(input_, SIGNAL(clicked(int, int)), - this, SLOT(clickEvent(int, int))); - } - - void InputCell::clickEvent(int, int) - { - emit clicked(this); - } - - /*! \brief Do not use this member. - * - * This is an ugly part of the cell structure. - */ - void InputCell::addCellWidgets() - { - layout_->addWidget(input_,0,0); - - if(evaluated_) - layout_->addWidget(output_,1,0); - } - - void InputCell::removeCellWidgets() - { - layout_->remove(input_); - if(evaluated_) - layout_->remove(output_); - } - - /*! \brief resets the input cell. Removes all output data and - * restores the initial state. - */ - void InputCell::clear() - { - if(evaluated_) - { - output_->clear(); - evaluated_ = false; - layout_->remove(output_); - } - - input_->setReadOnly(false); - input_->clear(); - treeView()->setClosed(false); //Notis this - setClosed(true); - } - - bool InputCell::eventFilter(QObject *o, QEvent *e) - { - //Take care of SHIFT + RETURN. - if(o == input_) - { - if(e->type() == QEvent::KeyPress)//QEvent::KeyRelease) - { - QKeyEvent *k = (QKeyEvent *)e; - - if(k->key() == Qt::Key_Return && k->state() == Qt::ShiftButton) - { - eval(); - return TRUE; - } - } - return Cell::eventFilter(o,e); - } - else - return Cell::eventFilter(o,e); - - } - - /*! \brief Sends the content of the inputcell to the - * evaluator. Displays the result in a outputcell. - * - * Removes whitespaces and tags from the content string. Then sends - * the content to the delegate object for evaluation. The result is - * printed in a output cell. No indentation and syntax - * highlightning is used in the output cell. - * - */ - void InputCell::eval() - { - //Get only the text, no tags. - QString expr = input_->text(); - expr = expr.simplifyWhiteSpace(); - - - createOutputCell(); - output_->clear(); - - if(hasDelegate()) - { - delegate()->evalExpression(expr); - - // 2005-11-24 AF, added check to see if the user wants to quit - if( 0 == expr.find( "quit()", 0, false )) - { - qApp->closeAllWindows(); - return; - } - - - output_->setText(delegate()->getResult()); - - //qDebug( "Eval:" ); - //qDebug( output_->text() ); - - //Change state if evaluated. - output_->show(); - - ++numEvals_; - evaluated_ = true; - - setClosed(false); - contentChanged(); - } - } - - void InputCell::contentChanged() - { - syntaxHighlighter_->rehighlight(); - - //qDebug( "Width-Inputcell: %i", width() ); - int _height = input_->heightForWidth(width()); - //int _height = input_->contentsHeight(); - - input_->setMinimumHeight(_height); - - if(evaluated_) - { - int outHeight = output_->heightForWidth(width()); - output_->setMinimumHeight(outHeight); - _height += outHeight; - } - - setHeight(_height); - - emit textChanged(); - } - - /*! - * \deprecated - */ - void InputCell::setStyleSheet(QStyleSheet *) - { - qDebug("inputSetStyleSheet"); - - //Qt::TextFormat f = input_->textFormat(); - //input_->setTextFormat(Qt::PlainText); - //QString tmp = input_->text(); - //input_->setTextFormat(f); - //input_->clear(); - - //input_->setStyleSheet(sheet); - - //if(evaluated_) - //{ -// Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); -// QStyleSheet *outsheet = new QStyleSheet(output_, 0); -// output_->setStyleSheet(stylesheet->getStyle(outsheet, "Output")); -// } - - } - - /*! - * Resize textcell when the mainwindow is resized. This because the - * cellcontent should always be visible. - * - * Added by AF, copied from textcell.cpp - */ - void InputCell::resizeEvent(QResizeEvent *event) - { - contentChanged(); - Cell::resizeEvent(event); - } - - void InputCell::setText(QString text) - { - // 2005-10-04 AF, added som code to replace/remove - QString tmp = text.replace("
", "\n"); - tmp.remove( " " ); - - input_->setText( tmp ); - contentChanged(); - - } - - QString InputCell::text() - { -// Qt::TextFormat f = input_->textFormat(); -// input_->setTextFormat(Qt::PlainText); -// QString tmp = input_->text(); - -// tmp = tmp.replace(QString("\n"), QString("
")); -// tmp = tmp.replace(QString("\t"), QString("")); -// input_->setTextFormat(f); - - return input_->text();//tmp; - } - - void InputCell::setClosed(const bool closed) - { - int newHeight = input_->height(); - - if(closed) - { - if(evaluated_) - output_->hide(); - } - else - { - if(evaluated_) - { - newHeight = input_->height() + output_->height(); - output_->show(); - } - } - setHeight(newHeight); - closed_ = closed; - } - - void InputCell::setFocus(const bool focus) - { - if(focus) - input_->setFocus(); - } - - void InputCell::mouseDoubleClickEvent(QMouseEvent *) - { - if(treeView()->hasMouse()) - { - setClosed(!closed_); - } - } - - void InputCell::accept(Visitor &v) - { - v.visitInputCellNodeBefore(this); - - if(hasChilds()) - child()->accept(v); - - v.visitInputCellNodeAfter(this); - - if(hasNext()) - next()->accept(v); - } - - /*! - * InputCell setStyle is locked on the "input" style. So if it does - * not work, see if the "input" style is defined. If it is, then it - * should appear in the style menu. - */ - void InputCell::setStyle(const QString &style) - { - // Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); -// QStyleSheet *sheet = new QStyleSheet(input_, 0); - -// setStyleSheet(stylesheet->getStyle(sheet, "Input")); - - Cell::setStyle(style); - } - - void InputCell::setStyle(const QString &name, const QString &val) - { -// Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); -// QStyleSheet *sheet = new QStyleSheet(input_, 0); - -// setStyleSheet(stylesheet->getStyle(sheet, name, val)); - - Cell::setStyle(name, val); - } -} diff --git a/OMNotebook_QT3/OMNotebook/inputcell.h b/OMNotebook_QT3/OMNotebook/inputcell.h deleted file mode 100644 index 74d22a08f74..00000000000 --- a/OMNotebook_QT3/OMNotebook/inputcell.h +++ /dev/null @@ -1,134 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file inputcell.h - * \author Ingemar Axelsson - * - * \brief Describes a inputcell. - */ - -#ifndef _INPUTCELL_H_ -#define _INPUTCELL_H_ - -//QT Headers -#include -#include -#include -#include - -//IAEX Headers -#include "cell.h" -#include "inputcelldelegate.h" -//#include "document.h" -#include "syntaxhighlighter.h" - - -namespace IAEX -{ - class InputCell : public Cell - { - Q_OBJECT - public: - InputCell(QWidget *parent=0, const char *name=0); - virtual ~InputCell(); - - void setStyleSheet(QStyleSheet *); - void setText(QString text); - QString text(); - virtual void viewExpression(const bool){} - - virtual void addCellWidgets(); - virtual void removeCellWidgets(); - - void setDelegate(InputCellDelegate *d); - void setSyntaxHighlighter(SyntaxHighlighter *h); - virtual void accept(Visitor &v); - //QSize sizeHint() const; - - //virtual Cell clone(){} - - signals: - void textChanged(); - - public slots: - void eval(); - void contentChanged(); - void setClosed(const bool closed); - virtual void setFocus(const bool focus); - void clickEvent(int, int); - virtual void setStyle(const QString &style); - virtual void setStyle(const QString &name, const QString &val); - - protected: - void resizeEvent(QResizeEvent *event); //AF - void mouseDoubleClickEvent(QMouseEvent *); - void clear(); - bool eventFilter(QObject *o, QEvent *e); - - bool hasDelegate(); - InputCellDelegate *delegate(); - - private: - void createInputCell(); - void createOutputCell(); - //void createHighlighter(); - - bool evaluated_; - bool closed_; - static int numEvals_; - - QTextEdit *input_; - QTextEdit *output_; - InputCellDelegate *delegate_; - - QGridLayout *layout_; - - //QSyntaxHighlighter *syntaxHighlighter_; - SyntaxHighlighter *syntaxHighlighter_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/inputcelldelegate.h b/OMNotebook_QT3/OMNotebook/inputcelldelegate.h deleted file mode 100644 index 5c9c400b5b1..00000000000 --- a/OMNotebook_QT3/OMNotebook/inputcelldelegate.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _INPUTCELLDELEGATE_H -#define _INPUTCELLDELEGATE_H - -#include -#include - -namespace IAEX -{ - /*! - * \interface InputCellDelegate - * - * \brief Describes what members a delegate to the inputcell should - * implement. - * - * This interface should be subclassed in order to extend the - * applications functionality to evaluate another type of - * expressions. At the moment a Modelica environment is - * implemented, and also a Standard ML environment is implemented. - * - */ - class InputCellDelegate - { - public: - virtual QString getResult() = 0; - virtual void evalExpression(QString &expr) = 0; - }; - -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/moc_cell.cpp b/OMNotebook_QT3/OMNotebook/moc_cell.cpp deleted file mode 100644 index 40ea2133516..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_cell.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/**************************************************************************** -** IAEX::Cell meta object code from reading C++ file 'cell.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_cell.cpp,v 1.6 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "cell.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::Cell::className() const -{ - return "IAEX::Cell"; -} - -QMetaObject *IAEX::Cell::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__Cell( "IAEX::Cell", &IAEX::Cell::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::Cell::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::Cell", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::Cell::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::Cell", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::Cell::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QWidget::staticMetaObject(); - static const QUParameter param_slot_0[] = { - { "r", &static_QUType_ptr, "Rule", QUParameter::In } - }; - static const QUMethod slot_0 = {"addRule", 1, param_slot_0 }; - static const QUParameter param_slot_1[] = { - { "style", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_1 = {"setStyle", 1, param_slot_1 }; - static const QUParameter param_slot_2[] = { - { "name", &static_QUType_QString, 0, QUParameter::In }, - { "val", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_2 = {"setStyle", 2, param_slot_2 }; - static const QUParameter param_slot_3[] = { - { "text", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_3 = {"setText", 1, param_slot_3 }; - static const QUParameter param_slot_4[] = { - { 0, &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_4 = {"setReadOnly", 1, param_slot_4 }; - static const QUParameter param_slot_5[] = { - { "color", &static_QUType_varptr, "\x0a", QUParameter::In } - }; - static const QUMethod slot_5 = {"setBackgroundColor", 1, param_slot_5 }; - static const QUParameter param_slot_6[] = { - { "selected", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_6 = {"setSelected", 1, param_slot_6 }; - static const QUParameter param_slot_7[] = { - { "focus", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_7 = {"setFocus", 1, param_slot_7 }; - static const QUParameter param_slot_8[] = { - { "height", &static_QUType_int, 0, QUParameter::In } - }; - static const QUMethod slot_8 = {"setHeight", 1, param_slot_8 }; - static const QUParameter param_slot_9[] = { - { "hidden", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_9 = {"hideTreeView", 1, param_slot_9 }; - static const QUParameter param_slot_10[] = { - { "label", &static_QUType_ptr, "QLabel", QUParameter::In } - }; - static const QUMethod slot_10 = {"setLabel", 1, param_slot_10 }; - static const QUParameter param_slot_11[] = { - { "newTreeWidget", &static_QUType_ptr, "TreeView", QUParameter::In } - }; - static const QUMethod slot_11 = {"setTreeWidget", 1, param_slot_11 }; - static const QUParameter param_slot_12[] = { - { "newWidget", &static_QUType_ptr, "QWidget", QUParameter::In } - }; - static const QUMethod slot_12 = {"setMainWidget", 1, param_slot_12 }; - static const QMetaData slot_tbl[] = { - { "addRule(Rule*)", &slot_0, QMetaData::Public }, - { "setStyle(const QString&)", &slot_1, QMetaData::Public }, - { "setStyle(const QString&,const QString&)", &slot_2, QMetaData::Public }, - { "setText(QString)", &slot_3, QMetaData::Public }, - { "setReadOnly(const bool)", &slot_4, QMetaData::Public }, - { "setBackgroundColor(const QColor)", &slot_5, QMetaData::Public }, - { "setSelected(const bool)", &slot_6, QMetaData::Public }, - { "setFocus(const bool)", &slot_7, QMetaData::Public }, - { "setHeight(const int)", &slot_8, QMetaData::Public }, - { "hideTreeView(const bool)", &slot_9, QMetaData::Public }, - { "setLabel(QLabel*)", &slot_10, QMetaData::Protected }, - { "setTreeWidget(TreeView*)", &slot_11, QMetaData::Protected }, - { "setMainWidget(QWidget*)", &slot_12, QMetaData::Protected } - }; - static const QUParameter param_signal_0[] = { - { 0, &static_QUType_ptr, "Cell", QUParameter::In } - }; - static const QUMethod signal_0 = {"clicked", 1, param_signal_0 }; - static const QUParameter param_signal_1[] = { - { 0, &static_QUType_int, 0, QUParameter::In } - }; - static const QUMethod signal_1 = {"doubleClicked", 1, param_signal_1 }; - static const QUParameter param_signal_2[] = { - { 0, &static_QUType_int, 0, QUParameter::In } - }; - static const QUMethod signal_2 = {"changedWidth", 1, param_signal_2 }; - static const QUParameter param_signal_3[] = { - { 0, &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod signal_3 = {"selected", 1, param_signal_3 }; - static const QUParameter param_signal_4[] = { - { 0, &static_QUType_ptr, "Cell", QUParameter::In }, - { 0, &static_QUType_ptr, "Qt::ButtonState", QUParameter::In } - }; - static const QUMethod signal_4 = {"cellselected", 2, param_signal_4 }; - static const QUMethod signal_5 = {"heightChanged", 0, 0 }; - static const QUParameter param_signal_6[] = { - { "link", &static_QUType_ptr, "QUrl", QUParameter::In } - }; - static const QUMethod signal_6 = {"openLink", 1, param_signal_6 }; - static const QUParameter param_signal_7[] = { - { 0, &static_QUType_ptr, "Cell", QUParameter::In }, - { 0, &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod signal_7 = {"cellOpened", 2, param_signal_7 }; - static const QMetaData signal_tbl[] = { - { "clicked(Cell*)", &signal_0, QMetaData::Protected }, - { "doubleClicked(int)", &signal_1, QMetaData::Protected }, - { "changedWidth(const int)", &signal_2, QMetaData::Protected }, - { "selected(const bool)", &signal_3, QMetaData::Protected }, - { "cellselected(Cell*,Qt::ButtonState)", &signal_4, QMetaData::Protected }, - { "heightChanged()", &signal_5, QMetaData::Protected }, - { "openLink(QUrl*)", &signal_6, QMetaData::Protected }, - { "cellOpened(Cell*,const bool)", &signal_7, QMetaData::Protected } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::Cell", parentObject, - slot_tbl, 13, - signal_tbl, 8, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__Cell.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::Cell::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::Cell" ) ) - return this; - return QWidget::qt_cast( clname ); -} - -#include -#include - -// SIGNAL clicked -void IAEX::Cell::clicked( Cell* t0 ) -{ - if ( signalsBlocked() ) - return; - QConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 0 ); - if ( !clist ) - return; - QUObject o[2]; - static_QUType_ptr.set(o+1,t0); - activate_signal( clist, o ); -} - -// SIGNAL doubleClicked -void IAEX::Cell::doubleClicked( int t0 ) -{ - activate_signal( staticMetaObject()->signalOffset() + 1, t0 ); -} - -// SIGNAL changedWidth -void IAEX::Cell::changedWidth( const int t0 ) -{ - activate_signal( staticMetaObject()->signalOffset() + 2, t0 ); -} - -// SIGNAL selected -void IAEX::Cell::selected( const bool t0 ) -{ - activate_signal_bool( staticMetaObject()->signalOffset() + 3, t0 ); -} - -// SIGNAL cellselected -void IAEX::Cell::cellselected( Cell* t0, Qt::ButtonState t1 ) -{ - if ( signalsBlocked() ) - return; - QConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 4 ); - if ( !clist ) - return; - QUObject o[3]; - static_QUType_ptr.set(o+1,t0); - static_QUType_ptr.set(o+2,&t1); - activate_signal( clist, o ); -} - -// SIGNAL heightChanged -void IAEX::Cell::heightChanged() -{ - activate_signal( staticMetaObject()->signalOffset() + 5 ); -} - -// SIGNAL openLink -void IAEX::Cell::openLink( QUrl* t0 ) -{ - if ( signalsBlocked() ) - return; - QConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 6 ); - if ( !clist ) - return; - QUObject o[2]; - static_QUType_ptr.set(o+1,t0); - activate_signal( clist, o ); -} - -// SIGNAL cellOpened -void IAEX::Cell::cellOpened( Cell* t0, const bool t1 ) -{ - if ( signalsBlocked() ) - return; - QConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 7 ); - if ( !clist ) - return; - QUObject o[3]; - static_QUType_ptr.set(o+1,t0); - static_QUType_bool.set(o+2,t1); - activate_signal( clist, o ); -} - -bool IAEX::Cell::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: addRule((Rule*)static_QUType_ptr.get(_o+1)); break; - case 1: setStyle((const QString&)static_QUType_QString.get(_o+1)); break; - case 2: setStyle((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2)); break; - case 3: setText((QString)static_QUType_QString.get(_o+1)); break; - case 4: setReadOnly((const bool)static_QUType_bool.get(_o+1)); break; - case 5: setBackgroundColor((const QColor)(*((const QColor*)static_QUType_ptr.get(_o+1)))); break; - case 6: setSelected((const bool)static_QUType_bool.get(_o+1)); break; - case 7: setFocus((const bool)static_QUType_bool.get(_o+1)); break; - case 8: setHeight((const int)static_QUType_int.get(_o+1)); break; - case 9: hideTreeView((const bool)static_QUType_bool.get(_o+1)); break; - case 10: setLabel((QLabel*)static_QUType_ptr.get(_o+1)); break; - case 11: setTreeWidget((TreeView*)static_QUType_ptr.get(_o+1)); break; - case 12: setMainWidget((QWidget*)static_QUType_ptr.get(_o+1)); break; - default: - return QWidget::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::Cell::qt_emit( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->signalOffset() ) { - case 0: clicked((Cell*)static_QUType_ptr.get(_o+1)); break; - case 1: doubleClicked((int)static_QUType_int.get(_o+1)); break; - case 2: changedWidth((const int)static_QUType_int.get(_o+1)); break; - case 3: selected((const bool)static_QUType_bool.get(_o+1)); break; - case 4: cellselected((Cell*)static_QUType_ptr.get(_o+1),(Qt::ButtonState)(*((Qt::ButtonState*)static_QUType_ptr.get(_o+2)))); break; - case 5: heightChanged(); break; - case 6: openLink((QUrl*)static_QUType_ptr.get(_o+1)); break; - case 7: cellOpened((Cell*)static_QUType_ptr.get(_o+1),(const bool)static_QUType_bool.get(_o+2)); break; - default: - return QWidget::qt_emit(_id,_o); - } - return TRUE; -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::Cell::qt_property( int id, int f, QVariant* v) -{ - return QWidget::qt_property( id, f, v); -} - -bool IAEX::Cell::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_cellapplication.cpp b/OMNotebook_QT3/OMNotebook/moc_cellapplication.cpp deleted file mode 100644 index 72b6d8fbb30..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_cellapplication.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** IAEX::CellApplication meta object code from reading C++ file 'cellapplication.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_cellapplication.cpp,v 1.6 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "cellapplication.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::CellApplication::className() const -{ - return "IAEX::CellApplication"; -} - -QMetaObject *IAEX::CellApplication::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__CellApplication( "IAEX::CellApplication", &IAEX::CellApplication::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::CellApplication::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellApplication", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::CellApplication::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellApplication", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::CellApplication::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QObject::staticMetaObject(); - metaObj = QMetaObject::new_metaobject( - "IAEX::CellApplication", parentObject, - 0, 0, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__CellApplication.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::CellApplication::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::CellApplication" ) ) - return this; - if ( !qstrcmp( clname, "Application" ) ) - return (Application*)this; - return QObject::qt_cast( clname ); -} - -bool IAEX::CellApplication::qt_invoke( int _id, QUObject* _o ) -{ - return QObject::qt_invoke(_id,_o); -} - -bool IAEX::CellApplication::qt_emit( int _id, QUObject* _o ) -{ - return QObject::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::CellApplication::qt_property( int id, int f, QVariant* v) -{ - return QObject::qt_property( id, f, v); -} - -bool IAEX::CellApplication::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_cellcursor.cpp b/OMNotebook_QT3/OMNotebook/moc_cellcursor.cpp deleted file mode 100644 index 1f2627fdd20..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_cellcursor.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** IAEX::CellCursor meta object code from reading C++ file 'cellcursor.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_cellcursor.cpp,v 1.6 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "cellcursor.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::CellCursor::className() const -{ - return "IAEX::CellCursor"; -} - -QMetaObject *IAEX::CellCursor::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__CellCursor( "IAEX::CellCursor", &IAEX::CellCursor::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::CellCursor::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellCursor", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::CellCursor::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellCursor", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::CellCursor::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = Cell::staticMetaObject(); - static const QUParameter param_slot_0[] = { - { 0, &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_0 = {"setFocus", 1, param_slot_0 }; - static const QMetaData slot_tbl[] = { - { "setFocus(const bool)", &slot_0, QMetaData::Public } - }; - static const QUMethod signal_0 = {"changedPosition", 0, 0 }; - static const QUParameter param_signal_1[] = { - { "x", &static_QUType_int, 0, QUParameter::In }, - { "y", &static_QUType_int, 0, QUParameter::In }, - { "xm", &static_QUType_int, 0, QUParameter::In }, - { "ym", &static_QUType_int, 0, QUParameter::In } - }; - static const QUMethod signal_1 = {"positionChanged", 4, param_signal_1 }; - static const QMetaData signal_tbl[] = { - { "changedPosition()", &signal_0, QMetaData::Public }, - { "positionChanged(int,int,int,int)", &signal_1, QMetaData::Public } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::CellCursor", parentObject, - slot_tbl, 1, - signal_tbl, 2, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__CellCursor.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::CellCursor::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::CellCursor" ) ) - return this; - return Cell::qt_cast( clname ); -} - -// SIGNAL changedPosition -void IAEX::CellCursor::changedPosition() -{ - activate_signal( staticMetaObject()->signalOffset() + 0 ); -} - -#include -#include - -// SIGNAL positionChanged -void IAEX::CellCursor::positionChanged( int t0, int t1, int t2, int t3 ) -{ - if ( signalsBlocked() ) - return; - QConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 1 ); - if ( !clist ) - return; - QUObject o[5]; - static_QUType_int.set(o+1,t0); - static_QUType_int.set(o+2,t1); - static_QUType_int.set(o+3,t2); - static_QUType_int.set(o+4,t3); - activate_signal( clist, o ); -} - -bool IAEX::CellCursor::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: setFocus((const bool)static_QUType_bool.get(_o+1)); break; - default: - return Cell::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::CellCursor::qt_emit( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->signalOffset() ) { - case 0: changedPosition(); break; - case 1: positionChanged((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3),(int)static_QUType_int.get(_o+4)); break; - default: - return Cell::qt_emit(_id,_o); - } - return TRUE; -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::CellCursor::qt_property( int id, int f, QVariant* v) -{ - return Cell::qt_property( id, f, v); -} - -bool IAEX::CellCursor::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_celldocument.cpp b/OMNotebook_QT3/OMNotebook/moc_celldocument.cpp deleted file mode 100644 index 289fd14649a..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_celldocument.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************** -** IAEX::CellDocument meta object code from reading C++ file 'celldocument.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_celldocument.cpp,v 1.7 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "celldocument.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::CellDocument::className() const -{ - return "IAEX::CellDocument"; -} - -QMetaObject *IAEX::CellDocument::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__CellDocument( "IAEX::CellDocument", &IAEX::CellDocument::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::CellDocument::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellDocument", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::CellDocument::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellDocument", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::CellDocument::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = Document::staticMetaObject(); - static const QUMethod slot_0 = {"toggleMainTreeView", 0, 0 }; - static const QUParameter param_slot_1[] = { - { "editable", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_1 = {"setEditable", 1, param_slot_1 }; - static const QUMethod slot_2 = {"cursorChangedPosition", 0, 0 }; - static const QUParameter param_slot_3[] = { - { "selected", &static_QUType_ptr, "Cell", QUParameter::In }, - { 0, &static_QUType_ptr, "Qt::ButtonState", QUParameter::In } - }; - static const QUMethod slot_3 = {"selectedACell", 2, param_slot_3 }; - static const QUMethod slot_4 = {"clearSelection", 0, 0 }; - static const QUParameter param_slot_5[] = { - { "clickedCell", &static_QUType_ptr, "Cell", QUParameter::In } - }; - static const QUMethod slot_5 = {"mouseClickedOnCell", 1, param_slot_5 }; - static const QUParameter param_slot_6[] = { - { "url", &static_QUType_ptr, "QUrl", QUParameter::In } - }; - static const QUMethod slot_6 = {"linkClicked", 1, param_slot_6 }; - static const QUParameter param_slot_7[] = { - { "aCell", &static_QUType_ptr, "Cell", QUParameter::In }, - { "open", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_7 = {"cursorMoveAfter", 2, param_slot_7 }; - static const QUParameter param_slot_8[] = { - { "b", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_8 = {"showHTML", 1, param_slot_8 }; - static const QMetaData slot_tbl[] = { - { "toggleMainTreeView()", &slot_0, QMetaData::Public }, - { "setEditable(bool)", &slot_1, QMetaData::Public }, - { "cursorChangedPosition()", &slot_2, QMetaData::Public }, - { "selectedACell(Cell*,Qt::ButtonState)", &slot_3, QMetaData::Public }, - { "clearSelection()", &slot_4, QMetaData::Public }, - { "mouseClickedOnCell(Cell*)", &slot_5, QMetaData::Public }, - { "linkClicked(QUrl*)", &slot_6, QMetaData::Public }, - { "cursorMoveAfter(Cell*,const bool)", &slot_7, QMetaData::Public }, - { "showHTML(bool)", &slot_8, QMetaData::Public } - }; - static const QUParameter param_signal_0[] = { - { 0, &static_QUType_int, 0, QUParameter::In } - }; - static const QUMethod signal_0 = {"widthChanged", 1, param_signal_0 }; - static const QUMethod signal_1 = {"cursorChanged", 0, 0 }; - static const QUParameter param_signal_2[] = { - { 0, &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod signal_2 = {"viewExpression", 1, param_signal_2 }; - static const QMetaData signal_tbl[] = { - { "widthChanged(const int)", &signal_0, QMetaData::Public }, - { "cursorChanged()", &signal_1, QMetaData::Public }, - { "viewExpression(const bool)", &signal_2, QMetaData::Public } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::CellDocument", parentObject, - slot_tbl, 9, - signal_tbl, 3, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__CellDocument.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::CellDocument::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::CellDocument" ) ) - return this; - return Document::qt_cast( clname ); -} - -// SIGNAL widthChanged -void IAEX::CellDocument::widthChanged( const int t0 ) -{ - activate_signal( staticMetaObject()->signalOffset() + 0, t0 ); -} - -// SIGNAL cursorChanged -void IAEX::CellDocument::cursorChanged() -{ - activate_signal( staticMetaObject()->signalOffset() + 1 ); -} - -// SIGNAL viewExpression -void IAEX::CellDocument::viewExpression( const bool t0 ) -{ - activate_signal_bool( staticMetaObject()->signalOffset() + 2, t0 ); -} - -bool IAEX::CellDocument::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: toggleMainTreeView(); break; - case 1: setEditable((bool)static_QUType_bool.get(_o+1)); break; - case 2: cursorChangedPosition(); break; - case 3: selectedACell((Cell*)static_QUType_ptr.get(_o+1),(Qt::ButtonState)(*((Qt::ButtonState*)static_QUType_ptr.get(_o+2)))); break; - case 4: clearSelection(); break; - case 5: mouseClickedOnCell((Cell*)static_QUType_ptr.get(_o+1)); break; - case 6: linkClicked((QUrl*)static_QUType_ptr.get(_o+1)); break; - case 7: cursorMoveAfter((Cell*)static_QUType_ptr.get(_o+1),(const bool)static_QUType_bool.get(_o+2)); break; - case 8: showHTML((bool)static_QUType_bool.get(_o+1)); break; - default: - return Document::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::CellDocument::qt_emit( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->signalOffset() ) { - case 0: widthChanged((const int)static_QUType_int.get(_o+1)); break; - case 1: cursorChanged(); break; - case 2: viewExpression((const bool)static_QUType_bool.get(_o+1)); break; - default: - return Document::qt_emit(_id,_o); - } - return TRUE; -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::CellDocument::qt_property( int id, int f, QVariant* v) -{ - return Document::qt_property( id, f, v); -} - -bool IAEX::CellDocument::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_cellgroup.cpp b/OMNotebook_QT3/OMNotebook/moc_cellgroup.cpp deleted file mode 100644 index 244a7e0225f..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_cellgroup.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** IAEX::CellGroup meta object code from reading C++ file 'cellgroup.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_cellgroup.cpp,v 1.6 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "cellgroup.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::CellGroup::className() const -{ - return "IAEX::CellGroup"; -} - -QMetaObject *IAEX::CellGroup::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__CellGroup( "IAEX::CellGroup", &IAEX::CellGroup::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::CellGroup::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellGroup", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::CellGroup::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::CellGroup", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::CellGroup::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = Cell::staticMetaObject(); - static const QUParameter param_slot_0[] = { - { "style", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_0 = {"setStyle", 1, param_slot_0 }; - static const QUParameter param_slot_1[] = { - { "name", &static_QUType_QString, 0, QUParameter::In }, - { "val", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_1 = {"setStyle", 2, param_slot_1 }; - static const QUParameter param_slot_2[] = { - { "closed", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_2 = {"setClosed", 1, param_slot_2 }; - static const QUParameter param_slot_3[] = { - { "focus", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_3 = {"setFocus", 1, param_slot_3 }; - static const QUMethod slot_4 = {"adjustHeight", 0, 0 }; - static const QMetaData slot_tbl[] = { - { "setStyle(const QString&)", &slot_0, QMetaData::Public }, - { "setStyle(const QString&,const QString&)", &slot_1, QMetaData::Public }, - { "setClosed(const bool)", &slot_2, QMetaData::Public }, - { "setFocus(const bool)", &slot_3, QMetaData::Public }, - { "adjustHeight()", &slot_4, QMetaData::Protected } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::CellGroup", parentObject, - slot_tbl, 5, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__CellGroup.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::CellGroup::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::CellGroup" ) ) - return this; - return Cell::qt_cast( clname ); -} - -bool IAEX::CellGroup::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: setStyle((const QString&)static_QUType_QString.get(_o+1)); break; - case 1: setStyle((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2)); break; - case 2: setClosed((const bool)static_QUType_bool.get(_o+1)); break; - case 3: setFocus((const bool)static_QUType_bool.get(_o+1)); break; - case 4: adjustHeight(); break; - default: - return Cell::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::CellGroup::qt_emit( int _id, QUObject* _o ) -{ - return Cell::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::CellGroup::qt_property( int id, int f, QVariant* v) -{ - return Cell::qt_property( id, f, v); -} - -bool IAEX::CellGroup::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_document.cpp b/OMNotebook_QT3/OMNotebook/moc_document.cpp deleted file mode 100644 index b5f8b94b0fe..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_document.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** IAEX::Document meta object code from reading C++ file 'document.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_document.cpp,v 1.7 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "document.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::Document::className() const -{ - return "IAEX::Document"; -} - -QMetaObject *IAEX::Document::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__Document( "IAEX::Document", &IAEX::Document::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::Document::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::Document", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::Document::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::Document", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::Document::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QObject::staticMetaObject(); - metaObj = QMetaObject::new_metaobject( - "IAEX::Document", parentObject, - 0, 0, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__Document.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::Document::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::Document" ) ) - return this; - return QObject::qt_cast( clname ); -} - -bool IAEX::Document::qt_invoke( int _id, QUObject* _o ) -{ - return QObject::qt_invoke(_id,_o); -} - -bool IAEX::Document::qt_emit( int _id, QUObject* _o ) -{ - return QObject::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::Document::qt_property( int id, int f, QVariant* v) -{ - return QObject::qt_property( id, f, v); -} - -bool IAEX::Document::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_documentview.cpp b/OMNotebook_QT3/OMNotebook/moc_documentview.cpp deleted file mode 100644 index ed3d835d7aa..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_documentview.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** IAEX::DocumentView meta object code from reading C++ file 'documentview.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_documentview.cpp,v 1.6 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "documentview.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::DocumentView::className() const -{ - return "IAEX::DocumentView"; -} - -QMetaObject *IAEX::DocumentView::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__DocumentView( "IAEX::DocumentView", &IAEX::DocumentView::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::DocumentView::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::DocumentView", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::DocumentView::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::DocumentView", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::DocumentView::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QMainWindow::staticMetaObject(); - metaObj = QMetaObject::new_metaobject( - "IAEX::DocumentView", parentObject, - 0, 0, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__DocumentView.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::DocumentView::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::DocumentView" ) ) - return this; - return QMainWindow::qt_cast( clname ); -} - -bool IAEX::DocumentView::qt_invoke( int _id, QUObject* _o ) -{ - return QMainWindow::qt_invoke(_id,_o); -} - -bool IAEX::DocumentView::qt_emit( int _id, QUObject* _o ) -{ - return QMainWindow::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::DocumentView::qt_property( int id, int f, QVariant* v) -{ - return QMainWindow::qt_property( id, f, v); -} - -bool IAEX::DocumentView::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_imagecell.cpp b/OMNotebook_QT3/OMNotebook/moc_imagecell.cpp deleted file mode 100644 index a8f1bd016e7..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_imagecell.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** IAEX::ImageCell meta object code from reading C++ file 'imagecell.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_imagecell.cpp,v 1.6 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "imagecell.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::ImageCell::className() const -{ - return "IAEX::ImageCell"; -} - -QMetaObject *IAEX::ImageCell::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__ImageCell( "IAEX::ImageCell", &IAEX::ImageCell::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::ImageCell::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::ImageCell", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::ImageCell::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::ImageCell", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::ImageCell::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = Cell::staticMetaObject(); - metaObj = QMetaObject::new_metaobject( - "IAEX::ImageCell", parentObject, - 0, 0, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__ImageCell.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::ImageCell::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::ImageCell" ) ) - return this; - return Cell::qt_cast( clname ); -} - -bool IAEX::ImageCell::qt_invoke( int _id, QUObject* _o ) -{ - return Cell::qt_invoke(_id,_o); -} - -bool IAEX::ImageCell::qt_emit( int _id, QUObject* _o ) -{ - return Cell::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::ImageCell::qt_property( int id, int f, QVariant* v) -{ - return Cell::qt_property( id, f, v); -} - -bool IAEX::ImageCell::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_inputcell.cpp b/OMNotebook_QT3/OMNotebook/moc_inputcell.cpp deleted file mode 100644 index bb3d0bb06a9..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_inputcell.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** IAEX::InputCell meta object code from reading C++ file 'inputcell.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_inputcell.cpp,v 1.7 2005/10/26 07:24:36 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "inputcell.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::InputCell::className() const -{ - return "IAEX::InputCell"; -} - -QMetaObject *IAEX::InputCell::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__InputCell( "IAEX::InputCell", &IAEX::InputCell::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::InputCell::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::InputCell", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::InputCell::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::InputCell", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::InputCell::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = Cell::staticMetaObject(); - static const QUMethod slot_0 = {"eval", 0, 0 }; - static const QUMethod slot_1 = {"contentChanged", 0, 0 }; - static const QUParameter param_slot_2[] = { - { "closed", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_2 = {"setClosed", 1, param_slot_2 }; - static const QUParameter param_slot_3[] = { - { "focus", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_3 = {"setFocus", 1, param_slot_3 }; - static const QUParameter param_slot_4[] = { - { 0, &static_QUType_int, 0, QUParameter::In }, - { 0, &static_QUType_int, 0, QUParameter::In } - }; - static const QUMethod slot_4 = {"clickEvent", 2, param_slot_4 }; - static const QUParameter param_slot_5[] = { - { "style", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_5 = {"setStyle", 1, param_slot_5 }; - static const QUParameter param_slot_6[] = { - { "name", &static_QUType_QString, 0, QUParameter::In }, - { "val", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_6 = {"setStyle", 2, param_slot_6 }; - static const QMetaData slot_tbl[] = { - { "eval()", &slot_0, QMetaData::Public }, - { "contentChanged()", &slot_1, QMetaData::Public }, - { "setClosed(const bool)", &slot_2, QMetaData::Public }, - { "setFocus(const bool)", &slot_3, QMetaData::Public }, - { "clickEvent(int,int)", &slot_4, QMetaData::Public }, - { "setStyle(const QString&)", &slot_5, QMetaData::Public }, - { "setStyle(const QString&,const QString&)", &slot_6, QMetaData::Public } - }; - static const QUMethod signal_0 = {"textChanged", 0, 0 }; - static const QMetaData signal_tbl[] = { - { "textChanged()", &signal_0, QMetaData::Public } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::InputCell", parentObject, - slot_tbl, 7, - signal_tbl, 1, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__InputCell.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::InputCell::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::InputCell" ) ) - return this; - return Cell::qt_cast( clname ); -} - -// SIGNAL textChanged -void IAEX::InputCell::textChanged() -{ - activate_signal( staticMetaObject()->signalOffset() + 0 ); -} - -bool IAEX::InputCell::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: eval(); break; - case 1: contentChanged(); break; - case 2: setClosed((const bool)static_QUType_bool.get(_o+1)); break; - case 3: setFocus((const bool)static_QUType_bool.get(_o+1)); break; - case 4: clickEvent((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; - case 5: setStyle((const QString&)static_QUType_QString.get(_o+1)); break; - case 6: setStyle((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2)); break; - default: - return Cell::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::InputCell::qt_emit( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->signalOffset() ) { - case 0: textChanged(); break; - default: - return Cell::qt_emit(_id,_o); - } - return TRUE; -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::InputCell::qt_property( int id, int f, QVariant* v) -{ - return Cell::qt_property( id, f, v); -} - -bool IAEX::InputCell::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_notebook.cpp b/OMNotebook_QT3/OMNotebook/moc_notebook.cpp deleted file mode 100644 index 32d515794ca..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_notebook.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** IAEX::NotebookWindow meta object code from reading C++ file 'notebook.h' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_notebook.cpp,v 1.7 2005/10/26 07:24:37 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "notebook.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::NotebookWindow::className() const -{ - return "IAEX::NotebookWindow"; -} - -QMetaObject *IAEX::NotebookWindow::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__NotebookWindow( "IAEX::NotebookWindow", &IAEX::NotebookWindow::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::NotebookWindow::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::NotebookWindow", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::NotebookWindow::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::NotebookWindow", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::NotebookWindow::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = DocumentView::staticMetaObject(); - static const QUMethod slot_0 = {"setSelectedStyle", 0, 0 }; - static const QUMethod slot_1 = {"updateStyleMenu", 0, 0 }; - static const QUMethod slot_2 = {"newFile", 0, 0 }; - static const QUMethod slot_3 = {"openFile", 0, 0 }; - static const QUParameter param_slot_4[] = { - { "filename", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_4 = {"openFile", 1, param_slot_4 }; - static const QUMethod slot_5 = {"closeFile", 0, 0 }; - static const QUMethod slot_6 = {"aboutQTNotebook", 0, 0 }; - static const QUMethod slot_7 = {"saveas", 0, 0 }; - static const QUMethod slot_8 = {"save", 0, 0 }; - static const QUParameter param_slot_9[] = { - { "action", &static_QUType_ptr, "QAction", QUParameter::In } - }; - static const QUMethod slot_9 = {"changeStyle", 1, param_slot_9 }; - static const QUMethod slot_10 = {"changeStyle", 0, 0 }; - static const QUMethod slot_11 = {"createNewCell", 0, 0 }; - static const QUMethod slot_12 = {"deleteCurrentCell", 0, 0 }; - static const QUMethod slot_13 = {"cutCell", 0, 0 }; - static const QUMethod slot_14 = {"copyCell", 0, 0 }; - static const QUMethod slot_15 = {"pasteCell", 0, 0 }; - static const QUMethod slot_16 = {"moveCursorUp", 0, 0 }; - static const QUMethod slot_17 = {"moveCursorDown", 0, 0 }; - static const QUMethod slot_18 = {"groupCellsAction", 0, 0 }; - static const QUMethod slot_19 = {"inputCellsAction", 0, 0 }; - static const QMetaData slot_tbl[] = { - { "setSelectedStyle()", &slot_0, QMetaData::Public }, - { "updateStyleMenu()", &slot_1, QMetaData::Public }, - { "newFile()", &slot_2, QMetaData::Private }, - { "openFile()", &slot_3, QMetaData::Private }, - { "openFile(const QString&)", &slot_4, QMetaData::Private }, - { "closeFile()", &slot_5, QMetaData::Private }, - { "aboutQTNotebook()", &slot_6, QMetaData::Private }, - { "saveas()", &slot_7, QMetaData::Private }, - { "save()", &slot_8, QMetaData::Private }, - { "changeStyle(QAction*)", &slot_9, QMetaData::Private }, - { "changeStyle()", &slot_10, QMetaData::Private }, - { "createNewCell()", &slot_11, QMetaData::Private }, - { "deleteCurrentCell()", &slot_12, QMetaData::Private }, - { "cutCell()", &slot_13, QMetaData::Private }, - { "copyCell()", &slot_14, QMetaData::Private }, - { "pasteCell()", &slot_15, QMetaData::Private }, - { "moveCursorUp()", &slot_16, QMetaData::Private }, - { "moveCursorDown()", &slot_17, QMetaData::Private }, - { "groupCellsAction()", &slot_18, QMetaData::Private }, - { "inputCellsAction()", &slot_19, QMetaData::Private } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::NotebookWindow", parentObject, - slot_tbl, 20, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__NotebookWindow.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::NotebookWindow::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::NotebookWindow" ) ) - return this; - return DocumentView::qt_cast( clname ); -} - -bool IAEX::NotebookWindow::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: setSelectedStyle(); break; - case 1: updateStyleMenu(); break; - case 2: newFile(); break; - case 3: openFile(); break; - case 4: openFile((const QString&)static_QUType_QString.get(_o+1)); break; - case 5: closeFile(); break; - case 6: aboutQTNotebook(); break; - case 7: saveas(); break; - case 8: save(); break; - case 9: changeStyle((QAction*)static_QUType_ptr.get(_o+1)); break; - case 10: changeStyle(); break; - case 11: createNewCell(); break; - case 12: deleteCurrentCell(); break; - case 13: cutCell(); break; - case 14: copyCell(); break; - case 15: pasteCell(); break; - case 16: moveCursorUp(); break; - case 17: moveCursorDown(); break; - case 18: groupCellsAction(); break; - case 19: inputCellsAction(); break; - default: - return DocumentView::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::NotebookWindow::qt_emit( int _id, QUObject* _o ) -{ - return DocumentView::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::NotebookWindow::qt_property( int id, int f, QVariant* v) -{ - return DocumentView::qt_property( id, f, v); -} - -bool IAEX::NotebookWindow::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_omc_communicator.cpp b/OMNotebook_QT3/OMNotebook/moc_omc_communicator.cpp deleted file mode 100644 index b5e0e1bad72..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_omc_communicator.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** OmcCommunicator meta object code from reading C++ file 'omc_communicator.hpp' -** -** Created: ti 25. okt 11:26:39 2005 -** by: The Qt MOC ($Id: moc_omc_communicator.cpp,v 1.2 2005/10/26 07:24:37 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "omc_communicator.hpp" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *OmcCommunicator::className() const -{ - return "OmcCommunicator"; -} - -QMetaObject *OmcCommunicator::metaObj = 0; -static QMetaObjectCleanUp cleanUp_OmcCommunicator( "OmcCommunicator", &OmcCommunicator::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString OmcCommunicator::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "OmcCommunicator", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString OmcCommunicator::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "OmcCommunicator", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* OmcCommunicator::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QObject::staticMetaObject(); - metaObj = QMetaObject::new_metaobject( - "OmcCommunicator", parentObject, - 0, 0, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_OmcCommunicator.setMetaObject( metaObj ); - return metaObj; -} - -void* OmcCommunicator::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "OmcCommunicator" ) ) - return this; - return QObject::qt_cast( clname ); -} - -bool OmcCommunicator::qt_invoke( int _id, QUObject* _o ) -{ - return QObject::qt_invoke(_id,_o); -} - -bool OmcCommunicator::qt_emit( int _id, QUObject* _o ) -{ - return QObject::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool OmcCommunicator::qt_property( int id, int f, QVariant* v) -{ - return QObject::qt_property( id, f, v); -} - -bool OmcCommunicator::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_smlinteractiveenvironment.cpp b/OMNotebook_QT3/OMNotebook/moc_smlinteractiveenvironment.cpp deleted file mode 100644 index 68d60c8f55a..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_smlinteractiveenvironment.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** IAEX::SmlInteractiveEnvironment meta object code from reading C++ file 'smlinteractiveenvironment.h' -** -** Created: ti 25. okt 11:26:38 2005 -** by: The Qt MOC ($Id: moc_smlinteractiveenvironment.cpp,v 1.6 2005/10/26 07:24:37 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "smlinteractiveenvironment.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::SmlInteractiveEnvironment::className() const -{ - return "IAEX::SmlInteractiveEnvironment"; -} - -QMetaObject *IAEX::SmlInteractiveEnvironment::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__SmlInteractiveEnvironment( "IAEX::SmlInteractiveEnvironment", &IAEX::SmlInteractiveEnvironment::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::SmlInteractiveEnvironment::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::SmlInteractiveEnvironment", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::SmlInteractiveEnvironment::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::SmlInteractiveEnvironment", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::SmlInteractiveEnvironment::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QObject::staticMetaObject(); - static const QUMethod slot_0 = {"updateOutput", 0, 0 }; - static const QUMethod slot_1 = {"updateErrorOutput", 0, 0 }; - static const QMetaData slot_tbl[] = { - { "updateOutput()", &slot_0, QMetaData::Public }, - { "updateErrorOutput()", &slot_1, QMetaData::Public } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::SmlInteractiveEnvironment", parentObject, - slot_tbl, 2, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__SmlInteractiveEnvironment.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::SmlInteractiveEnvironment::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::SmlInteractiveEnvironment" ) ) - return this; - if ( !qstrcmp( clname, "InputCellDelegate" ) ) - return (InputCellDelegate*)this; - return QObject::qt_cast( clname ); -} - -bool IAEX::SmlInteractiveEnvironment::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: updateOutput(); break; - case 1: updateErrorOutput(); break; - default: - return QObject::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::SmlInteractiveEnvironment::qt_emit( int _id, QUObject* _o ) -{ - return QObject::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::SmlInteractiveEnvironment::qt_property( int id, int f, QVariant* v) -{ - return QObject::qt_property( id, f, v); -} - -bool IAEX::SmlInteractiveEnvironment::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_stylesheet.cpp b/OMNotebook_QT3/OMNotebook/moc_stylesheet.cpp deleted file mode 100644 index 1ee63f5eec9..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_stylesheet.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** IAEX::Stylesheet meta object code from reading C++ file 'stylesheet.h' -** -** Created: ti 25. okt 11:26:38 2005 -** by: The Qt MOC ($Id: moc_stylesheet.cpp,v 1.6 2005/10/26 07:24:37 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "stylesheet.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::Stylesheet::className() const -{ - return "IAEX::Stylesheet"; -} - -QMetaObject *IAEX::Stylesheet::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__Stylesheet( "IAEX::Stylesheet", &IAEX::Stylesheet::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::Stylesheet::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::Stylesheet", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::Stylesheet::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::Stylesheet", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::Stylesheet::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QObject::staticMetaObject(); - metaObj = QMetaObject::new_metaobject( - "IAEX::Stylesheet", parentObject, - 0, 0, - 0, 0, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__Stylesheet.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::Stylesheet::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::Stylesheet" ) ) - return this; - return QObject::qt_cast( clname ); -} - -bool IAEX::Stylesheet::qt_invoke( int _id, QUObject* _o ) -{ - return QObject::qt_invoke(_id,_o); -} - -bool IAEX::Stylesheet::qt_emit( int _id, QUObject* _o ) -{ - return QObject::qt_emit(_id,_o); -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::Stylesheet::qt_property( int id, int f, QVariant* v) -{ - return QObject::qt_property( id, f, v); -} - -bool IAEX::Stylesheet::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_textcell.cpp b/OMNotebook_QT3/OMNotebook/moc_textcell.cpp deleted file mode 100644 index 3fe1604eb16..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_textcell.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/**************************************************************************** -** IAEX::TextCell meta object code from reading C++ file 'textcell.h' -** -** Created: ti 25. okt 11:26:38 2005 -** by: The Qt MOC ($Id: moc_textcell.cpp,v 1.6 2005/10/26 07:24:37 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "textcell.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::TextCell::className() const -{ - return "IAEX::TextCell"; -} - -QMetaObject *IAEX::TextCell::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__TextCell( "IAEX::TextCell", &IAEX::TextCell::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::TextCell::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::TextCell", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::TextCell::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::TextCell", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::TextCell::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = Cell::staticMetaObject(); - static const QUParameter param_slot_0[] = { - { "para", &static_QUType_int, 0, QUParameter::In }, - { "pos", &static_QUType_int, 0, QUParameter::In } - }; - static const QUMethod slot_0 = {"clickEvent", 2, param_slot_0 }; - static const QUParameter param_slot_1[] = { - { "readonly", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_1 = {"setReadOnly", 1, param_slot_1 }; - static const QUParameter param_slot_2[] = { - { "text", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_2 = {"setText", 1, param_slot_2 }; - static const QUParameter param_slot_3[] = { - { "style", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_3 = {"setStyle", 1, param_slot_3 }; - static const QUParameter param_slot_4[] = { - { "name", &static_QUType_QString, 0, QUParameter::In }, - { "val", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_4 = {"setStyle", 2, param_slot_4 }; - static const QUParameter param_slot_5[] = { - { "focus", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_5 = {"setFocus", 1, param_slot_5 }; - static const QUParameter param_slot_6[] = { - { "expr", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_6 = {"viewExpression", 1, param_slot_6 }; - static const QUMethod slot_7 = {"contentChanged", 0, 0 }; - static const QUParameter param_slot_8[] = { - { "url", &static_QUType_ptr, "QUrl", QUParameter::In } - }; - static const QUMethod slot_8 = {"openLinkInternal", 1, param_slot_8 }; - static const QUMethod slot_9 = {"textChangedInternal", 0, 0 }; - static const QMetaData slot_tbl[] = { - { "clickEvent(int,int)", &slot_0, QMetaData::Public }, - { "setReadOnly(const bool)", &slot_1, QMetaData::Public }, - { "setText(QString)", &slot_2, QMetaData::Public }, - { "setStyle(const QString&)", &slot_3, QMetaData::Public }, - { "setStyle(const QString&,const QString&)", &slot_4, QMetaData::Public }, - { "setFocus(const bool)", &slot_5, QMetaData::Public }, - { "viewExpression(const bool)", &slot_6, QMetaData::Public }, - { "contentChanged()", &slot_7, QMetaData::Protected }, - { "openLinkInternal(QUrl*)", &slot_8, QMetaData::Protected }, - { "textChangedInternal()", &slot_9, QMetaData::Protected } - }; - static const QUMethod signal_0 = {"textChanged", 0, 0 }; - static const QMetaData signal_tbl[] = { - { "textChanged()", &signal_0, QMetaData::Public } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::TextCell", parentObject, - slot_tbl, 10, - signal_tbl, 1, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__TextCell.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::TextCell::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::TextCell" ) ) - return this; - return Cell::qt_cast( clname ); -} - -// SIGNAL textChanged -void IAEX::TextCell::textChanged() -{ - activate_signal( staticMetaObject()->signalOffset() + 0 ); -} - -bool IAEX::TextCell::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: clickEvent((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; - case 1: setReadOnly((const bool)static_QUType_bool.get(_o+1)); break; - case 2: setText((QString)static_QUType_QString.get(_o+1)); break; - case 3: setStyle((const QString&)static_QUType_QString.get(_o+1)); break; - case 4: setStyle((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2)); break; - case 5: setFocus((const bool)static_QUType_bool.get(_o+1)); break; - case 6: viewExpression((const bool)static_QUType_bool.get(_o+1)); break; - case 7: contentChanged(); break; - case 8: openLinkInternal((QUrl*)static_QUType_ptr.get(_o+1)); break; - case 9: textChangedInternal(); break; - default: - return Cell::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::TextCell::qt_emit( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->signalOffset() ) { - case 0: textChanged(); break; - default: - return Cell::qt_emit(_id,_o); - } - return TRUE; -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::TextCell::qt_property( int id, int f, QVariant* v) -{ - return Cell::qt_property( id, f, v); -} - -bool IAEX::TextCell::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES - - -const char *IAEX::MyTextBrowser::className() const -{ - return "IAEX::MyTextBrowser"; -} - -QMetaObject *IAEX::MyTextBrowser::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__MyTextBrowser( "IAEX::MyTextBrowser", &IAEX::MyTextBrowser::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::MyTextBrowser::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::MyTextBrowser", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::MyTextBrowser::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::MyTextBrowser", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::MyTextBrowser::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QTextBrowser::staticMetaObject(); - static const QUParameter param_slot_0[] = { - { "name", &static_QUType_QString, 0, QUParameter::In } - }; - static const QUMethod slot_0 = {"setSource", 1, param_slot_0 }; - static const QMetaData slot_tbl[] = { - { "setSource(const QString&)", &slot_0, QMetaData::Public } - }; - static const QUParameter param_signal_0[] = { - { 0, &static_QUType_ptr, "QUrl", QUParameter::In } - }; - static const QUMethod signal_0 = {"openLink", 1, param_signal_0 }; - static const QMetaData signal_tbl[] = { - { "openLink(QUrl*)", &signal_0, QMetaData::Public } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::MyTextBrowser", parentObject, - slot_tbl, 1, - signal_tbl, 1, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__MyTextBrowser.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::MyTextBrowser::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::MyTextBrowser" ) ) - return this; - return QTextBrowser::qt_cast( clname ); -} - -#include -#include - -// SIGNAL openLink -void IAEX::MyTextBrowser::openLink( QUrl* t0 ) -{ - if ( signalsBlocked() ) - return; - QConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 0 ); - if ( !clist ) - return; - QUObject o[2]; - static_QUType_ptr.set(o+1,t0); - activate_signal( clist, o ); -} - -bool IAEX::MyTextBrowser::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: setSource((const QString&)static_QUType_QString.get(_o+1)); break; - default: - return QTextBrowser::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::MyTextBrowser::qt_emit( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->signalOffset() ) { - case 0: openLink((QUrl*)static_QUType_ptr.get(_o+1)); break; - default: - return QTextBrowser::qt_emit(_id,_o); - } - return TRUE; -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::MyTextBrowser::qt_property( int id, int f, QVariant* v) -{ - return QTextBrowser::qt_property( id, f, v); -} - -bool IAEX::MyTextBrowser::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/moc_treeview.cpp b/OMNotebook_QT3/OMNotebook/moc_treeview.cpp deleted file mode 100644 index 94020ad62d1..00000000000 --- a/OMNotebook_QT3/OMNotebook/moc_treeview.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** IAEX::TreeView meta object code from reading C++ file 'treeview.h' -** -** Created: ti 25. okt 11:26:38 2005 -** by: The Qt MOC ($Id: moc_treeview.cpp,v 1.6 2005/10/26 07:24:37 x05andfe Exp $) -** -** WARNING! All changes made in this file will be lost! -*****************************************************************************/ - -#undef QT_NO_COMPAT -#include "treeview.h" -#include -#include - -#include -#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26) -#error "This file was generated using the moc from 3.3.5. It" -#error "cannot be used with the include files from this version of Qt." -#error "(The moc has changed too much.)" -#endif - -const char *IAEX::TreeView::className() const -{ - return "IAEX::TreeView"; -} - -QMetaObject *IAEX::TreeView::metaObj = 0; -static QMetaObjectCleanUp cleanUp_IAEX__TreeView( "IAEX::TreeView", &IAEX::TreeView::staticMetaObject ); - -#ifndef QT_NO_TRANSLATION -QString IAEX::TreeView::tr( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::TreeView", s, c, QApplication::DefaultCodec ); - else - return QString::fromLatin1( s ); -} -#ifndef QT_NO_TRANSLATION_UTF8 -QString IAEX::TreeView::trUtf8( const char *s, const char *c ) -{ - if ( qApp ) - return qApp->translate( "IAEX::TreeView", s, c, QApplication::UnicodeUTF8 ); - else - return QString::fromUtf8( s ); -} -#endif // QT_NO_TRANSLATION_UTF8 - -#endif // QT_NO_TRANSLATION - -QMetaObject* IAEX::TreeView::staticMetaObject() -{ - if ( metaObj ) - return metaObj; - QMetaObject* parentObject = QWidget::staticMetaObject(); - static const QUParameter param_slot_0[] = { - { "closed", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_0 = {"setClosed", 1, param_slot_0 }; - static const QUParameter param_slot_1[] = { - { "sel", &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod slot_1 = {"setSelected", 1, param_slot_1 }; - static const QMetaData slot_tbl[] = { - { "setClosed(const bool)", &slot_0, QMetaData::Public }, - { "setSelected(const bool)", &slot_1, QMetaData::Public } - }; - static const QUParameter param_signal_0[] = { - { 0, &static_QUType_bool, 0, QUParameter::In } - }; - static const QUMethod signal_0 = {"becomeSelected", 1, param_signal_0 }; - static const QMetaData signal_tbl[] = { - { "becomeSelected(bool)", &signal_0, QMetaData::Protected } - }; - metaObj = QMetaObject::new_metaobject( - "IAEX::TreeView", parentObject, - slot_tbl, 2, - signal_tbl, 1, -#ifndef QT_NO_PROPERTIES - 0, 0, - 0, 0, -#endif // QT_NO_PROPERTIES - 0, 0 ); - cleanUp_IAEX__TreeView.setMetaObject( metaObj ); - return metaObj; -} - -void* IAEX::TreeView::qt_cast( const char* clname ) -{ - if ( !qstrcmp( clname, "IAEX::TreeView" ) ) - return this; - return QWidget::qt_cast( clname ); -} - -// SIGNAL becomeSelected -void IAEX::TreeView::becomeSelected( bool t0 ) -{ - activate_signal_bool( staticMetaObject()->signalOffset() + 0, t0 ); -} - -bool IAEX::TreeView::qt_invoke( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->slotOffset() ) { - case 0: setClosed((const bool)static_QUType_bool.get(_o+1)); break; - case 1: setSelected((const bool)static_QUType_bool.get(_o+1)); break; - default: - return QWidget::qt_invoke( _id, _o ); - } - return TRUE; -} - -bool IAEX::TreeView::qt_emit( int _id, QUObject* _o ) -{ - switch ( _id - staticMetaObject()->signalOffset() ) { - case 0: becomeSelected((bool)static_QUType_bool.get(_o+1)); break; - default: - return QWidget::qt_emit(_id,_o); - } - return TRUE; -} -#ifndef QT_NO_PROPERTIES - -bool IAEX::TreeView::qt_property( int id, int f, QVariant* v) -{ - return QWidget::qt_property( id, f, v); -} - -bool IAEX::TreeView::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; } -#endif // QT_NO_PROPERTIES diff --git a/OMNotebook_QT3/OMNotebook/modelicacolors.xml b/OMNotebook_QT3/OMNotebook/modelicacolors.xml deleted file mode 100644 index b65f6629cbd..00000000000 --- a/OMNotebook_QT3/OMNotebook/modelicacolors.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OMNotebook_QT3/OMNotebook/modelicahighlighter.h b/OMNotebook_QT3/OMNotebook/modelicahighlighter.h deleted file mode 100644 index f082075647c..00000000000 --- a/OMNotebook_QT3/OMNotebook/modelicahighlighter.h +++ /dev/null @@ -1,259 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _MODELICASYNTAXHIGHLIGHTER_H -#define _MODELICASYNTAXHIGHLIGHTER_H - -#include -#include - -#include -#include -#include -#include - -#include "syntaxhighlighter.h" -#include "syntax_highlighter.hpp" - -namespace IAEX -{ - /*! \class ModelicaHighlighter - * - * \brief Implements syntaxhighlightning for Modelica code. - * - * Implements syntaxhighlightning for Modelica code. Uses Daniel - * Hedbergs ModelicaSyntaxHighlighter class to implement the - * syntaxhighlightning functionality. To change colors edit the - * modelicacolors.xml - */ - class ModelicaHighlighter : public SyntaxHighlighter - { - public: - ModelicaHighlighter() - : highlighter_(0), textEdit_(0) - { - filename_ = QString("modelicacolors.xml"); - initializeColors(); - } - virtual ~ModelicaHighlighter(){} - void setTextEdit(QTextEdit *textEdit){ textEdit_ = textEdit;} - virtual void rehighlight() - { - if(!highlighter_) - { - if(textEdit_) - highlighter_ = new ModelicaSyntaxHighlighter(textEdit_, colors_); - else - throw runtime_error("ModelicaHighlighter: No QTextEdit."); - } - - highlighter_->rehighlight(); - } - - private: - void initializeColors() - { - QDomDocument doc("ModelicaColors"); - - QFile file(filename_); - - if(!file.open(IO_ReadOnly)) - throw std::exception( "Could not open " + filename_ ); - - if(!doc.setContent(&file)) - { - file.close(); - throw std::exception( "Could not understand content of " + filename_ ); - } - file.close(); - - QDomElement root = doc.documentElement(); - QDomNode n = root.firstChild(); - - while(!n.isNull()) - { - QDomElement e = n.toElement(); - if(!e.isNull()) - { - if(e.tagName() == "textForeground") - { - colors_.textForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "textBackground") - { - colors_.textBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "typeForeground") - { - colors_.typeForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "typeBackground") - { - colors_.typeBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "keywordForeground") - { - colors_.keywordForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "keywordBackground") - { - colors_.keywordBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "functionNameForeground") - { - colors_.functionNameForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "functionNameBackground") - { - colors_.functionNameBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "constantForeground") - { - colors_.constantForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "constantBackground") - { - colors_.constantBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "warningForeground") - { - colors_.warningForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "warningBackground") - { - colors_.warningBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "builtInForeground") - { - colors_.builtInForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "builtInBackground") - { - colors_.builtInBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "variableNameForeground") - { - colors_.variableNameForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "variableNameBackground") - { - colors_.variableNameBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "stringForeground") - { - colors_.stringForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "stringBackground") - { - colors_.stringBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "commentForeground") - { - colors_.commentForeground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else if(e.tagName() == "commentBackground") - { - colors_.commentBackground_ = QColor(atoi(e.attribute("red","")), - atoi(e.attribute("green","")), - atoi(e.attribute("blue",""))); - } - else - { - //Move on. - } - } - n = n.nextSibling(); - } - } - - private: - TextEditorFontAndColors colors_; - QSyntaxHighlighter *highlighter_; - QTextEdit *textEdit_; - QString filename_; - }; -} - -#endif diff --git a/OMNotebook_QT3/OMNotebook/nbparser.h b/OMNotebook_QT3/OMNotebook/nbparser.h deleted file mode 100644 index 40cf6d7f946..00000000000 --- a/OMNotebook_QT3/OMNotebook/nbparser.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _NBPARSER_H -#define _NBPARSER_H - -#include "cell.h" - -namespace IAEX -{ - /*! \interface NBParser - * - * This is an interface for different parsers. - */ - class NBParser - { - public: - virtual Cell *parse() = 0; - }; -}; -#endif diff --git a/OMNotebook_QT3/OMNotebook/notebook.cpp b/OMNotebook_QT3/OMNotebook/notebook.cpp deleted file mode 100644 index 0cc2b3bd4e9..00000000000 --- a/OMNotebook_QT3/OMNotebook/notebook.cpp +++ /dev/null @@ -1,689 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file notebook.cpp - * \author Ingemar Axelsson - * \date 2005-02-07 - */ - -#ifndef _NOTEBOOK_HH -#define _NOTEBOOK_HH - -//STD Headers -#include -#include -#include - -//QT Headers -#include -#include -#include -#include -#include -#include - -//IAEX Headers -#include "notebook.h" -#include "stylesheet.h" -#include "command.h" -#include "notebookcommands.h" -#include "cursorcommands.h" -#include "cellcommands.h" -#include "celldocument.h" - - -using namespace std; - -namespace IAEX{ - - /*! \class NotebookWindow - * \brief This class describes a mainwindow using the CellDocument - * - * This is the main applicationwindow. It contains of a menu, a - * toolbar, a statusbar and a workspace. The workspace will contain a - * celldocument view. - * - * - * - * \todo Add exceptions instead of error printings. - * - * \todo Make edit work correctly or remove it. - * - * \todo Implement menus for changing cellstyles. Also add menus - * for changing font style and size of selected text. Read the - * stylesheet file and create menus for every single style. Also - * think through what will happen if a section and subsection is - * created? Should a new CellGroup be added then? - * - * \todo Implement commands for deletion and makeing of new - * cells. This allows undo/redo. - * - * \todo implement a timer that saves a document every 5 minutes - * or so. - * - * \todo Implement section numbering. Could be done with some kind - * of vistors. - * - * - * \bug Segmentation fault when quit. Only sometimes. - */ - - NotebookWindow::NotebookWindow(Document *subject, - const QString &filename, QWidget *parent, const char *name) - : DocumentView(parent, name),//QMainWindow(0,0,WDestructiveClose), - subject_(subject), - filename_(filename), - app_( subject->application() ) //AF - { - subject_->attach(this); - - //reimplement in some way. - //connect(subject_, SIGNAL(cursorChanged()), - // this, SLOT(setSelectedStyle())); - - createMenu(); - createEditMenu(); - createCellMenu(); - createFormatMenu(); - createAboutMenu(); - - update(); - - if( filename_ != QString::null ) - qDebug( filename_ ); - - setCaption(QString("OMNotebook: ").append( strippedFileName(filename_) )); - statusBar()->message("Ready"); - resize(800, 600); - } - - NotebookWindow::~NotebookWindow() - { - subject_->detach(this); - subject_ = 0; - //delete document_; - } - - void NotebookWindow::update() - { - QFrame *mainWidget = subject_->getState(); - mainWidget->reparent(this, QPoint(0,0)); - setCentralWidget(mainWidget); - mainWidget->show(); - } - - /*! \todo Add more information to the about dialog. - */ - void NotebookWindow::aboutQTNotebook() - { - QMessageBox::about(this, "OMNotebook", - "

Information about OMNotebook.

"); - } - - /*! \brief Method for creating all menus. - */ - void NotebookWindow::createMenu() - { - QAction *openFileAction = new QAction("Open", "&Open", CTRL+Key_O, this, "open"); - QObject::connect(openFileAction, SIGNAL(activated()), this, SLOT(openFile())); - QAction *closeFileAction = new QAction("Close","&Close", CTRL+Key_W, this,"close"); - QObject::connect(closeFileAction, SIGNAL(activated()), this, SLOT(close())); - - QAction *quitWindowAction = new QAction("Quit", "&Quit", ALT+Key_Q, this, "quit"); - QObject::connect(quitWindowAction, SIGNAL(activated()),qApp, SLOT(closeAllWindows())); - - QAction * saveAsAction = new QAction("Save As...","&Save As...", 0, this, "saveas"); - QObject::connect(saveAsAction, SIGNAL(activated()), this, SLOT(saveas())); - QAction * saveAction = new QAction("Save","Save", CTRL+Key_S, this, "save"); - QObject::connect(saveAction, SIGNAL(activated()), this, SLOT(save())); - QAction * newAction = new QAction("New...","&New...", CTRL+Key_N, this, "newdoc"); - QObject::connect(newAction, SIGNAL(activated()), this, SLOT(newFile())); - - fileMenu = new QPopupMenu(this); - menuBar()->insertItem("&File", fileMenu); - newAction->addTo(fileMenu); - openFileAction->addTo(fileMenu); - saveAction->addTo(fileMenu); - saveAsAction->addTo(fileMenu); - closeFileAction->addTo(fileMenu); - fileMenu->insertSeparator(6); - quitWindowAction->addTo(fileMenu); - //treeviewToggle->addTo(fileMenu); - } - - void NotebookWindow::createAboutMenu() - { - QAction *aboutAction = new QAction("About", "&About", 0, this, "about"); - QObject::connect(aboutAction, SIGNAL(activated()), this, SLOT(aboutQTNotebook())); - - aboutMenu = new QPopupMenu(this); - menuBar()->insertItem("&Help", aboutMenu); - aboutAction->addTo(aboutMenu); - } - - /*! \todo Make the menu correspond to the current cell. - */ - void NotebookWindow::createCellMenu() - { - - QAction *cutCellAction = new QAction("Cut cell", "&Cut Cell", - CTRL+SHIFT+Key_X, this, "cutcell"); - QObject::connect(cutCellAction, SIGNAL(activated()), - this, SLOT(cutCell())); - - QAction *copyCellAction = new QAction("Copy cell", "&Copy Cell", - CTRL+SHIFT+Key_C, this, "copycell"); - QObject::connect(copyCellAction, SIGNAL(activated()), - this, SLOT(copyCell())); - - QAction *pasteCellAction = new QAction("Paste cell", "&Paste Cell", - CTRL+SHIFT+Key_V, this, "pastecell"); - QObject::connect(pasteCellAction, SIGNAL(activated()), - this, SLOT(pasteCell())); - - QAction *addCellAction = new QAction("Add cell", "&Add Cell", CTRL+Key_A, - this, "addcell"); - QObject::connect(addCellAction, SIGNAL(activated()), - this, SLOT(createNewCell())); - - QAction *deleteCellAction = new QAction("Delete cell", "&Delete Cell", - CTRL+SHIFT+Key_D, this, "deletecell"); - QObject::connect(deleteCellAction, SIGNAL(activated()), - this, SLOT(deleteCurrentCell())); - - QAction *nextCellAction = new QAction("next cell", "&Next Cell", - 0, this, "nextcell"); - QObject::connect(nextCellAction, SIGNAL(activated()), - this, SLOT(moveCursorDown())); - QAction *previousCellAction = new QAction("previous cell", "&Previous Cell", - 0, this, "prevoiscell"); - QObject::connect(previousCellAction, SIGNAL(activated()), - this, SLOT(moveCursorUp())); - - cellMenu = new QPopupMenu(this); - menuBar()->insertItem("&Cell", cellMenu); - - cutCellAction->addTo(cellMenu); - copyCellAction->addTo(cellMenu); - pasteCellAction->addTo(cellMenu); - - addCellAction->addTo(cellMenu); - deleteCellAction->addTo(cellMenu); - nextCellAction->addTo(cellMenu); - previousCellAction->addTo(cellMenu); - cellMenu->insertSeparator(3); - cellMenu->insertSeparator(5); - } - - void NotebookWindow::createFormatMenu() - { - //Create style menus. - QActionGroup *stylesgroup = new QActionGroup(this, 0, true); - - // 2005-10-03 AF, Add this check if the stylesheet file exist - Stylesheet *sheet; - try - { - sheet = Stylesheet::instance("stylesheet.xml"); - } - catch( exception &e ) - { - QMessageBox::warning( this, "Error", e.what(), "OK" ); - exit(-1); - } - - vector styles = sheet->getAvailableStyles(); - - formatMenu = new QPopupMenu(this); - - //QPopupMenu *styleMenu = new QPopupMenu(this); - - vector::iterator i = styles.begin(); - for(;i != styles.end(); ++i) - { - QAction *tmp = new QAction((*i),(*i),0, this, (*i)); - tmp->setToggleAction(true); - stylesgroup->add(tmp); - //tmp->addTo(styleMenu); - styles_[(*i)] = tmp; - } - - QObject::connect(stylesgroup, SIGNAL(selected(QAction*)), - this, SLOT(changeStyle(QAction*))); - - stylesgroup->setUsesDropDown(true); - stylesgroup->setMenuText("Styles"); - - QAction *groupAction = new QAction("Group Cells", "&Group cells", - CTRL+SHIFT+Key_G, this, "groupcells"); - QObject::connect(groupAction, SIGNAL(activated()), - this, SLOT(groupCellsAction())); - QAction *inputAction = new QAction("Inputcell", "&Input cell", - CTRL+SHIFT+Key_I, this, "inputcells"); - QObject::connect(inputAction, SIGNAL(activated()), - this, SLOT(inputCellsAction())); - - QObject::connect(formatMenu, SIGNAL(aboutToShow()), - this, SLOT(updateStyleMenu())); - - menuBar()->insertItem("&Format", formatMenu); - stylesgroup->addTo(formatMenu); - groupAction->addTo(formatMenu); - inputAction->addTo(formatMenu); - - formatMenu->insertSeparator(1); - } - - /*! \bug map[] generates segfault in some cases, espesially if - * style not exists in map. - */ - void NotebookWindow::setSelectedStyle() - { - } - - void NotebookWindow::updateStyleMenu() - { - cerr << "Update Style Menu" << endl; - - const QString style = subject_->getCursor()->currentCell()->style(); - map::iterator cs = styles_.find(style); - - if(cs != styles_.end()) - { - (*cs).second->toggle(); //this activates something that it should not. - //styles_[style]->toggle(); - } - else - { - qDebug("No styles found"); - cs = styles_.begin(); - for(;cs != styles_.end(); ++cs) - { - (*cs).second->setOn(false); - } - } - } - - void NotebookWindow::createEditMenu() - { - QAction *undoAction = new QAction("Undo", "&Undo", 0, this, "undoaction"); - QAction *redoAction = new QAction("Redo", "&Redo", 0, this, "redoaction"); - QAction *searchAction = new QAction("Search", "&Search", 0, this, "search"); - QAction *showExprAction = new QAction("View Expression", "&View Expression",0, this, "viewexpr"); - - undoAction->setEnabled(false); - redoAction->setEnabled(false); - searchAction->setEnabled(false); - -// QObject::connect(undoAction, SIGNAL(activated()), -// this, SLOT(undoAction())); - - -// QAction *setEditableAction = new QAction("Edit cell", "&Edit Cell", 0, -// this, "editcell"); - showExprAction->setToggleAction(true); - showExprAction->setOn(false); - - QObject::connect(showExprAction, SIGNAL(toggled(bool)), - subject_, SLOT(showHTML(bool))); - -// QAction *undoAction = new QAction("Select All", "&Select All", 0, this, "selectall"); - - editMenu = new QPopupMenu(this); - menuBar()->insertItem("&Edit", editMenu); - undoAction->addTo(editMenu); - redoAction->addTo(editMenu); - editMenu->insertSeparator(3); - //setEditableAction->addTo(editMenu); - searchAction->addTo(editMenu); - showExprAction->addTo(editMenu); - } - - ///////SLOT IMPLEMENTATIONS /////////////////////////////////////// - - void NotebookWindow::changeStyle(QAction *action) - { - subject_->cursorChangeStyle(action->text()); - } - - void NotebookWindow::changeStyle() - { - cerr << "Ever called" << endl; - map::iterator cs = styles_.begin(); - for(;cs != styles_.end(); ++cs) - { - if((*cs).second->isOn()) - { - subject_->cursorChangeStyle((*cs).first); //Change style. - } - } - } - - void NotebookWindow::createNewCell() - { - subject_->cursorAddCell(); - } - - void NotebookWindow::deleteCurrentCell() - { - //subject_->executeCommand(new DeleteCurrentCellCommand()); - subject_->cursorDeleteCell(); - } - - void NotebookWindow::cutCell() - { - //subject_->executeCommand(new DeleteCurrentCellCommand()); - subject_->cursorCutCell(); - } - - void NotebookWindow::copyCell() - { - //subject_->executeCommand(new DeleteCurrentCellCommand()); - subject_->cursorCopyCell(); - } - - void NotebookWindow::pasteCell() - { - //subject_->executeCommand(new DeleteCurrentCellCommand()); - subject_->cursorPasteCell(); - } - - void NotebookWindow::moveCursorDown() - { - //subject_->executeCommand(new CursorMoveDownCommand()); - subject_->cursorStepDown(); - } - - void NotebookWindow::moveCursorUp() - { - //subject_->executeCommand(new CursorMoveUpCommand()); - subject_->cursorStepUp(); - } - - /*! \todo Some of this code should be moved to CellDocument - * instead. The filename should be connected to the document, not - * to the window for example. - */ - void NotebookWindow::saveas() - { - - QString filename = QFileDialog::getSaveFileName( - QString::null, - "Notebooks (*.xml)", - this, - "save file dialog", - "Choose a filename to save under"); - - if(!filename.isEmpty()) - { - // 2005-09-30 AF, add check for file end when saving. - // false because it's not supposted to be casesensitiv - if( -1 == filename.find( ".xml", 0, false ) ) - { - qDebug( ".xml not found" ); - filename.append( ".xml" ); - } - - statusBar()->message("Saving file"); - application()->commandCenter()->executeCommand( - new SaveDocumentCommand(subject_, filename)); - - filename_ = filename; - statusBar()->message("Ready"); - - //2005-09-22 AF: Added this code line: - setCaption(QString("OMNotebook: ").append( strippedFileName(filename_) )); - } - } - - /*! - * uses QT functionality to stripp the filepath and return only - * the filename. //AF - */ - QString NotebookWindow::strippedFileName( const QString &fullFileName ) - { - QString name = QFileInfo( fullFileName ).fileName(); - name.remove( "\n" ); - return name; - } - - /*! - * Added a check that controlls if the user have saved before, - * if not the function saveas should be used insted. //AF - */ - void NotebookWindow::save() - { - if( !subject_->isSaved() ) - { - saveas(); - } - else - { - // old code, without check use only this code //AF - statusBar()->message("Saving file"); - application()->commandCenter()->executeCommand(new SaveDocumentCommand(subject_)); - statusBar()->message("Ready"); - } - } - - /*! \brief Open a file. Shows a file dialog. - * - * \todo Add exceptions if the file could not be opened. - * - * \todo When opening a file a new documentwindow is opened. So lot - * of the code below is obsolete. - */ - void NotebookWindow::openFile(const QString &filename) - { - try - { - //Open a new document - - /* - 2005-09-22 AF: Removed this check - if(subject_->isOpen()) - closeFile(); - */ - - if(filename.isEmpty()) - { - //Show a dialog for choosing a file. - filename_ = QFileDialog::getOpenFileName( - QString::null, "Notebooks (*.xml *.nb)", - this,"file open", "Notebook -- File Open" ); - } - else - { - filename_ = filename; - } - - if(!filename_.isEmpty()) - { - //subject_->executeCommand(new OpenFileCommand(filename_)); - application()->commandCenter()->executeCommand(new OpenFileCommand(filename_)); - //setCaption("Qt Notebook: " + filename_); - //setCentralWidget(subject_); - //subject_->show(); - - //createSavingTimer(); - } - else - { - //Cancel pushed. Do nothing - } - } - catch(exception &e) - { - cerr << "In NotebookWindow(), Exception: " << e.what() << endl; - openFile(); - } - } - - - /*! - * \todo Not implemented yet. - * - * the function isn't used, this funciton should also close the - * window, if it isn't the last window //AF - */ - void NotebookWindow::closeFile() - { - subject_->executeCommand(new CloseFileCommand()); - - - //application()-> - - // if(savingTimer_) - // { - // savingTimer_->stop(); - // delete savingTimer_; - // } - //delete subject_; - } - - /*! - * \todo Fix the code when the window dosen't have any file open, - * the command should create the new document, not this function //AF - * - */ - void NotebookWindow::newFile() - { - /* - application()->commandCenter()->executeCommand(new NewFileCommand()); - - closeFile(); - - createSavingTimer(); - - subject_ = new CellDocument(this); - - connect(subject_, SIGNAL(cursorChanged()), - this, SLOT(setSelectedStyle())); - - setCentralWidget(subject_); - - subject_->show(); - */ - - // AF - if( subject_->isOpen() ) - { - // a file is open, open a new window with the new file //AF - application()->commandCenter()->executeCommand(new OpenFileCommand(QString::null)); - } - else - { - subject_ = new CellDocument(app_, QString::null); - subject_->executeCommand(new NewFileCommand()); - subject_->attach(this); - - update(); - } - } - - void NotebookWindow::groupCellsAction() - { - subject_->executeCommand(new MakeGroupCellCommand()); - } - - void NotebookWindow::inputCellsAction() - { - subject_->executeCommand(new CreateNewCellCommand("Input")); - } - - void NotebookWindow::createSavingTimer() - { - //start a saving timer. - savingTimer_ = new QTimer(); - savingTimer_->start(30000); - - connect(savingTimer_, SIGNAL(timeout()), - this, SLOT(save())); - } - - /*! - * Why does not keyPressEvents occur? They are eaten somewhere. - */ - void NotebookWindow::keyPressEvent(QKeyEvent *event) - { - } - - void NotebookWindow::keyReleaseEvent(QKeyEvent *event) - { - //qDebug( event->text() ); - - if(event->state() == Qt::ControlButton) - { - if(event->key() == Qt::Key_Up) - { - moveCursorUp(); - event->accept(); - } - else if(event->key() == Qt::Key_Down) - { - moveCursorDown(); - event->accept(); - } - else - { - QMainWindow::keyReleaseEvent(event); - } - } - else - { - QMainWindow::keyReleaseEvent(event); - } - } - - Application *NotebookWindow::application() - { - return subject_->application(); - } - -} - -#endif diff --git a/OMNotebook_QT3/OMNotebook/notebook.h b/OMNotebook_QT3/OMNotebook/notebook.h deleted file mode 100644 index 01efdc14cfc..00000000000 --- a/OMNotebook_QT3/OMNotebook/notebook.h +++ /dev/null @@ -1,142 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file notebook.h - * \author Ingemar Axelsson - * \date 2005-02-07 - */ - -#ifndef _NOTEBOOK_WINDOW_H -#define _NOTEBOOK_WINDOW_H - -//STD Headers -#include - -//QT Headers -#include -#include -#include -#include -#include -#include - -//IAEX Headers -#include "application.h" -#include "document.h" -//#include "celldocument.h" - -namespace IAEX{ - - class NotebookWindow : public DocumentView - { - Q_OBJECT - public: - NotebookWindow(Document *subject, const QString& filename=0, - QWidget *parent=0, const char *name=0); - virtual ~NotebookWindow(); - - virtual void update(); - Application *application(); - - public slots: - void setSelectedStyle(); - void updateStyleMenu(); - - protected: - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *event); - - private slots: - void newFile(); - void openFile(const QString &filename=0); - void closeFile(); - void aboutQTNotebook(); - void saveas(); - void save(); - void changeStyle(QAction *action); - void changeStyle(); - - void createNewCell(); - void deleteCurrentCell(); - void cutCell(); - void copyCell(); - void pasteCell(); - void moveCursorUp(); - void moveCursorDown(); - void groupCellsAction(); - void inputCellsAction(); - - private: - void createMenu(); - void createAboutMenu(); - void createCellMenu(); - void createEditMenu(); - void createFormatMenu(); - - QString strippedFileName( const QString &fullFileName ); //AF - - private: - void createSavingTimer(); - - QPopupMenu *fileMenu; - QPopupMenu *aboutMenu; - QPopupMenu *cellMenu; - QPopupMenu *formatMenu; - QPopupMenu *editMenu; - - //Change to Document. - Application *app_; - Document *subject_; - - //list opendocs_; - QString filename_; - - QTimer *savingTimer_; - map styles_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/notebookcommands.h b/OMNotebook_QT3/OMNotebook/notebookcommands.h deleted file mode 100644 index 7f418f7e6c2..00000000000 --- a/OMNotebook_QT3/OMNotebook/notebookcommands.h +++ /dev/null @@ -1,197 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _NOTEBOOK_COMMANDS_H -#define _NOTEBOOK_COMMANDS_H - -//STD Headers -#include -#include -#include - -//QT Headers -#include -#include - -#include "command.h" -#include "celldocument.h" -#include "application.h" -#include "serializingvisitor.h" - -using namespace std; - -namespace IAEX -{ - /*! \class SaveDocumentCommand - * \brief Saves the document. - */ - class SaveDocumentCommand : public Command - { - public: - SaveDocumentCommand(Document *doc) : doc_(doc) - { - filename_ = doc_->getFilename(); - } - SaveDocumentCommand(Document *doc, const QString &filename) - :filename_(filename), doc_(doc){} - virtual ~SaveDocumentCommand(){} - void execute() - { - try - { - QDomDocument doc("qtNotebook"); - QDomElement root = doc.createElement("Notebook"); - doc.appendChild(root); - - SerializingVisitor save(root, doc); - doc_->runVisitor(save); - - //Write to file. - QFile file(filename_); - if(file.open(IO_WriteOnly)) - { - // Hade to change from 'doc.toString()' to - // 'doc.toCString()', so the xml file was saved in - // UTF-8, otherwise swedish letters didn't work. - // AF, 2005-09-28 - QTextStream filestream(&file); - filestream << doc.toCString(); - file.close(); - - doc_->setFilename( filename_ ); //AF - doc_->setSaved( true ); //AF - } - else - { - throw runtime_error("Could not save documet to file: " + string(filename_)); - } - } - catch(exception &e) - { - cerr << "SaveDocumentCommand(), Exception: " << e.what() << endl; - } - } - private: - QString filename_; - Document *doc_; - }; - - /*! \class OpenFileCommand - * - * Opens the specified filename. - * - */ - class OpenFileCommand : public Command - { - public: - OpenFileCommand(const QString &filename) : filename_(filename){} - virtual ~OpenFileCommand(){} - void execute() - { - try - { - application()->open(filename_); - } - catch(exception &e) - { - cerr << "OpenFileCommand(), Exception: " << e.what() << endl; - } - } - private: - QString filename_; - }; - - /*! \class CloseFileCommand - * - * Closes the current document. - */ - class CloseFileCommand : public Command - { - public: - CloseFileCommand(){} - virtual ~CloseFileCommand(){} - void execute() - { - try - { - - document()->close(); - } - catch(exception &e) - { - cerr << "CloseFileCommand(), Exception: " << e.what() << endl; - } - } - }; - - /*! \class NewFileCommand - * - * Create a new document in a notebook window - */ - class NewFileCommand : public Command - { - public: - NewFileCommand(){} - virtual ~NewFileCommand(){} - void execute() - { - try - { - /* - Document *doc = document(); - doc = new CellDocument( application(), QString::null ); - */ - } - catch(exception &e) - { - cerr << "NewFileCommand(), Exception: " << e.what() << endl; - } - } - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/notebookparser.cpp b/OMNotebook_QT3/OMNotebook/notebookparser.cpp deleted file mode 100644 index 09c092f936a..00000000000 --- a/OMNotebook_QT3/OMNotebook/notebookparser.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include -#include -#include -//#include -//#include - - -//ANTLR Headers -#include "AntlrNotebookLexer.hpp" -#include "AntlrNotebookParser.hpp" -#include "AntlrNotebookTreeParser.hpp" - -//IAEX Headers -#include "notebookparser.h" - -using namespace std; - -namespace IAEX -{ - - /*! \class NotebookParser - * - * \brief Used to open a notebookfile. - * - * Opens a notebookfile. Note that the parser used to parse - * Mathematica notebooks is not completley correct. There are a lot - * of notebooktags that are ignored. Some big things that is not - * implemented is section counter and hyperlinks. Hyperlinks will - * maybe be implemented later. For hyperlinks to work a new browser - * must be implemented supporting opening of new documents. This is - * not implemented at the time of writing. - * - * Those Cell styles that is not implemented could in most cases be - * implemented using the stylesheet. \see \ref stylesheet.xml for - * more information about changing a cells style. - * - * Here is a list of things that are implemented: - * - * \li Comments (**). - * \li Cell[]. - * \li CellGroupData[]. - * \li List[]. - * \li StyleBox[] - does not care about newlines. - * \li SuperscriptBox[]. - * \li rule[]. - * \li Some cellstyles, Text, Title, Section, Input, Author. - * - * Rules implemented: - * \li FontSlant - * \li FontWeight - * \li TextAlignment - * \li FontSize - * - * Below is some tags and rules that is not implemented. Note that - * this is just a subset of all tags not implemented. It is far - * from complete. - * - * \li Cellstyles, output. - * \li Section counter. - * \li Hard newlines. - * \li swedish charachters (åäö). - * \li subscript[] - will be implemented later. - * \li FormBox - ignored. - * \li RowBox - ignored. - * \li TextData - displayed as ordinary text. - * \li BoxData - ignored. - * \li ButtonBox - ignored, should implement links. - * \li FileName[] - ignored. - * \li RuleDelayed - interpreted as Rule. - * - * Some rules not implemented - * \li InitializationCell - * \li RGBColor - * \li CharacterEncoding - * \li ButtonStyle - * \li ButtonData - * \li FontColor - * \li TextJustification - * - * - * \param filename is the name of the file to be opened. - * - * \throws runtime_error if the notebook can not be opened. - */ - NotebookParser::NotebookParser(const QString filename, Factory *f) - : filename_(filename), factory_(f) {} - - NotebookParser::~NotebookParser(){} - - /*! - * This method just calls the antlr generated parser. To change the - * parser look at lexer.g, parser.g and walker.g instead. - */ - Cell *NotebookParser::parse() - { - std::ifstream anotebook(filename_); - - if(!anotebook) - { - anotebook.close(); - throw runtime_error("Could not open " + string(filename_)); - } - - Cell *workspace = factory_->createCell("cellgroup", 0); - - antlr::ASTFactory myFactory; - AntlrNotebookLexer lexer(anotebook); - AntlrNotebookParser parser(lexer); - - parser.initializeASTFactory(myFactory); - parser.setASTFactory(&myFactory); - parser.document(); - antlr::RefAST t = parser.getAST(); - - AntlrNotebookTreeParser *walker = new AntlrNotebookTreeParser(); - - walker->document(t, workspace, factory_); - anotebook.close(); - - return workspace; - } -} diff --git a/OMNotebook_QT3/OMNotebook/notebookparser.h b/OMNotebook_QT3/OMNotebook/notebookparser.h deleted file mode 100644 index f50fe63fd6f..00000000000 --- a/OMNotebook_QT3/OMNotebook/notebookparser.h +++ /dev/null @@ -1,74 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _NOTEBOOK_PARSER_H -#define _NOTEBOOK_PARSER_H - -#include - -//ANTLR Headers -// #include "NotebookLexer.hpp" -// #include "NotebookParser.hpp" -// #include "NotebookTreeParser.hpp" - -#include "nbparser.h" - -namespace IAEX -{ - class NotebookParser : public NBParser - { - public: - NotebookParser(const QString filename, Factory *f); - virtual ~NotebookParser(); - - virtual Cell *parse(); - private: - QString filename_; - Factory *factory_; - }; -}; -#endif diff --git a/OMNotebook_QT3/OMNotebook/omc_communicator.cpp b/OMNotebook_QT3/OMNotebook/omc_communicator.cpp deleted file mode 100644 index 5422b9fc7e9..00000000000 --- a/OMNotebook_QT3/OMNotebook/omc_communicator.cpp +++ /dev/null @@ -1,1411 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include "omc_communicator.hpp" - -// STD includes -#include -#include -#include //This should be cstdlib, if it even should be used!! -#include -#include - -// MME includes -//#include "annotation.hpp" -//#include "annotation_compiler.hpp" -//#include "application.hpp" -//#include "modelica_class.hpp" -//#include "modification.hpp" - -// Windows includes -#include "windows.h" - -// QT includes -#include "qapplication.h" -#include "qfile.h" -#include "qmessagebox.h" -#include "qstringlist.h" - -// MICO includes -#include - -using namespace std; - -/** - * \brief - * Creates and initializes the Modeq communicator. - */ -OmcCommunicator::OmcCommunicator() - : QObject(0, "Modeq communicator"), - omc_(0) //, - //compiler_(new AnnotationCompiler()) -{ -} - -/** - * \brief - * Destroys the Modeq communicator. - */ -OmcCommunicator::~OmcCommunicator() -{ - //delete compiler_; -} - -/** - * \brief - * Returns a reference to the Modeq communicator. - */ -OmcCommunicator& OmcCommunicator::getInstance() -{ - static OmcCommunicator instance; - return instance; -} - -/** - * \brief - * Attempts to establish a connection to Modeq. - * - * \return true if a connection was established successfully or if a connection already exists, - * false otherwise. - */ -bool OmcCommunicator::establishConnection() -{ - if (omc_) { - return true; - } - - // ORB initialization. - int argc(0); char* argv = new char[1]; - CORBA::ORB_var orb = CORBA::ORB_init(argc, &argv); - - QFile objectRefFile; - -#ifdef WIN32 // Win32 - - // Win32 + Cygwin? - //Cygwin support is removed due to missing code. - //Ingemar Axelsson 2005-09-14. - -// if ((dynamic_cast(qApp))->inCygwinMode()) { -// char *user(getenv("USERNAME")); -// if (!user) { user = "nobody"; } -// -// char *cygwinPath(getenv("CYGWINHOME")); -// if (!cygwinPath) { cygwinPath = "c:/cygwin"; } - - // There seems to be a bug in the QString(const char*) constructor which makes QString free the - // memory pointed to by its argument when the QString object gets destroyed. Therefore it is - // neccessary to create the QString objects on the heap and just leave them there. -// objectRefFile.setName(*(new QString(cygwinPath)) + "/tmp/openmodelica." + *(new QString(user)) + ".objid"); -// } - // Pure Win32 -// else -// { - char tempDirectory[1024]; - GetTempPath(1024, tempDirectory); - - objectRefFile.setName(*(new QString(tempDirectory)) + "openmodelica.objid"); -// } - -#else // UNIX environment - - char *user = getenv("USER"); - if (!user) { user = "nobody"; } - - objectRefFile.setName("/tmp/openmodelica." + *(new QString(user)) + ".objid"); - -#endif - - if (!objectRefFile.exists()) { return false; } - - QString uri; - objectRefFile.open(IO_ReadOnly); - objectRefFile.readLine(uri, 1024); - - /* - qDebug( "Text:" ); - qDebug( uri.latin1() ); - qDebug( "Text:" ); - qDebug( "" ); - - qDebug( "Text:" ); - qDebug( uri.stripWhiteSpace().latin1() ); - qDebug( "Text:" ); - */ - - CORBA::Object_var obj = orb->string_to_object(uri.stripWhiteSpace().latin1()); - omc_ = OmcCommunication::_narrow(obj); - - // Test if we have a connection. - try { - omc_->sendExpression("getClassNames()"); - } - catch (CORBA::Exception&) { - omc_ = 0; - return false; - } - - return true; -} - -/** - * \brief - * Returns true if a connection has been established to Modeq, false otherwise. - */ -bool OmcCommunicator::isConnected() const -{ - return omc_ != 0; -} - -/** - * \brief - * Closes the connection to Modeq. Modeq is not terminated by closing the connection. - */ -void OmcCommunicator::closeConnection() -{ -} - - -/** - * \brief Executes the specified Modeq function and returns the return - * value received from Modeq. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -QString OmcCommunicator::callOmc(const QString& fnCall) -{ - if (!omc_) - { - //throw ModeqError(fnCall); - cerr << "ModeqError(" << fnCall << ")" << endl; - } - - //emit modeqInput(fnCall + "\n"); - //qDebug(QString(fnCall).replace("%"," ")); - - QString returnString; - while (true) - { - try - { - returnString = omc_->sendExpression(fnCall.latin1()); - break; - } - catch (CORBA::Exception&) - { - // 2005-11-24 AF, added otherwise it crashes when command quit() is called. - // ignore if quit() is the first in the function call - if( 0 != fnCall.find( "quit()", 0, false )) - { - int result(QMessageBox::critical(0, tr("Communication Error"), - tr(QString("The Modelica kernel is not responding.")), tr("Try Again"), tr("Abort"))); - qApp->processEvents(); - if (result == 1) { - QMessageBox::critical(0, tr("Communication Error"), - tr(QString("Connection to the Modelica kernel lost.

") + - "The editor has to be restarted.", tr("Quit"))); - qApp->processEvents(); - //throw ModeqConnectionLost(); - cerr << "OmcConnectionLost()" << endl; - } - } - else - break; - } - } - - returnString = returnString.stripWhiteSpace(); - if (fnCall.startsWith("list(")) { - //emit modeqOutput("..."); - // qDebug("..."); - } else { - //emit modeqOutput(returnString); - //qDebug(QString(returnString).replace("%"," ")); - } - - if (returnString == "-1") { - qWarning(QString("[Internal Error] ModeqCommunicator::callModeq():\n") + - "Modeq call \"" + fnCall + "\" failed!\n\n"); - //throw ModeqError(fnCall, returnString); - cerr << "ModeqError(" << fnCall << ", " << returnString << ")" << endl; - } - - return returnString; -} - -/** NOT USED ********************************************************/ - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::loadFile(const QString& file) -// { -// QString fnCall("loadFile(\"" + file + "\")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString != "true") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Loads the specified Modelica class by looking up the correct file to load in the - * environment variable OPENMODELICALIBRARY. - * - * \return true if a file with the specified Modelica class was found, false otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::loadClass(const QString& ref) -// { -// QString fnCall("loadModel(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "true") { -// return true; -// } else if (returnString == "false") { -// return false; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::saveClass(const QString& file, const QString& ref) -// { -// QString fnCall("saveModel(\"" + file + "\"," + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString != "true") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::createConnector(const QString& ref, -// const QStringList& baseClassRefs, -// const QString& comment, -// bool encapsulated, -// bool partial) -// { -// QString name(ModelicaClassManager::getName(ref)); -// QString parentClassRef(ModelicaClassManager::getPath(ref)); - -// QString fnCall(!parentClassRef.isEmpty() ? "within " + parentClassRef + "; " : ""); -// fnCall += -// QString((encapsulated ? "encapsulated " : "")) + -// QString((partial ? "partial " : "")) + "connector " + name + " \"" + comment + "\""; -// for (QStringList::const_iterator it = baseClassRefs.begin(); it != baseClassRefs.end(); ++it) { -// fnCall += " extends " + *it + ";"; -// } -// fnCall += " end " + name + ";"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::createModel(const QString& ref, -// const QStringList& baseClassRefs, -// const QString& comment, -// bool encapsulated, -// bool partial) -// { -// QString name(ModelicaClassManager::getName(ref)); -// QString parentClassRef(ModelicaClassManager::getPath(ref)); - -// QString fnCall(!parentClassRef.isEmpty() ? "within " + parentClassRef + "; " : ""); -// fnCall += -// QString((encapsulated ? "encapsulated " : "")) + -// QString((partial ? "partial " : "")) + "model " + name + " \"" + comment + "\""; -// for (QStringList::const_iterator it = baseClassRefs.begin(); it != baseClassRefs.end(); ++it) { -// fnCall += " extends " + *it + ";"; -// } -// fnCall += " end " + name + ";"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::createBlock(const QString& ref, -// const QStringList& baseClassRefs, -// const QString& comment, -// bool encapsulated, -// bool partial) -// { -// QString name(ModelicaClassManager::getName(ref)); -// QString parentClassRef(ModelicaClassManager::getPath(ref)); - -// QString fnCall(!parentClassRef.isEmpty() ? "within " + parentClassRef + "; " : ""); -// fnCall += -// QString((encapsulated ? "encapsulated " : "")) + -// QString((partial ? "partial " : "")) + "block " + name + " \"" + comment + "\""; -// for (QStringList::const_iterator it = baseClassRefs.begin(); it != baseClassRefs.end(); ++it) { -// fnCall += " extends " + *it + ";"; -// } -// fnCall += " end " + name + ";"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::createRecord(const QString& ref, -// const QStringList& baseClassRefs, -// const QString& comment, -// bool encapsulated, -// bool partial) -// { -// QString name(ModelicaClassManager::getName(ref)); -// QString parentClassRef(ModelicaClassManager::getPath(ref)); - -// QString fnCall(!parentClassRef.isEmpty() ? "within " + parentClassRef + "; " : ""); -// fnCall += -// QString((encapsulated ? "encapsulated " : "")) + -// QString((partial ? "partial " : "")) + "record " + name + " \"" + comment + "\""; -// for (QStringList::const_iterator it = baseClassRefs.begin(); it != baseClassRefs.end(); ++it) { -// fnCall += " extends " + *it + ";"; -// } -// fnCall += " end " + name + ";"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::createFunction(const QString& ref, -// const QStringList& baseClassRefs, -// const QString& comment, -// bool encapsulated, -// bool partial) -// { -// QString name(ModelicaClassManager::getName(ref)); -// QString parentClassRef(ModelicaClassManager::getPath(ref)); - -// QString fnCall(!parentClassRef.isEmpty() ? "within " + parentClassRef + "; " : ""); -// fnCall += -// QString((encapsulated ? "encapsulated " : "")) + -// QString((partial ? "partial " : "")) + "function " + name + " \"" + comment + "\""; -// for (QStringList::const_iterator it = baseClassRefs.begin(); it != baseClassRefs.end(); ++it) { -// fnCall += " extends " + *it + ";"; -// } -// fnCall += " end " + name + ";"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::createPackage(const QString& ref, -// const QStringList& baseClassRefs, -// const QString& comment, -// bool encapsulated, -// bool partial) -// { -// QString name(ModelicaClassManager::getName(ref)); -// QString parentClassRef(ModelicaClassManager::getPath(ref)); - -// QString fnCall(!parentClassRef.isEmpty() ? "within " + parentClassRef + "; " : ""); -// fnCall += -// QString((encapsulated ? "encapsulated " : "")) + -// QString((partial ? "partial " : "")) + "package " + name + " \"" + comment + "\""; -// for (QStringList::const_iterator it = baseClassRefs.begin(); it != baseClassRefs.end(); ++it) { -// fnCall += " extends " + *it + ";"; -// } -// fnCall += " end " + name + ";"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Deletes the specified Modelica class in Modeq. - */ -// bool ModeqCommunicator::deleteClass(const QString& ref) -// { -// QString fnCall("deleteClass(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "true") { -// return true; -// } else if (returnString == "false") { -// return false; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if the specified Modelica class exists, false otherwise. - * - * The class reference must not be empty. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::existsClass(const QString& ref) -// { -// QString fnCall("existClass(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "true") { -// return true; -// } else if (returnString == "false") { -// return false; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to a restricted Modelica class of type Block, false - * otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isBlock(const QString& ref) -// { -// QString fnCall("isBlock(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to an unrestricted Modelica class, false otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isClass(const QString& ref) -// { -// QString fnCall("isClass(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to a restricted Modelica class of type Connector, false - * otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isConnector(const QString& ref) -// { -// QString fnCall("isConnector(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to a restricted Modelica class of type Function, false - * otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isFunction(const QString& ref) -// { -// QString fnCall("isFunction(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to a restricted Modelica class of type Model, false - * otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isModel(const QString& ref) -// { -// QString fnCall("isModel(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to a restricted Modelica class of type Package, false - * otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isPackage(const QString& ref) -// { -// QString fnCall("isPackage(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to a restricted Modelica class of type Record, false - * otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isRecord(const QString& ref) -// { -// QString fnCall("isRecord(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a reference to a restricted Modelica class of type Type, false - * otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isType(const QString& ref) -// { -// QString fnCall("isType(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns true if \a ref is a Modelica primitive type, false otherwise. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isPrimitive(const QString& ref) -// { -// // Real and Integer are known primitives. No need to ask Modeq. -// if (ref == "Real" || ref == "Integer") { -// return true; -// } - -// QString fnCall("isPrimitive(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns a comma separated list (surrounded with braces) with the names of all class definitions - * in the specified Modelica class. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// QString ModeqCommunicator::getClassNames(const QString& ref) -// { -// QString fnCall("getClassNames(" + ref + ")"); -// QString list(callModeq(fnCall)); - -// // Remove the surrounding braces before returning the list. -// return list.mid(1, list.length() - 2); -// } - -/** - * \brief - * Returns the icon layer annotation stored in Modeq of the specified Modelica class. - * - * A null pointer is returned if no annotation exists. The annotation returned is the one available - * in Modeq and is not neccessarly up to date. Use the functions of the ModelicaClass object to - * obtain the latest version of the annotation. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - * \throw SyntaxError if the compilation of the icon layer annotation fails. - * - * \see ModelicaClass::getIconLayerAnnotation() - * \see ModelicaClass::getLayerAnnotation() - */ -// IconLayerAnnotation* ModeqCommunicator::getIconLayerAnnotation(const QString& ref) -// { -// QString fnCall("getIconAnnotation(" + ref + ")"); -// QString annotationString(callModeq(fnCall)); - -// if (annotationString.isEmpty()) { -// return 0; -// } else { -// return compiler_->compileIconLayerAnnotation(annotationString.latin1(), ref.latin1()); -// } -// } - -/** - * \brief - * Returns the diagram layer annotation stored in Modeq of the specified Modelica class. - * - * A null pointer is returned if no annotation exists. The annotation returned is the one - * available in Modeq and is not neccessarly up to date. Use the functions of the ModelicaClass - * object to obtain the latest version of the annotation. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - * \throw SyntaxError if the compilation of the diagram layer annotation fails. - * - * \see ModelicaClass::getDiagramLayerAnnotation() - * \see ModelicaClass::getLayerAnnotation() - */ -// DiagramLayerAnnotation* ModeqCommunicator::getDiagramLayerAnnotation(const QString& ref) -// { -// QString fnCall("getDiagramAnnotation(" + ref + ")"); -// QString annotationString(callModeq(fnCall)); - -// if (annotationString.isEmpty()) { -// return 0; -// } else { -// return compiler_->compileDiagramLayerAnnotation(annotationString.latin1(), ref.latin1()); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::setClassLayerAnnotation(const QString& ref, const QString& annotation) -// { -// QString fnCall("addClassAnnotation(" + ref + "," + annotation + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "true" && returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns the number of classes inherited by the the specified Modelica class. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// int ModeqCommunicator::getInheritanceCount(const QString& ref) -// { -// QString fnCall("getInheritanceCount(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// bool conversionResult; -// int count(returnString.toInt(&conversionResult)); -// if (!conversionResult) { -// throw ModeqError(fnCall, returnString); -// } - -// return count; -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// QString ModeqCommunicator::getNthInheritedClass(const QString& ref, int index) -// { -// QString fnCall("getNthInheritedClass(" + ref + "," + QString::number(index) + ")"); -// return callModeq(fnCall); -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::addComponent(const QString& name, -// const QString& type, -// const QString& ref, -// const QString& annotation) -// { -// QString fnCall; -// if (annotation.isEmpty()) { -// fnCall = "addComponent(" + name + "," + type + "," + ref + ")"; -// } else { -// fnCall = "addComponent(" + name + "," + type + "," + ref + "," + annotation + ")"; -// } -// QString returnString(callModeq(fnCall)); - -// if (returnString != "true") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::updateComponent(const QString& name, -// const QString& type, -// const QString& ref, -// const QString& comment, -// const QString& annotation) -// { -// QString temporaryComment(comment); -// temporaryComment.replace("\\", "\\\\").replace("\"", "\\\""); - -// QString fnCall; -// if (annotation.isEmpty()) { -// fnCall = "updateComponent(" + name + "," + type + "," + ref + -// ", comment=\"" + temporaryComment + "\")"; -// } else { -// fnCall = "updateComponent(" + name + "," + type + "," + ref + -// ", comment=\"" + temporaryComment + "\",annotate=" + annotation + ")"; -// } -// QString returnString(callModeq(fnCall)); - -// if (returnString != "true") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * Deletes the specified component from the specified Modelica class. - * - * \param name the name of the component to delete. - * \param ref the reference to the Modelica class in which the component exists. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::deleteComponent(const QString& name, const QString& ref) -// { -// QString fnCall("deleteComponent(" + name + "," + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString != "true") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * Returns true if the specified component is protected, false otherwise. - * - * \param name the name of the component. - * \param ref the reference to the Modelica class in which the component exists. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// bool ModeqCommunicator::isProtected(const QString& name, const QString& ref) -// { -// QString fnCall("isProtected(" + name + "," + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString == "false") { -// return false; -// } else if (returnString == "true") { -// return true; -// } else { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns the number of components of the specified Modelica class. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// int ModeqCommunicator::getComponentCount(const QString& ref) -// { -// QString fnCall("getComponentCount(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// bool conversionResult; -// int count(returnString.toInt(&conversionResult)); -// if (!conversionResult) { -// throw ModeqError(fnCall, returnString); -// } - -// return count; -// } - -/** - * \brief - * Returns all component declarations in the Modelica class specifed by \a ref. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// std::vector ModeqCommunicator::getComponents(const QString& ref) -// { -// QString fnCall("getComponents(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// std::vector componentDeclarations; -// if (returnString == "{{}}") return componentDeclarations; - -// // Remove surrounding braces. -// QString componentList(returnString.mid(1, returnString.length() - 2)); - -// // Extract each component from the list of components returned from Modeq. -// while (!componentList.isEmpty()) -// { -// int i; - -// // Extract the type. -// i = componentList.find(','); -// if (i == -1) throw ModeqError(fnCall, returnString); // Parse error. -// QString type(componentList.mid(1, i - 1).stripWhiteSpace()); -// componentList = componentList.remove(0, i + 1).stripWhiteSpace(); - -// // Extract the name. -// i = componentList.find(','); -// if (i == -1) throw ModeqError(fnCall, returnString); // Parse error. -// QString name(componentList.left(i).stripWhiteSpace()); -// componentList = componentList.remove(0, i + 1).stripWhiteSpace(); - -// // Extract the comment. -// i = 0; -// do { -// i = componentList.find('"', i + 1); -// } while (componentList.at(i - 1) == '\\'); -// QString comment(componentList.mid(1, i - 1)); -// comment.replace("\\\"", "\"").replace("\\\\", "\\"); -// componentList = componentList.remove(0, i + 3).stripWhiteSpace(); - -// // Create declaration record. -// componentDeclarations.push_back(ComponentDeclaration(type, name, comment)); -// } - -// return componentDeclarations; -// } - -/** - * \brief - * Returns the placement annotations for the components in the Modelica class specified by \a ref. - * - * The annotations returned are the one available in Modeq. Use the functions of the - * ModelicaComponent object to obtain the local version of the annotations. - * - * \param ref the reference to the Modelica class. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - * - * \see ModelicaComponent::getPlacementAnnotation() - */ -// std::vector ModeqCommunicator::getComponentAnnotations(const QString& ref) -// { -// QString fnCall("getComponentAnnotations(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// std::vector componentAnnotations; - -// // Remove surrounding braces. -// QString annotationList(returnString.mid(1, returnString.length() - 2)); - -// // Remove any whitespace in the string to simplify the extraction of annotations. -// annotationList = annotationList.remove(' '); -// while (!annotationList.isEmpty()) { -// if (annotationList.startsWith("{}")) { -// componentAnnotations.push_back(0); -// annotationList = annotationList.remove(0, 3); -// } else { -// int i(annotationList.find('}')); -// QString annotation(annotationList.mid(0, i + 1)); -// annotationList = annotationList.remove(0, i + 2); -// try { -// componentAnnotations.push_back(compiler_->compilePlacementAnnotation(annotation.latin1())); -// } catch (SyntaxError&) { -// // compilePlacementAnnotation never throws SyntaxError as modeq returns {} if a component has a invalid annotation -// qWarning(QString("[Internal Error] ModeqCommunicator::getComponentAnnotations():\n") + -// "Parsing of placement annotation failed. The annotation is ignored.\n"); -// QMessageBox::critical(0, tr("Modelica Kernel Error"), -// tr(QString("
A function call to the Modelica kernel failed.

") + -// "The editor and kernel might be in an inconsistent state.
Please restart the editor.")); - -// componentAnnotations.push_back(0); -// } -// } -// } - -// return componentAnnotations; -// } - -/** - * \brief - * Returns the modification of the component with the given index in the Modelica class specified - * by \a ref. - * - * \param ref the reference to the Modelica class. - * \param index the index of the component in the Modelica class. - * \param name the name of the component with the specified index. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - * - * \see setNthComponentModification() - */ -// Modification* ModeqCommunicator::getNthComponentModification(const QString& ref, int index, const QString& name) -// { -// QString fnCall("getNthComponentModification(" + ref + "," + QString::number(index) + ")"); -// QString returnString(callModeq(fnCall)); - -// std::vector modifiers; - -// if (returnString == "{Code()}") return 0; - -// // Remove enclosing {Code()}. -// returnString = returnString.mid(6, returnString.length() - 8).stripWhiteSpace(); -// QString modificationString = returnString; -// // qDebug(returnString); -// // qDebug("MODIFICATION: " + modificationString); - -// // = ? -// if (modificationString.startsWith("=")) { -// QString value(modificationString.mid(1)); -// modifiers.push_back(new ComponentModifier("", value)); -// // qDebug(">>> =" + value); -// // qDebug(""); -// return new Modification(name, returnString, modifiers); -// } -// // := ? -// else if (modificationString.startsWith(":=")) { -// QString value(modificationString.mid(2)); -// modifiers.push_back(new ComponentModifier("", value)); -// // qDebug(">>> =" + value); -// // qDebug(""); -// return new Modification(name, returnString, modifiers); -// } else { -// if( modificationString.startsWith("(") && modificationString.endsWith(")") ) -// { -// // Remove surrounding () -// modificationString = modificationString.mid(1, modificationString.length() - 2); -// } - -// } - -// // Redclaration? -// if (modificationString.startsWith("redeclare")) { -// // Skip modifier -// int pDepth(0); -// while (!modificationString.isEmpty()) { -// if (modificationString.startsWith("(")) { -// ++pDepth; -// } else if (modificationString.startsWith(")")) { -// --pDepth; -// } else if (modificationString.startsWith(",") && pDepth == 0) { -// modificationString = modificationString.remove(0, 1).stripWhiteSpace(); -// break; -// } -// modificationString = modificationString.remove(0, 1); -// } -// } -// // Modification. -// else { -// QString componentReference(""); -// QString value(""); - -// while (!modificationString.isEmpty()) { -// // Remove any occurence of each and final. -// while (true) { -// if (modificationString.startsWith("each")) { -// modificationString = modificationString.remove(0,4).stripWhiteSpace(); -// } else if (modificationString.startsWith("final")) { -// modificationString = modificationString.remove(0,5).stripWhiteSpace(); -// } else { -// break; -// } -// } -// int pDepth(0); - -// // Take care of the case (unit="m")=2, (unit="m") is removed -// if( modificationString.startsWith("(") && !modificationString.endsWith(")") ){ - -// while(!modificationString.isEmpty()) -// { -// if (modificationString.startsWith("(")) { ++pDepth; } -// else if (modificationString.startsWith(")")) { --pDepth; } -// else if( modificationString.startsWith("=") && pDepth == 0 ) -// { -// break; -// } -// modificationString = modificationString.remove(0, 1); -// } - -// pDepth = 0; -// } - -// while (!modificationString.isEmpty()) { -// if (modificationString.startsWith("(")) { ++pDepth; } -// else if (modificationString.startsWith(")")) { --pDepth; } -// else if (modificationString.startsWith("=") && pDepth == 0) { -// int bDepth(0), btDepth(0); -// modificationString = modificationString.mid(1).stripWhiteSpace(); -// while (true) { -// // Last modifier? (No comma found). -// if (modificationString.isEmpty()) { -// break; -// } -// else if (modificationString.startsWith("(")) { ++pDepth; } -// else if (modificationString.startsWith(")")) { --pDepth; } -// else if (modificationString.startsWith("{")) { ++bDepth; } -// else if (modificationString.startsWith("}")) { --bDepth; } -// else if (modificationString.startsWith("[")) { ++btDepth; } -// else if (modificationString.startsWith("]")) { --btDepth; } -// else if (modificationString.startsWith(",") && pDepth == 0 && bDepth == 0 && btDepth == 0) { -// modificationString = modificationString.mid(1).stripWhiteSpace(); -// break; -// } -// value += modificationString.at(0); -// modificationString = modificationString.remove(0, 1); -// } -// break; -// } - -// componentReference += modificationString.at(0); -// modificationString = modificationString.remove(0, 1); -// } - -// // Remove any colon at the end of the component reference (happens when := is used). -// if (componentReference.endsWith(":")) { -// componentReference = componentReference.left(componentReference.length() - 1); -// } - -// // Remove any inner modifications from the component reference. -// int i(componentReference.find('(')); -// if (i > 0) { -// componentReference = componentReference.left(i); -// } - -// // Do not store any deep modifiers. -// if (componentReference.find('.') > 0) { -// continue; -// } -// modifiers.push_back(new ComponentModifier(componentReference, value)); - -// // qDebug(">>> " + componentReference + "=" + value); -// // qDebug(modificationString); -// componentReference = ""; -// value = ""; -// } - -// } - -// return new Modification(name, returnString, modifiers); -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::addConnection(const QString& sourceConnectorRef, -// const QString& destinationConnectorRef, -// const QString& ref, -// const QString& annotation) -// { -// QString fnCall = "addConnection(" + sourceConnectorRef + "," + destinationConnectorRef + "," + -// ref + "," + annotation + ")"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "true" && returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::updateConnection(const QString& sourceConnectorRef, -// const QString& destinationConnectorRef, -// const QString& ref, -// const QString& annotation) -// { -// QString fnCall = "updateConnection(" + sourceConnectorRef + "," + destinationConnectorRef + "," + -// ref + "," + annotation + ")"; -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "true" && returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::deleteConnection(const QString& sourceConnectorRef, -// const QString& destinationConnectorRef, -// const QString& ref) -// { -// QString fnCall("deleteConnection(" + sourceConnectorRef + "," + destinationConnectorRef + "," + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// if (returnString.lower() != "true" && returnString.lower() != "ok") { -// throw ModeqError(fnCall, returnString); -// } -// } - -/** - * \brief - * Returns the number of connections of the specified Modelica class. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// int ModeqCommunicator::getConnectionCount(const QString& ref) -// { -// QString fnCall("getConnectionCount(" + ref + ")"); -// QString returnString(callModeq(fnCall)); - -// bool conversionResult; -// int count(returnString.toInt(&conversionResult)); -// if (!conversionResult) throw ModeqError(fnCall, returnString); - -// return count; -// } - -/** - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// QString ModeqCommunicator::getNthConnection(const QString& ref, int index) -// { -// QString fnCall("getNthConnection(" + ref + "," + QString::number(index) + ")"); -// return callModeq(fnCall); -// } - -/** - * \brief - * Returns the connection annotation of the connection with the given index in the Modelica class - * specified by \a ref. - * - * A null pointer is returned if no annotation exists. The annotation returned is the one available - * in Modeq and is not neccessarly up to date. Use the functions of the ModelicaConnection object to - * obtain the latest version of the annotation. - * - * \param ref the reference to the Modelica class. - * \param index the index of the connection in the Modelica class. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - * \throw SyntaxError if the compilation of the connection annotation fails. - * - * \see ModelicaConnection::getConnectionLine() - */ -// Line* ModeqCommunicator::getNthConnectionAnnotation(const QString& ref, int index) -// { -// QString fnCall("getNthConnectionAnnotation(" + ref + "," + QString::number(index) + ")"); -// QString annotationString(callModeq(fnCall)); - -// if (annotationString.isEmpty()) { -// return 0; -// } else { -// return compiler_->compileConnectionAnnotation(annotationString.latin1()); -// } -// } - -/** - * \brief - * Returns the class definition of the specified Modelica class. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// QString ModeqCommunicator::list(const QString& ref) -// { -// QString fnCall("list(" + ref + ")"); -// QString classDefinition(callModeq(fnCall)); - -// // Remove the surrounding " characters. -// return classDefinition.mid(1, classDefinition.length() - 2); -// } - -/** - * \brief - * Quits Modeq. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - */ -// void ModeqCommunicator::quit() -// { -// QString fnCall("quit()"); -// callModeq(fnCall); -// } - -/** - * \brief - * Updates the specified Modelica class with the given class definition. - * - * Never call this function directly, use the setClassDefinition() function of the - * ModelicaClassManager, it will also update the internal caches of the editor. - * - * \throw ModeqError if the Modeq function call fails. - * \throw ModeqConnectionLost if the connection to Modeq is lost. - * \throw SyntaxError if the parsing of the specified class definition fails. - * - * \see ModelicaClassManager::setClassDefinition() - */ -// void ModeqCommunicator::updateClassDefinition(const QString& ref, -// const QString& definition) -// { -// QString fnCall; -// if (!ModelicaClassManager::getPath(ref).isEmpty()) { -// fnCall += "within " + ModelicaClassManager::getPath(ref) + "; "; -// } -// fnCall += definition; -// QString returnString(callModeq(fnCall)); - -// if (returnString != "Ok") { -// throw SyntaxError(returnString); -// } -// } - - diff --git a/OMNotebook_QT3/OMNotebook/omc_communicator.hpp b/OMNotebook_QT3/OMNotebook/omc_communicator.hpp deleted file mode 100644 index 3bc6f874748..00000000000 --- a/OMNotebook_QT3/OMNotebook/omc_communicator.hpp +++ /dev/null @@ -1,200 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef OMC_COMMUNICATOR_HPP_ -#define OMC_COMMUNICATOR_HPP_ - -// MME includes -//#include "main.hpp" -//#include "exceptions.hpp" - -// QT includes -#include "qobject.h" - -/* -// MME forward declarations -class AnnotationCompiler; -class PlacementAnnotation; -class DiagramLayerAnnotation; -class GraphicalLayerAnnotation; -class IconLayerAnnotation; -class Line; -class Modification; -*/ - -// QT forward declarations -class QString; -class QStringList; - -// Modeq communication interface -#include "omc_communication.h" - -/** - * - */ - -/* - struct ComponentDeclaration - { - ComponentDeclaration(QString type, QString name, QString comment) : type_(type), name_(name), comment_(comment) {}; - - QString type_; - QString name_; - QString comment_; - }; -*/ -//------------------------------------------------------------------------------------ - -/** - * \brief - * The ModeqCommunicator handles all low level communication with Modeq. - * - * This class is a singleton class, use the static getInstance() member function to obtain a - * reference to its instance. - */ -class OmcCommunicator : public QObject -{ - Q_OBJECT - -public: - ~OmcCommunicator(); - static OmcCommunicator& getInstance(); - - bool establishConnection(); - void closeConnection(); - bool isConnected() const; - - QString callOmc(const QString& fnCall); - -/* - void loadFile(const QString& file); - bool loadClass(const QString& ref); - void saveClass(const QString& file, const QString& ref); - - void createPackage(const QString& ref, const QStringList& baseClassRefs, - const QString& comment, bool encapsulated, bool partial); - void createConnector(const QString& ref, const QStringList& baseClassRefs, - const QString& comment, bool encapsulated, bool partial); - void createModel(const QString& ref, const QStringList& baseClassRefs, - const QString& comment, bool encapsulated, bool partial); - void createBlock(const QString& ref, const QStringList& baseClassRefs, - const QString& comment, bool encapsulated, bool partial); - void createRecord(const QString& ref, const QStringList& baseClassRefs, - const QString& comment, bool encapsulated, bool partial); - void createFunction(const QString& ref, const QStringList& baseClassRefs, - const QString& comment, bool encapsulated, bool partial); - - bool deleteClass(const QString& ref); - - bool existsClass(const QString& ref); - bool isBlock(const QString& ref); - bool isClass(const QString& ref); - bool isConnector(const QString& ref); - bool isFunction(const QString& ref); - bool isModel(const QString& ref); - bool isPackage(const QString& ref); - bool isRecord(const QString& ref); - bool isType(const QString& ref); - bool isPrimitive(const QString& ref); - - QString getClassNames(const QString& ref); - - IconLayerAnnotation* getIconLayerAnnotation(const QString& ref); - DiagramLayerAnnotation* getDiagramLayerAnnotation(const QString& ref); - void setClassLayerAnnotation(const QString& ref, const QString& annotation); - - int getInheritanceCount(const QString& ref); - QString getNthInheritedClass(const QString& ref, int index); - - int getComponentCount(const QString& ref); - std::vector getComponents(const QString& ref); - Modification* getNthComponentModification(const QString& ref, int index, const QString& name); - std::vector getComponentAnnotations(const QString& ref); - - void addComponent(const QString& name, const QString& type, const QString& ref, - const QString& annotation); - void updateComponent(const QString& name, const QString& type, const QString& ref, - const QString& comment, const QString& annotation = ""); - void deleteComponent(const QString& name, const QString& ref); - bool isProtected(const QString& name, const QString& ref); - - int getConnectionCount(const QString& ref); - QString getNthConnection(const QString& ref, int index); - Line* getNthConnectionAnnotation(const QString& ref, int index); - - void addConnection(const QString& sourceConnectorRef, const QString& destinationConnectorRef, - const QString& ref, const QString& annotation = ""); - void updateConnection(const QString& sourceConnectorRef, - const QString& destinationConnectorRef, const QString& ref, const QString& annotation); - void deleteConnection(const QString& sourceConnectorRef, - const QString& destinationConnectorRef, const QString& ref); - - QString list(const QString& ref); - void quit(); - - void updateClassDefinition(const QString& ref, const QString& definition); - - -signals: - void modeqInput(const QString&); - void modeqOutput(const QString&); -*/ -private: - // Enforce the singleon's uniqueness. - OmcCommunicator(); - OmcCommunicator(const OmcCommunicator&); - OmcCommunicator& operator=(const OmcCommunicator&); - -// QString callModeq(const QString& fnCall); - -private: - OmcCommunication_var omc_; - //AnnotationCompiler* compiler_; -}; - -#endif - diff --git a/OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.cpp b/OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.cpp deleted file mode 100644 index b6cd945cb66..00000000000 --- a/OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include - -#include "omcinteractiveenvironment.h" - -using namespace std; - -namespace IAEX -{ - /*! \class OmcInteractiveEnvironment - * - * \brief Implements evaluation for modelica code. - */ - OmcInteractiveEnvironment::OmcInteractiveEnvironment() - : comm_(OmcCommunicator::getInstance()),result_("") - { - //Communicate with Omc. - if(!comm_.isConnected()) - { - if(!comm_.establishConnection()) - { - throw runtime_error("OmcInteractiveEnvironment(): No connection to Omc established"); - } - } - } - - OmcInteractiveEnvironment::~OmcInteractiveEnvironment(){} - - QString OmcInteractiveEnvironment::getResult() - { - qDebug(result_); - return result_; - } - - void OmcInteractiveEnvironment::evalExpression(QString &expr) - { - result_ = comm_.callOmc(expr); - //qDebug(result_); - } -} diff --git a/OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.h b/OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.h deleted file mode 100644 index 91ccad47d9a..00000000000 --- a/OMNotebook_QT3/OMNotebook/omcinteractiveenvironment.h +++ /dev/null @@ -1,71 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _OMCINTERACTIVE_H -#define _OMCINTERACTIVE_H - -#include - -#include "omc_communicator.hpp" -#include "inputcelldelegate.h" - -namespace IAEX -{ - class OmcInteractiveEnvironment : public InputCellDelegate - { - public: - OmcInteractiveEnvironment(); - virtual ~OmcInteractiveEnvironment(); - - virtual QString getResult(); - virtual void evalExpression(QString &expr); - private: - OmcCommunicator &comm_; - QString result_; - }; -} -#endif \ No newline at end of file diff --git a/OMNotebook_QT3/OMNotebook/parserfactory.h b/OMNotebook_QT3/OMNotebook/parserfactory.h deleted file mode 100644 index 4a0b640c4d4..00000000000 --- a/OMNotebook_QT3/OMNotebook/parserfactory.h +++ /dev/null @@ -1,81 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _PARSER_FACTORY_H -#define _PARSER_FACTORY_H - -#include - -#include "nbparser.h" -#include "factory.h" - -namespace IAEX -{ - /*! \interface ParserFactory - * - * \brief Describes the interface for parser factories. - * - * A parser factory is responsible for creating the correct parser - * for a given file. - */ - class ParserFactory - { - public: - virtual NBParser *createParser(QString filename, Factory *f) = 0; - }; - - class CellParserFactory : public ParserFactory - { - public: - CellParserFactory(); - virtual ~CellParserFactory(); - - NBParser *createParser(QString filename, Factory *f); - }; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/qtapp.cpp b/OMNotebook_QT3/OMNotebook/qtapp.cpp deleted file mode 100644 index 24a0ceee350..00000000000 --- a/OMNotebook_QT3/OMNotebook/qtapp.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file qtapp.cpp - * \brief Mainprogram. This is just Qt startup code. - */ - -//STD Headers -#include -#include -#include - -//QT Headers -#include - -//IAEX Headers -#include "notebook.h" -#include "application.h" -#include "cellapplication.h" - - -using namespace std; -using namespace IAEX; - -/*! - * \todo Create an application that reads in a notebook and outputs a - * corresponding xml file. This should not be to hard to - * create. Atleast not now when a notebookparser exists. All - * components exist so it should only be to put them together. - */ - -int main(int argc, char **argv) -{ - try - { - CellApplication a(argc, argv); - return a.exec(); - } - catch(exception &e) - { - cerr << "In main(), exception:" << endl << e.what() << endl; - } - - return 0; -} diff --git a/OMNotebook_QT3/OMNotebook/rule.h b/OMNotebook_QT3/OMNotebook/rule.h deleted file mode 100644 index ae1ae4c9e32..00000000000 --- a/OMNotebook_QT3/OMNotebook/rule.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file rule.h - * \author Ingemar Axelsson - * - * \brief Describes a cell rule. - */ - -#ifndef _RULE_H -#define _RULE_H - -#include -#include - -using namespace std; - -namespace IAEX -{ - /*! \class Rule - * - * \brief Record describing a formatrule. - * - * Rule is used to store formatting information for some cells. Also see Stylesheet - */ - class Rule - { - public: - typedef QString attribute_t; - typedef QString value_t; - public: - Rule(attribute_t a, value_t v) : attribute_(a), value_(v){} - virtual ~Rule(){} - - attribute_t attribute() const - { - return attribute_; - } - - value_t value() const - { - return value_; - } - - private: - attribute_t attribute_; - attribute_t value_; - }; -} - -#endif diff --git a/OMNotebook_QT3/OMNotebook/selectingvisitor.cpp b/OMNotebook_QT3/OMNotebook/selectingvisitor.cpp deleted file mode 100644 index 0473849c37f..00000000000 --- a/OMNotebook_QT3/OMNotebook/selectingvisitor.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include "selectingvisitor.h" -#include "textcell.h" - -namespace IAEX{ - - void SelectingVisitor::visitCellNode(Cell *node) - { - //Do Nothing! - } - - void SelectingVisitor::visitCellGroupNode(CellGroup *node) - { - //Do Nothing! - } - - void SelectingVisitor::visitTextCellNode(TextCell *node) - { - node->setSelected(true); - node->setReadOnly(true); - } -} diff --git a/OMNotebook_QT3/OMNotebook/selectingvisitor.h b/OMNotebook_QT3/OMNotebook/selectingvisitor.h deleted file mode 100644 index b6a8a2187f5..00000000000 --- a/OMNotebook_QT3/OMNotebook/selectingvisitor.h +++ /dev/null @@ -1,80 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file visitor.h - * \author Ingemar Axelsson - * - * \brief Example of an visitor. - */ - -#ifndef SELECTINGVISITOR_H -#define SELECTINGVISITOR_H - -//IAEX Headers -#include "visitor.h" - -using namespace IAEX; - -namespace IAEX{ -/*! \class SelectingVisitor - * \author Ingemar Axelsson - * - * \brief SelectingVisitor is an example implementaion of a - * visitor. It selects all textcells but nothing else. It also - * traverses the tree in pre order. - * - * \deprecated Never used. - */ - class SelectingVisitor : public Visitor - { - public: - virtual void visitCellNode(Cell *node); - virtual void visitCellGroupNode(CellGroup *node); - virtual void visitTextCellNode(TextCell *node); - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/serializingvisitor.cpp b/OMNotebook_QT3/OMNotebook/serializingvisitor.cpp deleted file mode 100644 index 0472b41cd70..00000000000 --- a/OMNotebook_QT3/OMNotebook/serializingvisitor.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include "serializingvisitor.h" -#include "cellgroup.h" -#include "textcell.h" -#include "inputcell.h" -#include "cellcursor.h" -#include "imagecell.h" - -namespace IAEX -{ - /*! \class SerializingVisitor - * - * \brief Saves a celltree to an xml file. - * - * Converts a cell structure to XML. - */ - SerializingVisitor::SerializingVisitor(QDomElement &element, QDomDocument &doc) - : currentElement_(element), doc_(doc) - { - } - - SerializingVisitor::~SerializingVisitor() - { - - } - - /*! \brief writes cell contents to a file. - */ - void SerializingVisitor::visitCellNodeBefore(Cell *node) - { - cerr << "visitCellNode is not implemented" << endl; - } - - void SerializingVisitor::visitCellNodeAfter(Cell *node) - { - } - - /*! - */ - void SerializingVisitor::visitCellGroupNodeBefore(CellGroup *node) - { - //qDebug("Visitin a cellgroup"); - parents_.push(currentElement_); - QDomElement ce = doc_.createElement("CellGroupData"); - currentElement_.appendChild(ce); - - ce.setAttribute("closed", node->isClosed()); - - currentElement_ = ce; - } - - /*! \bug Does not set the parent correctly. - */ - void SerializingVisitor::visitCellGroupNodeAfter(CellGroup *node) - { - currentElement_ = parents_.top(); - parents_.pop(); - } - - void SerializingVisitor::visitTextCellNodeBefore(TextCell *node) - { - //qDebug("Visitin a textcell"); - QDomElement textcell = doc_.createElement("Cell"); - QDomText t = doc_.createTextNode(node->text()); - - textcell.setAttribute("style", node->style()); - textcell.appendChild(t); - - Cell::rules_t r = node->rules(); - Cell::rules_t::const_iterator i = r.begin(); - for(;i!=r.end();++i) - { - textcell.setAttribute((*i)->attribute(), (*i)->value()); - } - - currentElement_.appendChild(textcell); - } - - void SerializingVisitor::visitTextCellNodeAfter(TextCell *node) - { - } - - void SerializingVisitor::visitInputCellNodeBefore(InputCell *node) - { - //qDebug("Visitin a inputcell"); - QDomElement textcell = doc_.createElement("Cell"); - - QDomText t = doc_.createTextNode(node->text()); - textcell.setAttribute("style", "Input"); - textcell.appendChild(t); - - currentElement_.appendChild(textcell); - } - - void SerializingVisitor::visitInputCellNodeAfter(InputCell *node) - { - - } - - void SerializingVisitor::visitImageCellNodeBefore(ImageCell *node) - { - QDomElement imgCell = doc_.createElement("Cell"); - imgCell.setAttribute("style", "Image"); - imgCell.setAttribute("filename", node->filename()); - - currentElement_.appendChild(imgCell); - } - - void SerializingVisitor::visitImageCellNodeAfter(ImageCell *node) - { - - } - - - void SerializingVisitor::visitCellCursorNodeBefore(CellCursor *cursor) - { - //qDebug("Visitin a cellcursor"); - } - - void SerializingVisitor::visitCellCursorNodeAfter(CellCursor *cursor) - { - - } -} diff --git a/OMNotebook_QT3/OMNotebook/serializingvisitor.h b/OMNotebook_QT3/OMNotebook/serializingvisitor.h deleted file mode 100644 index ced4fd0c318..00000000000 --- a/OMNotebook_QT3/OMNotebook/serializingvisitor.h +++ /dev/null @@ -1,107 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file serializingvisitor.h - * \author Ingemar Axelsson - */ - -#ifndef SERIALIZINGVISITOR_H -#define SERIALIZINGVISITOR_H - -using namespace std; - - -#include -#include -#include - -#include -#include - -#include "visitor.h" - - -namespace IAEX{ - /*! \class StoringVisitor - * \brief Traverses the cellstructure and * creates a serialized stream - * of the internal representation of * the document. - * - */ - class SerializingVisitor : public Visitor - { - //Q_OBJECT - public: - //SerializingVisitor(ofstream &out); - SerializingVisitor(QDomElement &element, QDomDocument &doc); - virtual ~SerializingVisitor(); - - virtual void visitCellNodeBefore(Cell *node); - virtual void visitCellNodeAfter(Cell *node); - - virtual void visitCellGroupNodeBefore(CellGroup *node); - virtual void visitCellGroupNodeAfter(CellGroup *node); - - virtual void visitTextCellNodeBefore(TextCell *node); - virtual void visitTextCellNodeAfter(TextCell *node); - - virtual void visitInputCellNodeBefore(InputCell *node); - virtual void visitInputCellNodeAfter(InputCell *node); - - virtual void visitCellCursorNodeBefore(CellCursor *cursor); - virtual void visitCellCursorNodeAfter(CellCursor *cursor); - - virtual void visitImageCellNodeBefore(ImageCell *node); - virtual void visitImageCellNodeAfter(ImageCell *node); - - private: - stack parents_; - //QDomElement parent_; - QDomElement currentElement_; - QDomDocument doc_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/smlhighlighter.h b/OMNotebook_QT3/OMNotebook/smlhighlighter.h deleted file mode 100644 index 6bc6cccb318..00000000000 --- a/OMNotebook_QT3/OMNotebook/smlhighlighter.h +++ /dev/null @@ -1,123 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _SML_SYNTAXHIGHLIGHTER_H -#define _SML_SYNTAXHIGHLIGHTER_H - -#include - -#include -#include - -#include "smlsyntaxhighlighter.h" - -namespace IAEX -{ - /*! \class SmlHighlighter - * \brief Implements syntaxhighlightning for Standard ML. - * - * Syntaxhighlightning for Standard ML. This class is not correctly - * implemented, or it is not event close to be finished. - * - * \todo Implement this correct. - */ - class SmlHighlighter : public SyntaxHighlighter - { - public: - SmlHighlighter() - : highlighter_(0), textEdit_(0) - { - initializeColors(); - } - virtual ~SmlHighlighter(){} - void setTextEdit(QTextEdit *textEdit){ textEdit_ = textEdit;} - virtual void rehighlight() - { - if(!highlighter_) - { - if(textEdit_) - highlighter_ = new SmlSyntaxHighlighter(textEdit_, colors_); - else - throw runtime_error("SMLHighlighter: No QTextEdit."); - } - - highlighter_->rehighlight(); - } - - private: - void initializeColors() - { - colors_.textForeground_ = QColor(0,0,0); - colors_.textBackground_ = QColor(0,0,0); - colors_.typeForeground_ = QColor(0,0,0); - colors_.typeBackground_ = QColor(0,0,0); - colors_.keywordForeground_ = QColor(255,0,0); - colors_.keywordBackground_ = QColor(0,0,0); - colors_.functionNameForeground_ = QColor(0,0,255); - colors_.functionNameBackground_ = QColor(0,0,0); - colors_.constantForeground_ = QColor(0,255,0); - colors_.constantBackground_ = QColor(0,0,0); - colors_.warningForeground_ = QColor(255,0,0); - colors_.warningBackground_ = QColor(0,0,0); - colors_.builtInForeground_ = QColor(0,0,255); - colors_.builtInBackground_ = QColor(0,0,0); - colors_.variableNameForeground_ = QColor(255,0,255); - colors_.variableNameBackground_ = QColor(0,0,0); - colors_.stringForeground_ = QColor(100,0,0); - colors_.stringBackground_ = QColor(0,0,0); - colors_.commentForeground_ = QColor(200,0,0); - colors_.commentBackground_ = QColor(0,0,0); - } - - private: - TextEditorFontAndColors colors_; - QSyntaxHighlighter *highlighter_; - QTextEdit *textEdit_; - }; -} - -#endif diff --git a/OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.cpp b/OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.cpp deleted file mode 100644 index f358c24c691..00000000000 --- a/OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include "smlinteractiveenvironment.h" - -namespace IAEX -{ - /*! \class SmlInteractiveEnvironment - * - * \brief Implements evaluation for Standard ML code. - * - * - * \todo Implement as singleton. All environments should use the - * same process. - * - * \todo Add some settings so it is possible to change the path to - * the sml application easily. - */ - SmlInteractiveEnvironment::SmlInteractiveEnvironment() - : smlprocess_(0) - { - startProcess(); - } - - - SmlInteractiveEnvironment::~SmlInteractiveEnvironment() - { - killProcess(); - } - - QString SmlInteractiveEnvironment::getResult() - { - return result_; - } - - void SmlInteractiveEnvironment::evalExpression(QString &expr) - { - //Flush? - smlprocess_->writeToStdin(QString(";")); - //startProcess(); - smlprocess_->writeToStdin(expr); - - //smlprocess_->closeStdin(); - } - - void SmlInteractiveEnvironment::updateErrorOutput() - { - if(smlprocess_->isRunning()) - { - result_ = QString("").append( - QString(smlprocess_->readStderr())).append(""); - } - } - - void SmlInteractiveEnvironment::updateOutput() - { - result_ = QString(smlprocess_->readStdout()); - } - - void SmlInteractiveEnvironment::startProcess() - { - //if(!smlprocess_->isRunning()) - if(!smlprocess_) - { - smlprocess_ = new QProcess(this); - smlprocess_->addArgument("sml"); - QObject::connect(smlprocess_, SIGNAL(readyReadStderr()), - this, SLOT(updateErrorOutput())); - QObject::connect(smlprocess_, SIGNAL(readyReadStdout()), - this, SLOT(updateOutput())); - - smlprocess_->start(); - } - } - - void SmlInteractiveEnvironment::killProcess() - { - smlprocess_->kill();//tryTerminate(); - smlprocess_ = 0; - } -} diff --git a/OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.h b/OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.h deleted file mode 100644 index 92a7296ef85..00000000000 --- a/OMNotebook_QT3/OMNotebook/smlinteractiveenvironment.h +++ /dev/null @@ -1,81 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _SMLINTERACTIVE_H -#define _SMLINTERACTIVE_H - -#include -#include -#include - -#include "inputcelldelegate.h" - -namespace IAEX -{ - class SmlInteractiveEnvironment : public QObject, public InputCellDelegate - { - Q_OBJECT - public: - SmlInteractiveEnvironment(); - virtual ~SmlInteractiveEnvironment(); - - virtual QString getResult(); - virtual void evalExpression(QString &expr); - - public slots: - void updateOutput(); - void updateErrorOutput(); - - private: - void startProcess(); - void killProcess(); - - QProcess *smlprocess_; - QString result_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.cpp b/OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.cpp deleted file mode 100644 index a24d068b51c..00000000000 --- a/OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include "smlsyntaxhighlighter.h" - -// QT includes -#include "qapplication.h" -#include "qfont.h" -#include "qtextedit.h" - -/*! \class SmlSyntaxHighlighter - * \deprecated Never used, use SmlHighlighter instead. - */ -SmlSyntaxHighlighter::SmlSyntaxHighlighter(QTextEdit* textEdit, - const TextEditorFontAndColors& fontAndColors) - : QSyntaxHighlighter(textEdit), - fontAndColors_(fontAndColors) -{ - font_ = QFont(fontAndColors_.fontFamily_, fontAndColors_.fontSize_); - - QString keywordPattern(QString("\\b(and(also))|e(lse(if|when)?|quation|xtends)|for") + - "|i(f|mport|n)|loop|not|or|p(rotected|ublic)|then|w(h(en|ile)|ithin))\\b"); - - QString typePattern(QString("\\b(bool|c(lass|on(nector|stant))|discrete|e(n(capsulated|d)") + - "|xternal)|f(inal|low|unction)|in(ner|put)|model|out(er|put)|pa(ckage|r(tial|ameter))" + - "|re(cord|declare|placeable)|type)\\b"); - - QString functionNamePattern(QString("\\b(a(bs|nalysisType)|c(ardinality|hange|eil|ross)|d(e(lay|der)") + - "|i(v|agonal))|edge|f(ill|loor)|i(dentity|n(itial|teger))|linspace|ma(trix|x)|min|mod|n(dims" + - "|oEvent)|o(nes|uterProduct)|pr(e|o(duct|mote))|re(init|m)|s(amle|calar|i(gn|ze)|kew" + - "|qrt|um|ymmetric)|t(erminal|ranspose)|vector|zeros)\\b"); - - QString constantPattern("\\b(false|true)\\b"); - - QString warningPattern("\\b(assert|terminate)\\b"); - - QString builtInPattern("\\b(annotation|connect)\\b"); - - QString variableNamePattern("\\b(time)\\b"); - - QString stringPattern("(\".*(([^\\\\]\")|$)|\"\")"); - QString endStringPattern(".*(([^\\\\]\")|^\"|$)"); - - QString lineCommentPattern("//.*"); - QString commentPattern("/\\*.*((\\*/)|$)"); - QString endCommentPattern(".*((\\*/)|$)"); - - keyword_.setPattern(keywordPattern); - type_.setPattern(typePattern); - functionName_.setPattern(functionNamePattern); - constant_.setPattern(constantPattern); - warning_.setPattern(warningPattern); - builtIn_.setPattern(builtInPattern); - variableName_.setPattern(variableNamePattern); - - string_.setPattern(stringPattern); - string_.setMinimal(true); - endString_.setPattern(endStringPattern); - endString_.setMinimal(true); - - lineComment_.setPattern(lineCommentPattern); - comment_.setPattern(commentPattern); - comment_.setMinimal(true); - endComment_.setPattern(endCommentPattern); - endComment_.setMinimal(true); -} - -/** - * - */ -SmlSyntaxHighlighter::~SmlSyntaxHighlighter() -{ -} - -/** - * - */ -// void SmlSyntaxHighlighter::setFontAndColors(const TextEditorFontAndColors& fontAndColors) -// { -// fontAndColors_ = fontAndColors; -// font_ = QFont(fontAndColors_.fontFamily_, fontAndColors_.fontSize_); -// rehighlight(); -// } - -/** - * - */ -int SmlSyntaxHighlighter::getIndexOfMinPositive(int value1, - int value2, - int value3) const -{ - if (value1 < 0 && value2 < 0 && value3 < 0) { - return -1; - } - else if ((value1 >= 0 && value2 < 0 && value3 < 0) || - (value1 >= 0 && value2 >= 0 && value3 < 0 && value1 < value2) || - (value1 >= 0 && value2 < 0 && value3 >= 0 && value1 < value3) || - (value1 >= 0 && value2 >= 0 && value3 >= 0 && value1 < value2 && value1 < value3)) - { - return 1; - } - else if ((value2 >= 0 && value1 < 0 && value3 < 0) || - (value2 >= 0 && value1 >= 0 && value3 < 0 && value2 < value1) || - (value2 >= 0 && value1 < 0 && value3 >= 0 && value2 < value3) || - (value2 >= 0 && value1 >= 0 && value3 >= 0 && value2 < value1 && value2 < value3)) - { - return 2; - } - else - { - return 3; - } -} - - int SmlSyntaxHighlighter::highlightStringsAndComments(const QString& text, int startPosition) - { - // Highlight strings and comments. - int pos(startPosition); - while (true) { - int lineCommentPos(lineComment_.search(text, pos)); - int commentPos(comment_.search(text, pos)); - int stringPos(string_.search(text, pos)); - switch(getIndexOfMinPositive(lineCommentPos, commentPos, stringPos)) - { - case 1: // Line comment (C++ comment) - setFormat(lineCommentPos, lineComment_.matchedLength(), font_, fontAndColors_.commentForeground_); - return 0; - - case 2: // Comment (C comment) - setFormat(commentPos, comment_.matchedLength(), font_, fontAndColors_.commentForeground_); - pos = commentPos + comment_.matchedLength(); - if (pos == (int)text.length()) { - return InComment; - } - break; - - case 3: // String - setFormat(stringPos, string_.matchedLength(), font_, fontAndColors_.stringForeground_); - pos = stringPos + string_.matchedLength(); - if (pos == (int)text.length()) { - return InString; - } - break; - - default: - return 0; - } - } -} - -/** - * - */ -int SmlSyntaxHighlighter::highlightParagraph(const QString& text, int previousEndState) -{ - setFormat(0, text.length(), font_, fontAndColors_.textForeground_); - - // Keyword - int pos(0); - while (pos >= 0) { - pos = keyword_.search(text, pos); - if (pos >= 0) { - setFormat(pos, keyword_.matchedLength(), font_, fontAndColors_.keywordForeground_); - pos += keyword_.matchedLength(); - } - } - - // Type - pos = 0; - while (pos >= 0) { - pos = type_.search(text, pos); - if (pos >= 0) { - setFormat(pos, type_.matchedLength(), font_, fontAndColors_.typeForeground_); - pos += type_.matchedLength(); - } - } - - // Function name - pos = 0; - while (pos >= 0) { - pos = functionName_.search(text, pos); - if (pos >= 0) { - setFormat(pos, functionName_.matchedLength(), font_, fontAndColors_.functionNameForeground_); - pos += functionName_.matchedLength(); - } - } - - // Constant - pos = 0; - while (pos >= 0) { - pos = constant_.search(text, pos); - if (pos >= 0) { - setFormat(pos, constant_.matchedLength(), font_, fontAndColors_.constantForeground_); - pos += constant_.matchedLength(); - } - } - - // Warning - pos = 0; - while (pos >= 0) { - pos = warning_.search(text, pos); - if (pos >= 0) { - setFormat(pos, warning_.matchedLength(), font_, fontAndColors_.warningForeground_); - pos += warning_.matchedLength(); - } - } - - // Built-in - pos = 0; - while (pos >= 0) { - pos = builtIn_.search(text, pos); - if (pos >= 0) { - setFormat(pos, builtIn_.matchedLength(), font_, fontAndColors_.builtInForeground_); - pos += builtIn_.matchedLength(); - } - } - - // Variable name - pos = 0; - while (pos >= 0) { - pos = variableName_.search(text, pos); - if (pos >= 0) { - setFormat(pos, variableName_.matchedLength(), font_, fontAndColors_.variableNameForeground_); - pos += variableName_.matchedLength(); - } - } - - // Open strings. - pos = 0; - if (previousEndState == InString) { - pos = endString_.search(text, pos); - setFormat(pos, endString_.matchedLength(), font_, fontAndColors_.stringForeground_); - pos += endString_.matchedLength(); - if (pos == (int)text.length()) { - return InString; - } else { - return highlightStringsAndComments(text, pos); - } - } - - // Open comments. - pos = 0; - if (previousEndState == InComment) { - pos = endComment_.search(text, pos); - setFormat(pos, endComment_.matchedLength(), font_, fontAndColors_.commentForeground_); - pos += endComment_.matchedLength(); - if (pos == (int)text.length()) { - return InComment; - } else { - return highlightStringsAndComments(text, pos); - } - } - - // Strings and comments. - return highlightStringsAndComments(text, 0); -} diff --git a/OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.h b/OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.h deleted file mode 100644 index c7c922d114a..00000000000 --- a/OMNotebook_QT3/OMNotebook/smlsyntaxhighlighter.h +++ /dev/null @@ -1,146 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef SML_SYNTAX_HIGHLIGHTER_H_ -#define SML_SYNTAX_HIGHLIGHTER_H_ - -// QT includes -#include "qregexp.h" -#include - -// QT forward declarations -class QTextEdit; -class QFont; - -class TextEditorFontAndColors -{ -public: - friend bool operator==(const TextEditorFontAndColors& lhs, const - TextEditorFontAndColors& rhs); - friend bool operator!=(const TextEditorFontAndColors& lhs, const - TextEditorFontAndColors& rhs); - -public: - QString fontFamily_; - int fontSize_; - - QColor textForeground_; - QColor textBackground_; - QColor typeForeground_; - QColor typeBackground_; - QColor keywordForeground_; - QColor keywordBackground_; - QColor functionNameForeground_; - QColor functionNameBackground_; - QColor constantForeground_; - QColor constantBackground_; - QColor warningForeground_; - QColor warningBackground_; - QColor builtInForeground_; - QColor builtInBackground_; - QColor variableNameForeground_; - QColor variableNameBackground_; - QColor stringForeground_; - QColor stringBackground_; - QColor commentForeground_; - QColor commentBackground_; -}; - -/** - * - */ -class SmlSyntaxHighlighter : public QSyntaxHighlighter//, QObject -{ -// Q_OBJECT - -public: - SmlSyntaxHighlighter(QTextEdit* textEdit, - const TextEditorFontAndColors& fontAndColors); - ~SmlSyntaxHighlighter(); - - int highlightParagraph(const QString& text, int previousEndState); - -public slots: - //void setFontAndColors(const TextEditorFontAndColors& fontAndColors); - -private: - enum EndState { InComment = 1, InString = 2 }; - -private: - int getIndexOfMinPositive(int value1, int value2, int value3) const; - int highlightStringsAndComments(const QString& text, int startPosition); - -private: - TextEditorFontAndColors fontAndColors_; - QFont font_; - - QRegExp keyword_; - QRegExp type_; - QRegExp functionName_; - QRegExp constant_; - QRegExp warning_; - QRegExp builtIn_; - QRegExp variableName_; - QRegExp string_; - QRegExp endString_; - QRegExp lineComment_; - QRegExp comment_; - QRegExp endComment_; - - QColor foregroundColor_; - QColor typeColor_; - QColor keywordColor_; - QColor functionNameColor_; - QColor constantColor_; - QColor warningColor_; - QColor builtInColor_; - QColor variableNameColor_; - QColor stringColor_; - QColor commentColor_; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/stylesheet.cpp b/OMNotebook_QT3/OMNotebook/stylesheet.cpp deleted file mode 100644 index 90b327d9523..00000000000 --- a/OMNotebook_QT3/OMNotebook/stylesheet.cpp +++ /dev/null @@ -1,649 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include -#include - -#include -#include -#include -#include - -#include "stylesheet.h" -using namespace std; - -namespace IAEX -{ - -/*! \class Stylesheet - * \brief Reads a stylesheet file and creates - * correct QStyleSheet objects with the defined format. - * - * - * \todo Add support for caching different styles, this will speed up - * the creation of cells a little bit. It is just the first cell of - * that type that will take time. Use some variant of the Singleton - * pattern. - * - */ - -/*! \brief Reads a file and create a DOM tree from that file. - * \author Ingemar Axelsson - * \date 2004 - * - * Reads a given file and tries to construct a DOM tree from that - * file. If the file is corrupt the whole program will exit. - * - * \todo Add some exceptions here. Maybe program should not - * exit. There are many way of dealing whit this error. - * - * \todo Add stylesheet to IAEX namespace. - * - * \param filename File to be read. - */ - Stylesheet::Stylesheet(const QString &filename) - { - //read a stylesheet file. - doc_ = new QDomDocument("StyleDoc"); - - QFile file(filename); - - if(!file.open(IO_ReadOnly)) - {//return -1 - std::cerr << "Could not open file: " << filename; - - // 2005-10-03 AF, thorw exception insted of exit - throw std::exception( "Could not open file: " + filename); - //std::exit(-1); - } - - //Här kan det bli feeeeel! - if(!doc_->setContent(&file)) - { - file.close(); - //return -2; - std::cerr << "Could not read content from file: " << filename - << " Probably some syntax error in the xml file"; - std::exit(-2); - } - file.close(); - - //Get all available styles. - QDomElement root = doc_->documentElement(); - QDomNode n = root.firstChild(); - - //Search for the correct style - while(!n.isNull()) - { - QDomElement e = n.toElement(); - if(!e.isNull()) - { - if(e.tagName() == "style") - { - styles_.push_back(QString(e.attribute("name",""))); - } - } - n = n.nextSibling(); - } - } - - Stylesheet *Stylesheet::instance_ = 0; - - /* - * \todo Make it possible to change stylesheet file. - */ - Stylesheet *Stylesheet::instance(const QString &filename) - { - if(!instance_) - instance_ = new Stylesheet(filename); - - return instance_; - } - - vector Stylesheet::getAvailableStyles() const - { - return styles_; - } - - void Stylesheet::removeTagsFromString(QString &txt, const QString &style) - { - QDomElement root = doc_->documentElement(); - QDomNode n = root.firstChild(); - - //Search for the correct style - while( !n.isNull()) - { - QDomElement e = n.toElement(); - if(!e.isNull()) - { - if(e.attribute("name","") == style) - { - //cerr << "Before: " << txt << endl; - QString otag = e.attribute("tag","").prepend("<").append(">"); - QString ctag = e.attribute("tag","").prepend(""); - txt.remove(otag); - txt.remove(ctag); - - //cerr << "After: " << txt << endl; - } - } - n = n.nextSibling(); - } - } - -/*! - * \example stylesheet.xml - * - * There are a lot of different attribute values that can be - * used. Here is a list of all values that can be used for different - * attributes: - * - style - * - name (string) - * - margin - * - left (attribute, integer) - * - right (attribute, integer) - * - top (attribute, integer) - * - bottom (attribute, integer) - * - alignment - * - left - * - right - * - center - * - justify - * - verticalalignment - * - baseline - * - sub - subscription - * - super - superscription - * - whitespacemode - * - normal - * - pre - preformatted - * - nowrap - * - font - * - family - see Qt manual - * - size (integer) - * - weight - * - 0..99 - * - light - * - normal - * - demibold - * - bold - * - black - * - italic - * - strikeout - * - underline - * - color - * - red - * - green - * - blue - * - * - * Read the examplefile if something is unclear. - * - */ - -/*! \brief Get the correct formatting for a textcell. - * \author Ingemar Axelsson - * - * \deprecated - * - * Get the correct formatting for a textcell depending on what type of - * textcell it is. The formatting is defined in a xml document. Below - * is an example of a stylesheet xml document. - * - * \todo Implement so styles uses the standard tags instead of just one - * single tag. Then this works almost as it seems to. - * - * \param sheet Stylesheet to use for getting properties. Maybe not used. - * \param style String identifying which style to return. - * \return A stylesheet with the properties given in the stylesheet file. - */ - QStyleSheet *Stylesheet::getStyle(QStyleSheet *sheet, - const QString &style) const - { - //Create a new stylesheet - //QStyleSheet *mysheet = new QStyleSheet(this, 0); - //QStyleSheetItem *styleitem = sheet->item("div"); //Should not be DIV - QStyleSheetItem *styleitem = sheet->item("body"); - - ///Parse the XML DOM tree. - QDomElement root = doc_->documentElement(); - QDomNode n = root.firstChild(); - - //Search for the correct style - while( !n.isNull()) - { - QDomElement e = n.toElement(); - if(!e.isNull()) - { - if(e.attribute("name","") == style) - { - //Rätt style. Läs in och skapa QStylesheet. - QDomNode p = e.firstChild(); - - traverseStyleSettings(p, styleitem); - } - } - n = n.nextSibling(); - } - - return sheet; - } - - -/*! \brief wraps notebook text attributes to QT text attributes. - * \author Ingemar Axelsson - * \date 2004-12-10, 10:13:31 - * - * \deprecated - * - * \todo Give this member a better name. It is not very selfexplaining. - * - * \param attribute notebook attribute name. - * \param value notebook attribute value. - * \returns A QStyleSheet pointer with the correct values inserted. - */ - QStyleSheet *Stylesheet::getStyle(QStyleSheet *sheet, - const QString &attribute, - const QString &value) const - { - QStyleSheetItem *styleitem = sheet->item("div"); - if(attribute == "TextAlignment") - { - if(value == "Left") - { - styleitem->setAlignment(Qt::AlignLeft); - } - else if(value == "Right") - { - styleitem->setAlignment(Qt::AlignRight); - } - else - { - std::cerr << "Alignment value not correct: " << value; - } - } - else if(attribute == "FontWeight") - { - int weight = std::atoi(value); - - if(weight > 99 || weight <= 0) - weight = 50; - - styleitem->setFontWeight(weight); - } - else if(attribute == "FontSlant") - { - //This does only occur when italic is present. - //delete italic property to disable. - if(value =="Italic") - { - styleitem->setFontItalic(true); - } - } - else if(attribute == "FontSize") - { - styleitem->setFontSize(std::atoi(value)); - } - else - { - //std::cerr << "Attribute: " << attribute - //<< ", is not implemented." << std::endl; - } - - return sheet; - } - - /*! Changes the style on the textcell to style. - * - * \return Could be void! - */ - QString Stylesheet::getStyle(QTextEdit *textedit, - const QString &style) const - { - //Try to just get plaintext! - Qt::TextFormat tmp = textedit->textFormat(); - textedit->setTextFormat(Qt::PlainText); - - QString text = textedit->text(); - -// cerr << "STYLESHEET: " << text << endl; - textedit->setTextFormat(tmp); - - //QString text = textedit->text(); - QStyleSheet *sheet = QStyleSheet::defaultSheet();//textedit->styleSheet(); - - - //Create a new stylesheet - //QStyleSheet *mysheet = new QStyleSheet(this, 0); - //QStyleSheetItem *styleitem = sheet->item("qt"); - - ///Parse the XML DOM tree. - QDomElement root = doc_->documentElement(); - QDomNode n = root.firstChild(); - - //Search for the correct style - while( !n.isNull()) - { - QDomElement e = n.toElement(); - if(!e.isNull()) - { - if(e.attribute("name","") == style) - { - //Insert tag. - QString tag = e.attribute("tag", ""); - QString otag = tag; - QString ctag = tag; - otag.prepend("<").append(">"); - ctag.prepend(""); - - //Tag inputtext. - text = text.prepend(otag).append(ctag); - - QStyleSheetItem *styleitem = sheet->item(tag); - - //Rätt style. Läs in och skapa QStylesheet. - QDomNode p = e.firstChild(); - - traverseStyleSettings(p, styleitem); - - textedit->setStyleSheet(sheet); - } - } - n = n.nextSibling(); - } - - return text; - } - - - void Stylesheet::traverseStyleSettings(QDomNode p, - QStyleSheetItem *item) const - { - if(!item) - cerr << "TRAVERSE... No ITEM SET!!" << endl; - - while(!p.isNull()) - { - QDomElement f = p.toElement(); - if(f.tagName() == "margin") - { - parseMarginTag(f, item); - } - else if(f.tagName() == "alignment") - { - parseAlignmentTag(f, item); - } - else if(f.tagName() == "verticalalignment") - { - parseVAlignmentTag(f, item); - } - else if(f.tagName() == "whitespacemode") - { - parseWhitespaceTag(f, item); - } - else if(f.tagName() == "font") - { - parseFontTag(f, item); - } - else if(f.tagName() == "liststyle") - { - parseListstyleTag(f, item); - } - else - { - std::cerr << "Style not known" << f.tagName(); - } - - p = p.nextSibling(); - } - } - - - void Stylesheet::parseMarginTag(QDomElement f, QStyleSheetItem *item) const - { - if(f.attribute("left","")) - item->setMargin(QStyleSheetItem::MarginLeft, - std::atoi(f.attribute("left",""))); - if(f.attribute("right","")) - item->setMargin(QStyleSheetItem::MarginRight, - std::atoi(f.attribute("right",""))); - if(f.attribute("top","")) - item->setMargin(QStyleSheetItem::MarginTop, - std::atoi(f.attribute("top",""))); - if(f.attribute("bottom","")) - item->setMargin(QStyleSheetItem::MarginBottom, - std::atoi(f.attribute("bottom",""))); - } - - void Stylesheet::parseAlignmentTag(QDomElement f, - QStyleSheetItem *item) const - { - if(f.text() == "left") - { - item->setAlignment(Qt::AlignLeft); - } - else if(f.text() == "right") - { - item->setAlignment(Qt::AlignRight); - } - else if(f.text() == "center") - { - item->setAlignment(Qt::AlignCenter); - } - else if(f.text() == "justify") - { - item->setAlignment(Qt::AlignJustify); - } - else - { - std::cerr << "Alignment value not correct: " << f.text(); - } - } - - void Stylesheet::parseVAlignmentTag(QDomElement f, - QStyleSheetItem *item) const - { - //Ska den här vara möjlig över huvudtaget? - if(f.text() == "baseline") - { - item->setVerticalAlignment(QStyleSheetItem::VAlignBaseline); - } - else if(f.text() == "sub") - { - item->setVerticalAlignment(QStyleSheetItem::VAlignSub); - } - else if(f.text() == "super") - { - item->setVerticalAlignment(QStyleSheetItem::VAlignSuper); - } - else - { - std::cerr << "Value not defined: " << f.text(); - } - } - void Stylesheet::parseWhitespaceTag(QDomElement f, - QStyleSheetItem *item) const - { - if(f.text() == "normal") - { - item->setWhiteSpaceMode(QStyleSheetItem::WhiteSpaceNormal); - } - else if(f.text() == "pre") - { - item->setWhiteSpaceMode(QStyleSheetItem::WhiteSpaceNoWrap); - } - else if(f.text() == "nowrap") - { - item->setWhiteSpaceMode(QStyleSheetItem::WhiteSpaceNoWrap); - } - else - { - std::cerr << "Value not defined: " << f.text(); - } - } - void Stylesheet::parseFontTag(QDomElement f, - QStyleSheetItem *item) const - { - //cerr << "ParseFontTag()" << endl; - - item->setFontItalic(false); - //item->setFontStrikeOut(false); - //item->setFontUnderline(false); - - QDomNode fontnode = f.firstChild(); - while(!fontnode.isNull()) - { - QDomElement fontelement = fontnode.toElement(); - - if(fontelement.tagName() == "family") - { - item->setFontFamily(fontelement.text()); - } - else if(fontelement.tagName() == "size") - { - item->setFontSize(std::atoi(fontelement.text())); - } - else if(fontelement.tagName() == "weight") - { - //Error check must be done! - int weight = 50; //Normal by default - if(fontelement.text() == "bold") - { - weight = 75; - } - else if(fontelement.text() == "demibold") - { - weight = 63; - } - else if(fontelement.text() == "light") - { - weight = 25; - } - else if(fontelement.text() == "black") - { - weight = 87; - } - else if(fontelement.text() == "normal") - { - weight = 50; - } - else - { //kolla storlek. 0 - 99... text ger 0. - weight = std::atoi(fontelement.text()); - - if(weight > 99 || weight <= 0) - weight = 50; - } - - item->setFontWeight(weight); - } - else if(fontelement.tagName() == "italic") - { - //qDebug("setItalic"); - //This does only occur when italic is present. - //delete italic property to disable. - item->setFontItalic(true); - } - else if(fontelement.tagName() == "strikeout") - { - item->setFontStrikeOut(true); - } - else if(fontelement.tagName() == "underline") - { - item->setFontUnderline(true); - } - else if(fontelement.tagName() == "color") - { - int red = std::atoi(fontelement.attribute("red","")); - int green = std::atoi(fontelement.attribute("green","")); - int blue = std::atoi(fontelement.attribute("blue","")); - - item->setColor(QColor(red, green, blue)); - } - else - { - std::cerr << "font tag not specified: " - << fontelement.tagName(); - } - - fontnode = fontnode.nextSibling(); - } - } - - void Stylesheet::parseListstyleTag(QDomElement f, - QStyleSheetItem *item) const - { - if(f.text() == "disc") - { - item->setListStyle(QStyleSheetItem::ListDisc); - } - else if(f.text() == "circle") - { - item->setListStyle(QStyleSheetItem::ListCircle); - } - else if(f.text() == "square") - { - item->setListStyle(QStyleSheetItem::ListSquare); - } - else if(f.text() == "decimal") - { - item->setListStyle(QStyleSheetItem::ListDecimal); - } - else if(f.text() == "loweralpha") - { - item->setListStyle(QStyleSheetItem::ListLowerAlpha); - } - else if(f.text() == "upperalpha") - { - item->setListStyle(QStyleSheetItem::ListUpperAlpha); - } - else - { - std::cerr << "Value not defined: " << f.text(); - } - } -} diff --git a/OMNotebook_QT3/OMNotebook/stylesheet.h b/OMNotebook_QT3/OMNotebook/stylesheet.h deleted file mode 100644 index 3ce744dd1fe..00000000000 --- a/OMNotebook_QT3/OMNotebook/stylesheet.h +++ /dev/null @@ -1,104 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file stylesheet.h - * \author Ingemar Axelsson - */ - -#ifndef STYLESHEET_H -#define STYLESHEET_H - -#include -#include -#include -#include -//#include -#include - -using namespace std; - -namespace IAEX -{ - - class Stylesheet : public QObject - { - Q_OBJECT - - public: - static Stylesheet *instance(const QString &filename); - - QStyleSheet *getStyle(QStyleSheet *sheet, - const QString &style) const; - - QStyleSheet *getStyle(QStyleSheet *sheet, - const QString &attribute, - const QString &value) const; - - QString getStyle(QTextEdit *text, - const QString &style) const; - - vector getAvailableStyles() const; - void removeTagsFromString(QString &txt, const QString &style); - protected: - void traverseStyleSettings(QDomNode p, QStyleSheetItem *item) const; - void parseMarginTag(QDomElement f, QStyleSheetItem *item) const; - void parseAlignmentTag(QDomElement f, QStyleSheetItem *item) const; - void parseVAlignmentTag(QDomElement f, QStyleSheetItem *item) const; - void parseWhitespaceTag(QDomElement f, QStyleSheetItem *item) const; - void parseFontTag(QDomElement f, QStyleSheetItem *item) const; - void parseListstyleTag(QDomElement f, QStyleSheetItem *item) const; - - private: - Stylesheet(const QString &filename); - - QDomDocument *doc_; - static Stylesheet *instance_; - - vector styles_; - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/stylesheet.xml b/OMNotebook_QT3/OMNotebook/stylesheet.xml deleted file mode 100644 index 417139b66ab..00000000000 --- a/OMNotebook_QT3/OMNotebook/stylesheet.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OMNotebook_QT3/OMNotebook/syntax_highlighter.cpp b/OMNotebook_QT3/OMNotebook/syntax_highlighter.cpp deleted file mode 100644 index c94a124b243..00000000000 --- a/OMNotebook_QT3/OMNotebook/syntax_highlighter.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include "syntax_highlighter.hpp" - -// MME includes -//#include "options_manager.hpp" - -// QT includes -#include "qapplication.h" -#include "qfont.h" -#include "qtextedit.h" - -/** - * - */ -ModelicaSyntaxHighlighter::ModelicaSyntaxHighlighter(QTextEdit* textEdit, - const TextEditorFontAndColors& fontAndColors) - : QSyntaxHighlighter(textEdit), - fontAndColors_(fontAndColors) -{ - font_ = QFont(fontAndColors_.fontFamily_, fontAndColors_.fontSize_); - - QString keywordPattern(QString("\\b(a(lgorithm|nd)|e(lse(if|when)?|quation|xtends)|for") + - "|i(f|mport|n)|loop|not|or|p(rotected|ublic)|then|w(h(en|ile)|ithin))\\b"); - - QString typePattern(QString("\\b(block|c(lass|on(nector|stant))|discrete|e(n(capsulated|d)") + - "|xternal)|f(inal|low|unction)|in(ner|put)|model|out(er|put)|pa(ckage|r(tial|ameter))" + - "|re(cord|declare|placeable)|type)\\b"); - - QString functionNamePattern(QString("\\b(a(bs|nalysisType)|c(ardinality|hange|eil|ross)|d(e(lay|der)") + - "|i(v|agonal))|edge|f(ill|loor)|i(dentity|n(itial|teger))|linspace|ma(trix|x)|min|mod|n(dims" + - "|oEvent)|o(nes|uterProduct)|pr(e|o(duct|mote))|re(init|m)|s(amle|calar|i(gn|ze)|kew" + - "|qrt|um|ymmetric)|t(erminal|ranspose)|vector|zeros)\\b"); - - QString constantPattern("\\b(false|true)\\b"); - - QString warningPattern("\\b(assert|terminate)\\b"); - - QString builtInPattern("\\b(annotation|connect)\\b"); - - QString variableNamePattern("\\b(time)\\b"); - - QString stringPattern("(\".*(([^\\\\]\")|$)|\"\")"); - QString endStringPattern(".*(([^\\\\]\")|^\"|$)"); - - QString lineCommentPattern("//.*"); - QString commentPattern("/\\*.*((\\*/)|$)"); - QString endCommentPattern(".*((\\*/)|$)"); - - keyword_.setPattern(keywordPattern); - type_.setPattern(typePattern); - functionName_.setPattern(functionNamePattern); - constant_.setPattern(constantPattern); - warning_.setPattern(warningPattern); - builtIn_.setPattern(builtInPattern); - variableName_.setPattern(variableNamePattern); - - string_.setPattern(stringPattern); - string_.setMinimal(true); - endString_.setPattern(endStringPattern); - endString_.setMinimal(true); - - lineComment_.setPattern(lineCommentPattern); - comment_.setPattern(commentPattern); - comment_.setMinimal(true); - endComment_.setPattern(endCommentPattern); - endComment_.setMinimal(true); -} - -/** - * - */ -ModelicaSyntaxHighlighter::~ModelicaSyntaxHighlighter() -{ -} - -/** - * - */ -// void ModelicaSyntaxHighlighter::setFontAndColors(const TextEditorFontAndColors& fontAndColors) -// { -// fontAndColors_ = fontAndColors; -// font_ = QFont(fontAndColors_.fontFamily_, fontAndColors_.fontSize_); -// rehighlight(); -// } - -/** - * - */ -int ModelicaSyntaxHighlighter::getIndexOfMinPositive(int value1, - int value2, - int value3) const -{ - if (value1 < 0 && value2 < 0 && value3 < 0) { - return -1; - } - else if ((value1 >= 0 && value2 < 0 && value3 < 0) || - (value1 >= 0 && value2 >= 0 && value3 < 0 && value1 < value2) || - (value1 >= 0 && value2 < 0 && value3 >= 0 && value1 < value3) || - (value1 >= 0 && value2 >= 0 && value3 >= 0 && value1 < value2 && value1 < value3)) - { - return 1; - } - else if ((value2 >= 0 && value1 < 0 && value3 < 0) || - (value2 >= 0 && value1 >= 0 && value3 < 0 && value2 < value1) || - (value2 >= 0 && value1 < 0 && value3 >= 0 && value2 < value3) || - (value2 >= 0 && value1 >= 0 && value3 >= 0 && value2 < value1 && value2 < value3)) - { - return 2; - } - else - { - return 3; - } -} - - int ModelicaSyntaxHighlighter::highlightStringsAndComments(const QString& text, int startPosition) - { - // Highlight strings and comments. - int pos(startPosition); - while (true) { - int lineCommentPos(lineComment_.search(text, pos)); - int commentPos(comment_.search(text, pos)); - int stringPos(string_.search(text, pos)); - switch(getIndexOfMinPositive(lineCommentPos, commentPos, stringPos)) - { - case 1: // Line comment (C++ comment) - setFormat(lineCommentPos, lineComment_.matchedLength(), font_, fontAndColors_.commentForeground_); - return 0; - - case 2: // Comment (C comment) - setFormat(commentPos, comment_.matchedLength(), font_, fontAndColors_.commentForeground_); - pos = commentPos + comment_.matchedLength(); - if (pos == (int)text.length()) { - return InComment; - } - break; - - case 3: // String - setFormat(stringPos, string_.matchedLength(), font_, fontAndColors_.stringForeground_); - pos = stringPos + string_.matchedLength(); - if (pos == (int)text.length()) { - return InString; - } - break; - - default: - return 0; - } - } -} - -/** - * - */ -int ModelicaSyntaxHighlighter::highlightParagraph(const QString& text, int previousEndState) -{ - setFormat(0, text.length(), font_, fontAndColors_.textForeground_); - - // Keyword - int pos(0); - while (pos >= 0) { - pos = keyword_.search(text, pos); - if (pos >= 0) { - setFormat(pos, keyword_.matchedLength(), font_, fontAndColors_.keywordForeground_); - pos += keyword_.matchedLength(); - } - } - - // Type - pos = 0; - while (pos >= 0) { - pos = type_.search(text, pos); - if (pos >= 0) { - setFormat(pos, type_.matchedLength(), font_, fontAndColors_.typeForeground_); - pos += type_.matchedLength(); - } - } - - // Function name - pos = 0; - while (pos >= 0) { - pos = functionName_.search(text, pos); - if (pos >= 0) { - setFormat(pos, functionName_.matchedLength(), font_, fontAndColors_.functionNameForeground_); - pos += functionName_.matchedLength(); - } - } - - // Constant - pos = 0; - while (pos >= 0) { - pos = constant_.search(text, pos); - if (pos >= 0) { - setFormat(pos, constant_.matchedLength(), font_, fontAndColors_.constantForeground_); - pos += constant_.matchedLength(); - } - } - - // Warning - pos = 0; - while (pos >= 0) { - pos = warning_.search(text, pos); - if (pos >= 0) { - setFormat(pos, warning_.matchedLength(), font_, fontAndColors_.warningForeground_); - pos += warning_.matchedLength(); - } - } - - // Built-in - pos = 0; - while (pos >= 0) { - pos = builtIn_.search(text, pos); - if (pos >= 0) { - setFormat(pos, builtIn_.matchedLength(), font_, fontAndColors_.builtInForeground_); - pos += builtIn_.matchedLength(); - } - } - - // Variable name - pos = 0; - while (pos >= 0) { - pos = variableName_.search(text, pos); - if (pos >= 0) { - setFormat(pos, variableName_.matchedLength(), font_, fontAndColors_.variableNameForeground_); - pos += variableName_.matchedLength(); - } - } - - // Open strings. - pos = 0; - if (previousEndState == InString) { - pos = endString_.search(text, pos); - setFormat(pos, endString_.matchedLength(), font_, fontAndColors_.stringForeground_); - pos += endString_.matchedLength(); - if (pos == (int)text.length()) { - return InString; - } else { - return highlightStringsAndComments(text, pos); - } - } - - // Open comments. - pos = 0; - if (previousEndState == InComment) { - pos = endComment_.search(text, pos); - setFormat(pos, endComment_.matchedLength(), font_, fontAndColors_.commentForeground_); - pos += endComment_.matchedLength(); - if (pos == (int)text.length()) { - return InComment; - } else { - return highlightStringsAndComments(text, pos); - } - } - - // Strings and comments. - return highlightStringsAndComments(text, 0); -} diff --git a/OMNotebook_QT3/OMNotebook/syntax_highlighter.hpp b/OMNotebook_QT3/OMNotebook/syntax_highlighter.hpp deleted file mode 100644 index 8dd6fcbd09c..00000000000 --- a/OMNotebook_QT3/OMNotebook/syntax_highlighter.hpp +++ /dev/null @@ -1,151 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef SYNTAX_HIGHLIGHTER_HPP_ -#define SYNTAX_HIGHLIGHTER_HPP_ - -// MME includes -//#include "options_manager.hpp" - -// QT includes -#include "qregexp.h" -#include - -// QT forward declarations -class QTextEdit; -class QFont; - -/*! \class TextEditorFontAndColors - * - * \brief A structure for describing colors for different keywords. - */ -class TextEditorFontAndColors -{ -public: - friend bool operator==(const TextEditorFontAndColors& lhs, const - TextEditorFontAndColors& rhs); - friend bool operator!=(const TextEditorFontAndColors& lhs, const - TextEditorFontAndColors& rhs); - -public: - QString fontFamily_; - int fontSize_; - - QColor textForeground_; - QColor textBackground_; - QColor typeForeground_; - QColor typeBackground_; - QColor keywordForeground_; - QColor keywordBackground_; - QColor functionNameForeground_; - QColor functionNameBackground_; - QColor constantForeground_; - QColor constantBackground_; - QColor warningForeground_; - QColor warningBackground_; - QColor builtInForeground_; - QColor builtInBackground_; - QColor variableNameForeground_; - QColor variableNameBackground_; - QColor stringForeground_; - QColor stringBackground_; - QColor commentForeground_; - QColor commentBackground_; -}; - - -class ModelicaSyntaxHighlighter : public QSyntaxHighlighter//, QObject -{ -// Q_OBJECT - -public: - ModelicaSyntaxHighlighter(QTextEdit* textEdit, - const TextEditorFontAndColors& fontAndColors); - ~ModelicaSyntaxHighlighter(); - - int highlightParagraph(const QString& text, int previousEndState); - -public slots: - //void setFontAndColors(const TextEditorFontAndColors& fontAndColors); - -private: - enum EndState { InComment = 1, InString = 2 }; - -private: - int getIndexOfMinPositive(int value1, int value2, int value3) const; - int highlightStringsAndComments(const QString& text, int startPosition); - -private: - TextEditorFontAndColors fontAndColors_; - QFont font_; - - QRegExp keyword_; - QRegExp type_; - QRegExp functionName_; - QRegExp constant_; - QRegExp warning_; - QRegExp builtIn_; - QRegExp variableName_; - QRegExp string_; - QRegExp endString_; - QRegExp lineComment_; - QRegExp comment_; - QRegExp endComment_; - - QColor foregroundColor_; - QColor typeColor_; - QColor keywordColor_; - QColor functionNameColor_; - QColor constantColor_; - QColor warningColor_; - QColor builtInColor_; - QColor variableNameColor_; - QColor stringColor_; - QColor commentColor_; -}; - -#endif diff --git a/OMNotebook_QT3/OMNotebook/syntaxhighlighter.h b/OMNotebook_QT3/OMNotebook/syntaxhighlighter.h deleted file mode 100644 index 8d61fd2c220..00000000000 --- a/OMNotebook_QT3/OMNotebook/syntaxhighlighter.h +++ /dev/null @@ -1,69 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _SYNTAXHIGHLIGHTER_H -#define _SYNTAXHIGHLIGHTER_H - -#include -#include - -namespace IAEX -{ - /*! \interface SyntaxHighlighter - * \brief Interface that syntaxhighlighters needs to obey to. - * - */ - class SyntaxHighlighter - { - public: - //virtual QSyntaxHighlighter *createHighlighter(QTextEdit *textEdit) = 0; - virtual void rehighlight() = 0; - virtual void setTextEdit(QTextEdit *) = 0; - }; -} - -#endif diff --git a/OMNotebook_QT3/OMNotebook/textcell.cpp b/OMNotebook_QT3/OMNotebook/textcell.cpp deleted file mode 100644 index 4df8bcd9b0c..00000000000 --- a/OMNotebook_QT3/OMNotebook/textcell.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -//STD Headers -#include -#include -#include - -//QT Headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//IAEX Headers -#include "textcell.h" - -namespace IAEX{ - - /*! \class MyTextBrowser - * \brief extends QTextBrowser. Mostly so I can catch when a user - * clicks on a link without a change in textbrowsers content. - * - * QT bugs: - * - * \li Try to write a lot of fi after eachother. Then the - * textcursor starts to fly away. This has to be a bug. In qt - * 3.3.3. - * \li SuperScript tags does not work with large fonts. - */ - MyTextBrowser::MyTextBrowser(QWidget *parent, const char *name) - : QTextBrowser(parent, name) - { - setTextFormat(Qt::RichText); - - //Place the cursor in between. - //setText("Mamma < div > 6 < /div >"); //Does not work. - //setCursorPosition(0,5); - } - - MyTextBrowser::~MyTextBrowser(){} - - void MyTextBrowser::setSource(const QString &name) - { - emit openLink(new QUrl(context(), name));///??? - } - - - /*! \class TextCell - * \brief A concrete cellclass using QTextEdit as mainwidget. - * - * TextCell is a class that fulfills the Cell interface. It has the - * behavior of both QTextEdit and Cell. It is used to display texts - * in a cell. It supports simple undo, redo, cut, copy, paste. The - * text can be edited if the setReadOnly flag is set to - * false. Otherwise text is just selectable. The later is the - * default. - * - * \todo Add members to fulfill the QTextEdit interface. This is - * very nice when it is needed. - * - * \todo Add margins around the qtextedit widget. This can be very - * useful for different kind of purposes. - * - * \bug Set so tab focuses on next cell. - */ - TextCell::TextCell(QWidget *parent, const char *name) - : Cell(parent, name) - { - setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - setFocusPolicy(QWidget::NoFocus); - - createTextWidget(); - } - - TextCell::TextCell(TextCell &t) - : Cell(t) - { - //cout << "TEXT: " << t.text() << endl; - setText(t.text()); - setStyle(t.style()); - } - - TextCell::~TextCell() - { - setMainWidget(0); - delete text_; - } - - void TextCell::createTextWidget() - { - //text_ = new QTextBrowser(this, "textbrowser"); - text_ = new MyTextBrowser(this, "myBrowser"); - //text_->setFocusProxy(this); - //text_->setTabChangesFocus(TRUE); - - setMainWidget(text_); - - connect(text_, SIGNAL(returnPressed()), - this, SLOT(contentChanged())); - - connect(text_, SIGNAL(textChanged()), - this, SLOT(textChangedInternal())); - - connect(text_, SIGNAL(clicked(int, int)), - this, SLOT(clickEvent(int, int))); - -// connect(text_, SIGNAL(openLink(QUrl *)), -// this, SLOT(openLinkInternal(QUrl *))); - - connect(text_, SIGNAL(openLink(QUrl *)), - this, SLOT(openLinkInternal(QUrl *))); - - text_->setFrameStyle(QFrame::NoFrame); - text_->setReadOnly(true); - text_->setHScrollBarMode(QScrollView::AlwaysOff); - text_->setVScrollBarMode(QScrollView::AlwaysOff); - text_->setResizePolicy(QScrollView::AutoOneFit); - text_->setStyleSheet(QStyleSheet::defaultSheet()); - text_->setAutoFormatting(QTextEdit::AutoNone); - - //For testing only. - //text_->setTextFormat(Qt::PlainText); - - contentChanged(); - } - - /*! - * \todo Is there another better way to implement this. - * - * This should probably be done with a command. - */ - void TextCell::clickEvent(int para, int pos) - { - emit clicked(this); - } - - void TextCell::viewExpression(const bool expr) - { - if(expr) - { - QString txt = text_->text(); - text_->setTextFormat(Qt::PlainText); - text_->setText(txt); - } - else - { - text_->setTextFormat(Qt::RichText); - setStyle(Cell::style()); - } - - text_->setText(text_->text()); //Update - } - - /*! \brief Sets the visible text. - * - * Sets the text that should be visible. Can change the cellheight if - * the text is very long. - * - * \param text Text that should be visible inside the cell mainarea. - */ - void TextCell::setText(QString text) - { - Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); - - text_->setText(text); - text_->setText(stylesheet->getStyle(text_, Cell::style())); - - contentChanged(); - } - - /*! \brief Returns the text that is inside the mainarea. - * - * \returns The text inside the cell. - */ - QString TextCell::text() - { - //Save as plain text. - Qt::TextFormat tmp = text_->textFormat(); - text_->setTextFormat(Qt::PlainText); - QString txt = text_->text(); - - Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); - stylesheet->removeTagsFromString(txt, Cell::style()); - - text_->setTextFormat(tmp); - return txt; - } - - void TextCell::textChangedInternal() - { - contentChanged(); - } - - void TextCell::contentChanged() //Recalculates height. - { - //qDebug( "Width-Textcell: %i", width() ); - const int height = text_->heightForWidth(width()); - text_->setMinimumHeight(height); - setHeight(height); - emit textChanged(); - } - - void TextCell::setReadOnly(const bool readonly) - { - text_->setReadOnly(readonly); - if(readonly) - text_->setFrameStyle(QFrame::NoFrame); - else - text_->setFrameStyle(QFrame::Panel|QFrame::Sunken); - } - - void TextCell::accept(Visitor &v) - { - v.visitTextCellNodeBefore(this); - - if(hasChilds()) - { - child()->accept(v); - } - v.visitTextCellNodeAfter(this); - - //Move along. - if(hasNext()) - next()->accept(v); - } - - /*! - * Resize textcell when the mainwindow is resized. This because the - * cellcontent should always be visible. - */ - void TextCell::resizeEvent(QResizeEvent *event) - { - contentChanged(); - Cell::resizeEvent(event); - } - - void TextCell::clear() - { - text_->clear(); - } - - void TextCell::setStyleSheet(QStyleSheet *sheet) - { - cerr << "setStyleSheet()" << endl; - Qt::TextFormat f = text_->textFormat(); - text_->setTextFormat(Qt::PlainText); - QString tmp = text_->text(); - text_->setTextFormat(f); - text_->clear(); - - text_->setStyleSheet(sheet); - - setText(tmp); - } - - //Todo Implement using setFont and other memberfunctions instead of - //QStyleSheet!! - void TextCell::setStyle(const QString &style) - { -// Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); -// QStyleSheet *sheet = new QStyleSheet(text_, 0); -// setStyleSheet(stylesheet->getStyle(sheet, style)); - - //cerr << "SetStyle(" << style << ")" << endl; - - Qt::TextFormat tmp = text_->textFormat(); - text_->setTextFormat(Qt::PlainText); - QString txt = text_->text(); - - Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); - - if(Cell::style() != QString::null) - { -// cerr << "OLD TAG: " << Cell::style() << endl; - stylesheet->removeTagsFromString(txt, Cell::style()); - } - text_->setTextFormat(tmp); - text_->setText(txt); - - text_->setText(stylesheet->getStyle(text_, style)); - - Cell::setStyle(style); - } - - - /*! \this method should probably be deprecated. It is not a very - * good solution. - */ - void TextCell::setStyle(const QString &name, const QString &val) - { - //Stylesheet *stylesheet = Stylesheet::instance("stylesheet.xml"); - //QStyleSheet *sheet = new QStyleSheet(text_, 0); //this, 0); - //setStyleSheet(stylesheet->getStyle(sheet, name, val)); - - Cell::setStyle(name, val); - } - - void TextCell::setFocus(const bool focus) - { - if(focus) - text_->setFocus(); - } - - /*! \bug The link is removed if the sourcefile does not - * exists. This is strange. - */ - void TextCell::openLinkInternal(QUrl *url) - { - qDebug("Link clicked"); - emit openLink(url); - } - -//<<<<<<< .mine -// Cell TextCell::clone() -// { -// cerr << "TextCell::Clone()" << endl; -// return TextCell(this); -// } -//======= - //Cell &TextCell::clone() - //{ - // cerr << "TextCell::Clone()" << endl; - // return TextCell(this); - //} -//>>>>>>> .r179 - -} diff --git a/OMNotebook_QT3/OMNotebook/textcell.h b/OMNotebook_QT3/OMNotebook/textcell.h deleted file mode 100644 index 9bdb7da0646..00000000000 --- a/OMNotebook_QT3/OMNotebook/textcell.h +++ /dev/null @@ -1,132 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file textcell.h - * \author Ingemar Axelsson - * \date 2005-02-08 - */ -#ifndef TEXTCELL_H -#define TEXTCELL_H - -//QT Headers -#include -#include -#include -#include - -//IAEX Headers -#include "cell.h" -#include "visitor.h" -#include "stylesheet.h" - -namespace IAEX -{ - class TextCell : public Cell - { - Q_OBJECT - public: - TextCell(QWidget *parent = 0, const char *name = 0); - TextCell(TextCell &t); - - virtual ~TextCell(); - - virtual QString text(); - void clear(); - virtual void accept(Visitor &v); - -//<<<<<<< .mine - //virtual Cell clone(); //Create a copy of itself. -//======= - //virtual Cell &clone(); //Create a copy of itself. -//>>>>>>> .r179 - - signals: - void textChanged(); - - public slots: - void clickEvent(int para, int pos); //Should not be public! - void setReadOnly(const bool readonly); - void setText(QString text); - virtual void setStyle(const QString &style); - virtual void setStyle(const QString &name, const QString &val); - virtual void setFocus(const bool focus); - virtual void viewExpression(const bool expr); - - protected slots: - void contentChanged(); - void openLinkInternal(QUrl *url); - void textChangedInternal(); - - protected: - void resizeEvent(QResizeEvent *event); - - private: - void setStyleSheet(QStyleSheet *sheet); - void createTextWidget(); - QTextBrowser *text_; - }; - -/////////////////////////////////////////////// - class MyTextBrowser : public QTextBrowser - { - Q_OBJECT - public: - MyTextBrowser(QWidget *parent=0, const char *name=0); - virtual ~MyTextBrowser(); - - signals: - void openLink(QUrl *); - - public slots: - void setSource(const QString &name); - - protected: - //void mousePressEvent(QMouseEvent *event); - }; - -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/treeview.cpp b/OMNotebook_QT3/OMNotebook/treeview.cpp deleted file mode 100644 index a0b8ad20851..00000000000 --- a/OMNotebook_QT3/OMNotebook/treeview.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#include -#include "treeview.h" - -namespace IAEX -{ - - /*! \brief Construct a TreeView object and initialize it. - * \author Ingemar Axelsson - * - * For parameter information, see the Qt manual. - */ - TreeView::TreeView(QWidget *parent, const char *name) - :QWidget(parent, name), - selected_(false), - closed_(false), - selectedColor_(QColor(0,0,255)) - { - setFixedWidth(10); - setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding)); - setBackgroundMode(Qt::PaletteBase); - } - - /*! \brief Set the background color of the treeview. - * \author Ingemar Axelsson - * - * Sets the backgroundcolor of this view. This should never be set to - * black due to the color of the treething. - * - * \todo Add functionality to change the treecolor. Also add - * functionality to retrieve the current colors. - * - * \param col background color for the treeview. - */ - void TreeView::setBackgroundColor(const QColor col) - { - backgroundColor_ = col; - } - - void TreeView::setSelected(const bool sel) - { - selected_ = sel; - repaint(); - } - - /*! - * \deprecated - */ - const bool TreeView::selected() const - { - return selected_; - } - - void TreeView::setClosed(const bool closed) - { - closed_ = closed; - repaint(); - } - - const bool TreeView::isClosed() const - { - return closed_; - } - - QColor TreeView::selectedColor() const - { - return selectedColor_; - } - - QColor TreeView::backgroundColor() const - { - return backgroundColor_; - } - - /*! \brief Describes what a TreeView widget will look like. - * - * \bug Some cells are closed even if they cant be closed. This must - * be fixed in some way. - */ - void TreeView::paintEvent(QPaintEvent *event) - { - QPainter painter(this); - - if(selected_) - { - this->setPaletteBackgroundColor(selectedColor()); - painter.setPen(QPen(yellow, 1, SolidLine)); - } - else - { - this->setPaletteBackgroundColor(backgroundColor()); - painter.setPen(QPen(black,1, SolidLine)); - } - - QWidget::paintEvent(event); - - QPointArray points(4); - - if(closed_) - { - points[0] = QPoint(1,2); - points[1] = QPoint(5,2); - points[2] = QPoint(5, height()-2); - points[3] = QPoint(1, height()-8); - } - else - { - points[0] = QPoint(1,2); - points[1] = QPoint(5,2); - points[2] = QPoint(5,height()-2); - points[3] = QPoint(1,height()-2); - } - - painter.drawPolyline(points); - } - -////////////////////////////////////////////////////////////////////// - - /*! \class InputTreeView - * - * \brief A treeview for inputcells. This view acts a little - * different than other treeviews. Mostly different paintEvent. - */ - InputTreeView::InputTreeView(QWidget *parent, const char *name) - : TreeView(parent, name) - {} - - void InputTreeView::paintEvent(QPaintEvent *event) - { - QPainter painter(this); - - //Selected or not selected - if(selected()) - { - setPaletteBackgroundColor(selectedColor()); - painter.setPen(QPen(yellow, 1, SolidLine)); - } - else - { - setPaletteBackgroundColor(backgroundColor()); - painter.setPen(QPen(black,1, SolidLine)); - } - - if(isVisible()) - { - QWidget::paintEvent(event); - - QPointArray points(4); - - points[0] = QPoint(1,2); - points[1] = QPoint(5,2); - points[2] = QPoint(5,height()-2); - points[3] = QPoint(1,height()-2); - - painter.drawPolyline(points); - } - } -} diff --git a/OMNotebook_QT3/OMNotebook/treeview.h b/OMNotebook_QT3/OMNotebook/treeview.h deleted file mode 100644 index c364bff648a..00000000000 --- a/OMNotebook_QT3/OMNotebook/treeview.h +++ /dev/null @@ -1,112 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file treeview.h - * \author Ingemar Axelsson - */ -#ifndef TREEVIEW_H -#define TREEVIEW_H - -#include -#include -#include - -namespace IAEX -{ - - /*! \class TreeView - * \brief Class describing how the treeview should be drawn. - * \author Ingemar Axelsson - * - * TreeView is responsible for drawing the treestructure for each - * cell. - * - * \todo Find a way to easily extend a cell with multiple - * treeviews. It should be easy to change the treeview to a more - * goodlooking view if someone wants to do that. - */ - class TreeView : public QWidget - { - Q_OBJECT - public: - TreeView(QWidget *parent=0, const char *name=0); - - void TreeView::setBackgroundColor(const QColor col); - - const bool selected() const; - const bool isClosed() const; - public slots: - void setClosed(const bool closed); - void setSelected(const bool sel); - - - protected: - void paintEvent(QPaintEvent *event); - //void mousePressedEvent(QMouseEvent *event); - //void mouseReleaseEvent(QMouseEvent *event); - QColor selectedColor() const; - QColor backgroundColor() const; - - signals: - void becomeSelected(bool); //Deprecated - - private: - bool selected_; - bool closed_; //This is not a good way, but it works for now! - QColor selectedColor_; - QColor backgroundColor_; - }; - - class InputTreeView : public TreeView - { - public: - InputTreeView(QWidget *parent=0, const char *name=0); - protected: - void paintEvent(QPaintEvent *event); - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/trunk.pro b/OMNotebook_QT3/OMNotebook/trunk.pro deleted file mode 100644 index 338cd61f178..00000000000 --- a/OMNotebook_QT3/OMNotebook/trunk.pro +++ /dev/null @@ -1,96 +0,0 @@ -###################################################################### -# Automatically generated by qmake (1.07a) Mon Nov 15 16:21:23 2004 -###################################################################### - -TEMPLATE = app -INCLUDEPATH += . \ - /usr/local/include -#OBJECTS += - -unix:LIBS += -L/usr/local/lib -lantlr -TARGET = qtnotebook - -## For debugging -QMAKE_CFLAGS+=-pg -QMAKE_CXXFLAGS+=-pg -QMAKE_LFLAGS+=-pg - -#If modeq is installed on system. Set includepath and objects -#correctly. If modeq not is installed on the system. Comment out -#theese three lines below. -DEFINES += MODEQ -INCLUDEPATH += /home/x04ingax/modelica/modeq/runtime -OBJECTS += /home/x04ingax/modelica/modeq/runtime/modeq_communication.o -unix:LIBS += -lmico2.3.11 - -# Input -HEADERS += application.h\ - cell.h \ - cellapplication.h\ - commandcenter.h\ - cellcommandcenter.h\ - cellcursor.h \ - celldocument.h \ - cellgroup.h \ - command.h\ - cursor.h\ - document.h\ - documentview.h\ - factory.h\ - cellfactory.h\ - notebookcommands.h\ - cellcommands.h\ - cursorcommands.h\ - stylesheet.h \ - textcell.h \ - treeview.h \ - inputcell.h \ - inputcelldelegate.h\ - imagecell.h\ - notebook.h \ - visitor.h \ - parser.h\ - parserfactory.h\ - xmlparser.h\ - notebookparser.h\ - selectingvisitor.h\ - AntlrNotebookLexer.hpp\ - AntlrNotebookParser.hpp\ - AntlrNotebookTreeParser.hpp\ - modeq_communicator.hpp\ - modeqinteractiveenvironment.h\ - syntax_highlighter.hpp\ - syntaxhighlighter.h\ - modelicahighlighter.h\ - serializingvisitor.h\ - smlsyntaxhighlighter.h\ - smlinteractiveenvironment.h - -SOURCES += cell.cpp \ - cellcursor.cpp \ - celldocument.cpp \ - cellgroup.cpp \ - cellfactory.cpp\ - cellapplication.cpp\ - cellcommands.cpp\ - cellcommandcenter.cpp\ - notebookparser.cpp\ - qtapp.cpp \ - stylesheet.cpp \ - textcell.cpp \ - inputcell.cpp \ - imagecell.cpp\ - xmlparser.cpp\ - cellparserfactory.cpp\ - notebook.cpp \ - treeview.cpp \ - selectingvisitor.cpp\ - AntlrNotebookLexer.cpp\ - AntlrNotebookParser.cpp\ - AntlrNotebookTreeParser.cpp\ - modeq_communicator.cpp\ - modeqinteractiveenvironment.cpp\ - syntax_highlighter.cpp\ - serializingvisitor.cpp\ - smlsyntaxhighlighter.cpp\ - smlinteractiveenvironment.cpp diff --git a/OMNotebook_QT3/OMNotebook/trunk.sln b/OMNotebook_QT3/OMNotebook/trunk.sln deleted file mode 100644 index a54cde70dad..00000000000 --- a/OMNotebook_QT3/OMNotebook/trunk.sln +++ /dev/null @@ -1,39 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qtnotebook", "trunk.vcproj", "{259725BE-54D2-3C8D-A8A8-4CF7BD839D28}" - ProjectSection(ProjectDependencies) = postProject - {3700A59E-E33B-4AC7-8385-35D486AEE4E0} = {3700A59E-E33B-4AC7-8385-35D486AEE4E0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "antlr", "..\antlr\antlr.vcproj", "{9E68472B-29D8-4C20-9304-051C2C5C11B6}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NotebookParser", "..\NotebookParser\NotebookParser.vcproj", "{3700A59E-E33B-4AC7-8385-35D486AEE4E0}" - ProjectSection(ProjectDependencies) = postProject - {9E68472B-29D8-4C20-9304-051C2C5C11B6} = {9E68472B-29D8-4C20-9304-051C2C5C11B6} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {259725BE-54D2-3C8D-A8A8-4CF7BD839D28}.Debug.ActiveCfg = Debug|Win32 - {259725BE-54D2-3C8D-A8A8-4CF7BD839D28}.Debug.Build.0 = Debug|Win32 - {259725BE-54D2-3C8D-A8A8-4CF7BD839D28}.Release.ActiveCfg = Release|Win32 - {259725BE-54D2-3C8D-A8A8-4CF7BD839D28}.Release.Build.0 = Release|Win32 - {9E68472B-29D8-4C20-9304-051C2C5C11B6}.Debug.ActiveCfg = Debug|Win32 - {9E68472B-29D8-4C20-9304-051C2C5C11B6}.Debug.Build.0 = Debug|Win32 - {9E68472B-29D8-4C20-9304-051C2C5C11B6}.Release.ActiveCfg = Release|Win32 - {9E68472B-29D8-4C20-9304-051C2C5C11B6}.Release.Build.0 = Release|Win32 - {3700A59E-E33B-4AC7-8385-35D486AEE4E0}.Debug.ActiveCfg = Debug|Win32 - {3700A59E-E33B-4AC7-8385-35D486AEE4E0}.Debug.Build.0 = Debug|Win32 - {3700A59E-E33B-4AC7-8385-35D486AEE4E0}.Release.ActiveCfg = Release|Win32 - {3700A59E-E33B-4AC7-8385-35D486AEE4E0}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/OMNotebook_QT3/OMNotebook/trunk.vcproj b/OMNotebook_QT3/OMNotebook/trunk.vcproj deleted file mode 100644 index 3f4286b5e6c..00000000000 --- a/OMNotebook_QT3/OMNotebook/trunk.vcproj +++ /dev/null @@ -1,704 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OMNotebook_QT3/OMNotebook/visitor.h b/OMNotebook_QT3/OMNotebook/visitor.h deleted file mode 100644 index 586fad97c38..00000000000 --- a/OMNotebook_QT3/OMNotebook/visitor.h +++ /dev/null @@ -1,97 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -/*! \file visitor.h - * \author Ingemar Axelsson - */ -#ifndef VISITOR_H -#define VISITOR_H - -//using namespace std; - -namespace IAEX{ - - class Cell; - class CellGroup; - class TextCell; - class CellText; - class InputCell; - class ImageCell; - class CellCursor; - - /*! \interface Visitor - * \author Ingemar Axelsson - * - * When a new celltype is added to the cellhierarchy a new visitor - * member function must be added also. This means that it is expensive - * to add new celltypes. - * - */ - class Visitor - { - public: - virtual void visitCellNodeBefore(Cell *node) = 0; - virtual void visitCellNodeAfter(Cell *node) = 0; - - virtual void visitCellGroupNodeBefore(CellGroup *node) = 0; - virtual void visitCellGroupNodeAfter(CellGroup *node) = 0; - - virtual void visitTextCellNodeBefore(TextCell *node) = 0; - virtual void visitTextCellNodeAfter(TextCell *node) = 0; - - virtual void visitInputCellNodeBefore(InputCell *node) = 0; - virtual void visitInputCellNodeAfter(InputCell *node) = 0; - - virtual void visitCellCursorNodeBefore(CellCursor *cursor) = 0; - virtual void visitCellCursorNodeAfter(CellCursor *cursor) = 0; - - virtual void visitImageCellNodeBefore(ImageCell *node) = 0; - virtual void visitImageCellNodeAfter(ImageCell *node) = 0; - - }; -} -#endif diff --git a/OMNotebook_QT3/OMNotebook/xmlparser.cpp b/OMNotebook_QT3/OMNotebook/xmlparser.cpp deleted file mode 100644 index 9afed94c063..00000000000 --- a/OMNotebook_QT3/OMNotebook/xmlparser.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -//STD Headers -#include -#include -#include -//#include -//#include -#include - -//QT Headers -#include -#include -#include - -//IAEX Headers -#include "xmlparser.h" -#include "factory.h" - -using namespace std; - -namespace IAEX -{ - - - /*!\class XMLParser - * \brief Open an XML file. See cells.xml - * - * \todo implement the function to open a file with filename. - * - * \todo Add a parameter describing how the file should be read. This - * should be done with some filereader class that can parse a specific - * filetype. This to easy allow extensibility. What should the file - * reader return? What about a delegate? The CellContainer will be set - * as a delegate object for the filereader. Then when a Cell is - * created the CellContainer is the object that creates the cell. The - * file reader just gives it some information. This could probably be - * designed in some better way. - * - * \todo Throw exceptions instead of exit if file is problematic. - * - */ - XMLParser::XMLParser(const QString filename, Factory *f) - : filename_(filename), factory_(f) - { - } - - XMLParser::~XMLParser(){} - - Cell *XMLParser::parse() - { - QDomDocument doc("CellFile"); - - QFile file(filename_); - - if(!file.open(IO_ReadOnly)) - throw runtime_error("Could not open " + string(filename_)); - - if(!doc.setContent(&file)) - { - file.close(); - throw runtime_error("Could not understand content of " + string(filename_)); - } - file.close(); - - QDomElement root = doc.documentElement(); - QDomNode n = root.firstChild(); - - //Remove first cellgroup. - if(!n.isNull()) - { - QDomElement f = n.toElement(); - - if(!f.isNull()) - { - if(f.tagName() == "CellGroupData") - { - n = f.firstChild(); - } - } - } - - Cell *rootcell = factory_->createCell("cellgroup", 0); - - xmltraverse(rootcell, n); - - return rootcell; - } - - - void XMLParser::xmltraverse(Cell *ws, QDomNode &n) - { - while( !n.isNull()) - { - QDomElement e = n.toElement(); - if(!e.isNull()) - { - if(e.tagName() == "Notebook") - { - - } - else if(e.tagName() == "CellGroupData") - { - Cell *aGroup = factory_->createCell("cellgroup", ws); - - QDomNode p = e.firstChild(); - xmltraverse(aGroup, p); - - aGroup->setClosed(e.attribute("closed")); - - ws->addChild(aGroup); - } - else if(e.tagName() == "Cell") - { - //TextCell *aCell = factory_->createCell("text", ws); - Cell *aCell; - if(e.attribute("style") == "Image") - { - aCell = factory_->createCell(e.attribute("filename"), - e.attribute("style"), ws); - e.attributes().removeNamedItem("filename"); - } - else - { - aCell = factory_->createCell(e.attribute("style"), ws); - } - - //For all attributes - // QDomNamedNodeMap attributes = e.attributes(); - // attributes.removeNamedItem("style"); - /* for(unsigned int i=0; i < attributes.count(); ++i) - { - QDomNode n = attributes.item(i); - QDomAttr a = n.toAttr(); - aCell->setStyle(a.name(), a.value()); - } - */ - aCell->setText(e.text()); - aCell->setStyle(e.attribute("style","")); - - ws->addChild(aCell); - } - else - { - throw runtime_error("Unknown tag: <"+ std::string(e.tagName()) +">"); - } - } - n = n.nextSibling(); - } - } - -}; diff --git a/OMNotebook_QT3/OMNotebook/xmlparser.h b/OMNotebook_QT3/OMNotebook/xmlparser.h deleted file mode 100644 index a7b8bb051a3..00000000000 --- a/OMNotebook_QT3/OMNotebook/xmlparser.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ------------------------------------------------------------------------------------- -This file is part of OpenModelica. - -Copyright (c) 1998-2005, Linköpings universitet, -Department of Computer and Information Science, PELAB -See also: www.ida.liu.se/projects/OpenModelica - -All rights reserved. - -(The new BSD license, see also -http://www.opensource.org/licenses/bsd-license.php) - - -Redistribution and use in source and binary forms, with or without -modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Linköpings universitet nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -For more information about the Qt-library visit TrollTech:s webpage regarding -licence: http://www.trolltech.com/products/qt/licensing.html - ------------------------------------------------------------------------------------- -*/ - -#ifndef _XMLPARSER_H -#define _XMLPARSER_H - -#include -#include - -#include "nbparser.h" -#include "factory.h" - -namespace IAEX -{ - class XMLParser : public NBParser - { - public: - XMLParser(const QString filename, Factory *f); - virtual ~XMLParser(); - virtual Cell *parse(); - - private: - void xmltraverse(Cell *ws, QDomNode &n); - - QString filename_; - Factory *factory_; - }; -}; -#endif