Ejemplo n.º 1
0
void 
MapDrawHelper::buffer_render_finish() 
{
  if (m_buffer_drawn) {
    // need to do this to prevent drawing of colored outline
    m_buffer.SelectWhitePen();
    
    if (m_use_stencil) {
#ifdef ENABLE_SDL
      m_buffer.copy_transparent_black(m_stencil);
#else
      m_buffer.copy_or(m_stencil);
#endif
    }

#ifdef HAVE_ALPHA_BLEND
    if (settings.transparency && AlphaBlendAvailable())
      m_canvas.alpha_blend(0, 0, m_canvas.get_width(), m_canvas.get_height(),
                           m_buffer,
                           0, 0, m_canvas.get_width(), m_canvas.get_height(),
                           60);
    else
#endif
      m_canvas.copy_and(m_buffer);

    m_buffer_drawn = false;
  }
}
Ejemplo n.º 2
0
void
AirspaceLook::Initialise(const AirspaceRendererSettings &settings)
{
  for (unsigned i = 0; i < AIRSPACECLASSCOUNT; i++)
    pens[i].set(Layout::Scale(2),
                colors[settings.colours[i]]);

  // airspace brushes and colors
#ifdef HAVE_HATCHED_BRUSH
  bitmaps[0].load(IDB_AIRSPACE0);
  bitmaps[1].load(IDB_AIRSPACE1);
  bitmaps[2].load(IDB_AIRSPACE2);
  bitmaps[3].load(IDB_AIRSPACE3);
  bitmaps[4].load(IDB_AIRSPACE4);
  bitmaps[5].load(IDB_AIRSPACE5);
  bitmaps[6].load(IDB_AIRSPACE6);
  bitmaps[7].load(IDB_AIRSPACE7);

  for (int i = 0; i < NUMAIRSPACEBRUSHES; i++)
    brushes[i].set(bitmaps[i]);
#endif

#ifdef HAVE_ALPHA_BLEND
  if (AlphaBlendAvailable())
#endif
#if defined(HAVE_ALPHA_BLEND) || !defined(HAVE_HATCHED_BRUSH)
    for (unsigned i = 0; i < NUMAIRSPACECOLORS; ++i)
      solid_brushes[i].set(colors[i]);
#endif

  intercept_icon.load_big(IDB_AIRSPACEI, IDB_AIRSPACEI_HD);
}
Ejemplo n.º 3
0
inline void
AirspaceRenderer::DrawFillCached(Canvas &canvas, Canvas &stencil_canvas,
                                 const WindowProjection &projection,
                                 const AirspaceRendererSettings &settings,
                                 const AirspaceWarningCopy &awc,
                                 const AirspacePredicate &visible)
{
  if (awc.GetSerial() != last_warning_serial ||
      !fill_cache.Check(projection)) {
    last_warning_serial = awc.GetSerial();

    Canvas &buffer_canvas = fill_cache.Begin(canvas, projection);
    if (DrawFill(buffer_canvas, stencil_canvas,
                                projection, settings, awc, visible))
      fill_cache.Commit(canvas, projection);
    else
      fill_cache.CommitEmpty();
  }

#ifdef HAVE_ALPHA_BLEND
#ifdef HAVE_HATCHED_BRUSH
  if (settings.transparency && AlphaBlendAvailable())
#endif
    fill_cache.AlphaBlendTo(canvas, projection, 60);
#ifdef HAVE_HATCHED_BRUSH
  else
#endif
#endif
#ifdef HAVE_HATCHED_BRUSH
    fill_cache.CopyAndTo(canvas, projection);
#endif
}
Ejemplo n.º 4
0
void
MapDrawHelper::BufferRenderFinish()
{
    if (buffer_drawn) {
        // need to do this to prevent drawing of colored outline
        buffer.SelectWhitePen();

        if (use_stencil) {
#ifdef ENABLE_SDL
            buffer.copy_transparent_black(stencil);
#else
            buffer.CopyOr(stencil);
#endif
        }

#ifdef HAVE_ALPHA_BLEND
        if (settings.transparency && AlphaBlendAvailable())
            canvas.AlphaBlend(0, 0, canvas.get_width(), canvas.get_height(),
                              buffer,
                              0, 0, canvas.get_width(), canvas.get_height(),
                              60);
        else
#endif
            canvas.CopyAnd(buffer);

        buffer_drawn = false;
    }
}
Ejemplo n.º 5
0
static void
OnAirspaceListEnter(unsigned index)
{
  assert(index < AIRSPACECLASSCOUNT);

  AirspaceComputerSettings &computer =
    CommonInterface::SetComputerSettings().airspace;
  AirspaceRendererSettings &renderer =
    CommonInterface::SetMapSettings().airspace;

  if (color_mode) {
    AirspaceLook &look =
      CommonInterface::main_window.SetLook().map.airspace;

    int color_index = dlgAirspaceColoursShowModal();
    if (color_index >= 0) {
      renderer.classes[index].color = AirspaceLook::preset_colors[color_index];
      ActionInterface::SendMapSettings();
      Profile::SetAirspaceColor(index, renderer.classes[index].color);
      changed = true;

      look.Initialise(renderer);
    }

#ifdef HAVE_HATCHED_BRUSH
#ifdef HAVE_ALPHA_BLEND
    if (!renderer.transparency || !AlphaBlendAvailable()) {
#endif
      int pattern_index = dlgAirspacePatternsShowModal(look);
      if (pattern_index >= 0) {
        renderer.classes[index].brush = pattern_index;
        ActionInterface::SendMapSettings();
        Profile::SetAirspaceBrush(index, renderer.classes[index].brush);
        changed = true;
      }
#ifdef HAVE_ALPHA_BLEND
    }
#endif
#endif
  } else {
    renderer.classes[index].display = !renderer.classes[index].display;
    if (!renderer.classes[index].display)
      computer.warnings.class_warnings[index] =
        !computer.warnings.class_warnings[index];

    Profile::SetAirspaceMode(index, renderer.classes[index].display,
                             computer.warnings.class_warnings[index]);
    changed = true;
  }

  airspace_list->Invalidate();

  ActionInterface::SendMapSettings();
}
Ejemplo n.º 6
0
static void
OnAirspaceListEnter(unsigned ItemIndex)
{
    assert(ItemIndex < AIRSPACECLASSCOUNT);

    AirspaceComputerSettings &computer =
        CommonInterface::SetComputerSettings().airspace;
    AirspaceRendererSettings &renderer =
        CommonInterface::SetMapSettings().airspace;

    if (colormode) {
        int c = dlgAirspaceColoursShowModal();
        if (c >= 0) {
            renderer.colours[ItemIndex] = c;
            ActionInterface::SendMapSettings();
            Profile::SetAirspaceColor(ItemIndex, renderer.colours[ItemIndex]);
            changed = true;

            AirspaceLook &look =
                CommonInterface::main_window.SetLook().map.airspace;
            look.Initialise(renderer);
        }

#ifdef HAVE_HATCHED_BRUSH
#ifdef HAVE_ALPHA_BLEND
        if (!renderer.transparency || !AlphaBlendAvailable()) {
#endif
            int p = dlgAirspacePatternsShowModal();
            if (p >= 0) {
                renderer.brushes[ItemIndex] = p;
                ActionInterface::SendMapSettings();
                Profile::SetAirspaceBrush(ItemIndex, renderer.brushes[ItemIndex]);
                changed = true;
            }
#ifdef HAVE_ALPHA_BLEND
        }
#endif
#endif
    } else {
        renderer.display[ItemIndex] = !renderer.display[ItemIndex];
        if (!renderer.display[ItemIndex])
            computer.warnings.class_warnings[ItemIndex] =
                !computer.warnings.class_warnings[ItemIndex];

        Profile::SetAirspaceMode(ItemIndex);
        changed = true;
    }

    wAirspaceList->invalidate();

    ActionInterface::SendMapSettings();
}
Ejemplo n.º 7
0
static void
OnAirspacePaintListItem(Canvas &canvas, const PixelRect rc, unsigned i)
{
  assert(i < AIRSPACECLASSCOUNT);

  const AirspaceComputerSettings &computer =
    CommonInterface::SettingsComputer().airspace;
  const AirspaceRendererSettings &renderer =
    CommonInterface::SettingsMap().airspace;

  int w1, w2, x0;
  int w0 = rc.right - rc.left - Layout::FastScale(4);

  w1 = canvas.text_width(_("Warn")) + Layout::FastScale(10);
  w2 = canvas.text_width(_("Display")) + Layout::FastScale(10);
  x0 = w0 - w1 - w2;

  if (colormode) {
    canvas.white_pen();
#ifdef ENABLE_SDL
    canvas.select(Graphics::solid_airspace_brushes[renderer.colours[i]]);
#else
#ifdef HAVE_ALPHA_BLEND
    if (renderer.transparency && AlphaBlendAvailable()) {
      canvas.select(Graphics::solid_airspace_brushes[renderer.colours[i]]);
    } else {
#endif
      canvas.set_text_color(Graphics::GetAirspaceColourByClass(i, renderer));
      canvas.set_background_color(Color(0xFF, 0xFF, 0xFF));
      canvas.select(Graphics::GetAirspaceBrushByClass(i, renderer));
#ifdef HAVE_ALPHA_BLEND
    }
#endif
#endif
    canvas.rectangle(rc.left + x0, rc.top + Layout::FastScale(2),
        rc.right - Layout::FastScale(2), rc.bottom - Layout::FastScale(2));
  } else {
    if (computer.warnings.class_warnings[i])
      canvas.text(rc.left + w0 - w1 - w2, rc.top + Layout::FastScale(2),
                  _("Warn"));

    if (renderer.display[i])
      canvas.text(rc.left + w0 - w2, rc.top + Layout::FastScale(2),
                  _("Display"));
  }

  canvas.text_clipped(rc.left + Layout::FastScale(2),
      rc.top + Layout::FastScale(2), x0 - Layout::FastScale(10),
                      airspace_class_as_text((AirspaceClass_t)i, false));
}
Ejemplo n.º 8
0
static void
OnAirspacePaintListItem(Canvas &canvas, const PixelRect rc, unsigned i)
{
  assert(i < AIRSPACECLASSCOUNT);

  const AirspaceComputerSettings &computer =
    CommonInterface::GetComputerSettings().airspace;
  const AirspaceRendererSettings &renderer =
    CommonInterface::GetMapSettings().airspace;
  const AirspaceLook &look = CommonInterface::main_window.GetLook().map.airspace;

  PixelScalar w0 = rc.right - rc.left - Layout::FastScale(4);

  PixelScalar w1 = canvas.CalcTextWidth(_("Warn")) + Layout::FastScale(10);
  PixelScalar w2 = canvas.CalcTextWidth(_("Display")) + Layout::FastScale(10);
  PixelScalar x0 = w0 - w1 - w2;

  if (color_mode) {
    canvas.SelectWhitePen();
#ifndef HAVE_HATCHED_BRUSH
    canvas.Select(look.solid_brushes[i]);
#else
#ifdef HAVE_ALPHA_BLEND
    if (renderer.transparency && AlphaBlendAvailable()) {
      canvas.Select(look.solid_brushes[i]);
    } else {
#endif
      canvas.SetTextColor(renderer.classes[i].color);
      canvas.SetBackgroundColor(Color(0xFF, 0xFF, 0xFF));
      canvas.Select(look.brushes[renderer.classes[i].brush]);
#ifdef HAVE_ALPHA_BLEND
    }
#endif
#endif
    canvas.Rectangle(rc.left + x0, rc.top + Layout::FastScale(2),
        rc.right - Layout::FastScale(2), rc.bottom - Layout::FastScale(2));
  } else {
    if (computer.warnings.class_warnings[i])
      canvas.text(rc.left + w0 - w1 - w2, rc.top + Layout::FastScale(2),
                  _("Warn"));

    if (renderer.classes[i].display)
      canvas.text(rc.left + w0 - w2, rc.top + Layout::FastScale(2),
                  _("Display"));
  }

  canvas.text_clipped(rc.left + Layout::FastScale(2),
                      rc.top + Layout::FastScale(2), x0 - Layout::FastScale(10),
                      AirspaceFormatter::GetClass((AirspaceClass)i));
}
Ejemplo n.º 9
0
static void
OnAirspaceListEnter(unsigned ItemIndex)
{
  assert(ItemIndex < AIRSPACECLASSCOUNT);

  AirspaceComputerSettings &computer =
    CommonInterface::SetSettingsComputer().airspace;
  AirspaceRendererSettings &renderer =
    CommonInterface::SetSettingsMap().airspace;

  if (colormode) {
    int c = dlgAirspaceColoursShowModal();
    if (c >= 0) {
      renderer.colours[ItemIndex] = c;
      ActionInterface::SendSettingsMap();
      Profile::SetAirspaceColor(ItemIndex, renderer.colours[ItemIndex]);
      changed = true;
      Graphics::InitAirspacePens(renderer);
    }

#ifndef ENABLE_SDL
#ifdef HAVE_ALPHA_BLEND
    if (!renderer.transparency || !AlphaBlendAvailable()) {
#endif
      int p = dlgAirspacePatternsShowModal();
      if (p >= 0) {
        renderer.brushes[ItemIndex] = p;
        ActionInterface::SendSettingsMap();
        Profile::SetAirspaceBrush(ItemIndex, renderer.brushes[ItemIndex]);
        changed = true;
      }
#ifdef HAVE_ALPHA_BLEND
    }
#endif
#endif
  } else {
    renderer.display[ItemIndex] = !renderer.display[ItemIndex];
    if (!renderer.display[ItemIndex])
      computer.warnings.class_warnings[ItemIndex] =
        !computer.warnings.class_warnings[ItemIndex];

    Profile::SetAirspaceMode(ItemIndex);
    changed = true;
  }

  wAirspaceList->invalidate();

  ActionInterface::SendSettingsMap();
}
Ejemplo n.º 10
0
void
AirspaceClassLook::Initialise(const AirspaceClassRendererSettings &settings)
{
  fill_color = Color(settings.fill_color);

#ifdef HAVE_ALPHA_BLEND
  if (AlphaBlendAvailable())
#endif
#if defined(HAVE_ALPHA_BLEND) || !defined(HAVE_HATCHED_BRUSH)
    solid_brush.Set(fill_color);
#endif

  if (settings.border_width != 0)
    border_pen.Set(Layout::ScalePenWidth(settings.border_width),
                   Color(settings.border_color));
}
Ejemplo n.º 11
0
bool
AirspaceConfigPanel::Save(bool &_changed)
{
  bool changed = false;

  AirspaceComputerSettings &computer =
    CommonInterface::SetComputerSettings().airspace;
  AirspaceRendererSettings &renderer =
    CommonInterface::SetMapSettings().airspace;

  changed |= SaveValueEnum(AirspaceDisplay, ProfileKeys::AltMode, renderer.altitude_mode);

  changed |= SaveValue(ClipAltitude, UnitGroup::ALTITUDE, ProfileKeys::ClipAlt, renderer.clip_altitude);

  changed |= SaveValue(AltWarningMargin, UnitGroup::ALTITUDE, ProfileKeys::AltMargin, computer.warnings.altitude_warning_margin);

  changed |= SaveValue(AirspaceWarnings, ProfileKeys::AirspaceWarning, computer.enable_warnings);

  if (SaveValue(WarningTime, ProfileKeys::WarningTime, computer.warnings.warning_time)) {
    changed = true;
    require_restart = true;
  }

  if (SaveValue(AcknowledgeTime, ProfileKeys::AcknowledgementTime,
                computer.warnings.acknowledgement_time)) {
    changed = true;
    require_restart = true;
  }

  changed |= SaveValue(UseBlackOutline, ProfileKeys::AirspaceBlackOutline, renderer.black_outline);

  changed |= SaveValueEnum(AirspaceFillMode, ProfileKeys::AirspaceFillMode, renderer.fill_mode);

#ifndef ENABLE_OPENGL
#ifdef HAVE_ALPHA_BLEND
  if (AlphaBlendAvailable())
    changed |= SaveValue(AirspaceTransparency, ProfileKeys::AirspaceTransparency,
                         renderer.transparency);
#endif
#endif /* !OpenGL */

  _changed |= changed;

  return true;
}
Ejemplo n.º 12
0
  void AlphaBlend(PixelScalar dest_x, PixelScalar dest_y,
                  UPixelScalar dest_width, UPixelScalar dest_height,
                  HDC src,
                  PixelScalar src_x, PixelScalar src_y,
                  UPixelScalar src_width, UPixelScalar src_height,
                  uint8_t alpha) {
    assert(AlphaBlendAvailable());

    BLENDFUNCTION fn;
    fn.BlendOp = AC_SRC_OVER;
    fn.BlendFlags = 0;
    fn.SourceConstantAlpha = alpha;
    fn.AlphaFormat = 0;

    ::AlphaBlendInvoke(dc, dest_x, dest_y, dest_width, dest_height,
                       src, src_x, src_y, src_width, src_height,
                       fn);
  }
void
AirspaceClassRendererSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  // Save a working copy
  settings = CommonInterface::GetMapSettings().airspace.classes[type];

  // Add controls
  AddButton(_("Change Border Color"), *this, BorderColor);
  AddButton(_("Change Fill Color"), *this, FillColor);

#ifdef HAVE_HATCHED_BRUSH
#ifdef HAVE_ALPHA_BLEND
  bool transparency = CommonInterface::GetMapSettings().airspace.transparency;
  if (!transparency || !AlphaBlendAvailable())
#endif
    AddButton(_("Change Fill Brush"), *this, FillBrush);
#ifdef HAVE_ALPHA_BLEND
  else
    AddDummy();
#endif
#else
  AddDummy();
#endif

  AddInteger(_("Border Width"),
             _("The width of the border drawn around each airspace. "
               "Set this value to zero to hide the border."),
             _T("%d"), _T("%d"), 0, 5, 1, settings.border_width);

  static constexpr StaticEnumChoice fill_mode_list[] = {
    { (unsigned)AirspaceClassRendererSettings::FillMode::ALL, N_("Filled"), },
    { (unsigned)AirspaceClassRendererSettings::FillMode::PADDING, N_("Only padding"), },
    { (unsigned)AirspaceClassRendererSettings::FillMode::NONE, N_("Not filled"), },
    { 0 }
  };

  AddEnum(_("Fill Mode"),
          _("Defines how the airspace is filled with the configured color."),
          fill_mode_list, (unsigned)settings.fill_mode);
}
Ejemplo n.º 14
0
void
Canvas::AlphaBlend(int dest_x, int dest_y,
                   unsigned dest_width, unsigned dest_height,
                   HDC src,
                   int src_x, int src_y,
                   unsigned src_width, unsigned src_height,
                   uint8_t alpha)
{
  assert(AlphaBlendAvailable());

  BLENDFUNCTION fn;
  fn.BlendOp = AC_SRC_OVER;
  fn.BlendFlags = 0;
  fn.SourceConstantAlpha = alpha;
  fn.AlphaFormat = 0;

  ::AlphaBlendInvoke(dc, dest_x, dest_y, dest_width, dest_height,
                     src, src_x, src_y, src_width, src_height,
                     fn);
}
Ejemplo n.º 15
0
  void SetBufferPens(const AbstractAirspace &airspace) {
    AirspaceClass airspace_class = airspace.GetType();

#ifndef HAVE_HATCHED_BRUSH
    buffer.Select(look.solid_brushes[airspace_class]);
#else /* HAVE_HATCHED_BRUSH */

#ifdef HAVE_ALPHA_BLEND
    if (settings.transparency && AlphaBlendAvailable()) {
      buffer.Select(look.solid_brushes[airspace_class]);
    } else {
#endif
      // this color is used as the black bit
      buffer.SetTextColor(LightColor(settings.classes[airspace_class].fill_color));

      // get brush, can be solid or a 1bpp bitmap
      buffer.Select(look.brushes[settings.classes[airspace_class].brush]);

      buffer.SetBackgroundOpaque();
      buffer.SetBackgroundColor(COLOR_WHITE);
#ifdef HAVE_ALPHA_BLEND
    }
#endif

    buffer.SelectNullPen();

    if (use_stencil) {
      if (warnings.HasWarning(airspace) || warnings.IsInside(airspace) ||
          settings.classes[airspace_class].fill_mode ==
          AirspaceClassRendererSettings::FillMode::ALL) {
        stencil.SelectBlackBrush();
        stencil.SelectNullPen();
      } else {
        stencil.Select(look.thick_pen);
        stencil.SelectHollowBrush();
      }
    }

#endif /* HAVE_HATCHED_BRUSH */
  }
Ejemplo n.º 16
0
void
AirspaceLook::Initialise(const AirspaceRendererSettings &settings,
                         const Font &_name_font)
{
  for (unsigned i = 0; i < AIRSPACECLASSCOUNT; ++i) {
    const AirspaceClassRendererSettings &class_settings = settings.classes[i];

    if (class_settings.border_width != 0)
      pens[i].Set(Layout::ScalePenWidth(class_settings.border_width),
                  class_settings.border_color);

#ifdef HAVE_ALPHA_BLEND
    if (AlphaBlendAvailable())
#endif
#if defined(HAVE_ALPHA_BLEND) || !defined(HAVE_HATCHED_BRUSH)
      solid_brushes[i].Set(class_settings.fill_color);
#endif
  }

  // airspace brushes and colors
#ifdef HAVE_HATCHED_BRUSH
  bitmaps[0].Load(IDB_AIRSPACE0);
  bitmaps[1].Load(IDB_AIRSPACE1);
  bitmaps[2].Load(IDB_AIRSPACE2);
  bitmaps[3].Load(IDB_AIRSPACE3);
  bitmaps[4].Load(IDB_AIRSPACE4);
  bitmaps[5].Load(IDB_AIRSPACE5);
  bitmaps[6].Load(IDB_AIRSPACE6);
  bitmaps[7].Load(IDB_AIRSPACE7);

  for (unsigned i = 0; i < ARRAY_SIZE(AirspaceLook::brushes); i++)
    brushes[i].Set(bitmaps[i]);
#endif

  thick_pen.Set(Layout::ScalePenWidth(10), COLOR_BLACK);

  intercept_icon.Load(IDB_AIRSPACEI, IDB_AIRSPACEI_HD);

  name_font = &_name_font;
}
Ejemplo n.º 17
0
  void set_buffer_pens(const AbstractAirspace &airspace) {
    const unsigned color_index = settings.colours[airspace.GetType()];

#ifndef HAVE_HATCHED_BRUSH
    m_buffer.Select(airspace_look.solid_brushes[color_index]);
#else /* HAVE_HATCHED_BRUSH */

#ifdef HAVE_ALPHA_BLEND
    if (settings.transparency && AlphaBlendAvailable()) {
      m_buffer.Select(airspace_look.solid_brushes[color_index]);
    } else {
#endif
      // this color is used as the black bit
      m_buffer.SetTextColor(LightColor(airspace_look.colors[color_index]));

      // get brush, can be solid or a 1bpp bitmap
      m_buffer.Select(airspace_look.brushes[settings.brushes[airspace.GetType()]]);

      m_buffer.SetBackgroundOpaque();
      m_buffer.SetBackgroundColor(COLOR_WHITE);
#ifdef HAVE_ALPHA_BLEND
    }
#endif

    m_buffer.SelectNullPen();

    if (m_warnings.is_warning(airspace) || m_warnings.is_inside(airspace)) {
      m_stencil.SelectBlackBrush();
      m_stencil.Select(airspace_look.medium_pen);
    } else {
      m_stencil.Select(airspace_look.thick_pen);
      m_stencil.SelectHollowBrush();
    }

#endif /* HAVE_HATCHED_BRUSH */
  }
Ejemplo n.º 18
0
void
AirspaceLook::Initialise(const AirspaceRendererSettings &settings)
{
  for (unsigned i = 0; i < AIRSPACECLASSCOUNT; i++)
    pens[i].Set(Layout::ScalePenWidth(2), settings.classes[i].color);

  // airspace brushes and colors
#ifdef HAVE_HATCHED_BRUSH
  bitmaps[0].Load(IDB_AIRSPACE0);
  bitmaps[1].Load(IDB_AIRSPACE1);
  bitmaps[2].Load(IDB_AIRSPACE2);
  bitmaps[3].Load(IDB_AIRSPACE3);
  bitmaps[4].Load(IDB_AIRSPACE4);
  bitmaps[5].Load(IDB_AIRSPACE5);
  bitmaps[6].Load(IDB_AIRSPACE6);
  bitmaps[7].Load(IDB_AIRSPACE7);

  for (unsigned i = 0; i < ARRAY_SIZE(AirspaceLook::brushes); i++)
    brushes[i].Set(bitmaps[i]);
#endif

#ifdef HAVE_ALPHA_BLEND
  if (AlphaBlendAvailable())
#endif
#if defined(HAVE_ALPHA_BLEND) || !defined(HAVE_HATCHED_BRUSH)
    for (unsigned i = 0; i < AIRSPACECLASSCOUNT; ++i)
      solid_brushes[i].Set(settings.classes[i].color);
#endif

  thick_pen.Set(Layout::ScalePenWidth(10), COLOR_BLACK);
#ifndef ENABLE_OPENGL
  medium_pen.Set(Pen::SOLID, Layout::ScalePenWidth(3), COLOR_BLACK);
#endif

  intercept_icon.Load(IDB_AIRSPACEI, IDB_AIRSPACEI_HD);
}
Ejemplo n.º 19
0
void
AirspaceConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  const AirspaceComputerSettings &computer =
    CommonInterface::GetComputerSettings().airspace;
  const AirspaceRendererSettings &renderer =
    CommonInterface::GetMapSettings().airspace;

  RowFormWidget::Prepare(parent, rc);

  AddEnum(_("Airspace display"),
          _("Controls filtering of airspace for display and warnings.  The airspace filter button also allows filtering of display and warnings independently for each airspace class."),
          as_display_list, (unsigned)renderer.altitude_mode, this);

  AddFloat(_("Clip altitude"),
           _("For clip airspace mode, this is the altitude below which airspace is displayed."),
           _T("%.0f %s"), _T("%.0f"), fixed(0), fixed(20000), fixed(100), false, UnitGroup::ALTITUDE, fixed(renderer.clip_altitude));

  AddFloat(_("Margin"),
           _("For auto and all below airspace mode, this is the altitude above/below which airspace is included."),
           _T("%.0f %s"), _T("%.0f"), fixed(0), fixed(10000), fixed(100), false, UnitGroup::ALTITUDE, fixed(computer.warnings.altitude_warning_margin));

  AddBoolean(_("Warnings"), _("Enable/disable all airspace warnings."),
             computer.enable_warnings, this);

  AddTime(_("Warning time"),
          _("This is the time before an airspace incursion is estimated at which the system will warn the pilot."),
          10, 1000, 5, computer.warnings.warning_time);
  SetExpertRow(WarningTime);

  AddTime(_("Acknowledge time"),
          _("This is the time period in which an acknowledged airspace warning will not be repeated."),
          10, 1000, 5, computer.warnings.acknowledgement_time);
  SetExpertRow(AcknowledgeTime);

  AddBoolean(_("Use black outline"),
             _("Draw a black outline around each airspace rather than the airspace color."),
             renderer.black_outline);
  SetExpertRow(UseBlackOutline);

  AddEnum(_("Airspace fill mode"),
          _("Specifies the mode for filling the airspace area."),
          as_fill_mode_list, (unsigned)renderer.fill_mode);
  SetExpertRow(AirspaceFillMode);

#if !defined(ENABLE_OPENGL) && defined(HAVE_ALPHA_BLEND)
  if (AlphaBlendAvailable()) {
    AddBoolean(_("Airspace transparency"), _("If enabled, then airspaces are filled transparently."),
               renderer.transparency);
    SetExpertRow(AirspaceTransparency);
  }
#endif

  buttonColors = ConfigPanel::GetExtraButton(1);
  assert(buttonColors != NULL);

  buttonMode = ConfigPanel::GetExtraButton(2);
  assert(buttonMode != NULL);

  ShowDisplayControls(renderer.altitude_mode); // TODO make this work the first time
  ShowWarningControls(computer.enable_warnings);
}