Exemple #1
0
void
MyPrintout::ReadConfig()
{
    ConfigManager & config = wxGetApp().GetConfigManager();

    // Fonts config
    config.SetPath(_T("/Printing/Fonts"));
    if (config.ReadBool(_T("useCustomFonts")))
    {
        m_drawer.SetNumberFont(config.ReadFont(_T("gridNumberFont")));
        m_drawer.SetLetterFont(config.ReadFont(_T("gridLetterFont")));
        m_clueFont = config.ReadFont(_T("clueFont"));
    }
    else
    {
        m_drawer.SetNumberFont(m_frame->m_gridCtrl->GetNumberFont());
        m_drawer.SetLetterFont(m_frame->m_gridCtrl->GetLetterFont());
        m_clueFont = m_frame->m_across->GetFont();
    }
    m_drawer.SetNumberScale(config.ReadLong(_T("/Grid/numberScale")) / 100.);
    m_drawer.SetLetterScale(config.ReadLong(_T("/Grid/letterScale")) / 100.);

    SetupFonts();

    // Grid config
    config.SetPath(_T("/Printing"));
    m_gridAlign  = config.ReadLong(_T("gridAlignment"));

    const long brightness = config.ReadLong(_T("blackSquareBrightness"));
    m_drawer.SetBlackSquareColor(wxColour(brightness, brightness, brightness));
}
MenuSourceConfig::MenuSourceConfig( CEGUI::System *pSys,
			          const std::string &strConfigFileName )
: m_system(pSys)
{
	flowvr::xml::TiXmlDocument doc;
	if( doc.LoadFile( strConfigFileName ) )
	{
		flowvr::xml::TiXmlHandle root = doc.FirstChild( "config" );
		flowvr::xml::TiXmlHandle rsc  = root.FirstChild( "resources" );
		flowvr::xml::TiXmlHandle is   = root.FirstChild( "imagesets" );
		flowvr::xml::TiXmlHandle ft   = root.FirstChild( "fonts" );
		flowvr::xml::TiXmlHandle lf   = root.FirstChild( "looknfeels" );
		flowvr::xml::TiXmlHandle sm   = root.FirstChild( "schemes" );

		SetupResourceGroups( rsc );
		SetupImageSets( is );
		SetupFonts( ft );
		SetupLookNFeels( lf );
		SetupSchemes( sm );
	}
	else
	{
		std::cerr << "failed to open config file for CEGUI: ["
		          << strConfigFileName
		          << "]"
		          << std::endl;
	}
}
Exemple #3
0
void Ui_HWForm::setupUi(HWForm *HWForm)
{
    SetupFonts();

    HWForm->setObjectName(QString::fromUtf8("HWForm"));
    HWForm->resize(QSize(640, 480).expandedTo(HWForm->minimumSizeHint()));
    HWForm->setMinimumSize(QSize(720, 450));
    QString title = QMainWindow::tr("Hedgewars %1").arg(*cVersionString);
#ifdef QT_DEBUG
    title += QString("-r%1 (%2)").arg(*cRevisionString, *cHashString);
#endif
    HWForm->setWindowTitle(title);
    centralWidget = new QWidget(HWForm);
    centralWidget->setObjectName(QString::fromUtf8("centralWidget"));

    SetupPages(centralWidget);

    HWForm->setCentralWidget(centralWidget);

    Pages->setCurrentIndex(0);

    QMetaObject::connectSlotsByName(HWForm);
}
Exemple #4
0
void
MyPrintout::LayoutPages()
{
    // Disable windows while laying out the page
    wxWindowDisabler disableAll;
    wxBusyInfo wait(_T("Please wait. Laying out page..."));

    // Suppress drawing
    m_isDrawing = false;

    // Make the borders bigger if we're actually printing, because the DPI of the printer
    // is way higher.
    if (IsPreview())
        m_drawer.SetBorderSize(1);
    else
        m_drawer.SetBorderSize(3);

    // Try successive column scales (1/x) after the font gets too small.
    // Grid scale will be the entire page less the column scale.
    // e.g. column scale of 4 = 1/4; the grid will take up 3/4 of the page
    double colScales[] = { 4, 5, 6, 3 };
    int i = 0;
    const int startingFontSize = m_clueFont.GetPointSize();

    // Measure the grid and text.  If the text doesn't fit, catch the exception that should
    // be thrown, and try a smaller font size or a different grid size.
    for (;;)
    {
        try
        {
            // Measure the grid
            m_gridScale = 1 - (1. / colScales[i]);
            LayoutGrid(m_gridScale);
            DrawText();
            break;
        }
        catch (FontSizeError&)
        {
            wxTheApp->Yield();
            // If we're at the smallest good looking font size, try the next grid size.
            if (m_clueFont.GetPointSize() == MIN_GOOD_POINT_SIZE && i < 2)
            {
                wxLogDebug(_T("Hit min *good* font size"));
                wxLogDebug(_T("Trying again with a different grid size"));
                ++i; // Next grid size in the list
                m_clueFont.SetPointSize(startingFontSize);
                SetupFonts();
            }
            else if (m_clueFont.GetPointSize() <= MIN_POINT_SIZE)
            {
                wxLogDebug(_T("Ran out of size options!"));
                return;
            }
            else
            {
                wxLogDebug(_T("Trying again with font size: %d"), m_clueFont.GetPointSize());
                m_clueFont.SetPointSize(m_clueFont.GetPointSize() - 1);
                SetupFonts();
            }
        }
    }
    wxLogDebug(_T("Done with layout"));
}