Exemple #1
0
void CTabbedDialogs::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult)
{
    // TODO: Add your control notification handler code here
    SetActiveDialog (GetCurSel ());

    *pResult = 0;
}
Exemple #2
0
CamuleDlg::CamuleDlg(
	wxWindow* pParent,
	const wxString &title,
	wxPoint where,
	wxSize dlg_size)
:
wxFrame(
	pParent, -1, title, where, dlg_size,
	wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxDIALOG_NO_PARENT|
	wxRESIZE_BORDER|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX,
	wxT("aMule")),
m_activewnd(NULL),
m_transferwnd(NULL),
m_serverwnd(NULL),
m_sharedfileswnd(NULL),
m_searchwnd(NULL),
m_chatwnd(NULL),
m_statisticswnd(NULL),
m_kademliawnd(NULL),
m_prefsDialog(NULL),
m_srv_split_pos(0),
m_imagelist(16,16),
m_tblist(32,32),
m_prefsVisible(false),
m_wndToolbar(NULL),
m_wndTaskbarNotifier(NULL),
m_nActiveDialog(DT_NETWORKS_WND),
m_is_safe_state(false),
m_BlinkMessages(false),
m_CurrentBlinkBitmap(24),
m_last_iconizing(0),
m_skinFileName(),
m_clientSkinNames(CLIENT_SKIN_SIZE)
{
	// Initialize skin names
	m_clientSkinNames[Client_Green_Smiley]            = wxT("Transfer");
	m_clientSkinNames[Client_Red_Smiley]              = wxT("Connecting");
	m_clientSkinNames[Client_Yellow_Smiley]           = wxT("OnQueue");
	m_clientSkinNames[Client_Grey_Smiley]             = wxT("A4AFNoNeededPartsQueueFull");
	m_clientSkinNames[Client_White_Smiley]            = wxT("StatusUnknown");
	m_clientSkinNames[Client_ExtendedProtocol_Smiley] = wxT("ExtendedProtocol");
	m_clientSkinNames[Client_SecIdent_Smiley]         = wxT("SecIdent");
	m_clientSkinNames[Client_BadGuy_Smiley]           = wxT("BadGuy");
	m_clientSkinNames[Client_CreditsGrey_Smiley]      = wxT("CreditsGrey");
	m_clientSkinNames[Client_CreditsYellow_Smiley]    = wxT("CreditsYellow");
	m_clientSkinNames[Client_Upload_Smiley]           = wxT("Upload");
	m_clientSkinNames[Client_Friend_Smiley]           = wxT("Friend");
	m_clientSkinNames[Client_eMule_Smiley]            = wxT("eMule");
	m_clientSkinNames[Client_mlDonkey_Smiley]         = wxT("mlDonkey");
	m_clientSkinNames[Client_eDonkeyHybrid_Smiley]    = wxT("eDonkeyHybrid");
	m_clientSkinNames[Client_aMule_Smiley]            = wxT("aMule");
	m_clientSkinNames[Client_lphant_Smiley]           = wxT("lphant");
	m_clientSkinNames[Client_Shareaza_Smiley]         = wxT("Shareaza");
	m_clientSkinNames[Client_xMule_Smiley]            = wxT("xMule");
	m_clientSkinNames[Client_Unknown]                 = wxT("Unknown");
	m_clientSkinNames[Client_InvalidRating_Smiley]    = wxT("InvalidRatingOnFile");
	m_clientSkinNames[Client_PoorRating_Smiley]       = wxT("PoorRatingOnFile");
	m_clientSkinNames[Client_GoodRating_Smiley]       = wxT("GoodRatingOnFile");
	m_clientSkinNames[Client_FairRating_Smiley]       = wxT("FairRatingOnFile");
	m_clientSkinNames[Client_ExcellentRating_Smiley]  = wxT("ExcellentRatingOnFile");
	m_clientSkinNames[Client_CommentOnly_Smiley]      = wxT("CommentOnly");
	m_clientSkinNames[Client_Encryption_Smiley]       = wxT("Encrypted");

	// wxWidgets send idle events to ALL WINDOWS by default... *SIGH*
	wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED);
	wxUpdateUIEvent::SetMode(wxUPDATE_UI_PROCESS_SPECIFIED);
	wxInitAllImageHandlers();
	Apply_Clients_Skin();

#ifdef __WINDOWS__ 
	wxSystemOptions::SetOption(wxT("msw.remap"), 0);
#endif

#if !(wxCHECK_VERSION(2, 9, 0) && defined(__WXMAC__))
	// this crashes on Mac with wx 2.9
	SetIcon(wxICON(aMule));
#endif

	srand(time(NULL));

	// Create new sizer and stuff a wxPanel in there.
	wxFlexGridSizer *s_main = new wxFlexGridSizer(1);
	s_main->AddGrowableCol(0);
	s_main->AddGrowableRow(0);

	wxPanel* p_cnt = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize);
	s_main->Add(p_cnt, 0, wxGROW|wxEXPAND, 0);
	muleDlg(p_cnt, false, true);
	SetSizer(s_main, true);

	m_serverwnd = new CServerWnd(p_cnt, m_srv_split_pos);
	AddLogLineN(wxEmptyString);
	AddLogLineN(wxT(" - ") +
		CFormat(_("This is aMule %s based on eMule.")) % GetMuleVersion());
	AddLogLineN(wxT("   ") +
		CFormat(_("Running on %s")) % wxGetOsDescription());
	AddLogLineN(wxT(" - ") +
		wxString(_("Visit http://www.amule.org to check if a new version is available.")));
	AddLogLineN(wxEmptyString);

#ifdef ENABLE_IP2COUNTRY
	m_GeoIPavailable = true;
	m_IP2Country = new CIP2Country(thePrefs::GetConfigDir());
#else
	m_GeoIPavailable = false;
#endif
	m_searchwnd = new CSearchDlg(p_cnt);
	m_transferwnd = new CTransferWnd(p_cnt);
	m_sharedfileswnd = new CSharedFilesWnd(p_cnt);
	m_statisticswnd = new CStatisticsDlg(p_cnt, theApp->m_statistics);
	m_chatwnd = new CChatWnd(p_cnt);
	m_kademliawnd = CastChild(wxT("kadWnd"), CKadDlg);

	m_serverwnd->Show(false);
	m_searchwnd->Show(false);
	m_transferwnd->Show(false);
	m_sharedfileswnd->Show(false);
	m_statisticswnd->Show(false);
	m_chatwnd->Show(false);

	// Create the GUI timer
	gui_timer=new wxTimer(this,ID_GUI_TIMER_EVENT);
	if (!gui_timer) {
		AddLogLineN(_("FATAL ERROR: Failed to create Timer"));
		exit(1);
	}

	// Set transfers as active window
	Create_Toolbar(thePrefs::VerticalToolbar());
	SetActiveDialog(DT_TRANSFER_WND, m_transferwnd);
	m_wndToolbar->ToggleTool(ID_BUTTONDOWNLOADS, true );

	bool override_where = (where != wxDefaultPosition);
	bool override_size = (
		(dlg_size.x != DEFAULT_SIZE_X) ||
		(dlg_size.y != DEFAULT_SIZE_Y) );
	if (!LoadGUIPrefs(override_where, override_size)) {
		// Prefs not loaded for some reason, exit
		AddLogLineC(wxT("Error! Unable to load Preferences") );
		return;
	}

	// Prepare the dialog, sets the splitter-position (AFTER window size is set)
	m_transferwnd->Prepare();

	m_is_safe_state = true;

	// Init statistics stuff, better do it asap
	m_statisticswnd->Init();
	m_kademliawnd->Init();
	m_searchwnd->UpdateCatChoice();

	if (thePrefs::UseTrayIcon()) {
		CreateSystray();
	}

	Show(true);
	// Must we start minimized?
	if (thePrefs::GetStartMinimized()) {
		DoIconize(true);
	}

	// Set shortcut keys
	wxAcceleratorEntry entries[] = {
		wxAcceleratorEntry(wxACCEL_CTRL, wxT('Q'), wxID_EXIT)
	};

	SetAcceleratorTable(wxAcceleratorTable(itemsof(entries), entries));
	ShowED2KLinksHandler( thePrefs::GetFED2KLH() );

	wxNotebook* logs_notebook = CastChild( ID_SRVLOG_NOTEBOOK, wxNotebook);
	wxNotebook* networks_notebook = CastChild( ID_NETNOTEBOOK, wxNotebook);

	wxASSERT(logs_notebook->GetPageCount() == 4);
	wxASSERT(networks_notebook->GetPageCount() == 2);

	for (uint32 i = 0; i < logs_notebook->GetPageCount(); ++i) {
		m_logpages[i].page = logs_notebook->GetPage(i);
		m_logpages[i].name = logs_notebook->GetPageText(i);
	}

	for (uint32 i = 0; i < networks_notebook->GetPageCount(); ++i) {
		m_networkpages[i].page = networks_notebook->GetPage(i);
		m_networkpages[i].name = networks_notebook->GetPageText(i);
	}

	DoNetworkRearrange();
}
Exemple #3
0
void CamuleDlg::OnToolBarButton(wxCommandEvent& ev)
{
	static int lastbutton = ID_BUTTONDOWNLOADS;

	// Kry - just if the GUI is ready for it
	if ( m_is_safe_state ) {

		// Rehide the handler if needed
		if ( lastbutton == ID_BUTTONSEARCH && !thePrefs::GetFED2KLH() ) {
			if (ev.GetId() != ID_BUTTONSEARCH) {
				ShowED2KLinksHandler( false );
			} else {
				// Toogle ED2K handler.
				ToogleED2KLinksHandler();
			}
		}

		if ( lastbutton != ev.GetId() ) {
			switch ( ev.GetId() ) {
				case ID_BUTTONNETWORKS:
					SetActiveDialog(DT_NETWORKS_WND, m_serverwnd);
					// Set serverlist splitter position
					CastChild( wxT("SrvSplitterWnd"), wxSplitterWindow )->SetSashPosition(m_srv_split_pos, true);
					break;

				case ID_BUTTONSEARCH:
					// The search dialog should always display the handler
					if ( !thePrefs::GetFED2KLH() )
						ShowED2KLinksHandler( true );

					SetActiveDialog(DT_SEARCH_WND, m_searchwnd);
					break;

				case ID_BUTTONDOWNLOADS:
					SetActiveDialog(DT_TRANSFER_WND, m_transferwnd);
					// Prepare the dialog, sets the splitter-position
					m_transferwnd->Prepare();
					break;

				case ID_BUTTONSHARED:
					SetActiveDialog(DT_SHARED_WND, m_sharedfileswnd);
					break;

				case ID_BUTTONMESSAGES:
					m_BlinkMessages = false;
					SetActiveDialog(DT_CHAT_WND, m_chatwnd);
					break;

				case ID_BUTTONSTATISTICS:
					SetActiveDialog(DT_STATS_WND, m_statisticswnd);
					break;

				// This shouldn't happen, but just in case
				default:
					AddLogLineC(wxT("Unknown button triggered CamuleApp::OnToolBarButton().") );
					break;
			}
		}

		m_wndToolbar->ToggleTool(lastbutton, lastbutton == ev.GetId() );
		lastbutton = ev.GetId();
	}
}
Exemple #4
0
BOOL CMainDlg::OnInitDialog() 
{	
	CDialog::OnInitDialog();		
	SetFolderPath();
	//skin
	CString sSkinPath;
	sSkinPath.Format("%s\\skin.bmp",m_sFolderPath);
	m_hBmp = (HBITMAP)LoadImage(AfxGetInstanceHandle(),sSkinPath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
	m_bFirst = TRUE;
	//inisialisasi database
	CString sDBPath;
	
	m_pDb = new CADODatabase();
	sDBPath.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s\\db\\tts.mdb;Persist Security Info=False",m_sFolderPath);		

	if(m_pDb->Open(sDBPath))
	{			
		//inisialiasi backpropagation
		m_backpro.SetConnDB(m_pDb);		
		//inisialiasi second positioning asymetric windowing
		m_spaw.SetConnDB(m_pDb);
		m_spaw.SetBackPro(&m_backpro);
		
		m_spaw.Initialize(WINDOWSIZE,CENTERWINDOWPOS,4000,0.01, 0.01,4000);
		
		//inisialisasi speech
	
		//inisialisai natural language
		m_NatLang.SetConnDB(m_pDb);
		m_NatLang.m_sFolderPath = m_sFolderPath;
		m_NatLang.SetSPAW(&m_spaw);	

		//inisialisasi tiap dialog di memory		
		m_pLearningDlg = new CLearningDlg;	
		m_pLearningDlg->SetSPAW(&m_spaw);
		m_pLearningDlg->Create( IDD_LEARNING_DIALOG, &m_cMainPanel);
		m_pLearningDlg->ShowWindow(SW_HIDE);
					
		m_pKataDlg = new CKataDlg;
		m_pKataDlg->SetSPAW(&m_spaw);
		m_pKataDlg->SetDB(m_pDb);
		m_pKataDlg->Create( IDD_DATA_KATA, &m_cMainPanel);
		m_pKataDlg->ShowWindow(SW_HIDE);
		
		m_pPengecualianDlg = new CPengecualianDlg;
		m_pPengecualianDlg->SetDB(m_pDb);
		m_pPengecualianDlg->Create(IDD_DATA_PENGECUALIAN, &m_cMainPanel);
		m_pPengecualianDlg->ShowWindow(SW_HIDE);

		m_pSingkatanDlg = new CSingkatanDlg;
		m_pSingkatanDlg->SetDB(m_pDb);
		m_pSingkatanDlg->Create(IDD_DATA_SINGKATAN,&m_cMainPanel);
		m_pSingkatanDlg->ShowWindow(SW_HIDE);

		m_pPengucapanDlg = new CNETtalk2Dlg;
		m_pPengucapanDlg->SetNatLang(&m_NatLang);
		m_pPengucapanDlg->SetConnDB(m_pDb);
		m_pPengucapanDlg->Create(IDD_NETTALK2_DIALOG,&m_cMainPanel);
		m_pPengucapanDlg->ShowWindow(SW_SHOW);
		m_pPengucapanDlg->m_hLearning = m_pLearningDlg->m_hWnd;
		m_pPengucapanDlg->m_sFolderpath = m_sFolderPath;
		SetActiveDialog(m_pPengucapanDlg);
	
		SetStyle();
	}
	else
	{
		MessageBox("Error dalam membuka database","NETtalk2",MB_OK);	
		EndDialog(0);
	}
	
	SetWindowPos(&CWnd::wndTop,0,0,0,0,SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
	CenterWindow();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #5
0
void CMainDlg::OnKata() 
{
	SetActiveDialog(m_pKataDlg)	;
	SetSelected(m_cKata.GetDlgCtrlID());
}
Exemple #6
0
void CMainDlg::OnPengucapan() 
{
	SetActiveDialog(m_pPengucapanDlg);
	SetSelected(m_cPengucapan.GetDlgCtrlID());
}
Exemple #7
0
void CMainDlg::OnPembelajaran() 
{
	SetActiveDialog(m_pLearningDlg);
	SetSelected(m_cPembelajaran.GetDlgCtrlID());
}
Exemple #8
0
void CMainDlg::OnSingkatan() 
{
	SetActiveDialog(m_pSingkatanDlg);
	SetSelected(m_cSingkatan.GetDlgCtrlID());	
}