示例#1
0
void dlgConfigFontsShowModal()
{
  wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
                  Layout::landscape ?
                  _T("IDR_XML_CONFIG_FONTS_L") : _T("IDR_XML_CONFIG_FONTS"));

  if (wf == NULL)
    return;

  ((WndButton *)wf->FindByName(_T("cmdClose")))->SetOnClickNotify(OnCloseClicked);

  WndProperty *wp;

  wp = (WndProperty*)wf->FindByName(_T("prpUseCustomFonts"));
  if (wp) {
    DataFieldBoolean * dfb = (DataFieldBoolean*)wp->GetDataField();
    dfb->Set(Appearance.UseCustomFonts);
    ShowFontEditButtons(dfb->GetAsBoolean());
    wp->RefreshDisplay();
    RefreshFonts();
  }

  FontRegistryChanged = false;
  changed = false;

  wf->ShowModal();

  if (wp) {
    DataFieldBoolean * dfb = (DataFieldBoolean*) wp->GetDataField();
    if (dfb) {
      if (Appearance.UseCustomFonts != dfb->GetAsBoolean()) {
        Appearance.UseCustomFonts = !Appearance.UseCustomFonts;
        Profile::Set(szProfileUseCustomFonts, Appearance.UseCustomFonts);
        changed = true;
      }
    }
  }

  TempInfoWindowFont.reset();
  TempTitleWindowFont.reset();
  TempMapWindowFont.reset();
  TempTitleSmallWindowFont.reset();
  TempMapWindowBoldFont.reset();
  TempCDIWindowFont.reset();
  TempMapLabelFont.reset();
  TempMapLabelImportantFont.reset();

  if (changed) {
    Profile::Save();

    MessageBoxX(_("Changes to configuration saved.  Restart XCSoar to apply changes."),
                _T(""), MB_OK);
  }

  delete wf;
}
示例#2
0
static void
RefreshFonts()
{
  WndProperty * wp;

  wp = (WndProperty*)wf->FindByName(_T("prpUseCustomFonts"));
  if (wp) {
    bool bUseCustomFonts =
        ((DataFieldBoolean*)(wp->GetDataField()))->GetAsBoolean();
    ResetFonts(bUseCustomFonts);
    ShowFontEditButtons(bUseCustomFonts);
  }

  // now set SampleTexts on the Fonts frame
  WndFrame *sample;

  sample = (WndFrame *)wf->FindByName(_T("prpInfoWindowFont"));
  if (sample)
    sample->SetFont(TempInfoWindowFont);

  sample = (WndFrame *)wf->FindByName(_T("prpTitleWindowFont"));
  if (sample)
    sample->SetFont(TempTitleWindowFont);

  sample = (WndFrame *)wf->FindByName(_T("prpMapWindowFont"));
  if (sample)
    sample->SetFont(TempMapWindowFont);

  sample = (WndFrame *)wf->FindByName(_T("prpTitleSmallWindowFont"));
  if (sample)
    sample->SetFont(TempTitleSmallWindowFont);

  sample = (WndFrame *)wf->FindByName(_T("prpMapWindowBoldFont"));
  if (sample)
    sample->SetFont(TempMapWindowBoldFont);

  sample = (WndFrame *)wf->FindByName(_T("prpCDIWindowFont"));
  if (sample)
    sample->SetFont(TempCDIWindowFont);

  sample = (WndFrame *)wf->FindByName(_T("prpMapLabelFont"));
  if (sample)
    sample->SetFont(TempMapLabelFont);

  sample = (WndFrame *)wf->FindByName(_T("prpMapLabelImportantFont"));
  if (sample)
    sample->SetFont(TempMapLabelImportantFont);

  // now fix the rest of the dlgConfiguration fonts:
  wf->SetTitleFont(TempMapWindowBoldFont);
}
示例#3
0
void dlgConfigFontsShowModal()
{
  wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
                  Layout::landscape ?
                  _T("IDR_XML_CONFIG_FONTS_L") : _T("IDR_XML_CONFIG_FONTS"));

  if (wf == NULL)
    return;

  ((WndButton *)wf->FindByName(_T("cmdClose")))->SetOnClickNotify(OnCloseClicked);

  UISettings &ui_settings = CommonInterface::SetUISettings();

  LoadFormProperty(*wf, _T("prpUseCustomFonts"), ui_settings.custom_fonts);

  ShowFontEditButtons(ui_settings.custom_fonts);
  RefreshFonts();

  FontRegistryChanged = false;
  changed = false;

  wf->ShowModal();

  changed |= SaveFormProperty(*wf, _T("prpUseCustomFonts"),
                              szProfileUseCustomFonts,
                              ui_settings.custom_fonts);

  TempInfoWindowFont.reset();
  TempTitleWindowFont.reset();
  TempMapWindowFont.reset();
  TempTitleSmallWindowFont.reset();
  TempMapWindowBoldFont.reset();
  TempCDIWindowFont.reset();
  TempMapLabelFont.reset();
  TempMapLabelImportantFont.reset();

  if (changed) {
    Profile::Save();

    MessageBoxX(_("Changes to configuration saved.  Restart XCSoar to apply changes."),
                _T(""), MB_OK);
  }

  delete wf;
}