Ejemplo n.º 1
0
void AppState::OpenScript(WORD w)
{
    TCHAR szGameIni[MAX_PATH];
    HRESULT hr = _GetGameIni(szGameIni, ARRAYSIZE(szGameIni));
    if (SUCCEEDED(hr))
    {
        std::string keyName = default_reskey(w, NoBase36);
        TCHAR szScriptName[100];
        if (GetPrivateProfileString(GetResourceInfo(ResourceType::Script).pszTitleDefault, keyName.c_str(), keyName.c_str(), szScriptName, ARRAYSIZE(szScriptName), szGameIni))
        {
            OpenScript(szScriptName, nullptr, w);
        }
    }
}
Ejemplo n.º 2
0
void
DoScript(StandardFileReply *reply)
{
	short			result;
	FILE *			stream;
	ScriptCmd *		scriptCmds;
	
	result     = noErr;
	stream     = nil;
	scriptCmds = nil;
	
	//if ( result == noErr )
		{
		stream = OpenScript( reply );
		if ( stream == nil )
			{
			result = -1;
			}
		}
	if ( result == noErr )
		{
		scriptCmds = ParseScript( stream );
		if ( scriptCmds == nil )
			{
			result = -1;
			}
		}
	if ( result == noErr )
		{
		ExecuteScript( scriptCmds );
		}
	
	if ( scriptCmds )
		{
		DisposeScript( scriptCmds );
		}
	if ( stream )
		{
		fclose( stream );
		}
}
Ejemplo n.º 3
0
nsresult
XULContentSinkImpl::OpenTag(const PRUnichar** aAttributes, 
                            const PRUint32 aAttrLen,
                            const PRUint32 aLineNumber,
                            nsINodeInfo *aNodeInfo)
{
    nsresult rv;

    // Create the element
    nsXULPrototypeElement* element;
    rv = CreateElement(aNodeInfo, &element);

    if (NS_FAILED(rv)) {
#ifdef PR_LOGGING
        if (PR_LOG_TEST(gLog, PR_LOG_ERROR)) {
            nsAutoString anodeC;
            aNodeInfo->GetName(anodeC);
            PR_LOG(gLog, PR_LOG_ERROR,
                   ("xul: unable to create element '%s' at line %d",
                    NS_ConvertUTF16toUTF8(anodeC).get(),
                    aLineNumber));
        }
#endif

        return rv;
    }

    // Link this element to its parent.
    nsPrototypeArray* children = nsnull;
    rv = mContextStack.GetTopChildren(&children);
    if (NS_FAILED(rv)) {
        delete element;
        return rv;
    }

    // Add the attributes
    rv = AddAttributes(aAttributes, aAttrLen, element);
    if (NS_FAILED(rv)) return rv;

    children->AppendElement(element);

    if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) || 
        aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XUL)) {
        // Do scripty things now
        rv = OpenScript(aAttributes, aLineNumber);
        NS_ENSURE_SUCCESS(rv, rv);

        NS_ASSERTION(mState == eInScript || mState == eInDocumentElement,
                     "Unexpected state");
        if (mState == eInScript) {
            // OpenScript has pushed the nsPrototypeScriptElement onto the 
            // stack, so we're done.
            return NS_OK;
        }
    }

    // Push the element onto the context stack, so that child
    // containers will hook up to us as their parent.
    rv = mContextStack.Push(element, mState);
    if (NS_FAILED(rv)) return rv;

    mState = eInDocumentElement;
    return NS_OK;
}
Ejemplo n.º 4
0
LuaScript::LuaScript(std::string script) : mL(nullptr), mFile(""), mOpen(false) {
    OpenScript(script);
}
Ejemplo n.º 5
0
Editor::Editor( QWidget* parent, QString daten, ScribusView* vie) : QDialog( parent )
{
	setModal(true);
	setWindowTitle( tr( "Editor" ) );
	setWindowIcon(loadIcon("AppIcon.png"));
	view = vie;
	dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
	EditorLayout = new QVBoxLayout(this);
	EditTex = new QTextEdit(this);
	newAct = new QAction(QIcon(loadIcon("16/document-new.png")), tr("&New"), this);
	newAct->setShortcut(tr("Ctrl+N"));
	connect(newAct, SIGNAL(triggered()), EditTex, SLOT(clear()));
	openAct = new QAction(QIcon(loadIcon("16/document-open.png")), tr("&Open..."), this);
	connect(openAct, SIGNAL(triggered()), this, SLOT(OpenScript()));
	saveAsAct = new QAction( tr("Save &As..."), this);
	connect(saveAsAct, SIGNAL(triggered()), this, SLOT(SaveAs()));
	saveExitAct = new QAction( tr("&Save and Exit"), this);
	connect(saveExitAct, SIGNAL(triggered()), this, SLOT(accept()));
	exitAct = new QAction( tr("&Exit without Saving"), this);
	connect(exitAct, SIGNAL(triggered()), this, SLOT(reject()));
	undoAct = new QAction(QIcon(loadIcon("16/edit-undo.png")), tr("&Undo"), this);
	undoAct->setShortcut(tr("Ctrl+Z"));
	connect(undoAct, SIGNAL(triggered()), EditTex, SLOT(undo()));
	redoAct = new QAction(QIcon(loadIcon("16/edit-redo.png")),  tr("&Redo"), this);
	connect(redoAct, SIGNAL(triggered()), EditTex, SLOT(redo()));
	cutAct = new QAction(QIcon(loadIcon("16/edit-cut.png")), tr("Cu&t"), this);
	cutAct->setShortcut(tr("Ctrl+X"));
	connect(cutAct, SIGNAL(triggered()), EditTex, SLOT(cut()));
	copyAct = new QAction(QIcon(loadIcon("16/edit-copy.png")), tr("&Copy"), this);
	copyAct->setShortcut(tr("Ctrl+C"));
	connect(copyAct, SIGNAL(triggered()), EditTex, SLOT(copy()));
	pasteAct = new QAction(QIcon(loadIcon("16/edit-paste.png")), tr("&Paste"), this);
	pasteAct->setShortcut(tr("Ctrl-V"));
	connect(pasteAct, SIGNAL(triggered()), EditTex, SLOT(paste()));
	clearAct = new QAction(QIcon(loadIcon("16/edit-delete.png")), tr("C&lear"), this);
	connect(clearAct, SIGNAL(triggered()), this, SLOT(del()));
	getFieldAct = new QAction( tr("&Get Field Names"), this);
	connect(getFieldAct, SIGNAL(triggered()), this, SLOT(GetFieldN()));
	fmenu = new QMenu( tr("&File"));
	fmenu->addAction(newAct);
	fmenu->addAction(openAct);
	fmenu->addAction(saveAsAct);
	fmenu->addSeparator();
	fmenu->addAction(saveExitAct);
	fmenu->addAction(exitAct);
	emenu = new QMenu( tr("&Edit"));
	emenu->addAction(undoAct);
	emenu->addAction(redoAct);
	emenu->addSeparator();
	emenu->addAction(cutAct);
	emenu->addAction(copyAct);
	emenu->addAction(pasteAct);
	emenu->addAction(clearAct);
	emenu->addSeparator();
	emenu->addAction(getFieldAct);
	menuBar = new QMenuBar(this);
	menuBar->addMenu(fmenu);
	menuBar->addMenu(emenu);
	EditorLayout->setMenuBar( menuBar );
	EditTex->setMinimumSize( QSize( 400, 400 ) );
	EditTex->setPlainText(daten);
	EditorLayout->addWidget( EditTex );
#ifdef Q_OS_MAC
	Layout1_2 = new QHBoxLayout;
	Layout1_2->setSpacing( 5 );
	Layout1_2->setMargin( 0 );
	QSpacerItem* spacerr = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
	Layout1_2->addItem( spacerr );
	PushButton1 = new QPushButton( this );
	PushButton1->setText( tr( "OK" ) );
	PushButton1->setDefault( true );
	Layout1_2->addWidget( PushButton1 );
	PushButton2 = new QPushButton( this );
	PushButton2->setText( tr( "Cancel" ) );
	Layout1_2->addWidget( PushButton2 );
	EditorLayout->addLayout( Layout1_2 );
	connect(PushButton1, SIGNAL(clicked()), this, SLOT(accept()));
	connect(PushButton2, SIGNAL(clicked()), this, SLOT(reject()));
#endif
}
Ejemplo n.º 6
0
void SC_OpenLump(char *name)
{
	OpenScript(name, LUMP_SCRIPT);
}
Ejemplo n.º 7
0
void SC_OpenFile(char *name)
{
	OpenScript(name, FILE_ZONE_SCRIPT);
}
Ejemplo n.º 8
0
void SC_OpenLump(const char *name)
{
  OpenScript(name);
}