Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
14678:9fa8955ea79d | 14680:628eeaf879f7 |
---|---|
230 delete fileEditorTab; | 230 delete fileEditorTab; |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 void | 234 void |
235 FileEditor::activeTabChanged (int index) | |
236 { | |
237 Q_UNUSED (index); | |
238 handleEditorStateChanged (); | |
239 } | |
240 | |
241 void | |
242 FileEditor::handleEditorStateChanged () | |
243 { | |
244 FileEditorTab *fileEditorTab = activeEditorTab (); | |
245 if (fileEditorTab) | |
246 { | |
247 bool copyAvailable = fileEditorTab->copyAvailable (); | |
248 m_copyAction->setEnabled (copyAvailable); | |
249 m_cutAction->setEnabled (copyAvailable); | |
250 } | |
251 } | |
252 | |
253 void | |
235 FileEditor::construct () | 254 FileEditor::construct () |
236 { | 255 { |
237 QSettings *settings = ResourceManager::instance ()->settings (); | 256 QSettings *settings = ResourceManager::instance ()->settings (); |
238 QStyle *style = QApplication::style (); | 257 QStyle *style = QApplication::style (); |
239 | 258 |
240 m_menuBar = new QMenuBar (this); | 259 m_menuBar = new QMenuBar (this); |
241 m_toolBar = new QToolBar (this); | 260 m_toolBar = new QToolBar (this); |
242 m_statusBar = new QStatusBar (this); | |
243 m_tabWidget = new QTabWidget (this); | 261 m_tabWidget = new QTabWidget (this); |
244 m_tabWidget->setTabsClosable (true); | 262 m_tabWidget->setTabsClosable (true); |
245 //m_longTitle = settings->value ("editor/longWindowTitle",true).toBool (); | 263 //m_longTitle = settings->value ("editor/longWindowTitle",true).toBool (); |
246 | 264 |
247 // Theme icons with QStyle icons as fallback | 265 // Theme icons with QStyle icons as fallback |
351 | 369 |
352 QVBoxLayout *layout = new QVBoxLayout (); | 370 QVBoxLayout *layout = new QVBoxLayout (); |
353 layout->addWidget (m_menuBar); | 371 layout->addWidget (m_menuBar); |
354 layout->addWidget (m_toolBar); | 372 layout->addWidget (m_toolBar); |
355 layout->addWidget (m_tabWidget); | 373 layout->addWidget (m_tabWidget); |
356 layout->addWidget (m_statusBar); | |
357 layout->setMargin (0); | 374 layout->setMargin (0); |
358 setLayout (layout); | 375 setLayout (layout); |
359 | 376 |
360 connect (newAction, SIGNAL (triggered ()), this, SLOT (requestNewFile ())); | 377 connect (newAction, SIGNAL (triggered ()), this, SLOT (requestNewFile ())); |
361 connect (openAction, SIGNAL (triggered ()), this, SLOT (requestOpenFile ())); | 378 connect (openAction, SIGNAL (triggered ()), this, SLOT (requestOpenFile ())); |
372 connect (prevBookmarkAction, SIGNAL (triggered ()), this, SLOT (requestPreviousBookmark ())); | 389 connect (prevBookmarkAction, SIGNAL (triggered ()), this, SLOT (requestPreviousBookmark ())); |
373 connect (removeBookmarkAction, SIGNAL (triggered ()), this, SLOT (requestRemoveBookmark ())); | 390 connect (removeBookmarkAction, SIGNAL (triggered ()), this, SLOT (requestRemoveBookmark ())); |
374 connect (commentSelectedAction, SIGNAL (triggered ()), this, SLOT (requestCommentSelectedText ())); | 391 connect (commentSelectedAction, SIGNAL (triggered ()), this, SLOT (requestCommentSelectedText ())); |
375 connect (uncommentSelectedAction, SIGNAL (triggered ()), this, SLOT (requestUncommentSelectedText ())); | 392 connect (uncommentSelectedAction, SIGNAL (triggered ()), this, SLOT (requestUncommentSelectedText ())); |
376 connect (m_tabWidget, SIGNAL (tabCloseRequested (int)), this, SLOT (handleTabCloseRequest (int))); | 393 connect (m_tabWidget, SIGNAL (tabCloseRequested (int)), this, SLOT (handleTabCloseRequest (int))); |
394 connect (m_tabWidget, SIGNAL (currentChanged(int)), this, SLOT (activeTabChanged (int))); | |
377 | 395 |
378 // this has to be done only once, not for each editor | 396 // this has to be done only once, not for each editor |
379 m_lexer = new LexerOctaveGui (); | 397 m_lexer = new LexerOctaveGui (); |
380 | 398 |
381 // Editor font (default or from settings) | 399 // Editor font (default or from settings) |
412 | 430 |
413 void | 431 void |
414 FileEditor::addFileEditorTab (FileEditorTab *fileEditorTab) | 432 FileEditor::addFileEditorTab (FileEditorTab *fileEditorTab) |
415 { | 433 { |
416 m_tabWidget->addTab (fileEditorTab, ""); | 434 m_tabWidget->addTab (fileEditorTab, ""); |
417 connect (fileEditorTab, SIGNAL(fileNameChanged(QString)), | 435 connect (fileEditorTab, SIGNAL (fileNameChanged(QString)), |
418 this, SLOT(handleFileNameChanged(QString))); | 436 this, SLOT(handleFileNameChanged(QString))); |
419 | 437 connect (fileEditorTab, SIGNAL (editorStateChanged ()), |
438 this, SLOT (handleEditorStateChanged ())); | |
420 m_tabWidget->setCurrentWidget (fileEditorTab); | 439 m_tabWidget->setCurrentWidget (fileEditorTab); |
421 } | 440 } |
422 | 441 |
423 FileEditorTab * | 442 FileEditorTab * |
424 FileEditor::activeEditorTab () | 443 FileEditor::activeEditorTab () |