void RefreshGlobal() { DoDataExchange(true); boost::filesystem::path configFile; GetConfigPath(static_cast<const TCHAR *>(m_ConfigLabel), configFile); CComPtr<IConfig> config = CreateIConfig(QUERYBUILDER_CFG, configFile); CString accountServer = config->Get(GLOBAL_SERVER_ACCOUNT); if (accountServer.IsEmpty()) { GetDlgItem(IDC_EDIT_USER).EnableWindow(false); GetDlgItem(IDC_EDIT_PASSWORD).EnableWindow(false); m_User = _T(""); m_Password = _T(""); } else { GetDlgItem(IDC_EDIT_USER).EnableWindow(true); GetDlgItem(IDC_EDIT_PASSWORD).EnableWindow(true); m_User = config->Get(GLOBAL_USER); m_Password = config->Get(GLOBAL_PASSWORD); } if (m_configPrefs) GetDlgItem(IDC_LOGIN_PREFS).EnableWindow(m_ConfigLabel.IsEmpty()==false); DoDataExchange(); m_autoUpdateLink.ShowWindow(SW_HIDE); if (!(bool)m_IniFile->Get(GLOBAL_DISABLEAUTOUPDATE)) clib::thread run(__FUNCTION__, boost::bind(&thread_CheckForUpdates, this, m_autoupdate)); }
Config::Config() { if (m_config == NULL) { m_config = CreateIConfig(QUERYBUILDER_CFG); m_config->SetLabel(_T("GraphViewControl")); } }
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; }
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); }
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); }
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; }
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; }
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 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; }