26 #if defined (HAVE_CONFIG_H)
30 #if defined (HAVE_QSCINTILLA)
33 #include <QHBoxLayout>
36 #include <QPushButton>
39 #include <QVBoxLayout>
54 :
QWidget (p), m_incomplete_parse (false),
55 m_prompt (QString ()),
56 m_console (new
console (this, oct_qobj))
62 QGroupBox *input_group_box =
new QGroupBox ();
63 QHBoxLayout *input_layout =
new QHBoxLayout;
64 input_layout->addWidget (pause_button);
65 input_layout->addWidget (stop_button);
66 input_layout->addWidget (resume_button);
67 input_group_box->setLayout (input_layout);
69 QVBoxLayout *main_layout =
new QVBoxLayout ();
70 main_layout->addWidget (m_console);
71 main_layout->addWidget (input_group_box);
73 setLayout (main_layout);
75 setFocusProxy (m_console);
77 connect (pause_button, &QPushButton::clicked,
80 connect (resume_button, &QPushButton::clicked,
83 connect (stop_button, &QPushButton::clicked,
89 insert_interpreter_output (
"\n\n Welcome to Octave\n\n");
99 QPointer<command_widget> this_cw (
this);
109 if (this_cw.isNull ())
114 std::string
prompt = input_sys.PS1 ();
142 QPointer<command_widget> this_cw (
this);
156 if (this_cw.isNull ())
175 QFont term_font = QFont ();
176 term_font.setStyleHint (QFont::TypeWriter);
180 term_font.setPointSize
190 m_console->setStyleSheet (QString (
"color: %1; background-color:%2;")
191 .arg (fgc.name ()).arg (bgc.name ()));
201 m_command_position (-1),
202 m_cursor_position (0),
203 m_text_changed (false),
204 m_command_widget (p),
205 m_last_key_string (QString ())
208 setWrapMode (QsciScintilla::WrapWord);
210 connect (
this, SIGNAL (cursorPositionChanged (
int,
int)),
213 connect (
this, SIGNAL (textChanged (
void)),
216 connect (
this, SIGNAL (modificationAttempted (
void)),
223 if (! text (lines () -1).isEmpty ())
229 getCursorPosition (&line,&index);
238 QString input_line = text (lines () - 1);
243 input_line = input_line.trimmed ();
247 if (input_line.isEmpty ())
256 if (command.trimmed ().isEmpty ())
270 lineIndexFromPosition (text ().length (), &line, &index);
272 setCursorPosition (line, index);
286 setCursorPosition (line+1, col);
317 if (e->key () == Qt::Key_Return)
324 QsciScintilla::keyPressEvent(e);
Base class for Octave interfaces that use Qt.
static std::string decode_prompt_string(const std::string &s)
QString m_last_key_string
void move_cursor_to_end(void)
void accept_command_line(void)
void execute_command(const QString &command)
command_widget * m_command_widget
void cursor_position_changed(int line, int col)
console(command_widget *p, base_qobject &oct_qobj)
void new_command_line(const QString &command=QString())
void keyPressEvent(QKeyEvent *e)
void append_string(const QString &string)
Provides threadsafe access to octave.
event_manager & get_event_manager(void)
void parse_and_execute(const std::string &input, bool &incomplete_parse)
input_system & get_input_system(void)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
const gui_pref cs_colors[2 *cs_colors_count]
const gui_pref cs_color_mode("terminal/color_mode", QVariant(0))
const gui_pref cs_font_size("terminal/fontSize", QVariant(10))
const gui_pref cs_font("terminal/fontName", QVariant())
const gui_pref global_mono_font("monospace_font", global_font_family)