示例#1
0
void dlgBottomBarShowModal(void){

  WndProperty *wp;
  
  wf = dlgLoadFromXML(CallBackTable,                        
		      TEXT("dlgBottomBar.xml"), 
		      IDR_XML_BOTTOMBAR);

  if (!wf) return;

  setVariables();

  changed = false;

  wf->ShowModal();

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB0"));
  if (wp) {
	if (ConfBB0 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB0 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB1"));
  if (wp) {
	if (ConfBB1 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB1 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB2"));
  if (wp) {
	if (ConfBB2 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB2 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB3"));
  if (wp) {
	if (ConfBB3 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB3 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB4"));
  if (wp) {
	if (ConfBB4 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB4 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB5"));
  if (wp) {
	if (ConfBB5 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB5 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB6"));
  if (wp) {
	if (ConfBB6 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB6 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB7"));
  if (wp) {
	if (ConfBB7 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB7 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB8"));
  if (wp) {
	if (ConfBB8 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB8 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB9"));
  if (wp) {
	if (ConfBB9 != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB9 = (wp->GetDataField()->GetAsBoolean());
		changed=true;
	}
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConfBB0Auto"));
  if (wp) {
	if (ConfBB0Auto != (wp->GetDataField()->GetAsBoolean())) {
		ConfBB0Auto = (wp->GetDataField()->GetAsBoolean());
		changed=true; // not needed really
	}
  }

  if (changed) {

    if (!(ConfBB1 || ConfBB2 || ConfBB3 || ConfBB4 || ConfBB5 || 
        ConfBB6 || ConfBB7 || ConfBB8 || ConfBB9)) {
      MessageBoxX(
                   gettext(TEXT("_@M16_")), // can't disable all non-TRM0
                   TEXT(""), mbOk);        // bottom bar stripes
      // Automatically enable NAV1 bottom bar
      ConfBB1 = true;
    }

    UpdateConfBB();
    MessageBoxX (gettext(TEXT("_@M1607_")), // bottom bar config saved
                 TEXT(""), mbOk);

    // If the user just disabled the currently-shown BB stripe, then
    // automatically advance to the next enabled stripe.
    if (!ConfBB[BottomMode]) BottomBarChange(true);
  }


  delete wf;
  wf = NULL;

}
示例#2
0
//
// Init runtime variables using _Config variables
// This is needed after loading a new profile, and
// also on startup after loading a reset configuration.
//
// LK8000 is (normally!) separating config values from runtime values.
// For example, ActiveMap can be configured disabled by default in System Config,
// but enabled at runtime with a button or a customkey. However the configuration
// will still be "disabled" and saved as disabled in profile. 
// It is important to keep runtime and config variables separated, if a config
// variable can be changed with a button out of System Config!
// 
// Be careful, like AdjustVariables this function is called twice or more times on startup
//
void LKProfileInitRuntime(void) {

  #if TESTBENCH
  StartupStore(_T("... LKProfileInitRuntime\n"));
  #endif

  // Todo: use _Config values for files, and then we can compare if they changed
  WAYPOINTFILECHANGED = TRUE;
  TERRAINFILECHANGED = TRUE;
  TOPOLOGYFILECHANGED = TRUE;
  AIRSPACEFILECHANGED = TRUE;
  AIRFIELDFILECHANGED = TRUE;
  POLARFILECHANGED = TRUE;


  //
  // Runtime from Config
  //

  Appearance.InverseInfoBox	= InverseInfoBox_Config;
  AutoAdvance			= AutoAdvance_Config;
  AutoMcMode			= AutoMcMode_Config;
  BgMapColor			= BgMapColor_Config;
  EnableNavBaroAltitude		= EnableNavBaroAltitude_Config;
  Orbiter			= Orbiter_Config;
  Shading			= Shading_Config;
  TerrainRamp			= TerrainRamp_Config;
  TrailActive			= TrailActive_Config;
  UseTotalEnergy		= UseTotalEnergy_Config;
  AutoWindMode			= AutoWindMode_Config;
  MapWindow::EnableTrailDrift	= EnableTrailDrift_Config;
  AltitudeMode			= AltitudeMode_Config;
  OutlinedTp			= OutlinedTp_Config;
  BUGS				= BUGS_Config;

  MapWindow::zoom.AutoZoom(AutoZoom_Config);

  CALCULATED_INFO.AutoMacCready = AutoMacCready_Config==true?1:0;
  DisplayOrientation = DisplayOrientation_Config;
  MapWindow::SetAutoOrientation(true); // reset old autoorientation

  MapWindow::GliderScreenPositionY = MapWindow::GliderScreenPosition;

  GlobalModelType=Appearance.InfoBoxModel;

  //
  // Units
  //
  switch(SpeedUnit_Config) {
    case 0 :
	SPEEDMODIFY = TOMPH;
	break;
    case 1 :
	SPEEDMODIFY = TOKNOTS;
	break;
    case 2 :
    default:
	SPEEDMODIFY = TOKPH;
	break;
  }
  switch(TaskSpeedUnit_Config) {
    case 0 :
      TASKSPEEDMODIFY = TOMPH;
      break;
    case 1 :
      TASKSPEEDMODIFY = TOKNOTS;
      break;
    case 2 :
    default:
      TASKSPEEDMODIFY = TOKPH;
      break;
  }
  switch(DistanceUnit_Config) {
    case 0 : DISTANCEMODIFY = TOMILES; break;
    case 1 : DISTANCEMODIFY = TONAUTICALMILES; break;
    default:
    case 2 : DISTANCEMODIFY = TOKILOMETER; break;
  }
  switch(AltitudeUnit_Config) {
    case 0 : ALTITUDEMODIFY = TOFEET; break;
    default:
    case 1 : ALTITUDEMODIFY = TOMETER; break;
  }
  switch(LiftUnit_Config) {
    case 0 : LIFTMODIFY = TOKNOTS; break;
    case 2 : LIFTMODIFY = TOKNOTS; break;
    default:
    case 1 : LIFTMODIFY = TOMETER; break;
  }
  Units::NotifyUnitChanged(); // set unit strings


  SetOverColorRef();

  InitActiveGate();


  if ( ISPARAGLIDER ) {
	if(PGOptimizeRoute)	AATEnabled=true;
	LoggerTimeStepCruise=1;
  } else {
	AATEnabled=FALSE;
  }

  if ( ISPARAGLIDER || ISCAR ) {
	// paragliders can takeoff at 5kmh ground with some head wind!
	TakeOffSpeedThreshold=1.39;	// 5kmh
	if (ISCAR) TakeOffSpeedThreshold=0.83; // 3 kmh
  } else {
	TakeOffSpeedThreshold=11.12; // 40kmh
  }

  //
  // ModelType specials for PNAs
  //
  #if (WINDOWSPC<1)
  if (GlobalModelType == MODELTYPE_PNA_HP31X ) {
	DeviceNeedClipping=true;
	// key transcoding for this one
  	#if TESTBENCH
	StartupStore(TEXT(". Loading HP31X settings%s"),NEWLINE);
	#endif
  }
  else
  if (GlobalModelType == MODELTYPE_PNA_PN6000 ) {
	// key transcoding for this one
  }
  else
  if (GlobalModelType == MODELTYPE_PNA_MIO ) {
  	#if TESTBENCH
	StartupStore(TEXT(". Loading MIO settings%s"),NEWLINE);
	#endif
	// currently no special settings from MIO but need to handle hw keys
  }
  else
  if (GlobalModelType == MODELTYPE_PNA_NOKIA_500 ) {
  	#if TESTBENCH
	StartupStore(TEXT(". Loading Nokia500 settings%s"),NEWLINE);
	#endif
	// key transcoding is made
  }
  else
  if (GlobalModelType == MODELTYPE_PNA_MEDION_P5 ) {
  	#if TESTBENCH
	StartupStore(TEXT(".Loading Medion settings%s"),NEWLINE);
	#endif
	DeviceNeedClipping=true;
  }
  if (GlobalModelType == MODELTYPE_PNA_NAVIGON ) {
  	#if TESTBENCH
	StartupStore(TEXT(".Loading Navigon settings%s"),NEWLINE);
	#endif
	DeviceNeedClipping=true;
  }
  else
  if (GlobalModelType == MODELTYPE_PNA_PNA ) {
  	#if TESTBENCH
	StartupStore(TEXT(". Loading default PNA settings%s"),NEWLINE);
	#endif
		
  }
  #if TESTBENCH
  else
	StartupStore(TEXT(". No special regsets for this device%s"),NEWLINE);
  #endif

  #endif // ModelType specials



  LKalarms[0].triggervalue=(int)AlarmMaxAltitude1/1000;
  LKalarms[1].triggervalue=(int)AlarmMaxAltitude2/1000;
  LKalarms[2].triggervalue=(int)AlarmMaxAltitude3/1000;

  UpdateConfBB();
  UpdateConfIP();
  UpdateMultimapOrient();

}