Mercurial > hg > octave-nkf
comparison libgui/src/m-editor/file-editor-tab.cc @ 15371:eec0d1fcba4f
use Octave singleton style for octave_link class
* octave-link.h, octave-link.cc (class octave_link): Update style to
match other singleton classes in Octave.
Change all uses.
* history-dockwidget.cc, file-editor-tab.cc, main-window.cc,
octave-link.cc, workspace-model.cc: Change all uses.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Sep 2012 01:03:55 -0400 |
parents | 36ececf69385 |
children | e4ecc18a24cc |
comparison
equal
deleted
inserted
replaced
15370:8355fddce815 | 15371:eec0d1fcba4f |
---|---|
310 QString function_name = file_info.fileName (); | 310 QString function_name = file_info.fileName (); |
311 | 311 |
312 // We have to cut off the suffix, because octave appends it. | 312 // We have to cut off the suffix, because octave appends it. |
313 function_name.chop (file_info.suffix ().length () + 1); | 313 function_name.chop (file_info.suffix ().length () + 1); |
314 | 314 |
315 octave_link::instance ()->post_event | 315 octave_link::post_event (new octave_add_breakpoint_event |
316 (new octave_add_breakpoint_event (*this, | 316 (*this, path.toStdString (), |
317 path.toStdString (), | 317 function_name.toStdString (), line)); |
318 function_name.toStdString (), | |
319 line)); | |
320 } | 318 } |
321 | 319 |
322 void | 320 void |
323 file_editor_tab::request_remove_breakpoint (int line) | 321 file_editor_tab::request_remove_breakpoint (int line) |
324 { | 322 { |
327 QString function_name = file_info.fileName (); | 325 QString function_name = file_info.fileName (); |
328 | 326 |
329 // We have to cut off the suffix, because octave appends it. | 327 // We have to cut off the suffix, because octave appends it. |
330 function_name.chop (file_info.suffix ().length () + 1); | 328 function_name.chop (file_info.suffix ().length () + 1); |
331 | 329 |
332 octave_link::instance ()->post_event | 330 octave_link::post_event (new octave_remove_breakpoint_event |
333 (new octave_remove_breakpoint_event (*this, | 331 (*this, path.toStdString (), |
334 path.toStdString (), | 332 function_name.toStdString (), line)); |
335 function_name.toStdString (), | |
336 line)); | |
337 } | 333 } |
338 | 334 |
339 void | 335 void |
340 file_editor_tab::comment_selected_text () | 336 file_editor_tab::comment_selected_text () |
341 { | 337 { |
499 QString function_name = file_info.fileName (); | 495 QString function_name = file_info.fileName (); |
500 | 496 |
501 // We have to cut off the suffix, because octave appends it. | 497 // We have to cut off the suffix, because octave appends it. |
502 function_name.chop (file_info.suffix ().length () + 1); | 498 function_name.chop (file_info.suffix ().length () + 1); |
503 | 499 |
504 octave_link::instance ()->post_event | 500 octave_link::post_event (new octave_remove_all_breakpoints_event |
505 (new octave_remove_all_breakpoints_event (*this, | 501 (*this, path.toStdString (), |
506 path.toStdString (), | 502 function_name.toStdString ())); |
507 function_name.toStdString ())); | |
508 } | 503 } |
509 | 504 |
510 void | 505 void |
511 file_editor_tab::toggle_breakpoint () | 506 file_editor_tab::toggle_breakpoint () |
512 { | 507 { |
711 QString saveFileName(_file_name); | 706 QString saveFileName(_file_name); |
712 QFileDialog fileDialog(this); | 707 QFileDialog fileDialog(this); |
713 if (saveFileName == UNNAMED_FILE || saveFileName.isEmpty ()) | 708 if (saveFileName == UNNAMED_FILE || saveFileName.isEmpty ()) |
714 { | 709 { |
715 QString directory = QString::fromStdString | 710 QString directory = QString::fromStdString |
716 (octave_link::instance ()->get_last_working_directory ()); | 711 (octave_link::last_working_directory ()); |
717 | 712 |
718 if (directory.isEmpty ()) | 713 if (directory.isEmpty ()) |
719 { | 714 { |
720 directory = QDir::homePath (); | 715 directory = QDir::homePath (); |
721 } | 716 } |
749 if (_edit_area->isModified ()) | 744 if (_edit_area->isModified ()) |
750 save_file(_file_name); | 745 save_file(_file_name); |
751 | 746 |
752 QFileInfo file_info (_file_name); | 747 QFileInfo file_info (_file_name); |
753 QString path = file_info.absolutePath (); | 748 QString path = file_info.absolutePath (); |
754 //QString current_path = QString::fromStdString | 749 QString current_path |
755 (octave_link::instance ()->get_last_working_directory ()); | 750 = QString::fromStdString (octave_link::last_working_directory ()); |
756 QString function_name = file_info.fileName (); | 751 QString function_name = file_info.fileName (); |
757 | 752 |
758 // We have to cut off the suffix, because octave appends it. | 753 // We have to cut off the suffix, because octave appends it. |
759 function_name.chop (file_info.suffix ().length () + 1); | 754 function_name.chop (file_info.suffix ().length () + 1); |
760 _file_editor->terminal ()->sendText (QString ("cd \'%1\'\n%2\n") | 755 _file_editor->terminal ()->sendText (QString ("cd \'%1\'\n%2\n") |
761 .arg(path).arg (function_name)); | 756 .arg(path).arg (function_name)); |
762 // TODO: Sending a run event crashes for long scripts. Find out why. | 757 // TODO: Sending a run event crashes for long scripts. Find out why. |
763 // octave_link::instance () | 758 // octave_link::post_event (new octave_run_file_event |
764 // ->post_event (new octave_run_file_event (*this, _file_name.toStdString ())); | 759 // (*this, _file_name.toStdString ())); |
765 } | 760 } |
766 | 761 |
767 void | 762 void |
768 file_editor_tab::file_has_changed (const QString& fileName) | 763 file_editor_tab::file_has_changed (const QString& fileName) |
769 { | 764 { |