Ejemplo n.º 1
0
void CAddonDll::SaveSettings()
{
  // must save first, as TransferSettings() reloads saved settings!
  CAddon::SaveSettings();
  if (m_initialized)
    TransferSettings();
}
Ejemplo n.º 2
0
ADDON_STATUS CAddonDll::Create(ADDON_TYPE type, void* funcTable, void* info)
{
  /* ensure that a previous instance is destroyed */
  Destroy();

  if (!funcTable)
    return ADDON_STATUS_PERMANENT_FAILURE;

  CLog::Log(LOGDEBUG, "ADDON: Dll Initializing - %s", Name().c_str());
  m_initialized = false;

  if (!LoadDll())
    return ADDON_STATUS_PERMANENT_FAILURE;

  /* Check requested instance version on add-on */
  if (!CheckAPIVersion(type))
    return ADDON_STATUS_PERMANENT_FAILURE;

  /* Check versions about global parts on add-on (parts used on all types) */
  for (unsigned int id = ADDON_GLOBAL_MAIN; id <= ADDON_GLOBAL_MAX; ++id)
  {
    if (!CheckAPIVersion(id))
      return ADDON_STATUS_PERMANENT_FAILURE;
  }

  /* Load add-on function table (written by add-on itself) */
  m_pDll->GetAddon(funcTable);

  /* Allocate the helper function class to allow crosstalk over
     helper libraries */
  m_pHelpers = new CAddonInterfaces(this);

  /* Call Create to make connections, initializing data or whatever is
     needed to become the AddOn running */
  ADDON_STATUS status = m_pDll->Create(m_pHelpers->GetCallbacks(), info);
  if (status == ADDON_STATUS_OK)
  {
    m_initialized = true;
  }
  else if (status == ADDON_STATUS_NEED_SETTINGS)
  {
    status = TransferSettings();
    if (status == ADDON_STATUS_OK)
      m_initialized = true;
    else
      new CAddonStatusHandler(ID(), status, "", false);
  }
  else
  { // Addon failed initialization
    CLog::Log(LOGERROR, "ADDON: Dll %s - Client returned bad status (%i) from Create and is not usable", Name().c_str(), status);

    std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str());
    HELPERS::ShowOKDialogLines(CVariant{ heading }, CVariant{ 24070 }, CVariant{ 24071 });
  }

  return status;
}
Ejemplo n.º 3
0
ADDON_STATUS CAddonDll::Create(void* funcTable, void* info)
{
  /* ensure that a previous instance is destroyed */
  Destroy();

  if (!funcTable)
    return ADDON_STATUS_PERMANENT_FAILURE;

  CLog::Log(LOGDEBUG, "ADDON: Dll Initializing - %s", Name().c_str());
  m_initialized = false;

  if (!LoadDll())
    return ADDON_STATUS_PERMANENT_FAILURE;

  /* Load add-on function table (written by add-on itself) */
  m_pDll->GetAddon(funcTable);

  if (!CheckAPIVersion())
    return ADDON_STATUS_PERMANENT_FAILURE;

  /* Allocate the helper function class to allow crosstalk over
     helper libraries */
  m_pHelpers = new CAddonInterfaces(this);

  /* Call Create to make connections, initializing data or whatever is
     needed to become the AddOn running */
  ADDON_STATUS status = m_pDll->Create(m_pHelpers->GetCallbacks(), info);
  if (status == ADDON_STATUS_OK)
  {
    m_initialized = true;
  }
  else if ((status == ADDON_STATUS_NEED_SETTINGS) || (status == ADDON_STATUS_NEED_SAVEDSETTINGS))
  {
    m_needsavedsettings = (status == ADDON_STATUS_NEED_SAVEDSETTINGS);
    if ((status = TransferSettings()) == ADDON_STATUS_OK)
      m_initialized = true;
    else
      new CAddonStatusHandler(ID(), status, "", false);
  }
  else
  { // Addon failed initialization
    CLog::Log(LOGERROR, "ADDON: Dll %s - Client returned bad status (%i) from Create and is not usable", Name().c_str(), status);
    
    CGUIDialogOK* pDialog = g_windowManager.GetWindow<CGUIDialogOK>(WINDOW_DIALOG_OK);
    if (pDialog)
    {
      std::string heading = StringUtils::Format("%s: %s", TranslateType(Type(), true).c_str(), Name().c_str());
      pDialog->SetHeading(CVariant{heading});
      pDialog->SetLine(1, CVariant{24070});
      pDialog->SetLine(2, CVariant{24071});
      pDialog->Open();
    }
  }

  return status;
}
Ejemplo n.º 4
0
ADDON_STATUS CAddonDll::Create(KODI_HANDLE firstKodiInstance)
{
  CLog::Log(LOGDEBUG, "ADDON: Dll Initializing - %s", Name().c_str());
  m_initialized = false;

  if (!LoadDll())
  {
    return ADDON_STATUS_PERMANENT_FAILURE;
  }

  /* Check versions about global parts on add-on (parts used on all types) */
  for (unsigned int id = ADDON_GLOBAL_MAIN; id <= ADDON_GLOBAL_MAX; ++id)
  {
    if (!CheckAPIVersion(id))
      return ADDON_STATUS_PERMANENT_FAILURE;
  }

  /* Allocate the helper function class to allow crosstalk over
     helper add-on headers */
  if (!InitInterface(firstKodiInstance))
    return ADDON_STATUS_PERMANENT_FAILURE;

  /* Call Create to make connections, initializing data or whatever is
     needed to become the AddOn running */
  ADDON_STATUS status = m_pDll->Create(&m_interface, nullptr);
  if (status == ADDON_STATUS_OK)
  {
    m_initialized = true;
  }
  else if (status == ADDON_STATUS_NEED_SETTINGS)
  {
    if ((status = TransferSettings()) == ADDON_STATUS_OK)
      m_initialized = true;
    else
      new CAddonStatusHandler(ID(), status, "", false);
  }
  else
  { // Addon failed initialization
    CLog::Log(LOGERROR, "ADDON: Dll %s - Client returned bad status (%i) from Create and is not usable", Name().c_str(), status);

    // @todo currently a copy and paste from other function and becomes improved.
    std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str());
    HELPERS::ShowOKDialogLines(CVariant{ heading }, CVariant{ 24070 }, CVariant{ 24071 });
  }

  return status;
}
HRESULT CControlSurfaceProbePropPage::SetObjects( ULONG cObjects, LPUNKNOWN* ppUnk )
{
	if (cObjects == 1)
	{
		// Validate arguments
		if (ppUnk == NULL || *ppUnk == NULL)
			return E_POINTER;

		// Cast this to be our type.  Technically, we should be doing a QI
		// on the ppUnk, and talk via our interface.  But this is a private
		// interface for SONAR, that is guaranteed to be running in process.
		CControlSurfaceProbe* const pSurface = dynamic_cast<CControlSurfaceProbe*>(*ppUnk);
		if (NULL == pSurface)
			return E_POINTER;
		
		// If different than previous object, release the old one
		if (m_pSurface != pSurface && m_pSurface != NULL)
			m_pSurface->Release();

		m_pSurface = pSurface;
		m_pSurface->AddRef();
		m_dwSurfaceID = m_pSurface->GetSurfaceID();

		// Don't call UpdateData() here, it blows up badly,
		// instead transfer the data directly
		TransferSettings(false);

		return S_OK;
	}
	else if (cObjects == 0)
	{
		if (m_pSurface == NULL)
			return E_UNEXPECTED;

		m_pSurface->Release();
		m_pSurface = NULL;

		return S_OK;
	}
	else
		return E_UNEXPECTED;
}
void CControlSurfaceProbePropPage::DoDataExchange(CDataExchange* pDX)
{
   CDialog::DoDataExchange(pDX);

   AFX_MANAGE_STATE(AfxGetStaticModuleState());

   CDialog::DoDataExchange(pDX);

   if (pDX->m_bSaveAndValidate == FALSE)
      TransferSettings(false);

   //{{AFX_DATA_MAP(CControlSurfaceProbePropPage)
   DDX_Control(pDX, IDC_MARKER_TICK_SPIN, m_cMarkerTickSpin);
   DDX_Control(pDX, IDC_MARKER_BEAT_SPIN, m_cMarkerBeatSpin);
   DDX_Control(pDX, IDC_MARKER_MEAS_SPIN, m_cMarkerMeasSpin);
   DDX_Control(pDX, IDC_MARKER_THE_NEAREST, m_cMarkerTheNearest);
   DDX_Control(pDX, IDC_MARKER_TICKS, m_cMarkerTicks);
   DDX_Control(pDX, IDC_MARKER_BEATS, m_cMarkerBeats);
   DDX_Control(pDX, IDC_MARKER_MEASURES, m_cMarkerMeasures);
   DDX_Control(pDX, IDC_MARKER_LIST, m_cMarkerList);
   DDX_Control(pDX, IDC_MARKER_COUNT, m_cMarkerCount);
   DDX_Control(pDX, IDC_STRIP_METER_VALUES, m_cStripMeterValues);
   DDX_Control(pDX, IDC_STRIP_NUM_METERS, m_cStripNumMeters);
   DDX_Control(pDX, IDC_TS_AUTOPUNCH, m_cTransportAutoPunch);
   DDX_Control(pDX, IDC_UNIQUE_ID, m_cUniqueID);
   DDX_Control(pDX, IDC_HOST_VERSION, m_cHostVersion);
   DDX_Control(pDX, IDC_HOST_NAME, m_cHostName);
   DDX_Control(pDX, IDC_COMMANDS, m_cCommands);
   DDX_Control(pDX, IDC_PARAM_NUM_LOW, m_cParamNumLow);
   DDX_Control(pDX, IDC_PARAM_NUM_HIGH, m_cParamNumHigh);
   DDX_Control(pDX, IDC_PARAM_NUM_SPIN_LOW, m_cParamNumSpinLow);
   DDX_Control(pDX, IDC_PARAM_NUM_SPIN_HIGH, m_cParamNumSpinHigh);
   DDX_Control(pDX, IDC_MIX_VALUE_ARM, m_cMixValueArm);
   DDX_Control(pDX, IDC_NUM_MASTER, m_cNumMasters);
   DDX_Control(pDX, IDC_NUM_BUSES, m_cNumBuses);
   DDX_Control(pDX, IDC_TS_SCRUB, m_cTransportScrub);
   DDX_Control(pDX, IDC_TS_REC_AUTO, m_cTransportRecAutomation);
   DDX_Control(pDX, IDC_TS_PLAY, m_cTransportPlay);
   DDX_Control(pDX, IDC_TS_LOOP, m_cTransportLoop);
   DDX_Control(pDX, IDC_TS_AUDIO, m_cTransportAudio);
   DDX_Control(pDX, IDC_TS_REC, m_sTransportRec);
   DDX_Control(pDX, IDC_MIX_NEW_VAL, m_cNewVal);
   DDX_Control(pDX, IDC_NUM_AUXS, m_cNumAuxs);
   DDX_Control(pDX, IDC_NUM_MAINS, m_cNumMains);
   DDX_Control(pDX, IDC_NUM_TRACKS, m_cNumTracks);
   DDX_Control(pDX, IDC_STRIP_NAME, m_cStripName);
   DDX_Control(pDX, IDC_UPDATE_COUNT, m_cUpdateCount);
   DDX_Control(pDX, IDC_STRIP_NUM_SPIN, m_cStripNumSpin);
   DDX_Control(pDX, IDC_PARAM_NUM_SPIN, m_cParamNumSpin);
   DDX_Control(pDX, IDC_MIX_VALUE_TEXT, m_cMixValueText);
   DDX_Control(pDX, IDC_MIX_VALUE_LABEL, m_cMixValueLabel);
   DDX_Control(pDX, IDC_STRIP_NUM, m_cStripNum);
   DDX_Control(pDX, IDC_MIX_VALUE, m_cMixValue);
   DDX_Control(pDX, IDC_PARAM_NUM, m_cParamNum);
   DDX_Control(pDX, IDC_MIX_PARAM, m_cMixParam);
   DDX_Control(pDX, IDC_MIX_STRIP, m_cMixStrip);

   DDX_Control(pDX, IDC_MIX_ARM, m_cWrite);
   DDX_Control(pDX, IDC_READ_ENABLE, m_cRead);


   // dynamic mapped params
   DDX_Control(pDX, IDC_SCT_ROTARY, m_cDynRotary1 );
   DDX_Control(pDX, IDC_SCT_ROTARY2, m_cDynRotary2 );
   DDX_Control(pDX, IDC_SCT_ROTARY3, m_cDynRotary3 );
   DDX_Control(pDX, IDC_SCT_ROTARY4, m_cDynRotary4 );
   DDX_Control(pDX, IDC_SCT_SLIDER, m_cDynSlider1 );
   DDX_Control(pDX, IDC_SCT_SLIDER2, m_cDynSlider2 );
   DDX_Control(pDX, IDC_SCT_SLIDER3, m_cDynSlider3 );
   DDX_Control(pDX, IDC_SCT_SLIDER4, m_cDynSlider4 );
   DDX_Control(pDX, IDC_SCT_SWITCH, m_cDynSwitch );
   DDX_Control(pDX, IDC_MAP_NAME, m_cMapName );
   DDX_Control(pDX, IDC_UI_CONTEXT, m_cUIContext );
   DDX_Control(pDX, IDC_SCT_SLIDER_CAPTION, m_cDynSliderParam1 );
   DDX_Control(pDX, IDC_SCT_SLIDER_CAPTION2, m_cDynSliderParam2 );
   DDX_Control(pDX, IDC_SCT_SLIDER_CAPTION3, m_cDynSliderParam3 );
   DDX_Control(pDX, IDC_SCT_SLIDER_CAPTION4, m_cDynSliderParam4 );

   DDX_Control(pDX, IDC_SCT_ROTARY_CAPTION, m_cDynRotaryParam1 );
   DDX_Control(pDX, IDC_SCT_ROTARY_CAPTION2, m_cDynRotaryParam2 );
   DDX_Control(pDX, IDC_SCT_ROTARY_CAPTION3, m_cDynRotaryParam3 );
   DDX_Control(pDX, IDC_SCT_ROTARY_CAPTION4, m_cDynRotaryParam4 );

   DDX_Control(pDX, IDC_SCT_SWITCH_CAPTION, m_cDynSwitchParam );

   DDX_Control(pDX, IDC_LOCK_CONTEXT, m_cLockContext );
   DDX_Control(pDX, IDC_LEARN_ENABLE, m_cEnableLearn );

   DDX_Control(pDX, IDC_WND_TYPE, m_cWindowType);
   DDX_Control(pDX, IDC_WND_STATE, m_cWindowState);

   //}}AFX_DATA_MAP

   if (pDX->m_bSaveAndValidate == TRUE)
      TransferSettings(true);
}