Пример #1
0
int EBuffer::FoldClose(int Line) { /*FOLD00*/
  int f = FindNearFold(Line);
  int l, top;
  int level;

  if (f == -1) return 0;

  if (FF[f].open == 0) return 1;  // already closed

  if (Modify() == 0) return 0;

  if (SetPosR(CP.Col, FF[f].line, tmLeft) == 0) return 0;

  if (BFI(this, BFI_Undo)) {
    if (PushULong(Line) == 0) return 0;

    if (PushUChar(ucFoldClose) == 0) return 0;
  }

  FF[f].open = 0;
  top        = FF[f].line;
  level      = FF[f].level;

  while ((f < FCount - 1) && (FF[f + 1].level > level)) f++;

  /* performance tweak: do it in reverse (we'll see if it helps) */

  if (f == FCount - 1) {
    for (l = RCount - 1; l > top; l--) if (HideRow(l) == 0) return 0;
  } else {
    for (l = FF[f + 1].line - 1; l > top; l--) if (HideRow(l) == 0) return 0;
  }

  /* yup, it does. try below for a (MUCH!) slower version */

  /*if (f == FCount - 1) {
     for (l = top + 1; l < RCount; l++)
     if (HideRow(l) == 0) return 0;
     } else {
     for (l = top + 1; l < FF[f + 1].line; l++)
     if (HideRow(l) == 0) return 0;
     }*/
  return 1;
}
Пример #2
0
void
FlightSetupPanel::RefreshAltitudeControl()
{
  const NMEAInfo &basic = CommonInterface::Basic();
  ComputerSettings &settings_computer = CommonInterface::SetComputerSettings();

  if (basic.pressure_altitude_available && settings_computer.pressure_available)
    ShowAltitude(settings_computer.pressure.PressureAltitudeToQNHAltitude(
                 basic.pressure_altitude));
  else if (basic.baro_altitude_available)
    ShowAltitude(basic.baro_altitude);
  else
    HideRow(Altitude);
}