24 #if defined (HAVE_CONFIG_H)
28 #include <QKeySequence>
30 #include <QStringList>
35 #include <QApplication>
45 #if defined (Q_OS_WIN32)
54 #if defined (Q_OS_WIN32)
75 QClipboard * cb = QApplication::clipboard ();
77 bool has_selected_text = ! selected_text.isEmpty ();
84 #if defined (Q_OS_WIN32)
87 if (has_selected_text)
89 QRegExp file (
"(?:[ \\t]+)(\\S+) at line (\\d+) column (?:\\d+)");
91 int pos = file.indexIn (selected_text);
95 QString file_name = file.cap (1);
96 QString line = file.cap (2);
100 .arg (file_name).arg (line));
103 data << file_name << line;
109 if (has_selected_text)
111 QRegExp expr (
".*\b*(\\w+)\b*.*");
113 int pos = expr.indexIn (selected_text);
117 QString expr_found = expr.cap (1);
140 if (actions.length ())
142 for (
int i = 0; i < actions.length (); i++)
149 for (
int i = 0; i < actions.length (); i++)
157 QStringList commands =
selectedText ().split (QRegExp (
"[\r\n]"),
158 #
if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
161 QString::SkipEmptyParts);
163 for (
int i = 0; i < commands.size (); i++)
172 QString file =
_edit_action->data ().toStringList ().at (0);
173 int line =
_edit_action->data ().toStringList ().at (1).toInt ();
208 QFont term_font = QFont ();
209 term_font.setStyleHint (QFont::TypeWriter);
213 term_font.setPointSize
217 QFontMetrics metrics (term_font);
218 setMinimumSize (metrics.maxWidth ()*16, metrics.height ()*3);
223 bool cursor_blinking;
238 bool cursorUseForegroundColor
265 = (sc != QKeySequence (Qt::ControlModifier | Qt::Key_C).toString ())
279 octave::resource_manager& rmgr = oct_qobj.get_resource_manager ();
282 setContextMenuPolicy (Qt::CustomContextMenu);
287 =
_contextMenu->addAction (rmgr.icon (
"edit-copy"), tr (
"Copy"),
this,
291 =
_contextMenu->addAction (rmgr.icon (
"edit-paste"), tr (
"Paste"),
this,
307 =
_contextMenu->addAction (tr (
"Help on selection"),
this,
310 =
_contextMenu->addAction (tr (
"Documentation on selection"),
this,
320 connect (
this, SIGNAL (customContextMenuRequested (QPoint)),
328 (QKeySequence (Qt::ControlModifier + Qt::Key_C));
338 _nop_action->setShortcut (QKeySequence (Qt::ControlModifier + Qt::Key_D));
339 _nop_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
void doc_on_expression(void)
QAction * m_help_selected_action
virtual QString selectedText()=0
QAction * _run_selection_action
void help_on_expression(void)
octave::base_qobject & m_octave_qobj
virtual void setCursorType(CursorType type, bool blinking)
virtual void pasteClipboard(void)=0
void construct(octave::base_qobject &oct_qobj)
virtual void setBackgroundColor(const QColor &color)=0
virtual QList< QAction * > get_hotspot_actions(const QPoint &)
void notice_settings(const gui_settings *settings)
QAction * _interrupt_action
void edit_mfile_request(const QString &, int)
virtual void setSelectionColor(const QColor &color)=0
virtual void handleCustomContextMenuRequested(const QPoint &at)
virtual void has_extra_interrupt(bool extra)=0
QAction * _selectall_action
virtual void setTerminalFont(const QFont &font)=0
virtual void setCursorColor(bool useForegroundColor, const QColor &color)=0
virtual void copyClipboard(void)=0
void terminal_interrupt(void)
QAction * m_doc_selected_action
static QTerminal * create(octave::base_qobject &oct_qobj, QWidget *xparent)
void clear_command_window_request(void)
virtual void setForegroundColor(const QColor &color)=0
void execute_command_in_terminal_signal(const QString &)
QAction * m_edit_selected_action
virtual void setScrollBufferSize(int value=1000)=0
virtual void selectAll(void)=0
const gui_pref cs_colors[2 *cs_colors_count]
const gui_pref cs_color_mode("terminal/color_mode", QVariant(0))
const gui_pref cs_hist_buffer("terminal/history_buffer", QVariant(1000))
const gui_pref cs_font_size("terminal/fontSize", QVariant(10))
const std::vector< std::string > cs_cursor_types
const gui_pref cs_cursor("terminal/cursorType", QVariant("ibeam"))
const gui_pref cs_cursor_use_fgcol("terminal/cursorUseForegroundColor", QVariant(true))
const gui_pref cs_font("terminal/fontName", QVariant())
const gui_pref cs_cursor_blinking("terminal/cursorBlinking", QVariant(true))
const gui_pref global_mono_font("monospace_font", global_font_family)
const gui_pref global_cursor_blinking("cursor_blinking", QVariant(true))
const gui_pref sc_main_ctrld("shortcuts/main_ctrld", QVariant(false))
const sc_pref sc_main_edit_copy(sc_main_edit+":copy", QKeySequence::Copy)
const gui_pref sc_prevent_rl_conflicts("shortcuts/prevent_readline_conflicts", QVariant(false))