void CRebaseDlg::DoSize(int delta) { this->RemoveAllAnchors(); CSplitterControl::ChangeHeight(GetDlgItem(IDC_COMMIT_LIST), delta, CW_TOPALIGN); //CSplitterControl::ChangeHeight(GetDlgItem(), delta, CW_TOPALIGN); CSplitterControl::ChangeHeight(GetDlgItem(IDC_REBASE_TAB), -delta, CW_BOTTOMALIGN); //CSplitterControl::ChangeHeight(GetDlgItem(), -delta, CW_BOTTOMALIGN); CSplitterControl::ChangePos(GetDlgItem(IDC_SQUASH_ALL),0,delta); CSplitterControl::ChangePos(GetDlgItem(IDC_PICK_ALL),0,delta); CSplitterControl::ChangePos(GetDlgItem(IDC_EDIT_ALL),0,delta); CSplitterControl::ChangePos(GetDlgItem(IDC_BUTTON_UP2),0,delta); CSplitterControl::ChangePos(GetDlgItem(IDC_BUTTON_DOWN2),0,delta); CSplitterControl::ChangePos(GetDlgItem(IDC_REBASE_CHECK_FORCE),0,delta); this->AddRebaseAnchor(); // adjust the minimum size of the dialog to prevent the resizing from // moving the list control too far down. CRect rcLogMsg; m_CommitList.GetClientRect(rcLogMsg); SetMinTrackSize(CSize(m_DlgOrigRect.Width(), m_DlgOrigRect.Height()-m_CommitListOrigRect.Height()+rcLogMsg.Height())); SetSplitterRange(); // m_CommitList.Invalidate(); // GetDlgItem(IDC_LOGMESSAGE)->Invalidate(); this->m_ctrlTabCtrl.Invalidate(); this->m_CommitList.Invalidate(); this->m_FileListCtrl.Invalidate(); this->m_LogMessageCtrl.Invalidate(); }
void CImportPatchDlg::DoSize(int delta) { this->RemoveAllAnchors(); CSplitterControl::ChangeHeight(GetDlgItem(IDC_LIST_PATCH), delta, CW_TOPALIGN); //CSplitterControl::ChangeHeight(GetDlgItem(), delta, CW_TOPALIGN); CSplitterControl::ChangeHeight(GetDlgItem(IDC_AM_TAB), -delta, CW_BOTTOMALIGN); //CSplitterControl::ChangeHeight(GetDlgItem(), -delta, CW_BOTTOMALIGN); CSplitterControl::ChangePos(GetDlgItem(IDC_CHECK_3WAY), 0, delta); CSplitterControl::ChangePos(GetDlgItem(IDC_CHECK_IGNORE_SPACE), 0, delta); CSplitterControl::ChangePos(GetDlgItem(IDC_SIGN_OFF), 0, delta); CSplitterControl::ChangePos(GetDlgItem(IDC_KEEP_CR), 0, delta); this->AddAmAnchor(); // adjust the minimum size of the dialog to prevent the resizing from // moving the list control too far down. CRect rcLogMsg; m_cList.GetClientRect(rcLogMsg); SetMinTrackSize(CSize(m_DlgOrigRect.Width(), m_DlgOrigRect.Height()-m_PatchListOrigRect.Height()+rcLogMsg.Height())); SetSplitterRange(); // m_CommitList.Invalidate(); // GetDlgItem(IDC_LOGMESSAGE)->Invalidate(); this->m_ctrlTabCtrl.Invalidate(); }
int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; // child dialogs don't want resizable border or size grip, // nor they can handle the min/max size constraints BOOL bChild = GetStyle() & WS_CHILD; if (!bChild) { // keep client area CRect rect; GetClientRect(&rect); // set resizable style ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME); // adjust size to reflect new style ::AdjustWindowRectEx(&rect, GetStyle(), ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle()); SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED| SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION); // set the initial size as the min track size SetMinTrackSize(rect.Size()); } // create and init the size-grip if (!CreateSizeGrip(!bChild)) return -1; return 0; }
BOOL CShaderEditorDlg::Create(CWnd* pParent) { if (!__super::Create(IDD, pParent)) { return FALSE; } AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_COMBO2, TOP_RIGHT); AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_EDIT2, BOTTOM_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_BUTTON1, TOP_RIGHT); m_srcdata.SetTabStops(16); SetMinTrackSize(CSize(250, 40)); m_targets.AddString(_T("ps_2_0")); m_targets.AddString(_T("ps_2_a")); m_targets.AddString(_T("ps_2_sw")); m_targets.AddString(_T("ps_3_0")); m_targets.AddString(_T("ps_3_sw")); POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition(); while (pos) { const AppSettings::Shader& s = AfxGetAppSettings().m_shaders.GetNext(pos); m_labels.SetItemDataPtr(m_labels.AddString(s.label), (void*)&s); } CorrectComboListWidth(m_labels); m_nIDEventShader = SetTimer(1, 1000, NULL); return TRUE; }
BOOL CSubtitleDlDlg::OnInitDialog() { __super::OnInitDialog(); m_status.Create(WS_CHILD | WS_VISIBLE | CCS_BOTTOM, CRect(0, 0, 0, 0), this, IDC_STATUSBAR); int n, curPos = 0; CArray<int> columnWidth; CString strColumnWidth = AfxGetApp()->GetProfileString(IDS_R_DLG_SUBTITLEDL, IDS_RS_DLG_SUBTITLEDL_COLWIDTH, _T("")); CString token = strColumnWidth.Tokenize(_T(","), curPos); while (!token.IsEmpty()) { if (_stscanf_s(token, L"%i", &n) == 1) { columnWidth.Add(n); token = strColumnWidth.Tokenize(_T(","), curPos); } else { throw 1; } } m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP); if (columnWidth.GetCount() != 5) { // default sizes columnWidth.RemoveAll(); columnWidth.Add(290); columnWidth.Add(70); columnWidth.Add(50); columnWidth.Add(50); columnWidth.Add(270); } m_list.InsertColumn(COL_FILENAME, ResStr(IDS_SUBDL_DLG_FILENAME_COL), LVCFMT_LEFT, columnWidth[0]); m_list.InsertColumn(COL_LANGUAGE, ResStr(IDS_SUBDL_DLG_LANGUAGE_COL), LVCFMT_CENTER, columnWidth[1]); m_list.InsertColumn(COL_FORMAT, ResStr(IDS_SUBDL_DLG_FORMAT_COL), LVCFMT_CENTER, columnWidth[2]); m_list.InsertColumn(COL_DISC, ResStr(IDS_SUBDL_DLG_DISC_COL), LVCFMT_CENTER, columnWidth[3]); m_list.InsertColumn(COL_TITLES, ResStr(IDS_SUBDL_DLG_TITLES_COL), LVCFMT_LEFT, columnWidth[4]); AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_CHECK1, BOTTOM_LEFT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDC_STATUSBAR, BOTTOM_LEFT, BOTTOM_RIGHT); const CSize s(420, 200); SetMinTrackSize(s); EnableSaveRestore(IDS_R_DLG_SUBTITLEDL); // start new worker thread to download the list of subtitles m_pTA = DEBUG_NEW THREADSTRUCT; m_pTA->url = m_url; m_pTA->hWND = GetSafeHwnd(); SetStatus(ResStr(IDS_SUBDL_DLG_DOWNLOADING)); AfxBeginThread(RunThread, static_cast<LPVOID>(m_pTA)); return TRUE; }
BOOL CResizablePage::OnInitDialog() { CPropertyPage::OnInitDialog(); // set the initial size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CResizableSheetEx::OnInitDialog() { BOOL bResult = CPropertySheetEx::OnInitDialog(); // set the initial size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); // initialize layout PresetLayout(); m_bLayoutDone = TRUE; return bResult; }
void CResizableSheet::PresetLayout() { // set the initial size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); if (GetStyle() & WS_CHILD) { GetClientRect(&rc); GetTabControl()->MoveWindow(&rc); } if (IsWizard()) // wizard mode { // hide tab control GetTabControl()->ShowWindow(SW_HIDE); AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT); } else // tab mode { AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT); } // add a callback for active page (which can change at run-time) m_nCallbackID = AddAnchorCallback(); // use *total* parent size to have correct margins CRect rectPage, rectSheet; GetTotalClientRect(&rectSheet); GetActivePage()->GetWindowRect(&rectPage); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2); // pre-calculate margins m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft(); m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight(); // add all possible buttons, if they exist for (int i = 0; i < _propButtonsCount; i++) { if (NULL != GetDlgItem(_propButtons[i])) AddAnchor(_propButtons[i], BOTTOM_RIGHT); } // prevent flickering GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS); }
BOOL CResizableDialog::OnInitDialog() { CDialog::OnInitDialog(); // gets the template size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); // init UpdateGripPos(); m_bInitDone = TRUE; return TRUE; // return TRUE unless you set the focus to a control }
BOOL CMyPropertySheet::OnInitDialog() { CResizableSheet::OnInitDialog(); // ModifyStyleEx(WS_EX_DLGMODALFRAME, 0); // enable sys menu and icon // set minimal size CRect rc; GetWindowRect(&rc); SetMinTrackSize(CSize(GetMinWidth(), rc.Height())); //ResetMinTrackSize(); // enable save/restore, with active page EnableSaveRestore(_T("MyPropertySheet"), TRUE, TRUE); return TRUE; }
BOOL COpenDlg::OnInitDialog() { __super::OnInitDialog(); UpdateData(FALSE); CRecentFileList& MRU = AfxGetCurrentSettings().MRU; MRU.ReadList(); m_mrucombo.ResetContent(); for(int i = 0; i < MRU.GetSize(); i++) if(!MRU[i].IsEmpty()) m_mrucombo.AddString(MRU[i]); CorrectComboListWidth(m_mrucombo, GetFont()); CRecentFileList& MRUDub = AfxGetCurrentSettings().MRUDub; MRUDub.ReadList(); m_mrucombo2.ResetContent(); for(int i = 0; i < MRUDub.GetSize(); i++) if(!MRUDub[i].IsEmpty()) m_mrucombo2.AddString(MRUDub[i]); CorrectComboListWidth(m_mrucombo2, GetFont()); if(m_mrucombo.GetCount() > 0) { m_mrucombo.SetCurSel(0); } AddAnchor(m_mrucombo, TOP_LEFT, TOP_RIGHT); AddAnchor(m_mrucombo2, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_BUTTON1, TOP_RIGHT); AddAnchor(IDC_BUTTON2, TOP_RIGHT); AddAnchor(IDOK, TOP_RIGHT); AddAnchor(IDCANCEL, TOP_RIGHT); AddAnchor(IDC_STATIC1, TOP_LEFT, TOP_RIGHT); CRect r; GetWindowRect(r); CSize s = r.Size(); SetMinTrackSize(s); s.cx = 1000; SetMaxTrackSize(s); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CConvertChapDlg::OnInitDialog() { __super::OnInitDialog(); AddAnchor(IDC_EDIT1, TOP_LEFT); AddAnchor(IDC_EDIT2, TOP_LEFT, TOP_RIGHT); AddAnchor(IDOK, BOTTOM_CENTER); AddAnchor(IDCANCEL, BOTTOM_CENTER); CRect r; GetWindowRect(r); CSize s = r.Size(); SetMinTrackSize(s); s.cx = 1000; SetMaxTrackSize(s); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CResizableSheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // set the initial size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); // init UpdateGripPos(); PresetLayout(); // prevent flickering // GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS); m_bInitDone = TRUE; return bResult; }
BOOL InfWizardDlg::OnInitDialog() { CResizableSheetEx::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CRect rect; GetWindowRect(&rect); SetMinTrackSize(CSize(GetMinWidth(), rect.Height())); //EnableSaveRestore("InfWizardApp"); CString sTitle; sTitle.LoadString(IDS_INFWIZARD); this->SetTitle(sTitle, 0); CDeviceNotifier::RegisterNotifier(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void COFSNcDlg2::LoadSkin() { CComPtr<IXMLDOMDocument> pDoc = NULL; CComPtr<IXMLDOMNode> pRoot = NULL; LoadSkinXML(&pDoc, &pRoot); if(pRoot) { CRect r, rMin, rMax; r.SetRectEmpty(); rMin.SetRectEmpty(); rMax.SetRectEmpty(); LoadWindow(pRoot, r, rMin, rMax); // SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER); LoadColors(pRoot); LoadPictures(pRoot); LoadSkin(pRoot); SetMinTrackSize(rMin.Size()); if(!rMax.IsRectEmpty()) SetMaxTrackSize(rMax.Size()); } }
BOOL CResizableDialog::OnNcCreate(LPCREATESTRUCT lpCreateStruct) { if (!CDialog::OnNcCreate(lpCreateStruct)) return FALSE; // child dialogs don't want resizable border or size grip, // nor they can handle the min/max size constraints BOOL bChild = lpCreateStruct->style & WS_CHILD; // create and init the size-grip if (!CreateSizeGrip(!bChild)) return FALSE; if (!bChild) { // set the initial size as the min track size SetMinTrackSize(CSize(lpCreateStruct->cx, lpCreateStruct->cy)); } MakeResizable(lpCreateStruct); return TRUE; }
BOOL CResizablePageEx::OnInitDialog() { CPropertyPageEx::OnInitDialog(); // set the initial size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); // HACK: temporarily abandon subclassing // CAUSE: system subclasses this window after this message // ISSUE: our WindowProc is not the first to be called // and we miss some painting related messages if (Attach(UnsubclassWindow())) { CWnd* pParent = GetParent(); pParent->LockWindowUpdate(); Post_SheetPageExHack(pParent->GetSafeHwnd(), m_hWnd); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CSubtitleUpDlg::OnInitDialog() { __super::OnInitDialog(); m_progress.SetParent(&m_status); m_progress.UpdateWindow(); int n = 0, curPos = 0; CArray<int> columnWidth; CString strColumnWidth(AfxGetApp()->GetProfileString(IDS_R_DLG_SUBTITLEUP, IDS_RS_DLG_SUBTITLEUP_COLWIDTH)); CString token(strColumnWidth.Tokenize(_T(","), curPos)); while (!token.IsEmpty()) { if (_stscanf_s(token, L"%d", &n) == 1) { columnWidth.Add(n); token = strColumnWidth.Tokenize(_T(","), curPos); } else { throw 1; } } m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP); m_list.SetImageList(&m_pMainFrame->m_pSubtitlesProviders->GetImageList(), LVSIL_SMALL); if (columnWidth.GetCount() != COL_TOTAL_COLUMNS) { // default sizes columnWidth.RemoveAll(); columnWidth.Add(120); columnWidth.Add(75); columnWidth.Add(250); } m_list.InsertColumn(COL_PROVIDER, ResStr(IDS_SUBDL_DLG_PROVIDER_COL), LVCFMT_LEFT, columnWidth[COL_PROVIDER]); m_list.InsertColumn(COL_USERNAME, ResStr(IDS_SUBUL_DLG_USERNAME_COL), LVCFMT_LEFT, columnWidth[COL_USERNAME]); m_list.InsertColumn(COL_STATUS, ResStr(IDS_SUBUL_DLG_STATUS_COL), LVCFMT_LEFT, columnWidth[COL_STATUS]); m_list.SetRedraw(FALSE); m_list.DeleteAllItems(); int i = 0; for (const auto& iter : m_pMainFrame->m_pSubtitlesProviders->Providers()) { if (iter->Flags(SPF_UPLOAD)) { int iItem = m_list.InsertItem((int)i++, CString(iter->Name().c_str()), iter->GetIconIndex()); m_list.SetItemText(iItem, COL_USERNAME, UTF8To16(iter->UserName().c_str())); m_list.SetItemText(iItem, COL_STATUS, ResStr(IDS_SUBUL_DLG_STATUS_READY)); m_list.SetCheck(iItem, iter->Enabled(SPF_UPLOAD)); m_list.SetItemData(iItem, (DWORD_PTR)(iter.get())); } } m_list.SetRedraw(TRUE); m_list.Invalidate(); m_list.UpdateWindow(); UpdateData(FALSE); AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_BUTTON1, BOTTOM_RIGHT); AddAnchor(IDC_BUTTON2, BOTTOM_RIGHT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDC_STATUSBAR, BOTTOM_LEFT, BOTTOM_RIGHT); const CSize s(500, 250); SetMinTrackSize(s); EnableSaveRestore(IDS_R_DLG_SUBTITLEUP, TRUE); return TRUE; }
CDebugShadersDlg::CDebugShadersDlg() : CModelessDialog(IDD) , m_timerOneTime(this, TIMER_ONETIME_START, TIMER_ONETIME_END - TIMER_ONETIME_START + 1) , m_Compiler(nullptr) { EventRouter::EventSelection receives; receives.insert(MpcEvent::SHADER_LIST_CHANGED); GetEventd().Connect(m_eventc, receives, std::bind(&CDebugShadersDlg::EventCallback, this, std::placeholders::_1)); // Set window icon VERIFY(SetIcon(AfxGetMainWnd()->GetIcon(true), true) == nullptr); // Setup window auto-resize and restore last position SetSizeGripVisibility(FALSE); SetMinTrackSize(CSize(360, 100)); AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT); AddAnchor((UINT)IDC_STATIC, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_RADIO1, TOP_RIGHT); AddAnchor(IDC_RADIO2, TOP_RIGHT); AddAnchor(IDC_RADIO3, TOP_RIGHT); AddAnchor(IDC_RADIO4, TOP_RIGHT); EnableSaveRestore(IDS_R_DEBUG_SHADERS); CWinApp* pApp = AfxGetApp(); // Restore controls' old state m_iVersion = pApp->GetProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_LASTVERSION, ps_2_0); VERIFY(UpdateData(FALSE)); CString oldpath = pApp->GetProfileString(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_LASTFILE); if (!oldpath.IsEmpty()) { ASSERT(m_Shaders.GetCount() == 0); int sel = m_Shaders.AddString(oldpath); if (sel >= 0) { VERIFY(m_Shaders.SetCurSel(sel) != CB_ERR); } else { ASSERT(FALSE); } } // Put WM_PAINT message before WM_APP_RECOMPILE_SHADER UpdateWindow(); // Load new shader list OnListRefresh(); // We need to trigger shader compilation manually when // old state's selected shader is present in current shader list. // Otherwise it's triggered by OnListRefresh() int sel = m_Shaders.GetCurSel(); if (sel != CB_ERR) { CString path; m_Shaders.GetLBText(sel, path); ASSERT(!path.IsEmpty()); if (oldpath == path) { UpdateNotifierState(); VERIFY(PostMessage(WM_APP_RECOMPILE_SHADER)); } } // Display first-run dialog if (pApp->GetProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_FIRSTRUN, 1)) { CString msg; if (msg.LoadString(IDS_DEBUGSHADERS_FIRSTRUN_MSG)) { AfxMessageBox(msg, MB_ICONINFORMATION); } else { ASSERT(FALSE); } VERIFY(pApp->WriteProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_FIRSTRUN, 0)); } }
BOOL CSubtitleDlDlg::OnInitDialog() { __super::OnInitDialog(); AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_CHECK1, BOTTOM_LEFT); AddAnchor(IDOK, BOTTOM_RIGHT); CSize s(200, 150); SetMinTrackSize(s); m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT); m_list.InsertColumn(COL_FILENAME, _T("File"), LVCFMT_LEFT, 160); m_list.InsertColumn(COL_LANGUAGE, _T("Language"), LVCFMT_CENTER, 80); m_list.InsertColumn(COL_FORMAT, _T("Format"), LVCFMT_CENTER, 50); m_list.InsertColumn(COL_DISC, _T("Disc"), LVCFMT_CENTER, 50); m_list.InsertColumn(COL_TITLES, _T("Title(s)"), LVCFMT_LEFT, 300); m_onoff.Create(IDB_ONOFF, 12, 3, 0xffffff); m_list.SetImageList(&m_onoff, LVSIL_SMALL); int i = 0; POSITION pos = m_movies.GetHeadPosition(); while(pos) { isdb_movie& m = m_movies.GetNext(pos); CStringA titlesA = Implode(m.titles, '|'); titlesA.Replace("|", ", "); CString titles = UTF8To16(titlesA); POSITION pos2 = m.subs.GetHeadPosition(); while(pos2) { isdb_subtitle& s = m.subs.GetNext(pos2); CString name = UTF8To16(s.name); CString language = s.language; CString format = s.format; CString disc; disc.Format(_T("%d/%d"), s.disc_no, s.discs); int iItem = m_list.InsertItem(i++, _T("")); m_list.SetItemData(iItem, (DWORD_PTR)&s); m_list.SetItemText(iItem, COL_FILENAME, name); m_list.SetItemText(iItem, COL_LANGUAGE, language); m_list.SetItemText(iItem, COL_FORMAT, format); m_list.SetItemText(iItem, COL_DISC, disc); m_list.SetItemText(iItem, COL_TITLES, titles); } } m_selsubs.RemoveAll(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CResizableSheetEx::PresetLayout() { // set the initial size as the min track size CRect rc; GetWindowRect(&rc); SetMinTrackSize(rc.Size()); // use *total* parent size to have correct margins CRect rectPage, rectSheet; GetTotalClientRect(&rectSheet); // get page area if (IsWizard() || IsWizard97()) { HWND hPage = PropSheet_GetCurrentPageHwnd(m_hWnd); ::GetWindowRect(hPage, &rectPage); } else { GetTabControl()->GetWindowRect(&rectPage); } ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2); // calculate margins CRect rect; int cxDiff = rectSheet.right - rectPage.right; int cyDiff = 0; // try all possible buttons for (int i = 0; i < _propButtonsCount; i++) { CWnd* pWnd = GetDlgItem(_propButtons[i]); if (NULL != pWnd) { // move buttons if necessary if (GetStyle() & WS_CHILD) { pWnd->GetWindowRect(&rect); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2); cyDiff = rectSheet.bottom - rect.bottom; rect.OffsetRect(cxDiff, cyDiff); pWnd->MoveWindow(&rect); } // add buttons to the layout manager AddAnchor(_propButtons[i], BOTTOM_RIGHT); } } // setup pages area if (IsWizard() || IsWizard97()) { // move line and pages if necessary if (GetStyle() & WS_CHILD) { GetDlgItem(ID_WIZLINE)->GetWindowRect(&rect); ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rect, 2); rect.OffsetRect(0, cyDiff); rect.InflateRect(cxDiff, 0); GetDlgItem(ID_WIZLINE)->MoveWindow(&rect); rectPage.bottom += cyDiff; rectPage.left = 0; rectPage.top = 0; rectPage.right = rectSheet.right; } AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT); if (IsWizard97()) // add header line for wizard97 dialogs AddAnchor(ID_WIZLINEHDR, TOP_LEFT, TOP_RIGHT); // hide tab control GetTabControl()->ShowWindow(SW_HIDE); // pre-calculate margins m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft(); m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight(); } else { // grow tab to the available sheet space if (cyDiff > 0) rectSheet.bottom = rectPage.bottom + cyDiff; if (GetStyle() & WS_CHILD) GetTabControl()->MoveWindow(&rectSheet); AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT); } // add a callback for active page (which can change at run-time) m_nCallbackID = AddAnchorCallback(); // prevent flickering GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS); }
BOOL COpenDlg::OnInitDialog() { __super::OnInitDialog(); AppSettings& s = AfxGetAppSettings(); CRecentFileList& MRU = s.MRU; MRU.ReadList(); m_mrucombo.ResetContent(); for (int i = 0; i < MRU.GetSize(); i++) if (!MRU[i].IsEmpty()) { m_mrucombo.AddString(MRU[i]); } CorrectComboListWidth(m_mrucombo); CRecentFileList& MRUDub = s.MRUDub; MRUDub.ReadList(); m_mrucombo2.ResetContent(); for (int i = 0; i < MRUDub.GetSize(); i++) if (!MRUDub[i].IsEmpty()) { m_mrucombo2.AddString(MRUDub[i]); } CorrectComboListWidth(m_mrucombo2); if (m_mrucombo.GetCount() > 0) { m_mrucombo.SetCurSel(0); } if (::IsClipboardFormatAvailable(CF_UNICODETEXT) && ::OpenClipboard(m_hWnd)) { HGLOBAL hglb = ::GetClipboardData(CF_UNICODETEXT); if (hglb) { LPCTSTR pText = (LPCTSTR)::GlobalLock(hglb); if (pText) { if (AfxIsValidString(pText)) { CString tmpData(CString(pText).MakeLower()); if (PlayerYouTubeCheck(tmpData) || PlayerYouTubePlaylistCheck(tmpData)) { m_mrucombo.SetWindowTextW(pText); } } GlobalUnlock(hglb); } } CloseClipboard(); } m_fns.RemoveAll(); m_path.Empty(); m_path2.Empty(); m_fMultipleFiles = false; m_fAppendPlaylist = FALSE; AddAnchor(m_mrucombo, TOP_LEFT, TOP_RIGHT); AddAnchor(m_mrucombo2, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_BUTTON1, TOP_RIGHT); AddAnchor(IDC_BUTTON2, TOP_RIGHT); AddAnchor(IDOK, TOP_RIGHT); AddAnchor(IDCANCEL, TOP_RIGHT); AddAnchor(IDC_STATIC1, TOP_LEFT, TOP_RIGHT); CRect r; GetWindowRect(r); CSize sr = r.Size(); SetMinTrackSize(sr); sr.cx = 1000; SetMaxTrackSize(sr); if (m_hIcon != NULL) { CStatic *pStat = (CStatic*)GetDlgItem(IDC_MAINFRAME_ICON); pStat->SetIcon(m_hIcon); } return TRUE; }