Exemple #1
0
result Dictionary::OnInitializing(void)
{
	if (!CommonSetting::GetInstance().NSHDictionary)
		ShowInfoDlg();

	InitLessonState();
	//BaseWebForm::OnInitializing();

	__WCtrl->SetLessonWorkerListener(this);
	return E_SUCCESS;
}
Exemple #2
0
void BaseWordForm::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
{
	switch (actionId)
	{
	case ID_ADD_WORD:
	{
		if (__pAddWordDlg)
			delete __pAddWordDlg;

		__pAddWordDlg = new AddWord();
		__pAddWordDlg->ShowPopup(this);

		break;
	}
	case ID_MENU:
	{
		int hp = 0;
		int wp = 0;
		Header *header = GetHeader();

		if (header)
		{
			int posy = GetBounds().height - GetClientAreaBounds().height;

			Footer * footer = GetFooter();
			if (footer)
				posy -= footer->GetHeight();

			hp = (posy - 10);
			wp = header->GetWidth() - 10;
		}
		// Set the anchor position of the ContextMenu
		__pContextMenu->SetPosition(Point(wp, hp));

		// Show the ContextMenu
		__pContextMenu->SetShowState(true);
		__pContextMenu->Show();

		break;
	}
	case ID_DICTIONARY:
	{
		ShowDictionary();
		break;
	}
	case ID_MENU_INFO:
	{
		ShowInfoDlg();
		break;
	}
	}
}
Exemple #3
0
void Dictionary::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
{

	//ShowInfoDlg();

	if (actionId == ID_MENU_INFO)
	{
		ShowInfoDlg();
	}
	else if (actionId == ID_MENU_RESETDB)
	{
		MessageBox messageBox;
		messageBox.Construct(Utils::GetString("IDS_DIC_MENU_RESET_DB"), Utils::GetString("IDS_MSG_RESET_DB"), MSGBOX_STYLE_YESNO);
		// Calls ShowAndWait - draw, show itself and process events
		int modalResult = 0;
		messageBox.ShowAndWait(modalResult);
		if (modalResult == MSGBOX_RESULT_YES)
		{
			// remove all word!
			__WCtrl->DeleteLesson(0);
			CommonSetting *cs = &CommonSetting::GetInstance();
			cs->lern = "";
			cs->native = "";
			cs->Store();

			InitFrm * pInit = new InitFrm();
			pInit->Initialize();
			Utils::ShowFront(pInit, this);
		}
	}
	else if (actionId == ID_ADD_WORD)
	{
		AddWord *aw = new AddWord();
		aw->SetResultListener(this, ID_MENU_ADD_WORD_SUCCCES);
		aw->ShowPopup(this);
		AddToDestructList(aw);
	}
	else if (actionId == ID_MENU_ADD_WORD_SUCCCES)
	{
		__pList->RefreshList(__pList->GetItemCount() - 1, LIST_REFRESH_TYPE_ITEM_MODIFY);
	}
	else BaseWordForm::OnActionPerformed(source, actionId);
}
Exemple #4
0
void CPlayerDlg::SaveConfig()
{
	DoDataExchange(TRUE);

	if(m_conf)
		mconfig.SetValue(_T("use-filedir-conf"), _T("1"));
	else
		mconfig.RemoveValue(_T("use-filedir-conf"));

	if(m_double)
		mconfig.SetValue(_T("double"), _T("1"));
	else
		mconfig.RemoveValue(_T("double"));

	if(m_quiet)
		mconfig.SetValue(_T("quiet"), _T("1"));
	else
		mconfig.RemoveValue(_T("quiet"));

	if(m_fullscreen)
		mconfig.SetValue(_T("fs"), _T("1"));
	else
		mconfig.RemoveValue(_T("fs"));

	if(m_url)
		mconfig.SetValue(_T("urlcp"), _T("GBK"));
	else
		mconfig.RemoveValue(_T("urlcp"));

	if(m_framedrop)
		mconfig.SetValue(_T("framedrop"), _T("1"));
	else
		mconfig.RemoveValue(_T("framedrop"));

	if(m_idx)
		mconfig.SetValue(_T("idx"), _T("1"));
	else
		mconfig.RemoveValue(_T("idx"));

	if(m_guithread)
		mconfig.SetValue(_T("gui_thread"), _T("1"), true, ex_option);
	else
		mconfig.RemoveValue(_T("gui_thread"), true);

	if(m_gui_high)
		mconfig.SetValue(_T("gui_priority_lowest"), _T("0"), true, ex_gui);
	else
		mconfig.RemoveValue(_T("gui_priority_lowest"), true);

	if(m_reload)
		mconfig.SetValue(_T("reload_when_open"), _T("1"), true, ex_setting);
	else
		mconfig.RemoveValue(_T("reload_when_open"), true);

	if(m_no_dvdnav)
		mconfig.SetValue(_T("no_dvdnav"), _T("1"), true, ex_setting);
	else
		mconfig.RemoveValue(_T("no_dvdnav"), true);

	if(m_htimer)
		mconfig.SetValue(_T("high_accuracy_timer"), _T("1"), true, ex_option);
	else
		mconfig.RemoveValue(_T("high_accuracy_timer"), true);

	if(m_seekrt)
		mconfig.RemoveValue(_T("seek_realtime"), true);
	else
		mconfig.SetValue(_T("seek_realtime"), _T("0"), true, ex_setting);
	
	if(m_oneplayer)
		mconfig.SetValue(_T("one_player"), _T("1") ,true ,ex_setting);
	else
		mconfig.RemoveValue(_T("one_player"), true);

	if(m_quit)
		mconfig.RemoveValue(_T("always_quit"), true);
	else
		mconfig.SetValue(_T("always_quit"), _T("0"), true, ex_option);
	
	//Cache
	mconfig.RemoveValue(_T("auto-cache"));
	mconfig.RemoveValue(_T("cache-min"));
	switch (aComboCache.GetSelectedIndex())
	{
	case cache_512K:
		mconfig.SetValue(_T("cache"), _T("512") );
		break;
	case cache_1:
		mconfig.SetValue(_T("cache"), _T("1024") );
		break;
	case cache_2:
		mconfig.SetValue(_T("cache"), _T("2048") );
		break;
	case cache_4:
		mconfig.SetValue(_T("cache"), _T("4096") );
		break;
	case cache_8:
		mconfig.SetValue(_T("cache"), _T("8192") );
		break;
	case cache_16:
		mconfig.SetValue(_T("cache"), _T("16384") );
		break;
	case cache_32:
		mconfig.SetValue(_T("cache"), _T("32768") );
		break;
	case cache_64:
		mconfig.SetValue(_T("cache"), _T("65536") );
		break;
	case cache_96:
		mconfig.SetValue(_T("cache"), _T("98304") );
		break;
	case cache_128:
		mconfig.SetValue(_T("cache"), _T("131072") );
		mconfig.SetValue(_T("cache-min"), _T("10") );
		break;
	case cache_256:
		mconfig.SetValue(_T("cache"), _T("262144") );
		mconfig.SetValue(_T("cache-min"), _T("8") );
		break;
	case cache_auto:
		mconfig.SetValue(_T("auto-cache"), _T("1") );
		mconfig.RemoveValue(_T("cache"));
		break;
	default:
		mconfig.RemoveValue(_T("cache"));
		break;
	}
	
	//Loop
	switch (aComboLoop.GetSelectedIndex())
	{
	case loop_list:
		mconfig.SetValue(_T("loop"), _T("0"));
		mconfig.SetValue(_T("loop_all"), _T("1"), true, ex_setting);
		break;
	case loop_single:
		mconfig.SetValue(_T("loop"), _T("0"));
		mconfig.RemoveValue(_T("loop_all"), true);
		break;
	default:
		mconfig.RemoveValue(_T("loop"));
	}

	//AutoSync
	switch (aComboASync.GetSelectedIndex())
	{
	case sync_normal:
		mconfig.SetValue(_T("autosync"), _T("30"));
		mconfig.RemoveValue(_T("mc"));
		mconfig.RemoveValue(_T("nobps"));
		break;
	case sync_fast:
		mconfig.SetValue(_T("autosync"), _T("100"));
		mconfig.RemoveValue(_T("mc"));
		mconfig.RemoveValue(_T("nobps"));
		break;
	case sync_flv:
		mconfig.SetValue(_T("autosync"), _T("0"));
		mconfig.SetValue(_T("mc"), _T("1"));
		mconfig.RemoveValue(_T("nobps"));
		break;
	case sync_flvex:
		mconfig.SetValue(_T("autosync"), _T("0"));
		mconfig.SetValue(_T("mc"), _T("0.001"));
		mconfig.RemoveValue(_T("nobps"));
		break;
	case sync_avi:
		mconfig.SetValue(_T("autosync"), _T("0"));
		mconfig.SetValue(_T("nobps"), _T("1"));
		mconfig.RemoveValue(_T("mc"));
		break;
	default:
		mconfig.SetValue(_T("autosync"), _T("0"));
		mconfig.RemoveValue(_T("mc"));
		mconfig.RemoveValue(_T("nobps"));
		break;
	}

	//log
	mconfig.RemoveValue(_T("v"));
	switch (aComboLog.GetSelectedIndex())
	{
	case log_v1:
		mconfig.SetValue(_T("v") ,_T("1") );
		goto LogFile;
	case log_v2:
		mconfig.SetValue(_T("v") ,_T("2") );
		goto LogFile;
	case log_v3:
		mconfig.SetValue(_T("v") ,_T("3") );
		goto LogFile;
	case log_v4:
		mconfig.SetValue(_T("v") ,_T("4") );
		goto LogFile;
	case log_v5:
		mconfig.SetValue(_T("v") ,_T("5") );
	case log_normal:
LogFile:
		mconfig.SetValue(_T("log"), _T("1"), true, ex_option);
		break;
	case log_console_v1:
		mconfig.SetValue(_T("v") ,_T("1") );
		goto LogConsole;
	case log_console_v2:
		mconfig.SetValue(_T("v") ,_T("2") );
		goto LogConsole;
	case log_console_v3:
		mconfig.SetValue(_T("v") ,_T("3") );
		goto LogConsole;
	case log_console_v4:
		mconfig.SetValue(_T("v") ,_T("4") );
		goto LogConsole;
	case log_console_v5:
		mconfig.SetValue(_T("v") ,_T("5") );
	case log_console:
LogConsole:
		mconfig.SetValue(_T("log") ,_T("2") , true , ex_option);
		break;
	default:
		mconfig.SetValue(_T("log"), _T("0"), true, ex_option);
		break;
	}

	//AutoPlay
	switch (aComboAPlay.GetSelectedIndex())
	{
	case play_auto:
		mconfig.SetValue(_T("autoplay"), _T("1"));
		mconfig.SetValue(_T("autoplay_fuzziness"), _T("0"), true, ex_option);
		break;
	case play_none:
		mconfig.RemoveValue(_T("autoplay"));
		break;
	case play_ex_10:
		mconfig.SetValue(_T("autoplay_fuzziness"), _T("10"), true, ex_option);
		goto AutoPlay;
	case play_ex_20:
		mconfig.SetValue(_T("autoplay_fuzziness"), _T("20"), true, ex_option);
		goto AutoPlay;
	case play_ex_50:
		mconfig.SetValue(_T("autoplay_fuzziness"), _T("50"), true, ex_option);
		goto AutoPlay;
	case play_ex_100:
		mconfig.SetValue(_T("autoplay_fuzziness"), _T("100"), true, ex_option);
		goto AutoPlay;
	case play_ex_200:
		mconfig.SetValue(_T("autoplay_fuzziness"), _T("200"), true, ex_option);
		goto AutoPlay;
	case play_ex_6:
		mconfig.SetValue(_T("autoplay_fuzziness"), _T("6"), true, ex_option);
	default:
AutoPlay:
		mconfig.SetValue(_T("autoplay"), _T("1"));
		break;
	}

	//Monitor
	CString m_monitor_s = aComboMonitor.GetSelectedString();
	if(m_monitor_s != rStr.autos)
		mconfig.SetValue(_T("monitoraspect"), m_monitor_s );
	else
		mconfig.RemoveValue(_T("monitoraspect"));

	//Priority
	switch (aComboPriority.GetSelectedIndex())
	{
	case prio_realtime:
		mconfig.SetValue(_T("priority"), _T("realtime"));
		ShowInfoDlg(type_realtime);
		break;
	case prio_high:
		mconfig.SetValue(_T("priority"), _T("high"));
		break;
	case prio_abovenormal:
		mconfig.SetValue(_T("priority"), _T("abovenormal"));
		break;
	case prio_normal:
		mconfig.SetValue(_T("priority"), _T("normal"));
		break;
	case prio_belownormal:
		mconfig.SetValue(_T("priority"), _T("belownormal"));
		break;
	case prio_idle:
		mconfig.SetValue(_T("priority"), _T("idle"));
		break;
	default:
		mconfig.RemoveValue(_T("priority"));
	}

	//Skip Time
	CString value_s;
	int value_i = ListStringtoTime(ListTime.GetItemText(0, 1));
	if(value_i > 0) {
		value_s.Format(_T("%d"), value_i);
		mconfig.SetValue(_T("ss"), value_s);
	} else
		mconfig.RemoveValue(_T("ss"));

	value_i = ListStringtoTime(ListTime.GetItemText(0, 3));
	if(value_i > 0) {
		value_s.Format(_T("%d"), value_i);
		mconfig.SetValue(_T("end_pos"), value_s, true, ex_status);
	} else
		mconfig.RemoveValue(_T("end_pos"), true);
}