Example #1
0
/**
 * Construct a widget
 * @param parent :: The parent widget
 */
ScriptFileInterpreter::ScriptFileInterpreter(QWidget *parent,
                                             const QString &settingsGroup)
    : QWidget(parent), m_splitter(new QSplitter(Qt::Vertical, this)),
      m_editor(new ScriptEditor(this, NULL, settingsGroup)),
      m_messages(new ScriptOutputDisplay), m_status(new QStatusBar),
      m_runner() {

  // Initialise line wrapping to include visual arrow indicator
  m_editor->setWrapVisualFlags(QsciScintilla::WrapFlagByText);

  setupChildWidgets();

  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this,
          SLOT(showContextMenu(const QPoint &)));

  connect(m_editor, SIGNAL(textZoomedIn()), m_messages, SLOT(zoomUp()));
  connect(m_editor, SIGNAL(textZoomedOut()), m_messages, SLOT(zoomDown()));
  connect(m_messages, SIGNAL(textZoomedIn()), m_editor, SLOT(zoomIn()));
  connect(m_messages, SIGNAL(textZoomedOut()), m_editor, SLOT(zoomOut()));
  connect(m_editor, SIGNAL(textZoomedIn()), this, SLOT(emitZoomIn()));
  connect(m_editor, SIGNAL(textZoomedOut()), this, SLOT(emitZoomOut()));
  connect(m_messages, SIGNAL(textZoomedIn()), this, SLOT(emitZoomIn()));
  connect(m_messages, SIGNAL(textZoomedOut()), this, SLOT(emitZoomOut()));
}
/**
 * Create a new tab such that it is the specified index within the tab range.
 * @param index :: The index to give the new tab. If this is invalid the tab is simply appended
 * @param filename :: An optional filename
 */
void MultiTabScriptInterpreter::newTab(int index, const QString & filename)
{
  ScriptFileInterpreter *scriptRunner = new ScriptFileInterpreter(this,"ScriptWindow");
  scriptRunner->setup(*scriptingEnv(), filename);
  scriptRunner->toggleProgressReporting(m_reportProgress);
  connect(scriptRunner, SIGNAL(editorModificationChanged(bool)),
          this, SLOT(currentEditorModified(bool)));
  index = insertTab(index, scriptRunner, "");
  setCurrentIndex(index);
  setTabTitle(scriptRunner, filename); // Make sure the tooltip is set
  scriptRunner->setFocus();
  scriptRunner->editor()->zoomIn(globalZoomLevel());
  connect(scriptRunner->editor(), SIGNAL(textZoomedIn()), this, SLOT(zoomInAllButCurrent()));
  connect(scriptRunner->editor(), SIGNAL(textZoomedIn()), this, SLOT(trackZoomIn()));
  connect(scriptRunner->editor(), SIGNAL(textZoomedOut()), this, SLOT(zoomOutAllButCurrent()));
  connect(scriptRunner->editor(), SIGNAL(textZoomedOut()), this, SLOT(trackZoomOut()));

  emit newTabCreated(index);
  emit tabCountChanged(count());
}
Example #3
0
/** Ctrl + Rotating the mouse wheel will increase/decrease the font size
 *
 */
void ScriptEditor::wheelEvent(QWheelEvent *e) {
    if (e->modifiers() == Qt::ControlModifier) {
        if (e->delta() > 0) {
            zoomIn();
            emit textZoomedIn(); // allows tracking
        } else {
            zoomOut();
            emit textZoomedOut(); // allows tracking
        }
    } else {
        QsciScintilla::wheelEvent(e);
    }
}
Example #4
0
void ScriptOutputDisplay::wheelEvent(QWheelEvent *e) {
  if (e->modifiers() & Qt::ControlModifier) {
    const int delta = e->delta();
    if (delta < 0) {
      zoom(-1);
      emit textZoomedOut(); // allows tracking
    } else if (delta > 0) {
      zoom(1);
      emit textZoomedIn(); // allows tracking
    }
    return;
  } else {
    QTextEdit::wheelEvent(e);
  }
}
Example #5
0
void ScriptFileInterpreter::emitZoomIn() { emit textZoomedIn(); }