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)
83 (QKeySequence (Qt::ControlModifier | Qt::Key_C));
86 (QKeySequence (Qt::ControlModifier | Qt::Key_D));
94 QClipboard * cb = QApplication::clipboard ();
96 bool has_selected_text = ! selected_text.isEmpty ();
103 #if defined (Q_OS_WIN32)
106 if (has_selected_text)
108 QRegExp file (
"(?:[ \\t]+)(\\S+) at line (\\d+) column (?:\\d+)");
110 int pos = file.indexIn (selected_text);
114 QString file_name = file.cap (1);
115 QString
line = file.cap (2);
119 .arg (file_name).arg (
line));
122 data << file_name <<
line;
128 if (has_selected_text)
130 QRegExp expr (
".*\b*(\\w+)\b*.*");
132 int pos = expr.indexIn (selected_text);
136 QString expr_found = expr.cap (1);
159 if (actions.length ())
161 for (
int i = 0; i < actions.length (); i++)
168 for (
int i = 0; i < actions.length (); i++)
176 QStringList commands =
selectedText ().split (QRegExp (
"[\r\n]"),
177 #
if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
180 QString::SkipEmptyParts);
182 for (
int i = 0; i < commands.size (); i++)
191 QString file =
_edit_action->data ().toStringList ().at (0);
228 QFont term_font = QFont ();
229 term_font.setStyleHint (QFont::TypeWriter);
233 term_font.setPointSize
237 QFontMetrics metrics (term_font);
238 setMinimumSize (metrics.maxWidth ()*16, metrics.height ()*3);
243 bool cursor_blinking;
258 bool cursorUseForegroundColor
284 = (sc != QKeySequence (Qt::ControlModifier | Qt::Key_C).toString ());
300 setContextMenuPolicy (Qt::CustomContextMenu);
325 =
_contextMenu->addAction (tr (
"Help on selection"),
this,
328 =
_contextMenu->addAction (tr (
"Documentation on selection"),
this,
335 _contextMenu->addAction (tr (
"Clear Window"), parent (),
336 SLOT (handle_clear_command_window_request ()));
338 connect (
this, SIGNAL (customContextMenuRequested (QPoint)),
345 xparent, SLOT (handle_show_doc (
const QString&)));
348 xparent, SLOT (edit_mfile (
const QString&,
int)));
351 xparent, SLOT (execute_command_in_terminal (
const QString&)));
353 connect (xparent, SIGNAL (settings_changed (
const gui_settings *)),
356 connect (xparent, SIGNAL (init_terminal_size_signal ()),
359 connect (xparent, SIGNAL (copyClipboard_signal ()),
362 connect (xparent, SIGNAL (pasteClipboard_signal ()),
365 connect (xparent, SIGNAL (selectAll_signal ()),
373 (QKeySequence (Qt::ControlModifier + Qt::Key_C));
382 _nop_action->setShortcut (QKeySequence (Qt::ControlModifier + Qt::Key_D));
void doc_on_expression(void)
void report_status_message(const QString &)
QAction * m_help_selected_action
virtual QString selectedText()=0
QAction * _run_selection_action
void help_on_expression(void)
virtual void setCursorType(CursorType type, bool blinking)
virtual void pasteClipboard(void)=0
virtual void setBackgroundColor(const QColor &color)=0
virtual QList< QAction * > get_hotspot_actions(const QPoint &)
void notice_settings(const gui_settings *settings)
virtual void init_terminal_size(void)
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
void set_global_shortcuts(bool focus_out)
virtual void setCursorColor(bool useForegroundColor, const QColor &color)=0
virtual void copyClipboard(void)=0
void terminal_interrupt(void)
QAction * m_doc_selected_action
virtual void setForegroundColor(const QColor &color)=0
void construct(octave::base_qobject &oct_qobj, QWidget *xparent)
void execute_command_in_terminal_signal(const QString &)
QAction * m_edit_selected_action
virtual void setScrollBufferSize(int value=1000)=0
void show_doc_signal(const QString &)
virtual void selectAll(void)=0
static QTerminal * create(octave::base_qobject &oct_qobj, QWidget *xparent=nullptr)
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
QVariant value(const gui_pref &pref) const
QString sc_value(const sc_pref &pref) const
QIcon icon(const QString &icon_name, bool fallback=true)
const gui_pref cs_colors[cs_colors_count]
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)