예제 #1
0
void COption::DoModal(HWND hWnd)
{
	m_hDlg = CreateProp(hWnd);
}
예제 #2
0
EntityWindow::EntityWindow(EditorWidget *editor, EntityType type, EntityWindowType windowType)
{
    if(!editor->levelOpen)
    {
        close();
        QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
        return;
    }

    this->editor = editor;

    QGridLayout* gLayout = new QGridLayout(this);
    QLabel* nameLabel = new QLabel(QString("Name:"));
    QLabel* tileLabel = new QLabel(QString("Tile:"));
    QLabel* paramLabel = new QLabel(QString("Function:"));
    QLabel* tilesetLabel = new QLabel(QString("Tileset Name:"));
    QLabel* xLabel = new QLabel(QString("Texture Region X:"));
    QLabel* yLabel = new QLabel(QString("Texture Region Y:"));
    QLabel* twLabel = new QLabel(QString("Texture Region Width:"));
    QLabel* thLabel = new QLabel(QString("Texture Region Height:"));
    QLabel* wLabel = new QLabel(QString("Width:"));
    QLabel* hLabel = new QLabel(QString("Height:"));
    QLabel* oxLabel = new QLabel(QString("Origin X:"));
    QLabel* oyLabel = new QLabel(QString("Origin Y:"));
    nameBox = new QLineEdit();
    tilesetBox = new QComboBox();

    int textureNameCount = editor->data.configuration.textureNames.size();
    for(int i = 0; i < textureNameCount; i++)
    {
        tilesetBox->addItem(QString(editor->data.configuration.textureNames[i].c_str()));
    }
    valueBox = Tools::NewSpinBox(0);
    paramBox = Tools::NewSpinBox(0);
    tXBox = Tools::NewSpinBox(INT_MIN); tYBox = Tools::NewSpinBox(INT_MIN);
    tWBox = Tools::NewSpinBox(INT_MIN); tHBox = Tools::NewSpinBox(INT_MIN);
    wBox = Tools::NewSpinBox(INT_MIN); hBox = Tools::NewSpinBox(INT_MIN);
    oxBox = Tools::NewSpinBox(INT_MIN); oyBox = Tools::NewSpinBox(INT_MIN);
    QPushButton* okButton = new QPushButton(QString("OK"));
    QPushButton* cancelButton = new QPushButton(QString("Cancel"));

    gLayout->addWidget(nameLabel,0,0);
    gLayout->addWidget(nameBox,0,1);

    connect(cancelButton,SIGNAL(clicked()),this,SLOT(FullClose()));

    int row = editor->window->manager->entityList->selectionModel()->currentIndex().row();
    int bottomLayoutRow = 3;

    switch(type)
    {
    case Tiles:
        tilePreview = new TilePreviewWidget(editor);

        gLayout->addWidget(tileLabel,1,0);
        gLayout->addWidget(valueBox,1,1);
        gLayout->addWidget(paramLabel,2,0);
        gLayout->addWidget(paramBox,2,1);
        gLayout->addWidget(tilePreview,3,0);
        bottomLayoutRow = 4;

        connect(valueBox, SIGNAL(valueChanged(int)), tilePreview, SLOT(SetTileIndex(int)));
        break;

    case Props:
        gLayout->addWidget(tilesetLabel,0,2);
        gLayout->addWidget(tilesetBox,0,3);
        gLayout->addWidget(xLabel,1,0);
        gLayout->addWidget(tXBox,1,1);
        gLayout->addWidget(yLabel,1,2);
        gLayout->addWidget(tYBox,1,3);
        gLayout->addWidget(twLabel,2,0);
        gLayout->addWidget(tWBox,2,1);
        gLayout->addWidget(thLabel,2,2);
        gLayout->addWidget(tHBox,2,3);
        gLayout->addWidget(wLabel,3,0);
        gLayout->addWidget(wBox,3,1);
        gLayout->addWidget(hLabel,3,2);
        gLayout->addWidget(hBox,3,3);
        gLayout->addWidget(oxLabel,4,0);
        gLayout->addWidget(oxBox,4,1);
        gLayout->addWidget(oyLabel,4,2);
        gLayout->addWidget(oyBox,4,3);
        bottomLayoutRow = 5;
        break;

    case Sprites:
        bottomLayoutRow = 1;
        break;
    }

    switch(windowType)
    {
    case New:
        switch(type)
        {
        case Tiles: connect(okButton,SIGNAL(clicked()),this,SLOT(CreateTile())); break;
        case Props: connect(okButton,SIGNAL(clicked()),this,SLOT(CreateProp())); break;
        case Sprites: connect(okButton,SIGNAL(clicked()),this,SLOT(CreateSprite())); break;
        case Textures: connect(okButton,SIGNAL(clicked()),this,SLOT(CreateTexture())); break;
        case Polygons: connect(okButton,SIGNAL(clicked()),this,SLOT(CreatePolygon())); break;
        }
        break;
    case Edit:
        switch(type)
        {
        case Tiles:
            SetEditTileValues(row);
            connect(okButton,SIGNAL(clicked()),this,SLOT(EditTile()));
            break;
        case Props:
            SetEditPropValues(row);
            connect(okButton,SIGNAL(clicked()),this,SLOT(EditProp()));
            break;
        case Sprites:
            nameBox->setText(QString(editor->data.configuration.spriteDefinitions[row].name.c_str()));
            connect(okButton,SIGNAL(clicked()),this,SLOT(EditSprite()));
            break;
        case Textures:
            nameBox->setText(QString(editor->data.configuration.textureNames[row].c_str()));
            connect(okButton,SIGNAL(clicked()),this,SLOT(EditTexture()));
            break;
        case Polygons:
            nameBox->setText(QString(editor->data.configuration.polygonDefinitions[row].name.c_str()));
            connect(okButton,SIGNAL(clicked()),this,SLOT(EditPolygon()));
            break;
        }
        break;
    }

    gLayout->addWidget(okButton,bottomLayoutRow,0);
    gLayout->addWidget(cancelButton,bottomLayoutRow,1);

}