Mercurial > octave-nkf
diff gui/src/editor/FileEditor.cpp @ 14680:628eeaf879f7 gui
Copy/Paste buttons get greyed out in the editor correctly again. Removed margin in editor tabs and status bar.
* FileEditor: Removed status bar and added slot to handle changes in tabs.
* FileEditorTab: Removed margen and added signal when copying is possible.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Thu, 24 May 2012 12:08:53 +0200 |
parents | 35512b788af2 |
children | 66ff321cb62e |
line wrap: on
line diff
--- a/gui/src/editor/FileEditor.cpp Wed May 23 16:20:29 2012 -0400 +++ b/gui/src/editor/FileEditor.cpp Thu May 24 12:08:53 2012 +0200 @@ -232,6 +232,25 @@ } void +FileEditor::activeTabChanged (int index) +{ + Q_UNUSED (index); + handleEditorStateChanged (); +} + +void +FileEditor::handleEditorStateChanged () +{ + FileEditorTab *fileEditorTab = activeEditorTab (); + if (fileEditorTab) + { + bool copyAvailable = fileEditorTab->copyAvailable (); + m_copyAction->setEnabled (copyAvailable); + m_cutAction->setEnabled (copyAvailable); + } +} + +void FileEditor::construct () { QSettings *settings = ResourceManager::instance ()->settings (); @@ -239,7 +258,6 @@ m_menuBar = new QMenuBar (this); m_toolBar = new QToolBar (this); - m_statusBar = new QStatusBar (this); m_tabWidget = new QTabWidget (this); m_tabWidget->setTabsClosable (true); //m_longTitle = settings->value ("editor/longWindowTitle",true).toBool (); @@ -353,7 +371,6 @@ layout->addWidget (m_menuBar); layout->addWidget (m_toolBar); layout->addWidget (m_tabWidget); - layout->addWidget (m_statusBar); layout->setMargin (0); setLayout (layout); @@ -374,6 +391,7 @@ connect (commentSelectedAction, SIGNAL (triggered ()), this, SLOT (requestCommentSelectedText ())); connect (uncommentSelectedAction, SIGNAL (triggered ()), this, SLOT (requestUncommentSelectedText ())); connect (m_tabWidget, SIGNAL (tabCloseRequested (int)), this, SLOT (handleTabCloseRequest (int))); + connect (m_tabWidget, SIGNAL (currentChanged(int)), this, SLOT (activeTabChanged (int))); // this has to be done only once, not for each editor m_lexer = new LexerOctaveGui (); @@ -414,9 +432,10 @@ FileEditor::addFileEditorTab (FileEditorTab *fileEditorTab) { m_tabWidget->addTab (fileEditorTab, ""); - connect (fileEditorTab, SIGNAL(fileNameChanged(QString)), + connect (fileEditorTab, SIGNAL (fileNameChanged(QString)), this, SLOT(handleFileNameChanged(QString))); - + connect (fileEditorTab, SIGNAL (editorStateChanged ()), + this, SLOT (handleEditorStateChanged ())); m_tabWidget->setCurrentWidget (fileEditorTab); }