Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / tools / leveldesign / georges_plugin_sound / PageBgFades.cpp
blob23a44785002c72ab504456cbab0b49e71d2389c3
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
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 // PageBgFades.cpp : implementation file
23 #include "std_sound_plugin.h"
24 #include "georges_plugin_sound.h"
25 #include "nel/misc/types_nl.h"
26 #include "sound_dialog.h"
27 #include "sound_plugin.h"
28 #include "nel/sound/u_audio_mixer.h"
30 #include "PageBgFades.h"
31 #include "resource.h"
33 using namespace std;
35 uint FILTER_NAMES[] =
37 IDC_FILTER_NAME_00,
38 IDC_FILTER_NAME_01,
39 IDC_FILTER_NAME_02,
40 IDC_FILTER_NAME_03,
41 IDC_FILTER_NAME_04,
42 IDC_FILTER_NAME_05,
43 IDC_FILTER_NAME_06,
44 IDC_FILTER_NAME_07,
45 IDC_FILTER_NAME_08,
46 IDC_FILTER_NAME_09,
47 IDC_FILTER_NAME_10,
48 IDC_FILTER_NAME_11,
49 IDC_FILTER_NAME_12,
50 IDC_FILTER_NAME_13,
51 IDC_FILTER_NAME_14,
52 IDC_FILTER_NAME_15,
53 IDC_FILTER_NAME_16,
54 IDC_FILTER_NAME_17,
55 IDC_FILTER_NAME_18,
56 IDC_FILTER_NAME_19,
57 IDC_FILTER_NAME_20,
58 IDC_FILTER_NAME_21,
59 IDC_FILTER_NAME_22,
60 IDC_FILTER_NAME_23,
61 IDC_FILTER_NAME_24,
62 IDC_FILTER_NAME_25,
63 IDC_FILTER_NAME_26,
64 IDC_FILTER_NAME_27,
65 IDC_FILTER_NAME_28,
66 IDC_FILTER_NAME_29,
67 IDC_FILTER_NAME_30,
68 IDC_FILTER_NAME_31
71 uint FILTER_FADE_IN[] =
73 IDC_FADE_IN_00,
74 IDC_FADE_IN_01,
75 IDC_FADE_IN_02,
76 IDC_FADE_IN_03,
77 IDC_FADE_IN_04,
78 IDC_FADE_IN_05,
79 IDC_FADE_IN_06,
80 IDC_FADE_IN_07,
81 IDC_FADE_IN_08,
82 IDC_FADE_IN_09,
83 IDC_FADE_IN_10,
84 IDC_FADE_IN_11,
85 IDC_FADE_IN_12,
86 IDC_FADE_IN_13,
87 IDC_FADE_IN_14,
88 IDC_FADE_IN_15,
89 IDC_FADE_IN_16,
90 IDC_FADE_IN_17,
91 IDC_FADE_IN_18,
92 IDC_FADE_IN_19,
93 IDC_FADE_IN_20,
94 IDC_FADE_IN_21,
95 IDC_FADE_IN_22,
96 IDC_FADE_IN_23,
97 IDC_FADE_IN_24,
98 IDC_FADE_IN_25,
99 IDC_FADE_IN_26,
100 IDC_FADE_IN_27,
101 IDC_FADE_IN_28,
102 IDC_FADE_IN_29,
103 IDC_FADE_IN_30,
104 IDC_FADE_IN_31
107 uint FILTER_FADE_OUT[] =
109 IDC_FADE_OUT_00,
110 IDC_FADE_OUT_01,
111 IDC_FADE_OUT_02,
112 IDC_FADE_OUT_03,
113 IDC_FADE_OUT_04,
114 IDC_FADE_OUT_05,
115 IDC_FADE_OUT_06,
116 IDC_FADE_OUT_07,
117 IDC_FADE_OUT_08,
118 IDC_FADE_OUT_09,
119 IDC_FADE_OUT_10,
120 IDC_FADE_OUT_11,
121 IDC_FADE_OUT_12,
122 IDC_FADE_OUT_13,
123 IDC_FADE_OUT_14,
124 IDC_FADE_OUT_15,
125 IDC_FADE_OUT_16,
126 IDC_FADE_OUT_17,
127 IDC_FADE_OUT_18,
128 IDC_FADE_OUT_19,
129 IDC_FADE_OUT_20,
130 IDC_FADE_OUT_21,
131 IDC_FADE_OUT_22,
132 IDC_FADE_OUT_23,
133 IDC_FADE_OUT_24,
134 IDC_FADE_OUT_25,
135 IDC_FADE_OUT_26,
136 IDC_FADE_OUT_27,
137 IDC_FADE_OUT_28,
138 IDC_FADE_OUT_29,
139 IDC_FADE_OUT_30,
140 IDC_FADE_OUT_31,
143 map<uint, uint> FILTER_FADE_IN_IDX;
144 map<uint, uint> FILTER_FADE_OUT_IDX;
146 /////////////////////////////////////////////////////////////////////////////
147 // CPageBgFades property page
149 #undef new
150 IMPLEMENT_DYNCREATE(CPageBgFades, CPageBase)
151 #define new NL_NEW
153 CPageBgFades::CPageBgFades(NLGEORGES::CSoundDialog *soundDialog)
154 : CPageBase(soundDialog, CPageBgFades::IDD)
156 AFX_MANAGE_STATE(AfxGetStaticModuleState());
157 //{{AFX_DATA_INIT(CPageBgFades)
158 // NOTE: the ClassWizard will add member initialization here
159 //}}AFX_DATA_INIT
161 for (uint i=0; i<32; ++i)
163 FILTER_FADE_IN_IDX.insert(make_pair(FILTER_FADE_IN[i], i));
164 FILTER_FADE_OUT_IDX.insert(make_pair(FILTER_FADE_OUT[i], i));
168 CPageBgFades::~CPageBgFades()
172 void CPageBgFades::DoDataExchange(CDataExchange* pDX)
174 CPropertyPage::DoDataExchange(pDX);
175 //{{AFX_DATA_MAP(CPageBgFades)
176 // NOTE: the ClassWizard will add DDX and DDV calls here
177 //}}AFX_DATA_MAP
181 BEGIN_MESSAGE_MAP(CPageBgFades, CPropertyPage)
182 //{{AFX_MSG_MAP(CPageBgFades)
183 //}}AFX_MSG_MAP
184 END_MESSAGE_MAP()
186 /////////////////////////////////////////////////////////////////////////////
187 // CPageBgFades message handlers
189 BOOL CPageBgFades::OnInitDialog()
191 CPropertyPage::OnInitDialog();
193 // initialize the filter names and fade value
194 for (uint i =0; i<32; ++i)
196 char tmp[128];
197 GetDlgItem(FILTER_NAMES[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].Name));
198 sprintf(tmp, "%u", (unsigned int)SoundDialog->FilterFades.FadeIns[i]);
199 GetDlgItem(FILTER_FADE_IN[i])->SetWindowText(nlUtf8ToTStr(tmp));
200 sprintf(tmp, "%u", (unsigned int)SoundDialog->FilterFades.FadeOuts[i]);
201 GetDlgItem(FILTER_FADE_OUT[i])->SetWindowText(nlUtf8ToTStr(tmp));
204 SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades);
206 return TRUE; // return TRUE unless you set the focus to a control
207 // EXCEPTION: OCX Property Pages should return FALSE
210 BOOL CPageBgFades::OnCommand(WPARAM wParam, LPARAM lParam)
212 if (lParam != 0 && HIWORD(wParam) == EN_CHANGE)
214 int id = ::GetDlgCtrlID(HWND(lParam));
215 TCHAR tmp[1024];
217 if (FILTER_FADE_IN_IDX.find(id) != FILTER_FADE_IN_IDX.end())
219 // this is a fade in value modified !
220 GetDlgItem(id)->GetWindowText(tmp, 1024);
221 SoundDialog->FilterFades.FadeIns[FILTER_FADE_IN_IDX[id]] = atoi(nlTStrToUtf8(tmp));
222 SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades);
224 else if (FILTER_FADE_OUT_IDX.find(id) != FILTER_FADE_OUT_IDX.end())
226 // this is a fade in value modified !
227 GetDlgItem(id)->GetWindowText(tmp, 1024);
228 SoundDialog->FilterFades.FadeOuts[FILTER_FADE_OUT_IDX[id]] = atoi(nlTStrToUtf8(tmp));
229 SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades);
233 return CPropertyPage::OnCommand(wParam, lParam);