summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui/editorwindow.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-26 07:59:23 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-26 07:59:23 +0000
commitbe70fd89be787e2b24604f9ba785b87c1f8f1d22 (patch)
tree5b7ec98c48d2a5d2dc5078007142d2e92c09a8a2 /utils/themeeditor/gui/editorwindow.cpp
parent5300c7014d602c57fcae7f6619f5138d83ba33c0 (diff)
Theme Editor: Added an edit menu with a find/replace function (copied from an LGPL library)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27137 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui/editorwindow.cpp')
-rw-r--r--utils/themeeditor/gui/editorwindow.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp
index b778a1fba4..ea6c91f074 100644
--- a/utils/themeeditor/gui/editorwindow.cpp
+++ b/utils/themeeditor/gui/editorwindow.cpp
@@ -200,6 +200,20 @@ void EditorWindow::setupMenus()
QObject::connect(ui->actionOpen_Project, SIGNAL(triggered()),
this, SLOT(openProject()));
+
+ /* Connecting the edit menu */
+ QObject::connect(ui->actionUndo, SIGNAL(triggered()),
+ this, SLOT(undo()));
+ QObject::connect(ui->actionRedo, SIGNAL(triggered()),
+ this, SLOT(redo()));
+ QObject::connect(ui->actionCut, SIGNAL(triggered()),
+ this, SLOT(cut()));
+ QObject::connect(ui->actionCopy, SIGNAL(triggered()),
+ this, SLOT(copy()));
+ QObject::connect(ui->actionPaste, SIGNAL(triggered()),
+ this, SLOT(paste()));
+ QObject::connect(ui->actionFind_Replace, SIGNAL(triggered()),
+ this, SLOT(findReplace()));
}
void EditorWindow::addTab(TabContent *doc)
@@ -237,6 +251,12 @@ void EditorWindow::shiftTab(int index)
ui->actionClose_Document->setEnabled(false);
ui->actionToolbarSave->setEnabled(false);
ui->fromTree->setEnabled(false);
+ ui->actionUndo->setEnabled(false);
+ ui->actionRedo->setEnabled(false);
+ ui->actionCut->setEnabled(false);
+ ui->actionCopy->setEnabled(false);
+ ui->actionPaste->setEnabled(false);
+ ui->actionFind_Replace->setEnabled(false);
viewer->setScene(0);
}
else if(widget->type() == TabContent::Config)
@@ -245,6 +265,12 @@ void EditorWindow::shiftTab(int index)
ui->actionSave_Document_As->setEnabled(true);
ui->actionClose_Document->setEnabled(true);
ui->actionToolbarSave->setEnabled(true);
+ ui->actionUndo->setEnabled(false);
+ ui->actionRedo->setEnabled(false);
+ ui->actionCut->setEnabled(false);
+ ui->actionCopy->setEnabled(false);
+ ui->actionPaste->setEnabled(false);
+ ui->actionFind_Replace->setEnabled(false);
viewer->setScene(0);
}
else if(widget->type() == TabContent::Skin)
@@ -260,12 +286,26 @@ void EditorWindow::shiftTab(int index)
ui->actionToolbarSave->setEnabled(true);
ui->fromTree->setEnabled(true);
+ ui->actionUndo->setEnabled(true);
+ ui->actionRedo->setEnabled(true);
+ ui->actionCut->setEnabled(true);
+ ui->actionCopy->setEnabled(true);
+ ui->actionPaste->setEnabled(true);
+ ui->actionFind_Replace->setEnabled(true);
+
sizeColumns();
/* Syncing the preview */
viewer->setScene(doc->scene());
}
+
+ /* Hiding all the find/replace dialogs */
+ for(int i = 0; i < ui->editorTabs->count(); i++)
+ if(dynamic_cast<TabContent*>(ui->editorTabs->widget(i))->type() ==
+ TabContent::Skin)
+ dynamic_cast<SkinDocument*>(ui->editorTabs->widget(i))->hideFind();
+
}
bool EditorWindow::closeTab(int index)
@@ -469,6 +509,56 @@ void EditorWindow::lineChanged(int line)
}
+void EditorWindow::undo()
+{
+ TabContent* doc = dynamic_cast<TabContent*>
+ (ui->editorTabs->currentWidget());
+ if(doc->type() == TabContent::Skin)
+ dynamic_cast<SkinDocument*>(doc)->getEditor()->undo();
+}
+
+void EditorWindow::redo()
+{
+ TabContent* doc = dynamic_cast<TabContent*>
+ (ui->editorTabs->currentWidget());
+ if(doc->type() == TabContent::Skin)
+ dynamic_cast<SkinDocument*>(doc)->getEditor()->redo();
+
+}
+
+void EditorWindow::cut()
+{
+ TabContent* doc = dynamic_cast<TabContent*>
+ (ui->editorTabs->currentWidget());
+ if(doc->type() == TabContent::Skin)
+ dynamic_cast<SkinDocument*>(doc)->getEditor()->cut();
+}
+
+void EditorWindow::copy()
+{
+ TabContent* doc = dynamic_cast<TabContent*>
+ (ui->editorTabs->currentWidget());
+ if(doc->type() == TabContent::Skin)
+ dynamic_cast<SkinDocument*>(doc)->getEditor()->copy();
+}
+
+void EditorWindow::paste()
+{
+ TabContent* doc = dynamic_cast<TabContent*>
+ (ui->editorTabs->currentWidget());
+ if(doc->type() == TabContent::Skin)
+ dynamic_cast<SkinDocument*>(doc)->getEditor()->paste();
+}
+
+void EditorWindow::findReplace()
+{
+ TabContent* doc = dynamic_cast<TabContent*>
+ (ui->editorTabs->currentWidget());
+ if(doc->type() == TabContent::Skin)
+ dynamic_cast<SkinDocument*>(doc)->showFind();
+}
+
+
void EditorWindow::expandLine(ParseTreeModel* model, QModelIndex parent,
int line)
{