Пример #1
0
/*!
 \brief lance le processus de compilation adéquate en fonction de l'extension du fichier

*/
void WindowIDE::compile(void) {
#ifndef Q_OS_ANDROID
    mapSRC.clear();
    mapPP.clear();
    mapASM.clear();
    mapLM.clear();

    save();

    CEditorWidget *locEditorWidget = ((CEditorWidget*)ui->tabWidget->currentWidget());

    QString source = "#include <internal.h>\r\n"+locEditorWidget->m_editControl->editor()->text();
    QString sourcefname=locEditorWidget->m_editControl->editor()->fileName();
    QFileInfo fInfo(sourcefname);

    if (locEditorWidget->m_editControl->editor()->languageDefinition()->language()=="C++") {
        mapSRC[sourcefname] = source.toAscii();
        Clcpp *lcpp = new Clcpp(&mapSRC,&mapPP,ui->targetComboBox->currentText());
        lcpp->pStdLibs->LoadLibs();
        lcpp->run();
        //createEditorTab(fInfo.baseName()+".pp",mapPP[sourcefname]);
        //createOutputTab("PP Compiler :"+fInfo.fileName(),mapPP["output"]);
#if 1
        Clcc *lcc = new Clcc(&mapPP,&mapASM);
        lcc->run();
        createEditorTab(fInfo.baseName()+".log",mapASM["LOG"]);

        createEditorTab(fInfo.baseName()+".asm",mapASM[fInfo.baseName()+".asm"]);

        createOutputTab("C Compiler :"+fInfo.fileName(),mapASM["output"]);
#endif
    }

    if (locEditorWidget->m_editControl->editor()->languageDefinition()->language()=="ASM") {
        CEditorWidget *currentWidget = locEditorWidget;

        mapSRC[sourcefname] = source.toAscii();
        Cpasm * pasm = new Cpasm(&mapSRC,&mapLM);
        pasm->run("BAS",mapSRC[sourcefname]);
        pasm->savefile("BAS");
        pasm->savefile("BIN");
        pasm->savefile("HEX");

        createEditorTab(fInfo.baseName()+".bas",mapLM["BAS"]);

        createOutputTab("ASM Compiler :"+fInfo.fileName(),mapLM["output"]);

        currentWidget = ((CEditorWidget*)ui->tabWidget->currentWidget());
        QHexPanel *hexpanel = new QHexPanel();


        currentWidget->m_editControl
                ->addPanel(hexpanel, QCodeEdit::South, true);
        hexpanel->startadr = mapLM["_ORG"].trimmed().toLong();
        hexpanel->hexeditor->setData(mapLM["BIN"],hexpanel->startadr);
        hexpanel->hexeditor->setCursorPosition(0,BINEditor::BinEditor::MoveAnchor);
        connect(this,SIGNAL(newEmulatedPocket(CPObject*)),hexpanel,SLOT(newPocket(CPObject*)));
        connect(this,SIGNAL(removeEmulatedPocket(CPObject*)),hexpanel,SLOT(removePocket(CPObject*)));
        connect(hexpanel,SIGNAL(installTo(CpcXXXX*,qint32,QByteArray)),this,SLOT(installTo(CpcXXXX*,qint32,QByteArray)));




//        MSG_ERROR("*"+mapLM["_ORG"]+"*");
//        MSG_ERROR(QString("%1").arg(hexpanel->startadr));
    }
Пример #2
0
void SceneEditor::createInterface(ApplicationBuilderPtr TheApplicationBuilder)
{
	//Component Editors
	std::vector< ::osg::UInt32 > EditorTypeIdVector(getEditorTypeIds());
	FieldContainerPtr Editor(NullFC);
	beginEditCP(SceneEditorPtr(this), EditorsFieldMask);
	for(std::vector< ::osg::UInt32 >::const_iterator Itor(EditorTypeIdVector.begin()) ; Itor != EditorTypeIdVector.end(); ++Itor)
	{
		Editor = FieldContainerFactory::the()->findType(*Itor)->createFieldContainer();
		if(Editor != NullFC)
		{
			getEditors().push_back(SceneComponentEditor::Ptr::dcast(Editor));
			getEditors().back()->createInterface(TheApplicationBuilder);
		}
	}
	endEditCP(SceneEditorPtr(this), EditorsFieldMask);

	//Scene Label
    UIFontPtr SceneLabelFont = UIFont::create();
	beginEditCP(SceneLabelFont, UIFont::SizeFieldMask);
        SceneLabelFont->setSize(24);
    endEditCP(SceneLabelFont, UIFont::SizeFieldMask);

	//Scene Name Label
    _SceneLabel = osg::Label::create();
	beginEditCP(_SceneLabel, Label::TextFieldMask | Label::PreferredSizeFieldMask | Label::FontFieldMask);
		_SceneLabel->setText("Scene:");
        _SceneLabel->setFont(SceneLabelFont);
        _SceneLabel->setPreferredSize(Vec2f(75,30));
	endEditCP(_SceneLabel, Label::TextFieldMask | Label::PreferredSizeFieldMask | Label::FontFieldMask);

    _SceneNameLabel = osg::Label::create();
	beginEditCP(_SceneNameLabel, Label::PreferredSizeFieldMask | Label::FontFieldMask);
        _SceneNameLabel->setFont(SceneLabelFont);
        _SceneNameLabel->setPreferredSize(Vec2f(100,30));
	endEditCP(_SceneNameLabel, Label::PreferredSizeFieldMask | Label::FontFieldMask);


	//TabPanel
    _SceneEditorsTabPanel = osg::TabPanel::create();
    beginEditCP(_SceneEditorsTabPanel, TabPanel::TabAlignmentFieldMask | TabPanel::TabPlacementFieldMask | TabPanel::TabsFieldMask | TabPanel::TabContentsFieldMask);
        _SceneEditorsTabPanel->setTabAlignment(0.0f);
        _SceneEditorsTabPanel->setTabPlacement(TabPanel::PLACEMENT_WEST);
		for(::osg::UInt32 i(0) ; i<getEditors().size() ; ++i)
		{
			_SceneEditorsTabPanel->addTab(createEditorTab(getEditors()[i], TheApplicationBuilder->getIconManager()), getEditors()[i]);
		}
    endEditCP(_SceneEditorsTabPanel,TabPanel::TabAlignmentFieldMask | TabPanel::TabPlacementFieldMask | TabPanel::TabsFieldMask | TabPanel::TabContentsFieldMask);
        _SceneEditorsTabPanel->setSelectedIndex(0);


	//Layout
	SpringLayoutPtr SceneEditorInterfaceLayout = SpringLayout::create();

	//Scene Label
    SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _SceneLabel, 0, SpringLayoutConstraints::WEST_EDGE, SceneEditorPtr(this));
	SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _SceneLabel, 0, SpringLayoutConstraints::NORTH_EDGE, SceneEditorPtr(this));
	SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _SceneLabel, LayoutSpring::height(_SceneLabel));
	SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _SceneLabel, LayoutSpring::width(_SceneLabel));

	//Scene Name Label
    SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _SceneNameLabel, 1, SpringLayoutConstraints::EAST_EDGE, _SceneLabel);
    SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _SceneNameLabel, 0, SpringLayoutConstraints::EAST_EDGE, SceneEditorPtr(this));
	SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _SceneNameLabel, 0, SpringLayoutConstraints::NORTH_EDGE, SceneEditorPtr(this));
	SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _SceneNameLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _SceneLabel);

	//Scene Editors Tab Panel
    SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _SceneEditorsTabPanel, 0, SpringLayoutConstraints::WEST_EDGE, SceneEditorPtr(this));
    SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _SceneEditorsTabPanel, 0, SpringLayoutConstraints::EAST_EDGE, SceneEditorPtr(this));
	SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _SceneEditorsTabPanel, 1, SpringLayoutConstraints::SOUTH_EDGE, _SceneLabel);
	SceneEditorInterfaceLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _SceneEditorsTabPanel, 0, SpringLayoutConstraints::SOUTH_EDGE, SceneEditorPtr(this));

	beginEditCP(SceneEditorPtr(this), SceneEditor::ChildrenFieldMask | SceneEditor::LayoutFieldMask);
		getChildren().clear();
		getChildren().push_back(_SceneLabel);
		getChildren().push_back(_SceneNameLabel);
		getChildren().push_back(_SceneEditorsTabPanel);
		setLayout(SceneEditorInterfaceLayout);
	endEditCP(SceneEditorPtr(this), SceneEditor::ChildrenFieldMask | SceneEditor::LayoutFieldMask);
	
}