bool Layout::IsEnabled()
{
    for (int i = 0; i < m_nWins; i++) {
        if(m_sub_wins[i]->IsEnabled()){
            if(!IWindow::IsEnabled())
                Enable();
            return true;
        }
    }
    if(IWindow::IsEnabled())
        Disable();

    return false;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CAI_PolicingBehavior::GatherConditions( void )
{
	BaseClass::GatherConditions();

	// Mapmaker may have removed our goal while we're running our schedule
	if ( !m_hPoliceGoal )
	{
		Disable();
		return;
	}

	ClearCondition( COND_POLICE_TARGET_TOO_CLOSE_HARASS );
	ClearCondition( COND_POLICE_TARGET_TOO_CLOSE_SUPPRESS );

	CBaseEntity *pTarget = m_hPoliceGoal->GetTarget();

	if ( pTarget == NULL )
	{
		DevMsg( "ai_goal_police with NULL target entity!\n" );
		return;
	}

	// See if we need to knock out our target immediately
	if ( ShouldKnockOutTarget( pTarget ) )
	{
		SetCondition( COND_POLICE_TARGET_TOO_CLOSE_SUPPRESS );
	}

	float flDistSqr = ( m_hPoliceGoal->WorldSpaceCenter() - pTarget->WorldSpaceCenter() ).Length2DSqr();
	float radius = ( m_hPoliceGoal->GetRadius() * PATROL_RADIUS_RATIO );
	float zDiff = fabs( m_hPoliceGoal->WorldSpaceCenter().z - pTarget->WorldSpaceCenter().z );

	// If we're too far away, don't bother
	if ( flDistSqr < (radius*radius) && zDiff < 32.0f )
	{
		SetCondition( COND_POLICE_TARGET_TOO_CLOSE_HARASS );

		if ( flDistSqr < (m_hPoliceGoal->GetRadius()*m_hPoliceGoal->GetRadius()) )
		{
			SetCondition( COND_POLICE_TARGET_TOO_CLOSE_SUPPRESS );
		}
	}

	// If we're supposed to stop chasing (aggression over), return
	if ( m_bTargetIsHostile && m_flAggressiveTime < gpGlobals->curtime && IsCurSchedule(SCHED_CHASE_ENEMY) )
	{
		// Force me to re-evaluate my schedule
		GetOuter()->ClearSchedule( "Stopped chasing, aggression over" );
	}
}
Exemple #3
0
    void FieldTrial::UseOneTimeRandomization()
    {
        DCHECK_EQ(group_, kNotFinalized);
        DCHECK_EQ(kDefaultGroupNumber + 1, next_group_number_);
        if(!FieldTrialList::IsOneTimeRandomizationEnabled())
        {
            NOTREACHED();
            Disable();
            return;
        }

        random_ = static_cast<Probability>(
            divisor_ * HashClientId(FieldTrialList::client_id(), name_));
    }
Exemple #4
0
NS_IMETHODIMP
TaskbarPreview::SetVisible(bool visible) {
  if (mVisible == visible) return NS_OK;
  mVisible = visible;

  // If the nsWindow has already been destroyed but the caller is still trying
  // to use it then just pretend that everything succeeded.  The caller doesn't
  // actually have a way to detect this since it's the same case as when we
  // CanMakeTaskbarCalls returns false.
  if (!mWnd)
    return NS_OK;

  return visible ? Enable() : Disable();
}
Exemple #5
0
/* DoAvailable()
 * ===================================================================
 */
void
DoAvailable( void )
{
    PrevTree = ad_front;
    Reset_Tree( ad_inactive );


    NoExit( IINSTALL );
    Disable( IINSTALL );
    
    NoExit( ICONFIG );
    Disable( ICONFIG );


    /* Read in the UnUsed fonts, if necessary */
    
    if( !Fonts_Loaded )
    {
      MF_Save();
      Scan_Message( ad_scan, TRUE );	

      read_fonts( TRUE, FALSE );

      Scan_Message( ad_scan, FALSE );
      MF_Restore();
    }  

    CheckSelectAll( FALSE );
    
    mover_setup( available_list, available_count,
		 IBASE, ISLIDER, IUP, IDOWN,
		 ILINE0, ILINE13, ILINE, 0, INACTIVE_HEIGHT );
    HideObj( ILINE );		 
    Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); 
    ShowObj( ILINE );
    RedrawBase( tree, ILINE );
}
Exemple #6
0
void Bird::HandleUpdate(StringHash eventType, VariantMap &eventData)
{
    if (dead_ && GetPosition().y_ < -5.0f) Disable();

    float timeStep = eventData[SceneUpdate::P_TIMESTEP].GetFloat();
    if (sinceSpeciesSet_ < morphTime_){
        Morph();
    }
    sinceSpeciesSet_ += timeStep;

    if (sinceStateChange_ > stateDuration_){
        switch (state_) {
        case BirdState::Flying: {
            SetState(BirdState::Landing);
        } break;
        case BirdState::Standing: {
            SetState(BirdState::Flying);
        } break;
        default:
            break;
        }
    }
    if(!(first_ && state_ == BirdState::Standing)) sinceStateChange_ += timeStep;

    switch (state_) {
    case BirdState::Flying: {
        Fly(timeStep);
    } break;
    case BirdState::Landing: {
        Land(timeStep);
    } break;
    case BirdState::Standing: {
        Stand(timeStep);
    } break;
    default:
        break;
    }

    //Move bird
    rootNode_->Translate(velocity_*timeStep, TS_WORLD);

    //Update rotation in accordance with the birds movement.
    if (velocity_.Length() > 0.01f){
        Quaternion rotation = rootNode_->GetWorldRotation();
        Quaternion aimRotation = rotation;
        aimRotation.FromLookRotation(velocity_);
        rootNode_->SetRotation(rotation.Slerp(aimRotation, 2.0f * timeStep * velocity_.Length()));
    }
}
Exemple #7
0
CMemLeakDetector::~CMemLeakDetector()
{
#if defined(AUTO_ENABLE_MEMLEAKDETECTOR)
	// report leaks
	Disable();
	ReportLeaks();
#endif

#if defined(PLATFORM_WINDOWS)
	for(std::size_t i = 0; i < m_ModuleInfoVector.size(); ++i)
		_free_dbg(m_ModuleInfoVector[i].m_ModuleName, _CRT_BLOCK);
#endif

	delete m_Reporter;
}
Exemple #8
0
MythUICheckBox::MythUICheckBox(MythUIType *parent, const QString &name)
    : MythUIType(parent, name)
{
    m_currentCheckState = MythUIStateType::Off;
    m_state = "active";

    m_BackgroundState = m_CheckState = NULL;

    connect(this, SIGNAL(TakingFocus()), this, SLOT(Select()));
    connect(this, SIGNAL(LosingFocus()), this, SLOT(Deselect()));
    connect(this, SIGNAL(Enabling()), this, SLOT(Enable()));
    connect(this, SIGNAL(Disabling()), this, SLOT(Disable()));

    SetCanTakeFocus(true);
}
Exemple #9
0
void CIP2Country::Enable()
{
	Disable();

	if (m_CountryDataMap.empty()) {
		LoadFlags();
	}

	if (!CPath::FileExists(m_DataBasePath)) {
		Update();
		return;
	}

	m_geoip = GeoIP_open(unicode2char(m_DataBasePath), GEOIP_STANDARD);
}
void opengl_texture_state::SetTarget(GLenum tex_target)
{
	if (units[active_texture_unit].texture_target != tex_target) {
		Disable();

		if (units[active_texture_unit].texture_id) {
			glBindTexture(units[active_texture_unit].texture_target, 0);
			units[active_texture_unit].texture_id = 0;
		}

		// reset modes, since those were only valid for the previous texture target
		default_values(active_texture_unit, tex_target);
		units[active_texture_unit].texture_target = tex_target;
	}
}
Exemple #11
0
WorldLog::WorldLog()
{
    bEnabled = false;
    m_file = NULL;

    if (Config.MainConfig.GetBoolDefault("LogLevel", "World", false))
    {
        Log.Notice("WorldLog", "Enabling packetlog output to \"world.log\"");
        Enable();
    }
    else
    {
        Disable();
    }
}
Exemple #12
0
static void
/*FCN*/UpdateDlgControls (
  void
){
  if ( totalFeatures == 0 ){
    Disable ( featGroup );
    Enable ( groupDelButton );
  } else {
    if ( curFeatureInd < nHideFeatures ) Enable ( featHideButton );
    else Disable ( featHideButton );
    Enable ( featGroup );
    Disable ( groupDelButton );
  }
  if ( totalGroups < 6 ){
    Enable ( newButton );
  } else {
    Disable ( newButton );
  }
  if ( curGroupInd < nHideGroups ) Enable (groupHideButton);
  else Disable ( groupHideButton );
  if ( (Int2)Nlm_GetMuskCParamEd(MSM_GROUPS,groupAr[curGroupInd],MSM_STYLE)
       == MSM_SPREAD ) SetStatus (groupCompBox,FALSE);
  else SetStatus (groupCompBox,TRUE);
}
Exemple #13
0
void AddDelay(TimerBase *TimerBase, struct IORequest *ioreq)
{
	DPrintF("Inside AddDelay!\n");
	UINT32 ipl;
	ipl = Disable();

	    timer_AddTime(TimerBase, &TimerBase->Elapsed, &((struct TimeRequest*)ioreq)->tr_time);

	    INTERN_QueueRequest(TimerBase, ioreq);

	    Enable(ipl);

		DPrintF("Delay added!\n");
	    //CLEAR_BITS(((struct TimeRequest*)ioreq)->tr_node.io_Flags, IOF_QUICK);
	    ((struct TimeRequest*)ioreq)->tr_node.io_Flags &= ~IOF_QUICK;
}
Exemple #14
0
void CCustomZone::OnStateSwitch	(EZoneState new_state)
{
	if (new_state==eZoneStateDisabled)
		Disable();
	else
		Enable();

	if(new_state==eZoneStateAccumulate)
		PlayAccumParticles();

	if(new_state==eZoneStateAwaking)
		PlayAwakingParticles();

	m_eZoneState			= new_state;
	m_iPreviousStateTime	= m_iStateTime = 0;
};
Exemple #15
0
bool
RasterTile::CheckTileVisibility(int view_x, int view_y, unsigned view_radius)
{
  if (!width || !height) {
    Disable();
    return false;
  }

  const unsigned int dx1 = abs(view_x - (int)xstart);
  const unsigned int dx2 = abs((int)xend - view_x);
  const unsigned int dy1 = abs(view_y - (int)ystart);
  const unsigned int dy2 = abs((int)yend - view_y);

  distance = std::max(std::min(dx1, dx2), std::min(dy1, dy2));
  return distance <= view_radius || IsEnabled();
}
Exemple #16
0
__regargs BOOL PopEvent(EventT *event) {
  BOOL present = FALSE;

  Disable();

  if (used > 0) {
    present = TRUE;
    *event = queue[head];
    head = (head + 1) & (QUEUELEN - 1);
    used--;
  }

  Enable();

  return present;
}
Exemple #17
0
void CIP2Country::DownloadFinished(uint32 result)
{
	if (result == HTTP_Success) {
		Disable();
		// download succeeded. Switch over to new database.
		wxString newDat = m_DataBasePath + wxT(".download");

		// Try to unpack the file, might be an archive
		wxWCharBuffer dataBaseName = m_DataBaseName.wc_str();
		const wxChar* geoip_files[] = {
			dataBaseName,
			NULL
		};

		if (UnpackArchive(CPath(newDat), geoip_files).second == EFT_Error) {
			AddLogLineC(_("Download of GeoIP.dat file failed, aborting update."));
			return;
		}

		if (wxFileExists(m_DataBasePath)) {
			if (!wxRemoveFile(m_DataBasePath)) {
				AddLogLineC(CFormat(_("Failed to remove %s file, aborting update.")) % m_DataBaseName);
				return;
			}
		}

		if (!wxRenameFile(newDat, m_DataBasePath)) {
			AddLogLineC(CFormat(_("Failed to rename %s file, aborting update.")) % m_DataBaseName);
			return;
		}

		Enable();
		if (m_geoip) {
			AddLogLineN(CFormat(_("Successfully updated %s")) % m_DataBaseName);
		} else {
			AddLogLineC(_("Error updating GeoIP.dat"));
		}
	} else if (result == HTTP_Skipped) {
		AddLogLineN(CFormat(_("Skipped download of %s, because requested file is not newer.")) % m_DataBaseName);
	} else {
		AddLogLineC(CFormat(_("Failed to download %s from %s")) % m_DataBaseName % thePrefs::GetGeoIPUpdateUrl());
		// if it failed and there is no database, turn it off
		if (!wxFileExists(m_DataBasePath)) {
			thePrefs::SetGeoIPEnabled(false);
		}
	}
}
Exemple #18
0
static BOOL CmdUntrackType(struct IOSana2Req *request,
   struct DevBase *base)
{
   struct DevUnit *unit;
   struct Opener *opener;
   ULONG packet_type;
   struct TypeTracker *tracker;
   struct TypeStats *initial_stats;

   unit = (APTR)request->ios2_Req.io_Unit;
   packet_type = request->ios2_PacketType;
   if(packet_type <= ETH_MTU)
      packet_type = ETH_MTU;

   /* Get global tracker and initial figures */

   tracker = (struct TypeTracker *)
      FindTypeStats(unit, &unit->type_trackers, packet_type, base);
   opener = request->ios2_BufferManagement;
   initial_stats = FindTypeStats(unit, &opener->initial_stats, packet_type,
      base);

   /* Decrement tracker usage and free unused structures */

   if(initial_stats != NULL)
   {
      if((--tracker->user_count) == 0)
      {
         Disable();
         Remove((APTR)tracker);
         Enable();
         FreeMem(tracker, sizeof(struct TypeTracker));
      }

      Remove((APTR)initial_stats);
      FreeMem(initial_stats, sizeof(struct TypeStats));
   }
   else
   {
      request->ios2_Req.io_Error = S2ERR_BAD_STATE;
      request->ios2_WireError = S2WERR_NOT_TRACKED;
   }

   /* Return */

   return TRUE;
}
Exemple #19
0
void SeriesTool::SetSelectedSeries(plot::Series * series)
{
    m_series = series;

    if (m_series != nullptr)

    {
        Enable();
        m_checkBox_name->SetLabel(m_series->GetSeriesName());
        m_checkBox_name->SetValue(m_series->GetRenderer()->GetVisible());

        m_slider_line_weight->SetValue(m_series->GetRenderer()->GetLine()->GetThickness());

        m_checkBox_line_visible->SetValue(m_series->GetRenderer()->GetLine()->GetVisible());

        m_combo_line_colour->SetColorSelection(m_series->GetRenderer()->GetLine()->GetColourIndex());

        m_slider_marks_size->SetValue(m_series->GetRenderer()->GetMarker()->GetSize());

        m_checkBox_marks_visible->SetValue(m_series->GetRenderer()->GetMarker()->GetVisible());

        m_combo_marks_colour->SetColorSelection(m_series->GetRenderer()->GetMarker()->GetFillColourIndex());

        m_combo_marks_style->SetMarkStyleSelection((plot::wxMarker *)(m_series->GetRenderer()->GetMarker()));
        Refresh();
    }
    else
    {
        Disable();
        m_checkBox_name->SetLabel("NA");
        m_checkBox_name->SetValue(false);

        m_slider_line_weight->SetValue(0);

        m_checkBox_line_visible->SetValue(false);

        m_combo_line_colour->SetColorSelection(0);

        m_slider_marks_size->SetValue(1);

        m_checkBox_marks_visible->SetValue(false);

        m_combo_marks_colour->SetColorSelection(0);

        Refresh();
    }
}
Exemple #20
0
void Arm::EnablePID(bool enable)
{
	if (enable && !isEnabled)
	{
		Enable();
		isEnabled = true;
	}
	else if(!enable && isEnabled)
	{
		Disable();
		isEnabled = false;
	}
	else
	{
		// DO NOTHING
	}
}
Exemple #21
0
/******* SerialUnit::Dispose() ***********************************/
OOP_Object *PCSerUnit__Root__Dispose(OOP_Class *cl, OOP_Object *obj, OOP_Msg msg)
{
    struct HIDDSerialUnitData * data;
    EnterFunc(bug("SerialUnit::Dispose()\n"));

    data = OOP_INST_DATA(cl, obj);

    Disable();
    CSD(cl->UserData)->units[data->unitnum] = NULL;
    Enable();

    /* stop all interrupts */
    serial_outp(data, UART_IER, 0);

    OOP_DoSuperMethod(cl, obj, (OOP_Msg)msg);
    ReturnPtr("SerialUnit::Dispose()", OOP_Object *, obj);
}
Exemple #22
0
static BOOL CmdUntrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
{
    struct SiS900Unit *unit;
    struct Opener *opener;
    ULONG packet_type;
    struct TypeTracker *tracker;
    struct TypeStats *initial_stats;

    unit = (APTR)request->ios2_Req.io_Unit;
    
D(bug("[%s]: S2CmdUntrackType()\n", unit->sis900u_name));
    
    packet_type = request->ios2_PacketType;

    /* Get global tracker and initial figures */

    tracker = (struct TypeTracker *)
        FindTypeStats(LIBBASE, unit, &unit->sis900u_type_trackers, packet_type);
    opener = request->ios2_BufferManagement;
    initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type);

    /* Decrement tracker usage and free unused structures */

    if(initial_stats != NULL)
    {
        if((--tracker->user_count) == 0)
        {
            Disable();
            Remove((APTR)tracker);
            Enable();
            FreeMem(tracker, sizeof(struct TypeTracker));
        }

        Remove((APTR)initial_stats);
        FreeMem(initial_stats, sizeof(struct TypeStats));
    }
    else
    {
        request->ios2_Req.io_Error = S2ERR_BAD_STATE;
        request->ios2_WireError = S2WERR_NOT_TRACKED;
    }

    /* Return */

    return TRUE;
}
void Render(Gwen::Skin::Base* skin)
{
    // Sanity.
    assert(skin != nullptr);
    if (skin == nullptr)
    {
        return;
    }

    if (_tooltip == nullptr)
    {
        return;
    }

    assert(_tooltip->GetTooltip() != nullptr);
    if (_tooltip->GetTooltip() == nullptr)
    {
        Disable(_tooltip);
        return;
    }

    Renderer::Base* render = skin->GetRender();
    assert(render != nullptr);
    if (render != nullptr)
    {
        Point old_offset = render->GetRenderOffset();
        Point mouse_position = Input::GetMousePosition();
        Rectangle bounds = _tooltip->GetTooltip()->GetBounds();

        Rectangle offset = Gwen::Rectangle(mouse_position._x - bounds._width / 2,
                                           mouse_position._y - bounds._height - 10,
                                           bounds._width,
                                           bounds._height);
        offset = Utility::ClampRectangleToRectangle(offset, _tooltip->GetCanvas()->GetBounds());

        // Calculate the offset on screen bounds.
        render->AddRenderOffset(Point(offset._x, offset._y));
        render->EndClipping();

        skin->DrawTooltip(_tooltip->GetTooltip());

        _tooltip->GetTooltip()->DoRender(skin);

        render->SetRenderOffset(old_offset);
    }
}
Exemple #24
0
void Ship::SetDockedWith(SpaceStation *s, int port)
{
	if (s) {
		m_dockedWith = s;
		m_dockedWithPort = port;
		m_wheelState = 1.0f;
		m_flightState = DOCKED;
		SetVelocity(vector3d(0,0,0));
		SetAngVelocity(vector3d(0,0,0));
		Disable();
		ClearThrusterState();
		m_dockedWith->SetDocked(this, port);
		onDock.emit();
	} else {
		Undock();
	}
}
void LaserFence::Toggle ()
{
    switch( m_mode )
    {
        case ModeDisabled:
        case ModeDisabling:
            Enable();
            break;

        case ModeEnabled:
        case ModeEnabling:
            Disable();
            break;
    }

	m_nextToggled = false;
}
void ShooterArm::TestPID(float setpoint,float p, float stage1I, float stage2I, float stage1D,float stage2D, float stage1Tol, float stage2Tol)
{
    //_maxFeedForward = 0.0;
    //float newFeedForward = 0.0;//_maxFeedForward * cos(GetCurrentRadians());
    //GetPIDController()->SetPID(p,i,d, newFeedForward);
    Disable();
    _bothStage_P = p;
    _stage_1_I = stage1I;
    _stage_2_I = stage2I;
    _stage_1_D = stage1D;
    _stage_2_D = stage2D;
    _stage_1_tolerance = stage1Tol;
    _stage_2_tolerance = stage2Tol;
    
    GetPIDController()->SetPID(_bothStage_P,_stage_1_I,_stage_1_D);
    SetAngle(setpoint);
}
Exemple #27
0
	BOOL CWinWow64FsRedirectionGuard::Enable()
	{
		if (!m_bChanged)
		{
			BOOL br = Disable();
			if (br)
				return br;
		}


		BOOL br = CWinModule_kernel32::Wow64EnableWow64FsRedirection(TRUE);
		if (!br)
			return FALSE;


		m_bChanged = TRUE;
		return TRUE;
	}
Exemple #28
0
void Metrobot::DisabledPeriodic(){

	UpdateOI();

	if( joystick->GetButtonDown( 4 ) ){
		autonScript = NO_SCRIPT;
	}
	if( joystick->GetButtonDown( 3 ) ){
		autonScript = SCRIPT_1;
	}
	if( joystick->GetButtonDown( 5 ) ){
		autonScript = SCRIPT_2;
	}
	
	Disable();
	GetWatchdog().Feed();

}
 CKilobotCommunicationEntity::CKilobotCommunicationEntity(CComposableEntity* pc_parent,
                                                          const std::string& str_id,
                                                          size_t un_msg_size,
                                                          Real f_range,
                                                          SAnchor& s_anchor,
                                                          CEmbodiedEntity& c_entity_body) :
    CPositionalEntity(pc_parent,
                      str_id),
    m_psAnchor(&s_anchor),
    m_fTxRange(f_range),
    m_pcEntityBody(&c_entity_body),
    m_eTxStatus(TX_NONE) {
    Disable();
    SetInitPosition(s_anchor.Position);
    SetPosition(GetInitPosition());
    SetInitOrientation(s_anchor.Orientation);
    SetOrientation(GetInitOrientation());
 }
	FSceneViewExtension(const TArray<FString>& InRenderPasses, bool bInCaptureFramesInHDR, int32 InHDRCompressionQuality, int32 InCaptureGamut, UMaterialInterface* InPostProcessingMaterial)
		: RenderPasses(InRenderPasses)
		, bNeedsCapture(true)
		, bCaptureFramesInHDR(bInCaptureFramesInHDR)
		, HDRCompressionQuality(InHDRCompressionQuality)
		, CaptureGamut(InCaptureGamut)
		, PostProcessingMaterial(InPostProcessingMaterial)
		, RestoreDumpHDR(0)
		, RestoreHDRCompressionQuality(0)
		, RestoreDumpGamut(HCGM_Rec709)
	{
		CVarDumpFrames = IConsoleManager::Get().FindConsoleVariable(TEXT("r.BufferVisualizationDumpFrames"));
		CVarDumpFramesAsHDR = IConsoleManager::Get().FindConsoleVariable(TEXT("r.BufferVisualizationDumpFramesAsHDR"));
		CVarHDRCompressionQuality = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SaveEXR.CompressionQuality"));
		CVarDumpGamut = IConsoleManager::Get().FindConsoleVariable(TEXT("r.TonemapperOutputGamut"));

		Disable();
	}