本文整理汇总了C++中CLanguage类的典型用法代码示例。如果您正苦于以下问题:C++ CLanguage类的具体用法?C++ CLanguage怎么用?C++ CLanguage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLanguage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadLanguage
//-----------------------------------------------------------------------------
// Read Webserver Configurationfile for languages
//-----------------------------------------------------------------------------
void Cyhttpd::ReadLanguage(void) {
// Init Class vars
CLanguage *lang = CLanguage::getInstance();
log_level_printf(3, "ReadLanguage:%s\n",
ConfigList["Language.selected"].c_str());
lang->setLanguage(ConfigList["Language.selected"]);
}
示例2: InitDialog
ATMO_BOOL CAtmoColorPicker::InitDialog(WPARAM wParam)
{
CLanguage *Lng = new CLanguage;
HWND hwndCtrl;
hwndCtrl = this->getDlgItem(IDC_EDT_RED);
Edit_LimitText(hwndCtrl,3);
hwndCtrl = this->getDlgItem(IDC_EDT_GREEN);
Edit_LimitText(hwndCtrl,3);
hwndCtrl = this->getDlgItem(IDC_EDT_BLUE);
Edit_LimitText(hwndCtrl,3);
hwndCtrl = this->getDlgItem(IDC_SL_RED);
SendMessage(hwndCtrl, TBM_SETRANGEMIN, 0, 0);
SendMessage(hwndCtrl, TBM_SETRANGEMAX, 0, 255);
SendMessage(hwndCtrl, TBM_SETPOS, 1, this->m_iRed);
SendMessage(hwndCtrl, TBM_SETTICFREQ, 8, 0);
hwndCtrl = this->getDlgItem(IDC_SL_GREEN);
SendMessage(hwndCtrl, TBM_SETRANGEMIN, 0, 0);
SendMessage(hwndCtrl, TBM_SETRANGEMAX, 0, 255);
SendMessage(hwndCtrl, TBM_SETPOS, 1, this->m_iGreen);
SendMessage(hwndCtrl, TBM_SETTICFREQ, 8, 0);
hwndCtrl = this->getDlgItem(IDC_SL_BLUE);
SendMessage(hwndCtrl, TBM_SETRANGEMIN, 0, 0);
SendMessage(hwndCtrl, TBM_SETRANGEMAX, 0, 255);
SendMessage(hwndCtrl, TBM_SETPOS, 1, this->m_iBlue);
SendMessage(hwndCtrl, TBM_SETTICFREQ, 8, 0);
UpdateColorControls(ATMO_TRUE, ATMO_TRUE);
Lng->szCurrentDir[Lng->SetLngPath()];
sprintf(Lng->szFileINI, "%s\\Language.ini\0", Lng->szCurrentDir);
GetPrivateProfileString("Common", "Language", "English", Lng->szLang, 256, Lng->szFileINI);
// Read Buffer from IniFile
sprintf(Lng->szTemp, "%s\\%s.xml\0", Lng->szCurrentDir, Lng->szLang);
Lng->XMLParse(Lng->szTemp, Lng->sTextCPicker, "ColorPicker");
SendMessage(getDlgItem(IDC_STATIC22), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)(Lng->sTextCPicker[0]));
SendMessage(getDlgItem(IDC_STATIC23), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)(Lng->sTextCPicker[1]));
SendMessage(getDlgItem(IDC_STATIC24), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)(Lng->sTextCPicker[2]));
SendMessage(this->m_hDialog, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)(Lng->sTextCPicker[3]));
SendMessage(getDlgItem(IDCANCEL), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)(Lng->sTextCPicker[4]));
return ATMO_TRUE;
}
示例3: _T
void CSelectLanguageDlg::ListLanguages(CString sLanguageFolder)
{
// Declare variables
WIN32_FIND_DATA wfd;
HANDLE hFile;
CString sFile;
CString sSpec = sLanguageFolder + _T("*.xml");
CString sPathFile;
CLanguage * pLanguage = CLanguage::Instance();
CFunctions * pFunctions = CFunctions::Instance();
CPath * pPath = CPath::Instance();
LanguageType oLangType;
// Find the first file
hFile = FindFirstFile(sSpec, &wfd);
if (hFile != INVALID_HANDLE_VALUE)
{
do
{
// Get file info
sFile = wfd.cFileName;
sPathFile = sLanguageFolder + sFile;
// Get language info
if (pLanguage->LoadLanguage(sPathFile, _T(""), false))
{
// Check if it is the right version
if (pFunctions->CompareVersions(pLanguage->GetLanguageVersion(), VERSION_LANGUAGE) != COMPAREVERSION_FIRSTSMALLER)
{
// Add to list of languages
oLangType.sFilename = pPath->StripFileExtension(pPath->ExtractFileName(sPathFile));
oLangType.sDescription = pLanguage->GetLanguageName();
m_arrLanguages[m_iLanguageCount++] = oLangType;
}
}
}
while (FindNextFile(hFile, &wfd));
// Close handle to file
FindClose(hFile);
}
// Release last language
pLanguage->ReleaseLanguage();
}
示例4: GetLanguageDef
int CEdit::GetLanguageDef( LPCTSTR pszName, CM_LANGUAGE *pLang )
{
int cbLang = 0;
for ( int i = 0; i < g_nLanguageCount; i++ )
{
CLanguage *pLangFound = g_pLanguages[ i ];
if ( _tcsicmp( pLangFound->m_szName, pszName ) == 0 )
{
cbLang = pLangFound->GetSize();
if ( pLang )
{
memcpy( pLang, pLangFound->m_pLang, cbLang );
}
break;
}
}
return cbLang;
}
示例5: OnInitDialog
BOOL CCloseApplicationDlg::OnInitDialog()
{
// Declare variables
CString sTemp;
CLanguage * pLanguage = CLanguage::Instance();
// Call original function
CDialog::OnInitDialog();
// Set icon
m_icoApplication.SetSize(40, 40);
m_icoApplication.SetTransparentColor(RGB(0, 0, 0));
m_icoApplication.LoadIcon(m_hIcon);
// Set window text
sTemp.Format(pLanguage->GetString(IDS_CLOSEAPPLICATION_TITLE), m_sApplicationTitle);
SetWindowText(sTemp);
m_lblTitle.SetWindowText(sTemp);
// Set explanation text
sTemp.Format(pLanguage->GetString(IDS_CLOSEAPPLICATION_EXPLANATION), m_sApplicationTitle,
m_iCountDown, m_sApplicationTitle);
m_lblExplanation.SetWindowText(sTemp);
// Set button text
m_btnCancel.SetWindowText(pLanguage->GetString(IDS_GENERAL_CANCEL));
m_btnEndNow.SetWindowText(pLanguage->GetString(IDS_CLOSEAPPLICATION_ENDNOW));
// Create and set font
m_fntTitle.DeleteObject();
m_fntTitle.CreateFont(
20, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_BOLD, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
DEFAULT_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
PROOF_QUALITY, // nQuality
DEFAULT_PITCH | FF_DONTCARE, // nPitchAndFamily
NULL);
m_lblTitle.SetFont(&m_fntTitle);
// Auto resize controls
AutoResizeControls();
// Set control properties
m_prgEnd.SetRange32(0, CLOSEAPPLICATION_TIME);
m_prgEnd.SetPos(0);
// Start timer
SetTimer(TIMER_COUNTDOWN, 1000, NULL);
// Try to close application in a nice way
std::string strVersion;
UINT uWinPlatform;
UINT uVersion = getWinVersion(strVersion, uWinPlatform);
CString sProcess = CPath::Instance()->ExtractFileName(m_sApplicationPath);
if ((uVersion == WINDOWS_NT3) || (uVersion == WINDOWS_NT4))
{
CloseNTApplication(sProcess.GetBuffer(sProcess.GetLength()));
}
else
{
CloseAllWinApplication(sProcess.GetBuffer(sProcess.GetLength()));
}
// Return TRUE unless you want to set focus to a control
return TRUE;
}
示例6: getDlgItem
ATMO_BOOL CAtmoGradients::InitDialog(WPARAM wParam)
{
HWND groupBox = getDlgItem( IDC_ZONE_GROUP );
CLanguage *Lng = new CLanguage;
Lng->szCurrentDir[Lng->SetLngPath()];
sprintf(Lng->szFileINI, "%s\\Language.ini\0", Lng->szCurrentDir);
GetPrivateProfileString("Common", "Language", "English", Lng->szLang, 256, Lng->szFileINI);
// Read Buffer from IniFile
sprintf(Lng->szTemp, "%s\\%s.xml\0", Lng->szCurrentDir, Lng->szLang);
Lng->XMLParse(Lng->szTemp, Lng->sGradientsText, "Gradients");
SetWindowLongPtr(groupBox, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
OrgGroupBoxProc = (WNDPROC)SetWindowLongPtr(groupBox, GWL_WNDPROC, reinterpret_cast<LONG_PTR>(GroupBoxProc));
int zonenIdx = 0;
char zonename[100];
int xpos, ypos;
int zoneCount = m_pConfig->getZoneCount() + 1;
m_ZoneRadios = new HWND[ zoneCount ];
for(int i=0; i<zoneCount; i++)
m_ZoneRadios[i] = 0;
#define radio_width 60
#define radio_height 20
xpos = 10;
ypos = 12;
RECT rect, rrect;
GetClientRect( groupBox, &rect );
GetWindowRect( groupBox, &rrect );
if(m_pConfig->getZonesTopCount() > 0)
{
int radioWidth = (rect.right - rect.left - 20) / (m_pConfig->getZonesTopCount() + 1);
xpos = 10 + radioWidth - radio_width/2;
for( int zone=0; zone < m_pConfig->getZonesTopCount(); zone++)
{
sprintf( zonename, Lng->sGradientsText[0] + "%d", zonenIdx );
HWND handle = CreateWindow("BUTTON", zonename,
BS_AUTORADIOBUTTON | BS_LEFTTEXT | WS_VISIBLE | WS_TABSTOP | WS_CHILD,
xpos, ypos, radio_width, radio_height, groupBox, NULL, m_hInst, NULL);
SetWindowFont(handle, GetWindowFont(m_hDialog), false);
m_ZoneRadios[ zonenIdx ] = handle;
zonenIdx++;
xpos += radioWidth;
}
}
if( m_pConfig->getZonesLRCount() > 0 )
{
int radioHeight = (rect.bottom - rect.top - 40) / (m_pConfig->getZonesLRCount() + 1);
xpos = rect.right - 10 - radio_width;
ypos = rect.top + 20 + radioHeight - radio_height / 2;
for( int zone=0; zone < m_pConfig->getZonesLRCount(); zone++)
{
sprintf( zonename, Lng->sGradientsText[0] + "%d", zonenIdx );
HWND handle = CreateWindow("BUTTON", zonename,
BS_AUTORADIOBUTTON | BS_LEFTTEXT | WS_VISIBLE | WS_TABSTOP | WS_CHILD,
xpos, ypos, radio_width, radio_height, groupBox, NULL, m_hInst, NULL);
SetWindowFont(handle, GetWindowFont(m_hDialog), false);
m_ZoneRadios[ zonenIdx ] = handle;
zonenIdx++;
ypos += radioHeight;
}
}
if(m_pConfig->getZonesBottomCount() > 0)
{
int radioWidth = (rect.right - rect.left - 20) / (m_pConfig->getZonesBottomCount() + 1);
xpos = rect.right - 10 - radioWidth - radio_width/2 ;
ypos = rect.bottom - 30;
for( int zone=0; zone < m_pConfig->getZonesBottomCount(); zone++)
{
sprintf( zonename, Lng->sGradientsText[0] + "%d", zonenIdx );
HWND handle = CreateWindow("BUTTON", zonename,
BS_AUTORADIOBUTTON | BS_LEFTTEXT | WS_VISIBLE | WS_TABSTOP | WS_CHILD,
xpos, ypos, radio_width, radio_height, groupBox, NULL, m_hInst, NULL);
SetWindowFont(handle, GetWindowFont(m_hDialog), false);
m_ZoneRadios[ zonenIdx ] = handle;
zonenIdx++;
//.........这里部分代码省略.........
示例7: ParseException
Token&
Tokenizer::_ParseHexOperand()
{
const char* begin = fCurrentChar;
fCurrentChar += 2;
// skip "0x"
if (!_IsHexDigit(*fCurrentChar))
throw ParseException("expected hex digit", _CurrentPos());
fCurrentChar++;
while (_IsHexDigit(*fCurrentChar))
fCurrentChar++;
int32 length = fCurrentChar - begin;
fCurrentToken = Token(begin, length, _CurrentPos() - length,
TOKEN_CONSTANT);
if (length <= 10) {
// including the leading 0x, a 32-bit constant will be at most
// 10 characters. Anything larger, and 64 is necessary.
fCurrentToken.value.SetTo((uint32)strtoul(
fCurrentToken.string.String(), NULL, 16));
} else {
fCurrentToken.value.SetTo((uint64)strtoull(
fCurrentToken.string.String(), NULL, 16));
}
return fCurrentToken;
}
示例8: Token
void
Tokenizer::SetTo(const char* string)
{
fString = string;
fCurrentChar = fString.String();
fCurrentToken = Token();
fReuseToken = false;
}
示例9: Q4_ConnectToMasterServer
DWORD Q4_ConnectToMasterServer(GAME_INFO *pGI, int iMasterIdx)
{
size_t packetlen=0;
char sendbuf[40];
ZeroMemory(sendbuf,sizeof(sendbuf));
int len = 0;
len = UTILZ_ConvertEscapeCodes(pGI->szMasterQueryString,sendbuf,sizeof(sendbuf));
char szIP[260];
strcpy(szIP,pGI->szMasterServerIP[iMasterIdx]);
SplitIPandPORT(szIP,pGI->dwMasterServerPORT);
dbg_print("Master server %s:%d",szIP,(unsigned short)pGI->dwMasterServerPORT);
SOCKET ConnectSocket = getsockudp(szIP,(unsigned short)pGI->dwMasterServerPORT);
if(INVALID_SOCKET==ConnectSocket)
{
dbg_print("Error connecting to socket!");
return 1001;
}
dbg_print("Sending command %s Len: %d",sendbuf,len);
if(send(ConnectSocket, sendbuf, len, 0)==SOCKET_ERROR)
{
closesocket(ConnectSocket);
dbg_print("Error sending packet!");
return 1002;
}
int i = 0;
unsigned char *packet[iMAX_PACKETS];
size_t packlen[iMAX_PACKETS];
DWORD Q4_dwNewTotalServers=0;
// Let's retrieve all packets as fast as possible, that's the reason for splitting up int two for loop.
for(i=0; i<iMAX_PACKETS;i++)
{
packet[i] = NULL;
packet[i]=(unsigned char*)getpacket(ConnectSocket, &packlen[i]);
if(packet[i]==NULL) //End of transfer
break;
}
//Now parse all server IP's from recieved packets
for(i=0; i<iMAX_PACKETS;i++)
{
if(packet[i]==NULL) //End of packets
break;
Q4_dwNewTotalServers += Q4_ParseServers((char*)packet[i],packlen[i],pGI,Q4_InsertServerItem);
SetStatusText(pGI->iIconIndex,g_lang.GetString("StatusReceivingMaster"),Q4_dwNewTotalServers,pGI->szGAME_NAME);
free(packet[i]);
}
closesocket(ConnectSocket);
pGI->dwTotalServers = pGI->vSI.size();
return 0;
}
示例10: Buddy_AddBuddyProc
LRESULT CALLBACK Buddy_AddBuddyProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static BOOL bEditBuddyname = FALSE;
switch (message)
{
case WM_INITDIALOG:
{
SetDlgItemText(hDlg,IDC_STATIC_BUDDY_NAME,g_lang.GetString("BuddyName"));
CenterWindow(hDlg);
bEditBuddyname = (BOOL) lParam;
if(bEditBuddyname) //Edit mode
{
// if(pEditBuddy!=NULL)
{
if(itBuddyEdit->cMatchOnColorEncoded)
CheckDlgButton(hDlg,IDC_CHECK_NO_COLOR_MATCH,BST_CHECKED);
else
CheckDlgButton(hDlg,IDC_CHECK_NO_COLOR_MATCH,BST_UNCHECKED);
if(itBuddyEdit->cMatchExact)
CheckDlgButton(hDlg,IDC_CHECK_EXACT_MATCH,BST_CHECKED);
else
CheckDlgButton(hDlg,IDC_CHECK_EXACT_MATCH,BST_UNCHECKED);
PostMessage(GetDlgItem(hDlg,IDC_EDIT_NICKNAME_FILTER),EM_SETSEL,0,strlen(itBuddyEdit->szPlayerName));
PostMessage(GetDlgItem(hDlg,IDC_EDIT_NICKNAME_FILTER),EM_SETSEL,(WPARAM)-1,-1);
}
SetWindowText(hDlg,g_lang.GetString("TitleEditBuddy"));
SetDlgItemText(hDlg,IDC_EDIT_NICKNAME_FILTER,(TCHAR*)itBuddyEdit->szPlayerName);
}
else
{
SetWindowText(hDlg,g_lang.GetString("TitleAddBuddy"));
}
SetFocus(GetDlgItem(hDlg,IDC_EDIT_NICKNAME_FILTER));
//return TRUE;
}
break;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
if(LOWORD(wParam) == IDOK)
{
char szBuddy[100];
GetDlgItemText(hDlg,IDC_EDIT_NICKNAME_FILTER,szBuddy,sizeof(szBuddy)-1);
if(!bEditBuddyname)
{
bm.Add(szBuddy,NULL);
bm.UpdateList();
}else if(bEditBuddyname)
{
strcpy_s(itBuddyEdit->szPlayerName,szBuddy);
itBuddyEdit->cMatchOnColorEncoded = IsDlgButtonChecked(hDlg,IDC_CHECK_NO_COLOR_MATCH);
itBuddyEdit->cMatchExact = IsDlgButtonChecked(hDlg,IDC_CHECK_EXACT_MATCH);
}
}
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
示例11: Buddy_ListViewSubclassProc
LRESULT APIENTRY Buddy_ListViewSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HMENU hPopMenu;
if(uMsg == WM_COMMAND)
{
DWORD wmId;
DWORD wmEvent;
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EDIT_BUDDY:
{
//pEditBuddy = Buddy_GetBuddyInfoBySelection();
itBuddyEdit = bm.FindBuddyInfoByID(bm.GetBuddyIDBySelection());
if(itBuddyEdit!=bm.BuddyList.end())
{
DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_ADD_BUDDY, g_hWnd, (DLGPROC)Buddy_AddBuddyProc,TRUE);
}
bm.UpdateList();
}
break;
case IDM_REFRESH:
break;
case IDM_ADD:
bm.Buddy_Add(g_hInst,g_hWnd,true);
break;
case IDM_DELETE:
bm.Remove();
break;
case IDM_COPYIP:
{
int n=-1;
char szIP[40];
n = ListView_GetSelectionMark(g_hwndListBuddy);
ListView_GetItemText(g_hwndListBuddy,n,2,szIP,sizeof(szIP)-1);
if(n!=-1)
{
EditCopy(szIP);
}
else
MessageBox(hwnd,g_lang.GetString("ErrorServerCopyToClipBoard"),NULL,MB_OK);
}
break;
case IDM_CONNECT:
StartGame_ConnectToServer(true);
break;
}
}
else if(uMsg==WM_LBUTTONDBLCLK)
{
PostMessage(hwnd,WM_COMMAND,LOWORD(IDM_CONNECT),0);
}
else if(uMsg == WM_RBUTTONDOWN)
{
//get mouse cursor position x and y as lParam has the message itself
POINT lpClickPoint;
GetCursorPos(&lpClickPoint);
hPopMenu = CreatePopupMenu();
int n=-1;
n = ListView_GetSelectionMark(g_hwndListBuddy);
if(n!=-1)
{
//place the window/menu there if needed
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_CONNECT,g_lang.GetString("MenuConnect"));
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_DELETE,g_lang.GetString("Remove"));
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_EDIT_BUDDY,g_lang.GetString("Edit"));
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_COPYIP,g_lang.GetString("MenuCopyIP"));
}
InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_ADD,g_lang.GetString("Add"));
//InsertMenu(hPopMenu,0xFFFFFFFF,MF_BYPOSITION|MF_STRING,IDM_REFRESH,"&Refresh");
//workaround for microsoft bug, to hide menu w/o selecting
SetForegroundWindow(hwnd);
TrackPopupMenu(hPopMenu,TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_BOTTOMALIGN,lpClickPoint.x, lpClickPoint.y,0,hwnd,NULL);
SendMessage(hwnd,WM_NULL,0,0);
DestroyMenu(hPopMenu);
return 0;
}
return CallWindowProc((WNDPROC)g_wpOrigListBuddyProc, hwnd, uMsg, wParam, lParam);
}
示例12: _ParseHexOperand
const Token&
Tokenizer::NextToken()
{
if (fCurrentToken.type == TOKEN_END_OF_LINE)
return fCurrentToken;
if (fReuseToken) {
fReuseToken = false;
return fCurrentToken;
}
while (*fCurrentChar != 0 && isspace(*fCurrentChar))
fCurrentChar++;
if (*fCurrentChar == 0) {
return fCurrentToken = Token("", 0, _CurrentPos(),
TOKEN_END_OF_LINE);
}
bool decimal = *fCurrentChar == '.';
if (decimal || isdigit(*fCurrentChar)) {
if (*fCurrentChar == '0' && fCurrentChar[1] == 'x')
return _ParseHexOperand();
BString temp;
const char* begin = fCurrentChar;
// optional digits before the comma
while (isdigit(*fCurrentChar)) {
temp << *fCurrentChar;
fCurrentChar++;
}
// optional post decimal part
// (required if there are no digits before the decimal)
if (*fCurrentChar == '.') {
decimal = true;
temp << '.';
fCurrentChar++;
// optional post decimal digits
while (isdigit(*fCurrentChar)) {
temp << *fCurrentChar;
fCurrentChar++;
}
}
int32 length = fCurrentChar - begin;
if (length == 1 && decimal) {
// check for . operator
fCurrentChar = begin;
if (!_ParseOperator())
throw ParseException("unexpected character", _CurrentPos());
return fCurrentToken;
}
BString test = temp;
test << "&_";
double value;
char t[2];
int32 matches = sscanf(test.String(), "%lf&%s", &value, t);
if (matches != 2)
throw ParseException("error in constant", _CurrentPos() - length);
fCurrentToken = Token(begin, length, _CurrentPos() - length,
TOKEN_CONSTANT);
if (decimal)
fCurrentToken.value.SetTo(value);
else
fCurrentToken.value.SetTo((int64)strtoll(temp.String(), NULL, 10));
} else if (isalpha(*fCurrentChar) || *fCurrentChar == '_') {
const char* begin = fCurrentChar;
while (*fCurrentChar != 0 && (isalpha(*fCurrentChar)
|| isdigit(*fCurrentChar) || *fCurrentChar == '_')) {
fCurrentChar++;
}
int32 length = fCurrentChar - begin;
fCurrentToken = Token(begin, length, _CurrentPos() - length,
TOKEN_IDENTIFIER);
} else if (*fCurrentChar == '"' || *fCurrentChar == '\'') {
const char* begin = fCurrentChar++;
while (*fCurrentChar != 0) {
if (*fCurrentChar == '\\') {
if (*(fCurrentChar++) != 0)
fCurrentChar++;
} else if (*(fCurrentChar++) == *begin)
break;
}
int32 length = fCurrentChar - begin;
fCurrentToken = Token(begin, length, _CurrentPos() - length,
TOKEN_STRING_LITERAL);
} else {
if (!_ParseOperator()) {
int32 type = TOKEN_NONE;
switch (*fCurrentChar) {
case '\n':
type = TOKEN_END_OF_LINE;
//.........这里部分代码省略.........
示例13: CFG_MainProc
LRESULT CALLBACK CFG_MainProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
g_tvIndexCFG = 0;
g_hwndTree = GetDlgItem(hDlg,IDC_TREE_CONF);
SendMessage(g_hwndTree, TVM_SETIMAGELIST , TVSIL_NORMAL, (LPARAM)g_hImageListIcons);
SendMessage(g_hwndTree, TVM_SETIMAGELIST , TVSIL_STATE, (LPARAM)g_hImageListStates);
HTREEITEM hNewItem;
hNewItem = TreeView_AddItem(27,g_lang.GetString("ConfigGeneral"));
hNewItem = TreeView_AddItem(15,g_lang.GetString("ConfigMinimizer"));
hNewItem = TreeView_AddItem(28,"mIRC");
hNewItem = TreeView_AddItem(3,"Account (XMPP)");
hNewItem = TreeView_AddItem(16,g_lang.GetString("ConfigExtExe"));
hNewItem = TreeView_AddItem(25,g_lang.GetString("ConfigGraphic"));
hNewItem = TreeView_AddItem(13,g_lang.GetString("ConfigNetwork"));
hNewItem = TreeView_AddItem(20 ,g_lang.GetString("ConfigGames"));
if (hNewItem)
TreeView_Select(g_hwndTree, hNewItem, TVGN_CARET);
for(UINT i=0;i<gm.GamesInfo.size();i++)
hNewItem = TreeView_AddItem(gm.GamesInfo[i].iIconIndex,gm.GamesInfo[i].szGAME_SHORTNAME);
TreeView_Select(g_hwndTree, NULL, TVGN_CARET);
for(UINT i=0; i<gm.GamesInfo.size();i++)
{
GamesInfoCFG[i].bActive = gm.GamesInfo[i].bActive;
GamesInfoCFG[i].bUseHTTPServerList[0] = gm.GamesInfo[i].bUseHTTPServerList[0];
GamesInfoCFG[i].dwMasterServerPORT = gm.GamesInfo[i].dwMasterServerPORT;
strcpy(GamesInfoCFG[i].szGAME_NAME, gm.GamesInfo[i].szGAME_NAME);
strcpy(GamesInfoCFG[i].szMasterServerIP[0], gm.GamesInfo[i].szMasterServerIP[0]);
GamesInfoCFG[i].vGAME_INST = gm.GamesInfo[i].vGAME_INST;
}
memcpy(&AppCFGtemp,&AppCFG,sizeof(APP_SETTINGS_NEW));
CFG_g_sMIRCoutputTemp = g_sMIRCoutput;
SetDlgItemText(hDlg,IDOK,g_lang.GetString("Ok"));
SetDlgItemText(hDlg,IDC_BUTTON_DEFAULT,g_lang.GetString("SetDefault"));
SetDlgItemText(hDlg,IDCANCEL,g_lang.GetString("Cancel"));
CenterWindow(hDlg);
CFG_OnTabbedDialogInit(hDlg) ;
return TRUE;
}
case WM_NOTIFY:
{
NMTREEVIEW *lpnmtv;
lpnmtv = (LPNMTREEVIEW)lParam;
switch (wParam)
{
case IDC_TREE_CONF:
{
NMTREEVIEW *pnmtv;
pnmtv = (LPNMTREEVIEW) lParam;
if((lpnmtv->hdr.code == TVN_SELCHANGED) )
{
if((g_bChanged==true) && (pnmtv->action == TVC_BYMOUSE))
CFG_ApplySettings();
CFG_OnSelChanged(hDlg);
}
}
break;
}
break;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDCANCEL:
LocalFree(g_pHdr);
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
case IDOK:
{
CFG_ApplySettings();
if(AppCFGtemp.bAutostart)
AddAutoRun(EXE_PATH);
else
RemoveAutoRun();
if(AppCFGtemp.bUse_minimize)
{
UnregisterHotKey(NULL, HOTKEY_ID);
if (!RegisterHotKey(NULL, HOTKEY_ID, AppCFGtemp.dwMinimizeMODKey ,AppCFGtemp.cMinimizeKey))
{
//probably already registred
MessageBox(NULL,g_lang.GetString("ErrorRegHotkey"),"Hotkey error",NULL);
}
//.........这里部分代码省略.........
示例14: CFG_EditInstall_Proc
LRESULT CALLBACK CFG_EditInstall_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TCHAR szFile[260];
switch(uMsg)
{
case WM_INITDIALOG:
{
CFG_editexeIdx = lParam;
int gameID = CFG_GetGameID(g_currSelCfg);
GAME_INSTALLATIONS gi;
gi = GamesInfoCFG[gameID].vGAME_INST.at(lParam);
g_cfgScriptTmp.clear();
g_cfgFilterNameTmp.clear();
g_EditorTI.sScript = gi.sScript;
g_EditorTI.sName = gi.sFilterName;
CheckDlgButton(hDlg,IDC_CHECK_CONDITION,gi.bActiveScript);
SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,gi.sFilterName.c_str());
SetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,gi.sName.c_str());
SetDlgItemText(hDlg,IDC_EDIT_PATH,gi.szGAME_PATH.c_str());
SetDlgItemText(hDlg,IDC_EDIT_CMD,gi.szGAME_CMD.c_str());
// SetDlgItemText(hDlg,IDC_EDIT_CFG_MOD,gi.sMod.c_str());
// SetDlgItemText(hDlg,IDC_EDIT_CFG_VERSION,gi.sVersion.c_str());
break;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_BUTTON_EDIT_SCRIPT:
DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_EDIT_FILTER, hDlg, (DLGPROC)FilterEditor_Dlg,-2);
g_cfgScriptTmp = g_EditorTI.sScript;
g_cfgFilterNameTmp = g_EditorTI.sName;
SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,g_cfgFilterNameTmp.c_str());
break;
case IDC_BUTTON_CFG_EXE_CANCEL:
EndDialog(hDlg,0);
break;
case IDC_BUTTON_EXE_CFG_OK:
{
int gameID = CFG_GetGameID(g_currSelCfg);
TCHAR szTemp[MAX_PATH*2];
GAME_INSTALLATIONS gi;
GetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,szTemp,MAX_PATH);
if(strlen(szTemp)==0)
{
MessageBox(hDlg,g_lang.GetString("NoName"),"Error saving",MB_OK);
return TRUE;
}
if(IsDlgButtonChecked(hDlg,IDC_CHECK_CONDITION)==BST_CHECKED)
gi.bActiveScript=TRUE;
else
gi.bActiveScript=FALSE;
gi.sFilterName = g_cfgFilterNameTmp;
gi.sScript = g_cfgScriptTmp;
gi.sName = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_PATH,szTemp,MAX_PATH);
gi.szGAME_PATH = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_CMD,szTemp,MAX_PATH*2);
gi.szGAME_CMD = szTemp;
GamesInfoCFG[gameID].vGAME_INST.at(CFG_editexeIdx) = gi;
EndDialog(hDlg,0);
}
break;
case IDC_BUTTON_ET_PATH:
{
OPENFILENAME ofn;
memset(&ofn,0,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Executable\0*.exe\0";
ofn.nFilterIndex = 2;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
int gameID=-1;
gameID = CFG_GetGameID(g_currSelCfg);
if(gameID!=-1)
{
if(GamesInfoCFG[gameID].vGAME_INST.size()>0)
ofn.lpstrInitialDir = GamesInfoCFG[gameID].vGAME_INST[CFG_editexeIdx].szGAME_PATH.c_str();
}
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
//.........这里部分代码省略.........
示例15: CFG_AddNewInstall_Proc
LRESULT CALLBACK CFG_AddNewInstall_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
TCHAR szFile[360];
switch(uMsg)
{
case WM_INITDIALOG:
{
g_cfgScriptTmp.clear();
g_cfgFilterNameTmp.clear();
SetWindowText(hDlg,g_lang.GetString("TitleNewInstall"));
SetDlgItemText(hDlg,IDC_BUTTON_EXE_CFG_OK,g_lang.GetString("Save"));
SetDlgItemText(hDlg,IDC_BUTTON_CFG_EXE_CANCEL,g_lang.GetString("Cancel"));
SetDlgItemText(hDlg,IDC_STATIC_ADDNEWINSTALL,g_lang.GetString("AddNewInstall"));
SetDlgItemText(hDlg,IDC_STATIC_EXE,g_lang.GetString("ColumnExePath"));
SetDlgItemText(hDlg,IDC_STATIC_COMMAND,g_lang.GetString("ColumnCommand"));
SetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,"Default");
int gameID = CFG_GetGameID(g_currSelCfg);
if(gm.GamesInfo[gameID].vGAME_INST_DEFAULT.size()>0)
{
SetDlgItemText(hDlg,IDC_EDIT_CMD,gm.GamesInfo[gameID].vGAME_INST_DEFAULT.at(0).szGAME_CMD.c_str());
}
break;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_BUTTON_EDIT_SCRIPT:
DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_EDIT_FILTER, hDlg, (DLGPROC)FilterEditor_Dlg,-1);
g_cfgScriptTmp = g_EditorTI.sScript;
g_cfgFilterNameTmp = g_EditorTI.sName;
SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,g_cfgFilterNameTmp.c_str());
break;
case IDC_BUTTON_CFG_EXE_CANCEL:
EndDialog(hDlg,0);
break;
case IDC_BUTTON_EXE_CFG_OK:
{
int gameID = CFG_GetGameID(g_currSelCfg);
TCHAR szTemp[MAX_PATH*2];
GAME_INSTALLATIONS gi;
GetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,szTemp,MAX_PATH);
if(strlen(szTemp)==0)
{
MessageBox(hDlg,g_lang.GetString("NoName"),"Error saving",MB_OK);
return TRUE;
}
if(IsDlgButtonChecked(hDlg,IDC_CHECK_CONDITION)==BST_CHECKED)
gi.bActiveScript=TRUE;
else
gi.bActiveScript=FALSE;
gi.sFilterName = g_cfgFilterNameTmp;
gi.sScript = g_cfgScriptTmp;
gi.sName = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_PATH,szTemp,MAX_PATH*2);
gi.szGAME_PATH = szTemp;
GetDlgItemText(hDlg,IDC_EDIT_CMD,szTemp,MAX_PATH*2);
gi.szGAME_CMD = szTemp;
//USE below function for above code!!!
//GetDlgItemTextToString(HWND hWnd,int nID, string &pOutString)
GamesInfoCFG[gameID].vGAME_INST.push_back(gi);
EndDialog(hDlg,0);
}
break;
case IDC_BUTTON_ET_PATH:
{
OPENFILENAME ofn;
memset(&ofn,0,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Executable\0*.exe\0";
ofn.nFilterIndex = 2;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
int gameID=-1;
gameID = CFG_GetGameID(g_currSelCfg);
if(gameID!=-1)
{
if(GamesInfoCFG[gameID].vGAME_INST.size()>0)
ofn.lpstrInitialDir = GamesInfoCFG[gameID].vGAME_INST[CFG_editexeIdx].szGAME_PATH.c_str();
}
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if(GetOpenFileName(&ofn))
//.........这里部分代码省略.........