Ejemplo n.º 1
0
void CMediaSettingsPage::OnOK()
{
	UpdateData();

	Settings.MediaPlayer.EnablePlay		= ( m_bEnablePlay != FALSE );
	Settings.MediaPlayer.EnableEnqueue	= ( m_bEnableEnqueue != FALSE );

	int nSelected = m_wndServices.GetCurSel();
	if ( nSelected == nCustomIndex )
		nSelected = nSnareazaIndex;

	Settings.MediaPlayer.ServicePath.clear();
	int nCount = m_wndServices.GetCount();
	for( int i = 0; i < nCount; ++i )
	{
		CString* psPlayer = (CString*)m_wndServices.GetItemDataPtr( i );
		if ( ! psPlayer )
			continue;
		if ( i == nSelected )
			*psPlayer += _T("*");
		Settings.MediaPlayer.ServicePath.insert( *psPlayer );
	}

	if ( nSelected == nSnareazaIndex )	// Shareaza Media Player is selected
		Settings.MediaPlayer.ShortPaths = FALSE;

	CSettingsSheet* pSheet = GetSheet();
	for ( INT_PTR nPage = 0 ; nPage < pSheet->GetPageCount() ; nPage++ )
	{
		CSettingsPage* pPage = pSheet->GetPage( nPage );
		if ( pPage )
		{
			CString strClass( pPage->GetRuntimeClass()->m_lpszClassName );
			if ( strClass == _T("CPluginsSettingsPage") )
			{
				CPluginsSettingsPage* pPluginPage = static_cast< CPluginsSettingsPage* >( pPage );
				pPluginPage->UpdateList();
				break;
			}
		}
	}

	Settings.MediaPlayer.FileTypes.clear();
	for ( int nItem = 0 ; nItem < m_wndList.GetCount() ; nItem++ )
	{
		CString str;
		m_wndList.GetLBText( nItem, str );
		if ( str.GetLength() )
		{
			Settings.MediaPlayer.FileTypes.insert( str );
		}
	}

	CSettingsPage::OnOK();
}
Ejemplo n.º 2
0
void CMediaSettingsPage::OnOK()
{
	UpdateData();

	Settings.MediaPlayer.EnablePlay		= ( m_bEnablePlay != FALSE );
	Settings.MediaPlayer.EnableEnqueue	= ( m_bEnableEnqueue != FALSE );
	Settings.MediaPlayer.ServicePath.clear();

	// Re-add previous external mediaplayers.  ToDo: Some way to clear them?

	int nSelected = m_wndServices.GetCurSel();
	if ( nSelected == CUSTOM_INDEX )
		nSelected = INTERNAL_INDEX;

	const int nCount = m_wndServices.GetCount();
	for ( int i = 0; i < nCount; ++i )
	{
		CString* psPlayer = (CString*)m_wndServices.GetItemDataPtr( i );
		if ( ! psPlayer )
			continue;
		if ( i == nSelected )
			*psPlayer += L'*';	// SELECTED_PLAYER_TOKEN
		Settings.MediaPlayer.ServicePath.insert( *psPlayer );
	}

	Settings.MediaPlayer.ShortPaths = ( nSelected != INTERNAL_INDEX );	// No MAX_LENGTH issues with internal service only?

	CSettingsSheet* pSheet = GetSheet();
	for ( INT_PTR nPage = 0; nPage < pSheet->GetPageCount(); nPage++ )
	{
		if ( CSettingsPage* pPage = pSheet->GetPage( nPage ) )
		{
			CString strClass( pPage->GetRuntimeClass()->m_lpszClassName );
			if ( strClass == L"CPluginsSettingsPage" )
			{
				CPluginsSettingsPage* pPluginPage = static_cast< CPluginsSettingsPage* >( pPage );
				pPluginPage->UpdateList();
				break;
			}
		}
	}

	Settings.MediaPlayer.FileTypes.clear();

	for ( int nItem = 0; nItem < m_wndList.GetCount(); nItem++ )
	{
		CString str;
		m_wndList.GetLBText( nItem, str );
		if ( ! str.IsEmpty() )
			Settings.MediaPlayer.FileTypes.insert( str );
	}

	CSettingsPage::OnOK();
}
Ejemplo n.º 3
0
BOOL CConfigFrame::DisplayContextBranch()
{   TCHAR p;
    int i, iPos, iLen, iLeft, iChars=0;
    CString strCmdLine(_T("")), strContext(_T(""));
    CString strItem(_T("")), strClass(_T("")), strSubItem(_T("")); 
    HTREEITEM hTreeItem=NULL, hChildItem=NULL, hShowItem=NULL;

    // Check for command line option
    CVcbfApp *theApp = (CVcbfApp *)AfxGetApp();
    if (!theApp)
       return FALSE;

    if (theApp->m_lpCmdLine)
      strCmdLine = theApp->m_lpCmdLine;

    strCmdLine.MakeLower();
    //
    // DBCS Compliant:
    iPos = strCmdLine.Find(_T("/c=\""));
    if (iPos != -1)
    { 
      iLen = strCmdLine.GetLength();
      iLeft = iPos + 4;
      for (i=iLeft; i<iLen; i++)
      { 
        p = strCmdLine.GetAt(i);
        if (p == _T('\"'))
        { 
          break;
        }
        iChars++;
      }
      
      strContext=strCmdLine.Mid(iLeft, iChars);
    }
    else
      strContext=_T("Name Server");

    // Take the context string and divide it into Branch and Sub-Branch
    // If no subitem is specified, "(default)" is used
       
    if (strContext.IsEmpty())
       return FALSE;    

    iPos = strContext.Find(_T("\\"));
    if (iPos != -1)
    { strClass = strContext.Left(iPos);
      strSubItem = strContext.Right(strContext.GetLength() - iPos - 1);
    }
    else
    { strClass = strContext;
      strSubItem = GetLocDefConfName();
    }

    CConfLeftDlg* pLeftDlg = GetCConfLeftDlg();
	if (!pLeftDlg) 
       return FALSE;

    // Search through the first level of the tree
    hTreeItem = pLeftDlg->m_tree_ctrl.GetChildItem(pLeftDlg->m_tree_ctrl.GetRootItem());
  
    while (hTreeItem)
    { 
      strItem = pLeftDlg->m_tree_ctrl.GetItemText(hTreeItem);
	
	  if (strItem.CompareNoCase(strClass) == 0)
      { pLeftDlg->m_tree_ctrl.Expand(hTreeItem, TVE_EXPAND);
        hShowItem=hTreeItem;
        break;
      }

      hTreeItem = pLeftDlg->m_tree_ctrl.GetNextSiblingItem(hTreeItem);
    }

    // Search through child items if necessary
    hChildItem = pLeftDlg->m_tree_ctrl.GetChildItem(hTreeItem);
    
    while (hChildItem)
    { 
      strItem = pLeftDlg->m_tree_ctrl.GetItemText(hChildItem);
	
	  if (strItem.CompareNoCase(strSubItem) == 0)
      { hShowItem=hChildItem;
        break;
      }
      
      hChildItem = pLeftDlg->m_tree_ctrl.GetNextSiblingItem(hChildItem);
    }

    // Select the item that was found and display the right pane 
    if (hShowItem)
       pLeftDlg->m_tree_ctrl.Select(hShowItem,TVGN_CARET);
 
    return TRUE;
}
Ejemplo n.º 4
0
CWnd* CCJToolBar::InsertControl(CRuntimeClass * pClass, CString strTitle, CRect & pRect, UINT nID, DWORD dwStyle)
{
	dwStyle |= WS_CHILD | WS_VISIBLE;
	CWnd* pCtrl = 0;
	
	CRect rect = pRect;
	BOOL bCreate = FALSE;
	
	// make sure the id is valid
	ASSERT( CommandToIndex( nID ) >= 0 );
	SetButtonInfo( CommandToIndex( nID ), nID, TBBS_SEPARATOR, pRect.Width());
	
	CString strClass( pClass->m_lpszClassName );
	
	if( strClass == TEXT("CCJComboBox") ) {
		pCtrl = new CCJComboBox();
		bCreate = ((CCJComboBox*)pCtrl)->Create(dwStyle, rect, this, nID);
	}
	
	else if( strClass == TEXT("CComboBox") ) {
		pCtrl = new CComboBox();
		bCreate = ((CComboBox*)pCtrl)->Create(dwStyle, rect, this, nID);
	}
	
	else if( strClass == TEXT("CEdit") ) {
		pCtrl = new CEdit();
		bCreate = ((CEdit*)pCtrl)->Create(dwStyle, rect, this, nID);
	}
	
	else if( strClass == TEXT("CButton") ) {
		pCtrl = new CButton();
		bCreate = ((CButton*)pCtrl)->Create(strTitle,dwStyle, rect, this, nID);
	}
	
	else {
		pCtrl = (CWnd*)pClass->CreateObject();
		bCreate = pCtrl->Create(0, 0, dwStyle, rect, this, nID);
	}
	
	if( !pCtrl ) return 0;
	if( !bCreate ) { delete pCtrl; return 0; }
	
	GetItemRect( CommandToIndex(nID), &pRect );
	
	pCtrl->SetWindowPos(0, pRect.left, pRect.top, 0, 0,
		SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS );
	
	pCtrl->SetFont( &m_font );
	pCtrl->ShowWindow( SW_SHOW );
	
	// we have to remember this control, so we can delete it later
	if( !m_pControls ) {
		m_pControls = new CObList();
		m_pControls->AddTail( pCtrl );
	}

	// David Cofer
	else
		m_pControls->AddTail( pCtrl);
	
	return pCtrl;
}
Ejemplo n.º 5
0
jobject MakeObjectInstance(JNIEnv *env,const char *pzObjectType,  DynamicXMLObject *pDO,DynamicXMLObject *pDXOOOwner)
{
	if (env->ExceptionOccurred()) 
	{
		env->ExceptionClear();
	}

	GString strClass(pzObjectType);
	int nStartAt = strClass.ReverseFind("/");
	if(nStartAt == -1)
		nStartAt = 0;
	else
		nStartAt++; // first byte past slash

	logit("MOI Make Object Instance1\n");
	logit(strClass);
	logit("\n");


//								"gapp/MyOrder");
	jclass clazzA = env->FindClass(strClass);

	// Here we are passing in a "variable" as a class name, these are the kids of errors that a bad value will produce:
	//
	//------------------------------------------------------ V ---------------
	//													  gapp/MyOrder    	works.
	//java.lang.ClassNotFoundException: Didn't find class "MyOrder" on
					  // JNI WARNING: illegal class name 'LMyOrder;' (FindClass)
					  // JNI WARNING: illegal class name 'Lgapp/MyOrder;' (FindClass)
								    //illegal class name 'MyOrder;' (FindClass)

	jobject objReturnValue = 0;
	GString strType("Ljava/lang/String;");
	// if this class type exposes a 'ctor that takes a single XMLObject we are using containment.
	jmethodID midctor = env->GetMethodID(clazzA, "<init>", "(LXMLObject;)V");
	if (env->ExceptionOccurred()) 
	{
		env->ExceptionClear();
	}
	if (midctor)
	{
		// create a new java XMLObject instance
		jclass clazzX = env->FindClass("XMLObject");
	    jmethodID midX = env->GetMethodID(clazzX, "<init>", "(Ljava/lang/String;)V");
		jstring	tagX = env->NewStringUTF(pDO->GetObjectTag());
		jobject objX = env->NewObject(clazzA, midX, tagX );

		// assign the object handle into the instance just created.
		jclass clazz = env->GetObjectClass(objX);
		jfieldID fid = env->GetFieldID(clazz, "oH", "I");
		env->SetIntField(objX, fid, CastDXMLO(pDO));

		// create a new instance of some user defined java class that is 
		// not extending XMLObject.  Pass the XMLObject to the 'ctor.
		objReturnValue = env->NewObject(clazzA, midctor, objX );
	}
	else
	{
		// create an instance of a java object derived from the java XMLObject
		objReturnValue = env->AllocObject(clazzA);

		// assign the base class object handle directly.
		jclass clazz = env->GetObjectClass(objReturnValue);

		// any object that extends XMLObject will have the oH (Object Handle)
		// If the Object created is a String the fid will be 0.
		jfieldID fid = env->GetFieldID(clazz, "oH", "I");
		if (env->ExceptionOccurred()) 
		{
			env->ExceptionClear();
		}
		if (fid)
		{
			env->SetIntField(objReturnValue, fid, CastDXMLO(pDO));

			// create the jobject to DXO index
			union CAST_THIS_TYPE_SAFE_COMPILERS
			{
				jobject   mbrObj;
				void *    mbrVoid;
			}Member;  

			Member.mbrObj = env->NewGlobalRef(objReturnValue);
			pDXOOOwner->addSubUserLanguageObject(Member.mbrVoid);
			// printf("===<Factory>NewGlobRef[%d]\n",Member.mbrObj);
			pDO->setUserLanguageObject(Member.mbrVoid);
			cacheManager.addAlternate( pDO );
		}
		else if (strType.CompareNoCase(pzObjectType) != 0)
		{
		  GString Err;
		  Err.Format("Object type [%s] must either be derived from XMLObject\n"
		  "or supply a constructor %s(XMLObject o)",pzObjectType,pzObjectType);
		}
	}
	pDO->SetObjectType(pzObjectType);
	return objReturnValue;
}