29 #ifdef HAVE_QSCINTILLA
31 #include <Qsci/qscilexer.h>
47 long position = SendScintilla (QsciScintillaBase::SCI_GETCURRENTPOS);
48 long point_x = SendScintilla
49 (QsciScintillaBase::SCI_POINTXFROMPOSITION,0,position);
50 long point_y = SendScintilla
51 (QsciScintillaBase::SCI_POINTYFROMPOSITION,0,position);
52 *local_pos = QPoint (point_x,point_y);
53 *global_pos = mapToGlobal (*local_pos);
60 QPoint global_pos, local_pos;
63 QString lexer_name =
lexer ()->lexer ();
64 return ((lexer_name ==
"octave" || lexer_name ==
"matlab")
88 if (hasSelectedText ())
92 #ifdef HAVE_QSCI_VERSION_2_6_0
95 octave_qscintilla::contextMenuEvent (QContextMenuEvent *e)
97 QMenu *context_menu = createStandardContextMenu ( );
100 QPoint global_pos, local_pos;
102 if (e->reason () == QContextMenuEvent::Mouse)
105 global_pos = e->globalPos ();
106 local_pos = e->pos ();
112 QRect editor_rect = geometry ();
113 editor_rect.moveTopLeft
114 (parentWidget ()->mapToGlobal (editor_rect.topLeft ()));
115 if (!editor_rect.contains (global_pos))
116 global_pos = editor_rect.topLeft ();
120 context_menu->addSeparator ();
124 QString lexer_name =
lexer ()->lexer ();
125 if (lexer_name ==
"octave" || lexer_name ==
"matlab")
132 context_menu->addAction (tr (
"Documentation on")
138 context_menu->addSeparator ();
139 if (hasSelectedText ())
140 context_menu->addAction (tr (
"&Run Selection"),
145 context_menu->exec (global_pos);
183 QStringList commands = selectedText ().split (QRegExp(
"[\r\n]"),
184 QString::SkipEmptyParts);
185 for (
int i = 0; i < commands.size (); i++ )