--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EditorWindow</class>
+ <widget class="QMainWindow" name="EditorWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>523</width>
+ <height>473</height>
+ </rect>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>800</width>
+ <height>600</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMaximumSize</enum>
+ </property>
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <item>
+ <widget class="My_Edit" name="e"/>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="msg">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="acceptRichText">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>523</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>File</string>
+ </property>
+ <addaction name="actionNew"/>
+ <addaction name="actionOpen"/>
+ <addaction name="actionSave"/>
+ <addaction name="actionSave_as"/>
+ <addaction name="separator"/>
+ <addaction name="actionQuit"/>
+ </widget>
+ <widget class="QMenu" name="menuEdit">
+ <property name="title">
+ <string>Edit</string>
+ </property>
+ <addaction name="actionCopy"/>
+ <addaction name="actionPaste"/>
+ <addaction name="actionCut"/>
+ <addaction name="actionClear_all"/>
+ <addaction name="separator"/>
+ <addaction name="actionFind"/>
+ <addaction name="actionFind_next"/>
+ </widget>
+ <widget class="QMenu" name="menuTools">
+ <property name="title">
+ <string>Tools</string>
+ </property>
+ <addaction name="actionCompile"/>
+ <addaction name="separator"/>
+ <addaction name="actionProperties"/>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuEdit"/>
+ <addaction name="menuTools"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionNew">
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <action name="actionOpen">
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action name="actionSave">
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action name="actionSave_as">
+ <property name="text">
+ <string>Save as</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+S</string>
+ </property>
+ </action>
+ <action name="actionQuit">
+ <property name="text">
+ <string>Quit</string>
+ </property>
+ </action>
+ <action name="actionCopy">
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+C</string>
+ </property>
+ </action>
+ <action name="actionPaste">
+ <property name="text">
+ <string>Paste</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+V</string>
+ </property>
+ </action>
+ <action name="actionCut">
+ <property name="text">
+ <string>Cut</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+X</string>
+ </property>
+ </action>
+ <action name="actionClear_all">
+ <property name="text">
+ <string>Clear All</string>
+ </property>
+ </action>
+ <action name="actionFind">
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+F</string>
+ </property>
+ </action>
+ <action name="actionFind_next">
+ <property name="text">
+ <string>Find Next</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+L</string>
+ </property>
+ </action>
+ <action name="actionCompile">
+ <property name="text">
+ <string>Compile</string>
+ </property>
+ </action>
+ <action name="actionProperties">
+ <property name="text">
+ <string>Properties</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>My_Edit</class>
+ <extends>QTextEdit</extends>
+ <header>../my_edit.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
#include <QtGui/QVBoxLayout>
#include "editor.h"
+#include "my_edit.h"
#define TYPENUM 5
Editor::Editor(char *hdir, QWidget * parent)
: QMainWindow(parent)
{
+ setupUi(this);
+
strcpy(HomeDir, hdir);
find_text = "";
sensitive = FALSE;
- QMenu * file = NULL;
+// QMenu * file = NULL;
/* QMenu * comp = new QMenu();*/
/* QMenu * loglan = new QMenu();*/
- QMenu * medit = NULL;
- QAction* action = NULL;
+// QMenu * medit = NULL;
+// QAction* action = NULL;
- file = menuBar()->addMenu("&File");
- medit = menuBar()->addMenu("&Edit");
+// file = menuBar()->addMenu("&File");
+// medit = menuBar()->addMenu("&Edit");
- action = menuBar()->addAction("&Compile", this, SLOT(cmp()));
+// action = menuBar()->addAction("&Compile", this, SLOT(cmp()));
/* m->insertItem( "&LOGLAN ", loglan );*/
- action = menuBar()->addAction("&Properties", this, SLOT(props()));
+// action = menuBar()->addAction("&Properties", this, SLOT(props()));
- file->addAction("New", this, SLOT(create()), QKeySequence(Qt::CTRL + Qt::Key_N));
- file->addAction("Open", this, SLOT(load()), QKeySequence(Qt::CTRL + Qt::Key_O));
- file->addAction("Save", this, SLOT(save()), QKeySequence(Qt::CTRL + Qt::Key_S));
- file->addAction("Save as", this, SLOT(save_as()), QKeySequence(Qt::CTRL + Qt::Key_A));
- file->addSeparator();
- file->addAction("Quit ", this, SLOT(close()));
+// file->addAction("New", this, SLOT(create()), QKeySequence(Qt::CTRL + Qt::Key_N));
+// file->addAction("Open", this, SLOT(load()), QKeySequence(Qt::CTRL + Qt::Key_O));
+// file->addAction("Save", this, SLOT(save()), QKeySequence(Qt::CTRL + Qt::Key_S));
+// file->addAction("Save as", this, SLOT(save_as()), QKeySequence(Qt::CTRL + Qt::Key_A));
+// file->addSeparator();
+ connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
+// file->addAction("Quit ", this, SLOT(close()));
/* comp->insertItem("Compile ", this, SLOT(cmp()), CTRL + Key_C);*/
/* comp->insertItem("Gen ", this, SLOT(gen()), CTRL + Key_G);*/
/* loglan->insertItem( "Program structure", this, SLOT(log_prog()));*/
/* loglan->insertItem( "Unit structure", this, SLOT(log_unit()));*/
-
- e = new My_Edit(this, "editor");
+
+// e = new My_Edit(this, "editor");
connect(e, SIGNAL(cursorMove()), this, SLOT(updateline()));
- medit->addAction("Copy", e, SLOT(copy()), QKeySequence(Qt::CTRL + Qt::Key_Insert));
- medit->addAction("Paste", e, SLOT(paste()), QKeySequence(Qt::SHIFT + Qt::Key_Insert));
- medit->addAction("Cut", e, SLOT(cut()), QKeySequence(Qt::CTRL + Qt::Key_Delete));
- medit->addAction("Clear All", e, SLOT(clear()));
- medit->addSeparator();
- medit->addAction("Find", this, SLOT(findText()), QKeySequence(Qt::CTRL + Qt::Key_F));
- medit->addAction("Find Next", this, SLOT(find_next()), QKeySequence(Qt::CTRL + Qt::Key_L));
-
- msg = new QTextEdit(this);
- msg->setReadOnly(TRUE);
-
- QVBoxLayout * layout = new QVBoxLayout();
- layout->setContentsMargins (3, 0, 3, 0);
- layout->addWidget(e);
- layout->addWidget(msg);
- QWidget *window = new QWidget();
- window->setLayout(layout);
- setCentralWidget(window);
+ connect(actionCopy, SIGNAL(triggered()), e, SLOT(copy()));
+ connect(actionPaste, SIGNAL(triggered()), e, SLOT(paste()));
+ connect(actionCut, SIGNAL(triggered()), e, SLOT(cut()));
+ connect(actionClear_all, SIGNAL(triggered()), e, SLOT(clear()));
+// medit->addAction("Copy", e, SLOT(copy()), QKeySequence(Qt::CTRL + Qt::Key_Insert));
+// medit->addAction("Paste", e, SLOT(paste()), QKeySequence(Qt::SHIFT + Qt::Key_Insert));
+// medit->addAction("Cut", e, SLOT(cut()), QKeySequence(Qt::CTRL + Qt::Key_Delete));
+// medit->addAction("Clear All", e, SLOT(clear()));
+// medit->addSeparator();
+// medit->addAction("Find", this, SLOT(findText()), QKeySequence(Qt::CTRL + Qt::Key_F));
+// medit->addAction("Find Next", this, SLOT(find_next()), QKeySequence(Qt::CTRL + Qt::Key_L));
+
+// msg = new QTextEdit(this);
+// msg->setReadOnly(TRUE);
+
+// QVBoxLayout * layout = new QVBoxLayout();
+// layout->setContentsMargins (3, 0, 3, 0);
+// layout->addWidget(e);
+// layout->addWidget(msg);
+// QWidget *window = new QWidget();
+// window->setLayout(layout);
+// setCentralWidget(window);
compiler_path.sprintf("%s/%s", HomeDir, "compile/logcomp");
gen_path.sprintf("%s/%s", HomeDir, "compile/gen");
file_path.sprintf("%s", HomeDir);
- QColor col(200, 200, 200);
- QPalette grp(Qt::black, col, col.lighter(), col.darker(), col.darker(), Qt::black, col);
+// QColor col(200, 200, 200);
+// QPalette grp(Qt::black, col, col.lighter(), col.darker(), col.darker(), Qt::black, col);
- msg->setPalette(grp);
+// msg->setPalette(grp);
position = new QLabel();
statusBar()->addPermanentWidget(position);
/**
* Displays additional window
*/
-void Editor::load()
+void Editor::on_actionOpen_triggered()
{
QString fn = QFileDialog::getOpenFileName(this, "Load file", file_path, "*.log");
if (!fn.isEmpty())
* If content has been read from file, it is written to this file. Otherwise
* dialog is shown to save content to the specified by user, file.
*/
-void Editor::save()
+void Editor::on_actionSave_triggered()
{
if (fname.isEmpty()) {
QString fn = QFileDialog::getSaveFileName(this, "Save file",
* Forces saving editor content to the new file. Special dialog is shown for
* that purpose.
*/
-void Editor::save_as()
+void Editor::on_actionSave_as_triggered()
{
QString fn = QFileDialog::getSaveFileName(this, "Save file as",
file_path, "*.log");
/**
* Empties editor content.
*/
-void Editor::create()
+void Editor::on_actionNew_triggered()
{
e->clear();
fname.sprintf("%s", "");
/**
* @attention Currently not in use
*/
-void Editor::print()
-{
-}
+//void Editor::print()
+//{
+//}
/**
* @attention Currently not in use.
*
* Saves and compiles code.
*/
-void Editor::cmp()
+void Editor::on_actionCompile_triggered()
{
- save();
+ on_actionSave_triggered();
compile(COMP_MODE);
}
*/
void Editor::comp_all()
{
- save();
+ on_actionSave_triggered();
compile(ALL_MODE);
}
/**
* Displays window with editor properties
*/
-void Editor::props()
+void Editor::on_actionProperties_triggered()
{
QDialog dlg(this, Qt::Dialog);
* Displays window to set search parameters. If text is found sets cursor
* position on it.
*/
-void Editor::findText()
+void Editor::on_actionFind_triggered()
{
QDialog dlg(this, Qt::Dialog);
QString *txt;
* Displays window to set search parameters. If text is found sets cursor
* position on it.
*/
-void Editor::find_next()
+void Editor::on_actionFind_next_triggered()
{
if (!find_text.isEmpty()) {
QTextDocument::FindFlags flags = 0;