コード例 #1
0
///
/// フレームを描画する
void DebugMenuFrame::drawFrame(
    const float x,
    const float y,
    const Color& color
) const {

    //  描画
    printDisplay(x, y, color, TRI_DEBUG_FONT_SIZE, getLabel().c_str());

    int idx = 0;
    Color font_color;
    for (auto item: items_) {
        T3_NULL_ASSERT(item);

        if (focus_item_ == item) {
            font_color = color_sample::orange();
        }
        else if (idx == select_idx_) {
            font_color = color_sample::cyan();
        }
        else {
            font_color = color_sample::white();
        }
        
        //
        if (focus_item_ == item && item->hasChild()) {
            //  フレームなのでさらにフレームの内容を描画
            DebugMenuFrame* dmf = static_cast<DebugMenuFrame*>(item);
            dmf->drawFrame(
                x + getLabelWidth() * TRI_DEBUG_FONT_SIZE,
                y + (idx * TRI_DEBUG_FONT_SIZE) + TRI_DEBUG_FONT_SIZE / 2,
                font_color
            );
        }
        else {
            //  アイテムを描画
            item->draw(
                x + getLabelWidth() * TRI_DEBUG_FONT_SIZE,
                y + (TRI_DEBUG_FONT_SIZE*idx) + TRI_DEBUG_FONT_SIZE / 2,
                font_color
            );
        }        
        
        idx += 1;
    }
}
コード例 #2
0
MagpieFileImportPopup::MagpieFileImportPopup()
	: Dialog(TApp::instance()->getMainWindow(), true, true, "MagPieFileImport"), m_levelField(0), m_fromField(0), m_toField(0), m_flipbook(0), m_levelPath()
{
	setWindowTitle(tr("Import Magpie File"));

	beginVLayout();

	setLabelWidth(45);

	addSeparator(tr("Frame Range"));

	QWidget *fromToWidget = new QWidget(this);
	fromToWidget->setFixedHeight(DVGui::WidgetHeight);
	fromToWidget->setFixedSize(210, DVGui::WidgetHeight);
	QHBoxLayout *fromToLayout = new QHBoxLayout(fromToWidget);
	fromToLayout->setMargin(0);
	fromToLayout->setSpacing(0);
	m_fromField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1);
	fromToLayout->addWidget(m_fromField, 0, Qt::AlignLeft);
	m_toField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1);
	QLabel *toLabel = new QLabel(tr("To:"));
	toLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	toLabel->setFixedSize(20, m_toField->height());
	fromToLayout->addWidget(toLabel, 0, Qt::AlignRight);
	fromToLayout->addWidget(m_toField, 0, Qt::AlignLeft);
	fromToWidget->setLayout(fromToLayout);
	addWidget(tr("From:"), fromToWidget);

	addSeparator(tr("Animation Level"));

	m_levelField = new DVGui::FileField(this);
	m_levelField->setFileMode(QFileDialog::AnyFile);
	m_levelField->setFixedWidth(200);
	bool ret = connect(m_levelField, SIGNAL(pathChanged()), SLOT(onLevelPathChanged()));

	addWidget(tr("Level:"), m_levelField);

	QLabel *frameLabel = new QLabel(" Frame", this);
	frameLabel->setFixedHeight(DVGui::WidgetHeight);
	addWidget(tr("Phoneme"), frameLabel);
	int i;
	for (i = 0; i < 9; i++) {
		IntLineEdit *field = new IntLineEdit(this, 1, 1);
		QLabel *label = new QLabel("", this);
		label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
		label->setFixedSize(getLabelWidth(), field->height());
		m_actFields.append(QPair<QLabel *, IntLineEdit *>(label, field));
		addWidgets(label, field);
	}

	endVLayout();

	QFrame *frame = new QFrame(this);
	frame->setFrameStyle(QFrame::StyledPanel);
	frame->setObjectName("LipSynkViewer");
	frame->setStyleSheet("#LipSynkViewer { border: 1px solid rgb(150,150,150); }");
	QVBoxLayout *frameLayout = new QVBoxLayout(frame);
	frameLayout->setMargin(0);
	frameLayout->setSpacing(0);
	UINT buttonMask = FlipConsole::cFullConsole & (~(FlipConsole::eRate | FlipConsole::eSound | FlipConsole::eSaveImg | FlipConsole::eHisto | FlipConsole::eCompare | FlipConsole::eCustomize | FlipConsole::eSave | FlipConsole::eBegin | FlipConsole::eEnd | FlipConsole::eFirst | FlipConsole::eNext | FlipConsole::ePause | FlipConsole::ePlay | FlipConsole::ePrev | FlipConsole::eRate | FlipConsole::eWhiteBg | FlipConsole::eCheckBg | FlipConsole::eBlackBg | FlipConsole::eNext | FlipConsole::eLast | FlipConsole::eLoop | FlipConsole::eGRed | FlipConsole::eGGreen | FlipConsole::eGBlue | FlipConsole::eRed | FlipConsole::eGreen | FlipConsole::eBlue | FlipConsole::eMatte | FlipConsole::eDefineSubCamera | FlipConsole::eDefineLoadBox | FlipConsole::eUseLoadBox | FlipConsole::eFilledRaster));
	m_flipbook = new FlipBook(this, tr("Import Magpie File"), buttonMask);
	m_flipbook->setFixedHeight(250);
	frameLayout->addWidget(m_flipbook);
	frame->setLayout(frameLayout);
	addWidget(frame);

	QPushButton *okBtn = new QPushButton(tr("Import"), this);
	okBtn->setDefault(true);
	QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
	ret = ret && connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
	ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
	assert(ret);

	addButtonBarWidget(okBtn, cancelBtn);
}