示例#1
0
void CScreenProfile::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		m_pProfile = g_pProfileMgr->GetCurrentProfile();
		SAFE_STRCPY(m_szProfile,m_pProfile->m_sName.c_str());
		UpdateProfileName();

	}
	CBaseScreen::OnFocus(bFocus);
}
示例#2
0
void CScreenProfile::OnFocus(bool bFocus)
{
	if (bFocus)
	{
		m_pProfile = g_pProfileMgr->GetCurrentProfile();
		LTStrCpy(m_szProfile,m_pProfile->m_sFriendlyName.c_str(), LTARRAYSIZE(m_szProfile));
		UpdateProfileName();

	}
	CBaseScreen::OnFocus(bFocus);
}
示例#3
0
uint32 CScreenProfile::OnCommand(uint32 dwCommand, uint32 dwParam1, uint32 dwParam2)
{
	switch (dwCommand)
	{
	case CMD_OK:
		{
			m_pDlg->Show(LTFALSE);
			SetCapture(LTNULL);
			HandleDlgCommand(nCommand,(uint16)dwParam1);
			SetSelection(1);
		}
		break;
	case CMD_CANCEL:
		{
			m_pDlg->Show(LTFALSE);
			SetCapture(LTNULL);
			SetSelection(1);
		}
		break;

	case CMD_LOAD:
		{
			m_pDlg->Show(LTTRUE);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_CONFIRM:
		{
			uint16 nIndex = (uint16)dwParam1;
			if (dwParam2 == CMD_DELETE)
			{
				if (nIndex < m_pListCtrl->GetNumControls()) 
				{
					StringSet::iterator iter = m_ProfileList.begin();
					for (int i = 0; i < nIndex && iter != m_ProfileList.end(); ++i, ++iter);

					if (iter != m_ProfileList.end())
					{
						std::string profile = *iter;
						g_pProfileMgr->DeleteProfile(profile);

					}
					m_pProfile = g_pProfileMgr->GetCurrentProfile();
					SAFE_STRCPY(m_szProfile, m_pProfile->m_sName.c_str());
					UpdateProfileName();

				}
			}
			else if (dwParam2 == CMD_LOAD)
			{
				if (nIndex < m_pListCtrl->GetNumControls()) 
				{
					StringSet::iterator iter = m_ProfileList.begin();
					for (int i = 0; i < nIndex && iter != m_ProfileList.end(); ++i, ++iter);

					if (iter != m_ProfileList.end())
					{
						std::string profile = *iter;
						g_pProfileMgr->NewProfile(profile);
						m_pProfile = g_pProfileMgr->GetCurrentProfile();

						SAFE_STRCPY(m_szProfile, profile.c_str());
						UpdateProfileName();
					}
				}
			}
			else if (dwParam2 == CMD_CREATE)
			{
				SAFE_STRCPY(m_szOldProfile,m_szProfile);
				bCreate = LTTRUE;

				//show edit box here	
				MBCreate mb;
				mb.eType = LTMB_EDIT;
				mb.pFn = EditCallBack;
				mb.pString = m_szProfile;
				mb.nMaxChars = MAX_PROFILE_NAME;
				mb.eInput = CLTGUIEditCtrl::kInputFileFriendly;
				g_pInterfaceMgr->ShowMessageBox(IDS_ENTER_PROFILE_NAME,&mb);
			}
		}
		break;
	case CMD_DELETE:
		{
			m_pDlg->Show(LTTRUE);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_CREATE:
		{
			if (g_pLTClient->IsConnected())
			{
				MBCreate mb;
				mb.eType = LTMB_YESNO;
				mb.pFn = CreateCallBack,
				g_pInterfaceMgr->ShowMessageBox(IDS_CONFIRM_NEWPROFILE,&mb);
			}
			else
				SendCommand(CMD_CONFIRM,0,CMD_CREATE);
		}
		break;
	case CMD_RENAME:
		{
			m_pDlg->Show(LTTRUE);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_EDIT:
		{
			SAFE_STRCPY(m_szProfile,(char *)dwParam1);
			std::string profileName = m_szProfile;
			StringSet::iterator iter = m_ProfileList.find(profileName);

			if (iter != m_ProfileList.end())
			{
				//don't proceed renaming or creating a new one if we already have a profile of that
				//name
				MBCreate mb;
				mb.eType = LTMB_OK;
				mb.pFn = NULL,
				g_pInterfaceMgr->ShowMessageBox(IDS_PROFILE_ALREADY_EXISTS,&mb);
			}
			else
			{
				if (bCreate)
				{
					g_pProfileMgr->NewProfile(profileName);
				}
				else
				{
					g_pProfileMgr->RenameProfile(szOldFN,profileName);
				}
				m_pProfile = g_pProfileMgr->GetCurrentProfile();
				SAFE_STRCPY(m_szProfile,m_pProfile->m_sName.c_str());
				UpdateProfileName();
			}
		}
		break;
	default:
		return CBaseScreen::OnCommand(dwCommand,dwParam1,dwParam2);
	}

	return 1;
};
示例#4
0
uint32 CScreenProfile::OnCommand(uint32 dwCommand, uint32 dwParam1, uint32 dwParam2)
{
	switch (dwCommand)
	{
	case CMD_OK:
		{
			m_pDlg->Show(false);
			SetCapture(NULL);
			HandleDlgCommand(nCommand,(uint16)dwParam1);
			SetSelection(1);
		}
		break;
	case CMD_CANCEL:
		{
			m_pDlg->Show(false);
			SetCapture(NULL);
			SetSelection(1);
		}
		break;

	case CMD_LOAD:
		{
			m_pDlg->Show(true);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_CONFIRM:
		{
			uint16 nIndex = (uint16)dwParam1;
			if (dwParam2 == CMD_DELETE)
			{
				if (nIndex < m_pListCtrl->GetNumControls()) 
				{
					ProfileArray::iterator iter = m_ProfileList.begin();
					for (int i = 0; i < nIndex && iter != m_ProfileList.end(); ++i, ++iter);

					if (iter != m_ProfileList.end())
					{
						g_pProfileMgr->DeleteProfile(iter->m_sFileName.c_str());

					}
					m_pProfile = g_pProfileMgr->GetCurrentProfile();
					LTStrCpy(m_szProfile, m_pProfile->m_sFriendlyName.c_str(), LTARRAYSIZE(m_szProfile));
					UpdateProfileName();

				}
			}
			else if (dwParam2 == CMD_LOAD)
			{
				if (nIndex < m_pListCtrl->GetNumControls()) 
				{
					ProfileArray::iterator iter = m_ProfileList.begin();
					for (int i = 0; i < nIndex && iter != m_ProfileList.end(); ++i, ++iter);

					if (iter != m_ProfileList.end())
					{
						g_pProfileMgr->NewProfile((*iter).m_sFileName.c_str(),L"",true);
						m_pProfile = g_pProfileMgr->GetCurrentProfile();

						LTStrCpy(m_szProfile, (*iter).m_sFriendlyName.c_str(), LTARRAYSIZE(m_szProfile));
						UpdateProfileName();
					}
				}
			}
			else if (dwParam2 == CMD_CREATE)
			{
				LTStrCpy(m_szOldProfile,m_szProfile, LTARRAYSIZE(m_szOldProfile));
				bCreate = true;

				//show edit box here	
				MBCreate mb;
				mb.eType = LTMB_EDIT;
				mb.pFn = EditCallBack;
				mb.pUserData = this;
				mb.pString = g_pProfileMgr->GetCurrentProfile()->m_sFriendlyName.c_str();
				mb.nMaxChars = MAX_PROFILE_NAME;
//				mb.eInput = kInputFileFriendly;
				g_pInterfaceMgr->ShowMessageBox("IDS_ENTER_PROFILE_NAME",&mb);
			}
		}
		break;
	case CMD_DELETE:
		{
			m_pDlg->Show(true);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_CREATE:
		{
			if (g_pLTClient->IsConnected())
			{
				MBCreate mb;
				mb.eType = LTMB_YESNO;
				mb.pFn = CreateCallBack;
				mb.pUserData = this;
				g_pInterfaceMgr->ShowMessageBox("IDS_CONFIRM_NEWPROFILE",&mb);
			}
			else
				SendCommand(CMD_CONFIRM,0,CMD_CREATE);
		}
		break;
	case CMD_RENAME:
		{
			m_pDlg->Show(true);
			SetCapture(m_pDlg);
			nCommand = dwCommand;
		}
		break;
	case CMD_EDIT:
		{
			std::wstring profileName = (wchar_t *)dwParam1;
			
			ProfileArray::iterator iter = m_ProfileList.begin();
			while (iter != m_ProfileList.end() && !LTStrIEquals( (*iter).m_sFriendlyName.c_str(), profileName.c_str() ) )
			{
				iter++;
			}

			if (iter != m_ProfileList.end())
			{
				//don't proceed renaming or creating a new one if we already have a profile of that
				//name
				MBCreate mb;
				mb.eType = LTMB_OK;
				mb.pFn = NULL,
				g_pInterfaceMgr->ShowMessageBox("IDS_PROFILE_ALREADY_EXISTS",&mb);
			}
			else
			{
				if (bCreate)
				{
					char szName[32] = "";
					uint32 n = 0;
					do 
					{
						LTSNPrintF(szName,LTARRAYSIZE(szName),"Profile%03d",n);
						n++;
					} while (CWinUtil::FileExist(GetAbsoluteProfileFile( g_pLTClient, szName)));
					g_pProfileMgr->NewProfile(szName, profileName.c_str(), false);
				}
				else
				{
					g_pProfileMgr->RenameProfile(szOldFN,profileName.c_str());
				}
				m_pProfile = g_pProfileMgr->GetCurrentProfile();
				LTStrCpy(m_szProfile,m_pProfile->m_sFriendlyName.c_str(), LTARRAYSIZE(m_szProfile));
				UpdateProfileName();
			}
		}
		break;
	default:
		return CBaseScreen::OnCommand(dwCommand,dwParam1,dwParam2);
	}

	return 1;
};