Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/addsetting.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9881 by zmatsuo, Fri Apr 22 15:37:28 2022 UTC revision 9882 by zmatsuo, Fri Apr 22 15:37:38 2022 UTC
# Line 1722  void CCygwinPropPageDlg::OnHelp() Line 1722  void CCygwinPropPageDlg::OnHelp()
1722    
1723  #define REWRITE_TEMPLATE        1  #define REWRITE_TEMPLATE        1
1724  // quick hack :-(  // quick hack :-(
1725  HINSTANCE CAddSettingPropSheetDlg::ghInstance;  HINSTANCE TTCPropSheetDlg::ghInstance;
1726  class CAddSettingPropSheetDlg *CAddSettingPropSheetDlg::gTTCPS;  class TTCPropSheetDlg* TTCPropSheetDlg::gTTCPS;
1727    
1728  LRESULT CALLBACK CAddSettingPropSheetDlg::WndProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)  LRESULT CALLBACK TTCPropSheetDlg::WndProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
1729  {  {
1730          switch(msg){          switch(msg){
1731          case WM_INITDIALOG:          case WM_INITDIALOG:
# Line 1743  LRESULT CALLBACK CAddSettingPropSheetDlg Line 1743  LRESULT CALLBACK CAddSettingPropSheetDlg
1743          return result;          return result;
1744  }  }
1745    
1746  LRESULT CALLBACK CAddSettingPropSheetDlg::WndProcStatic(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)  LRESULT CALLBACK TTCPropSheetDlg::WndProcStatic(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
1747  {  {
1748          CAddSettingPropSheetDlg *self = (CAddSettingPropSheetDlg *)GetWindowLongPtr(dlg, GWLP_USERDATA);          TTCPropSheetDlg*self = (TTCPropSheetDlg*)GetWindowLongPtr(dlg, GWLP_USERDATA);
1749          return self->WndProc(dlg, msg, wParam, lParam);          return self->WndProc(dlg, msg, wParam, lParam);
1750  }  }
1751    
1752  int CALLBACK CAddSettingPropSheetDlg::PropSheetProc(HWND hWnd, UINT msg, LPARAM lp)  int CALLBACK TTCPropSheetDlg::PropSheetProc(HWND hWnd, UINT msg, LPARAM lp)
1753  {  {
1754          switch (msg) {          switch (msg) {
1755          case PSCB_PRECREATE:          case PSCB_PRECREATE:
# Line 1775  int CALLBACK CAddSettingPropSheetDlg::Pr Line 1775  int CALLBACK CAddSettingPropSheetDlg::Pr
1775                          { IDCANCEL, "BTN_CANCEL" },                          { IDCANCEL, "BTN_CANCEL" },
1776                          { IDHELP, "BTN_HELP" },                          { IDHELP, "BTN_HELP" },
1777                  };                  };
1778                  CAddSettingPropSheetDlg *self = gTTCPS;                  TTCPropSheetDlg*self = gTTCPS;
1779                  self->m_hWnd = hWnd;                  self->m_hWnd = hWnd;
1780                  SetDlgTexts(hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);                  SetDlgTexts(hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
                 CenterWindow(hWnd, self->m_hParentWnd);  
1781                  self->m_OrgProc = SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR)WndProcStatic);                  self->m_OrgProc = SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR)WndProcStatic);
1782                  self->m_OrgUserData = SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)self);                  self->m_OrgUserData = SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)self);
1783                  break;                  break;
# Line 1787  int CALLBACK CAddSettingPropSheetDlg::Pr Line 1786  int CALLBACK CAddSettingPropSheetDlg::Pr
1786          return 0;          return 0;
1787  }  }
1788    
1789  // CAddSettingPropSheetDlg  void TTCPropSheetDlg::AddPage(HPROPSHEETPAGE page)
1790  CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd)  {
1791            hPsp[m_PageCount] = page;
1792            m_PageCount++;
1793    }
1794    
1795    TTCPropSheetDlg::TTCPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd)
1796  {  {
1797          m_hInst = hInstance;          m_hInst = hInstance;
1798          m_hWnd = 0;          m_hWnd = 0;
# Line 1800  CAddSettingPropSheetDlg::CAddSettingProp Line 1804  CAddSettingPropSheetDlg::CAddSettingProp
1804          m_psh.hwndParent = hParentWnd;          m_psh.hwndParent = hParentWnd;
1805          m_psh.hInstance = hInstance;          m_psh.hInstance = hInstance;
1806          m_psh.pfnCallback = PropSheetProc;          m_psh.pfnCallback = PropSheetProc;
1807            m_PageCount = 0;
1808    }
1809    TTCPropSheetDlg::~TTCPropSheetDlg()
1810    {
1811            free((void*)m_psh.pszCaption);
1812    }
1813    
1814    void TTCPropSheetDlg::SetCaption(const wchar_t* caption)
1815    {
1816            m_psh.pszCaption = _wcsdup(caption);
1817    }
1818    
1819    INT_PTR TTCPropSheetDlg::DoModal()
1820    {
1821            m_psh.nPages = m_PageCount;
1822            m_psh.phpage = hPsp;
1823            ghInstance = m_hInst;
1824            gTTCPS = this;
1825            return PropertySheetW(&m_psh);
1826    }
1827    
1828    //////////////////////////////////////////////////////////////////////////////
1829    
1830    // CAddSettingPropSheetDlg
1831    CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, HWND hParentWnd):
1832            TTCPropSheetDlg(hInstance, hParentWnd)
1833    {
1834          // CPP,tmfcのTTCPropertyPage派生クラスから生成          // CPP,tmfcのTTCPropertyPage派生クラスから生成
1835          int i = 0;          int i = 0;
1836          m_Page[i++] = new CGeneralPropPageDlg(hInstance);          m_Page[i++] = new CGeneralPropPageDlg(hInstance);
# Line 1814  CAddSettingPropSheetDlg::CAddSettingProp Line 1844  CAddSettingPropSheetDlg::CAddSettingProp
1844                  m_Page[i++] = new CDebugPropPage(hInstance);                  m_Page[i++] = new CDebugPropPage(hInstance);
1845          }          }
1846          m_PageCountCPP = i;          m_PageCountCPP = i;
1847    
1848            HPROPSHEETPAGE page;
1849          for (i = 0; i < m_PageCountCPP; i++) {          for (i = 0; i < m_PageCountCPP; i++) {
1850                  hPsp[i] = m_Page[i]->CreatePropertySheetPage();                  page = m_Page[i]->CreatePropertySheetPage();
1851                    AddPage(page);
1852          }          }
1853    
1854          // TTCPropertyPage を使用しない PropertyPage          // TTCPropertyPage を使用しない PropertyPage
1855          hPsp[m_PageCountCPP+0] = CodingPageCreate(hInstance, &ts);          page = CodingPageCreate(hInstance, &ts);
1856          hPsp[m_PageCountCPP+1] = FontPageCreate(hInstance, &ts);          AddPage(page);
1857          m_PageCount = m_PageCountCPP + 2;          page = FontPageCreate(hInstance, &ts);
1858            AddPage(page);
1859          m_psh.nPages = m_PageCount;  
1860          m_psh.phpage = hPsp;          wchar_t *title = TTGetLangStrW("Tera Term", "DLG_TABSHEET_TITLE", L"Tera Term: Additional settings", ts.UILanguageFile);
1861            SetCaption(title);
1862          wchar_t UIMsg[MAX_UIMSG];          free(title);
         get_lang_msgW("DLG_TABSHEET_TITLE", UIMsg, _countof(UIMsg),  
                                   L"Tera Term: Additional settings", ts.UILanguageFile);  
         m_psh.pszCaption = _wcsdup(UIMsg);  
1863  }  }
1864    
1865  CAddSettingPropSheetDlg::~CAddSettingPropSheetDlg()  CAddSettingPropSheetDlg::~CAddSettingPropSheetDlg()
1866  {  {
         free((void*)m_psh.pszCaption);  
1867          for (int i = 0; i < m_PageCountCPP; i++) {          for (int i = 0; i < m_PageCountCPP; i++) {
1868                  delete m_Page[i];                  delete m_Page[i];
1869          }          }
1870  }  }
   
 INT_PTR CAddSettingPropSheetDlg::DoModal()  
 {  
         ghInstance = m_hInst;  
         gTTCPS = this;  
         return PropertySheetW(&m_psh);  
 }  

Legend:
Removed from v.9881  
changed lines
  Added in v.9882

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26