From cb4ae0b104084e9c054d2a1b28ce531d104e9d76 Mon Sep 17 00:00:00 2001
From: Robert Jonsson <spamatica@gmail.com>
Date: Sat, 27 Aug 2011 20:17:59 +0000
Subject: full screen + part edit focus

---
 muse2/ChangeLog                   |  3 +++
 muse2/awl/CMakeLists.txt          |  2 ++
 muse2/awl/lineedit.cpp            | 11 +++++++++++
 muse2/awl/lineedit.h              | 18 ++++++++++++++++++
 muse2/muse/app.cpp                |  1 +
 muse2/muse/arranger/pcanvas.cpp   |  8 +++++---
 muse2/muse/arranger/pcanvas.h     |  4 ++--
 muse2/muse/cliplist/cliplist.cpp  |  4 +++-
 muse2/muse/liste/listedit.cpp     |  1 +
 muse2/muse/marker/markerview.cpp  |  4 +++-
 muse2/muse/master/lmaster.cpp     |  1 +
 muse2/muse/master/masteredit.cpp  |  2 ++
 muse2/muse/midiedit/drumedit.cpp  |  1 +
 muse2/muse/midiedit/pianoroll.cpp |  1 +
 muse2/muse/midiedit/scoreedit.cpp |  3 ++-
 muse2/muse/shortcuts.cpp          |  3 ++-
 muse2/muse/shortcuts.h            |  1 +
 muse2/muse/waveedit/waveedit.cpp  |  1 +
 18 files changed, 60 insertions(+), 9 deletions(-)
 create mode 100644 muse2/awl/lineedit.cpp
 create mode 100644 muse2/awl/lineedit.h

(limited to 'muse2')

diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index d5dd93ce..e5ea1660 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,6 @@
+27.08.2011:
+        - Added fullscreen shortcut to all editors which have full screen action (rj)
+        - Part text editor now closes when focus is lost (rj)
 17.08.2011:
         - Convert some Qt3 style coding in ComboBox to Qt4 in terms of menu entry handling. (Orcan)
         - Add mouse wheel support to ComboBox. (Orcan)
diff --git a/muse2/awl/CMakeLists.txt b/muse2/awl/CMakeLists.txt
index 21772470..532d0c8d 100644
--- a/muse2/awl/CMakeLists.txt
+++ b/muse2/awl/CMakeLists.txt
@@ -29,6 +29,7 @@ QT4_WRAP_CPP (awl_mocs
       drawbar.h
       floatentry.h
       knob.h
+      lineedit.h
       midimeter.h
       midimslider.h
       midipanentry.h
@@ -64,6 +65,7 @@ file (GLOB awl_source_files
       floatentry.cpp
       knob.cpp
       # ltest.cpp
+      lineedit.cpp
       midimeter.cpp
       midimslider.cpp
       midipanentry.cpp
diff --git a/muse2/awl/lineedit.cpp b/muse2/awl/lineedit.cpp
new file mode 100644
index 00000000..07d2e49f
--- /dev/null
+++ b/muse2/awl/lineedit.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include "lineedit.h"
+
+LineEdit::LineEdit(QWidget *parent) :
+    QLineEdit(parent)
+{
+}
+void LineEdit::focusOutEvent ( QFocusEvent * e )
+{
+    emit returnPressed();
+}
diff --git a/muse2/awl/lineedit.h b/muse2/awl/lineedit.h
new file mode 100644
index 00000000..4ad6116e
--- /dev/null
+++ b/muse2/awl/lineedit.h
@@ -0,0 +1,18 @@
+#ifndef LINEEDIT_H
+#define LINEEDIT_H
+
+#include <QLineEdit>
+
+class LineEdit : public QLineEdit
+{
+    Q_OBJECT
+public:
+    explicit LineEdit(QWidget *parent = 0);
+    void focusOutEvent ( QFocusEvent * e );
+signals:
+
+public slots:
+
+};
+
+#endif // LINEEDIT_H
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index d6990c67..cece85ed 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -2858,6 +2858,7 @@ void MusE::updateConfiguration()
       followCtsAction->setShortcut(shortcuts[SHRT_FOLLOW_CONTINUOUS].key);
       
       helpManualAction->setShortcut(shortcuts[SHRT_OPEN_HELP].key);
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
       
       // Orcan: Old stuff, needs to be converted. These aren't used anywhere so I commented them out
       //menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]);
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 56d68ceb..1bf7a541 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -16,13 +16,13 @@
 #include <map>
 
 #include <QClipboard>
-#include <QLineEdit>
 #include <QMenu>
 #include <QMessageBox>
 #include <QPainter>
 #include <QUrl>
 #include <QPoint>
 
+#include <awl/lineedit.h>
 #include "fastlog.h"
 #include "widgets/tools.h"
 #include "arranger.h"
@@ -183,7 +183,8 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event)
                   editPart = (NPart*)curItem;
                   QRect r = map(curItem->bbox());
                   if (lineEditor == 0) {
-                        lineEditor = new QLineEdit(this);
+                        lineEditor = new LineEdit(this);
+                        connect(lineEditor, SIGNAL(returnPressed()),SLOT(returnPressed()));
                         lineEditor->setFrame(true);
                         }
                   editMode = true;
@@ -685,7 +686,8 @@ void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt)
                   editPart = npart;
                   QRect r = map(curItem->bbox());
                   if (lineEditor == 0) {
-                        lineEditor = new QLineEdit(this);
+                        lineEditor = new LineEdit(this);
+                        connect(lineEditor, SIGNAL(returnPressed()),SLOT(returnPressed()));
                         lineEditor->setFrame(true);
                         }
                   lineEditor->setText(editPart->name());
diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h
index 71a0129c..4d8e97f8 100644
--- a/muse2/muse/arranger/pcanvas.h
+++ b/muse2/muse/arranger/pcanvas.h
@@ -50,7 +50,7 @@ struct AutomationObject {
   ControllerVals controllerState;
 };
 
-class QLineEdit;
+class LineEdit;
 class MidiEditor;
 class QMenu;
 class Xml;
@@ -66,7 +66,7 @@ class PartCanvas : public Canvas {
       TrackList* tracks;
 
       Part* resizePart;
-      QLineEdit* lineEditor;
+      LineEdit* lineEditor;
       NPart* editPart;
       int curColorIndex;
       bool editMode;
diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp
index 8dbb80ef..47f88d1b 100644
--- a/muse2/muse/cliplist/cliplist.cpp
+++ b/muse2/muse/cliplist/cliplist.cpp
@@ -16,6 +16,7 @@
 #include "globals.h"
 #include "wave.h"
 #include "xml.h"
+#include "shortcuts.h"
 #include "ui_cliplisteditorbase.h"
 
 
@@ -128,7 +129,8 @@ ClipListEdit::ClipListEdit(QWidget* parent)
       settingsMenu->addAction(subwinAction);      
       settingsMenu->addAction(shareAction);      
       settingsMenu->addAction(fullscreenAction);      
-      
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
+
       QFontMetrics fm(editor->view->font());
       int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo 0
       int w  = 2 + fm.width('9') * 9 + fm.width(':') * 3 + fw * 4;
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index bc90433d..ce102dc5 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -500,6 +500,7 @@ ListEdit::ListEdit(PartList* pl)
       settingsMenu->addAction(subwinAction);
       settingsMenu->addAction(shareAction);
       settingsMenu->addAction(fullscreenAction);
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
 
 
       // Toolbars ---------------------------------------------------------
diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp
index fabb35fd..0e1e3c4a 100644
--- a/muse2/muse/marker/markerview.cpp
+++ b/muse2/muse/marker/markerview.cpp
@@ -14,6 +14,7 @@
 #include "sync.h"
 #include "icons.h"
 #include "song.h"
+#include "shortcuts.h"
 ///#include "posedit.h"
 #include "awl/posedit.h"
 
@@ -178,7 +179,8 @@ MarkerView::MarkerView(QWidget* parent)
       settingsMenu->addAction(subwinAction);
       settingsMenu->addAction(shareAction);
       settingsMenu->addAction(fullscreenAction);
-      
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
+
       
       // Toolbars ---------------------------------------------------------
       QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 5370a493..ab392497 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -158,6 +158,7 @@ LMaster::LMaster()
       settingsMenu->addAction(subwinAction);
       settingsMenu->addAction(shareAction);
       settingsMenu->addAction(fullscreenAction);
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
 
       
       connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index 1eb2d071..9f5c45e5 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -20,6 +20,7 @@
 #include "xml.h"
 #include "lcombo.h"
 #include "doublelabel.h"
+#include "shortcuts.h"
 ///#include "sigedit.h"
 #include "globals.h"
 
@@ -92,6 +93,7 @@ MasterEdit::MasterEdit()
       settingsMenu->addAction(subwinAction);
       settingsMenu->addAction(shareAction);
       settingsMenu->addAction(fullscreenAction);
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
 
       // Toolbars ---------------------------------------------------------
       QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 14419e0f..32ae8208 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -266,6 +266,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
       settingsMenu->addAction(subwinAction);
       settingsMenu->addAction(shareAction);
       settingsMenu->addAction(fullscreenAction);
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
 
       connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int)));
 
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index 89f84062..c8fa1887 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -232,6 +232,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i
       menuConfig->addAction(subwinAction);
       menuConfig->addAction(shareAction);
       menuConfig->addAction(fullscreenAction);
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
 
       
       //---------ToolBar----------------------------------
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 6bc60205..1a2a4ab6 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -442,7 +442,8 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
 	settings_menu->addAction(subwinAction);
 	settings_menu->addAction(shareAction);
 	settings_menu->addAction(fullscreenAction);
-  
+  fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
+
 
 	init_shortcuts();
 	
diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp
index 86ab0dcd..effdd03a 100644
--- a/muse2/muse/shortcuts.cpp
+++ b/muse2/muse/shortcuts.cpp
@@ -37,7 +37,8 @@ void initShortCuts()
       defShrt(SHRT_TOGGLE_LOOP,   Qt::Key_Slash, "Transport: Toggle Loop section", GLOBAL_SHRT, "toggle_loop");
       defShrt(SHRT_START_REC,     Qt::Key_Asterisk, "Transport: Toggle Record",    GLOBAL_SHRT, "toggle_rec");
       defShrt(SHRT_REC_CLEAR,     Qt::Key_Backspace, "Transport: Clear all rec enabled tracks",    GLOBAL_SHRT, "rec_clear");
-      
+      defShrt(SHRT_FULLSCREEN,       Qt::CTRL + Qt::Key_F, "Toggle fullscreen", GLOBAL_SHRT, "fullscreen");
+
       defShrt(SHRT_COPY,          Qt::CTRL + Qt::Key_C, "Edit: Copy", INVIS_SHRT, "copy");
       defShrt(SHRT_UNDO,          Qt::CTRL + Qt::Key_Z, "Edit: Undo", INVIS_SHRT, "undo");
       defShrt(SHRT_REDO,          Qt::CTRL + Qt::Key_Y, "Edit: Redo", INVIS_SHRT, "redo");
diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h
index b72e0207..ee29a770 100644
--- a/muse2/muse/shortcuts.h
+++ b/muse2/muse/shortcuts.h
@@ -63,6 +63,7 @@ enum {
       SHRT_TOGGLE_METRO, // C
       SHRT_START_REC, // *(keypad)
       SHRT_REC_CLEAR, // *(keypad)
+      SHRT_FULLSCREEN,
 
       //Main + Drumeditor
       SHRT_NEW, //Ctrl+N
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index e138769d..003162d2 100644
--- a/muse2/muse/waveedit/waveedit.cpp
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -154,6 +154,7 @@ WaveEdit::WaveEdit(PartList* pl)
       settingsMenu->addAction(subwinAction);
       settingsMenu->addAction(shareAction);
       settingsMenu->addAction(fullscreenAction);
+      fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
 
       //---------ToolBar----------------------------------
       tools = addToolBar(tr("Wave edit tools"));
-- 
cgit v1.2.3