示例#1
0
BOOL CScrollV::ScrollRow(int nRow)
{
    int nNewPos = m_nCurrentPos + nRow * m_nRowRange;
    if(nNewPos < 0)
    {
        nNewPos = 0;
    } else if(nNewPos > m_nMaxRange)
    {
        nNewPos = m_nMaxRange;
    }
    BOOL bRet = (nNewPos != m_nCurrentPos);
    m_nCurrentPos = nNewPos;
    SetRange();
    return bRet;
}
示例#2
0
// Create the CProgressCtrl as a child of the status bar positioned
// over the first pane, extending "nSize" percentage across pane.
// Sets the range to be 0 to MaxValue, with a step of 1.
BOOL CProgressBar::Create(LPCTSTR strMessage, int nSize /*=100*/, 
						  int MaxValue /*=100*/, BOOL bSmooth /*=FALSE*/, 
                          int nPane /*=0*/)
{
	BOOL bSuccess = FALSE;
	
	CStatusBar *pStatusBar = GetStatusBar();
	if (!pStatusBar)
		return FALSE;

	DWORD dwStyle = WS_CHILD|WS_VISIBLE;
#ifdef PBS_SMOOTH	 
	if (bSmooth)
		dwStyle |= PBS_SMOOTH;
#endif

    // Until m_nPane is initialized, Resize() must not be called. But it can be called (which 
    // happens in multi-threaded programs) in CProgressBar::OnEraseBkgnd after the control is 
    // created in CProgressBar::Create.
    m_strMessage  = strMessage;	
    m_nSize 	  = nSize;	
    m_nPane 	  = nPane;	
    m_strPrevText = pStatusBar->GetPaneText(m_nPane); 

	// Get CRect coordinates for requested status bar pane
	CRect PaneRect;
	pStatusBar->GetItemRect(nPane, &PaneRect);

	// Create the progress bar
	bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1);
	ASSERT(bSuccess);
	if (!bSuccess)
		return FALSE;

	// Set range and step
	SetRange(0, MaxValue);
	SetStep(1);

	m_strMessage  = strMessage;
	m_nSize 	  = nSize;
	m_nPane 	  = nPane;
    m_strPrevText = pStatusBar->GetPaneText(m_nPane); 

	// Resize the control to its desired width
	Resize();

	return TRUE;
}
示例#3
0
/** Support objects created, start application specific content. */
void UApp::Start() {
    // the mouse must be in cursor mode before setting the UI.
    auto input_ = GetSubsystem< Urho3D::Input >();
    input_->SetMouseVisible(true);

    // resources origin.
    cache_ = GetSubsystem< Urho3D::ResourceCache >();

    // use the default style from Urho3D.
    GetSubsystem< Urho3D::UI >()->GetRoot()->SetDefaultStyle(
                cache_->GetResource< Urho3D::XMLFile >("UI/DefaultStyle.xml"));

    // grab mouse
    input_->SetMouseGrabbed(true);

    // setup scene to render.
    scene_ = new Urho3D::Scene(context_);
    scene_->CreateComponent< Urho3D::Octree >();

    // Create the light
    {
        auto lightNode = scene_->CreateChild("Light");
        lightNode->SetPosition(Urho3D::Vector3(6, 6, -20));
        auto light = lightNode->CreateComponent< Urho3D::Light >();
        light->SetLightType(Urho3D::LIGHT_POINT);
        light->SetRange(1000);
    }

    // setup camera
    {
        auto cameraNode_ = scene_->CreateChild("Camera");
        cameraNode_->SetPosition(Urho3D::Vector3(6, 6, -20));
        auto camera_ = cameraNode_->CreateComponent< Urho3D::Camera >();
        camera_->SetFarClip(2000);
        auto renderer = GetSubsystem< Urho3D::Renderer >();
        Urho3D::SharedPtr< Urho3D::Viewport > viewport(new Urho3D::Viewport(context_, scene_, camera_));
        renderer->SetViewport(0, viewport);
    }

    // start the game
    game.start();

    // subscribe to events
    SubscribeToEvent(Urho3D::E_UPDATE,URHO3D_HANDLER(UApp,HandleUpdate));
    SubscribeToEvent(Urho3D::E_KEYDOWN,URHO3D_HANDLER(UApp,HandleKeyDown));
    SubscribeToEvent(Urho3D::E_KEYUP,URHO3D_HANDLER(UApp,HandleKeyUp));
}
示例#4
0
bool wxSpinCtrl::Reparent(wxWindowBase *newParent)
{
    // Reparenting both the updown control and its buddy does not seem to work:
    // they continue to be connected somehow, but visually there is no feedback
    // on the buddy edit control. To avoid this problem, we reparent the buddy
    // window normally, but we recreate the updown control and reassign its
    // buddy.

    // Get the position before changing the parent as it would be offset after
    // changing it.
    const wxRect rect = GetRect();

    if ( !wxWindowBase::Reparent(newParent) )
        return false;

    newParent->GetChildren().DeleteObject(this);

    // destroy the old spin button after detaching it from this wxWindow object
    // (notice that m_hWnd will be reset by UnsubclassWin() so save it first)
    const HWND hwndOld = GetHwnd();
    UnsubclassWin();
    if ( !::DestroyWindow(hwndOld) )
    {
        wxLogLastError(wxT("DestroyWindow"));
    }

    // create and initialize the new one
    if ( !wxSpinButton::Create(GetParent(), GetId(),
                               rect.GetPosition(), rect.GetSize(),
                               GetWindowStyle(), GetName()) )
        return false;

    // reapply our values to wxSpinButton
    wxSpinButton::SetValue(GetValue());
    SetRange(m_min, m_max);

    // also set the size again with wxSIZE_ALLOW_MINUS_ONE flag: this is
    // necessary if our original position used -1 for either x or y
    SetSize(rect, wxSIZE_ALLOW_MINUS_ONE);

    // associate it with the buddy control again
    ::SetParent(GetBuddyHwnd(), GetHwndOf(GetParent()));
    (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0);

    return true;
}
ssize_t
DaemonSocketPDU::Receive(int aFd)
{
  struct iovec iv;
  memset(&iv, 0, sizeof(iv));
  iv.iov_base = GetData(0);
  iv.iov_len = GetAvailableSpace();

  uint8_t cmsgbuf[CMSG_SPACE(sizeof(int)* MAX_NFDS)];

  struct msghdr msg;
  memset(&msg, 0, sizeof(msg));
  msg.msg_iov = &iv;
  msg.msg_iovlen = 1;
  msg.msg_control = cmsgbuf;
  msg.msg_controllen = sizeof(cmsgbuf);

  ssize_t res = TEMP_FAILURE_RETRY(recvmsg(aFd, &msg, MSG_NOSIGNAL));
  if (res < 0) {
    MOZ_ASSERT(errno != EBADF); /* internal error */
    OnError("recvmsg", errno);
    return -1;
  }
  if (msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) {
    return -1;
  }

  SetRange(0, res);

  struct cmsghdr* chdr = CMSG_FIRSTHDR(&msg);

  for (; chdr; chdr = CMSG_NXTHDR(&msg, chdr)) {
    if (NS_WARN_IF(!CMSGHDR_CONTAINS_FD(chdr))) {
      continue;
    }
    // Retrieve sent file descriptors.
    size_t fdCount = (chdr->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) / sizeof(int);
    for (size_t i = 0; i < fdCount; i++) {
      int* receivedFd = static_cast<int*>(CMSG_DATA(chdr)) + i;
      mReceivedFds.AppendElement(*receivedFd);
    }
  }

  return res;
}
示例#6
0
void COScopeCtrl::OnSize(UINT nType, int cx, int cy) 
{
  CWnd::OnSize(nType, cx, cy) ;

  // NOTE: OnSize automatically gets called during the setup of the control
  
  GetClientRect(m_rectClient) ;
 

  // set some member variables to avoid multiple function calls
  m_nClientHeight = m_rectClient.Height() ;
  m_nClientWidth  = m_rectClient.Width() ;

  // the "left" coordinate and "width" will be modified in 
  // InvalidateCtrl to be based on the width of the y axis scaling
  m_rectPlot.left   = 20 ;  
  m_rectPlot.top    = 10 ;
  m_rectPlot.right  = m_rectClient.right-10 ;
  m_rectPlot.bottom = m_rectClient.bottom-25 ;

  // set some member variables to avoid multiple function calls
  m_nPlotHeight = m_rectPlot.Height() ;
  m_nPlotWidth  = m_rectPlot.Width() ;

  // set the scaling factor for now, this can be adjusted 
  // in the SetRange functions
  m_dVerticalFactor = (double)m_nPlotHeight / m_dRange ; 

#ifdef WINCE
	// 최초 실행시 SetRange를 호출 할 수 있도록 0로 설정
  static DRA::DisplayMode mode = DRA::Portrait;//
	

	DRA::DisplayMode newMode = DRA::GetDisplayMode();

	if(mode != newMode)	{		mode = newMode;	}

	// Orientation 에 상관 없이 
	// x, y  축이 변경될 가능성이 있기 때문에, SetRange로 갱신 필요.
	SetRange(m_dLowerLimit, m_dUpperLimit, m_nYDecimals);
#endif

} // OnSize
BOOL CGraphShowDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	if (m_uiADCFileLength > 0)
	{
		m_pSampleData = new double[m_uiADCFileLength];
	}
		// 创建绘图控件并设置相关参数
 	CreateGraph(IDC_STATIC_GRAPHSHOW, &m_OScopeCtrl);
	// customize the control
	SetRange(DrawGraphYAxisLower, DrawGraphYAxisUpper, DecimalPlaces, &m_OScopeCtrl) ;
 	SetYUnits(DrawGraphYAxisLabel, &m_OScopeCtrl) ;
 	SetXUnits(DrawGraphXAxisLabel, &m_OScopeCtrl) ;
 	SetBackgroundColor(DrawGraphSetBackgroundColor, &m_OScopeCtrl) ;
 	SetGridColor(DrawGraphSetGridColor, &m_OScopeCtrl) ;
 	SetPlotColor(DrawGraphSetPlotColor, &m_OScopeCtrl) ;

	m_Sec_GraphADCShow.Lock();
	m_uiADCGraphDrowFromNb = (m_pADCDataRecThread->m_uiADCDataFrameCount[m_uiADCGraphNb - 1]) * ReceiveDataSize;
	m_Sec_GraphADCShow.Unlock();

	if (m_uiADCGraphDrowFromNb > m_OScopeCtrl.m_uiXAxisPointNum)
	{
		m_OScopeCtrl.m_uiXAxisLabelMax = m_uiADCGraphDrowFromNb;
	}
	else
	{
		m_OScopeCtrl.m_uiXAxisLabelMax = m_OScopeCtrl.m_uiXAxisPointNum;
	}
	m_OScopeCtrl.m_uiXAxisLabelMin = m_OScopeCtrl.m_uiXAxisLabelMax - m_OScopeCtrl.m_uiXAxisPointNum;
	m_OScopeCtrl.Reset(false);
	m_OScopeCtrl.m_dPreviousPosition = 0.0;
	m_OScopeCtrl.m_uiPointNum = m_uiADCGraphDrowFromNb;	// 绘制了的点的个数

//	OnSetHScrollBarRange();
	m_OScopeCtrl.m_bStopSample = m_bStopSample;
	m_Sec_GraphADCShow.Lock();
	m_pADCDataRecThread->m_pOScopeCtrl[m_uiADCGraphNb - 1] = &m_OScopeCtrl;
	m_pADCDataRecThread->m_uiADCGraphIP[m_uiADCGraphNb - 1] =  IPSetAddrStart + IPSetAddrInterval * m_uiADCGraphNb;
	m_Sec_GraphADCShow.Unlock();
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
void LimitSlider::setRange( float min, float max )
{
	ASSERT( min >= mMinLimit );
	ASSERT( max <= mMaxLimit );
	if( min != mMin || max != mMax )
	{
		float value = getValue();
		mMin = min;
		mMax = max;
		int sliderMin = BW_ROUND_TO_INT( mMin * powf( 10.f, (float)mDigits ) );
		int sliderMax = BW_ROUND_TO_INT( mMax * powf( 10.f, (float)mDigits ) );
		SetRange( sliderMin, sliderMax, TRUE );
		if( value < min )
			value = min;
		if( value > max )
			value = max;
		setValue( value );
	}
}
示例#9
0
bool CGUIScrollBar::OnMessage(CGUIMessage& message)
{
  switch (message.GetMessage())
  {
  case GUI_MSG_ITEM_SELECT:
    SetValue(message.GetParam1());
    return true;
  case GUI_MSG_LABEL_RESET:
    SetRange(message.GetParam1(), message.GetParam2());
    return true;
  case GUI_MSG_PAGE_UP:
    Move(-1);
    return true;
  case GUI_MSG_PAGE_DOWN:
    Move(1);
    return true;
  }
  return CGUIControl::OnMessage(message);
}
示例#10
0
CChart2D::CChart2D()
: m_chartTitle(_T(""))
, m_strLabelX(_T(""))
, m_strLabelY(_T(""))
, m_normalBackColor(RGB(255,255,255))
, m_normalAxisColor(RGB(0,0,0))
, m_normalGridColor(RGB(120,120,120))
, m_normalTitleColor(RGB(0,0,0))
, m_normalLabelColor(RGB(0,0,0))
, m_grid_x(10)
, m_grid_y(10)
, mp_legendFontY(NULL)
, mp_legendFontX(NULL)
, mp_titleFont(NULL)
, m_updateBackground(true)
, m_axisFmtX("%5.1f")
{
 SetRange(-10, 10, -10, 10);
}
示例#11
0
/**
 * Internal common init function.
 */
void ADXL345_SPI::Init(Range range)
{
		m_spi = new SPI(m_port);
		m_spi->SetClockRate(500000);
		m_spi->SetMSBFirst();
		m_spi->SetSampleDataOnFalling();
		m_spi->SetClockActiveLow();
		m_spi->SetChipSelectActiveHigh();

		uint8_t commands[2];
		// Turn on the measurements
		commands[0] = kPowerCtlRegister;
		commands[1] = kPowerCtl_Measure;
		m_spi->Transaction(commands, commands, 2);

		SetRange(range);

		HALReport(HALUsageReporting::kResourceType_ADXL345, HALUsageReporting::kADXL345_SPI);
}
示例#12
0
ssize_t
DaemonSocketPDU::Receive(int aFd)
{
  struct iovec iv;
  memset(&iv, 0, sizeof(iv));
  iv.iov_base = GetData(0);
  iv.iov_len = GetAvailableSpace();

  uint8_t cmsgbuf[CMSG_SPACE(sizeof(int))];

  struct msghdr msg;
  memset(&msg, 0, sizeof(msg));
  msg.msg_iov = &iv;
  msg.msg_iovlen = 1;
  msg.msg_control = cmsgbuf;
  msg.msg_controllen = sizeof(cmsgbuf);

  ssize_t res = TEMP_FAILURE_RETRY(recvmsg(aFd, &msg, MSG_NOSIGNAL));
  if (res < 0) {
    MOZ_ASSERT(errno != EBADF); /* internal error */
    OnError("recvmsg", errno);
    return -1;
  }
  if (msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) {
    return -1;
  }

  SetRange(0, res);

  struct cmsghdr *chdr = CMSG_FIRSTHDR(&msg);

  for (; chdr; chdr = CMSG_NXTHDR(&msg, chdr)) {
    if (NS_WARN_IF(!CMSGHDR_CONTAINS_FD(chdr))) {
      continue;
    }
    // Retrieve sent file descriptor. If multiple file descriptors
    // have been sent, we close all but the final one.
    mReceivedFd = *(static_cast<int*>(CMSG_DATA(chdr)));
  }

  return res;
}
示例#13
0
//------------------------------------------------------------------------------
bool LinearInterpolator::Interpolate(const Real ind, Real *results)
{
    if (pointCount < requiredPoints)
        return false;
        
    Integer index         = latestPoint;
    Integer previousPoint = latestPoint-1;
    Integer valid         = pointCount;
    Integer i;
    Real delta;
    
    while ((previousPoint != latestPoint) && valid > 0) {
        if (previousPoint < 0)
            previousPoint += bufferSize;
        if (index < 0)
            index += bufferSize;
        // Check to see that ind is in the valid range
        SetRange();
        if ((ind < range[0]) || (ind > range[1]))
            return false;
            
        if (ind >= independent[previousPoint])
        {
            // Found the bounding points
            delta = independent[index] - independent[previousPoint];
            if (delta == 0.0)
                return false;
            delta = (ind - independent[previousPoint]) / delta;
            for (i = 0; i < dimension; ++i)
                results[i] = dependent[previousPoint][i] + delta *
                             (dependent[index][i]-dependent[previousPoint][i]);
                             
            return true;
        }
        
        index = previousPoint;
        --previousPoint;
        --valid;
    }

    return false;
}
//**************************************************************************************
void CBCGPSliderButton::Serialize(CArchive& ar)
{
	CBCGPToolbarButton::Serialize (ar);

	if (ar.IsLoading ())
	{
		ar >> m_iWidth;
		ar >> m_dwStyle;

		int		nMin;
		int		nMax;
		int		nValue;

		ar >> nMin;
		ar >> nMax;
		ar >> nValue;

		SetRange (nMin, nMax);
		SetValue (nValue, FALSE);
	}
示例#15
0
//**************************************************************************************
void CProgressButton::Serialize(CArchive& ar)
{
	CMFCToolBarButton::Serialize (ar);

	if (ar.IsLoading ())
	{
		ar >> m_iWidth;
		ar >> m_dwStyle;

		int		nMin;
		int		nMax;
		int		nValue;

		ar >> nMin;
		ar >> nMax;
		ar >> nValue;

		SetRange (nMin, nMax);
		SetValue (nValue, FALSE);
	}
BOOL CGraphShowDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

		// 创建绘图控件并设置相关参数
 	CreateGraph(IDC_STATIC_GRAPHSHOW, &m_OScopeCtrl);
	// customize the control
	SetRange(-2.5, 2.5, DecimalPlaces, &m_OScopeCtrl) ;
 	SetYUnits("Y", &m_OScopeCtrl) ;
 	SetXUnits("X", &m_OScopeCtrl) ;
 	SetBackgroundColor(RGB(0, 0, 64), &m_OScopeCtrl) ;
 	SetGridColor(RGB(192, 192, 255), &m_OScopeCtrl) ;
 	SetPlotColor(RGB(255, 255, 255), &m_OScopeCtrl) ;
	unsigned int uiLength = 0;
	m_Sec.Lock();
	uiLength = m_ADCDataRecThread->m_uiADCDataFrameCount[m_uiADCGraphNb - 1] * ReceiveDataSize;
	m_Sec.Unlock();
	if (uiLength > m_OScopeCtrl.m_uiXAxisPointNum)
	{
		m_OScopeCtrl.m_uiXAxisLabelMax = uiLength;
	}
	else
	{
		m_OScopeCtrl.m_uiXAxisLabelMax = m_OScopeCtrl.m_uiXAxisPointNum;
	}
	m_OScopeCtrl.m_uiXAxisLabelMin = m_OScopeCtrl.m_uiXAxisLabelMax - m_OScopeCtrl.m_uiXAxisPointNum;
	m_OScopeCtrl.Reset(false);
	m_OScopeCtrl.m_dPreviousPosition = 0.0;
	m_OScopeCtrl.m_uiPointNum = uiLength;	// 绘制了的点的个数

	m_dSampleData.reserve(1024);

	OnSetHScrollBarRange();

	m_Sec.Lock();
	m_ADCDataRecThread->m_uiADCGraphIP = 71 + 10 * m_uiADCGraphNb;
	m_Sec.Unlock();
	m_OScopeCtrl.m_bStopSample = m_bStopSample;
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
示例#17
0
bool wxSpinCtrl::Reparent(wxWindowBase *newParent)
{
    // Reparenting both the updown control and its buddy does not seem to work:
    // they continue to be connected somehow, but visually there is no feedback
    // on the buddy edit control. To avoid this problem, we reparent the buddy
    // window normally, but we recreate the updown control and reassign its
    // buddy.

    if ( !wxWindowBase::Reparent(newParent) )
        return false;

    newParent->GetChildren().DeleteObject(this);

    // preserve the old values
    const wxSize size = GetSize();
    int value = GetValue();
    const wxRect btnRect = wxRectFromRECT(wxGetWindowRect(GetHwnd()));

    // destroy the old spin button
    UnsubclassWin();
    if ( !::DestroyWindow(GetHwnd()) )
    {
        wxLogLastError(wxT("DestroyWindow"));
    }

    // create and initialize the new one
    if ( !wxSpinButton::Create(GetParent(), GetId(),
                               btnRect.GetPosition(), btnRect.GetSize(),
                               GetWindowStyle(), GetName()) )
        return false;

    SetValue(value);
    SetRange(m_min, m_max);
    SetInitialSize(size);

    // associate it with the buddy control again
    ::SetParent(GetBuddyHwnd(), GetHwndOf(GetParent()));
    (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0);

    return true;
}
示例#18
0
// Create the CProgressCtrl as a child of the status bar positioned
// over the first pane, extending "nSize" percentage across pane.
// Sets the range to be 0 to MaxValue, with a step of 1.
BOOL CProgressBar::Create(LPCTSTR strMessage, int nSize /*=100*/, 
						  int MaxValue /*=100*/, BOOL bSmooth /*=FALSE*/, 
                          int nPane /*=0*/)
{
	BOOL bSuccess = FALSE;
	
	CStatusBar *pStatusBar = GetStatusBar();
	if (!pStatusBar)
		return FALSE;

	DWORD dwStyle = WS_CHILD|WS_VISIBLE;
#ifdef PBS_SMOOTH	 
	if (bSmooth)
		dwStyle |= PBS_SMOOTH;
#endif

	// Get CRect coordinates for requested status bar pane
	CRect PaneRect;
	pStatusBar->GetItemRect(nPane, &PaneRect);

	// Create the progress bar
	bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1);
	ASSERT(bSuccess);
	if (!bSuccess)
		return FALSE;

	// Set range and step
	SetRange(0, MaxValue);
	SetStep(1);

	m_strMessage  = strMessage;
	m_nSize 	  = nSize;
	m_nPane 	  = nPane;
    m_strPrevText = pStatusBar->GetPaneText(m_nPane); 

	// Resize the control to its desired width
	Resize();

	return TRUE;
}
void MCvarSlider::ApplySettings( KeyValues *inResourceData )
{
	BaseClass::ApplySettings( inResourceData );
	const char *convar = inResourceData->GetString( "convar", NULL );
	_ButtonCvar = cvar->FindVar( convar );
	
	if ( !_ButtonCvar )
	{
		Warning( "MCvarCheckButton: ConVar Invalid %s\n", convar );
		SetEnabled( false );
		return;
	}

	int max_value = inResourceData->GetInt( "maxValue", 100 );
	int min_value = inResourceData->GetInt( "minValue", 0 );
	SetRange( min_value, max_value );
	SetSliderThumbSubRange( true, min_value, max_value );
	SetNumTicks( ( max_value - min_value ) / 10 );

	_flScale = inResourceData->GetFloat( "scaleValue", 1.0f );
	SetScaledValue( _ButtonCvar->GetFloat() );
}
示例#20
0
void
avtLineScanQuery::SetInputParams(const MapNode &params)
{
    if (params.HasNumericEntry("num_lines"))
        SetNumberOfLines(params.GetEntry("num_lines")->ToInt());

    if (params.HasNumericEntry("num_bins"))
        SetNumberOfBins(params.GetEntry("num_bins")->ToInt());

    double min = 0., max = 1.0;
    if (params.HasNumericEntry("min"))
    {
        min = params.GetEntry("min")->ToDouble();
    }

    if (params.HasNumericEntry("max"))
    {
        max = params.GetEntry("max")->ToDouble();
    }

    SetRange(min, max);
}
示例#21
0
void               P3DVisRangeState::Load
                                      (P3DInputStringFmtStream
                                                          *SourceStream,
                                       const P3DFileVersion
                                                          *Version)
 {
  if ((Version->Major == 0) && (Version->Minor < 3))
   {
    Enabled   = false;
    Range.Min = 0.0f;
    Range.Max = 1.0f;
   }
  else
   {
    float                              Min,Max;

    SourceStream->ReadFmtStringTagged("VisRangeEnabled","b",&Enabled);
    SourceStream->ReadFmtStringTagged("VisRange","ff",&Min,&Max);

    SetRange(Min,Max);
   }
 }
示例#22
0
bool wxGauge::Create(wxWindow *parent,
                     wxWindowID id,
                     int range,
                     const wxPoint& pos,
                     const wxSize& size,
                     long style,
                     const wxValidator& validator,
                     const wxString& name)
{
    if ( !CreateControl(parent, id, pos, size, style, validator, name) )
        return false;

    if ( !MSWCreateControl(PROGRESS_CLASS, wxEmptyString, pos, size) )
        return false;

    SetRange(range);

    // in case we need to emulate indeterminate mode...
    m_nDirection = wxRIGHT;

    return true;
}
示例#23
0
VOID CDUIProgressBarBase::SetAttribute(const CDUIString& strName, const CDUIString& strValue)
{
	BOOL bHandled(FALSE);
	if(strName.compare(_T("back_image")) == 0)
	{
		CRefPtr<CImageList> pImage = GetSkinMgr()->GetImage(strValue);
		DUI_ASSERT(!pImage.IsNull() && (pImage->GetItemCount() >= PROCRSS_BAR_IMAGE_COUNT));
		
		CProgressBarUIData data;
		data.m_imageBK = pImage;
		SetUIData(data);

		bHandled = TRUE;
	}
	else if(strName.compare(_T("range")) == 0)
	{
		TCHAR szValue[128] = {0};
		lstrcpyn(szValue, strValue.c_str(), sizeof(szValue) / sizeof(TCHAR) - 1);
		LPTSTR pstr = szValue;
		INT nItem1 = _tcstol(pstr, &pstr, 10);    
		INT nItem2 = _tcstol(pstr + 1, &pstr, 10); 	

		SetRange(nItem1, nItem2);
		bHandled = TRUE;
	}
	else if(strName.compare(_T("pos")) == 0)
	{
		INT nPos = _ttol(strValue.c_str());
		SetPos(nPos);
		bHandled = TRUE;
	}
	

	if(!bHandled)
	{
		theBase::SetAttribute(strName, strValue);
	}
}
示例#24
0
CScrollV::CScrollV(HWND hWnd, CDuiObject* pDuiObject)
			: CControlBaseFont(hWnd, pDuiObject)
{
	m_nMaxRange = 0;
	m_nCurrentPos = 0;
	m_nPageRange = 0;
	m_nRowRange = 0;
	m_rcBlock.SetRectEmpty();

	m_bShowScroll = false;
	m_bHover = false;
	m_enButtonState = enBSNormal;
	m_nDownTop = -1;

	m_nArrowLen = 0;
	
	CRect rcButton = CRect(0,0,0,0);
	rcButton.bottom = rcButton.top + m_nArrowLen;

 	CControlBase * pControlBase = NULL;
 	pControlBase = new CImageButton(hWnd, this, BT_UP, rcButton);
	pControlBase->SetTabStop(FALSE);
	m_pControlUpImage = pControlBase;
 	m_vecControl.push_back(pControlBase);
 
 	rcButton = CRect(0,0,0,0);
 	rcButton.top = rcButton.bottom - m_nArrowLen;
 	pControlBase = new CImageButton(hWnd, this, BT_DOWN, rcButton);
	pControlBase->SetTabStop(FALSE);
	m_pControlDownImage = pControlBase;
 	m_vecControl.push_back(pControlBase);

	// 默认值
	m_nMaxRange = 400;
	m_nCurrentPos = 0;
	m_nRowRange = 10;
	SetRange();
}
示例#25
0
int r3dMouse::SetCapture()
{
	if(pdiMouse == NULL) {
		if(r3dRenderer->pdi->CreateDevice(GUID_SysMouse, &pdiMouse, NULL) != DI_OK)
		{
			m_MouseMoveX = 0;
			m_MouseMoveY = 0;
			return FALSE;
		}
	}

	if(!MouseAcquired) 
		Mouse_Acquire();

	ClearPressed();
	int z;
	QueryMotionDistance(&m_MouseMoveX, &m_MouseMoveY);
	QueryWheelMotion(&z);

	SetRange(r3dRenderer->HLibWin);

	return TRUE;
}
示例#26
0
bool wxGaugeBase::Create(wxWindow *parent,
                         wxWindowID id,
                         int range,
                         const wxPoint& pos,
                         const wxSize& size,
                         long style,
                         const wxValidator& validator,
                         const wxString& name)
{
    if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
        return false;

    SetName(name);

#if wxUSE_VALIDATORS
    SetValidator(validator);
#endif // wxUSE_VALIDATORS

    SetRange(range);
    SetValue(0);

    return true;
}
示例#27
0
void CSplitterControl::PreSubclassWindow()
{
	// Enable notifications - CStatic has this disabled by default
	ModifyStyle(0, SS_NOTIFY);

	CRect rc;
	GetClientRect(rc);

	// Determine default type base on it's size.
	m_nType = (rc.Width() < rc.Height())?SPS_VERTICAL:SPS_HORIZONTAL;

	if (!SplitterControl_hCursor1)
	{
		SplitterControl_hCursor1 = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
		SplitterControl_hCursor2 = AfxGetApp()->LoadStandardCursor(IDC_SIZENS);
	}

	// force the splitter not to be splitted.
	SetRange(0, 0, -1);


	CStatic::PreSubclassWindow();
}
示例#28
0
文件: Scroll.cpp 项目: KnowNo/QQPCMgr
CScrollV::CScrollV(HWND hWnd, CMessageInterface* pMessage, UINT uControlID, CRect rc, BOOL bIsVisible/* = TRUE*/)
			: CControlBase(hWnd, pMessage, uControlID, rc, bIsVisible)
{
	m_pImage = NULL;

	m_nMaxRange = 0;
	m_nCurrentPos = 0;
	m_nPageRange = 0;
	m_nRowRange = 0;
	m_rcBlock.SetRectEmpty();

	m_bShowScroll = false;
	m_bHover = false;
	m_enButtonState = enBSNormal;
	m_nDownTop = -1;
	
	CRect rcButton = rc;
	rcButton.bottom = rc.top + 20;

 	CControlBase * pControlBase = NULL;
 	pControlBase = new CImageButton(hWnd, this, BT_UP, rcButton);
 	((CImageButton *)pControlBase)->SetBitmap(IDB_PNG_SCROLL_UP);
 	m_vecControl.push_back(pControlBase);
 
 	rcButton = rc;
 	rcButton.top = rc.bottom - 20;
 	pControlBase = new CImageButton(hWnd, this, BT_DOWN, rcButton);
 	((CImageButton *)pControlBase)->SetBitmap(IDB_PNG_SCROLL_DOWN);
 	m_vecControl.push_back(pControlBase);

	// TEST +
	m_nMaxRange = 600;
	m_nCurrentPos = 100;
	m_nRowRange = 10;
	SetRange();
	// TEST +
}
示例#29
0
BOOL CSkinProgress::Init(
	CBitmap *pBmp,
	int nUpper,
	int nType,
	BOOL bReverse)
{
	mpBaseBmp = NULL;
	mpCompatibleBmp = NULL;
	mpStretchBmp = NULL;
	mpProgressBmp = NULL;
	mPaneRect.SetRect(0, 0, 0, 0);

	if (!SetBitmap(pBmp, false))
	{
		return false;
	}else
	{
		mnType = nType;

		mnLower = 0;
		mnUpper = nUpper;
		mnLeft = 0;
		mnRight = 0;

		SetRange(0, nUpper, 1, false ,false);

		mbReverse = bReverse;

		Reset(false);

		SetTimer((UINT)(ULONG_PTR) this, 500, NULL);

		OnCalcPos();

		return true;
	}
}
ExponentialNumericControl::ExponentialNumericControl( Control& parent ) : NumericEdit( parent )
{
    SetReal();
    SetPrecision( 8 );
    SetRange( 0.0, 1.0 );

    m_coefficient.label.Hide();
    m_coefficient.slider.SetRange( 0, 180 ); // step size = 0.05
    m_coefficient.slider.SetScaledMinWidth( 250 );
    m_coefficient.SetReal();
    m_coefficient.SetRange( 1.00, 10.00 );
    m_coefficient.SetPrecision( 2 );
    m_coefficient.SetToolTip( "<p>Coefficient value in the range [1.0,9.99]</p>" );
    m_coefficient.OnValueUpdated( (NumericEdit::value_event_handler)&ExponentialNumericControl::__CoefficientValueUpdated, *this );

    m_exponent.SetRange( -8, 0 );
    m_exponent.SetToolTip( "<p>Exponent in the range [-8,0]</p>" );
    m_exponent.OnValueUpdated( (SpinBox::value_event_handler)&ExponentialNumericControl::__ExponentValueUpdated, *this );

    sizer.Add( m_coefficient, 100 );
    sizer.Add( m_exponent );

    AdjustToContents();
}