Beispiel #1
0
void
Canvas::DrawButton(PixelRect rc, bool down)
{
  const Pen old_pen = pen;

  Color gray = IsDithered()
    ? (down ? COLOR_BLACK : COLOR_WHITE)
    : COLOR_LIGHT_GRAY;
  DrawFilledRectangle(rc, gray);

  Pen bright(1, IsDithered() ? COLOR_BLACK : LightColor(gray));
  Pen dark(1, IsDithered() ? COLOR_BLACK : DarkColor(gray));

  Select(down ? dark : bright);
  DrawTwoLinesExact(rc.left, rc.bottom - 2, rc.left, rc.top,
                    rc.right - 2, rc.top);
  DrawTwoLinesExact(rc.left + 1, rc.bottom - 3, rc.left + 1, rc.top + 1,
                    rc.right - 3, rc.top + 1);

  Select(down ? bright : dark);
  DrawTwoLinesExact(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1,
                    rc.right - 1, rc.top + 1);
  DrawTwoLinesExact(rc.left + 2, rc.bottom - 2, rc.right - 2, rc.bottom - 2,
                    rc.right - 2, rc.top + 2);

  pen = old_pen;
}
Beispiel #2
0
void
ButtonWindow::OnPaint(Canvas &canvas)
{
  const bool focused = HasCursorKeys() ? HasFocus() : down;

  if (focused) {
    Pen pen(Layout::Scale(1), COLOR_BLACK);
    canvas.Select(pen);
    canvas.SelectHollowBrush();
    canvas.Rectangle(-1, -1, canvas.GetWidth(), canvas.GetHeight());
  }

  PixelRect rc(2, 2, canvas.GetWidth() - 4, canvas.GetHeight() - 4);

  if (down) {
    rc.left += Layout::FastScale(1);
    rc.top += Layout::FastScale(1);
  }

  canvas.DrawButton(GetClientRect(), down);

  canvas.SetTextColor(IsEnabled()
                      ? (IsDithered() && down ? COLOR_WHITE : COLOR_BLACK)
                      : COLOR_GRAY);
  canvas.SetBackgroundTransparent();

  unsigned style = GetTextStyle();
  if (IsDithered())
    style |= DT_UNDERLINE;

  canvas.DrawFormattedText(&rc, text.c_str(), style);
}
Beispiel #3
0
void
DialogLook::Initialise()
{
  const FontDescription text_font_d(std::min(Layout::FontScale(12),
                                             Layout::min_screen_pixels / 20));
  const FontDescription small_font_d =
    text_font_d.WithHeight(text_font_d.GetHeight() * 3u / 4u);

  text_font.Load(text_font_d);
  small_font.Load(small_font_d);

  bold_font.Load(text_font_d.WithBold());

  caption.text_color = COLOR_BLACK;
  caption.font = &text_font;

#ifdef EYE_CANDY
  caption.background_bitmap.Load(IDB_DIALOGTITLE);
#endif

  caption.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR_DARK;
  caption.inactive_background_color = COLOR_GRAY;

  if (IsDithered())
    SetBackgroundColor(COLOR_WHITE);
  else
    SetBackgroundColor(Color(0xe2, 0xdc, 0xbe));
  text_color = COLOR_BLACK;

  button.Initialise(bold_font);
  check_box.Initialise(text_font);

  focused.background_color = COLOR_XCSOAR_DARK;
  focused.text_color = COLOR_WHITE;
  focused.border_pen.Create(Layout::FastScale(1) + 2, COLOR_BLACK);

  list.background_color = COLOR_WHITE;
  list.text_color = COLOR_BLACK;
  list.selected.background_color = IsDithered()
    ? COLOR_VERY_LIGHT_GRAY : COLOR_XCSOAR_LIGHT;
  list.selected.text_color = COLOR_BLACK;
  list.focused.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR;
  list.focused.text_color = COLOR_WHITE;
  list.pressed.background_color = COLOR_YELLOW;
  list.pressed.text_color = COLOR_BLACK;
  list.font = &text_font;
  list.font_bold = &bold_font;
}
Beispiel #4
0
TextUtil *
TextUtil::create(const char *facename, int height, bool bold, bool italic)
{
  jobject localObject;
  jint paramStyle, paramTextSize;

  Java::String paramFamilyName(env, facename);
  paramStyle = 0;
  if (bold)
    paramStyle |= 1;
  if (italic)
    paramStyle |= 2;
  paramTextSize = height;

  int paint_flags = 0;
  if (!IsDithered())
    /* 1 = Paint.ANTI_ALIAS_FLAG */
    paint_flags |= 1;

  // construct org.xcsoar.TextUtil object
  localObject = env->NewObject(cls, midTextUtil,
                               paramFamilyName.Get(),
                               paramStyle, paramTextSize,
                               paint_flags);
  if (!localObject)
    return nullptr;

  TextUtil *tu = new TextUtil(localObject);

  env->DeleteLocalRef(localObject);

  return tu;
}
void
AircraftRenderer::Draw(Canvas &canvas, const MapSettings &settings_map,
                       const AircraftLook &look,
                       const Angle angle, const PixelPoint aircraft_pos)
{
  const bool inverse = IsDithered() || !settings_map.terrain.enable;

  switch (settings_map.aircraft_symbol) {
  case AircraftSymbol::DETAILED:
    DrawDetailedAircraft(canvas, inverse,
                         look, angle, aircraft_pos);
    break;

  case AircraftSymbol::SIMPLE_LARGE:
    DrawSimpleAircraft(canvas, look, angle, aircraft_pos, true);
    break;

  case AircraftSymbol::SIMPLE:
    DrawSimpleAircraft(canvas, look, angle, aircraft_pos, false);
    break;

  case AircraftSymbol::HANGGLIDER:
    DrawHangGlider(canvas, look, angle, aircraft_pos,
                   inverse);
    break;

  case AircraftSymbol::PARAGLIDER:
    DrawParaGlider(canvas, look, angle, aircraft_pos,
                   inverse);
    break;
  }
}
Beispiel #6
0
void
DialogLook::Initialise(const Font &caption_font,
                       const Font &_text_font,
                       const Font &_small_font,
                       const Font &button_font,
                       const Font &list_font,
                       const Font &list_font_bold)
{
  caption.text_color = COLOR_BLACK;
  caption.font = &caption_font;

#ifdef EYE_CANDY
  caption.background_bitmap.Load(IDB_DIALOGTITLE);
#endif

  caption.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR_DARK;
  caption.inactive_background_color = COLOR_GRAY;

  if (IsDithered())
    SetBackgroundColor(COLOR_WHITE);
  else
    SetBackgroundColor(Color(0xe2, 0xdc, 0xbe));
  text_color = COLOR_BLACK;

  text_font = &_text_font;
  small_font = &_small_font;
  button.Initialise(button_font);

  focused.background_color = COLOR_XCSOAR_DARK;
  focused.text_color = COLOR_WHITE;
  focused.border_pen.Set(Layout::FastScale(1) + 2, COLOR_BLACK);

  list.background_color = COLOR_WHITE;
  list.text_color = COLOR_BLACK;
  list.selected.background_color = IsDithered()
    ? COLOR_VERY_LIGHT_GRAY : COLOR_XCSOAR_LIGHT;
  list.selected.text_color = COLOR_BLACK;
  list.focused.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR;
  list.focused.text_color = COLOR_WHITE;
  list.pressed.background_color = COLOR_YELLOW;
  list.pressed.text_color = COLOR_BLACK;
  list.font = &list_font;
  list.font_bold = &list_font_bold;
}
Beispiel #7
0
gcc_const
static inline bool
IsMono()
{
#ifdef KOBO
  return FreeType::mono;
#else
  return IsDithered();
#endif
}
Beispiel #8
0
void
WindArrowLook::Initialise(const Font &_font, bool inverse)
{
  arrow_pen.Create(Layout::Scale(1),
                   inverse
                   ? (HasColors() ? LightColor(COLOR_GRAY) : COLOR_WHITE)
                   : (HasColors() ? DarkColor(COLOR_GRAY) : COLOR_BLACK));
  tail_pen.Create(Pen::DASH2, 1, inverse ? COLOR_WHITE : COLOR_BLACK);
  arrow_brush.Create(IsDithered() ? COLOR_DARK_GRAY : COLOR_GRAY);

  font = &_font;
}
Beispiel #9
0
gcc_const
static inline bool
IsMono()
{
#ifdef KOBO
  /* on the Kobo, "mono" mode can be set at runtime; the shutdown
     screen renders in greyscale mode */
  return FreeType::mono;
#else
  return IsDithered();
#endif
}
Beispiel #10
0
void
TabDisplay::PaintButton(Canvas &canvas, unsigned CaptionStyle,
                        const TCHAR *caption, const PixelRect &rc,
                        const Bitmap *bmp, const bool isDown, bool inverse)
{
  PixelRect rcTextFinal = rc;
  const UPixelScalar buttonheight = rc.bottom - rc.top;
  const PixelSize text_size = canvas.CalcTextSize(caption);
  const int textwidth = text_size.cx;
  const int textheight = text_size.cy;
  UPixelScalar textheightoffset = 0;

  if (textwidth > (rc.right - rc.left)) // assume 2 lines
    textheightoffset = std::max(0, (int)(buttonheight - textheight * 2) / 2);
  else
    textheightoffset = std::max(0, (int)(buttonheight - textheight) / 2);

  rcTextFinal.top += textheightoffset;

  canvas.DrawFilledRectangle(rc, canvas.GetBackgroundColor());

  if (bmp != NULL) {
    const PixelSize bitmap_size = bmp->GetSize();
    const int offsetx = (rc.right - rc.left - bitmap_size.cx / 2) / 2;
    const int offsety = (rc.bottom - rc.top - bitmap_size.cy) / 2;

    if (inverse) // black background
      canvas.CopyNotOr(rc.left + offsetx,
                       rc.top + offsety,
                       bitmap_size.cx / 2,
                       bitmap_size.cy,
                       *bmp,
                       bitmap_size.cx / 2, 0);

    else
      canvas.CopyAnd(rc.left + offsetx,
                      rc.top + offsety,
                      bitmap_size.cx / 2,
                      bitmap_size.cy,
                      *bmp,
                      bitmap_size.cx / 2, 0);

  } else {
#ifndef USE_GDI
    if (IsDithered())
      CaptionStyle |= DT_UNDERLINE;
#endif

    canvas.DrawFormattedText(&rcTextFinal, caption, CaptionStyle);
  }
}
Beispiel #11
0
void
ProgressBar::OnPaint(Canvas &canvas)
{
  unsigned position = 0;
  if (min_value < max_value) {
    unsigned value = this->value;
    if (value < min_value)
      value = min_value;
    else if (value > max_value)
      value = max_value;
#ifdef ROUND_PROGRESS_BAR
    position = (value - min_value) * (GetWidth() - GetHeight()) /
               (max_value - min_value);
#else
    position = (value - min_value) * GetWidth() / (max_value - min_value);
#endif
  }

#ifdef ROUND_PROGRESS_BAR
  unsigned margin = GetHeight() / 9;

  canvas.SelectNullPen();
  canvas.SelectWhiteBrush();
  canvas.DrawRoundRectangle(0, 0, GetWidth(), GetHeight(),
                            GetHeight(), GetHeight());

  Brush progress_brush(IsDithered() ? COLOR_BLACK : COLOR_XCSOAR_LIGHT);
  canvas.Select(progress_brush);
  canvas.DrawRoundRectangle(margin, margin, margin + position,
                            GetHeight() - margin, GetHeight(), GetHeight());
#else
  canvas.DrawFilledRectangle(0, 0, position, GetHeight(),
                             IsDithered() ? COLOR_BLACK : COLOR_GREEN);
  canvas.DrawFilledRectangle(position, 0, GetWidth(), GetHeight(), COLOR_WHITE);
#endif
}
Beispiel #12
0
void
ButtonLook::Initialise(const Font &_font)
{
  font = &_font;

  standard.foreground_color = COLOR_BLACK;
  standard.foreground_brush.Set(standard.foreground_color);
  standard.background_color = IsDithered() ? COLOR_WHITE : COLOR_LIGHT_GRAY;
  if (IsDithered()) {
    standard.light_border_pen.Set(1, COLOR_BLACK);
    standard.dark_border_pen.Set(1, COLOR_BLACK);
  } else if (!HasColors()) {
    standard.light_border_pen.Set(1, LightColor(COLOR_DARK_GRAY));
    standard.dark_border_pen.Set(1, COLOR_BLACK);
  } else {
    standard.light_border_pen.Set(1, LightColor(standard.background_color));
    standard.dark_border_pen.Set(1, DarkColor(standard.background_color));
  }

  focused.foreground_color = COLOR_WHITE;
  focused.foreground_brush.Set(focused.foreground_color);
  focused.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR_DARK;
  if (IsDithered()) {
    focused.light_border_pen.Set(1, COLOR_WHITE);
    focused.dark_border_pen.Set(1, COLOR_WHITE);
  } else if (!HasColors()) {
    focused.light_border_pen.Set(1, LightColor(COLOR_DARK_GRAY));
    focused.dark_border_pen.Set(1, COLOR_BLACK);
  } else {
    focused.light_border_pen.Set(1, LightColor(focused.background_color));
    focused.dark_border_pen.Set(1, DarkColor(focused.background_color));
  }

  disabled.color = COLOR_GRAY;
  disabled.brush.Set(disabled.color);
}
void
GaugeThermalAssistantWindow::OnPaint(Canvas &canvas)
{
  ThermalAssistantWindow::OnPaint(canvas);

  if (pressed) {
#ifdef ENABLE_OPENGL
    const ScopeAlphaBlend alpha_blend(!IsDithered());

    canvas.SelectNullPen();
    canvas.Select(Brush(COLOR_YELLOW.WithAlpha(80)));

    DrawCircle(canvas);
#else
    canvas.InvertRectangle(GetClientRect());
#endif
  }
}
Beispiel #14
0
void
MapLook::Initialise(const MapSettings &settings,
                    const Font &font, const Font &bold_font)
{
  waypoint.Initialise(settings.waypoint, font, bold_font);
  airspace.Initialise(settings.airspace, font);
  aircraft.Initialise();
  task.Initialise();
  marker.Initialise();
  trail.Initialise(settings.trail);
  wave.Initialise();
  wind.Initialise(bold_font);

#ifdef HAVE_NOAA
  noaa.Initialise();
#endif

#ifdef HAVE_HATCHED_BRUSH
  above_terrain_bitmap.Load(IDB_ABOVETERRAIN);
  above_terrain_brush.Set(above_terrain_bitmap);
#endif

  terrain_warning_icon.LoadResource(IDB_TERRAINWARNING, IDB_TERRAINWARNING_HD);

  compass_brush.Set(IsDithered() ? COLOR_WHITE : Color(207, 207, 207));
  compass_pen.Set(Layout::ScalePenWidth(1), HasColors()? COLOR_GRAY : COLOR_BLACK);
  compass_triangle_brush.Set(IsDithered() ? COLOR_BLACK : Color(50, 50, 50));
  compass_triangle_pen.Set(Layout::ScalePenWidth(1), HasColors()? COLOR_GRAY : COLOR_BLACK);

  traffic_safe_icon.LoadResource(IDB_TRAFFIC_SAFE, IDB_TRAFFIC_SAFE_HD, false);
  traffic_warning_icon.LoadResource(IDB_TRAFFIC_WARNING, IDB_TRAFFIC_WARNING_HD, false);
  traffic_alarm_icon.LoadResource(IDB_TRAFFIC_ALARM, IDB_TRAFFIC_ALARM_HD, false);

  static constexpr Color clrSepia(0x78,0x31,0x18);
  reach_pen.Set(Pen::DASH, Layout::ScalePenWidth(1), clrSepia);
  reach_pen_thick.Set(Pen::DASH, Layout::ScalePenWidth(2), clrSepia);

  track_line_pen.Set(3, COLOR_GRAY);

  contest_pens[0].Set(Layout::ScalePenWidth(1) + 2, COLOR_RED);
  contest_pens[1].Set(Layout::ScalePenWidth(1) + 1, COLOR_ORANGE);
  contest_pens[2].Set(Layout::ScalePenWidth(1), COLOR_BLUE);

  thermal_source_icon.LoadResource(IDB_THERMALSOURCE, IDB_THERMALSOURCE_HD);

  traffic_safe_icon.LoadResource(IDB_TRAFFIC_SAFE, IDB_TRAFFIC_SAFE_HD, false);
  traffic_warning_icon.LoadResource(IDB_TRAFFIC_WARNING, IDB_TRAFFIC_WARNING_HD, false);
  traffic_alarm_icon.LoadResource(IDB_TRAFFIC_ALARM, IDB_TRAFFIC_ALARM_HD, false);

  map_scale_left_icon.LoadResource(IDB_MAPSCALE_LEFT, IDB_MAPSCALE_LEFT_HD, false);
  map_scale_right_icon.LoadResource(IDB_MAPSCALE_RIGHT, IDB_MAPSCALE_RIGHT_HD, false);

  logger_on_icon.LoadResource(IDB_LOGGER, IDB_LOGGER_HD);
  logger_off_icon.LoadResource(IDB_LOGGEROFF, IDB_LOGGEROFF_HD);

  cruise_mode_icon.LoadResource(IDB_CRUISE, IDB_CRUISE_HD, false);
  climb_mode_icon.LoadResource(IDB_CLIMB, IDB_CLIMB_HD, false);
  final_glide_mode_icon.LoadResource(IDB_FINALGLIDE, IDB_FINALGLIDE_HD, false);
  abort_mode_icon.LoadResource(IDB_ABORT, IDB_ABORT_HD, false);

  waiting_for_fix_icon.LoadResource(IDB_GPSSTATUS1, IDB_GPSSTATUS1_HD, false);
  no_gps_icon.LoadResource(IDB_GPSSTATUS2, IDB_GPSSTATUS2_HD, false);

  overlay_font = &bold_font;
}
void
TabDisplay::PaintButton(Canvas &canvas, unsigned CaptionStyle,
                        const TCHAR *caption, const PixelRect &rc,
                        const Bitmap *bmp, const bool isDown, bool inverse)
{
  PixelRect rcTextFinal = rc;
  const UPixelScalar buttonheight = rc.bottom - rc.top;
  const PixelSize text_size = canvas.CalcTextSize(caption);
  const int textwidth = text_size.cx;
  const int textheight = text_size.cy;
  UPixelScalar textheightoffset = 0;

  if (textwidth > (rc.right - rc.left)) // assume 2 lines
    textheightoffset = std::max(0, (int)(buttonheight - textheight * 2) / 2);
  else
    textheightoffset = std::max(0, (int)(buttonheight - textheight) / 2);

  rcTextFinal.top += textheightoffset;

  canvas.DrawFilledRectangle(rc, canvas.GetBackgroundColor());

  if (bmp != nullptr) {
    const PixelSize bitmap_size = bmp->GetSize();
    const int offsetx = (rc.right - rc.left - bitmap_size.cx / 2) / 2;
    const int offsety = (rc.bottom - rc.top - bitmap_size.cy) / 2;

#ifdef ENABLE_OPENGL

    if (inverse) {
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);

      /* invert the texture color */
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR);

      /* copy the texture alpha */
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
    } else
      /* simple copy */
      OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

    const GLEnable scope(GL_TEXTURE_2D);
    const GLBlend blend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    GLTexture &texture = *bmp->GetNative();
    texture.Bind();
    texture.Draw(rc.left + offsetx, rc.top + offsety);

#else
    if (inverse) // black background
      canvas.CopyNotOr(rc.left + offsetx,
                       rc.top + offsety,
                       bitmap_size.cx / 2,
                       bitmap_size.cy,
                       *bmp,
                       bitmap_size.cx / 2, 0);

    else
      canvas.CopyAnd(rc.left + offsetx,
                      rc.top + offsety,
                      bitmap_size.cx / 2,
                      bitmap_size.cy,
                      *bmp,
                      bitmap_size.cx / 2, 0);
#endif

  } else {
#ifndef USE_GDI
    if (IsDithered())
      CaptionStyle |= DT_UNDERLINE;
#endif

    canvas.DrawFormattedText(&rcTextFinal, caption, CaptionStyle);
  }
}
Beispiel #16
0
void Statistics::RenderSpeed(LKSurface& Surface, const RECT& rc)
{

  if ((flightstats.Task_Speed.sum_n<2)
      || !ValidTaskPoint(ActiveTaskPoint)) {
    DrawNoData(Surface, rc);
    return;
  }

  ResetScale();

  ScaleXFromData(rc, &flightstats.Task_Speed);
  ScaleYFromData(rc, &flightstats.Task_Speed);
  ScaleYFromValue(rc, 0);
  ScaleXFromValue(rc, flightstats.Task_Speed.x_min+1.0); // in case no data
  ScaleXFromValue(rc, flightstats.Task_Speed.x_min); 

  for(int j=1;j<MAXTASKPOINTS;j++) {
    if (ValidTaskPoint(j) && (flightstats.LegStartTime[j]>=0)) {
      double xx = 
        (flightstats.LegStartTime[j]-CALCULATED_INFO.TaskStartTime)/3600.0;
      if (xx>=0) {
        DrawLine(Surface, rc,
                 xx, y_min,
                 xx, y_max,
                 STYLE_REDTHICK);
      }
    }
  }

  DrawXGrid(Surface, rc,
            0.5, flightstats.Task_Speed.x_min,
            STYLE_THINDASHPAPER, 0.5, true);

 /* DrawYGrid(hdc, rc, 10/TASKSPEEDMODIFY, 0, STYLE_THINDASHPAPER,
            10, true);*/
  if(Units::GetUserHorizontalSpeedUnit() == unStatuteMilesPerHour) {
    DrawYGrid(Surface, rc, 5.0/TASKSPEEDMODIFY, 0, STYLE_THINDASHPAPER, 5.0, true);
  } else {
    DrawYGrid(Surface, rc, 10/TASKSPEEDMODIFY, 0, STYLE_THINDASHPAPER, 10, true);
  }

  DrawLineGraph(Surface, rc, &flightstats.Task_Speed,STYLE_MEDIUMBLACK);

  DrawTrend(Surface, rc, &flightstats.Task_Speed, STYLE_BLUETHIN);


  if(INVERTCOLORS || IsDithered())
    Surface.SetTextColor(RGB_DARKGREEN);
  else
    Surface.SetTextColor(RGB_GREEN);

  Surface.SetBackgroundOpaque();

  TCHAR text[80];
  DrawXLabel(Surface, rc, TEXT(" t/h "));
  _stprintf(text,TEXT(" v/%s "),Units::GetHorizontalSpeedName());
  DrawYLabel(Surface, rc, text);


//  DrawXLabel(hdc, rc, TEXT("t"));
//  DrawYLabel(hdc, rc, TEXT("V"));

}
Beispiel #17
0
void
ScrollBar::Paint(Canvas &canvas) const
{
  // ###################
  // #### ScrollBar ####
  // ###################

  // draw rectangle around entire scrollbar area
  canvas.SelectBlackPen();
  canvas.SelectHollowBrush();
  canvas.Rectangle(rc.left, rc.top, rc.right, rc.bottom);

  // ###################
  // ####  Buttons  ####
  // ###################

  const int arrow_padding = std::max(GetWidth() / 4, 4);

  PixelRect up_arrow_rect = rc;
  ++up_arrow_rect.left;
  up_arrow_rect.bottom = up_arrow_rect.top + GetWidth();

  PixelRect down_arrow_rect = rc;
  ++down_arrow_rect.left;
  down_arrow_rect.top = down_arrow_rect.bottom - GetWidth();

  canvas.DrawExactLine(up_arrow_rect.left, up_arrow_rect.bottom,
                       up_arrow_rect.right, up_arrow_rect.bottom);
  canvas.DrawExactLine(down_arrow_rect.left, down_arrow_rect.top - 1,
                       down_arrow_rect.right, down_arrow_rect.top - 1);

  button_renderer.DrawButton(canvas, up_arrow_rect, false, false);
  button_renderer.DrawButton(canvas, down_arrow_rect, false, false);

  canvas.SelectNullPen();
  canvas.SelectBlackBrush();

  const RasterPoint up_arrow[3] = {
    { (up_arrow_rect.left + rc.right) / 2,
      up_arrow_rect.top + arrow_padding },
    { up_arrow_rect.left + arrow_padding,
      up_arrow_rect.bottom - arrow_padding },
    { rc.right - arrow_padding,
      up_arrow_rect.bottom - arrow_padding },
  };
  canvas.DrawTriangleFan(up_arrow, ARRAY_SIZE(up_arrow));

  const RasterPoint down_arrow[3] = {
    { (down_arrow_rect.left + rc.right) / 2,
      down_arrow_rect.bottom - arrow_padding },
    { down_arrow_rect.left + arrow_padding,
      down_arrow_rect.top + arrow_padding },
    { rc.right - arrow_padding,
      down_arrow_rect.top + arrow_padding },
  };
  canvas.DrawTriangleFan(down_arrow, ARRAY_SIZE(down_arrow));

  // ###################
  // ####  Slider   ####
  // ###################

  if (rc_slider.top + 4 < rc_slider.bottom) {
    canvas.SelectBlackPen();
    canvas.DrawExactLine(rc_slider.left, rc_slider.top,
                         rc_slider.right, rc_slider.top);
    canvas.DrawExactLine(rc_slider.left, rc_slider.bottom,
                         rc_slider.right, rc_slider.bottom);

    PixelRect rc_slider2 = rc_slider;
    ++rc_slider2.left;
    ++rc_slider2.top;
    button_renderer.DrawButton(canvas, rc_slider2, dragging, dragging);
  }

  // fill the rest with darker gray
  const Color background_color = IsDithered() ? COLOR_BLACK : COLOR_GRAY;

  if (up_arrow_rect.bottom + 1 < rc_slider.top)
    canvas.DrawFilledRectangle(rc.left + 1, up_arrow_rect.bottom + 1,
                               rc.right, rc_slider.top,
                               background_color);

  if (rc_slider.bottom + 1 < down_arrow_rect.top - 1)
    canvas.DrawFilledRectangle(rc.left + 1, rc_slider.bottom + 1,
                               rc.right, down_arrow_rect.top - 1,
                               background_color);
}
Beispiel #18
0
void Statistics::DrawYGrid(LKSurface& Surface, const RECT& rc,
			   const double tic_step,
			   const double zero,
                           const int Style,
			   const double unit_step, bool draw_units) {

  POINT line[2];
  SIZE tsize;
  double yval;

  if(INVERTCOLORS || IsDithered())
    Surface.SelectObject(LK_BLACK_PEN);


  int xmin, ymin, xmax, ymax;

  if (!tic_step) return;

  for (yval=zero; yval<= y_max; yval+= tic_step) {

    xmin = rc.left;
    ymin = (int)((y_max-yval)*yscale)+rc.top -BORDER_Y;
    xmax = rc.right;
    ymax = ymin;
    line[0].x = xmin+BORDER_X;
    line[0].y = ymin;
    line[1].x = xmax;
    line[1].y = ymax;

    // STYLE_THINDASHPAPER
    if ((yval< y_max) &&
        (ymin>=rc.top) && (ymin<=rc.bottom-BORDER_Y)) {

      StyleLine(Surface, line[0], line[1], Style, rc);

      if (draw_units) {
	TCHAR unit_text[MAX_PATH];
	FormatTicText(unit_text, yval*unit_step/tic_step, unit_step);
	Surface.GetTextSize(unit_text, &tsize);
	Surface.SetBackgroundOpaque();
	Surface.DrawText(xmin, ymin-tsize.cy/2, unit_text);
    Surface.SetBackgroundTransparent();
      }
    }
  }

  for (yval=zero-tic_step; yval>= y_min; yval-= tic_step) {

    xmin = rc.left;
    ymin = (int)((y_max-yval)*yscale)+rc.top-BORDER_Y;
    xmax = rc.right;
    ymax = ymin;
    line[0].x = xmin+BORDER_X;
    line[0].y = ymin;
    line[1].x = xmax;
    line[1].y = ymax;

    // STYLE_THINDASHPAPER
    if ((yval> y_min) &&
        (ymin>=rc.top) && (ymin<=rc.bottom-BORDER_Y)) {

      StyleLine(Surface, line[0], line[1], Style, rc);

      if (draw_units) {
	TCHAR unit_text[MAX_PATH];
	FormatTicText(unit_text, yval*unit_step/tic_step, unit_step);
	Surface.GetTextSize(unit_text, &tsize);
    Surface.SetBackgroundOpaque();
	Surface.DrawText(xmin, ymin-tsize.cy/2, unit_text);
    Surface.SetBackgroundTransparent();
      }
    }
  }
}
Beispiel #19
0
void
MapLook::Initialise(const MapSettings &settings,
                    const Font &font, const Font &bold_font)
{
  const uint8_t alpha = ALPHA_OVERLAY;

  waypoint.Initialise(settings.waypoint, font, bold_font);
  aircraft.Initialise();
  task.Initialise();
  trail.Initialise(settings.trail);
  wave.Initialise();
  wind.Initialise(bold_font);

#ifdef HAVE_NOAA
  noaa.Initialise();
#endif

#ifdef HAVE_HATCHED_BRUSH
  above_terrain_bitmap.Load(IDB_ABOVETERRAIN);
  above_terrain_brush.Create(above_terrain_bitmap);
#endif

  terrain_warning_icon.LoadResource(IDB_TERRAINWARNING, IDB_TERRAINWARNING_HD);

  compass_brush.Create(IsDithered() ? COLOR_WHITE : ColorWithAlpha(Color(207, 207, 207), alpha));
  compass_pen.Create(Layout::ScalePenWidth(1),
                     HasColors()? COLOR_GRAY : COLOR_BLACK);
  compass_triangle_brush.Create(IsDithered()
                                ? COLOR_BLACK
                                : ColorWithAlpha(Color(50, 50, 50), alpha));
  compass_triangle_pen.Create(Layout::ScalePenWidth(1),
                              HasColors() ? COLOR_GRAY : COLOR_BLACK);

  traffic_safe_icon.LoadResource(IDB_TRAFFIC_SAFE, IDB_TRAFFIC_SAFE_HD, false);
  traffic_warning_icon.LoadResource(IDB_TRAFFIC_WARNING, IDB_TRAFFIC_WARNING_HD, false);
  traffic_alarm_icon.LoadResource(IDB_TRAFFIC_ALARM, IDB_TRAFFIC_ALARM_HD, false);

  static constexpr Color clrSepia(0x78,0x31,0x18);
  reach_terrain_pen.Create(Pen::DASH3, Layout::ScalePenWidth(1), clrSepia);
  reach_terrain_pen_thick.Create(Pen::DASH3, Layout::ScalePenWidth(2), clrSepia);

  static constexpr Color clrBlupia(0x38,0x55,0xa7);
  reach_working_pen.Create(Pen::DASH1, Layout::ScalePenWidth(1), clrBlupia);
  reach_working_pen_thick.Create(Pen::DASH1, Layout::ScalePenWidth(2), clrBlupia);

  track_line_pen.Create(3, COLOR_GRAY);

  contest_pens[0].Create(Layout::ScalePenWidth(1) + 2, COLOR_RED);
  contest_pens[1].Create(Layout::ScalePenWidth(1) + 1, COLOR_ORANGE);
  contest_pens[2].Create(Layout::ScalePenWidth(1), COLOR_BLUE);

  thermal_source_icon.LoadResource(IDB_THERMALSOURCE, IDB_THERMALSOURCE_HD);

  traffic_safe_icon.LoadResource(IDB_TRAFFIC_SAFE, IDB_TRAFFIC_SAFE_HD, false);
  traffic_warning_icon.LoadResource(IDB_TRAFFIC_WARNING, IDB_TRAFFIC_WARNING_HD, false);
  traffic_alarm_icon.LoadResource(IDB_TRAFFIC_ALARM, IDB_TRAFFIC_ALARM_HD, false);

  cruise_mode_icon.LoadResource(IDB_CRUISE, IDB_CRUISE_HD, false);
  climb_mode_icon.LoadResource(IDB_CLIMB, IDB_CLIMB_HD, false);
  final_glide_mode_icon.LoadResource(IDB_FINALGLIDE, IDB_FINALGLIDE_HD, false);
  abort_mode_icon.LoadResource(IDB_ABORT, IDB_ABORT_HD, false);

  waiting_for_fix_icon.LoadResource(IDB_GPSSTATUS1, IDB_GPSSTATUS1_HD, false);
  no_gps_icon.LoadResource(IDB_GPSSTATUS2, IDB_GPSSTATUS2_HD, false);

  topography.Initialise();
  airspace.Initialise(settings.airspace, topography.important_label_font);

  overlay.Initialise(font, bold_font);
}
Beispiel #20
0
void
WndForm::OnPaint(Canvas &canvas)
{
  const SingleWindow &main_window = GetMainWindow();
  gcc_unused const bool is_active = main_window.IsTopDialog(*this);

#ifdef ENABLE_OPENGL
  if (!IsDithered() && !IsMaximised() && is_active) {
    /* draw a shade around the current dialog to emphasise it */
    const ScopeAlphaBlend alpha_blend;

    const PixelRect rc = GetClientRect();
    const PixelScalar size = Layout::VptScale(4);

    const RasterPoint vertices[8] = {
      { rc.left, rc.top },
      { rc.right, rc.top },
      { rc.right, rc.bottom },
      { rc.left, rc.bottom },
      { rc.left - size, rc.top - size },
      { rc.right + size, rc.top - size },
      { rc.right + size, rc.bottom + size },
      { rc.left - size, rc.bottom + size },
    };

    const ScopeVertexPointer vp(vertices);

    static constexpr Color inner_color = COLOR_BLACK.WithAlpha(192);
    static constexpr Color outer_color = COLOR_BLACK.WithAlpha(16);
    static constexpr Color colors[8] = {
      inner_color,
      inner_color,
      inner_color,
      inner_color,
      outer_color,
      outer_color,
      outer_color,
      outer_color,
    };

    const ScopeColorPointer cp(colors);

    static constexpr GLubyte indices[] = {
      0, 4, 1, 4, 5, 1,
      1, 5, 2, 5, 6, 2,
      2, 6, 3, 6, 7, 3,
      3, 7, 0, 7, 4, 0,
    };

    glDrawElements(GL_TRIANGLES, ARRAY_SIZE(indices),
                   GL_UNSIGNED_BYTE, indices);
  }
#endif

  ContainerWindow::OnPaint(canvas);

  // Get window coordinates
  PixelRect rcClient = GetClientRect();

  // Draw the borders
  if (!IsMaximised()) {
#ifndef USE_GDI
    if (IsDithered())
      canvas.DrawOutlineRectangle(rcClient.left, rcClient.top,
                                  rcClient.right - 1, rcClient.bottom - 1,
                                  COLOR_BLACK);
    else
#endif
      canvas.DrawRaisedEdge(rcClient);
  }

  if (!caption.empty()) {
    // Set the colors
    canvas.SetTextColor(COLOR_WHITE);

    // Set the titlebar font and font-size
    canvas.Select(*look.caption.font);

    // JMW todo add here icons?

#ifdef EYE_CANDY
    if (!IsDithered() && is_active) {
      canvas.SetBackgroundTransparent();
      canvas.Stretch(title_rect.left, title_rect.top,
                     title_rect.right - title_rect.left,
                     title_rect.bottom - title_rect.top,
                     look.caption.background_bitmap);

      // Draw titlebar text
      canvas.DrawText(title_rect.left + Layout::GetTextPadding(),
                      title_rect.top, caption.c_str());
    } else {
#endif
      canvas.SetBackgroundColor(is_active
                                ? look.caption.background_color
                                : look.caption.inactive_background_color);
      canvas.DrawOpaqueText(title_rect.left + Layout::GetTextPadding(),
                            title_rect.top, title_rect, caption.c_str());
#ifdef EYE_CANDY
    }
#endif
  }

  if (dragging) {
#ifdef ENABLE_OPENGL
    const ScopeAlphaBlend alpha_blend;
    canvas.DrawFilledRectangle(0, 0, canvas.GetWidth(), canvas.GetHeight(),
                               COLOR_YELLOW.WithAlpha(80));
#elif defined(USE_GDI)
    canvas.InvertRectangle(title_rect);
#else
    canvas.InvertRectangle(GetClientRect());
#endif
  }
}
Beispiel #21
0
void Statistics::DrawXGrid(LKSurface& Surface, const RECT& rc,
			   const double tic_step,
			   const double zero,
                           const int Style,
			   const double unit_step, bool draw_units) {

  if(INVERTCOLORS || IsDithered())
    Surface.SelectObject(LK_BLACK_PEN);


  POINT line[2];

  double xval;
  SIZE tsize;

  int xmin, ymin, xmax, ymax;
  if (!tic_step) return;
  LKASSERT(tic_step!=0);

  //  bool do_units = ((x_max-zero)/tic_step)<10;

  for (xval=zero; xval<= x_max; xval+= tic_step) {

    xmin = (int)((xval-x_min)*xscale)+rc.left+BORDER_X;
    ymin = rc.top;
    xmax = xmin;
    ymax = rc.bottom;
    line[0].x = xmin;
    line[0].y = ymin;
    line[1].x = xmax;
    line[1].y = ymax-BORDER_Y;

    // STYLE_THINDASHPAPER
    if ((xval< x_max)
        && (xmin>=rc.left+BORDER_X) && (xmin<=rc.right)) {
      StyleLine(Surface, line[0], line[1], Style, rc);

      if (draw_units) {
	TCHAR unit_text[MAX_PATH];
	FormatTicText(unit_text, xval*unit_step/tic_step, unit_step);

//	SetBkMode(hdc, OPAQUE);
	Surface.GetTextSize(unit_text, &tsize);
	Surface.SetBackgroundOpaque();
	Surface.DrawText(xmin-tsize.cx/2, ymax-tsize.cy, unit_text);
	Surface.SetBackgroundTransparent();
      }
    }

  }

  for (xval=zero-tic_step; xval>= x_min; xval-= tic_step) {

    xmin = (int)((xval-x_min)*xscale)+rc.left+BORDER_X;
    ymin = rc.top;
    xmax = xmin;
    ymax = rc.bottom;
    line[0].x = xmin;
    line[0].y = ymin;
    line[1].x = xmax;
    line[1].y = ymax-BORDER_Y;

    // STYLE_THINDASHPAPER

    if ((xval> x_min)
        && (xmin>=rc.left+BORDER_X) && (xmin<=rc.right)) {

      StyleLine(Surface, line[0], line[1], Style, rc);

      if (draw_units) {
	TCHAR unit_text[MAX_PATH];
	FormatTicText(unit_text, xval*unit_step/tic_step, unit_step);
//	SetBkMode(hdc, OPAQUE);
	Surface.GetTextSize(unit_text, &tsize);
	Surface.SetBackgroundOpaque();
	Surface.DrawText(xmin-tsize.cx/2, ymax-tsize.cy, unit_text);
	Surface.SetBackgroundTransparent();
      }
    }

  }

}
//
// Set all default values for configuration.
// We need to set runtime variables later, that make use of
// configuration values. One setting for configuration, and the
// runtime equivalent of the same setting, for the case when it
// is possible to change such runtime value with a button.
//
// ALL configurable parameters MUST be listed here. Add new items at the bottom!
//
// Let's keep this list alpha sorted like in LKPROFILES.h and load/save functions
//
// AFTER this function is called:
// * values must be normalized with ProfileAdjustVariables()
// * Runtime values must be initialised with InitRuntime()
//
void LKProfileResetDefault(void) {

    int i;

#if TESTBENCH
    StartupStore(TEXT("... ProfileResetDefault%s"),NEWLINE);
#endif


    Units::CoordinateFormat = (CoordinateFormats_t)cfDDMMSS;

    // Units
    SpeedUnit_Config = 2;         // default is kmh
    TaskSpeedUnit_Config = 2;     // default is kph
    DistanceUnit_Config = 2;      // default is km
    LiftUnit_Config = 1;          // default m/s
    AltitudeUnit_Config = 1;      // default m

    //
    // Default infobox groups configuration
    // Should be different for each aircraft category
    //
    InfoType[0] = 1326913302;
    InfoType[1] = 1915694850;
    InfoType[2] = 403835669;
    InfoType[3] = 740895295;
    InfoType[4] = 1460275747;
    InfoType[5] = 725435674;
    InfoType[6] = 168906009;
    InfoType[7] = 387389207;

    InfoType[8] = 387389207; // totally unused!

    DisplayOrientation_Config=NORTHCIRCLE;

    DisplayTextType=0;

    AltitudeMode_Config = ALLON;
    ClipAltitude = 10000;	 // * 10
    AltWarningMargin = 1000; // * 10
    AIRSPACEWARNINGS = TRUE;
    WarningTime = 60;

    AcknowledgementTime = 1800;	// keep ack level for this time, [secs]
    AirspaceWarningRepeatTime = 900;            // warning repeat time if not acknowledged after 15 minutes
    AirspaceWarningVerticalMargin = 1000;        // vertical distance used to calculate too close condition *10
    AirspaceWarningDlgTimeout = 10;             // airspace warning dialog auto closing in x secs
    AirspaceWarningMapLabels = 1;               // airspace warning map labels showed
    AirspaceAckAllSame = 0;

    SafetyAltitudeMode = 0;

    SAFETYALTITUDEARRIVAL = 3000; // * 10
    SAFETYALTITUDETERRAIN = 500; // *10
    SAFTEYSPEED = 55.556;

    WindCalcTime=WCALC_TIMEBACK;
    WindCalcSpeed=27.778;

    SectorType = 1;
    SectorRadius = 3000;


    for(i=0; i<AIRSPACECLASSCOUNT; i++) {
        MapWindow::iAirspaceMode[i] = 3; // Display + Warning
    }
#ifdef HAVE_HATCHED_BRUSH
    MapWindow::SetAirSpaceFillType(MapWindow::asp_fill_patterns_full);
#else
    MapWindow::SetAirSpaceFillType(MapWindow::asp_fill_ablend_borders);
#endif
    MapWindow::SetAirSpaceOpacity(30);

    TrailActive_Config = 1; // long

    EnableTrailDrift_Config = false;

    EnableThermalLocator = 1;

    FinalGlideTerrain = 1;

    AutoWindMode_Config = D_AUTOWIND_CIRCLING;

    MapWindow::zoom.CircleZoom(1);

    HomeWaypoint = -1;

    Alternate1 = -1;

    Alternate2 = -1;

    MapWindow::SnailWidthScale = 16;

    TeamCodeRefWaypoint = -1;

    StartLine = 1;

    StartRadius = 3000;

    FinishLine = 1;

    FinishRadius = 3000;

    EnableAutoBacklight = 1;

    EnableAutoSoundVolume = 0;

    AircraftCategory = 0;

    AATEnabled=FALSE;

    CheckSum = 1;

    PGCruiseZoom=4;
    PGAutoZoomThreshold = 5000;
    PGClimbZoom=1;
    AutoOrientScale=100;

    PGOpenTimeH=12;
    PGOpenTimeM=0;
    PGCloseTimeH=23;
    PGCloseTimeM=59;

    PGNumberOfGates=0;
    PGGateIntervalTime=30;
    PGStartOut=0;

    // These values are used on startup, but on reset change also OpenCloseTopology
    LKTopoZoomCat05=DEFAULT_WATER_LABELS_THRESHOLD;	// coast area share the same label management of cat10
    LKTopoZoomCat10=DEFAULT_WATER_LABELS_THRESHOLD;	// water labels threshold, over this realscale, no water labels are printed)
    LKTopoZoomCat20=9999;		// water lines
    LKTopoZoomCat30=25;		// Big Roads
    LKTopoZoomCat40=6;		// Medium road
    LKTopoZoomCat50=3;		// Small road
    LKTopoZoomCat60=8;		// Railroad
    LKTopoZoomCat70=15;		// Big cities
    LKTopoZoomCat80=9999;		// Med city
    LKTopoZoomCat90=9999;		// Small city
    LKTopoZoomCat100=3;		// Very small cities
    LKTopoZoomCat110=9999;	// city polyline area

    LKMaxLabels=70;

    IphoneGestures = (IphoneGestures_t)iphDisabled;

    PollingMode = (PollingMode_t)pollmodeDisabled;

    LKVarioBar = (LKVarioBar_t)vBarDisabled;

    LKVarioVal = (LKVarioVal_t)vValVarioVario;

    OutlinedTp_Config = (OutlinedTp_t)otLandable;

    TpFilter = (TpFilter_t)TfNoLandables;

    OverColor = (OverColor_t)OcBlack;

    DeclutterMode = (DeclutterMode_t)dmHigh;

    // full size overlay by default
    OverlaySize = 0;
    if (IsDithered())
        BarOpacity = 100;
    else
        BarOpacity = 75;

#ifdef PPC2002
    FontRenderer = 1; // AntiAliasing
#else
    FontRenderer = 0; // ClearType Compatible
#endif

    GPSAltitudeOffset = 0;

    UseGeoidSeparation = true;
    UseExtSound1 = false;
    UseExtSound2 = false;

    PressureHg = 0;

    CustomKeyTime = 700;
    CustomKeyModeCenter = (CustomKeyMode_t)ckToggleMap;

    CustomKeyModeLeft = (CustomKeyMode_t)ckDisabled;
    CustomKeyModeRight = (CustomKeyMode_t)ckDisabled;
    CustomKeyModeAircraftIcon = (CustomKeyMode_t)ckDisabled;
    CustomKeyModeLeftUpCorner = (CustomKeyMode_t)ckMultitargetRotate;
    CustomKeyModeRightUpCorner = (CustomKeyMode_t)ckToggleOverlays;
    CustomKeyModeCenterScreen = (CustomKeyMode_t)ckWhereAmI;

    MapBox = (MapBox_t)mbBoxed;

    // Units labels printout
    if ((ScreenSize == (ScreenSize_t)ss240x320) ||
            (ScreenSize == (ScreenSize_t)ss272x480) ||
            (ScreenSize == (ScreenSize_t)ss320x240) )
        HideUnits = 1;
    else
        HideUnits = 0;



    BestWarning=1;

    ThermalBar=0;

    TrackBar=1;

    PGOptimizeRoute=true;
    PGOptimizeRoute_Config = true;

    GlideBarMode = (GlideBarMode_t)gbDisabled;

    ArrivalValue = (ArrivalValue_t)avAltitude;

    // 1 is showing all airports and declutter only unneeded outlandings
    NewMapDeclutter = 1;

    AverEffTime = (AverEffTime_t)ae30seconds;

    if (IsDithered())
        BgMapColor_Config = 0; // white
    else
        BgMapColor_Config = 2; // LCD green

    debounceTimeout.assign(0, 250*1000); // 250ms;

    DeviceNeedClipping=false;

    Appearance.DefaultMapWidth=206;
    // Landables style
    Appearance.IndLandable=wpLandableDefault;
    // White/Black inversion
    InverseInfoBox_Config=true; // black
    Appearance.InfoBoxModel=apImPnaGeneric;


    AutoAdvance_Config = 1;

    AutoMcMode_Config = amcEquivalent;


    AutoMacCready_Config = true;

    UseTotalEnergy_Config= false;

    WaypointsOutOfRange = 1; // include also wps out of terrain

    EnableFAIFinishHeight = false;

    Handicap = 100; // Std Cirrus

    UTCOffset = 0;

    AutoZoom_Config=false;

    MenuTimeout_Config = MENUTIMEOUTMAX;

    LockSettingsInFlight = 0;

    LoggerShortName = 0;

    EnableFLARMMap = 0;

    TerrainContrast = 128;

    TerrainBrightness = 128;

    TerrainRamp_Config = 0;

    MapWindow::GliderScreenPosition = 40;

    BallastSecsToEmpty =  120;

#if ((WINDOWSPC==0))
    SetSystemTimeFromGPS = true;
#else
    SetSystemTimeFromGPS = false;
#endif
    SaveRuntime = false;

    AutoForceFinalGlide = false;

    AlarmMaxAltitude1 = 0;

    AlarmMaxAltitude2 = 0;

    AlarmMaxAltitude3 = 0;

    AlarmTakeoffSafety = 0;

    GearWarningMode=0;

    GearWarningAltitude=200;

    FinishMinHeight = 0;

    StartHeightRef = 0;

    StartMaxHeight = 0;

    StartMaxHeightMargin = 0;

    StartMaxSpeed = 0;

    StartMaxSpeedMargin = 0;

    EnableNavBaroAltitude_Config = 1;

    Orbiter_Config = 1;
    Shading_Config = 1;
    OverlayClock = 0;
    UseTwoLines = 0;
    SonarWarning_Config = 1; // sonar enabled by default on reset

    // default BB and IP is all ON
    ConfBB0 = 0; // TRM is off by default on v4
    ConfBB1 = 1;
    ConfBB2 = 1;
    ConfBB3 = 1;
    ConfBB4 = 1;
    ConfBB5 = 1;
    ConfBB6 = 1;
    ConfBB7 = 1;
    ConfBB8 = 1;
    ConfBB9 = 1;
    ConfBB0Auto = 1;

    ConfIP11 = 1;
    ConfIP12 = 1;
    ConfIP13 = 1;
    ConfIP14 = 1;
    ConfIP15 = 1;
    ConfIP16 = 1;
    ConfIP17 = 1;
    ConfIP21 = 1;
    ConfIP22 = 1;
    ConfIP23 = 1;
    ConfIP24 = 1;
    ConfIP31 = 1;
    ConfIP32 = 1;
    ConfIP33 = 1;

    LoggerTimeStepCruise = 1;

    LoggerTimeStepCircling = 1;

    GlidePolar::SafetyMacCready = 0.5; // This is saved *10 and loaded /10 in Adjust!

    DisableAutoLogger = false;

    LiveTrackerInterval = 0;

    // empty or demo versions
    //szAirspaceFile[0] = TEXT('\0');
    //szWaypointFile[0] = TEXT('\0');
    //szTerrainFile[0] = TEXT('\0');
    //szAirfieldFile[0] = TEXT('\0');
    //szMapFile[0] = TEXT('\0');
    //szPolarFile[0] = TEXT('\0');


    _tcscpy(szPolarFile,_T("%LOCAL_PATH%\\\\_Polars\\Std Cirrus.plr"));
    _tcscpy(szAirspaceFile,_T("%LOCAL_PATH%\\\\_Airspaces\\DEMO.txt"));
    szAdditionalAirspaceFile[0] = TEXT('\0');
    _tcscpy(szWaypointFile,_T("%LOCAL_PATH%\\\\_Waypoints\\DEMO.cup"));
    szAdditionalWaypointFile[0] = TEXT('\0');
    _tcscpy(szTerrainFile,_T("%LOCAL_PATH%\\\\_Maps\\DEMO.DEM"));
    _tcscpy(szAirfieldFile,_T("%LOCAL_PATH%\\\\_Waypoints\\WAYNOTES.txt"));
    _tcscpy(szLanguageFile,_T("%LOCAL_PATH%\\\\_Language\\ENGLISH.LNG"));

    szInputFile[0] = TEXT('\0');
    _tcscpy(szMapFile,_T("%LOCAL_PATH%\\\\_Maps\\DEMO.LKM"));

    // Ports and device settings
    dwDeviceName1[0]=_T('\0');
    szPort1[0] = _T('\0');
    dwSpeedIndex1 = 2;
    dwBit1Index = (BitIndex_t)bit8N1;
    dwDeviceName2[0]=_T('\0');
    szPort2[0] = _T('\0');
    dwSpeedIndex2 = 2;
    dwBit2Index = (BitIndex_t)bit8N1;

    _tcscpy(PilotName_Config,_T("WOLF.HIRTH"));
    _tcscpy(LiveTrackersrv_Config,_T("www.livetrack24.com"));
    LiveTrackerport_Config = 80;
    _tcscpy(LiveTrackerusr_Config,_T("LK8000"));
    _tcscpy(LiveTrackerpwd_Config,_T(""));

    _tcscpy(AircraftType_Config,_T("CIRRUS-STD"));
    _tcscpy(AircraftRego_Config,_T("D-1900"));
    _tcscpy(CompetitionClass_Config,_T("CLUB"));
    _tcscpy(CompetitionID_Config,_T("WH"));

    LockSettingsInFlight = false;
    LoggerShortName = false;

    BUGS_Config=1; // 1=100%, 0.5 = 50% .. FLOATS!

    UseUngestures=true;

    // This is also reset by global init, but never mind. Done twice.
    extern void Reset_CustomMenu(void);
    Reset_CustomMenu();

    extern void Reset_Multimap_Flags(void);
    Reset_Multimap_Flags();

    extern void Reset_Multimap_Mode(void);
    Reset_Multimap_Mode();

    UseWindRose=false;	// use wind rose (ex: NNE) for wind direction, instead of degrees
    // only Changed by custom Key

    Flags_DrawTask=true;
    Flags_DrawFAI=false;
    FAI28_45Threshold = FAI_BIG_THRESHOLD;
    BottomMode=BM_CRU;
    iFlarmDirection=0;
    AspPermanentChanged=0;

    FontMapWaypoint=MAXFONTRESIZE;
    FontMapTopology=MAXFONTRESIZE;
    FontInfopage1L=MAXFONTRESIZE;
    FontInfopage2L=MAXFONTRESIZE;
    FontBottomBar=MAXFONTRESIZE;
    FontCustom1=MAXFONTRESIZE;
    FontOverlayBig=MAXFONTRESIZE;
    FontOverlayMedium=MAXFONTRESIZE;
    FontVisualGlide=MAXFONTRESIZE;

    // Overlay config
    Overlay_TopLeft=1;
    Overlay_TopMid=1;
    Overlay_TopRight=1;
    Overlay_TopDown=1;
    Overlay_LeftTop=1;
    Overlay_LeftMid=1;
    Overlay_LeftBottom=1;
    Overlay_LeftDown=1;
    Overlay_RightTop=1;
    Overlay_RightMid=1;
    Overlay_RightBottom=1;


    // ######### ADD NEW ITEMS ABOVE THIS LINE  #########

}