Exemplo n.º 1
0
void dlgTeamCodeShowModal(void)
{
    WndProperty* wp = NULL;
    WndButton *buttonCode = NULL;
    wf = NULL;
    char filename[MAX_PATH];
    if (InfoBoxLayout::landscape)
    {
        LocalPathS(filename, TEXT("dlgTeamCode_L.xml"));
        wf = dlgLoadFromXML(CallBackTable,

                            filename,
                            hWndMainWindow,
                            TEXT("IDR_XML_TEAMCODE_L"));
        if (!wf) return;
    }
    else
    {
        LocalPathS(filename, TEXT("dlgTeamCode.xml"));
        wf = dlgLoadFromXML(CallBackTable,

                            filename,
                            hWndMainWindow,
                            TEXT("IDR_XML_TEAMCODE"));
        if (!wf) return;
    }

    TCHAR sTmp[32] = { 0 };
    if( WayPointList && ValidWayPoint(TeamCodeRefWaypoint)) {
        // LKTOKEN _@M1230_ "Team Ref.: "
        _tcsncpy(sTmp, gettext(TEXT("_@M1230_")), 20);
        _tcsncat(sTmp, WayPointList[TeamCodeRefWaypoint].Name,10);
    } else {
        // LKTOKEN _@M1231_ "Team code: SET REF!"
        _tcsncpy(sTmp, gettext(TEXT("_@M1231_")), 30);
    }
    wf->SetCaption(sTmp);

    // set event for button
    buttonCode = ((WndButton *)wf->FindByName(TEXT("cmdSetCode")));
    if (buttonCode) {
        buttonCode->SetOnClickNotify(OnCodeClicked);
    }

    // Set unit for range
    wp = (WndProperty*)wf->FindByName(TEXT("prpRange"));
    if (wp) {
        wp->GetDataField()->SetUnits(Units::GetDistanceName());
    }

    Update();

    wf->SetTimerNotify(OnTimerNotify);

    wf->ShowModal();

    delete wf;
    wf=NULL;

}
Exemplo n.º 2
0
bool dlgAirspaceShowModal(bool coloredit){

  colormode = coloredit;

  ItemIndex = -1;

  if (!ScreenLandscape) {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE_L"));
  } else {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE"));
  }
  if (!wf) return false;

  wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList"));
  LKASSERT(wAirspaceList!=NULL);
  wAirspaceList->SetBorderKind(BORDERLEFT);
  wAirspaceList->SetEnterCallback(OnAirspaceListEnter);

  wAirspaceListEntry = (WndOwnerDrawFrame*)wf->
  FindByName(TEXT("frmAirspaceListEntry"));
  LKASSERT(wAirspaceListEntry!=NULL);
  wAirspaceListEntry->SetCanFocus(true);

  // ScrollbarWidth is initialised from DrawScrollBar in WindowControls, so it might not be ready here
  if ( wAirspaceList->ScrollbarWidth == -1) {
   #if defined (PNA)
   #define SHRINKSBFACTOR 1.0 // shrink width factor.  Range .1 to 1 where 1 is very "fat"
   #else
   #define SHRINKSBFACTOR 0.75  // shrink width factor.  Range .1 to 1 where 1 is very "fat"
   #endif
   wAirspaceList->ScrollbarWidth = (int) (SCROLLBARWIDTH_INITIAL * ScreenDScale * SHRINKSBFACTOR);

  }
  wAirspaceListEntry->SetWidth(wAirspaceList->GetWidth() - wAirspaceList->ScrollbarWidth - 5);


  UpdateList();

  changed = false;

  wf->ShowModal();


  delete wf;

  wf = NULL;

  return changed;
}
Exemplo n.º 3
0
void dlgBasicSettingsShowModal(void){


  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgBasicSettings.xml")); // no worry missing _L, it is unused anyway
  if (!InfoBoxLayout::landscape) 
	wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_BASICSETTINGS_L"));
  else
	wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_BASICSETTINGS"));

  WndProperty* wp;

//  BallastTimerActive = false;

  if (wf) {

    wf->SetTimerNotify(OnTimerNotify);

    ((WndButton *)wf->FindByName(TEXT("buttonDumpBallast")))->SetVisible(!BallastTimerActive);
    ((WndButton *)wf->FindByName(TEXT("buttonStopDump")))->SetVisible(BallastTimerActive);

    wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude"));
    if (wp) {
      wp->GetDataField()->SetAsFloat(
	       Units::ToUserAltitude(GPS_INFO.BaroAltitude));
      wp->GetDataField()->SetUnits(Units::GetAltitudeName());
      wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpBallastLitres"));
    if (wp) {
      wp->GetDataField()-> SetAsFloat(GlidePolar::BallastLitres);
      wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpWingLoading"));
    if (wp) {
      if (GlidePolar::WingLoading>0.1) {
	wp->GetDataField()-> SetAsFloat(GlidePolar::WingLoading);
      } else {
	wp->SetVisible(false);
      }
      wp->RefreshDisplay();
    }
    if (CALCULATED_INFO.Flying) {
	wp = (WndProperty*)wf->FindByName(TEXT("prpQNH"));
	if (wp) {
		wp->GetDataField()->SetDisplayFormat(_T("%.0f"));
	}
    }

    wf->ShowModal();
    delete wf;
  }
  wf = NULL;

}
Exemplo n.º 4
0
bool dlgAirspaceShowModal(bool coloredit){

  colormode = coloredit;

  ItemIndex = -1;

  if (!InfoBoxLayout::landscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE"));
  }
  if (!wf) return false;

  ASSERT(wf!=NULL);

  wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList"));
  ASSERT(wAirspaceList!=NULL);
  wAirspaceList->SetBorderKind(BORDERLEFT);
  wAirspaceList->SetEnterCallback(OnAirspaceListEnter);

  wAirspaceListEntry = (WndOwnerDrawFrame*)wf->
    FindByName(TEXT("frmAirspaceListEntry"));
  ASSERT(wAirspaceListEntry!=NULL);
  wAirspaceListEntry->SetCanFocus(true);

  UpdateList();

  changed = false;

  wf->ShowModal();

  // now retrieve back the properties...
  if (changed) {
    StoreRegistry();
    // DoStatusMessage(TEXT("Configuration saved")); // REMOVE FIXV2
    DoStatusMessage(gettext(TEXT("_@M877_"))); // Configuration saved
  };

  delete wf;

  wf = NULL;

  return changed;
}
Exemplo n.º 5
0
void dlgChecklistShowModal(void){
  static bool first=true;
  if (first) {
    LoadChecklist();
    first=false;
  }

  //  WndProperty *wp;

  if (!ScreenLandscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgChecklist_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_CHECKLIST_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgChecklist.xml"));
    wf = dlgLoadFromXML(CallBackTable,                        
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_CHECKLIST"));
  }

  nTextLines = 0;

  if (!wf) return;

  wf->SetKeyDownNotify(FormKeyDown);

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

  wDetails = (WndListFrame*)wf->FindByName(TEXT("frmDetails"));
  ASSERT(wDetails!=NULL);

  wDetailsEntry = 
    (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmDetailsEntry"));
  ASSERT(wDetailsEntry!=NULL);
  wDetailsEntry->SetCanFocus(true);

  wDetails->SetBorderKind(BORDERLEFT);

  page = 0;

  NextPage(0); // JMW just to turn proper pages on/off

  wf->ShowModal();

  delete wf;

  wf = NULL;

}
Exemplo n.º 6
0
void dlgWaypointEditShowModal(WAYPOINT *wpt) {
  if (!wpt) {
    return;
  }

  global_wpt = wpt;

  if (!ScreenLandscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgWaypointEdit_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename,
                        hWndMainWindow,
                        TEXT("IDR_XML_WAYPOINTEDIT_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgWaypointEdit.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_WAYPOINTEDIT"));
  }

  if (wf) {

    buttonName = ((WndButton *)wf->FindByName(TEXT("cmdName")));
    if (buttonName) {
      buttonName->SetOnClickNotify(OnNameClicked);
    }

    buttonComment = ((WndButton *)wf->FindByName(TEXT("cmdComment")));
    if (buttonComment) {
      buttonComment->SetOnClickNotify(OnCommentClicked);
    }

    UpdateButtons();

    SetUnits();

    SetValues();

    wf->SetModalResult(mrCancle);

    if (wf->ShowModal()==mrOK) {

      ////
      GetValues();

    }
    delete wf;
  }
  wf = NULL;

}
Exemplo n.º 7
0
void dlgFlarmTrafficShowModal(void){
  static bool first=true;
  if (first) {

    first=false;
  }

  if (InfoBoxLayout::landscape) {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgFlarmTraffic_L.xml"),
			XCSoarInterface::main_window,
			TEXT("IDR_XML_FLARMTRAFFIC_L"));
  } else {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgFlarmTraffic.xml"),
			XCSoarInterface::main_window,
			TEXT("IDR_XML_FLARMTRAFFIC"));
  }

  nTextLines = 0;

  if (!wf) return;

  wf->SetKeyDownNotify(FormKeyDown);

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

  wDetails = (WndListFrame*)wf->FindByName(TEXT("frmDetails"));
  wDetails->SetEnterCallback(OnListEnter);
  assert(wDetails!=NULL);

  wDetailsEntry =
    (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmDetailsEntry"));
  assert(wDetailsEntry!=NULL);
  wDetailsEntry->SetCanFocus(true);


  wDetails->SetBorderKind(BORDERLEFT);

  page = 0;

  wDetails->ResetList();
  Update();

  wf->SetTimerNotify(OnTimerNotify);

  wf->ShowModal();

  delete wf;

  wf = NULL;

}
Exemplo n.º 8
0
void dlgChecklistShowModal(void){
  static bool first=true;
  if (first) {
    LoadChecklist();
    first=false;
  }

  //  WndProperty *wp;

  if (!InfoBoxLayout::landscape) {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgChecklist_L.xml"),
                        XCSoarInterface::main_window,
                        TEXT("IDR_XML_CHECKLIST_L"));
  } else {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgChecklist.xml"),
                        XCSoarInterface::main_window,
                        TEXT("IDR_XML_CHECKLIST"));
  }

  nTextLines = 0;

  if (!wf) return;

  wf->SetKeyDownNotify(FormKeyDown);

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

  wDetails = (WndListFrame*)wf->FindByName(TEXT("frmDetails"));
  assert(wDetails!=NULL);

  wDetailsEntry =
    (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmDetailsEntry"));
  assert(wDetailsEntry!=NULL);
  wDetailsEntry->SetCanFocus(true);

  wDetails->SetBorderKind(BORDERLEFT);

  page = 0;

  NextPage(0); // JMW just to turn proper pages on/off

  wf->ShowModal();

  delete wf;

  wf = NULL;

}
Exemplo n.º 9
0
bool dlgAirspaceShowModal(bool coloredit){

  colormode = coloredit;

  ItemIndex = -1;

  if (!ScreenLandscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE"));
  }
  if (!wf) return false;

  //ASSERT(wf!=NULL);

  wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList"));
  //ASSERT(wAirspaceList!=NULL);
  wAirspaceList->SetBorderKind(BORDERLEFT);
  wAirspaceList->SetEnterCallback(OnAirspaceListEnter);

  wAirspaceListEntry = (WndOwnerDrawFrame*)wf->
    FindByName(TEXT("frmAirspaceListEntry"));
  //ASSERT(wAirspaceListEntry!=NULL);
  wAirspaceListEntry->SetCanFocus(true);

  UpdateList();

  changed = false;

  wf->ShowModal();


  delete wf;

  wf = NULL;

  return changed;
}
Exemplo n.º 10
0
int dlgAirspaceColoursShowModal(void){

  ItemIndex = -1;

  if (!InfoBoxLayout::landscape) {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspaceColours_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACECOLOURS_L"));
  } else {
    char filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspaceColours.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACECOLOURS"));
  }

  if (!wf) return -1;

  ASSERT(wf!=NULL);

  wAirspaceColoursList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceColoursList"));
  ASSERT(wAirspaceColoursList!=NULL);
  wAirspaceColoursList->SetBorderKind(BORDERLEFT);
  wAirspaceColoursList->SetEnterCallback(OnAirspaceColoursListEnter);

  wAirspaceColoursListEntry = (WndOwnerDrawFrame*)wf->
    FindByName(TEXT("frmAirspaceColoursListEntry"));
  ASSERT(wAirspaceColoursListEntry!=NULL);
  wAirspaceColoursListEntry->SetCanFocus(true);

  UpdateList();

  wf->ShowModal();

  // now retrieve back the properties...

  delete wf;

  wf = NULL;

  return ItemIndex;
}
Exemplo n.º 11
0
void dlgLoggerReplayShowModal(void){

  wf = dlgLoadFromXML(CallBackTable, IDR_XML_LOGGERREPLAY);

  WndProperty* wp;

  if (wf) {

    wp = (WndProperty*)wf->FindByName(TEXT("prpRate"));
    if (wp) {
      wp->GetDataField()->SetAsFloat(ReplayLogger::TimeScale);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpIGCFile"));
    if (wp) {
      DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(wp->GetDataField());
      if(dfe) {
        dfe->ScanDirectoryTop(_T(LKD_LOGS), _T("*" LKS_IGC));
        dfe->Lookup(ReplayLogger::GetFilename());
      }
      wp->RefreshDisplay();
    }

    wf->ShowModal();
    delete wf;
  }
  wf = NULL;
}
Exemplo n.º 12
0
void dlgLoggerReplayShowModal(void){

  TCHAR tsuf[10];
  TCHAR filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgLoggerReplay.xml"));
  wf = dlgLoadFromXML(CallBackTable, 
                      filename, 
		      TEXT("IDR_XML_LOGGERREPLAY"));

  WndProperty* wp;

  if (wf) {

    wp = (WndProperty*)wf->FindByName(TEXT("prpRate"));
    if (wp) {
      wp->GetDataField()->SetAsFloat(ReplayLogger::TimeScale);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpIGCFile"));
    if (wp) {
      DataFieldFileReader* dfe;
      dfe = (DataFieldFileReader*)wp->GetDataField();
      // dfe->ScanDirectoryTop(_T(""),TEXT("*.igc")); 
      _stprintf(tsuf,_T("*%s"),_T(LKS_IGC));
      dfe->ScanDirectoryTop(_T(LKD_LOGS),tsuf);
      dfe->Lookup(ReplayLogger::GetFilename());
      wp->RefreshDisplay();
    }

    wf->ShowModal();
    delete wf;
  }
  wf = NULL;
}
Exemplo n.º 13
0
void dlgTextEntryKeyboardShowModal(TCHAR *text, int width, const TCHAR* szFile, const TCHAR* szResource)
{
	first = true;
  wf = NULL;
  if (width==0) {
    width = MAX_TEXTENTRY;
  }
  max_width = min(MAX_TEXTENTRY, width);
  char filename[MAX_PATH];
    LocalPathS(filename, szFile);
    wf = dlgLoadFromXML(CallBackTable, 
			filename, 
			hWndMainWindow,			  
			szResource);
  if (!wf) return;

  cursor = 0;
  ClearText();

  if (_tcslen(text)>0) {
    _tcsupr(text);
    LK_tcsncpy(edittext, text, max_width-1);
    // position cursor at the end of imported text
    cursor=_tcslen(text); 
  }

  UpdateTextboxProp();
  wf->SetKeyDownNotify(FormKeyDown);
  wf->ShowModal();
  LK_tcsncpy(text, edittext, max_width-1);
  delete wf;
  wf=NULL;
}
Exemplo n.º 14
0
int dlgAirspaceColoursShowModal(void){

  ItemIndex = -1;

    wf = dlgLoadFromXML(CallBackTable, 
                       ScreenLandscape ? TEXT("dlgAirspaceColours_L.xml") : TEXT("dlgAirspaceColours_P.xml"), 
                       ScreenLandscape ? IDR_XML_AIRSPACECOLOURS_L : IDR_XML_AIRSPACECOLOURS_P);
  
  if (!wf) return -1;

  wAirspaceColoursList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceColoursList"));
  if(wAirspaceColoursList) {
    wAirspaceColoursList->SetEnterCallback(OnAirspaceColoursListEnter);
  }

  wAirspaceColoursListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmAirspaceColoursListEntry"));
  if(wAirspaceColoursListEntry) {
    wAirspaceColoursListEntry->SetCanFocus(true);
  }

  UpdateList();

  wf->ShowModal();

  delete wf;

  wf = NULL;

  return ItemIndex;
}
Exemplo n.º 15
0
void dlgMultimapsShowModal(void){
  WndProperty *wp;
  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgMultimaps.xml"));
  wf = dlgLoadFromXML(CallBackTable,                        
		      filename, 
		      hWndMainWindow,
		      TEXT("IDR_XML_MULTIMAPS"));

  if (!wf) return;

  setVariables();

  wf->ShowModal();

  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap1"));
  if (wp) Multimap1 = (wp->GetDataField()->GetAsInteger());
 
  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap2"));
  if (wp) Multimap2 = (wp->GetDataField()->GetAsInteger());
 
  wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap3"));
  if (wp) Multimap3 = (wp->GetDataField()->GetAsInteger());

  UpdateMultimapOrient();

  delete wf;
  wf = NULL;

}
Exemplo n.º 16
0
void dlgTextEntryKeyboardShowModal(TCHAR *text, int width, const TCHAR* szFile, const TCHAR* szResource)
{

  first = true;
  wf = NULL;
  if (width==0) {
    width = MAX_TEXTENTRY;
  }
  max_width = min(MAX_TEXTENTRY, width);
  char filename[MAX_PATH];
    LocalPathS(filename, szFile);
    wf = dlgLoadFromXML(CallBackTable,
			filename,
			hWndMainWindow,
			szResource);
  if (!wf) return;

  cursor = 0;
  ClearText();

  if (_tcslen(text)>0) {
    _tcsupr(text);
    LK_tcsncpy(edittext, text, max_width-1);
    // show previous test.
    // this text is replaced by first key down
    // but used if "OK" is clicked first for don't reset current value.
  }

  UpdateTextboxProp();
  wf->SetKeyDownNotify(FormKeyDown);
  wf->ShowModal();
  LK_tcsncpy(text, edittext, max_width-1);
  delete wf;
  wf=NULL;
}
Exemplo n.º 17
0
void dlgWindSettingsShowModal(void){

  TCHAR filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgWindSettings.xml"));
  wf = dlgLoadFromXML(CallBackTable, 
                      filename, 
		      TEXT("IDR_XML_WINDSETTINGS"));

  if (wf) {
    WndProperty* wp;

    wp = (WndProperty*)wf->FindByName(TEXT("prpSpeed"));
    if (wp) {
      wp->GetDataField()->SetUnits(Units::GetHorizontalSpeedName());
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpAutoWind"));
    if (wp) {
      DataFieldEnum* dfe;
      dfe = (DataFieldEnum*)wp->GetDataField();
	// LKTOKEN  _@M418_ = "Manual" 
      dfe->addEnumText(gettext(TEXT("_@M418_")));
	// LKTOKEN  _@M175_ = "Circling" 
      dfe->addEnumText(gettext(TEXT("_@M175_")));
      dfe->addEnumText(gettext(TEXT("ZigZag")));
	// LKTOKEN  _@M149_ = "Both" 
      dfe->addEnumText(gettext(TEXT("_@M149_")));
      dfe->addEnumText(MsgToken(1793)); // External

      wp->GetDataField()->Set(AutoWindMode);
      wp->RefreshDisplay();

      wp = (WndProperty*)wf->FindByName(TEXT("prpTrailDrift"));
      if (wp) {
        wp->GetDataField()->Set(MapWindow::EnableTrailDrift);
        wp->RefreshDisplay();
      }
    }

    wf->ShowModal();

    wp = (WndProperty*)wf->FindByName(TEXT("prpAutoWind"));
    if (wp) {
      if (AutoWindMode != wp->GetDataField()->GetAsInteger()) {
	AutoWindMode = wp->GetDataField()->GetAsInteger();
      }
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpTrailDrift"));
    if (wp) {
      if (MapWindow::EnableTrailDrift != wp->GetDataField()->GetAsBoolean()) {
        MapWindow::EnableTrailDrift = wp->GetDataField()->GetAsBoolean();
      }
    }
    
    delete wf;
  }
  wf = NULL;

}
Exemplo n.º 18
0
bool dlgAirspaceShowModal(bool coloredit){

  colormode = coloredit;

  WndForm *wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_AIRSPACE_L : IDR_XML_AIRSPACE_P);
  if (!wf) return false;

  WndListFrame* wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList"));
  LKASSERT(wAirspaceList!=NULL);
  wAirspaceList->SetBorderKind(BORDERLEFT);
  wAirspaceList->SetEnterCallback(OnAirspaceListEnter);

  WndOwnerDrawFrame* wAirspaceListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmAirspaceListEntry"));
  if(wAirspaceListEntry) {
    wAirspaceListEntry->SetCanFocus(true);
  }

  UpdateList(wAirspaceList);

  changed = false;

  wf->ShowModal();

  delete wf;

  return changed;
}
Exemplo n.º 19
0
void dlgAirspaceDetails(int the_circle, int the_area) {
  index_circle = the_circle;
  index_area = the_area;
  if ((index_area<=0) && (index_circle <=0)) {
    return;
  }

  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgAirspaceDetails.xml"));
  wf = dlgLoadFromXML(CallBackTable,
		      filename, 
		      hWndMainWindow,
		      TEXT("IDR_XML_AIRSPACEDETAILS"));

  if (!wf) return;

  ASSERT(wf!=NULL);

  SetValues();

  wf->ShowModal();

  delete wf;
  wf = NULL;
  return;
}
Exemplo n.º 20
0
void dlgThermalDetails(int indexid) {

  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgThermalDetails.xml"));
  wf = dlgLoadFromXML(CallBackTable,
		      filename, 
		      hWndMainWindow,
		      TEXT("IDR_XML_THERMALDETAILS"));

  if (!wf) return;

  SetValues(indexid);

  s_selected=indexid;

  if (wcslen(ThermalHistory[indexid].Near) >0) {
	TCHAR tcap[100];
	wsprintf(tcap,_T("%s %s: %s"),
		gettext(_T("_@M905_")), // Thermal
		gettext(_T("_@M456_")), // Near
		ThermalHistory[indexid].Near
	);
	wf->SetCaption(tcap);
  }

  wf->ShowModal();

  delete wf;
  wf = NULL;
  return;
}
Exemplo n.º 21
0
void dlgVoiceShowModal(void){
  wf = dlgLoadFromXML(CallBackTable,
                      _T("dlgVoice.xml"),
		      XCSoarInterface::main_window,
		      _T("IDR_XML_VOICE"));

  
  if (!wf) return;

  LoadIntoForm(*wf, XCSoarInterface::SettingsComputer());

  wf->ShowModal();

  bool changed = false;

  changed = SaveFromForm(*wf, XCSoarInterface::SetSettingsComputer());
  
  if (changed) {
    Profile::StoreRegistry();

    MessageBoxX(gettext(_T("Changes to configuration saved.")),
		 _T(""), MB_OK);
  }
    
  delete wf;
  wf = NULL;

}
Exemplo n.º 22
0
void dlgTextEntryKeyboardShowModal(TCHAR *text, int width, unsigned ResID)
{
  wf = NULL;
  if (width==0) {
    width = MAX_TEXTENTRY;
  }
  max_width = min(MAX_TEXTENTRY, width);
  wf = dlgLoadFromXML(CallBackTable, ResID);
  if (!wf) return;

 // cursor = _tcslen(text);
  ClearText();

  if (_tcslen(text)>0) {
    CharUpper(text);
    LK_tcsncpy(edittext, text, max_width-1);
    // show previous test.
    // this text is replaced by first key down
    // but used if "OK" is clicked first for don't reset current value.
  }
  cursor = _tcslen(edittext);
  UpdateTextboxProp();

  WindowControl* pBtHelp = wf->FindByName(TEXT("cmdHelp"));
  if(pBtHelp) {
     pBtHelp->SetVisible(wKeyboardPopupWndProperty && wKeyboardPopupWndProperty->HasHelpText());
  }

  wf->SetKeyDownNotify(FormKeyDown);
  wf->ShowModal();
  LK_tcsncpy(text, edittext, max_width-1);
 // cursor = _tcslen(text);
  delete wf;
  wf=NULL;
}
Exemplo n.º 23
0
void dlgWaypointFilesShowModal(void){
TCHAR temptext[MAX_PATH];
TCHAR tmp[MAX_PATH];
WndProperty *wp;



  wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_FILES_L : IDR_XML_FILES_P);
  if (!wf) return;

  setVariables();
  wf->SetCaption(MsgToken(2340)); 
  wf->ShowModal();


  for (unsigned int i=0 ; i < NO_WP_FILES; i++)
  {
    _tcscpy(temptext,szWaypointFile[i]);
    _sntprintf(tmp,MAX_PATH,_T("prpFile%1u"),i+1);
    wp = (WndProperty*)wf->FindByName(tmp);
    if (wp) {
      DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
      _tcscpy(temptext, dfe->GetPathFile());
      if (_tcscmp(temptext,szWaypointFile[i])) {
        _tcscpy(szWaypointFile[i],temptext);
      }
    }
  }


  delete wf;
  wf = NULL;

}
Exemplo n.º 24
0
void dlgLKTrafficDetails(int indexid) {

  TCHAR status[80], tpas[30];
  char filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgLKTraffic.xml"));
  wf = dlgLoadFromXML(CallBackTable,
		      filename, 
		      hWndMainWindow,
		      TEXT("IDR_XML_LKTRAFFICDETAILS"));

  if (!wf) return;

  ASSERT(wf!=NULL);

  // cmdTarget Caption name is normally "TARGET"
  buttonTarget=((WndButton *)wf->FindByName(TEXT("cmdTarget")));
  if (buttonTarget) {
	if ( LKTraffic[indexid].Locked ) {
	// LKTOKEN  _@M754_ = "UNLOCK" 
		_tcscpy(status,gettext(TEXT("_@M754_")));
		buttonTarget->SetCaption(status);
	}
  }


  SetValues(indexid);

  _tcscpy(status,_T("Traffic: "));
  if (LKTraffic[indexid].Locked) _tcscat(status,_T("TARGET "));
  switch(LKTraffic[indexid].Status) {
	case LKT_REAL:
	// LKTOKEN  _@M394_ = "Live " 
		_tcscat(status,gettext(TEXT("_@M394_")));
		break;
	case LKT_GHOST:
	// LKTOKEN  _@M323_ = "Ghost " 
		_tcscat(status,gettext(TEXT("_@M323_")));
		break;
	case LKT_ZOMBIE:
	// LKTOKEN  _@M829_ = "Zombie " 
		_tcscat(status,gettext(TEXT("_@M829_")));
		break;
	default:
	// LKTOKEN  _@M753_ = "UNKNOWN! " 
		_tcscat(status,gettext(TEXT("_@M753_")));
		break;
  }
  Units::TimeToTextDown(tpas,(int)(GPS_INFO.Time - LKTraffic[indexid].Time_Fix));
  _stprintf(status,_T("%s (%s\" old)"),status,tpas);

  wf->SetCaption(status);
  SelectedTraffic=indexid;

  wf->ShowModal();

  delete wf;
  wf = NULL;
  return;
}
Exemplo n.º 25
0
void dlgNumberEntryKeyboardShowModal(int *value, int width) 
{
  wf = NULL;
  wGrid = NULL;
  if (width==0) {
    width = MAX_TEXTENTRY;
  }
  max_width = min(MAX_TEXTENTRY, width);
  char filename[MAX_PATH];
  if (InfoBoxLayout::landscape) 
    {
      LocalPathS(filename, TEXT("frmNumberEntry_Keyboard_L.xml"));
      wf = dlgLoadFromXML(CallBackTable, 
			  filename, 
			  hWndMainWindow,			  
			  TEXT("IDR_XML_NUMBERENTRY_KEYBOARD_L"));
      if (!wf) return;
    }
  else
    {
      LocalPathS(filename, TEXT("frmNumberEntry_Keyboard.xml"));
      wf = dlgLoadFromXML(CallBackTable, 
			  filename, 
			  hWndMainWindow,			  
			  TEXT("IDR_XML_NUMBERENTRY_KEYBOARD"));
      if (!wf) return;
    }
  wGrid = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmGrid"));
  cursor = 0;
  ClearText();
  TCHAR text[20];
  _stprintf(text, TEXT("%ld"), *value);
  if (_tcslen(text)>0) {
    _tcsupr(text);
    _tcsncpy(edittext, text, max_width-1);
    edittext[max_width-1]= 0;
  }
  UpdateTextboxProp();
  wf->SetKeyDownNotify(FormKeyDown);
  wf->ShowModal();
  _tcsncpy(text, edittext, max_width);
  text[max_width-1]=0;
  *value = _wtoi(text);
  delete wf;
  wf=NULL; //@ 101027 just to be sure
}
Exemplo n.º 26
0
void dlgOracleShowModal(void){

  SHOWTHREAD(_T("dlgOracleShowModal"));

  wf=NULL;
 
  if (!ScreenLandscape) {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgOracle_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, filename, TEXT("IDR_XML_ORACLE_L"));
  } else  {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgOracle.xml"));
    wf = dlgLoadFromXML(CallBackTable, filename, TEXT("IDR_XML_ORACLE"));
  }

  if (!wf) return;

  // Since the topology search is made in the cache, and the cache has only items that
  // are ok to be printed for the current scale, and we want also items for high zoom,
  // we force high zoom and refresh. First we save current scale, of course.
  double oldzoom=MapWindow::zoom.Scale();

  // set a zoom level for topology visibility scan
  MapWindow::zoom.EventSetZoom(3);
  MapWindow::RefreshMap(); 

  // Make the current nearest invalid
  ResetNearestTopology();

  WaitToCallForce=2;

  // We must wait for data ready, so we shall do it  with timer notify.
  wf->SetTimerNotify(OnTimerNotify);
  wf->ShowModal();

  delete wf;
  wf = NULL;
  // Now we restore old zoom
  MapWindow::zoom.EventSetZoom(oldzoom);
  // And force rescan of topology in the cache
  MapWindow::ForceVisibilityScan=true;
  MapWindow::RefreshMap();

}
Exemplo n.º 27
0
void dlgTeamCodeShowModal(void)
{
  WndProperty* wp = NULL;
  WndButton *buttonCode = NULL;
  wf = NULL;

  if (InfoBoxLayout::landscape)
    {
      wf = dlgLoadFromXML(CallBackTable,
                          TEXT("dlgTeamCode_L.xml"),
			  XCSoarInterface::main_window,
			  TEXT("IDR_XML_TEAMCODE_L"));
      if (!wf) return;
    }
  else
    {
      wf = dlgLoadFromXML(CallBackTable,
                          TEXT("dlgTeamCode.xml"),
			  XCSoarInterface::main_window,
			  TEXT("IDR_XML_TEAMCODE"));
      if (!wf) return;
    }

  // set event for button
  buttonCode = ((WndButton *)wf->FindByName(TEXT("cmdSetCode")));
  if (buttonCode) {
    buttonCode->SetOnClickNotify(OnCodeClicked);
  }

  // Set unit for range
  wp = (WndProperty*)wf->FindByName(TEXT("prpRange"));
  if (wp) {
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
  }

  Update();

  wf->SetTimerNotify(OnTimerNotify);

  wf->ShowModal();

  delete wf;

}
Exemplo n.º 28
0
int dlgAirspacePatternsShowModal(void){

  ItemIndex = -1;

  if (!ScreenLandscape) {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspacePatterns_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        TEXT("IDR_XML_AIRSPACEPATTERNS_L"));
  } else {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspacePatterns.xml"));
    wf = dlgLoadFromXML(CallBackTable,                      
                        filename, 
                        TEXT("IDR_XML_AIRSPACEPATTERNS"));
  }

  if (!wf) return -1;

  //ASSERT(wf!=NULL);

  wAirspacePatternsList = (WndListFrame*)wf->FindByName(TEXT("frmAirspacePatternsList"));
  //ASSERT(wAirspacePatternsList!=NULL);
  wAirspacePatternsList->SetBorderKind(BORDERLEFT);
  wAirspacePatternsList->SetEnterCallback(OnAirspacePatternsListEnter);

  wAirspacePatternsListEntry = (WndOwnerDrawFrame*)wf->
    FindByName(TEXT("frmAirspacePatternsListEntry"));
  //ASSERT(wAirspacePatternsListEntry!=NULL);
  wAirspacePatternsListEntry->SetCanFocus(true);

  UpdateList();

  wf->ShowModal();

  // now retrieve back the properties...

  delete wf;

  wf = NULL;

  return ItemIndex;
}
Exemplo n.º 29
0
ListElement* dlgMultiSelectListShowModal(void) {

    ItemIndex = -1;

    if (iNO_ELEMENTS == 0) {

        return NULL;
    }

    wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_MULTISELECTLIST_L : IDR_XML_MULTISELECTLIST_P);

    if (!wf) return NULL;

    wf->SetTimerNotify(1000, OnTimer);
    wMultiSelectListList = (WndListFrame*) wf->FindByName(TEXT("frmMultiSelectListList"));
    LKASSERT(wMultiSelectListList != NULL);
    wMultiSelectListList->SetBorderKind(BORDERLEFT);
    wMultiSelectListList->SetEnterCallback(OnMultiSelectListListEnter);

    wMultiSelectListListEntry = (WndOwnerDrawFrame*) wf->FindByName(TEXT("frmMultiSelectListListEntry"));
    if(wMultiSelectListListEntry) {
        /*
         * control height must contains 2 text Line 
         * Check and update Height if necessary
         */
        LKWindowSurface windowSurface(MainWindow);
        LKBitmapSurface tmpSurface(windowSurface, 1, 1);

        const auto oldFont = tmpSurface.SelectObject(wMultiSelectListListEntry->GetFont());
        const int minHeight = 2 * tmpSurface.GetTextHeight(_T("dp")) + 2 * DLGSCALE(2);
        tmpSurface.SelectObject(oldFont);
        const int wHeight = wMultiSelectListListEntry->GetHeight();
        if(minHeight > wHeight) {
            wMultiSelectListListEntry->SetHeight(minHeight);
        }
        wMultiSelectListListEntry->SetCanFocus(true);
    } else LKASSERT(0);

    UpdateList();

    wf->ShowModal();

    delete wf;

    wf = NULL;

    iNO_ELEMENTS = 0;

    NoAirfields = 0;
    NoOutlands = 0;
    NoWaypoints = 0;
    NoAirspace = 0;
    NoTaskPoints = 0;

    return pResult;
}
Exemplo n.º 30
0
void dlgAirspaceShowModal(bool coloredit){

  colormode = coloredit;

  ItemIndex = -1;

  if (!Layout::landscape) {
    wf = dlgLoadFromXML(CallBackTable,
                        _T("dlgAirspace_L.xml"),
                        XCSoarInterface::main_window,
                        _T("IDR_XML_AIRSPACE_L"));
  } else {
    wf = dlgLoadFromXML(CallBackTable,
                        _T("dlgAirspace.xml"),
                        XCSoarInterface::main_window,
                        _T("IDR_XML_AIRSPACE"));
  }
  if (!wf) return;

  assert(wf!=NULL);

  wAirspaceList = (WndListFrame*)wf->FindByName(_T("frmAirspaceList"));
  assert(wAirspaceList!=NULL);
  wAirspaceList->SetBorderKind(BORDERLEFT);
  wAirspaceList->SetEnterCallback(OnAirspaceListEnter);

  UpdateList();

  changed = false;

  wf->ShowModal();

  // now retrieve back the properties...
  if (changed) {
    Profile::StoreRegistry();
    Message::AddMessage(_T("Configuration saved"));
  };

  delete wf;

  wf = NULL;

}