コード例 #1
0
ファイル: WidgetSaver.cpp プロジェクト: wpbest/XPF
    void WidgetSaver::save(Container::Ptr widget, std::stringstream& stream)
    {
        auto node = std::make_shared<DataIO::Node>();
        for (auto& child : widget->getWidgets())
        {
            auto& saveFunction = WidgetSaver::getSaveFunction(toLower(child->getWidgetType()));
            if (saveFunction)
                node->children.emplace_back(saveFunction(WidgetConverter{child}));
            else
                throw Exception{"No save function exists for widget type '" + child->getWidgetType() + "'."};
        }

        DataIO::emit(node, stream);
    }
コード例 #2
0
ファイル: WidgetSaver.cpp プロジェクト: wpbest/XPF
    TGUI_API std::shared_ptr<DataIO::Node> saveContainer(Container::Ptr container)
    {
        auto node = saveWidget(container);
        for (auto& child : container->getWidgets())
        {
            auto& saveFunction = WidgetSaver::getSaveFunction(toLower(child->getWidgetType()));
            if (saveFunction)
                node->children.emplace_back(saveFunction(WidgetConverter{child}));
            else
                throw Exception{"No save function exists for widget type '" + child->getWidgetType() + "'."};
        }

        return node;
    }
コード例 #3
0
ファイル: loadsave.cpp プロジェクト: AReim1982/scummvm
//----------------------------------------------------------------------
// For saving and loading functions
//----------------------------------------------------------------------
void saveFunction(LoadedFunction *fun, Common::WriteStream *stream) {
	int a;
	stream->writeUint16BE(fun->originalNumber);
	if (fun->calledBy) {
		stream->writeByte(1);
		saveFunction(fun->calledBy, stream);
	} else {
		stream->writeByte(0);
	}
	stream->writeUint32LE(fun->timeLeft);
	stream->writeUint16BE(fun->runThisLine);
	stream->writeByte(fun->cancelMe);
	stream->writeByte(fun->returnSomething);
	stream->writeByte(fun->isSpeech);
	saveVariable(&(fun->reg), stream);

	if (fun->freezerLevel) {
		fatal(ERROR_GAME_SAVE_FROZEN);
	}
	saveStack(fun->stack, stream);
	for (a = 0; a < fun->numLocals; a++) {
		saveVariable(&(fun->localVars[a]), stream);
	}
}
コード例 #4
0
ファイル: interface.cpp プロジェクト: reolyze/wallgen
interface::interface(QWidget *parent) :
    QWidget(parent)
{

    // FUNCTIONAL VARIABLES
    termindex = 0;
    saveloadPath = QDir::currentPath();

    // FUNCTIONAL OBJECTS
    f = new hex3Function();
    c = new ColorWheel();


    // ORGANIZATIONAL ELEMENTS
    editconst = new QGroupBox(tr("Function Constants"), this);          //create elements
    interfaceLayout = new QVBoxLayout(this);
    topbarLayout = new QHBoxLayout();
    propsBox = new QGroupBox(tr("Image Properties"), this);
    displayWidget = new QWidget(this);
    genBoxWidget = new QWidget(this);

    topbarLayout->addWidget(genBoxWidget);
    topbarLayout->addWidget(displayWidget);
    topbarLayout->addWidget(propsBox);
    interfaceLayout->addLayout(topbarLayout);                       //lay out vertically
    interfaceLayout->addWidget(editconst);
    setLayout(interfaceLayout);

    // INPUT VALIDATORS (NUMERICAL)
    doubleValidate = new QDoubleValidator(-9999999.0, 9999999.0, 5, this);
    intValidate = new QIntValidator(-9999999, 9999999, this);
    posdoubleValidate = new QDoubleValidator(1.0, 9999999.0, 5, this);
    posintValidate = new QIntValidator(1, 9999999, this);
    numtermsValidate = new QIntValidator(1, 99, this);
    dimValidate = new QIntValidator(1, 2000, this);

    // EDITCONST SUBELEMENTS
    currtermL = new QLabel(editconst);                              //create labels
    currtermL->setText(tr("Term"));
    nL = new QLabel(editconst);
    mL = new QLabel(editconst);
    aL = new QLabel(editconst);
    rL = new QLabel(editconst);
    scaleaL = new QLabel(tr("sa"), editconst);
    scalerL = new QLabel(tr("sr"), editconst);
    refreshLabels();
    nE = new QLineEdit(editconst);                              //create input boxes
    mE = new QLineEdit(editconst);
    aE = new QLineEdit(editconst);
    rE = new QLineEdit(editconst);
    scaleaE = new QLineEdit(editconst);
    scalerE = new QLineEdit(editconst);
    currtermE = new QSpinBox(editconst);
    espacer1 = new QSpacerItem(10, 15);
    espacer2 = new QSpacerItem(10, 15);
    espacer3 = new QSpacerItem(10, 15);
    espacer4 = new QSpacerItem(10, 15);
    espacer5 = new QSpacerItem(130, 15);
    espacer6 = new QSpacerItem(2, 0);
    espacer7 = new QSpacerItem(15, 15);
    espacer8 = new QSpacerItem(8, 15);
    loadButton = new QPushButton(tr("Load..."), editconst);
    saveButton = new QPushButton(tr("Save"), editconst);
    currtermE->setMaximum(4);
    currtermE->setMinimum(1);
    nE->setFixedWidth(75);
    mE->setFixedWidth(75);
    rE->setFixedWidth(75);
    aE->setFixedWidth(75);
    scaleaE->setFixedWidth(75);
    scalerE->setFixedWidth(75);
    nL->setFixedWidth(18);
    mL->setFixedWidth(20);
    rL->setFixedWidth(18);
    aL->setFixedWidth(18);
    scaleaL->setFixedWidth(18);
    scalerL->setFixedWidth(18);
    nE->setValidator(intValidate);
    mE->setValidator(intValidate);
    rE->setValidator(doubleValidate);
    aE->setValidator(doubleValidate);
    scaleaE->setValidator(doubleValidate);
    scalerE->setValidator(doubleValidate);


    editconstLayoutStack = new QVBoxLayout(editconst);  //initialize layout
    editconstLayout = new QHBoxLayout();
    editconstLayoutLower = new QHBoxLayout();
    editconstLayoutLower->setAlignment(Qt::AlignRight);
    editconstLayout->setAlignment(Qt::AlignRight);

    editconstLayout->addWidget(currtermL);              //fill layouts
    editconstLayout->addWidget(currtermE);
    editconstLayout->addItem(espacer1);
    editconstLayout->addWidget(nL);
    editconstLayout->addWidget(nE);
    editconstLayout->addItem(espacer2);
    editconstLayout->addWidget(mL);
    editconstLayout->addWidget(mE);
    editconstLayout->addItem(espacer3);
    editconstLayout->addWidget(rL);
    editconstLayout->addWidget(rE);
    editconstLayout->addItem(espacer4);
    editconstLayout->addWidget(aL);
    editconstLayout->addWidget(aE);
    editconstLayoutLower->addItem(espacer8);
    editconstLayoutLower->addWidget(loadButton);
    editconstLayoutLower->addItem(espacer7);
    editconstLayoutLower->addWidget(saveButton);
    editconstLayoutLower->addItem(espacer5);
    editconstLayoutLower->addWidget(scalerL);
    editconstLayoutLower->addWidget(scalerE);
    editconstLayoutLower->addItem(espacer6);
    editconstLayoutLower->addWidget(scaleaL);
    editconstLayoutLower->addWidget(scaleaE);
    editconstLayoutStack->addLayout(editconstLayout);
    editconstLayoutStack->addLayout(editconstLayoutLower);
    editconst->setLayout(editconstLayoutStack);

    // GENBOX SUBELEMENTS
    genBox = new QGroupBox(tr("Image Generation"), genBoxWidget);
    functionSel = new QComboBox(genBox);        //initialize elements
    colorwheelSel = new QComboBox(genBox);
    functionL = new QLabel(genBox);
    colorwheelL = new QLabel(genBox);
    numtermsL = new QLabel(tr("<i>No. Terms</i>"), genBox);
    numtermsE = new QLineEdit("4", genBox);
    gspacer1 = new QSpacerItem(0,20);
    gspacer2 = new QSpacerItem(0,10);
    gspacer3 = new QSpacerItem(0,10);
    gspacer4 = new QSpacerItem(0,50);

    genBoxOverallLayout = new QVBoxLayout(genBoxWidget);
    functionLayout = new QVBoxLayout();
    colorwheelLayout = new QVBoxLayout();
    numtermsLayout = new QHBoxLayout();

    functionSel->addItem("Hex3");
    functionSel->addItem("Hex6");
    functionSel->addItem("Square");
    functionSel->addItem("Rhombic");
    functionSel->addItem("RhombicPaired");
    functionSel->addItem("Rectangular");
    functionSel->addItem("RectangularPaired");
    functionSel->addItem("General");
    functionSel->addItem("GeneralPaired");
    colorwheelSel->addItem("IcosColor");
    colorwheelSel->addItem("IcosColorC");
    colorwheelSel->addItem("StCol");
    colorwheelSel->addItem("StColC");
    colorwheelSel->addItem("StCol35");
    colorwheelSel->addItem("ZoneCol");
    colorwheelSel->addItem("SectCol");
    colorwheelSel->addItem("Sect6Col");
    colorwheelSel->addItem("WinCol");
    functionL->setText(tr("Function"));
    colorwheelL->setText(tr("Color Wheel"));
    numtermsE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    numtermsL->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    colorwheelSel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    colorwheelL->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    functionSel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    functionL->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);



    numtermsE->setFixedWidth(30);
    numtermsE->setValidator(numtermsValidate);

    genBoxLayout = new QVBoxLayout(genBox);     //set up layout
    functionLayout->addWidget(functionL);
    functionLayout->addWidget(functionSel);
    numtermsLayout->addWidget(numtermsL);
    numtermsLayout->addWidget(numtermsE);
    functionLayout->addLayout(numtermsLayout);
    genBoxLayout->addLayout(functionLayout);
    genBoxLayout->addItem(gspacer1);
    colorwheelLayout->addItem(gspacer3);
    colorwheelLayout->addWidget(colorwheelL);
    colorwheelLayout->addWidget(colorwheelSel);
    genBoxLayout->addLayout(colorwheelLayout);
    genBoxLayout->addItem(gspacer2);

    genBoxOverallLayout->addWidget(genBox);
    genBoxOverallLayout->addItem(gspacer4);

    // PROPSBOX SUBELEMENTS
    outheightL = new QLabel(tr("Output Height"), propsBox);          //initialize elements
    outwidthL = new QLabel(tr("Output Width"), propsBox);
    XCornerL = new QLabel(tr("XCorner"), propsBox);
    YCornerL = new QLabel(tr("YCorner"), propsBox);
    worldwidthL = new QLabel(tr("World Width"), propsBox);
    worldheightL = new QLabel(tr("World Height"), propsBox);
    outheightE = new QLineEdit(propsBox);
    outwidthE = new QLineEdit(propsBox);
    XCornerE = new QLineEdit(propsBox);
    YCornerE = new QLineEdit(propsBox);
    worldwidthE = new QLineEdit(propsBox);
    worldheightE = new QLineEdit(propsBox);
    saveImagePush = new QPushButton(tr("Save Image"), propsBox);
    pspacer1 = new QSpacerItem(0, 12);
    pspacer2 = new QSpacerItem(0, 14);
    pspacer3 = new QSpacerItem(15, 30);
    pspacer4 = new QSpacerItem(20, 60);
    pspacer5 = new QSpacerItem(20, 15);

//    outheightE->setFixedWidth(100);
//    outwidthE->setFixedWidth(100);
//    XCornerE->setFixedWidth(100);
//    YCornerE->setFixedWidth(100);
//    worldwidthE->setFixedWidth(100);
//    worldheightE->setFixedWidth(100);

//    outheightE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    outwidthE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    XCornerE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    YCornerE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    worldwidthE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    worldheightE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    saveImagePush->setFixedHeight(25);
    propsBoxOverallLayout = new QVBoxLayout(propsBox);
    propsBoxLayout = new QHBoxLayout();
    propseditStack = new QVBoxLayout();
    propslabelStack = new QVBoxLayout();
    savePushLayout = new QHBoxLayout();

    outheightE->setValidator(dimValidate);
    outwidthE->setValidator(dimValidate);
    XCornerE->setValidator(doubleValidate);
    YCornerE->setValidator(doubleValidate);
    worldwidthE->setValidator(doubleValidate);
    worldheightE->setValidator(doubleValidate);

    outheightE->setFixedWidth(100);
    outwidthE->setFixedWidth(100);
    XCornerE->setFixedWidth(100);
    YCornerE->setFixedWidth(100);
    worldwidthE->setFixedWidth(100);
    worldheightE->setFixedWidth(100);

    saveImagePush->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    saveImagePush->setFixedWidth(150);

    propslabelStack->addWidget(XCornerL);
    propslabelStack->addWidget(YCornerL);
    propslabelStack->addWidget(worldwidthL);
    propslabelStack->addWidget(worldheightL);
    propslabelStack->addItem(pspacer1);
    propslabelStack->addWidget(outwidthL);
    propslabelStack->addWidget(outheightL);

    propslabelStack->setAlignment(XCornerL, Qt::AlignLeft);
    propslabelStack->setAlignment(YCornerL, Qt::AlignLeft);
    propslabelStack->setAlignment(worldwidthL, Qt::AlignLeft);
    propslabelStack->setAlignment(worldheightL, Qt::AlignLeft);
    propslabelStack->setAlignment(outwidthL, Qt::AlignLeft);
    propslabelStack->setAlignment(outheightL, Qt::AlignLeft);

    propseditStack->addWidget(XCornerE);
    propseditStack->addWidget(YCornerE);
    propseditStack->addWidget(worldwidthE);
    propseditStack->addWidget(worldheightE);
    propseditStack->addItem(pspacer2);
    propseditStack->addWidget(outwidthE);
    propseditStack->addWidget(outheightE);

    //propsBoxLayout->addItem(pspacer3);
    propsBoxLayout->addLayout(propslabelStack);
    propsBoxLayout->addLayout(propseditStack);
    propsBoxLayout->addItem(pspacer4);

    //savePushLayout->addWidget(saveImagePush);
    //savePushLayout->addItem(pspacer5);

    propsBoxOverallLayout->addLayout(propsBoxLayout);
    //propsBoxOverallLayout->addItem(pspacer3);
    propsBoxOverallLayout->addWidget(saveImagePush);
    propsBoxOverallLayout->setAlignment(saveImagePush, Qt::AlignRight);

    // DISP SUBELEMENTS
    disp = new Display(200, displayWidget);
    updatePreview = new QPushButton(tr("Update Preview"), this);
    dispLayout = new QVBoxLayout(displayWidget);
    dispLayout->addWidget(disp);
    dispLayout->addWidget(updatePreview);

    // CONNECT SIGNALS & SLOTS
    connect(updatePreview, SIGNAL(clicked()), this, SLOT(updatePreviewDisplay()));
    connect(colorwheelSel, SIGNAL(currentIndexChanged(int)), c, SLOT(setCurrent(int)));
    connect(functionSel, SIGNAL(currentIndexChanged(int)), this, SLOT(changeFunction(int)));
    connect(numtermsE, SIGNAL(textChanged(QString)), this, SLOT(changeMaxTerms(QString)));
    connect(currtermE, SIGNAL(valueChanged(int)), this, SLOT(updateTerms(int)));

    connect(outwidthE, SIGNAL(textChanged(QString)), this, SLOT(changeOWidth(QString)));
    connect(outheightE, SIGNAL(textChanged(QString)), this, SLOT(changeOHeight(QString)));
    connect(worldwidthE, SIGNAL(textChanged(QString)), this, SLOT(changeWorldWidth(QString)));
    connect(worldheightE, SIGNAL(textChanged(QString)), this, SLOT(changeWorldHeight(QString)));
    connect(XCornerE, SIGNAL(textChanged(QString)), this, SLOT(changeXCorner(QString)));
    connect(YCornerE, SIGNAL(textChanged(QString)), this, SLOT(changeYCorner(QString)));

    connect(nE, SIGNAL(textChanged(QString)), this, SLOT(changeN(QString)));
    connect(mE, SIGNAL(textChanged(QString)), this, SLOT(changeM(QString)));
    connect(rE, SIGNAL(textChanged(QString)), this, SLOT(changeR(QString)));
    connect(aE, SIGNAL(textChanged(QString)), this, SLOT(changeA(QString)));
    connect(scalerE, SIGNAL(textChanged(QString)), this, SLOT(changeScaleR(QString)));
    connect(scaleaE, SIGNAL(textChanged(QString)), this, SLOT(changeScaleA(QString)));

    connect(saveImagePush, SIGNAL(clicked()), this, SLOT(saveImageStart()));
    connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFunction()));
    connect(saveButton, SIGNAL(clicked()), this, SLOT(saveFunction()));

    // SET DEFAULTS
    refreshTerms();
    scalerE->setText(QString::number(f->scaleR()));
    scaleaE->setText(QString::number(f->scaleA()));

    outwidthE->setText(QString::number(settings::OWidth));
    outheightE->setText(QString::number(settings::OHeight));
    worldwidthE->setText(QString::number(settings::Width));
    worldheightE->setText(QString::number(settings::Height));
    XCornerE->setText(QString::number(settings::XCorner));
    YCornerE->setText(QString::number(settings::YCorner));

    functionSel->setCurrentIndex(0);    //set up current function
    colorwheelSel->setCurrentIndex(7);


    // FINALIZE WINDOW
    setFixedSize(sizeHint());
    setWindowTitle(tr("Wallpaper Generation"));
}
コード例 #5
0
ファイル: loadsave.cpp プロジェクト: AReim1982/scummvm
bool saveGame(const Common::String &fname) {
	Common::OutSaveFile *fp = g_system->getSavefileManager()->openForSaving(fname);

	if (fp == NULL)
		return false;

	fp->writeString("SLUDSA");
	fp->writeByte(0);
	fp->writeByte(0);
	fp->writeByte(MAJOR_VERSION);
	fp->writeByte(MINOR_VERSION);

	if (!g_sludge->_gfxMan->saveThumbnail(fp))
		return false;

	fp->write(&fileTime, sizeof(FILETIME));

	// DON'T ADD ANYTHING NEW BEFORE THIS POINT!

	fp->writeByte(allowAnyFilename);
	fp->writeByte(captureAllKeys);
	fp->writeByte(true);
	g_sludge->_txtMan->saveFont(fp);

	// Save backdrop
	fp->writeUint16BE(g_sludge->_gfxMan->getCamX());
	fp->writeUint16BE(g_sludge->_gfxMan->getCamY());
	fp->writeFloatLE(g_sludge->_gfxMan->getCamZoom());

	fp->writeByte(brightnessLevel);
	g_sludge->_gfxMan->saveHSI(fp);

	// Save event handlers
	g_sludge->_evtMan->saveHandlers(fp);

	// Save regions
	saveRegions(fp);

	g_sludge->_cursorMan->saveCursor(fp);

	// Save functions
	LoadedFunction *thisFunction = allRunningFunctions;
	int countFunctions = 0;
	while (thisFunction) {
		countFunctions++;
		thisFunction = thisFunction->next;
	}
	fp->writeUint16BE(countFunctions);

	thisFunction = allRunningFunctions;
	while (thisFunction) {
		saveFunction(thisFunction, fp);
		thisFunction = thisFunction->next;
	}

	for (int a = 0; a < numGlobals; a++) {
		saveVariable(&globalVars[a], fp);
	}

	savePeople(fp);

	if (currentFloor->numPolygons) {
		fp->writeByte(1);
		fp->writeUint16BE(currentFloor->originalNum);
	} else {
		fp->writeByte(0);
	}

	g_sludge->_gfxMan->saveZBuffer(fp);
	g_sludge->_gfxMan->saveLightMap(fp);

	fp->writeByte(fadeMode);

	g_sludge->_speechMan->save(fp);
	saveStatusBars(fp);
	g_sludge->_soundMan->saveSounds(fp);

	fp->writeUint16BE(saveEncoding);

	blur_saveSettings(fp);

	g_sludge->_gfxMan->saveColors(fp);

	g_sludge->_gfxMan->saveParallax(fp);
	fp->writeByte(0);

	g_sludge->_languageMan->saveLanguageSetting(fp);

	g_sludge->_gfxMan->saveSnapshot(fp);

	fp->flush();
	fp->finalize();
	delete fp;

	clearStackLib();
	return true;
}
コード例 #6
0
ファイル: people.cpp プロジェクト: VillainyStudios/opensludge
bool savePeople (FILE * fp) {
	onScreenPerson * me = allPeople;
	int countPeople = 0, a;

	putSigned (scaleHorizon, fp);
	putSigned (scaleDivide, fp);

	while (me) {
		countPeople ++;
		me = me -> next;
	}

	put2bytes (countPeople, fp);

	me = allPeople;
	for (a = 0; a < countPeople; a ++) {

		putFloat (me -> x, fp);
		putFloat (me -> y, fp);

		saveCostume (me -> myPersona, fp);
		saveAnim (me -> myAnim, fp);
		fputc (me -> myAnim == me -> lastUsedAnim, fp);

		putFloat (me -> scale, fp);

		put2bytes (me -> extra, fp);
		put2bytes (me -> height, fp);
		put2bytes (me -> walkToX, fp);
		put2bytes (me -> walkToY, fp);
		put2bytes (me -> thisStepX, fp);
		put2bytes (me -> thisStepY, fp);
		put2bytes (me -> frameNum, fp);
		put2bytes (me -> frameTick, fp);
		put2bytes (me -> walkSpeed, fp);
		put2bytes (me -> spinSpeed, fp);
		putSigned (me -> floaty, fp);
		fputc (me -> show, fp);
		fputc (me -> walking, fp);
		fputc (me -> spinning, fp);
		if (me -> continueAfterWalking) {
			fputc (1, fp);
			saveFunction (me -> continueAfterWalking, fp);
		} else {
			fputc (0, fp);
		}
		put2bytes (me -> direction, fp);
		put2bytes (me -> angle, fp);
		put2bytes (me -> angleOffset, fp);
		put2bytes (me -> wantAngle, fp);
		putSigned (me -> directionWhenDoneWalking, fp);
		putSigned (me -> inPoly, fp);
		putSigned (me -> walkToPoly, fp);

		fputc (me -> r, fp);
		fputc (me -> g, fp);
		fputc (me -> b, fp);
		fputc (me -> colourmix, fp);
		fputc (me -> transparency, fp);
		
		saveObjectRef (me -> thisType, fp);

		me = me -> next;
	}
	return true;
}
コード例 #7
0
ファイル: pgxeditor.cpp プロジェクト: ssundar81/pgXplorer
void PgxEditor::createActions()
{
    newpgxeditor_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/editor.png")), tr("New"), this);
    newpgxeditor_action->setShortcuts(QKeySequence::New);
    newpgxeditor_action->setStatusTip(tr("New editor"));
    connect(newpgxeditor_action, SIGNAL(triggered()), this, SIGNAL(newPgxeditor()));

    cut_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/cut.png")), tr("Cut"), this);
    cut_action->setShortcuts(QKeySequence::Cut);
    cut_action->setStatusTip(tr("Cut selected text and copy to clipboard"));
    connect(cut_action, SIGNAL(triggered()), this, SLOT(cut()));

    copy_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/copy.png")), tr("Copy"), this);
    copy_action->setShortcuts(QKeySequence::Copy);
    copy_action->setStatusTip(tr("Copy selected text to clipboard"));
    connect(copy_action, SIGNAL(triggered()), this, SLOT(copy()));

    paste_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/paste.png")), tr("Paste"), this);
    paste_action->setShortcuts(QKeySequence::Paste);
    paste_action->setStatusTip(tr("Paste text from clipboard"));
    connect(paste_action, SIGNAL(triggered()), this, SLOT(paste()));

    if(!editor_name.isEmpty()) {
        save_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/save.png")), tr("&Save"), this);
        save_action->setShortcuts(QKeySequence::Save);
        save_action->setStatusTip(tr("Save function"));
        save_action->setEnabled(false);
        connect(save_action, SIGNAL(triggered()), this, SLOT(saveFunction()));

        execute_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/execute.png")), tr("&Execute"), this);
        execute_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
        execute_action->setStatusTip(tr("Execute function"));
        connect(execute_action, SIGNAL(triggered()), this, SLOT(executeFunction()));
    }

    selected_execute_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/selected_execute.png")), tr("&Run"), this);
    selected_execute_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
    selected_execute_action->setStatusTip(tr("Execute selected text"));
    if(!editor_name.isEmpty())
        selected_execute_action->setEnabled(false);
    connect(selected_execute_action, SIGNAL(triggered()), this, SLOT(executeText()));

    wrap_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/wrap.png")), tr("Wrap/Un-wrap lines"),this);
    wrap_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
    wrap_action->setStatusTip(tr("Toggle line wrapping"));
    wrap_action->setCheckable(true);
    wrap_action->setChecked(true);
    connect(wrap_action, SIGNAL(triggered()), this, SLOT(toggleWrap()));

    find_action = new QAction(QIcon(qApp->applicationDirPath().append("/icons/find.png")), tr("Find"), this);
    find_action->setShortcuts(QKeySequence::Find);
    find_action->setStatusTip(tr("Find/replace text"));
    connect(find_action, SIGNAL(triggered()), this, SLOT(toggleFindBar()));

    casesensitivity_action = new QAction(tr("Cs"), this);
    casesensitivity_action->setToolTip(tr("Case sensitive"));
    casesensitivity_action->setCheckable(true);
    casesensitivity_button = new QToolButton;
    casesensitivity_button->setDefaultAction(casesensitivity_action);
    casesensitivity_button->setVisible(false);

    wholeword_action = new QAction(tr("W"), this);
    wholeword_action->setToolTip(tr("Whole word"));
    wholeword_action->setCheckable(true);
    wholeword_button = new QToolButton;
    wholeword_button->setDefaultAction(wholeword_action);
    wholeword_button->setVisible(false);

    backwards_action = new QAction(tr("B"), this);
    backwards_action->setToolTip(tr("Backwards"));
    backwards_action->setCheckable(true);
    backwards_button = new QToolButton;
    backwards_button->setDefaultAction(backwards_action);
    backwards_button->setVisible(false);
}