Mercurial > octave-nkf
diff libgui/src/m-editor/file-editor-tab.cc @ 16377:8430ea8c1594
open editor tab and insert marker for debugging with gui
* file-editor-interface.h (file_editor_interface::request_open_file):
New public slot.
(file_editor_interface::handle_dbstop_request): New virtual function.
* file-editor-tab.h, file-editor-tab.cc (file_editor_tab::goto_line):
New arg, line, with default value. Don't prompt if line is greater
than zero.
(file_editor_tab::set_debugger_position): New arg, widget id.
(file_editor_tab::add_filename_to_list): New arg, widget id.
* file-editor.h, file-editor.cc (file_eidtor::editor_tab_map):
New data member.
(file_editor::fetFileNames) Delete.
(file_editor::~file_editor, file_editor::check_conflict_save,
file_editor::handle_add_filename_to_list): Use editor_tab_map instead
of fetFileNames.
(file_editor::request_open_file): New args, line and set_marker.
Optionally position cursor at line and with debug marker. If file is
already open in tab, switch to it instead of giving error.
(file_editor::construct): Connect fetab_set_debugger_position signal
to set_debugger_position slot.
* main-window.h, main-window.cc (main_window::dbstop_signal):
New signal.
(main_window::handle_dbstop_request): New function.
* octave-event-listener.h (octave_event_listener::dbstop): New
virtual function.
* octave-qt-event-listener.h, octave-qt-event-listener.cc
(octave_qt_event_listener::dbstop): New function.
(octave_qt_event_listener::dbstop_signal): New signal.
* octave-link.h, octave-link.cc (octave_link::dbstop,
octave_link::do_dbstop, octave_link::dbstop_event_hook_fcn,
octave_link::do_dbstop_event_hook_fcn): New functions
* octave-main-thread.h, octave-main-thread.cc (dbstop_event_hook_fcn):
New function.
(octave_main_thread::run): Add it to the list of dbstop event hook
functions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 27 Mar 2013 12:59:12 -0400 |
parents | f482302d81c9 |
children | 4bb1b82076e5 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc Wed Mar 27 00:45:49 2013 -0400 +++ b/libgui/src/m-editor/file-editor-tab.cc Wed Mar 27 12:59:12 2013 -0400 @@ -629,19 +629,26 @@ } void -file_editor_tab::goto_line (const QWidget* ID) +file_editor_tab::goto_line (const QWidget* ID, int line) { if (ID != this) return; - int line, index; + bool ok = true; - _edit_area->getCursorPosition(&line, &index); + if (line <= 0) + { + bool ok = false; + + int index; - bool ok = false; + _edit_area->getCursorPosition(&line, &index); + - line = QInputDialog::getInt (_edit_area, "Goto line", "Line number", - line+1, 1, _edit_area->lines(), 1, &ok); + line = QInputDialog::getInt (_edit_area, "Goto line", "Line number", + line+1, 1, _edit_area->lines(), 1, &ok); + } + if (ok) _edit_area->setCursorPosition (line-1, 0); } @@ -1103,7 +1110,7 @@ // Unnamed files shouldn't be transmitted. if (!_file_name.isEmpty ()) - emit add_filename_to_list (_file_name); + emit add_filename_to_list (_file_name, this); } void @@ -1140,8 +1147,11 @@ } void -file_editor_tab::set_debugger_position (int line) +file_editor_tab::set_debugger_position (const QWidget *ID, int line) { + if (ID != this || ID == 0) + return; + _edit_area->markerDeleteAll (debugger_position); if (line > 0) {