unsigned int ON_ComponentStatus::SetSelectedState(
  ON_ComponentState selected_state,
  bool bSynchronizeHighlight
  )
{
  bool bChanged = false;
  switch (selected_state)
  {
  case ON_ComponentState::NotSelected:
    if ( 0 != ClearStates(ON_ComponentStatus::Selected) )
      bChanged = true;
    if ( bSynchronizeHighlight && 0 != ClearStates(ON_ComponentStatus::Highlighted) )
      bChanged = true;
    break;

  case ON_ComponentState::Selected:
    if ( 0 != SetStates(ON_ComponentStatus::Selected) )
      bChanged = true;
    if ( bSynchronizeHighlight && 0 != SetStates(ON_ComponentStatus::Highlighted) )
      bChanged = true;
    break;

  case ON_ComponentState::SelectedPersistent:
    if ( 0 != SetStates(ON_ComponentStatus::SelectedPersistent) )
      bChanged = true;
    if ( bSynchronizeHighlight && 0 != SetStates(ON_ComponentStatus::Highlighted) )
      bChanged = true;
    break;
  }

  return bChanged ? 1U : 0U;
}
Exemple #2
0
void FGTrim::SetMode(TrimMode tt) {
    ClearStates();
    fdmex->GetPropagate()->SetInitialState(&fgic);
    mode=tt;
    switch(tt) {
      case tFull:
        if (debug_lvl > 0)
          cout << "  Full Trim" << endl;
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tWdot,tAlpha));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tUdot,tThrottle ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tQdot,tPitchTrim ));
        //TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tHmgt,tBeta ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tVdot,tPhi ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tPdot,tAileron ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tRdot,tRudder ));
        break;
      case tLongitudinal:
        if (debug_lvl > 0)
          cout << "  Longitudinal Trim" << endl;
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tWdot,tAlpha ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tUdot,tThrottle ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tQdot,tPitchTrim ));
        break;
      case tGround:
        if (debug_lvl > 0)
          cout << "  Ground Trim" << endl;
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tWdot,tAltAGL ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tQdot,tTheta ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tPdot,tPhi ));
        break;
      case tPullup:
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tNlf,tAlpha ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tUdot,tThrottle ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tQdot,tPitchTrim ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tHmgt,tBeta ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tVdot,tPhi ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tPdot,tAileron ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tRdot,tRudder ));
        break;
      case tTurn:
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tWdot,tAlpha ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tUdot,tThrottle ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tQdot,tPitchTrim ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tVdot,tBeta ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tPdot,tAileron ));
        TrimAxes.push_back(FGTrimAxis(fdmex,&fgic,tRdot,tRudder ));
        break;
      case tCustom:
      case tNone:
        break;
    }
    //cout << "TrimAxes.size(): " << TrimAxes.size() << endl;
    sub_iterations.resize(TrimAxes.size());
    successful.resize(TrimAxes.size());
    solution.resize(TrimAxes.size());
}
void FGTrim::SetMode(TrimMode tt) {
    ClearStates();
    mode=tt;
    switch(tt) {
      case tFull:
        if (debug_lvl > 0)
          cout << "  Full Trim" << endl;
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAlpha ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tUdot,tThrottle ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
        //TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tHmgt,tBeta ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tVdot,tPhi ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tAileron ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
        break;
      case tLongitudinal:
        if (debug_lvl > 0)
          cout << "  Longitudinal Trim" << endl;
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAlpha ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tUdot,tThrottle ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
        break;
      case tGround:
        if (debug_lvl > 0)
          cout << "  Ground Trim" << endl;
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAltAGL ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tTheta ));
        //TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tPhi ));
        break;
      case tPullup:
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tNlf,tAlpha ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tUdot,tThrottle ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tHmgt,tBeta ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tVdot,tPhi ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tAileron ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
        break;
      case tTurn:
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAlpha ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tUdot,tThrottle ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tVdot,tBeta ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tAileron ));
        TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
        break;
      case tCustom:
      case tNone:
        break;
    }
    //cout << "TrimAxes.size(): " << TrimAxes.size() << endl;
    sub_iterations=new double[TrimAxes.size()];
    successful=new double[TrimAxes.size()];
    solution=new bool[TrimAxes.size()];
    current_axis=0;
}
Exemple #4
0
void cJoystickSDL::Update() {
	if ( NULL != mJoystick ) {
		ClearStates();

		for ( Int32 i = 0; i < mButtons; i++ ) {
			UpdateButton( i, 0 != SDL_JoystickGetButton( mJoystick, i ) );
		}

	}
}
int CGlobalState::Restore( CRestore &restore )
{
	int i, listCount;
	globalentity_t tmpEntity;

	ClearStates();
	if ( !restore.ReadFields( "GLOBAL", this, m_SaveData, ARRAYSIZE(m_SaveData) ) )
		return 0;
	
	listCount = m_listCount;	// Get new list count
	m_listCount = 0;				// Clear loaded data

	for ( i = 0; i < listCount; i++ )
	{
		if ( !restore.ReadFields( "GENT", &tmpEntity, gGlobalEntitySaveData, ARRAYSIZE(gGlobalEntitySaveData) ) )
			return 0;
		EntityAdd( MAKE_STRING(tmpEntity.name), MAKE_STRING(tmpEntity.levelName), tmpEntity.state );
	}
	return 1;
}
Exemple #6
0
UndoManager::~UndoManager()
{
   ClearStates();
}
FLiveEditorWizardBase::~FLiveEditorWizardBase()
{
	ClearStates();
}
unsigned int ON_ComponentStatus::SetDamagedState(
  bool bIsDamaged
  )
{
  return bIsDamaged ? SetStates(ON_ComponentStatus::Damaged) : ClearStates(ON_ComponentStatus::Damaged);
}
unsigned int ON_ComponentStatus::SetLockedState(
  bool bIsLocked
  )
{
  return bIsLocked ? SetStates(ON_ComponentStatus::Locked) : ClearStates(ON_ComponentStatus::Locked);
}
unsigned int ON_ComponentStatus::SetHiddenState(
  bool bIsHidden
  )
{
  return bIsHidden ? SetStates(ON_ComponentStatus::Hidden) : ClearStates(ON_ComponentStatus::Hidden);
}
unsigned int ON_ComponentStatus::SetHighlightedState(
  bool bIsHighlighted
  )
{
  return bIsHighlighted ? SetStates(ON_ComponentStatus::Highlighted) : ClearStates(ON_ComponentStatus::Highlighted);
}