// This is a very light touched save variant - it won't overwrite // anything, only create new entries. void I18NRepo::SaveIni(const std::string &languageID) { IniFile ini; ini.Load(GetIniPath(languageID)); for (auto iter = cats_.begin(); iter != cats_.end(); ++iter) { std::string categoryName = iter->first; IniFile::Section *section = ini.GetOrCreateSection(categoryName.c_str()); SaveSection(ini, section, iter->second); } ini.Save(GetIniPath(languageID)); }
VOID SetWindowPosIni( const HWND hWnd ) { RECT rect; if( ! GetWindowRect( hWnd, &rect ) ) return; TCHAR lptstrIniPath[ MAX_PATH * 2 ]; GetIniPath( lptstrIniPath ); TCHAR lptstrX[ 100 ]; TCHAR lptstrY[ 100 ]; int x = (int) rect.left; if( x < 0 ) x = 0; int y = (int) rect.top; if( y < 0 ) y = 0; wsprintf( lptstrX, TEXT( "%d" ), x ); wsprintf( lptstrY, TEXT( "%d" ), y ); WritePrivateProfileString( TEXT( "Window" ), TEXT( "posX" ), lptstrX, lptstrIniPath ); WritePrivateProfileString( TEXT( "Window" ), TEXT( "posY" ), lptstrY, lptstrIniPath ); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int nCmdShow) { MSG msg; if(_tcsstr(lpCmdLine, _T("/glass"))) { g_Aero = TRUE; } GetIniPath(); g_WndList = new CWndList(); g_Launcher = new CLauncher(); g_EditIni = new CEditIniFile(); g_Launcher->ReadFromFile(g_IniPath); BOOL enable = FALSE; DwmIsCompositionEnabled( &enable ); if(!enable) g_Aero = FALSE; MyRegisterClass(hInstance); if (!InitInstance (hInstance, nCmdShow)) return FALSE; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } delete [] g_IniPath; delete g_EditIni; delete g_WndList; delete g_Launcher; return (int) msg.wParam; }
int GetSliderIni( LPCTSTR lpszTargetPath ) { TCHAR lpszExeName[ MAX_PATH * 2 ]; TCHAR lpszExeNameLower[ MAX_PATH * 2 ]; if( lpszTargetPath == NULL ) return 33; const int len = lstrlen( lpszTargetPath ); int start = 0; int i; for( i = len - 1; i >= 0; i-- ) { if( lpszTargetPath[ i ] == TEXT( '\\' ) ) { start = i + 1; break; } } lstrcpy( lpszExeName, &lpszTargetPath[ start ] ); #if !defined( _UNICODE ) if( lstrlen( lpszExeName ) >= 19 ) { lpszExeName[ 15 ] = '\0'; PathToExeEx( lpszExeName, MAX_PATH * 2 ); } #endif const int len2 = lstrlen( lpszExeName ); for( i = 0; i < len2; i++ ) { TCHAR c = lpszExeName[ i ]; if( _istascii( c ) && _istupper( c ) ) { lpszExeNameLower[ i ] = (TCHAR) _totlower( c ); } else { lpszExeNameLower[ i ] = c; } } lpszExeNameLower[ i ] = TEXT( '\0' ); TCHAR lpszPath[ MAX_PATH * 2 ]; GetIniPath( lpszPath ); // to flushes the cache --- Just in case! WritePrivateProfileString( NULL, NULL, NULL, lpszPath ); int iSlider = GetPrivateProfileInt( TEXT( "Slider" ), lpszExeNameLower, 33, lpszPath ); if( iSlider < 0 || iSlider > 99 ) iSlider = 33; else if( iSlider == 0 ) iSlider = 1; // for backword compat. return iSlider; }
void ResetIniPath( void ) /************************************************************************/ { LPSTR lp; if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI; lstrcpy( szPreferenceFile, lp ); GetIniPath( szPreferenceFile ); }
BOOL WriteIni() { TCHAR lpBuffer[ BUF_SIZE ]; TCHAR lpszPath[ MAX_PATH * 2 ]; GetIniPath( lpszPath ); // Delete old keys/values WritePrivateProfileString( TEXT( "Slider" ), TEXT( "Slider0" ), NULL, lpszPath ); WritePrivateProfileString( TEXT( "Slider" ), TEXT( "Slider1" ), NULL, lpszPath ); WritePrivateProfileString( TEXT( "Slider" ), TEXT( "Slider2" ), NULL, lpszPath ); WritePrivateProfileString( TEXT( "Options" ), TEXT( "RealTime" ), NULL, lpszPath ); WritePrivateProfileString( TEXT( "Options" ), TEXT( "RealTime" ), g_bRealTime ? TEXT( "1" ) : TEXT( "0" ), lpszPath ); TCHAR lpszLangId[ 100 ]; wsprintf( lpszLangId, TEXT( "%d" ), (int) GetLanguage() ); WritePrivateProfileString( TEXT( "Options" ), TEXT( "Language" ), lpszLangId, lpszPath ); ZeroMemory( lpBuffer, sizeof( TCHAR ) * BUF_SIZE ); LPTSTR ptr = lpBuffer; int i; for( i = 0; i < g_iEnemyIndex; i++ ) { wsprintf( ptr, TEXT( "Enemy%d=%s" ), i, g_lpszEnemy[ i ] ); ptr += ( lstrlen( ptr ) + 1 ); } WritePrivateProfileSection( TEXT( "Enemy" ), lpBuffer, lpszPath ); ZeroMemory( lpBuffer, sizeof( TCHAR ) * BUF_SIZE ); ptr = lpBuffer; for( i = 0; i < g_iFriendIndex; i++ ) { wsprintf( ptr, TEXT( "Friend%d=%s" ), i, g_lpszFriend[ i ] ); ptr += ( lstrlen( ptr ) + 1 ); } WritePrivateProfileSection( TEXT( "Friend" ), lpBuffer, lpszPath ); return TRUE; }
void CSyntaxView::OnDestroy() { DoDataExchange(true); boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> iniFile = CreateIConfig(QUERYBUILDER_INI, iniPath); iniFile->Set(GLOBAL_SYNTAX_SHOWERRORS, m_checkErrors); iniFile->Set(GLOBAL_SYNTAX_SHOWWARNINGS, m_checkWarnings); iniFile->Set(GLOBAL_SYNTAX_SHOWINFORMATION, m_checkInformation); SetMsgHandled(false); }
const char* CALLBACK PS2EgetLibName( void ) { // PCSX2 - first-time emu detection fp_emu = fopen( GetIniPath( "nuvee_emu.txt" ), "w" ); if( fp_emu ) { fprintf( fp_emu, "ps2\n" ); fclose( fp_emu ); } emu_type = 2; return PS2_LibraryName; }
int CALLBACK PS2EgetLibType( void ) { // PCSX2 - first-time emu detection fp_emu = fopen( GetIniPath( "nuvee_emu.txt" ), "w" ); if( fp_emu ) { fprintf( fp_emu, "ps2\n" ); fclose( fp_emu ); } emu_type = 2; return PS2E_LT_PAD; }
VOID GetWindowPosIni( LPPOINT lppt ) { TCHAR lptstrIniPath[ MAX_PATH * 2 ]; GetIniPath( lptstrIniPath ); int x = GetPrivateProfileInt( TEXT( "Window" ), TEXT( "PosX" ), CW_USEDEFAULT, lptstrIniPath ); int y = GetPrivateProfileInt( TEXT( "Window" ), TEXT( "PosY" ), CW_USEDEFAULT, lptstrIniPath ); int maxX = GetSystemMetrics( SM_CXSCREEN ) - 640; int maxY = GetSystemMetrics( SM_CYSCREEN ) - 480; if( x != CW_USEDEFAULT && x > maxX ) x = maxX; if( y != CW_USEDEFAULT && y > maxY ) y = maxY; lppt->x = x, lppt->y = y; }
int CALLBACK PS2EgetLibVersion2( int type ) { // PCSX2 - first-time emu detection fp_emu = fopen( GetIniPath( "nuvee_emu.txt" ), "w" ); if( fp_emu ) { fprintf( fp_emu, "ps2\n" ); fclose( fp_emu ); } emu_type = 2; if (type == PS2E_LT_PAD) return (PS2E_PAD_VERSION<<16) | PS2_VERSION; }
BOOL GetTargetTitleIni( LPTSTR lpStr, int iMax ) { TCHAR lpIniPath[ MAX_PATH * 2 ]; GetIniPath( lpIniPath ); GetPrivateProfileString( TEXT( "Options" ), TEXT( "GShow" ), NULL, lpStr, iMax, lpIniPath ); return ( lpStr != NULL ); }
bool I18NRepo::LoadIni(const std::string &languageID, const std::string &overridePath) { std::string iniPath; if (!overridePath.empty()) { iniPath = overridePath + languageID + ".ini"; } else { iniPath = GetIniPath(languageID); } if (!this->ini->Load(iniPath)) return false; //Clear(); return true; }
bool I18NRepo::LoadIni(const std::string &languageID) { IniFile ini; if (!ini.LoadFromVFS(GetIniPath(languageID))) { return false; } Clear(); const std::vector<IniFile::Section> §ions = ini.Sections(); for (auto iter = sections.begin(); iter != sections.end(); ++iter) { if (iter->name() != "") { cats_[iter->name()] = LoadSection(&(*iter)); } } return true; }
void SaveConfig_Main() { FILE *fp; fp = fopen( GetIniPath( "nuvee_ps2_usb_main.ini" ), "w" ); if( fp ) { fprintf( fp, "PORT1 = %d\n", port_type[0] ); fprintf( fp, "PORT2 = %d\n", port_type[1] ); fprintf( fp, "HIDMOUSE_API = %d\n", hidmouse_api ); fprintf( fp, "Debug = %d\n", usb_logging ); fprintf( fp, "Swap lightguns = %d\n", lightgun_swap ); fprintf( fp, "Snap mouse = %d\n", snap_mouse_cursor ); fclose( fp ); } }
BOOL PutDefaultString( LPSTR lpKeyName, LPSTR lpString) /************************************************************************/ { LPSTR lp; #ifdef PRIVATE_INI if ( !szPreferenceFile[0] ) { if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI; lstrcpy( szPreferenceFile, lp ); GetIniPath( szPreferenceFile ); } return( WritePrivateProfileString( ID_APPL, stripstruct(lpKeyName), lpString, szPreferenceFile )); #else return( WriteProfileString( ID_APPL, stripstruct(lpKeyName), lpString )); #endif }
int KouetsApp::SaveIni() { if (!updated_) return 0; int ret = 0; QSettings stg(GetIniPath(), QSettings::IniFormat); stg.setValue("program", programPath_); stg.setValue("commandline", cmdLine_); stg.setValue("decoration", decoration_); stg.setValue("activatetab", bactivateprocessedtab_); stg.setValue("linewrap", blinewrap_); updated_ = false; return ret; }
void LoadConfig_Main() { FILE *fp; fp = fopen( GetIniPath( "nuvee_ps2_usb_main.ini" ), "r" ); if( fp ) { fscanf( fp, "PORT1 = %d\n", &port_type[0] ); fscanf( fp, "PORT2 = %d\n", &port_type[1] ); fscanf( fp, "HIDMOUSE_API = %d\n", &hidmouse_api ); fscanf( fp, "Debug = %d\n", &usb_logging ); fscanf( fp, "Swap lightguns = %d\n", &lightgun_swap ); fscanf( fp, "Snap mouse = %d\n", &snap_mouse_cursor ); fclose( fp ); } }
int GetDefaultInt( LPSTR lpKeyName, int nDefault ) /************************************************************************/ { LPSTR lp; #ifdef PRIVATE_INI if ( !szPreferenceFile[0] ) { if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI; lstrcpy( szPreferenceFile, lp ); GetIniPath( szPreferenceFile ); } return( GetPrivateProfileInt( ID_APPL, stripstruct(lpKeyName), nDefault, szPreferenceFile ) ); #else return( GetProfileInt( ID_APPL, stripstruct(lpKeyName), nDefault ) ); #endif }
void CBookmarksView::OnDestroy() { DoDataExchange(true); boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> iniFile = CreateIConfig(QUERYBUILDER_INI, iniPath); iniFile->Set(GLOBAL_BOOKMARKS_SHOWMINE, m_checkMine); iniFile->Set(GLOBAL_BOOKMARKS_SHOWTODOS, m_checkTodos); iniFile->Set(GLOBAL_BOOKMARKS_SHOWHACKS, m_checkHacks); iniFile->Set(GLOBAL_BOOKMARKS_SORTCOLUMN, m_list.m_sortedCol); iniFile->Set(GLOBAL_BOOKMARKS_SORTASCENDING, m_list.m_sortAscending); m_list.DeleteAllItems(); m_listMaster.DeleteAllItems(); SetMsgHandled(false); }
CMainFrame::CMainFrame() : m_sourceEclView(this), m_targetEclView(this), m_EditStrBuf(m_warnView), m_EditStrBufW(m_warnView), m_bStreamInit(false) { theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_OFF_2007_BLUE); g_MainFrame = this; boost::filesystem::path iniPath; GetIniPath(iniPath); m_iniFile = CreateIConfig(AMT_INI, iniPath); m_cfgLHS = CreateIConfig(AMT_CFG_LHS); m_cfgRHS = CreateIConfig(AMT_CFG_RHS); m_bCheckBoxMatching = true; m_bCheckBoxNotMatching = true; m_bCheckBoxOrphans = true; m_bCheckBoxCRLF = false; m_bCheckBoxWhitespace = false; m_progress = 0; }
WORD GetDefaultString( LPSTR lpKeyName, LPSTR lpDefault, LPSTR lpReturnedString, int nSize) /************************************************************************/ { LPSTR lp; #ifdef PRIVATE_INI if ( !szPreferenceFile[0] ) { if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI; lstrcpy( szPreferenceFile, lp ); GetIniPath( szPreferenceFile ); } return( GetPrivateProfileString( ID_APPL, stripstruct(lpKeyName), lpDefault, lpReturnedString, nSize, szPreferenceFile ) ); #else return( GetProfileString( ID_APPL, stripstruct(lpKeyName), lpDefault, lpReturnedString, nSize ) ); #endif }
/** * load ini file. * * @return zero if loaded. */ int KouetsApp::LoadIni() { int ret = 0; QSettings stg(GetIniPath(), QSettings::IniFormat); QVariant var = stg.value("program"); programPath_ = var.toString(); var = stg.value("commandline"); cmdLine_ = var.toString(); var = stg.value("decoration"); decoration_ = var.toString(); var = stg.value("activatetab", 1); bactivateprocessedtab_ = var.toInt(); var = stg.value("linewrap", 1); blinewrap_ = var.toInt(); updated_ = false; return ret; }
void CALLBACK PADconfigure (void) { #ifdef DEBUG_API if( fp_debug == 0 ) fp_debug = fopen( "nuvee-log.txt", "w" ); fprintf( fp_debug, "PADconfigure\n" ); #endif // PCSX2 - first-time emu detection fp_emu = fopen( GetIniPath( "nuvee_emu.txt" ), "r" ); if( fp_emu ) { char emu_name[256]; fscanf( fp_emu, "%s", emu_name ); if( strcmp( emu_name, "ps2" ) == 0 ) { emu_type = 2; strcpy( ini_path, "inis" ); } else if( strcmp( emu_name, "ps1" ) == 0 ) { emu_type = 1; strcpy( ini_path, "plugins" ); } fclose( fp_emu ); } // HID acquire hWnd_app = GetActiveWindow(); DialogBox( hInstance_app, MAKEINTRESOURCE (IDD_MAIN), GetActiveWindow(), (DLGPROC) MainDlgProc ); }
LRESULT CSyntaxView::OnInitDialog(HWND /*hWnd*/, LPARAM /*lParam*/) { SetMsgHandled(false); DlgResize_Init(false,false); m_list = GetDlgItem(IDC_LIST_SYNTAX); m_list.AddColumn(_T("Message"), 0); m_list.AddColumn(_T("Code"), 1); m_list.AddColumn(_T("Location"), 2); m_list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> iniFile = CreateIConfig(QUERYBUILDER_INI, iniPath); m_checkErrors = iniFile->Get(GLOBAL_SYNTAX_SHOWERRORS); m_checkWarnings = iniFile->Get(GLOBAL_SYNTAX_SHOWWARNINGS); m_checkInformation = iniFile->Get(GLOBAL_SYNTAX_SHOWINFORMATION); DoDataExchange(); return 0; }
BOOL SetSliderIni( LPCTSTR lpszString, const int iSlider ) { if( iSlider <= 0 || iSlider > 99 || lstrlen( lpszString ) > 1000 ) return FALSE; WriteDebugLog( TEXT( "SetSliderIni" ) ); WriteDebugLog( lpszString ); TCHAR lpszExeName[ MAX_PATH * 2 ] = _T( "" ); /* - 1.1b7 int len = lstrlen( lpszTarget ); int start = -1; int end = -1; for( int i = len - 1; i >= 5; i-- ) { if( lpszTarget[ i ] == TEXT( ' ' ) && ( lpszTarget[ i - 1 ] == TEXT( 'e' ) || lpszTarget[ i - 1 ] == TEXT( 'E' ) ) && ( lpszTarget[ i - 2 ] == TEXT( 'x' ) || lpszTarget[ i - 2 ] == TEXT( 'X' ) ) && ( lpszTarget[ i - 3 ] == TEXT( 'e' ) || lpszTarget[ i - 3 ] == TEXT( 'E' ) ) && lpszTarget[ i - 4 ] == TEXT( '.' ) ) { end = i; break; } } for( ; i >=0; i-- ) { if( lpszTarget[ i ] == TEXT( '\\' ) ) { start = i + 1; break; } } if( start == -1 ) start = 0; if( end == -1 || end - start <= 0 ) { TCHAR dbg[1000]; wsprintf( dbg, TEXT("DEBUG: %s %d %d %d"), lpszTarget, start, end, end-start ); WriteDebugLog( dbg ) ; return FALSE; } lstrcpy( lpszExeName, &lpszTarget[ start ] ); lpszExeName[ end - start ] = TEXT( '\0' ); */ // +1.1b7 PathToExe( lpszString, lpszExeName, MAX_PATH * 2 ); #if !defined( _UNICODE ) if( lstrlen( lpszExeName ) >= 19 ) { lpszExeName[ 15 ] = '\0'; PathToExeEx( lpszExeName, MAX_PATH * 2 ); } #endif TCHAR lpszExeNameLower[ MAX_PATH * 2 ] = _TEXT( "" ); int len = lstrlen( lpszExeName ); for( int i = 0; i < len; i++ ) { TCHAR c = lpszExeName[ i ]; if( _istascii( c ) && _istupper( c ) ) { lpszExeNameLower[ i ] = (TCHAR) _totlower( c ); } else { lpszExeNameLower[ i ] = c; } } //lpszExeNameLower[ i ] = TEXT( '\0' ); TCHAR lpszPath[ MAX_PATH * 2 ]; GetIniPath( lpszPath ); TCHAR tmpstr[ 100 ]; wsprintf( tmpstr, TEXT( "%d" ), iSlider ); WritePrivateProfileString( TEXT( "Slider" ), lpszExeNameLower, tmpstr, lpszPath ); // to flushes the cache WritePrivateProfileString( NULL, NULL, NULL, lpszPath ); return TRUE; }
LRESULT CBookmarksView::OnInitDialog(HWND /*hWnd*/, LPARAM /*lParam*/) { SetMsgHandled(false); DlgResize_Init(false, false); CRect rc(0, 0, 0, 0); CWindow wndPlaceholder = GetDlgItem(IDC_BOOKMARKS_PLACEHOLDER); wndPlaceholder.GetWindowRect(rc); ScreenToClient(rc); wndPlaceholder.DestroyWindow(); const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; if (!m_list.Create(dwViewStyle, rc, CWnd::FromHandle(m_hWnd), IDC_BOOKMARKS_PLACEHOLDER)) { TRACE0("Failed to create Class View\n"); return -1; // fail to create } m_list.SetOwner(CWnd::FromHandle(m_hWnd)); m_list.m_sortedCol = 0; m_list.m_sortAscending = false; m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_FULLROWSELECT); m_list.EnableMultipleSort(true); int col = 0; m_list.InsertColumn(col++, _T("Line")); m_list.InsertColumn(col++, _T("Type")); m_list.InsertColumn(col++, _T("User")); m_list.InsertColumn(col++, _T("Module")); m_list.InsertColumn(col++, _T("Attribute")); m_list.InsertColumn(col++, _T("Attr Type")); m_list.InsertColumn(col++, _T("Description")); for (int i = 0; i < col; ++i) { m_list.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER); } if (!m_listMaster.Create(dwViewStyle, rc, CWnd::FromHandle(m_hWnd), IDC_BOOKMARKS_PLACEHOLDER)) { TRACE0("Failed to create Class View\n"); return -1; // fail to create } col = 0; m_listMaster.InsertColumn(col++, _T("Line")); m_listMaster.InsertColumn(col++, _T("Type")); m_listMaster.InsertColumn(col++, _T("User")); m_listMaster.InsertColumn(col++, _T("Module")); m_listMaster.InsertColumn(col++, _T("Attribute")); m_listMaster.InsertColumn(col++, _T("Attr Type")); m_listMaster.InsertColumn(col++, _T("Description")); boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> iniFile = CreateIConfig(QUERYBUILDER_INI, iniPath); m_checkMine = iniFile->Get(GLOBAL_BOOKMARKS_SHOWMINE); m_checkTodos = iniFile->Get(GLOBAL_BOOKMARKS_SHOWTODOS); m_checkHacks = iniFile->Get(GLOBAL_BOOKMARKS_SHOWHACKS); m_list.m_sortedCol = iniFile->Get(GLOBAL_BOOKMARKS_SORTCOLUMN); m_list.m_sortAscending = iniFile->Get(GLOBAL_BOOKMARKS_SORTASCENDING); DoDataExchange(); return 0; }
BOOL ReadIni() { TCHAR lpszPath[ MAX_PATH * 2 ]; GetIniPath( lpszPath ); g_bLogging = !! GetPrivateProfileInt( TEXT( "Options" ), TEXT( "Logging" ), FALSE, lpszPath ); EnableLoggingIni( g_bLogging ); g_bSelChange = !! GetPrivateProfileInt( TEXT( "Options" ), TEXT( "SelChange" ), FALSE, lpszPath ); //0x04 LANG_CHINESE //0x01 SUBLANG_CHINESE_TRADITIONAL Chinese (Traditional) //0x02 SUBLANG_CHINESE_SIMPLIFIED Chinese (Simplified) // WORD wDefLanguage = (WORD) PRIMARYLANGID( GetSystemDefaultLangID() ); WORD wDefLanguage = (WORD) PRIMARYLANGID( GetUserDefaultLangID() ); if( wDefLanguage == LANG_CHINESE ) { WORD wSubLangId = (WORD) SUBLANGID( GetSystemDefaultLangID() ); wDefLanguage = ( wSubLangId == SUBLANG_CHINESE_TRADITIONAL )? LANG_CHINESE_T : LANG_CHINESE_S ; } else if( wDefLanguage != LANG_ENGLISH && wDefLanguage != LANG_FINNISH && wDefLanguage != LANG_JAPANESE && wDefLanguage != LANG_SPANISH ) { wDefLanguage = LANG_ENGLISH; } WORD wLanguage = (WORD) GetPrivateProfileInt( TEXT( "Options" ), TEXT( "Language" ), (int) wDefLanguage, lpszPath ); if( wLanguage != LANG_ENGLISH && wLanguage != LANG_FINNISH && wLanguage != LANG_JAPANESE && wLanguage != LANG_JAPANESEo && wLanguage != LANG_CHINESE_T && wLanguage != LANG_CHINESE_S && wDefLanguage != LANG_SPANISH && wLanguage != LANG_FRENCH ) { wLanguage = wDefLanguage; } SetLanguage( wLanguage ); g_Slider[ 0 ] = (BYTE) 33; g_Slider[ 1 ] = (BYTE) 33; g_Slider[ 2 ] = (BYTE) 33; g_Slider[ 3 ] = (BYTE) 0; int i, j; TCHAR lpszKey[ 100 ]; g_iEnemyIndex = 0; for( i = 0; i < MAX_PROCESS_CNT; i++ ) { wsprintf( lpszKey, TEXT( "Enemy%d" ), i ); GetPrivateProfileString( TEXT( "Enemy" ), lpszKey, TEXT( "" ), g_lpszEnemy[ g_iEnemyIndex ], MAX_PATH + 1, lpszPath ); if( lstrlen( g_lpszEnemy[ g_iEnemyIndex ] ) == 0 ) break; else if( IsAbsFoe( g_lpszEnemy[ g_iEnemyIndex ] ) ) continue; else if( _tcschr( g_lpszEnemy[ g_iEnemyIndex ], TEXT( '\\' ) ) != NULL ) continue; PathToExeEx( g_lpszEnemy[ g_iEnemyIndex ], MAX_PATH + 1 ); for( j = 0; j < g_iEnemyIndex; j++ ) { if( lstrcmpi( g_lpszEnemy[ j ], g_lpszEnemy[ g_iEnemyIndex ] ) == 0 ) goto NEXT_FOE; } g_iEnemyIndex++; NEXT_FOE: { ; } } g_iFriendIndex = 0; for( i = 0; i < MAX_PROCESS_CNT; i++ ) { wsprintf( lpszKey, TEXT( "Friend%d" ), i ); GetPrivateProfileString( TEXT( "Friend" ), lpszKey, TEXT( "" ), g_lpszFriend[ g_iFriendIndex ], MAX_PATH + 1, lpszPath ); if( lstrlen( g_lpszFriend[ g_iFriendIndex ] ) == 0 ) break; else if( IsAbsFoe( g_lpszEnemy[ g_iFriendIndex ] ) ) continue; else if( _tcschr( g_lpszEnemy[ g_iFriendIndex ], TEXT( '\\' ) ) != NULL ) continue; PathToExeEx( g_lpszFriend[ g_iFriendIndex ], MAX_PATH + 1 ); for( j = 0; j < g_iFriendIndex; j++ ) { if( lstrcmpi( g_lpszFriend[ j ], g_lpszFriend[ g_iFriendIndex ] ) == 0 ) goto NEXT_FRIEND; } for( j = 0; j < g_iEnemyIndex; j++ ) { if( lstrcmpi( g_lpszEnemy[ j ], g_lpszFriend[ g_iFriendIndex ] ) == 0 ) goto NEXT_FRIEND; } g_iFriendIndex++; NEXT_FRIEND: { ; } } return TRUE; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; m_wndClientArea.ModifyStyleEx(WS_EX_CLIENTEDGE, 0); // create a view to occupy the client area of the frame //if (!m_wndView.Create(IDD_ABOUTBOX, this)) //m_wndView.Create(GetSafeHwnd(), CRect(10,300,100,330), _T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, NULL, 2); //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) //{ // TRACE0("Failed to create view window\n"); // return -1; //} // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); //// create a view to occupy the client area of the frame //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) //{ // TRACE0("Failed to create view window\n"); // return -1; //} boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> ini = CreateIConfig(AMT_INI, iniPath); CString config1( ini->Get(g_szConfigSection, RepLabel1, _T("0")) ); CString config2( ini->Get(g_szConfigSection, RepLabel2, _T("1")) ); m_splitter.Create(m_hWndMDIClient, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_repositoryDlg.Create(m_splitter); //m_detailSheetView.SetReflectNotifications(true); m_detailSheetView.SetTabStyles(CTCS_BOTTOM | CTCS_TOOLTIPS); m_detailSheetView.Create(m_splitter, ATL::CWindow::rcDefault); //m_detailView.SetFont(WTL::AtlGetDefaultGuiFont()); m_sourceEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault); m_sourceEclView.DoInit(); m_sourceEclView.SetReadOnly(true); //TODO: InitEclCommandMixin(this, this, &m_sourceEclView, this); m_detailSheetView.AddTab(m_sourceEclView, _T("Source ECL")); m_diffView.Create(m_detailSheetView, ATL::CWindow::rcDefault, _T(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE); m_detailSheetView.AddTab(m_diffView, _T("Differences")); m_targetEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault); m_targetEclView.DoInit(); m_targetEclView.SetReadOnly(true); //TODO: InitEclCommandMixin(this, this, &m_targetEclView, this); m_detailSheetView.AddTab(m_targetEclView, _T("Target ECL")); m_dependees.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE); m_dependees.SetFont(WTL::AtlGetDefaultGuiFont()); m_detailSheetView.AddTab(m_dependees, _T("Dependee Check")); m_logView.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | LBS_NOINTEGRALHEIGHT, WS_EX_CLIENTEDGE); m_logView.SetFont(WTL::AtlGetDefaultGuiFont()); m_detailSheetView.AddTab(m_logView, _T("Log")); WTL::CEdit edit; edit.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE); CString face = _T("MS Shell Dlg"); int nPointSize = 8; WTL::CFont font; WTL::CLogFont logFont; logFont.lfCharSet = DEFAULT_CHARSET; logFont.lfHeight = nPointSize*10; ::_tcsncpy(logFont.lfFaceName, face, LF_FACESIZE); logFont.lfWeight = FW_LIGHT; logFont.lfQuality = PROOF_QUALITY; logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; logFont.lfOutPrecision = OUT_TT_PRECIS; if ( font.CreatePointFontIndirect(&logFont,0) ) { edit.SetFont(font.Detach(),false); } m_warnView.SetEditCtrl(edit.Detach()); m_detailSheetView.AddTab(m_warnView, _T("Warnings")); m_detailSheetView.GetTabCtrl().SetCurSel(1); m_splitter.SetSplitterPanes(m_repositoryDlg, m_detailSheetView); m_splitter.SetSplitterPosPct(50); m_wndRibbonBar.Create(this); InitializeRibbon(); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, _T(""), TRUE), _T("")); m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, _T(""), TRUE), _T("")); CMFCRibbonProgressBar * elem = new CMFCRibbonProgressBar(ID_STATUSBAR_PANE3); m_wndStatusBar.AddExtendedElement(elem, _T("Progress")); elem->SetRange(1, 1); elem->SetPos(0); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // Enable enhanced windows management dialog //EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); HICON newIcon = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME_AMT)); HICON oldIcon = SetIcon(newIcon, false); HICON oldIcon2 = SetIcon(newIcon, true); RecalcLayout(); if ( !m_bStreamInit ) { m_pOldBuf = std::cerr.rdbuf(&m_EditStrBuf); m_pOldBufW = std::wcerr.rdbuf(&m_EditStrBufW); m_bStreamInit = true; } PostMessage(UM_INITIALIZE); return 0; }
BOOL CQueryBuilderApp::InitInstance() { HRESULT hRes = _Module.Init(NULL, m_hInstance); ATLASSERT(SUCCEEDED(hRes)); #ifndef _DEBUG // Setup exception handler BT_SetAppName(_T("ECL IDE")); BT_SetSupportEMail(_T("*****@*****.**")); BT_SetFlags(BTF_DETAILEDMODE | BTF_EDITMAIL | BTF_ATTACHREPORT); BT_SetSupportURL(_T("http://hpccsystems.com/support")); // = BugTrapServer =========================================== //BT_SetSupportServer(_T("localhost"), 9999); // - or - //BT_SetSupportServer(_T("127.0.0.1"), 9999); // = BugTrapWebServer ======================================== //BT_SetSupportServer(_T("http://localhost/BugTrapWebServer/RequestHandler.aspx"), BUGTRAP_HTTP_PORT); // required since VS 2005 SP1 BT_InstallSehFilter(); #endif // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinAppEx::InitInstance(); // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization HINSTANCE hInstanceResources = ::LoadLibrary(_T("en_us.dll")); _Module.SetResourceInstance(hInstanceResources); AfxSetResourceHandle(hInstanceResources); SetApplicationName(_T("eclide.exe")); boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> ini = CreateIConfig(QUERYBUILDER_INI, iniPath); CComPtr<IConfig> config = CreateIConfig(QUERYBUILDER_CFG); if (!hGrid) hGrid = ::LoadLibrary(SGRID::CGridCtrl::GetLibraryName()); std::_tstring majorVersion; GetAppMajorVersion(majorVersion); SetRegistryKey((boost::_tformat(_T("HPCC Systems\\Version%1%")) % majorVersion).str().c_str()); LoadStdProfileSettings(0); // Load standard INI file options InitContextMenuManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); theApp.EnableTaskbarInteraction(false); //const TCHAR * path = _tgetenv(_T("PATH")); //if (path) //{ // const TCHAR * hpccbin = _tgetenv(_T("HPCCBIN")); // if (hpccbin) // { // boost::filesystem::wpath eclccPath = hpccbin; // eclccPath /= _T("eclcc.exe"); // if (boost::filesystem::exists(eclccPath)) // { // std::_tstring envVar = _T("PATH="); // envVar += hpccbin; // envVar += _T(";"); // envVar += path; // _tputenv(envVar.c_str()); // ini->Set(GLOBAL_COMPILER_LOCATION, eclccPath.native_file_string()); // } // boost::filesystem::wpath stdLibPath = hpccbin; // stdLibPath /= _T("ecllib"); // if (boost::filesystem::exists(stdLibPath)) // { // ini->Set(GLOBAL_COMPILER_STDLIB, stdLibPath.native_file_string()); // } // } //} // To create the main window, this code creates a new frame window // object and then sets it as the application's main window object CMDIFrameWnd* pFrame = new CMainFrame; if (!pFrame) return FALSE; m_pMainWnd = pFrame; // create main MDI frame window if (!pFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; // try to load shared MDI menus and accelerator table //TODO: add additional member variables and load calls for // additional menu types your application may need //HINSTANCE hInst = AfxGetResourceHandle(); //m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_QueryBuilderTYPE)); //m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_QueryBuilderTYPE)); // The main window has been initialized, so show and update it pFrame->ShowWindow(m_nCmdShow); pFrame->UpdateWindow(); return TRUE; }