예제 #1
0
void CodeEditor::onIDESettingsChanged()
{
    reloadFont();
    highlighterReapplyFontSettings();
    updateLineSize();
    drawnLinesCount = viewport()->height()/lineHeight;
}
예제 #2
0
TextPreview::TextPreview(QWidget *parent)
	: QWidget(parent), currentPage(0), currentWin(0), useTimer(false), acceptMove(false), fontColor(TdwFile::White)
{
	pagesPos.append(0);

	setFixedSize(320, 224);

	if(names.isEmpty()) {
		iconImage = QImage(":/images/icons.png");
		reloadFont();

		bool jp = tr("false", "Use Japanese Encoding") == "true";
		names << FF8Text::toFF8(Data::name(0), jp) << FF8Text::toFF8(Data::name(1), jp)
				<< FF8Text::toFF8(Data::name(2), jp) << FF8Text::toFF8(Data::name(3), jp)
				<< FF8Text::toFF8(Data::name(4), jp) << FF8Text::toFF8(Data::name(5), jp)
				<< FF8Text::toFF8(Data::name(6), jp) << FF8Text::toFF8(Data::name(7), jp)
				<< FF8Text::toFF8(Data::name(8), jp) << FF8Text::toFF8(Data::name(9), jp)
				<< FF8Text::toFF8(Data::name(10), jp) << FF8Text::toFF8(Data::name(15), jp)
				<< FF8Text::toFF8(Data::name(12), jp) << FF8Text::toFF8(Data::name(14), jp);

		namesWidth[0] = calcFF8TextWidth(names.at(0));
		namesWidth[1] = calcFF8TextWidth(names.at(1));
		namesWidth[2] = calcFF8TextWidth(names.at(2));
		namesWidth[3] = calcFF8TextWidth(names.at(3));
		namesWidth[4] = calcFF8TextWidth(names.at(4));
		namesWidth[5] = calcFF8TextWidth(names.at(5));
		namesWidth[6] = calcFF8TextWidth(names.at(6));
		namesWidth[7] = calcFF8TextWidth(names.at(7));
		namesWidth[8] = calcFF8TextWidth(names.at(8));
		namesWidth[9] = calcFF8TextWidth(names.at(9));
		namesWidth[10] = calcFF8TextWidth(names.at(10));
		namesWidth[11] = calcFF8TextWidth(names.at(11));
		namesWidth[12] = calcFF8TextWidth(names.at(12));
		namesWidth[13] = calcFF8TextWidth(names.at(13));

		locations << FF8Text::toFF8(tr("Galbadia"), jp) << FF8Text::toFF8(tr("Esthar"), jp)
				<< FF8Text::toFF8(tr("Balamb"), jp) << FF8Text::toFF8(tr("Dollet"), jp)
				<< FF8Text::toFF8(tr("Timber"), jp) << FF8Text::toFF8(tr("Trabia"), jp)
				<< FF8Text::toFF8(tr("Centra"), jp) << FF8Text::toFF8(tr("Horizon"), jp);

		locationsWidth[0] = calcFF8TextWidth(locations.at(0));
		locationsWidth[1] = calcFF8TextWidth(locations.at(1));
		locationsWidth[2] = calcFF8TextWidth(locations.at(2));
		locationsWidth[3] = calcFF8TextWidth(locations.at(3));
		locationsWidth[4] = calcFF8TextWidth(locations.at(4));
		locationsWidth[5] = calcFF8TextWidth(locations.at(5));
		locationsWidth[6] = calcFF8TextWidth(locations.at(6));
		locationsWidth[7] = calcFF8TextWidth(locations.at(7));
	}

	startTimer(500);
}
예제 #3
0
//codeEditor
CodeEditor::CodeEditor(QWidget* parent)
{
    setProperty("piGameScriptEditor","true");
    setMouseTracking(1);
    //setViewport(new QGLWidget);
    viewport()->setFocusPolicy(Qt::ClickFocus);
    setFocusPolicy(Qt::ClickFocus);
    //setAttribute(Qt::WA_TranslucentBackground);

    //init variables:
    firstDrawnLineNumber=0;
    leftareaWidth=0;
    drawnLinesCount=0;
    lineSpacing=0;
    leftMargin=4;
    cursorVisible=true;
    mousepressed=false;
    columnNumber = 0;
    lineNumber = 10;
    lineIterator = lines.begin();
    lineIterator += lineNumber;
    insertMode = true;
    selLineNumber=0;
    selColumnNumber=0;
    highlighter = NULL;
    reloadFont();
    setFrameStyle(0);
    connect( verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(verticalScrollBarMoved(int)) );
    connect( horizontalScrollBar(),SIGNAL(valueChanged(int)),this,SLOT(horizontalScrollBarMoved(int)));
    verticalScrollBar()->setMinimum(0);
    verticalScrollBar()->setSingleStep(1);
    horizontalScrollBar()->setSingleStep(50);
    horizontalScrollBar()->setMinimum(0);
    int msec = qApp->cursorFlashTime() / 2;
    cursorBlinkTimer.setInterval(msec);
    connect(&cursorBlinkTimer, SIGNAL(timeout()),this,SLOT(toggleCursorVisible()));
    cursorBlinkTimer.start();
    tabStopPixelSize = fontMetrics().width(' ')*4;
    horizontalScrollBar()->setCursor(Qt::ArrowCursor);
    verticalScrollBar()->setCursor(Qt::ArrowCursor);

    //some good default for codeTokenFormats - plain text
    codeTokenFormat ctf;
    ctf.bold=false;
    ctf.italic=false;
    ctf.underline=false;
    ctf.color=palette().windowText().color();
    codeTokenFormats.append(ctf);
    defaultTokenFormat = 0;
}
예제 #4
0
파일: glc.c 프로젝트: cout/mglc
/* Render a string s of n characters.  Note that if the string is a UTF8
 * string (which is not yet supported), n may be less than count.
 */
void glcRenderCountedString(GLint count, const GLCchar* s) {
	int i, j;
	GLCfont *f;
	XCharStruct *p;
	int min, max;
	float font_width;

	if(currentGlcContext == 0) {
		last_error = GLC_STATE_ERROR;
		return;
	}
	if(count < 0) {
		last_error = GLC_PARAMETER_ERROR;
		return;
	}
	i = g->current_font_list[0];
	f = &g->fonts[i][g->font_faces[i]];
	if(g->reload_font) reloadFont();

	/* Find out which characters in the font have per-char data */
	min = f->xfontinfo->min_byte1;
	max = f->xfontinfo->max_byte1;
	if(min == 0 && max == 0) {
		min = f->xfontinfo->min_char_or_byte2;
		max = f->xfontinfo->max_char_or_byte2;
	} else {
		min += f->xfontinfo->min_char_or_byte2<<8;
		max += f->xfontinfo->max_char_or_byte2<<8;
	}

	/* Render the string */
	for(j = 0; j < count; j++) {
		if(f->xfontinfo->per_char)
			p = &f->xfontinfo->per_char[s[j] - min];
		else
			p = &f->xfontinfo->max_bounds;
		font_width = (float)p->width / g->bitmap_scale[0];

		glCallList(g->list_base + s[j]);

		/* Advance the raster position in the y direction.  We should
		 * only do this if GLX doesn't know about rotated fonts.
		 */
		glBitmap(0, 0, 0, 0,
			0.0,
			g->bitmap_matrix[1]*font_width,
			NULL);
	}
}
예제 #5
0
void MirandaFont::registerFont(FontState *font)
{
	if (fid.cbSize != 0)
		return;

	MirandaSkinnedDialog * dlg = (MirandaSkinnedDialog *) field->getDialog();

	HDC hdc = GetDC(NULL);

	fid.cbSize = sizeof(fid);
	lstrcpyn(fid.group, CharToTchar(dlg->getDescription()), sizeof(fid.group));
	strncpy(fid.dbSettingsGroup, dlg->getModule(), sizeof(fid.dbSettingsGroup));

	char tmp[sizeof(fid.prefix)];
	mir_snprintf(tmp, sizeof(tmp), "%s%s%sFont", TcharToChar(dlg->getSkinName()), dlg->getName(), field->getName());
	strncpy(fid.prefix, tmp, sizeof(fid.prefix));

	fid.deffontsettings.colour = font->getColor();
	fid.deffontsettings.size = -MulDiv(font->getSize(), GetDeviceCaps(hdc, LOGPIXELSY), 72);
	fid.deffontsettings.style = (font->isBold() ? DBFONTF_BOLD : 0)
		| (font->isItalic() ? DBFONTF_ITALIC : 0)
		| (font->isUnderline() ? DBFONTF_UNDERLINE : 0)
		| (font->isStrikeOut() ? DBFONTF_STRIKEOUT : 0);
	fid.deffontsettings.charset = DEFAULT_CHARSET;
	lstrcpyn(fid.deffontsettings.szFace, font->getFace(), sizeof(fid.deffontsettings.szFace));
	fid.order = dlg->getIndexOf(field);
	fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;

	CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0);

	ReleaseDC(NULL, hdc);

	HookEventObj(ME_FONT_RELOAD, staticReloadFont, this);

	reloadFont();
}
예제 #6
0
ScriptEditor::ScriptEditor(const std::string& scriptName, Gui* gui)
    : QWidget(gui)
    , PanelWidget(scriptName, this, gui)
    , _imp( new ScriptEditorPrivate() )
{
    _imp->mainLayout = new QVBoxLayout(this);
    _imp->buttonsContainer = new QWidget(this);
    _imp->buttonsContainerLayout = new QHBoxLayout(_imp->buttonsContainer);
    _imp->buttonsContainerLayout->setContentsMargins(0, 0, 0, 0);
    _imp->buttonsContainerLayout->setSpacing(2);

    QPixmap undoPix, redoPix, clearHistoPix, sourceScriptPix, loadScriptPix, saveScriptPix, execScriptPix, outputVisiblePix, outputHiddenPix, clearOutpoutPix;
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_PREVIOUS_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &undoPix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_NEXT_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &redoPix);
    appPTR->getIcon(NATRON_PIXMAP_CLOSE_PANEL, NATRON_MEDIUM_BUTTON_ICON_SIZE, &clearHistoPix);
    appPTR->getIcon(NATRON_PIXMAP_CLEAR_ALL_ANIMATION, NATRON_MEDIUM_BUTTON_ICON_SIZE, &clearHistoPix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_CLEAR_OUTPUT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &clearOutpoutPix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_EXEC_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &execScriptPix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_OUTPUT_PANE_ACTIVATED, NATRON_MEDIUM_BUTTON_ICON_SIZE, &outputVisiblePix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_OUTPUT_PANE_DEACTIVATED, NATRON_MEDIUM_BUTTON_ICON_SIZE, &outputHiddenPix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_LOAD_EXEC_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &sourceScriptPix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_LOAD_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &loadScriptPix);
    appPTR->getIcon(NATRON_PIXMAP_SCRIPT_SAVE_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &saveScriptPix);

    _imp->undoB = new Button(QIcon(undoPix), QString(), _imp->buttonsContainer);
    QKeySequence undoSeq(Qt::CTRL + Qt::Key_BracketLeft);
    _imp->undoB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->undoB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    _imp->undoB->setFocusPolicy(Qt::NoFocus);
    setToolTipWithShortcut(kShortcutGroupScriptEditor, kShortcutActionScriptEditorPrevScript, "<p>" + tr("Previous Script").toStdString() + "</p>" + "<p><b>" + tr("Keyboard shortcut: %1").toStdString() + "</b></p>", _imp->undoB);
    _imp->undoB->setEnabled(false);
    QObject::connect( _imp->undoB, SIGNAL(clicked(bool)), this, SLOT(onUndoClicked()) );

    _imp->redoB = new Button(QIcon(redoPix), QString(), _imp->buttonsContainer);
    QKeySequence redoSeq(Qt::CTRL + Qt::Key_BracketRight);
    _imp->redoB->setFocusPolicy(Qt::NoFocus);
    _imp->redoB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->redoB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    setToolTipWithShortcut(kShortcutGroupScriptEditor, kShortcutActionScriptEditorNextScript, "<p>" + tr("Next Script").toStdString() + "</p>" + "<p><b>" + tr("Keyboard shortcut: %1").toStdString() + "</b></p>", _imp->redoB);
    _imp->redoB->setEnabled(false);
    QObject::connect( _imp->redoB, SIGNAL(clicked(bool)), this, SLOT(onRedoClicked()) );

    _imp->clearHistoB = new Button(QIcon(clearHistoPix), QString(), _imp->buttonsContainer);
    _imp->clearHistoB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->clearHistoB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    _imp->clearHistoB->setFocusPolicy(Qt::NoFocus);
    setToolTipWithShortcut(kShortcutGroupScriptEditor, kShortcutActionScriptEditorClearHistory, "<p>" + tr("Clear History").toStdString() + "</p>" +
                           "<p><b>" + tr("Keyboard shortcut: %1").toStdString() + "</b></p>", _imp->clearHistoB);

    QObject::connect( _imp->clearHistoB, SIGNAL(clicked(bool)), this, SLOT(onClearHistoryClicked()) );

    _imp->sourceScriptB = new Button(QIcon(sourceScriptPix), QString(), _imp->buttonsContainer);
    _imp->sourceScriptB->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Open and execute a script."), NATRON_NAMESPACE::WhiteSpaceNormal) );
    _imp->sourceScriptB->setFocusPolicy(Qt::NoFocus);
    _imp->sourceScriptB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->sourceScriptB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    QObject::connect( _imp->sourceScriptB, SIGNAL(clicked(bool)), this, SLOT(onSourceScriptClicked()) );

    _imp->loadScriptB = new Button(QIcon(loadScriptPix), QString(), _imp->buttonsContainer);
    _imp->loadScriptB->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Open a script without executing it."), NATRON_NAMESPACE::WhiteSpaceNormal) );
    _imp->loadScriptB->setFocusPolicy(Qt::NoFocus);
    _imp->loadScriptB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->loadScriptB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    QObject::connect( _imp->loadScriptB, SIGNAL(clicked(bool)), this, SLOT(onLoadScriptClicked()) );

    _imp->saveScriptB = new Button(QIcon(saveScriptPix), QString(), _imp->buttonsContainer);
    _imp->saveScriptB->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Save the current script."), NATRON_NAMESPACE::WhiteSpaceNormal) );
    _imp->saveScriptB->setFocusPolicy(Qt::NoFocus);
    _imp->saveScriptB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->saveScriptB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    QObject::connect( _imp->saveScriptB, SIGNAL(clicked(bool)), this, SLOT(onSaveScriptClicked()) );

    _imp->execScriptB = new Button(QIcon(execScriptPix), QString(), _imp->buttonsContainer);
    QKeySequence execSeq(Qt::CTRL + Qt::Key_Return);
    _imp->execScriptB->setFocusPolicy(Qt::NoFocus);
    _imp->execScriptB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->execScriptB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    setToolTipWithShortcut(kShortcutGroupScriptEditor, kShortcutActionScriptExecScript, "<p>" + tr("Execute the current script").toStdString() + "</p>" + "<p><b>" + tr("Keyboard shortcut: %1").toStdString() + "</b></p>", _imp->execScriptB);

    QObject::connect( _imp->execScriptB, SIGNAL(clicked(bool)), this, SLOT(onExecScriptClicked()) );
    QIcon icShowHide;
    icShowHide.addPixmap(outputVisiblePix, QIcon::Normal, QIcon::On);
    icShowHide.addPixmap(outputHiddenPix, QIcon::Normal, QIcon::Off);
    _imp->showHideOutputB = new Button(icShowHide, QString(), _imp->buttonsContainer);
    setToolTipWithShortcut(kShortcutGroupScriptEditor, kShortcutActionScriptShowOutput, "<p>" + tr("Show/Hide the output area").toStdString() + "</p>" +  "<p><b>" + tr("Keyboard shortcut: %1").toStdString() + "</b></p>", _imp->showHideOutputB);
    _imp->showHideOutputB->setFocusPolicy(Qt::NoFocus);
    _imp->showHideOutputB->setCheckable(true);
    _imp->showHideOutputB->setChecked(true);
    _imp->showHideOutputB->setDown(true);
    _imp->showHideOutputB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->showHideOutputB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    QObject::connect( _imp->showHideOutputB, SIGNAL(clicked(bool)), this, SLOT(onShowHideOutputClicked(bool)) );

    _imp->clearOutputB = new Button(QIcon(clearOutpoutPix), QString(), _imp->buttonsContainer);
    QKeySequence clearSeq(Qt::CTRL + Qt::Key_Backspace);
    _imp->clearOutputB->setFocusPolicy(Qt::NoFocus);
    _imp->clearOutputB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->clearOutputB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    setToolTipWithShortcut(kShortcutGroupScriptEditor, kShortcutActionScriptClearOutput, "<p>" + tr("Clear the output area").toStdString() + "</p>" + "<p><b>" + tr("Keyboard shortcut: %1").toStdString() + "</b></p>", _imp->clearOutputB);
    QObject::connect( _imp->clearOutputB, SIGNAL(clicked(bool)), this, SLOT(onClearOutputClicked()) );

    _imp->showAutoDeclVarsB = new Button(QIcon(), QString::fromUtf8("..."), _imp->buttonsContainer);
    _imp->showAutoDeclVarsB->setFocusPolicy(Qt::NoFocus);
    _imp->showAutoDeclVarsB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
    _imp->showAutoDeclVarsB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
    _imp->showAutoDeclVarsB->setCheckable(true);
    bool isAutoDeclEnabled = appPTR->getCurrentSettings()->isAutoDeclaredVariablePrintActivated();
    _imp->showAutoDeclVarsB->setChecked(isAutoDeclEnabled);
    _imp->showAutoDeclVarsB->setDown(isAutoDeclEnabled);
    _imp->showAutoDeclVarsB->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("When checked, auto-declared Python variable will be printed "
                                                                           "in gray in the output window."), NATRON_NAMESPACE::WhiteSpaceNormal) );
    QObject::connect( _imp->showAutoDeclVarsB, SIGNAL(clicked(bool)), this, SLOT(onShowAutoDeclVarsClicked(bool)) );

    _imp->buttonsContainerLayout->addWidget(_imp->undoB);
    _imp->buttonsContainerLayout->addWidget(_imp->redoB);
    _imp->buttonsContainerLayout->addWidget(_imp->clearHistoB);
    _imp->buttonsContainerLayout->addSpacing(10);

    _imp->buttonsContainerLayout->addWidget(_imp->sourceScriptB);
    _imp->buttonsContainerLayout->addWidget(_imp->loadScriptB);
    _imp->buttonsContainerLayout->addWidget(_imp->saveScriptB);
    _imp->buttonsContainerLayout->addWidget(_imp->execScriptB);
    _imp->buttonsContainerLayout->addSpacing(10);

    _imp->buttonsContainerLayout->addWidget(_imp->showHideOutputB);
    _imp->buttonsContainerLayout->addWidget(_imp->clearOutputB);
    _imp->buttonsContainerLayout->addSpacing(10);

    _imp->buttonsContainerLayout->addWidget(_imp->showAutoDeclVarsB);
    _imp->buttonsContainerLayout->addStretch();

    QSplitter* splitter = new QSplitter(Qt::Vertical, this);


    _imp->outputEdit = new OutputScriptTextEdit(this);
    QObject::connect( _imp->outputEdit, SIGNAL(userScrollChanged(bool)), this, SLOT(onUserScrollChanged(bool)) );
    _imp->outputEdit->setFocusPolicy(Qt::NoFocus);
    _imp->outputEdit->setReadOnly(true);

    _imp->inputEdit = new InputScriptTextEdit(gui, KnobGuiPtr(), DimSpec::all(), ViewSetSpec::all(), this);
    QObject::connect( _imp->inputEdit, SIGNAL(textChanged()), this, SLOT(onInputScriptTextChanged()) );
    QFontMetrics fm = _imp->inputEdit->fontMetrics();
    _imp->inputEdit->setTabStopWidth(fm.width( QLatin1Char(' ') ) * 4);
    _imp->outputEdit->setTabStopWidth(fm.width( QLatin1Char(' ') ) * 4);

    _imp->mainLayout->addWidget(_imp->buttonsContainer);
    splitter->addWidget(_imp->outputEdit);
    splitter->addWidget(_imp->inputEdit);
    _imp->mainLayout->addWidget(splitter);

    QObject::connect( &_imp->history, SIGNAL(canUndoChanged(bool)), this, SLOT(onHistoryCanUndoChanged(bool)) );
    QObject::connect( &_imp->history, SIGNAL(canRedoChanged(bool)), this, SLOT(onHistoryCanRedoChanged(bool)) );

    _imp->autoSaveTimer.setSingleShot(true);

    reloadFont();

    // Restore input script input from settings
    {
        QSettings settings( QString::fromUtf8(NATRON_ORGANIZATION_NAME), QString::fromUtf8(NATRON_APPLICATION_NAME) );
        QString key = QString::fromUtf8(kScriptEditorInputSerializationKey);
        if (settings.contains(key)) {
            QString script = settings.value(key).toString();
            setInputScript(script);
        }
    }
}