1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 // settings_dialog.cpp : implementation file
25 #include "georges_edit.h"
26 #include "settings_dialog.h"
28 using namespace NLMISC
;
30 /////////////////////////////////////////////////////////////////////////////
31 // CSettingsDialog dialog
34 CSettingsDialog::CSettingsDialog(CWnd
* pParent
/*=NULL*/)
35 : CDialog(CSettingsDialog::IDD
, pParent
)
37 //{{AFX_DATA_INIT(CSettingsDialog)
38 RootSearchPath
= _T("");
42 TypeDfnSubDirectory
= _T("");
49 void CSettingsDialog::DoDataExchange(CDataExchange
* pDX
)
51 CDialog::DoDataExchange(pDX
);
52 //{{AFX_DATA_MAP(CSettingsDialog)
53 DDX_Text(pDX
, IDC_ROOT_SEARCH_PATH
, RootSearchPath
);
54 DDX_Text(pDX
, IDC_REMEMBER_LIST_SIZE
, RememberListSize
);
55 DDX_Text(pDX
, IDC_DEFAULT_DFN
, DefaultDfn
);
56 DDX_Text(pDX
, IDC_DEFAULT_TYPE
, DefaultType
);
57 DDX_Text(pDX
, IDC_TYP_DFN_PATH
, TypeDfnSubDirectory
);
58 DDX_Text(pDX
, IDC_MAX_UNDO
, MaxUndo
);
59 DDX_Check(pDX
, IDC_START_EXPANDED
, StartExpanded
);
64 BEGIN_MESSAGE_MAP(CSettingsDialog
, CDialog
)
65 //{{AFX_MSG_MAP(CSettingsDialog)
66 ON_EN_CHANGE(IDC_ROOT_SEARCH_PATH
, OnChangeRootSearchPath
)
67 ON_BN_CLICKED(IDC_BROWSE
, OnBrowse
)
68 ON_EN_CHANGE(IDC_REMEMBER_LIST_SIZE
, OnChangeRememberListSize
)
69 ON_EN_CHANGE(IDC_DEFAULT_DFN
, OnChangeDefaultDfn
)
70 ON_EN_CHANGE(IDC_DEFAULT_TYPE
, OnChangeDefaultType
)
74 /////////////////////////////////////////////////////////////////////////////
75 // CSettingsDialog message handlers
77 void CSettingsDialog::OnChangeRootSearchPath()
81 BOOL
CSettingsDialog::OnInitDialog()
83 CDialog::OnInitDialog();
86 RootSearchPath
= "\\";
88 // Get the config file path
90 RootSearchPath
= theApp
.RootSearchPath
.c_str();
91 TypeDfnSubDirectory
= theApp
.TypeDfnSubDirectory
.c_str();
92 RememberListSize
= theApp
.RememberListSize
;
93 MaxUndo
= theApp
.MaxUndo
;
94 DefaultDfn
= theApp
.DefaultDfn
.c_str ();
95 DefaultType
= theApp
.DefaultType
.c_str ();
96 StartExpanded
= theApp
.StartExpanded
;
100 return TRUE
; // return TRUE unless you set the focus to a control
101 // EXCEPTION: OCX Property Pages should return FALSE
104 void CSettingsDialog::OnOK()
108 // Make a config file
109 theApp
.RootSearchPath
= NLMISC::tStrToUtf8(RootSearchPath
);
110 theApp
.TypeDfnSubDirectory
= NLMISC::tStrToUtf8(TypeDfnSubDirectory
);
111 theApp
.RememberListSize
= RememberListSize
;
112 theApp
.StartExpanded
= StartExpanded
? TRUE
: FALSE
;
113 theApp
.MaxUndo
= MaxUndo
;
114 theApp
.DefaultDfn
= NLMISC::tStrToUtf8(DefaultDfn
);
115 theApp
.DefaultType
= NLMISC::tStrToUtf8(DefaultType
);
122 void CSettingsDialog::OnBrowse()
126 // Select a directory.
127 TCHAR path
[MAX_PATH
];
131 memset(&info
, 0, sizeof(BROWSEINFO
));
132 info
.lpszTitle
= _T("Select the root search directory");
133 info
.ulFlags
= BIF_RETURNONLYFSDIRS
;
137 if (list
= SHBrowseForFolder(&info
))
139 // Convert item into path string
140 BOOL bRet
= SHGetPathFromIDList(list
, path
);
144 RootSearchPath
= path
;
150 void CSettingsDialog::OnChangeRememberListSize()
154 void CSettingsDialog::OnChangeDefaultDfn()
158 void CSettingsDialog::OnChangeDefaultType()