Mercurial > octave-dspies
changeset 19002:00b1d60500bd gui-release
improved finding a function file for editing in gui (case 1 in bug #41509)
* octave-qscintilla.cc (contextmenu_edit): call F__which__ to get the
correct path of a function file even it is a class function
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 10 Aug 2014 19:31:42 +0200 |
parents | 2675b285f55f |
children | e87e65bc71ae |
files | libgui/src/m-editor/octave-qscintilla.cc |
diffstat | 1 files changed, 36 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/octave-qscintilla.cc Thu Aug 07 11:44:56 2014 -0400 +++ b/libgui/src/m-editor/octave-qscintilla.cc Sun Aug 10 19:31:42 2014 +0200 @@ -31,6 +31,8 @@ #include <Qsci/qscilexer.h> #include <Qsci/qscicommandset.h> #include <QShortcut> +#include <QMessageBox> +#include <oct-map.h> #include "octave-qscintilla.h" #include "file-editor-tab.h" @@ -265,7 +267,40 @@ void octave_qscintilla::contextmenu_edit (bool) { - emit execute_command_in_terminal_signal (QString("edit ") + _word_at_cursor); + octave_value_list fct = F__which__ (ovl (_word_at_cursor.toStdString ()),0); + octave_map map = fct(0).map_value (); + + QString type = QString::fromStdString ( + map.contents ("type").data ()[0].string_value ()); + QString name = QString::fromStdString ( + map.contents ("name").data ()[0].string_value ()); + + QString message = QString (); + + if (type.isEmpty ()) + message = tr ("Can not find function %1"); + else if (type == QString("built-in function")) + message = tr ("%1 is a built-in function"); + + if (! message.isEmpty ()) + { + QMessageBox *msgBox + = new QMessageBox (QMessageBox::Critical, + tr ("Octave Editor"), + message.arg (name), + QMessageBox::Ok, this); + + msgBox->setWindowModality (Qt::NonModal); + msgBox->setAttribute (Qt::WA_DeleteOnClose); + msgBox->show (); + return; + } + + QString filename = QString::fromStdString ( + map.contents ("file").data ()[0].string_value ()); + + emit execute_command_in_terminal_signal (QString("edit ") + + "\""+filename+"\""); } void