comparison libgui/src/main-window.cc @ 15993:41471c02d51c

gui: show menu with recently used editor files also in file menu of main window * file-editor-interface.h: new function get_mru_menu () * file-editor.h: new function get_mru_menu (), _mru_file_menu global * file-editor.cc (destructor): delete _mru_file_menu * file-editor.cc (set_focus): make editor visible before setting focus here * main-window.cc (focus_editor): and not here * file-editor.cc (request_new_file,request_open_file): set editor focus here * main-window.cc (new_file,open_file): and not here * main-window.cc (construct): add the editor's mru menu to the file menu
author Torsten <ttl@justmail.de>
date Sat, 02 Feb 2013 13:21:44 +0100
parents c4c46e1a086b
children 74ba79f79fcc
comparison
equal deleted inserted replaced
15992:c4c46e1a086b 15993:41471c02d51c
98 void 98 void
99 main_window::new_file () 99 main_window::new_file ()
100 { 100 {
101 #ifdef HAVE_QSCINTILLA 101 #ifdef HAVE_QSCINTILLA
102 _file_editor->request_new_file (); 102 _file_editor->request_new_file ();
103 focus_editor ();
104 #endif 103 #endif
105 } 104 }
106 105
107 void 106 void
108 main_window::open_file () 107 main_window::open_file ()
109 { 108 {
110 #ifdef HAVE_QSCINTILLA 109 #ifdef HAVE_QSCINTILLA
111 _file_editor->request_open_file (); 110 _file_editor->request_open_file ();
112 focus_editor ();
113 #endif 111 #endif
114 } 112 }
115 113
116 void 114 void
117 main_window::open_file (const QString& file_name) 115 main_window::open_file (const QString& file_name)
118 { 116 {
119 #ifdef HAVE_QSCINTILLA 117 #ifdef HAVE_QSCINTILLA
120 _file_editor->request_open_file (file_name); 118 _file_editor->request_open_file (file_name);
121 focus_editor ();
122 #endif 119 #endif
123 } 120 }
124 121
125 void 122 void
126 main_window::report_status_message (const QString& statusMessage) 123 main_window::report_status_message (const QString& statusMessage)
402 399
403 void 400 void
404 main_window::focus_editor () 401 main_window::focus_editor ()
405 { 402 {
406 #ifdef HAVE_QSCINTILLA 403 #ifdef HAVE_QSCINTILLA
407 if (!_file_editor->isVisible ())
408 {
409 _file_editor->setVisible (true);
410 }
411 // call own function of editor in order to set focus to the current editor tab 404 // call own function of editor in order to set focus to the current editor tab
412 _file_editor->set_focus (); 405 _file_editor->set_focus ();
413 #endif 406 #endif
414 } 407 }
415 408
723 new_gui_action->setEnabled (false); // TODO: Make this work. 716 new_gui_action->setEnabled (false); // TODO: Make this work.
724 717
725 QAction *open_action 718 QAction *open_action
726 = file_menu->addAction (QIcon(":/actions/icons/fileopen.png"), tr ("Open...")); 719 = file_menu->addAction (QIcon(":/actions/icons/fileopen.png"), tr ("Open..."));
727 open_action->setShortcut (Qt::ControlModifier + Qt::Key_O); 720 open_action->setShortcut (Qt::ControlModifier + Qt::Key_O);
721
722 file_menu->addMenu(_file_editor->get_mru_menu ());
723
728 QAction *close_command_window_action 724 QAction *close_command_window_action
729 = file_menu->addAction (tr ("Close Command Window")); 725 = file_menu->addAction (tr ("Close Command Window"));
730 close_command_window_action->setShortcut (Qt::ControlModifier + Qt::Key_W); 726 close_command_window_action->setShortcut (Qt::ControlModifier + Qt::Key_W);
731 close_command_window_action->setEnabled (false); // TODO: Make this work. 727 close_command_window_action->setEnabled (false); // TODO: Make this work.
732 728