Mercurial > octave-dspies
comparison libgui/src/m-editor/octave-qscintilla.cc @ 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 | c6b89c4a9e63 |
children | e87e65bc71ae |
comparison
equal
deleted
inserted
replaced
18993:2675b285f55f | 19002:00b1d60500bd |
---|---|
29 #ifdef HAVE_QSCINTILLA | 29 #ifdef HAVE_QSCINTILLA |
30 | 30 |
31 #include <Qsci/qscilexer.h> | 31 #include <Qsci/qscilexer.h> |
32 #include <Qsci/qscicommandset.h> | 32 #include <Qsci/qscicommandset.h> |
33 #include <QShortcut> | 33 #include <QShortcut> |
34 #include <QMessageBox> | |
35 #include <oct-map.h> | |
34 | 36 |
35 #include "octave-qscintilla.h" | 37 #include "octave-qscintilla.h" |
36 #include "file-editor-tab.h" | 38 #include "file-editor-tab.h" |
37 #include "shortcut-manager.h" | 39 #include "shortcut-manager.h" |
38 | 40 |
263 } | 265 } |
264 | 266 |
265 void | 267 void |
266 octave_qscintilla::contextmenu_edit (bool) | 268 octave_qscintilla::contextmenu_edit (bool) |
267 { | 269 { |
268 emit execute_command_in_terminal_signal (QString("edit ") + _word_at_cursor); | 270 octave_value_list fct = F__which__ (ovl (_word_at_cursor.toStdString ()),0); |
271 octave_map map = fct(0).map_value (); | |
272 | |
273 QString type = QString::fromStdString ( | |
274 map.contents ("type").data ()[0].string_value ()); | |
275 QString name = QString::fromStdString ( | |
276 map.contents ("name").data ()[0].string_value ()); | |
277 | |
278 QString message = QString (); | |
279 | |
280 if (type.isEmpty ()) | |
281 message = tr ("Can not find function %1"); | |
282 else if (type == QString("built-in function")) | |
283 message = tr ("%1 is a built-in function"); | |
284 | |
285 if (! message.isEmpty ()) | |
286 { | |
287 QMessageBox *msgBox | |
288 = new QMessageBox (QMessageBox::Critical, | |
289 tr ("Octave Editor"), | |
290 message.arg (name), | |
291 QMessageBox::Ok, this); | |
292 | |
293 msgBox->setWindowModality (Qt::NonModal); | |
294 msgBox->setAttribute (Qt::WA_DeleteOnClose); | |
295 msgBox->show (); | |
296 return; | |
297 } | |
298 | |
299 QString filename = QString::fromStdString ( | |
300 map.contents ("file").data ()[0].string_value ()); | |
301 | |
302 emit execute_command_in_terminal_signal (QString("edit ") | |
303 + "\""+filename+"\""); | |
269 } | 304 } |
270 | 305 |
271 void | 306 void |
272 octave_qscintilla::contextmenu_run (bool) | 307 octave_qscintilla::contextmenu_run (bool) |
273 { | 308 { |