Esempio n. 1
0
static void OnFilterDirection(DataField *Sender, 
                              DataField::DataAccessKind_t Mode){

  switch(Mode){
    case DataField::daGet:
      Sender->Set(TEXT("*"));
    break;
    case DataField::daPut:
    break;
    case DataField::daChange:
    break;
    case DataField::daInc:
      DirectionFilterIdx++;
      if (DirectionFilterIdx > sizeof(DirectionFilter)/sizeof(DirectionFilter[0])-1)
        DirectionFilterIdx = 0;
      FilterMode(false);
      UpdateList();
    break;
    case DataField::daDec:
      if (DirectionFilterIdx == 0)
        DirectionFilterIdx = sizeof(DirectionFilter)/sizeof(DirectionFilter[0])-1;
      else
        DirectionFilterIdx--;
      FilterMode(false);
      UpdateList();
    break;
  case DataField::daSpecial:
    break;
  }

  SetDirectionData(Sender);

}
Esempio n. 2
0
static bool FormKeyDown(WndForm* pWnd, unsigned KeyCode){
  unsigned NewIndex = TypeFilterIdx;

  switch(KeyCode & 0xffff){
    case KEY_F1:
      NewIndex = 0;
    break;
    case KEY_F2:
      NewIndex = 2;
    break;
    case KEY_F3:
      NewIndex = 3;
    break;
  }

  if (TypeFilterIdx != NewIndex){
    TypeFilterIdx = NewIndex;
    FilterMode(false);
    UpdateList();

    WndProperty* wp = ((WndProperty *)wf->FindByName(TEXT("prpFltType")));
    if(wp && wp->GetDataField()) {
        wp->GetDataField()->SetAsString(CAirspaceManager::GetAirspaceTypeText(TypeFilterIdx));
        wp->RefreshDisplay();
    }
    return true;
  }

  return false;
}
Esempio n. 3
0
static void OnFilterType(DataField *Sender, 
                         DataField::DataAccessKind_t Mode) {

  TCHAR sTmp[20];

  switch(Mode){
    case DataField::daGet:
      Sender->Set(TEXT("*"));
    break;
    case DataField::daPut:
    break;
    case DataField::daChange:
    break;
    case DataField::daInc:
      TypeFilterIdx++;
      if (TypeFilterIdx > (AIRSPACECLASSCOUNT+1)) TypeFilterIdx = 0;		//Need to limit+1 because idx shifted with +1
      FilterMode(false);
      UpdateList();
    break;
    case DataField::daDec:
      if (TypeFilterIdx == 0)
        TypeFilterIdx = AIRSPACECLASSCOUNT+1;		//Need to limit+1 because idx shifted with +1
      else
        TypeFilterIdx--;
      FilterMode(false);
      UpdateList();
    break;
  case DataField::daSpecial:
    break;
  }

  if (TypeFilterIdx>0) {
    if( TypeFilterIdx == AIRSPACECLASSCOUNT+1)
      _tcscpy(sTmp, MsgToken(239));
    else
      LK_tcsncpy(sTmp, CAirspaceManager::GetAirspaceTypeText(TypeFilterIdx-1), sizeof(sTmp)/sizeof(sTmp[0])-1);
  } else {
	_tcscpy(sTmp, TEXT("*"));
  }
  Sender->Set(sTmp);

}
Esempio n. 4
0
static void OnFilterName(DataField *_Sender, DataField::DataAccessMode Mode) {
    switch(Mode) {
    case DataField::daChange:
        FilterMode(true);
        UpdateList();
        break;

    case DataField::daSpecial:
        return;
    }
}
Esempio n. 5
0
/**
 * \brief Returns the filtering mode of this Sampler.
 *
 * \Return FilterMode 
 */
ocl::Sampler::FilterMode ocl::Sampler::filterMode() const
{
	if(this->_context == nullptr) throw std::runtime_error("context not valid. cannot create a sampler");
	if(this->_id == nullptr) throw std::runtime_error("id not valid. cannot create a sampler");

	cl_filter_mode mode;
	
	cl_int status = clGetSamplerInfo (this->_id, CL_SAMPLER_FILTER_MODE, sizeof(mode), &mode, NULL);
	OPENCL_SAFE_CALL(status);
	
	return FilterMode(mode);
}
Esempio n. 6
0
static void OnFilterName(WndButton* pWnd) {

  int SelectedAsp=-1;
  int CursorPos=0;
TCHAR newNameFilter[NAMEFILTERLEN+1];

LK_tcsncpy(newNameFilter, sNameFilter, NAMEFILTERLEN);
SelectedAsp =  dlgTextEntryShowModalAirspace(newNameFilter, NAMEFILTERLEN);



int i= _tcslen(newNameFilter)-1;
while (i>=0) {
 if (newNameFilter[i]!=_T(' ')) {
         break;
 }
 newNameFilter[i]=0;
 i--;
};

LK_tcsncpy(sNameFilter, newNameFilter, NAMEFILTERLEN);


if (wpnewName) {
      if (sNameFilter[0]=='\0') {
          SetNameCaption(TEXT("*"));
      } else {
          SetNameCaption(sNameFilter);
      }
}

FilterMode(true);
UpdateList();

if((SelectedAsp>=0) && (SelectedAsp < NumberOfAirspaces))
{
    CursorPos = SelectedAsp;
    /*
 for (i=0; i<UpLimit; i++)
 {

     if(AirspaceSelectInfo[i].Index == SelectedAsp)
     {
           CursorPos = i;
     }
     */
 }


 wAirspaceList->SetFocus();
wAirspaceList->SetItemIndexPos(CursorPos);
wAirspaceList->Redraw();
}
Esempio n. 7
0
static void OnFilterDistance(DataField *Sender, 
                             DataField::DataAccessKind_t Mode) {

  TCHAR sTmp[12];

  switch(Mode){
    case DataField::daGet:
      Sender->Set(TEXT("25"));
    break;
    case DataField::daPut:
    break;
    case DataField::daChange:
    break;
    case DataField::daInc:
      DistanceFilterIdx++;
      if (DistanceFilterIdx > sizeof(DistanceFilter)/sizeof(DistanceFilter[0])-1)
        DistanceFilterIdx = 0;
      FilterMode(false);
      UpdateList();
    break;
    case DataField::daDec:
      if (DistanceFilterIdx == 0)
        DistanceFilterIdx = sizeof(DistanceFilter)/sizeof(DistanceFilter[0])-1;
      else
        DistanceFilterIdx--;
      FilterMode(false);
      UpdateList();
    break;
  case DataField::daSpecial:
    break;
  }

  if (DistanceFilterIdx == 0)
    _stprintf(sTmp, TEXT("%c"), '*');
  else
    _stprintf(sTmp, TEXT("%.0f%s"), 
              DistanceFilter[DistanceFilterIdx],
              Units::GetDistanceName());
  Sender->Set(sTmp);
}
Esempio n. 8
0
static void OnFilterType(DataField *Sender,
                         DataField::DataAccessMode Mode) {
    switch(Mode) {
    case DataField::daChange:
        TypeFilterIdx = Sender->GetAsInteger();
        FilterMode(false);
        UpdateList();
        break;

    case DataField::daSpecial:
        return;
    }
}
Esempio n. 9
0
static void OnFilterDirection(DataField *_Sender,
                              DataField::DataAccessMode Mode) {
    DataFieldEnum &df = *(DataFieldEnum *)_Sender;

    switch(Mode) {
    case DataField::daChange:
        direction_filter = df.GetAsInteger();
        FilterMode(false);
        UpdateList();
        break;

    case DataField::daSpecial:
        return;
    }
}
Esempio n. 10
0
void
AirspaceFilterListener::OnModified(DataField &df)
{
  if (&df == distance_control->GetDataField())
    dialog_state.distance = (unsigned)df.GetAsInteger() != WILDCARD
      ? Units::ToSysDistance(fixed(df.GetAsInteger()))
      : fixed(-1);

  else if (&df == direction_control->GetDataField())
    dialog_state.direction = df.GetAsInteger();

  else if (&df == type_control->GetDataField())
    dialog_state.type = df.GetAsInteger();

  FilterMode(&df == name_control->GetDataField());
  UpdateList();
}
Esempio n. 11
0
static void OnFilterDistance(DataField *_Sender,
                             DataField::DataAccessMode Mode) {
    DataFieldString *Sender = (DataFieldString *)_Sender;

    switch(Mode) {
    case DataField::daChange:
        distance_filter = (unsigned)Sender->GetAsInteger() != WILDCARD
                          ? fixed(Sender->GetAsInteger())
                          : fixed_minus_one;
        FilterMode(false);
        UpdateList();
        break;

    case DataField::daSpecial:
        return;
    }
}
void
AirspaceListWidget::OnModified(DataField &df)
{
  if (filter_widget.IsDataField(DISTANCE, df)) {
    DataFieldEnum &dfe = (DataFieldEnum &)df;
    dialog_state.distance = dfe.GetValue() != WILDCARD
      ? Units::ToSysDistance(fixed(dfe.GetValue()))
      : fixed(-1);

  } else if (filter_widget.IsDataField(DIRECTION, df)) {
    DataFieldEnum &dfe = (DataFieldEnum &)df;
    dialog_state.direction = dfe.GetValue();

  } else if (filter_widget.IsDataField(TYPE, df)) {
    DataFieldEnum &dfe = (DataFieldEnum &)df;
    dialog_state.type = dfe.GetValue();
  }

  FilterMode(filter_widget.IsDataField(NAME, df));
  UpdateList();
}