Exemplo n.º 1
0
void Counter::ResetToPeriod(bool bPeriod)
{
	DWORD periodtime = m_dwPeriodTime;
	Reset();
	SetPeriod(periodtime);
	m_dwCurTime = bPeriod ? m_dwPeriodTime : 0;
}
Exemplo n.º 2
0
void CCalloutConfigDialog::OnNMReleasedcaptureCalloutSliderTime(NMHDR *pNMHDR, LRESULT *pResult) {
    int iPos = m_sldTime.GetPos();
    /*m_spnTime.SetPos(iPos / 1000.0);
    SetCurrentPageInfo(iPos);*/
    SetPeriod(iPos);
    *pResult = 0;
}
Exemplo n.º 3
0
BOOL ArmDev::ConfigParameters(ST_ARM_CONSOLE_DEV_INF_PARA stIntfPara)
{
	if (!m_bDevInterfaceOK)
	{
		TRACE(TEXT("ARM_DEVICE_NOT_EIST \r\n"));
		return FALSE;
	}

	if (!SetDelay(stIntfPara.iDelayTime))
	{
		TRACE(TEXT("SetDelay Failed \r\n"));
		return FALSE;
	}

	Sleep(50);

	if (!SetPeriod(stIntfPara.iPriodTime))
	{
		TRACE(TEXT("SetPeriod Failed \r\n"));
		return FALSE;
	}

	Sleep(50);

	if (!SetPulseNum(stIntfPara.iPulseNum))
	{
		TRACE(TEXT("SetPulseNum Failed \r\n"));
		return FALSE;
	}
	return TRUE;
}
Exemplo n.º 4
0
void SetPWM(u8 dutycycle){
    T2CON=0x00;
    SetPeriod();
    SetDutyCycle(dutycycle);
    IO_CONFIG_OUT(PWMport,PWMpin);
    T2CON=0b110;
}
Exemplo n.º 5
0
bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
{
    Relocate(x, y, z, ang);

    if (!IsPositionValid())
    {
        TC_LOG_ERROR("entities.transport", "Transport (GUID: " UI64FMTD ") not created. Suggested coordinates isn't valid (X: %f Y: %f)",
            guidlow, x, y);
        return false;
    }

    Object::_Create(ObjectGuid::Create<HighGuid::Transport>(guidlow));

    GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
    if (!goinfo)
    {
        TC_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, guidlow: " UI64FMTD " map: %u  (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
        return false;
    }

    m_goInfo = goinfo;
    m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry);

    TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
    if (!tInfo)
    {
        TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str());
        return false;
    }

    _transportInfo = tInfo;

    // initialize waypoints
    _nextFrame = tInfo->keyFrames.begin();
    _currentFrame = _nextFrame++;
    _triggeredArrivalEvent = false;
    _triggeredDepartureEvent = false;

    if (m_goTemplateAddon)
    {
        SetFaction(m_goTemplateAddon->faction);
        SetUInt32Value(GAMEOBJECT_FLAGS, m_goTemplateAddon->flags);
    }

    m_goValue.Transport.PathProgress = 0;
    SetObjectScale(goinfo->size);
    SetPeriod(tInfo->pathTime);
    SetEntry(goinfo->entry);
    SetDisplayId(goinfo->displayId);
    SetGoState(!goinfo->moTransport.allowstopping ? GO_STATE_READY : GO_STATE_ACTIVE);
    SetGoType(GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT);
    SetGoAnimProgress(animprogress);
    SetName(goinfo->name);
    SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f);
    SetParentRotation(QuaternionData());

    m_model = CreateModel();
    return true;
}
Exemplo n.º 6
0
void CInteractionAreaDialog::OnNMReleasedcaptureCalloutSliderTime(NMHDR *pNMHDR, LRESULT *pResult)
{
    // TODO: Add your control notification handler code here
    int iPos = m_sldTime.GetPos();

    SetPeriod(iPos);
    *pResult = 0;
}
Exemplo n.º 7
0
void InfoWidget::SetDrawInfo(Draw *draw) {
	DrawInfo *info = draw->GetDrawInfo();
	if (info == NULL)
		return;
	SetUnit(info->GetUnit());
	SetColor(info->GetDrawColor());
	SetPrec(info->GetPrec());
	SetPeriod(draw->GetPeriod());
}
Exemplo n.º 8
0
BOOL CCalloutConfigDialog::OnInitDialog() {
    CDialog::OnInitDialog();

    // TODO:  Add extra initialization here
    /*CString csText;
    csText.Format(_T("%.3f"), (float)m_iCurrentMs/1000);
    m_edtTime.SetWindowText(csText);

    csText.Format(_T("%.3f"), (float)m_iDisplayPeriod/1000);
    m_edtPeriod.SetWindowText(csText);*/
    DWORD dwIds[] = {IDC_CALLOUT_LBL_PAGE_NAME,
        IDC_CALLOUT_LBL_PAGE_START,
        IDC_CALLOUT_LBL_PAGE_END,
        IDC_CALLOUT_LBL_DTIME,
        IDC_CALLOUT_LBL_DPERIOD,
        IDC_CALLOUT_TIME_SEC,          
        IDC_CALLOUT_PERIOD_SEC,         
        IDC_CALLOUT_BUTTON_CURRENT_TIME,
        IDC_CALLOUT_GROUP,
        IDC_CALLOUT_LBL_PAGE_LENGHT,
        IDOK,
        IDCANCEL,
        -1};
    MfcUtils::Localize(this, dwIds);

    /*CString csCallout;
    csCallout.LoadString(ID_GRAPHICALOBJECT_CALLOUT);
    CString csTextObject;
    csTextObject.LoadString(ID_GRAPHICALOBJECT_TEXT);
    CString csDisplay;
    csDisplay.LoadString(IDC_CALLOUT_LBL_DTIME);*/
    CString csTitle;// = csCallout + _T("\\")+ csTextObject + _T(" ") + csDisplay;
    csTitle.LoadString(IDS_GO_CONFIG_DIALOG_TITLE);
    SetWindowText(csTitle);
    m_spnTime.SetRangeAndDelta(0, m_iTotalLen / 1000.0, 0.001);
    m_spnTime.SetBuddy(&m_edtTime);
    m_spnTime.SetPos(m_iDisplayTime / 1000.0);
    m_spnTime.SetDecimalPlaces(3);

    m_sldTime.SetRange(0, m_iTotalLen);
    m_sldTime.SetTicFreq(1);
    m_sldTime.SetPos(m_iDisplayTime);

    m_spnPeriod.SetBuddy(&m_edtPeriod);
    m_spnPeriod.SetRangeAndDelta(0.01,  m_iTotalLen / 1000.0, 0.001);
    m_sldPeriod.SetRange(10, m_iTotalLen);
    m_sldPeriod.SetTicFreq(1);
    m_bInitialPeriod = true;
    SetPeriod(m_iDisplayTime);
    m_bInitialPeriod = false;

    SetCurrentPageInfo(m_iCurrentMs);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 9
0
void CInteractionAreaDialog::OnDeltaposCalloutSpinTime(NMHDR *pNMHDR, LRESULT *pResult)
{
    LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
    // TODO: Add your control notification handler code here
     float fPos = m_spnTime.GetPos();
    int iSldPos = fPos * 1000;
    m_sldTime.SetPos(iSldPos);
    SetPeriod(iSldPos);
    *pResult = 0;
}
Exemplo n.º 10
0
uint32 MultimediaClock::SetResolution(uint32 ms)
{
	if(m_CurrentPeriod == ms)
	{
		return m_CurrentPeriod;
	}
	Cleanup();
	SetPeriod(ms);
	return GetResolution();
}
Exemplo n.º 11
0
/**
 * Configure Timer 1 to provide a periodic 1mS interrupt.
 */
void Timer1::Enable()
{
    SetPeriod (1000);

    T1MCR = TxMCR_INT_ON_MR0 | TxMCR_RESET_ON_MR0;
    T1TCR = TxTCR_COUNTER_ENABLE;

    VICVectAddr8 = reinterpret_cast <uint32_t> (Timer1ISR);
    VICVectCntl8 = VICVectCntl_ENABLE | VIC_Channel_Timer1;
    VICIntEnable = (1 << VIC_Channel_Timer1);
}
int CGXDLMSDemandRegister::SetValue(int index, CGXDLMSVariant& value)
{
	if (index == 1)
	{
		if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
		{
			return ERROR_CODES_INVALID_PARAMETER;
		}
		memcpy(m_LN, &value.byteArr[0], 6);
		return ERROR_CODES_OK;
	}
    else if (index == 2)
    {
        SetCurrentAvarageValue(value.lVal);
    }
    else if (index == 3)
    {
        SetLastAvarageValue(value);
    }
    else if (index == 4)
    {
		m_Scaler = value.Arr[0].bVal;
		m_Unit = value.Arr[1].bVal;
    }
    else if (index == 5)
    {
		SetStatus(value.lVal);    
    }
    else if (index == 6)
    {
		CGXDLMSVariant tmp;
		CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_DATETIME, tmp);            
		SetCaptureTime(tmp.dateTime);
    }
    else if (index == 7)
    {
        CGXDLMSVariant tmp;
		CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_DATETIME, tmp);
        SetStartTimeCurrent(tmp.dateTime);
    }
    else if (index == 8)
    {
		SetPeriod(value.ulVal);
    }   
    else if (index == 9)
    {
        SetNumberOfPeriods(value.lVal);			
    }   
	else
	{
		return ERROR_CODES_INVALID_PARAMETER;
	}
	return ERROR_CODES_OK;
}
Exemplo n.º 13
0
bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
{
    Relocate(x, y, z, ang);

    if (!IsPositionValid())
    {
        TC_LOG_ERROR("entities.transport", "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
            guidlow, x, y);
        return false;
    }

    Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);

    GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);

    if (!goinfo)
    {
        TC_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u  (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
        return false;
    }

    m_goInfo = goinfo;

    TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
    if (!tInfo)
    {
        TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str());
        return false;
    }

    _transportInfo = tInfo;

    // initialize waypoints
    _nextFrame = tInfo->keyFrames.begin();
    _currentFrame = _nextFrame++;
    _triggeredArrivalEvent = false;
    _triggeredDepartureEvent = false;

    m_goValue.Transport.PathProgress = 0;
    SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
    SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
    SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
    SetPeriod(tInfo->pathTime);
    SetEntry(goinfo->entry);
    SetDisplayId(goinfo->displayId);
    SetGoState(!goinfo->moTransport.canBeStopped ? GO_STATE_READY : GO_STATE_ACTIVE);
    SetGoType(GAMEOBJECT_TYPE_MO_TRANSPORT);
    SetGoAnimProgress(animprogress);
    SetName(goinfo->name);
    UpdateRotationFields(0.0f, 1.0f);

    m_model = GameObjectModel::Create(*this);
    return true;
}
Exemplo n.º 14
0
nglTimer::nglTimer(nglTime Period) : mLastTime(0)
{
  mCallCnt = 0;
  mRunning = false;
  mCounter = 0;
  mRoundsPerTick = 0;
  
  SetPeriod(Period);

  App->AddTimer (this);
  sTimers.push_back(this);
}
PhoenixBase::PhoenixBase(){
	
	//----------Initialize Member Objects----------------
	m_Bot = new PhoenixRobot();
	m_ControlBoard = new PhoenixControlBoard();
	m_OpController = new OperatorController(m_ControlBoard);
	m_Constants = PhoenixConstants::GetInstance();
	//m_WinchState = Winch::UNLOCKING;
		
	//-----------------------------------------------------
	SetPeriod(HZ(ROBOT_HZ));
	GetWatchdog().SetEnabled(false);
	printf("Done constructing PhoenixBase!\n");
}
Exemplo n.º 16
0
nglTimer::nglTimer(nglTime Period)
{
  mCounter = 0;
  mRoundsPerTick = 0;
  mCallCnt = 0;
  //mTimerID = 0;
  mRunning = false;
  SetPeriod(Period);

  mCounter = mRoundsPerTick;

  mLastTick = nglTime::GetTime();
  mTimers.push_back(this);
  InitMainTimer();
}
Exemplo n.º 17
0
void CWatchdog::Reboot()
{
    SetPeriod(10);
    Enable();
    while(1);
}
Exemplo n.º 18
0
    /**
     * Robot-wide initialization code should go here.
     * 
     * Use this method for default Robot-wide initialization which will
     * be called when the robot is first powered on.  It will be called exactly 1 time.
     */
    void RobotInit()
    {
printf(">>> RobotInit\n");

	LogInit();

#ifdef HAVE_COMPRESSOR
	compressor  = new Compressor(1, 1);
#endif

#ifdef HAVE_TOP_WHEEL
#ifdef HAVE_TOP_CAN1
	topWheel1    = new CANJaguar(1);
	topWheel1->SetSafetyEnabled(false);	// motor safety off while configuring
	topWheel1->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
	topWheel1->ConfigEncoderCodesPerRev( 1 );
#endif
#ifdef HAVE_TOP_PWM1
	topWheel1    = new Victor(1);
	topWheel1->SetSafetyEnabled(false);	// motor safety off while configuring
#endif
#ifdef HAVE_TOP_CAN2
	topWheel2    = new CANJaguar(2);
	topWheel2->SetSafetyEnabled(false);	// motor safety off while configuring
	topWheel2->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
	topWheel2->ConfigEncoderCodesPerRev( 1 );
#endif
	topTach      = new Tachometer(2);
#endif

#ifdef HAVE_BOTTOM_WHEEL
#ifdef HAVE_BOTTOM_CAN1
	bottomWheel1 = new CANJaguar(3);
	bottomWheel1->SetSafetyEnabled(false);	// motor safety off while configuring
	bottomWheel1->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
	bottomWheel1->ConfigEncoderCodesPerRev( 1 );
#endif
#ifdef HAVE_BOTTOM_PWM1
	bottomWheel1 = new Victor(2);
	bottomWheel1->SetSafetyEnabled(false);	// motor safety off while configuring
#endif
#ifdef HAVE_BOTTOM_CAN2
	bottomWheel2 = new CANJaguar(4);
	bottomWheel2->SetSafetyEnabled(false);	// motor safety off while configuring
	bottomWheel2->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
	bottomWheel2->ConfigEncoderCodesPerRev( 1 );
#endif
	bottomTach   = new Tachometer(3);
#endif

#ifdef HAVE_ARM
	arm          = new DoubleSolenoid(2, 1);
#endif
#ifdef HAVE_INJECTOR
	injectorL    = new DoubleSolenoid(5, 3);
	injectorR    = new DoubleSolenoid(6, 4);
#endif
#ifdef HAVE_EJECTOR
	ejector      = new Solenoid(7);
#endif
#ifdef HAVE_LEGS
	legs         = new Solenoid(8);
#endif

	ds           = DriverStation::GetInstance();
	eio          = &ds->GetEnhancedIO();
	gamepad      = new Joystick(1);

	LiveWindow *lw = LiveWindow::GetInstance();
#ifdef HAVE_COMPRESSOR
	lw->AddActuator("K9", "Compressor", compressor);
#endif
#ifdef HAVE_TOP_WHEEL
#ifdef HAVE_TOP_CAN1
	lw->AddActuator("K9", "Top1",       topWheel1);
#endif
#ifdef HAVE_TOP_PWM1
	lw->AddActuator("K9", "Top1",       topWheel1);
#endif
#ifdef HAVE_TOP_CAN2
	lw->AddActuator("K9", "Top2",       topWheel2);
#endif
#endif
#ifdef HAVE_BOTTOM_WHEEL
#ifdef HAVE_BOTTOM_CAN1
	lw->AddActuator("K9", "Bottom1",    bottomWheel1);
#endif
#ifdef HAVE_BOTTOM_PWM1
	lw->AddActuator("K9", "Bottom1",    bottomWheel1);
#endif
#ifdef HAVE_BOTTOM_CAN2
	lw->AddActuator("K9", "Bottom2",    bottomWheel2);
#endif
#endif
#ifdef HAVE_ARM
	lw->AddActuator("K9", "Arm",        arm);
#endif
#ifdef HAVE_INJECTOR
	lw->AddActuator("K9", "InjectorL",  injectorL);
	lw->AddActuator("K9", "InjectorR",  injectorR);
#endif
#ifdef HAVE_EJECTOR
	lw->AddActuator("K9", "Ejector",    ejector);
#endif
#ifdef HAVE_LEGS
	lw->AddActuator("K9", "Legs",       legs);
#endif

	SmartDashboard::PutNumber("Shooter P", kP);
	SmartDashboard::PutNumber("Shooter I", kI);
	SmartDashboard::PutNumber("Shooter D", kD);

	spinFastNow = false;

#ifdef HAVE_TOP_WHEEL
	SmartDashboard::PutNumber("Top Set      ", topSpeed);
#ifdef HAVE_TOP_CAN1
	SmartDashboard::PutNumber("Top Current 1", 0.0);
#endif
#ifdef HAVE_TOP_CAN2
	SmartDashboard::PutNumber("Top Current 2", 0.0);
	SmartDashboard::PutNumber("Top Jag      ", 0.0);
#endif
	SmartDashboard::PutNumber("Top Tach     ", 0.0);
#endif

#ifdef HAVE_BOTTOM_WHEEL
	SmartDashboard::PutNumber("Bottom Set      ", bottomSpeed);
#ifdef HAVE_BOTTOM_CAN1
	SmartDashboard::PutNumber("Bottom Current 1", 0.0);
#endif
#ifdef HAVE_BOTTOM_CAN2
	SmartDashboard::PutNumber("Bottom Current 2", 0.0);
	SmartDashboard::PutNumber("Bottom Jag      ", 0.0);
#endif
	SmartDashboard::PutNumber("Bottom Tach     ", 0.0);
#endif

	SetPeriod(0); 	//Set update period to sync with robot control packets (20ms nominal)

printf("<<< RobotInit\n");
    }
Exemplo n.º 19
0
BOOL CInteractionAreaDialog::OnInitDialog() 
{
    CDialog::OnInitDialog();

    CString csTitle;
    csTitle.LoadString(CInteractionAreaDialog::IDD);
    SetWindowText(csTitle);

    DWORD dwIds[] = {IDC_ACTION_AC,
        IDC_ACTION_MU,
        IDC_ACTION_MD,
        IDC_ACTION_MI,
        IDC_ACTION_MO,
        IDC_IF_ACTIVATED,
        IDC_IF_MOUSEUP,
        IDC_IF_MOUSEDOWN,
        IDC_IF_MOUSEIN,
        IDC_IF_MOUSEOUT,
        IDC_INTERACTIONAREA_ACTIVE,
        IDC_AC_ALL_PAGES,
        IDC_AC_CURRENT_PAGE,
        IDC_AC_CURRENT_TIMESTAMP,
        IDC_AC_END_OF_PAGE,
        IDC_STOP_REPLAY,
        IDC_SET_STOPMARK,
        IDC_SHOW_MOUSECURSOR,
        IDC_ACTIV_START_REPLAY,
        IDC_ACTIV_STOP_REPLAY,
        IDC_MOUSEIN_START_REPLAY,
        IDC_MOUSEIN_STOP_REPLAY,
        IDC_MOUSEOUT_START_REPLAY,
        IDC_MOUSEOUT_STOP_REPLAY,
        IDC_MOUSEUP_START_REPLAY,
        IDC_MOUSEUP_STOP_REPLAY,
        IDC_MOUSEDOWN_START_REPLAY,
        IDC_MOUSEDOWN_STOP_REPLAY,
        IDC_CALLOUT_LBL_DTIME,
        IDC_CALLOUT_LBL_DPERIOD,
        IDC_CALLOUT_TIME_SEC,          
        IDC_CALLOUT_PERIOD_SEC,
        IDOK,
        IDCANCEL,
        -1};
    MfcUtils::Localize(this, dwIds);

    CString csCustom;
    csCustom.LoadString(IDS_PAGE_SIZE_CUSTOM);
    GetDlgItem(IDC_AC_CHOOSE)->SetWindowText(csCustom);

    m_btnActivationIntern.SetBitmap(m_hBitmap);
    m_btnMouseDownIntern.SetBitmap(m_hBitmap);
    m_btnMouseUpIntern.SetBitmap(m_hBitmap);
    m_btnMouseEnterIntern.SetBitmap(m_hBitmap);
    m_btnMouseLeaveIntern.SetBitmap(m_hBitmap);

    CStringArray aActionStrings;
    CMouseAction::GetActionStrings(aActionStrings, m_pEditorDoc && m_pEditorDoc->project.FirstQuestionnaireIsRandomTest());
    for (int i = 0; i < aActionStrings.GetSize(); ++i)
    {
        m_wndClickAction.AddString(aActionStrings[i]);
        m_wndUpAction.AddString(aActionStrings[i]);
        m_wndDownAction.AddString(aActionStrings[i]);
        m_wndEnterAction.AddString(aActionStrings[i]);
        m_wndLeaveAction.AddString(aActionStrings[i]);

        int iItemData = i;
        if (!(m_pEditorDoc && m_pEditorDoc->project.FirstQuestionnaireIsRandomTest()) && i >= INTERACTION_JUMP_RANDOM_QUESTION) {
            iItemData = i + 1;
        }

        m_wndClickAction.SetItemData(i, iItemData);
        m_wndUpAction.SetItemData(i, iItemData);
        m_wndDownAction.SetItemData(i, iItemData);
        m_wndEnterAction.SetItemData(i, iItemData);
        m_wndLeaveAction.SetItemData(i, iItemData);
    }

    int iStart = 0;
    if (m_pInteractionArea) {
        if (m_pInteractionArea->GetClickAction()) {
            UpdateMouseAction(ACTION_ACTIVATION, IDC_ACTIVATION_DESTINATION, m_pInteractionArea->GetClickAction(), &m_wndClickAction, &m_cbActivStartReplay, &m_cbActivStopReplay);
        } else {
            UpdateMouseAction(&m_wndClickAction, &m_cbActivStartReplay, &m_cbActivStopReplay);
        }

        if (m_pInteractionArea->GetUpAction()) {
            UpdateMouseAction(ACTION_MOUSEUP, IDC_MOUSEUP_DESTINATION, m_pInteractionArea->GetUpAction(), &m_wndUpAction, &m_cbMouseupStartReplay, &m_cbMouseupStopReplay);
        } else {
            UpdateMouseAction(&m_wndUpAction, &m_cbMouseupStartReplay, &m_cbMouseupStopReplay);
        }

        if (m_pInteractionArea->GetDownAction()) {
            UpdateMouseAction(ACTION_MOUSEDOWN, IDC_MOUSEDOWN_DESTINATION, m_pInteractionArea->GetDownAction(), &m_wndDownAction, &m_cbMousedownStartReplay, &m_cbMousedownStopReplay);
        } else {
            UpdateMouseAction(&m_wndDownAction, &m_cbMousedownStartReplay, &m_cbMousedownStopReplay);
        }

        if (m_pInteractionArea->GetEnterAction()) {
            UpdateMouseAction(ACTION_MOUSEIN, IDC_MOUSEIN_DESTINATION, m_pInteractionArea->GetEnterAction(), &m_wndEnterAction, &m_cbMouseinStartReplay, &m_cbMouseinStopReplay);
        } else {
            UpdateMouseAction(&m_wndEnterAction, &m_cbMouseinStartReplay, &m_cbMouseinStopReplay);
        }

        if (m_pInteractionArea->GetLeaveAction()) {
            UpdateMouseAction(ACTION_MOUSEOUT, IDC_MOUSEOUT_DESTINATION, m_pInteractionArea->GetLeaveAction(), &m_wndLeaveAction, &m_cbMouseoutStartReplay, &m_cbMouseoutStopReplay);
        } else {
            UpdateMouseAction(&m_wndLeaveAction, &m_cbMouseoutStartReplay, &m_cbMouseoutStopReplay);
        }


        AreaPeriodId periodId = m_pInteractionArea->GetActivityPeriod();
        AreaPeriodId periodVisible = m_pInteractionArea->GetVisibilityPeriod();
        iStart = m_pInteractionArea->GetVisibilityStart();
        int iLength = m_pInteractionArea->GetVisibilityLength();
        int iRadioButtonId = IDC_AC_CURRENT_PAGE;
        switch (periodId)
        {
        case INTERACTION_PERIOD_PAGE:
            iRadioButtonId = IDC_AC_CURRENT_PAGE;
            break;
        case INTERACTION_PERIOD_END_PAGE:
            iRadioButtonId = IDC_AC_END_OF_PAGE;
            break;
        case INTERACTION_PERIOD_TIME:
            iRadioButtonId = IDC_AC_CURRENT_TIMESTAMP;
            break;
        case INTERACTION_PERIOD_ALL_PAGES:
            iRadioButtonId = IDC_AC_ALL_PAGES;
            break;
        }
        if (periodVisible == INTERACTION_PERIOD_TIME && iLength != 1)
            iRadioButtonId = IDC_AC_CHOOSE;

        CheckRadioButton(IDC_AC_ALL_PAGES, IDC_AC_CHOOSE, iRadioButtonId);

        m_bShowMouseCursor = m_pInteractionArea->IsHandCursor() == true ? TRUE : FALSE;
    }
    else
    {
        m_wndClickAction.SetCurSel(INTERACTION_JUMP_NEXT_PAGE);
        m_wndUpAction.SetCurSel(INTERACTION_NO_ACTION);
        m_wndDownAction.SetCurSel(INTERACTION_NO_ACTION);
        m_wndEnterAction.SetCurSel(INTERACTION_NO_ACTION);
        m_wndLeaveAction.SetCurSel(INTERACTION_NO_ACTION);
        CheckRadioButton(IDC_AC_ALL_PAGES, IDC_AC_CHOOSE, IDC_AC_CHOOSE);
        iStart = m_pEditorDoc->GetCurrentPreviewPos();

        m_bShowMouseCursor = FALSE;
    }

    m_spnTime.SetRangeAndDelta(0, m_pEditorDoc->m_displayEndMs / 1000.0, 0.001);
    m_spnTime.SetBuddy(&m_edtTime);
    m_spnTime.SetPos(iStart / 1000.0);
    m_spnTime.SetDecimalPlaces(3);

    m_sldTime.SetRange(0, m_pEditorDoc->m_displayEndMs);
    m_sldTime.SetTicFreq(1);
    m_sldTime.SetPos(iStart);

    m_spnPeriod.SetBuddy(&m_edtPeriod);
    m_spnPeriod.SetRangeAndDelta(0.01,  m_pEditorDoc->m_displayEndMs / 1000.0, 0.001);
    m_sldPeriod.SetRange(10, m_pEditorDoc->m_displayEndMs);
    m_sldPeriod.SetTicFreq(1);
    m_bInitialPeriod = true;
    SetPeriod(iStart);
    m_bInitialPeriod = false;

    CButton *pCheckButton = (CButton *)GetDlgItem(IDC_SHOW_MOUSECURSOR);
    pCheckButton->SetCheck(m_bShowMouseCursor);

   /* CRect rcOK;
    m_btnOK.GetWindowRect(&rcOK);
    CRect rcBack;
    m_stBottom.GetWindowRect(&rcBack);*/
   

    int screenY = GetSystemMetrics(SM_CYMAXIMIZED);

    CRect rcWin;
    GetWindowRect(&rcWin);
    /*m_iButtonVOffset = rcWin.bottom - rcOK.bottom;
    m_iBackVOffset = rcWin.bottom - rcBack.bottom;*/

    m_szInitial = rcWin.Size();
    
   /* if( screenY < rcWin.Height() + 40) {
        rcWin.top = 20;
        rcWin.bottom = screenY - 20;
    }*/
    
    m_pScrollHelper->AttachWnd(this);
    m_pScrollHelper->SetDisplaySize(m_szInitial.cx - 20, m_szInitial.cy );
    m_bIsInitialized = true;

   /* MoveWindow(&rcWin, TRUE);
    CenterWindow();*/

    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
}
Exemplo n.º 20
0
ASIC11096SPI::ASIC11096SPI(UInt8 period)
{
	SetPeriod(period);
}
Exemplo n.º 21
0
fsDldHistRecFilter_DuringPeriod::fsDldHistRecFilter_DuringPeriod()
{
	SetPeriod (0);	
}
Exemplo n.º 22
0
void BudgetWindow::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case M_SELECT_CATEGORY:
		{
			HandleCategorySelection();
			fAmountBox->MakeFocus(true);
			break;
		}
		case M_AMOUNT_CHANGED:
		{
			BString str(fAmountBox->Text());
			if(str.CountChars()<1)
				str = "0";

			Fixed f;
			if(gDefaultLocale.StringToCurrency(str.String(),f)!=B_OK)
				break;
			f.Round();
			gDefaultLocale.CurrencyToString(f,str);
			str.Truncate(str.FindFirst(gDefaultLocale.CurrencyDecimal()));
			str.RemoveFirst(gDefaultLocale.CurrencySymbol());

			BRow *row = fCategoryList->CurrentSelection();
			if(!row)
				break;

			row->SetField(new BStringField(str.String()),1);
			fCategoryList->UpdateRow(row);

			BudgetEntry entry;
			gDatabase.GetBudgetEntry( ((BStringField*)row->GetField(0))->String(),entry );
			entry.amount = f;
			if(entry.isexpense)
				entry.amount.Invert();
			gDatabase.AddBudgetEntry(entry);

			RefreshBudgetGrid();
			RefreshBudgetSummary();

			fBudgetSummary->SetFocusRow( entry.isexpense ? 1 : 0);
			fBudgetSummary->SetFocusRow(2);
			break;
		}
		case M_BUDGET_RECALCULATE:
		{
			GenerateBudget(false);
			RefreshBudgetGrid();
			RefreshBudgetSummary();
			RefreshCategories();
			break;
		}
		case M_BUDGET_ZERO:
		{
			GenerateBudget(true);
			RefreshBudgetGrid();
			RefreshBudgetSummary();
			RefreshCategories();
			break;
		}
		case M_SET_PERIOD_MONTH:
		{
			SetPeriod(BUDGET_MONTHLY);
			break;
		}
		case M_SET_PERIOD_WEEK:
		{
			SetPeriod(BUDGET_WEEKLY);
			break;
		}
		case M_SET_PERIOD_QUARTER:
		{
			SetPeriod(BUDGET_QUARTERLY);
			break;
		}
		case M_SET_PERIOD_YEAR:
		{
			SetPeriod(BUDGET_ANNUALLY);
			break;
		}
		case M_NEXT_FIELD:
		{
			if(fAmountBox->ChildAt(0)->IsFocus())
				fMonthly->MakeFocus(true);
			break;
		}
		case M_PREVIOUS_FIELD:
		{
			if(fAmountBox->ChildAt(0)->IsFocus())
				fCategoryList->MakeFocus(true);
			break;
		}
		default:
			BWindow::MessageReceived(msg);
	}
}