Mercurial > hg > octave-lyh
changeset 14829:e97be88fc478 gui
Fixed removing all breakpoints.
* file-editor-tab: Renamed slot to remove all breakpoints.
* file-editor: Renamed slot to remove all breakpoints.
* octave-event: Added checking for return value when adding breakpoints.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Mon, 02 Jul 2012 15:18:55 +0200 |
parents | 6b90737f69cc |
children | 41b86dc61306 |
files | gui/src/m-editor/file-editor-tab.cc gui/src/m-editor/file-editor-tab.h gui/src/m-editor/file-editor.cc gui/src/octave-adapter/octave-event.h |
diffstat | 4 files changed, 39 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/m-editor/file-editor-tab.cc +++ b/gui/src/m-editor/file-editor-tab.cc @@ -383,9 +383,19 @@ } void -file_editor_tab::remove_breakpoint () +file_editor_tab::remove_all_breakpoints () { - _edit_area->markerDeleteAll (breakpoint); + QFileInfo file_info (_file_name); + QString path = file_info.absolutePath (); + QString function_name = file_info.fileName (); + + // We have to cut off the suffix, because octave appends it. + function_name.chop (file_info.suffix ().length () + 1); + + octave_link::instance ()->post_event + (new octave_remove_all_breakpoints_event (*this, + path.toStdString (), + function_name.toStdString ())); } void
--- a/gui/src/m-editor/file-editor-tab.h +++ b/gui/src/m-editor/file-editor-tab.h @@ -46,7 +46,7 @@ void toggle_bookmark (); void next_bookmark (); void previous_bookmark (); - void remove_breakpoint (); + void remove_all_breakpoints (); void toggle_breakpoint (); void next_breakpoint (); void previous_breakpoint ();
--- a/gui/src/m-editor/file-editor.cc +++ b/gui/src/m-editor/file-editor.cc @@ -230,7 +230,7 @@ { file_editor_tab *activeFileEditorTab = active_editor_tab (); if (activeFileEditorTab) - activeFileEditorTab->remove_breakpoint (); + activeFileEditorTab->remove_all_breakpoints (); } void
--- a/gui/src/octave-adapter/octave-event.h +++ b/gui/src/octave-adapter/octave-event.h @@ -269,12 +269,11 @@ bp_table::intmap intmap; intmap[0] = _line; - // TODO: Check success. std::string previous_directory = octave_env::get_current_directory (); octave_env::chdir (_path); - bp_table::add_breakpoint (_function_name, intmap); + intmap = bp_table::add_breakpoint (_function_name, intmap); octave_env::chdir (previous_directory); - return true; + return intmap.size () > 0; } std::string get_path () @@ -317,12 +316,11 @@ bp_table::intmap intmap; intmap[0] = _line; - // TODO: Check success. std::string previous_directory = octave_env::get_current_directory (); octave_env::chdir (_path); bp_table::remove_breakpoint (_function_name, intmap); octave_env::chdir (previous_directory); - return true; + return true; // TODO: Check result. } std::string get_path () @@ -350,21 +348,37 @@ { public: octave_remove_all_breakpoints_event (octave_event_observer& o, - std::string file) + std::string path, + std::string function_name) : octave_event (o) { - _file = file; + _path = path; + _function_name = function_name; } bool perform () { - // TODO: Check success. - bp_table::remove_all_breakpoints_in_file (_file, true); - return true; + bp_table::intmap intmap; + std::string previous_directory = octave_env::get_current_directory (); + octave_env::chdir (_path); + intmap = bp_table::remove_all_breakpoints_in_file (_function_name, true); + octave_env::chdir (previous_directory); + return intmap.size() > 0; + } + + std::string get_path () + { + return _path; + } + + std::string get_function_name () + { + return _function_name; } private: - std::string _file; + std::string _path; + std::string _function_name; }; class octave_debug_step_into_event : public octave_event