Example #1
0
void ViewfinderImpl::SetOutputType(T_enOutputType enOutputType)
{
   unsigned int output = 0;

   switch (enOutputType)
   {
   case Viewfinder::outputTypeUndefined:
      return; // do nothing

   case Viewfinder::outputTypeLCD:
      // corresponds to "Camera and PC", to have viewfinder on camera LCD also
      output = kEdsEvfOutputDevice_TFT | kEdsEvfOutputDevice_PC;
      break;

   case Viewfinder::outputTypeVideoOut:
      return; // do nothing, since on EDSDK, video out can't be set

   case Viewfinder::outputTypeOff:
      // corresponds to "PC", not "Off", to not shutdown viewfinder at all
      output = kEdsEvfOutputDevice_PC;
      break;

   default:
      ATLASSERT(false);
      return;
   }

   Variant outputValue;
   outputValue.Set(output);
   outputValue.SetType(Variant::typeUInt32);

   PropertyAccess p(m_hSourceDevice);
   p.Set(kEdsPropID_Evf_OutputDevice, outputValue);
}
Example #2
0
ViewfinderImpl::ViewfinderImpl(Handle hSourceDevice, boost::asio::io_service& ioService, std::shared_ptr<LightweightMutex> spMtxLock)
:m_hSourceDevice(hSourceDevice),
m_ioService(ioService),
m_spMtxLock(spMtxLock),
m_evtTimerStopped(true, false) // manual-reset event
{
   // Get the output device for the live view image
   PropertyAccess p(hSourceDevice);

   Variant vDevice = p.Get(kEdsPropID_Evf_OutputDevice);
   ATLASSERT(vDevice.Type() == Variant::typeUInt32);

   unsigned int device = vDevice.Get<unsigned int>();

   // PC live view starts by setting the PC as the output device for the live view image.
   device |= kEdsEvfOutputDevice_PC;

   vDevice.Set(device);

   {
      LightweightMutex::LockType lock(*spMtxLock);
      p.Set(kEdsPropID_Evf_OutputDevice, vDevice);
   }

   // A property change event notification is issued from the camera if property settings are made successfully.
   // Start downloading of the live view image once the property change notification arrives.
}
Example #3
0
   virtual void SetOutputType(Viewfinder::T_enOutputType enOutputType) override
   {
      // note that T_enOutputType values exactly correspond to values
      // expected by prPTP_DEV_PROP_CAMERA_OUTPUT
      prUInt8 output = static_cast<prUInt8>(enOutputType);

      Variant outputValue;
      outputValue.Set(output);
      outputValue.SetType(Variant::typeUInt8);

      PropertyAccess access(m_hCamera);
      access.Set(prPTP_DEV_PROP_CAMERA_OUTPUT, outputValue);
   }
Example #4
0
void ViewfinderImpl::Close()
{
   // clear live view flag in property
   PropertyAccess p(m_hSourceDevice);

   Variant vDevice = p.Get(kEdsPropID_Evf_OutputDevice);
   ATLASSERT(vDevice.Type() == Variant::typeUInt32);

   unsigned int device = vDevice.Get<unsigned int>();
   device &= ~kEdsEvfOutputDevice_PC;

   vDevice.Set(device);

   p.Set(kEdsPropID_Evf_OutputDevice, vDevice);
}
Example #5
0
ImageProperty RemoteReleaseControlImpl::MapShootingModeToImagePropertyValue(RemoteReleaseControl::T_enShootingMode enShootingMode) const
{
   prUInt8 uiValue = 0;
   switch (enShootingMode)
   {
   case RemoteReleaseControl::shootingModeP:    uiValue = 0x01; break;
   case RemoteReleaseControl::shootingModeTv:   uiValue = 0x02; break;
   case RemoteReleaseControl::shootingModeAv:   uiValue = 0x03; break;
   case RemoteReleaseControl::shootingModeM:    uiValue = 0x04; break;
   default:
      ATLASSERT(false);
      break;
   }

   Variant value;
   value.Set(uiValue);
   value.SetType(Variant::typeUInt8);

   return ImageProperty(variantPsrec, prPTP_DEV_PROP_EXPOSURE_MODE, value, false);
}
Example #6
0
void ScrollComponent::SetPosition(CL_Vec2f vDisplacement, bool bForceUpdate)
{
	if (vDisplacement == CL_Vec2f(0,0) && !bForceUpdate) return;
	
	/*
	//this works, but it still totally feels wrong, really I would need to turn "momentum" off as well, and perfectly tune the
	//sensitivity so it feels like you're dragging the scroll bar

	if (IsDesktop())
	{
		vDisplacement.y *= -1; //on desktops where you use a mouse, it makes more sense to drag the scroll bar down, rather than "drag the screen up"
	}
	*/

	m_vecChildPos += vDisplacement;

	//force it within our ranges
	ForceRange(m_vecChildPos.x, m_pBoundsRect->left, m_pBoundsRect->right);
	if (m_pBoundsRect->top > m_pBoundsRect->bottom) m_pBoundsRect->top = m_pBoundsRect->bottom;
	ForceRange(m_vecChildPos.y, m_pBoundsRect->top, m_pBoundsRect->bottom);
	
	CL_Vec2f percent2d(0,0);
	//avoid divide by 0 errors
	if (m_pBoundsRect->get_width() != 0) percent2d.x = m_vecChildPos.x/(-m_pBoundsRect->get_width());
	if (m_pBoundsRect->get_height() != 0) percent2d.y = m_vecChildPos.y/ (-m_pBoundsRect->get_height());

	m_progressVar->Set(percent2d);
	
	//also run this on all children
	EntityList *pChildren = GetParent()->GetChildren();

	Variant *pPos;
	EntityList::iterator itor = pChildren->begin();
	while (itor != pChildren->end())
	{
		pPos = (*itor)->GetVar("pos2d");
		pPos->Set(m_vecChildPos);
		itor++;
	}
}