Пример #1
0
WndProperty *
RowFormWidget::CreateEdit(const TCHAR *label, const TCHAR *help,
                          bool read_only)
{
  assert(IsDefined());

  const PixelRect edit_rc =
    InitialControlRect(Layout::GetMinimumControlHeight());

  WindowStyle style;
  if (!read_only)
    style.TabStop();

  PanelControl &panel = *(PanelControl *)GetWindow();
  WndProperty *edit =
    new WndProperty(panel, look, label,
                    edit_rc, (*label == '\0') ? 0 : 100,
                    style);
  edit->SetReadOnly(read_only);

  if (help != NULL)
    edit->SetHelpText(help);

  return edit;
}
Пример #2
0
static void SetReadOnlyItems()
{
  WndProperty* wp;
  bool aspw=false;
  bool aspmaplabels=false;
  
  wp = (WndProperty*)wf->FindByName(TEXT("prpAirspaceWarnings"));
  if (wp) aspw=(wp->GetDataField()->GetAsBoolean());
  wp = (WndProperty*)wf->FindByName(TEXT("prpWarningMapLabels"));
  if (wp) aspmaplabels=(wp->GetDataField()->GetAsBoolean());
  
  wp = (WndProperty*)wf->FindByName(TEXT("prpWarningTime"));
  if (wp) wp->SetReadOnly(!aspw && !aspmaplabels);
  wp = (WndProperty*)wf->FindByName(TEXT("prpAcknowledgementTime"));
  if (wp) wp->SetReadOnly(!aspw);
  wp = (WndProperty*)wf->FindByName(TEXT("prpWarningDlgTimeout"));
  if (wp) wp->SetReadOnly(!aspw);
  wp = (WndProperty*)wf->FindByName(TEXT("prpWarningVerticalMargin"));
  if (wp) wp->SetReadOnly(!aspw && !aspmaplabels);
 
}
Пример #3
0
static void setVariables(void) {
  WndProperty *wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpCat10"));
  if (wp) {
	if (HaveZoomTopology(10)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(10)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat20"));
  if (wp) {
	if (HaveZoomTopology(20)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(20)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat30"));
  if (wp) {
	if (HaveZoomTopology(30)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(30)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat40"));
  if (wp) {
	if (HaveZoomTopology(40)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(40)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat50"));
  if (wp) {
	if (HaveZoomTopology(50)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(50)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat60"));
  if (wp) {
	if (HaveZoomTopology(60)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(60)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat70"));
  if (wp) {
	if (HaveZoomTopology(70)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(70)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat80"));
  if (wp) {
	if (HaveZoomTopology(80)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(80)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat90"));
  if (wp) {
	if (HaveZoomTopology(90)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(90)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat100"));
  if (wp) {
	if (HaveZoomTopology(100)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(100)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpCat110"));
  if (wp) {
	if (HaveZoomTopology(110)) {
		wp->GetDataField()->SetAsFloat( ReadZoomTopology(110)*RZC);
	} else {
		wp->GetDataField()->SetAsFloat( 0 );
		wp->SetReadOnly(true);    
	}
	wp->RefreshDisplay();
  }

}
Пример #4
0
void dlgBasicSettingsShowModal(void){

  SHOWTHREAD(_T("dlgBasicSettingsShowModal"));

  char filename[MAX_PATH];
  if (!ScreenLandscape) {
	LocalPathS(filename, TEXT("dlgBasicSettings_L.xml"));
	wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_BASICSETTINGS_L"));
  } else {
	LocalPathS(filename, TEXT("dlgBasicSettings.xml"));
	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());
      if (!GPS_INFO.BaroAltitudeAvailable) wp->SetReadOnly(1);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpBallastPercent"));
    if (wp) {
      if (WEIGHTS[2]==0) wp->SetReadOnly(1);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpBallastLitres"));
    if (wp) {
      if (WEIGHTS[2]>0) {
        wp->GetDataField()-> SetAsFloat(GlidePolar::BallastLitres);
      } else {
	wp->SetReadOnly(1);
      }
      wp->RefreshDisplay();
    }
    wp = (WndProperty*)wf->FindByName(TEXT("prpWingLoading"));
    if (wp) {
      if (GlidePolar::WingLoading>0.1) {
	if (ISPARAGLIDER) {
		wp->GetDataField()->SetDisplayFormat(_T("%.1f kg/m2"));
		wp->GetDataField()->SetEditFormat(_T("%1.1f"));
		wp->GetDataField()->SetMin(1.0);
		wp->GetDataField()->SetStep(0.1);
	} 
	if (ISGLIDER) {
		wp->GetDataField()->SetDisplayFormat(_T("%.1f kg/m2"));
		wp->GetDataField()->SetEditFormat(_T("%1.1f"));
		wp->GetDataField()->SetMin(5.0);
		wp->GetDataField()->SetStep(0.5);
	}
	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;

}
Пример #5
0
    void OnSend(WndButton* pWnd) {
        if(ItemIndex < FileList.size()) {
            StartHourglassCursor();
            
            //Start Bluetooth if needed...
#ifdef UNDER_CE    
            CObexPush Obex;
            if(Obex.Startup()) {
                StartupStore(_T("Startup OK \n"));
                size_t nDevice = Obex.LookupDevice();
                StartupStore(_T("LookupDevice OK \n"));
                if(nDevice == 0) {
                    StopHourglassCursor();
                    MessageBoxX(_T("No Device"), _T("Error"), mbOk);
                    StartHourglassCursor();
                } else {
                    WndProperty* wp = (WndProperty*)wfDlg->FindByName(TEXT("prpDeviceList"));
                    DataFieldEnum* dfe = NULL;
                    if (wp) {
                        dfe = (DataFieldEnum*)wp->GetDataField();
                    }
                    if(dfe) {
                        dfe->Clear();
                        dfe->addEnumText(_T("none"));
                    }
                    for(size_t i = 0; i < nDevice; ++i) {
                        TCHAR szDeviceName[100] = {0};
                        if(!Obex.GetDeviceName(i, szDeviceName, array_size(szDeviceName))) {
                            _stprintf(szDeviceName, _T("Unknown device <%d>"), i);
                        }
                        StartupStore(_T("GetDeviceName <%d><%s> \n"), i, szDeviceName);
                        if(dfe) {
                            dfe->addEnumText(szDeviceName);
                        }
                    }
                    if(wp) {
                        if(dfe) {
                            dfe->SetAsInteger(0);
                        }
                        wp->SetReadOnly(false);
                        wp->RefreshDisplay();
                    }
                    StopHourglassCursor();
                    size_t DeviceIndex = 0;
                    if(dfe && wp) {
                        dlgComboPicker(wp);
                        DeviceIndex = dfe->GetAsInteger();
                    }
                    StartHourglassCursor();
                    if(DeviceIndex != 0) {
                        DeviceIndex--;

                        TCHAR szFileFullPath[MAX_PATH] = _T("\0");
                        LocalPath(szFileFullPath, _T(LKD_LOGS));
                        size_t nLen = _tcslen(szFileFullPath);
                        if (szFileFullPath[nLen - 1] != _T('\\')) {
                            _tcscat(szFileFullPath, _T("\\"));
                        }
                        FileList_t::const_iterator ItFileName = FileList.begin();
                        std::advance(ItFileName, ItemIndex);
                        _tcscat(szFileFullPath, ItFileName->c_str());

                        if(!Obex.SendFile(DeviceIndex, szFileFullPath)) {
                            StopHourglassCursor();
                            MessageBoxX(_T("Send Failed"), _T("Error"), mbOk);
                            StartHourglassCursor();
                        } else {
                            StopHourglassCursor();
                            MessageBoxX(_T("File sent!"), _T("Success"), mbOk);
                            StartHourglassCursor();
                        }
                    }
                }
                Obex.Shutdown();
            } else {
                MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk);
            }
#else
            MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk);
#endif
            StopHourglassCursor();
        }
    }