]>
Commit | Line | Data |
---|---|---|
53947ced AM |
1 | Description: Compile audacity against wxWidgets 3.0 |
2 | Solved compilation issues: | |
3 | (1.) Allow wxWidgets 3.0 in various configure scripts. | |
4 | (2.) The file dialog was derived from an internal wx class that | |
5 | disappeared in wx3.0 (discussed in further detail below). | |
6 | (3.) In several places the types in interfaces changed between | |
7 | wxChar* and wxString. I've tried to modify the code so it works with | |
8 | both interfaces (thanks to implicit conversion; may look a bit weird | |
9 | in some places). | |
10 | (4.) Calls to "wxTheApp->SuspendIdleCallback()" are no longer | |
11 | supported. They were part of a workaround for a clipboard problem, | |
12 | which fortunately doesn't seem to be there any longer in wx3.0, so I | |
13 | deactivated it for wx3.0. | |
14 | (5.) AddPendingEvent() and ProcessEvent() now have the visibility | |
15 | "protected" in wxWindow. It has always been a bad idea to call them | |
16 | directly on a wxWindow object, but now it's explicitly forbidden. | |
17 | Instead, those functions should be called on the object returned by | |
18 | GetEventHandler(). | |
19 | (6.) The class wxStandardPaths is now a singleton and has to be | |
20 | treated as such (no more explicit constructor calls). | |
21 | (7.) "wxLogWarning" is a macro now, so the "::" prefix doesn't work | |
22 | on it anymore. | |
23 | (8.) Several int types (which were actually used as enums) are now | |
24 | real enum types (e.g. wxRasterOperationMode, wxMouseButton) and have | |
25 | to be used as such. | |
26 | (9.) Apart from the FD constants (which have been fixed in Olly's | |
27 | patch already) there are some other constants which have received a | |
28 | prefix (e.g. wx* -> wxFONTFAMILY_*, wx* -> wxFONTSTYLE_*, wx* -> | |
29 | wxFONTWEIGHT_*). | |
30 | (10.) Signature changes in constructors of wxFlexGridSizer and wxIcon | |
31 | and wxSizeEvent | |
32 | (11.) Missing includes (missing header files were probably included | |
33 | indirectly in wx2.8 by chance) | |
34 | (12.) When deriving from the abstract class wxGridTableBase, | |
35 | different methods have to be implemented with wx3.0 (EndEdit with new | |
36 | signature and ApplyEdit) than before with wx2.8 (only EndEdit with | |
37 | old signature). Now both versions are implemented in parallel in the | |
38 | classes TimeEditor and ChoiceEditor (one version essentially being a | |
39 | wrapper of the other one). | |
40 | Solved runtime issues: | |
41 | (1.) Segmentation fault: The LadspaEffectDialog receives EVT_TEXT | |
42 | events before it's properly initialized. To prevent this, a | |
43 | workaround was already in place, but was only active on Windows. It | |
44 | looks like this happens now on more platforms (including GTK). As the | |
45 | workaround doesn't do any harm, even if activated unnecessarily, I've | |
46 | simply activated it for all environments. | |
47 | (2.) GTK critical warning "IA__gtk_range_set_range: assertion | |
48 | 'min < max' failed" because of negative numbers as result of window | |
49 | size checking. Added a sanity check that straightens up the numbers | |
50 | in edge cases. | |
51 | (3.) GTK critical warning "IA__gdk_window_get_origin: assertion | |
52 | 'GDK_IS_WINDOW (window)' failed": Received events of type wxSizeEvent | |
53 | on the main project window cause calls to "ClientToScreen" - which is | |
54 | not available until the window is first shown. So the class has to | |
55 | keep track of wxShowEvent events and inhibit those actions until the | |
56 | window is first shown. | |
57 | (4.) The functions wxString::Format and wxString::Printf have become | |
58 | stricter about parameter types that don't match (format string vs. | |
59 | function parameters). So the bugs (that were already present in | |
60 | audacity before) become visible in wx3.0 as error messages. I've | |
61 | fixed all the ones that popped up during my testing, but there might | |
62 | be more of them that I just didn't happen to hit. At some point, all | |
63 | the calls to wxString::Format and wxString::Printf have to be checked | |
64 | systematically. | |
65 | Author: Martin Steghöfer <martin@steghoefer.eu> | |
66 | Bug-Debian: https://bugs.debian.org/749659 | |
67 | ||
68 | --- a/configure.in | |
69 | +++ b/configure.in | |
70 | @@ -186,13 +186,11 @@ | |
71 | [dynamic_loading="$enableval"], | |
72 | [dynamic_loading="yes"]) | |
73 | ||
74 | -dnl AC_ARG_WITH(wx-version, | |
75 | -dnl [AS_HELP_STRING([--with-wx-version], | |
76 | -dnl [select wxWidgets version (if both installed) [2.8,]])], | |
77 | -dnl wx_preference="--version=$withval", | |
78 | -dnl wx_preference="") | |
79 | -dnl At the moment we only support wx2.8. If we start supporting 3.0 when it | |
80 | -dnl comes out, we'll want it back again. | |
81 | +AC_ARG_WITH(wx-version, | |
82 | + [AS_HELP_STRING([--with-wx-version], | |
83 | + [select wxWidgets version (if both installed) [2.8, 3.0]])], | |
84 | + wx_preference="--version=$withval", | |
85 | + wx_preference="") | |
86 | ||
87 | dnl ---------------------------------------------------- | |
88 | dnl If user asked for debug, put debug in compiler flags | |
89 | @@ -291,19 +289,21 @@ | |
90 | wxconfigargs="$static_preference $unicode_preference $wxconfigargs $wx_preference" | |
91 | wx_version=`${WX_CONFIG} $wxconfigargs --version` | |
92 | ||
93 | -AC_MSG_NOTICE([Checking that the chosen version of wxWidgets is 2.8.x]) | |
94 | +AC_MSG_NOTICE([Checking that the chosen version of wxWidgets is 2.8.x or 3.0.x]) | |
95 | ||
96 | case "${wx_version}" in | |
97 | 2.8.*) | |
98 | echo "Great, you're using wxWidgets ${wx_version}!" | |
99 | ;; | |
100 | + 3.0.*) | |
101 | + echo "Great, you're using wxWidgets ${wx_version}!" | |
102 | + ;; | |
103 | *) | |
104 | wx_list=`${WX_CONFIG} --list` | |
105 | - AC_MSG_ERROR([Unable to locate a suitable configuration of wxWidgets v2.8.x or higher. | |
106 | -The currently available configurations are listed below. If necessary, either | |
107 | -install the package for your distribution or download the latest version of | |
108 | -wxWidgets | |
109 | -from http://wxwidgets.org. | |
110 | + AC_MSG_ERROR([Unable to locate a suitable configuration of wxWidgets v2.8.x | |
111 | +or v3.0.x. The currently available configurations are listed below. If | |
112 | +necessary, either install the package for your distribution or download a | |
113 | +suitable version of wxWidgets from http://wxwidgets.org. | |
114 | ${wx_list}]) | |
115 | esac | |
116 | ||
117 | --- a/lib-src/lib-widget-extra/configure.in | |
118 | +++ b/lib-src/lib-widget-extra/configure.in | |
119 | @@ -74,12 +74,11 @@ | |
120 | debug_preference="$enableval", | |
121 | debug_preference="no") | |
122 | ||
123 | -dnl AC_ARG_WITH(wx-version, | |
124 | -dnl [AS_HELP_STRING([--with-wx-version], | |
125 | -dnl [select wxWidgets version (if both installed) [2.8,]])], | |
126 | -dnl wx_preference="--version=$withval", | |
127 | -dnl wx_preference="") | |
128 | -dnl Right now only support wx 2.8 | |
129 | +AC_ARG_WITH(wx-version, | |
130 | + [AS_HELP_STRING([--with-wx-version], | |
131 | + [select wxWidgets version (if both installed) [2.8, 3.0]])], | |
132 | + wx_preference="--version=$withval", | |
133 | + wx_preference="") | |
134 | ||
135 | dnl ---------------------------------------------------- | |
136 | dnl If user asked for debug, put debug in compiler flags | |
137 | @@ -139,19 +138,21 @@ | |
138 | ||
139 | wx_version=`${WX_CONFIG} $wxconfigargs --version` | |
140 | ||
141 | -AC_MSG_NOTICE([Checking that the chosen version of wxWidgets is 2.8.x]) | |
142 | +AC_MSG_NOTICE([Checking that the chosen version of wxWidgets is 2.8.x or 3.0.x]) | |
143 | ||
144 | case "${wx_version}" in | |
145 | 2.8.*) | |
146 | echo "Great, you're using wxWidgets ${wx_version}!" | |
147 | ;; | |
148 | + 3.0.*) | |
149 | + echo "Great, you're using wxWidgets ${wx_version}!" | |
150 | + ;; | |
151 | *) | |
152 | wx_list=`${WX_CONFIG} --list` | |
153 | - AC_MSG_ERROR([Unable to locate a suitable configuration of wxWidgets v2.8.x or higher. | |
154 | -The currently available configurations are listed below. If necessary, either | |
155 | -install the package for your distribution or download the latest version of | |
156 | -wxWidgets | |
157 | -from http://wxwidgets.org. | |
158 | + AC_MSG_ERROR([Unable to locate a suitable configuration of wxWidgets v2.8.x | |
159 | +or v3.0.x. The currently available configurations are listed below. If | |
160 | +necessary, either install the package for your distribution or download a | |
161 | +suitable version of wxWidgets from http://wxwidgets.org. | |
162 | ${wx_list}]) | |
163 | esac | |
164 | ||
165 | --- a/lib-src/FileDialog/configure.ac | |
166 | +++ b/lib-src/FileDialog/configure.ac | |
167 | @@ -47,7 +47,7 @@ | |
168 | ||
169 | AC_ARG_WITH(wx-version, | |
170 | [AC_HELP_STRING([--with-wx-version], | |
171 | - [override default wxWidgets version [2.6,2.8]])], | |
172 | + [override default wxWidgets version [2.8, 3.0]])], | |
173 | wx_preference="--version=$withval", | |
174 | wx_preference="") | |
175 | ||
176 | @@ -64,45 +64,66 @@ | |
177 | fi | |
178 | ||
179 | dnl Gather wx arguments | |
180 | +wxconfigargs="$static_preference $unicode_preference $debug_preference $wx_preference" | |
181 | ||
182 | -CPPFLAGS="$CPPFLAGS `$WX_CONFIG $static_preference $unicode_preference $debug_preference $wx_preference --cxxflags`" | |
183 | +dnl Get wx version | |
184 | +wx_version=`${WX_CONFIG} $wxconfigargs --version` | |
185 | ||
186 | -dnl OS-specific configuration | |
187 | +dnl Get wx flags | |
188 | +CXXFLAGS="$CXXFLAGS `$WX_CONFIG $wxconfigargs --cxxflags`" | |
189 | + | |
190 | +dnl OS- and wx-version-specific configuration | |
191 | ||
192 | AC_CANONICAL_HOST | |
193 | ||
194 | -case "${host_os}" in | |
195 | - darwin*) | |
196 | - dnl Mac OS X configuration | |
197 | - EXTRADEPS="mac/FileDialogPrivate.h" | |
198 | - EXTRAOBJS="mac/FileDialogPrivate.o" | |
199 | - ;; | |
200 | - | |
201 | - cygwin*) | |
202 | - dnl Windows/CygWin configuration | |
203 | - EXTRADEPS="win/FileDialogPrivate.h" | |
204 | - EXTRAOBJS="win/FileDialogPrivate.o" | |
205 | - ;; | |
206 | - | |
207 | - *) | |
208 | - dnl Unix configuration | |
209 | - AM_PATH_GTK_2_0(2.4.0, | |
210 | - have_gtk="yes", | |
211 | - have_gtk="no") | |
212 | - if [[ "$have_gtk" = "yes" ]] | |
213 | - then | |
214 | - CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" | |
215 | - EXTRADEPS="gtk/FileDialogPrivate.h gtk/private.h" | |
216 | - EXTRAOBJS="gtk/FileDialogPrivate.o" | |
217 | - HAVE_GTK=1 | |
218 | - else | |
219 | - EXTRADEPS="generic/FileDialogPrivate.h" | |
220 | - EXTRAOBJS="generic/FileDialogPrivate.o" | |
221 | - HAVE_GTK=0 | |
222 | - fi | |
223 | - ;; | |
224 | +case "${wx_version}" in | |
225 | + 2.8.*) | |
226 | + case "${host_os}" in | |
227 | + darwin*) | |
228 | + dnl Mac OS X configuration | |
229 | + EXTRADEPS="mac/FileDialogPrivate.h" | |
230 | + EXTRAOBJS="mac/FileDialogPrivate.o" | |
231 | + ;; | |
232 | + cygwin*) | |
233 | + dnl Windows/CygWin configuration | |
234 | + EXTRADEPS="win/FileDialogPrivate.h" | |
235 | + EXTRAOBJS="win/FileDialogPrivate.o" | |
236 | + ;; | |
237 | + *) | |
238 | + dnl Unix configuration | |
239 | + AM_PATH_GTK_2_0(2.4.0, | |
240 | + have_gtk="yes", | |
241 | + have_gtk="no") | |
242 | + if [[ "$have_gtk" = "yes" ]] | |
243 | + then | |
244 | + CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" | |
245 | + EXTRADEPS="gtk/FileDialogPrivate.h gtk/private.h" | |
246 | + EXTRAOBJS="gtk/FileDialogPrivate.o" | |
247 | + HAVE_GTK=1 | |
248 | + else | |
249 | + EXTRADEPS="generic/FileDialogPrivate.h" | |
250 | + EXTRAOBJS="generic/FileDialogPrivate.o" | |
251 | + HAVE_GTK=0 | |
252 | + fi | |
253 | + ;; | |
254 | + esac | |
255 | + ;; | |
256 | + 3.0.*) | |
257 | + dnl for wxWidgets >= 3.0 we can compile a generic implementation of our FileDialog | |
258 | + EXTRADEPS="wx30/FileDialogPrivate.h" | |
259 | + EXTRAOBJS="wx30/FileDialogPrivate.o" | |
260 | + HAVE_GTK=0 dnl no need for extra GTK flags, we don't use it directly, we use wx interfaces | |
261 | + ;; | |
262 | + *) | |
263 | + wx_list=`${WX_CONFIG} --list` | |
264 | + AC_MSG_ERROR([Unable to locate a suitable configuration of wxWidgets v2.8.x | |
265 | +or v3.0.x. The currently available configurations are listed below. If | |
266 | +necessary, either install the package for your distribution or download a | |
267 | +suitable version of wxWidgets from http://wxwidgets.org. | |
268 | +${wx_list}]) | |
269 | esac | |
270 | ||
271 | + | |
272 | # | |
273 | # Write it all out | |
274 | # | |
275 | --- a/lib-src/FileDialog/FileDialog.h | |
276 | +++ b/lib-src/FileDialog/FileDialog.h | |
277 | @@ -26,14 +26,18 @@ | |
278 | ||
279 | typedef void (*fdCallback)(void *, int); | |
280 | ||
281 | -#if defined(__WXMAC__) | |
282 | -#include "mac/FileDialogPrivate.h" | |
283 | -#elif defined(__WXMSW__) | |
284 | -#include "win/FileDialogPrivate.h" | |
285 | -#elif defined(__WXGTK__) && defined(HAVE_GTK) | |
286 | -#include "gtk/FileDialogPrivate.h" | |
287 | -#else | |
288 | -#include "generic/FileDialogPrivate.h" | |
289 | +#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION == 8 // wx2.8 | |
290 | +# if defined(__WXMAC__) | |
291 | +# include "mac/FileDialogPrivate.h" | |
292 | +# elif defined(__WXMSW__) | |
293 | +# include "win/FileDialogPrivate.h" | |
294 | +# elif defined(__WXGTK__) && defined(HAVE_GTK) | |
295 | +# include "gtk/FileDialogPrivate.h" | |
296 | +# else | |
297 | +# include "generic/FileDialogPrivate.h" | |
298 | +# endif | |
299 | +#else // wx3.0 | |
300 | +# include "wx30/FileDialogPrivate.h" | |
301 | #endif | |
302 | ||
303 | ///////////////////////////////////////////////////////////////////////////// | |
304 | @@ -55,11 +59,11 @@ | |
305 | //---------------------------------------------------------------------------- | |
306 | ||
307 | wxString | |
308 | -FileSelector(const wxChar *message = wxFileSelectorPromptStr, | |
309 | +FileSelector(const wxChar *message = wxString(wxFileSelectorPromptStr, wxConvUTF8).wc_str(), | |
310 | const wxChar *default_path = NULL, | |
311 | const wxChar *default_filename = NULL, | |
312 | const wxChar *default_extension = NULL, | |
313 | - const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, | |
314 | + const wxChar *wildcard = wxString(wxFileSelectorDefaultWildcardStr, wxConvUTF8).wc_str(), | |
315 | int flags = 0, | |
316 | wxWindow *parent = NULL, | |
317 | wxString label = wxEmptyString, | |
318 | --- /dev/null | |
319 | +++ b/lib-src/FileDialog/wx30/FileDialogPrivate.cpp | |
320 | @@ -0,0 +1,61 @@ | |
321 | +#include <wx/wxprec.h> | |
322 | +#ifndef WX_PRECOMP | |
323 | +# include <wx/wx.h> | |
324 | +#endif | |
325 | + | |
326 | +#include "../FileDialog.h" | |
327 | + | |
328 | +#include <cassert> | |
329 | + | |
330 | +#include "wx/event.h" | |
331 | +#include "wx/filedlg.h" | |
332 | +#include "wx/window.h" | |
333 | + | |
334 | + | |
335 | +FileDialog::FileDialog(wxWindow *parent, | |
336 | + const wxString& message, | |
337 | + const wxString& defaultDir, | |
338 | + const wxString& defaultFile, | |
339 | + const wxString& wildCard, | |
340 | + long style, | |
341 | + const wxPoint& pos, | |
342 | + const wxSize& sz, | |
343 | + const wxString& name) | |
344 | +: wxFileDialog(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name) | |
345 | +{ | |
346 | +} | |
347 | + | |
348 | + | |
349 | +FileDialog::~FileDialog() | |
350 | +{ | |
351 | + // intentionally left blank; it's just there to make sure | |
352 | + // we have a virtual destructor (in case of subclassing) | |
353 | +} | |
354 | + | |
355 | + | |
356 | +int FileDialog::ShowModal() | |
357 | +{ | |
358 | + assert (SupportsExtraControl()); | |
359 | + | |
360 | + if (!m_buttonlabel.IsEmpty()) { | |
361 | + SetExtraControlCreator(&FileDialog::CreateButton); | |
362 | + } | |
363 | + | |
364 | + return wxFileDialog::ShowModal(); | |
365 | +} | |
366 | + | |
367 | + | |
368 | +wxWindow * FileDialog::CreateButton(wxWindow *fileDialogGeneric) | |
369 | +{ | |
370 | + FileDialog *fileDialog = (FileDialog *) fileDialogGeneric; | |
371 | + wxButton *button = new wxButton(fileDialog, wxID_ANY, fileDialog->m_buttonlabel); | |
372 | + fileDialog->Bind(wxEVT_BUTTON, &FileDialog::OnButton, fileDialog, button->GetId()); | |
373 | + return button; | |
374 | +} | |
375 | + | |
376 | +void FileDialog::OnButton(wxCommandEvent& WXUNUSED(event)) | |
377 | +{ | |
378 | + ClickButton(GetFilterIndex()); | |
379 | +} | |
380 | + | |
381 | + | |
382 | --- /dev/null | |
383 | +++ b/lib-src/FileDialog/wx30/FileDialogPrivate.h | |
384 | @@ -0,0 +1,47 @@ | |
385 | +#ifndef __FILEDIALOGWX30H__ | |
386 | +#define __FILEDIALOGWX30H__ | |
387 | + | |
388 | + | |
389 | +#include "wx/filedlg.h" | |
390 | + | |
391 | + | |
392 | +class FileDialog : public wxFileDialog | |
393 | +{ | |
394 | +public: // constructors/destructors | |
395 | + FileDialog() { } | |
396 | + | |
397 | + FileDialog(wxWindow *parent, | |
398 | + const wxString& message = wxFileSelectorPromptStr, | |
399 | + const wxString& defaultDir = wxEmptyString, | |
400 | + const wxString& defaultFile = wxEmptyString, | |
401 | + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, | |
402 | + long style = wxFD_DEFAULT_STYLE, | |
403 | + const wxPoint& pos = wxDefaultPosition, | |
404 | + const wxSize& sz = wxDefaultSize, | |
405 | + const wxString& name = wxFileDialogNameStr); | |
406 | + | |
407 | + virtual ~FileDialog(); | |
408 | + | |
409 | +public: // public methods | |
410 | + virtual void EnableButton(wxString label, fdCallback cb, void *cbdata); | |
411 | + | |
412 | + virtual void ClickButton(int index); | |
413 | + | |
414 | + virtual int ShowModal(); | |
415 | + | |
416 | + void OnButton(wxCommandEvent& event); | |
417 | + | |
418 | +private: // private methods | |
419 | + static wxWindow * CreateButton(wxWindow *fileDialog); | |
420 | + | |
421 | +private: // attributes | |
422 | + wxString m_buttonlabel; | |
423 | + | |
424 | + fdCallback m_callback; | |
425 | + | |
426 | + void *m_cbdata; | |
427 | +}; | |
428 | + | |
429 | + | |
430 | +#endif | |
431 | + | |
432 | --- a/src/AudacityApp.cpp | |
433 | +++ b/src/AudacityApp.cpp | |
434 | @@ -1324,7 +1324,7 @@ | |
435 | } | |
436 | ||
437 | if (option < argc - 1 && | |
438 | - argv[option + 1] && | |
439 | + !wxString(argv[option + 1]).IsEmpty() && // *argv is of type wxChar* in wx28 and wxString in wx30 | |
440 | !wxString(wxT("-blocksize")).CmpNoCase(argv[option])) { | |
441 | long theBlockSize; | |
442 | if (wxString(argv[option + 1]).ToLong(&theBlockSize)) { | |
443 | --- a/src/AudioIO.cpp | |
444 | +++ b/src/AudioIO.cpp | |
445 | @@ -561,7 +561,7 @@ | |
446 | wxString errStr = _("Could not find any audio devices.\n"); | |
447 | errStr += _("You will not be able to play or record audio.\n\n"); | |
448 | wxString paErrStr = LAT1CTOWX(Pa_GetErrorText(err)); | |
449 | - if (paErrStr) | |
450 | + if (!paErrStr.IsEmpty()) | |
451 | errStr += _("Error: ")+paErrStr; | |
452 | // XXX: we are in libaudacity, popping up dialogs not allowed! A | |
453 | // long-term solution will probably involve exceptions | |
454 | --- a/src/CaptureEvents.cpp | |
455 | +++ b/src/CaptureEvents.cpp | |
456 | @@ -17,7 +17,7 @@ | |
457 | #include "Audacity.h" | |
458 | #include "CaptureEvents.h" | |
459 | ||
460 | -#if defined(__WXGTK__) && defined(HAVE_GTK) | |
461 | +#if defined(__WXGTK__) && defined(HAVE_GTK) && wxMAJOR_VERSION < 3 | |
462 | // As of wxGTK 2.8.9, there is a problem in the wxClipboard class that | |
463 | // allows recursive event processing. This problem has been corrected | |
464 | // by wxWidgets 2.9+. However, this han't made it into a release yet, | |
465 | --- a/src/LyricsWindow.cpp | |
466 | +++ b/src/LyricsWindow.cpp | |
467 | @@ -68,9 +68,9 @@ | |
468 | // loads either the XPM or the windows resource, depending on the platform | |
469 | #if !defined(__WXMAC__) && !defined(__WXX11__) | |
470 | #ifdef __WXMSW__ | |
471 | - wxIcon ic(wxICON(AudacityLogo)); | |
472 | + wxIcon ic = wxICON(AudacityLogo); | |
473 | #else | |
474 | - wxIcon ic(wxICON(AudacityLogo48x48)); | |
475 | + wxIcon ic = wxICON(AudacityLogo48x48); | |
476 | #endif | |
477 | SetIcon(ic); | |
478 | #endif | |
479 | --- a/src/Menus.cpp | |
480 | +++ b/src/Menus.cpp | |
481 | @@ -2403,7 +2403,7 @@ | |
482 | // The workaround is to queue a context menu event, allowing the key press | |
483 | // event to complete. | |
484 | wxContextMenuEvent e(wxEVT_CONTEXT_MENU, GetId()); | |
485 | - mTrackPanel->AddPendingEvent(e); | |
486 | + mTrackPanel->GetEventHandler()->AddPendingEvent(e); | |
487 | } | |
488 | ||
489 | void AudacityProject::OnTrackMute() | |
490 | --- a/src/MixerBoard.cpp | |
491 | +++ b/src/MixerBoard.cpp | |
492 | @@ -1723,9 +1723,9 @@ | |
493 | // loads either the XPM or the windows resource, depending on the platform | |
494 | #if !defined(__WXMAC__) && !defined(__WXX11__) | |
495 | #ifdef __WXMSW__ | |
496 | - wxIcon ic(wxICON(AudacityLogo)); | |
497 | + wxIcon ic = wxICON(AudacityLogo); | |
498 | #else | |
499 | - wxIcon ic(wxICON(AudacityLogo48x48)); | |
500 | + wxIcon ic = wxICON(AudacityLogo48x48); | |
501 | #endif | |
502 | SetIcon(ic); | |
503 | #endif | |
504 | --- a/src/PitchName.cpp | |
505 | +++ b/src/PitchName.cpp | |
506 | @@ -20,6 +20,10 @@ | |
507 | #include <math.h> | |
508 | #include <stdio.h> | |
509 | ||
510 | +#ifndef WX_PRECOMP | |
511 | +# include "wx/wx.h" | |
512 | +#endif | |
513 | + | |
514 | #include "PitchName.h" | |
515 | ||
516 | ||
517 | --- a/src/PlatformCompatibility.cpp | |
518 | +++ b/src/PlatformCompatibility.cpp | |
519 | @@ -20,6 +20,7 @@ | |
520 | #include <wx/filename.h> | |
521 | #include <wx/stdpaths.h> | |
522 | #include <wx/app.h> | |
523 | +#include <wx/version.h> | |
524 | ||
525 | #include "AudacityApp.h" | |
526 | #include "PlatformCompatibility.h" | |
527 | @@ -37,7 +38,11 @@ | |
528 | static wxString path; | |
529 | ||
530 | if (!found) { | |
531 | +#if wxMAJOR_VERSION < 3 | |
532 | wxStandardPaths std; | |
533 | +#else | |
534 | + wxStandardPaths std(wxStandardPaths::Get()); | |
535 | +#endif | |
536 | ||
537 | path = std.GetExecutablePath(); | |
538 | ||
539 | @@ -65,4 +70,4 @@ | |
540 | #else | |
541 | return filePath; | |
542 | #endif | |
543 | -} | |
544 | \ No newline at end of file | |
545 | +} | |
546 | --- a/src/Profiler.cpp | |
547 | +++ b/src/Profiler.cpp | |
548 | @@ -22,6 +22,9 @@ | |
549 | ||
550 | #include "Profiler.h" | |
551 | ||
552 | +#include <cstdio> | |
553 | +#include <cstring> | |
554 | + | |
555 | ///write to a profile at the end of the test. | |
556 | Profiler::~Profiler() | |
557 | { | |
558 | @@ -165,4 +168,3 @@ | |
559 | else | |
560 | return 0.0; | |
561 | } | |
562 | - | |
563 | \ No newline at end of file | |
564 | --- a/src/Project.cpp | |
565 | +++ b/src/Project.cpp | |
566 | @@ -79,7 +79,6 @@ | |
567 | #include <wx/string.h> | |
568 | #include <wx/textfile.h> | |
569 | #include <wx/timer.h> | |
570 | -#include <wx/generic/filedlgg.h> | |
571 | #include <wx/display.h> | |
572 | ||
573 | #include <wx/arrimpl.cpp> // this allows for creation of wxObjArray | |
574 | @@ -702,6 +701,7 @@ | |
575 | EVT_MOUSE_EVENTS(AudacityProject::OnMouseEvent) | |
576 | EVT_CLOSE(AudacityProject::OnCloseWindow) | |
577 | EVT_SIZE(AudacityProject::OnSize) | |
578 | + EVT_SHOW(AudacityProject::OnShow) | |
579 | EVT_MOVE(AudacityProject::OnMove) | |
580 | EVT_ACTIVATE(AudacityProject::OnActivate) | |
581 | EVT_COMMAND_SCROLL_LINEUP(HSBarID, AudacityProject::OnScrollLeftButton) | |
582 | @@ -758,7 +758,8 @@ | |
583 | mLastEffect(NULL), | |
584 | mLastEffectType(0), | |
585 | mTimerRecordCanceled(false), | |
586 | - mMenuClose(false) | |
587 | + mMenuClose(false), | |
588 | + mShownOnce(false) | |
589 | { | |
590 | int widths[] = {-2, -1}; | |
591 | mStatusBar = CreateStatusBar(2); | |
592 | @@ -981,9 +982,9 @@ | |
593 | // loads either the XPM or the windows resource, depending on the platform | |
594 | #if !defined(__WXMAC__) && !defined(__WXX11__) | |
595 | #if defined(__WXMSW__) | |
596 | - wxIcon ic(wxICON(AudacityLogo)); | |
597 | + wxIcon ic = wxICON(AudacityLogo); | |
598 | #elif defined(__WXGTK__) | |
599 | - wxIcon ic(wxICON(AudacityLogoAlpha)); | |
600 | + wxIcon ic = wxICON(AudacityLogoAlpha); | |
601 | #else | |
602 | wxIcon ic; | |
603 | ic.CopyFromBitmap(theTheme.Bitmap(bmpAudacityLogo48x48)); | |
604 | @@ -1350,6 +1351,12 @@ | |
605 | ||
606 | int panelWidth, panelHeight; | |
607 | mTrackPanel->GetTracksUsableArea(&panelWidth, &panelHeight); | |
608 | + if (panelWidth < 0) { | |
609 | + panelWidth = 0; | |
610 | + } | |
611 | + if (panelHeight < 0) { | |
612 | + panelHeight = 0; | |
613 | + } | |
614 | ||
615 | // Add 1/4 of a screen of blank space to the end of the longest track | |
616 | mViewInfo.screen = ((double) panelWidth) / mViewInfo.zoom; | |
617 | @@ -1561,9 +1568,26 @@ | |
618 | ||
619 | void AudacityProject::OnSize(wxSizeEvent & event) | |
620 | { | |
621 | - HandleResize(); | |
622 | - if (!this->IsMaximized() && !this->IsIconized()) | |
623 | - SetNormalizedWindowState(this->GetRect()); | |
624 | + if (mShownOnce) { | |
625 | + HandleResize(); | |
626 | + if (!this->IsMaximized() && !this->IsIconized()) | |
627 | + SetNormalizedWindowState(this->GetRect()); | |
628 | + } | |
629 | + event.Skip(); | |
630 | +} | |
631 | + | |
632 | +void AudacityProject::OnShow(wxShowEvent & event) | |
633 | +{ | |
634 | + // Remember that the window has been shown at least once | |
635 | + mShownOnce = true; | |
636 | + | |
637 | + // Call "OnSize" again (the previous calls to "OnSize" might not | |
638 | + // have succeeded because some methods are not available before | |
639 | + // the actual creation/showing of the window) | |
640 | + wxSizeEvent sizeEvent(GetSize()); | |
641 | + OnSize(sizeEvent); | |
642 | + | |
643 | + // Further processing by default handlers | |
644 | event.Skip(); | |
645 | } | |
646 | ||
647 | @@ -1675,7 +1699,7 @@ | |
648 | wxCommandEvent e(EVT_CAPTURE_KEY); | |
649 | e.SetEventObject(&event); | |
650 | ||
651 | - if (w->ProcessEvent(e)) { | |
652 | + if (w->GetEventHandler()->ProcessEvent(e)) { | |
653 | return false; | |
654 | } | |
655 | } | |
656 | --- a/src/Sequence.cpp | |
657 | +++ b/src/Sequence.cpp | |
658 | @@ -1035,7 +1035,7 @@ | |
659 | Internat::ToString(((wxLongLong)(bb->f->GetLength())).ToDouble(), 0).c_str(), | |
660 | Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str()); | |
661 | ::wxMessageBox(sMsg, _("Warning - Length in Writing Sequence"), wxICON_EXCLAMATION | wxOK); | |
662 | - ::wxLogWarning(sMsg); | |
663 | + wxLogWarning(sMsg); | |
664 | bb->f->SetLength(mMaxSamples); | |
665 | } | |
666 | ||
667 | --- a/src/Tags.cpp | |
668 | +++ b/src/Tags.cpp | |
669 | @@ -482,7 +482,7 @@ | |
670 | ||
671 | while (*attrs) { | |
672 | wxString attr = *attrs++; | |
673 | - if (!*attr) | |
674 | + if (attr.IsEmpty()) | |
675 | break; | |
676 | wxString value = *attrs++; | |
677 | ||
678 | --- a/src/TrackPanel.cpp | |
679 | +++ b/src/TrackPanel.cpp | |
680 | @@ -5097,7 +5097,7 @@ | |
681 | // The activate event is used to make the | |
682 | // parent window 'come alive' if it didn't have focus. | |
683 | wxActivateEvent e; | |
684 | - GetParent()->ProcessEvent(e); | |
685 | + GetParent()->GetEventHandler()->ProcessEvent(e); | |
686 | ||
687 | // wxTimers seem to be a little unreliable, so this | |
688 | // "primes" it to make sure it keeps going for a while... | |
689 | @@ -5534,7 +5534,7 @@ | |
690 | int trackKind = pTrack->GetKind(); | |
691 | currentTool = selectTool; // the default. | |
692 | ||
693 | - if( event.ButtonIsDown(3) || event.RightUp()){ | |
694 | + if( event.ButtonIsDown(wxMOUSE_BTN_RIGHT) || event.RightUp()){ | |
695 | currentTool = zoomTool; | |
696 | } else if( trackKind == Track::Time ){ | |
697 | currentTool = envelopeTool; | |
698 | @@ -8251,7 +8251,7 @@ | |
699 | mSliderOffset = 0; | |
700 | ||
701 | int fontSize = 10; | |
702 | - mFont.Create(fontSize, wxSWISS, wxNORMAL, wxNORMAL); | |
703 | + mFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); | |
704 | ||
705 | int allowableWidth = GetTrackInfoWidth() - 2; // 2 to allow for left/right borders | |
706 | int textWidth, textHeight; | |
707 | --- a/src/CaptureEvents.h | |
708 | +++ b/src/CaptureEvents.h | |
709 | @@ -17,7 +17,7 @@ | |
710 | #ifndef _AUDACITY_CAPTURE_EVENTS_ | |
711 | #define _AUDACITY_CAPTURE_EVENTS_ | |
712 | ||
713 | -#if defined(__WXGTK__) && defined(HAVE_GTK) | |
714 | +#if defined(__WXGTK__) && defined(HAVE_GTK) && wxMAJOR_VERSION < 3 | |
715 | // As of wxGTK 2.8.9, there is a problem in the wxClipboard class that | |
716 | // allows recursive event processing. This problem has been corrected | |
717 | // by wxWidgets 2.9+. However, this han't made it into a release yet, | |
718 | --- a/src/LabelTrack.cpp | |
719 | +++ b/src/LabelTrack.cpp | |
720 | @@ -957,7 +957,7 @@ | |
721 | ||
722 | // copy data onto clipboard | |
723 | if (wxTheClipboard->Open()) { | |
724 | -#if defined(__WXGTK__) && defined(HAVE_GTK) | |
725 | +#if defined(__WXGTK__) && defined(HAVE_GTK) && wxMAJOR_VERSION < 3 | |
726 | CaptureEvents capture; | |
727 | #endif | |
728 | wxTheClipboard->SetData(new wxTextDataObject(data)); | |
729 | @@ -992,7 +992,7 @@ | |
730 | ||
731 | // copy the data on clipboard | |
732 | if (wxTheClipboard->Open()) { | |
733 | -#if defined(__WXGTK__) && defined(HAVE_GTK) | |
734 | +#if defined(__WXGTK__) && defined(HAVE_GTK) && wxMAJOR_VERSION < 3 | |
735 | CaptureEvents capture; | |
736 | #endif | |
737 | wxTheClipboard->SetData(new wxTextDataObject(data)); | |
738 | @@ -1017,7 +1017,7 @@ | |
739 | // if text data is available | |
740 | if (IsTextClipSupported()) { | |
741 | if (wxTheClipboard->Open()) { | |
742 | -#if defined(__WXGTK__) && HAVE_GTK | |
743 | +#if defined(__WXGTK__) && HAVE_GTK && wxMAJOR_VERSION < 3 | |
744 | CaptureEvents capture; | |
745 | #endif | |
746 | wxTextDataObject data; | |
747 | @@ -1074,7 +1074,7 @@ | |
748 | /// @return true if the text data is available in the clipboard, false otherwise | |
749 | bool LabelTrack::IsTextClipSupported() | |
750 | { | |
751 | -#if defined(__WXGTK__) && defined(HAVE_GTK) | |
752 | +#if defined(__WXGTK__) && defined(HAVE_GTK) && wxMAJOR_VERSION < 3 | |
753 | CaptureEvents capture; | |
754 | #endif | |
755 | ||
756 | --- a/src/UploadDialog.cpp | |
757 | +++ b/src/UploadDialog.cpp | |
758 | @@ -113,12 +113,12 @@ | |
759 | icons->Add(*mp3Icon); | |
760 | icons->Add(*upIcon); | |
761 | ||
762 | - wxFlexGridSizer *topSizer = new wxFlexGridSizer(2, 1); | |
763 | + wxFlexGridSizer *topSizer = new wxFlexGridSizer(2, 1, 0); | |
764 | wxStaticBoxSizer *connectionBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("FTP Connection"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL); | |
765 | wxStaticBoxSizer *fileBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("File Manager"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL); | |
766 | wxStaticBoxSizer *siteBox = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("Site Manager"), wxDefaultPosition, wxDefaultSize, 0, wxT("")), wxVERTICAL); | |
767 | ||
768 | - wxFlexGridSizer *connectionSizer = new wxFlexGridSizer(2, 4); | |
769 | + wxFlexGridSizer *connectionSizer = new wxFlexGridSizer(2, 4, 0); | |
770 | wxBoxSizer *leftSizer = new wxBoxSizer(wxVERTICAL); | |
771 | wxBoxSizer *rightSizer = new wxBoxSizer(wxVERTICAL); | |
772 | wxBoxSizer *fileButtonSizer = new wxBoxSizer(wxHORIZONTAL); | |
773 | --- a/src/commands/ScriptCommandRelay.cpp | |
774 | +++ b/src/commands/ScriptCommandRelay.cpp | |
775 | @@ -57,7 +57,7 @@ | |
776 | wxASSERT(cmd != NULL); | |
777 | AppCommandEvent ev; | |
778 | ev.SetCommand(cmd); | |
779 | - project->AddPendingEvent(ev); | |
780 | + project->GetEventHandler()->AddPendingEvent(ev); | |
781 | } | |
782 | ||
783 | /// This is the function which actually obeys one command. Rather than applying | |
784 | --- a/src/effects/BassTreble.cpp | |
785 | +++ b/src/effects/BassTreble.cpp | |
786 | @@ -35,6 +35,7 @@ | |
787 | #include <wx/checkbox.h> | |
788 | #include <wx/slider.h> | |
789 | #include <wx/sizer.h> | |
790 | +#include <wx/textctrl.h> | |
791 | ||
792 | // Used to communicate the type of the filter. | |
793 | static const int bassType = 0; //Low Shelf | |
794 | --- a/src/effects/Compressor.cpp | |
795 | +++ b/src/effects/Compressor.cpp | |
796 | @@ -38,6 +38,7 @@ | |
797 | #include <wx/textdlg.h> | |
798 | #include <wx/brush.h> | |
799 | #include <wx/image.h> | |
800 | +#include <wx/dcclient.h> | |
801 | #include <wx/dcmemory.h> | |
802 | ||
803 | #include "Compressor.h" | |
804 | --- a/src/effects/nyquist/Nyquist.cpp | |
805 | +++ b/src/effects/nyquist/Nyquist.cpp | |
806 | @@ -701,7 +701,7 @@ | |
807 | // See also http://bugzilla.audacityteam.org/show_bug.cgi?id=642#c9 | |
808 | // for further info about this thread safety question. | |
809 | wxString prevlocale = wxSetlocale(LC_NUMERIC, NULL); | |
810 | - wxSetlocale(LC_NUMERIC, wxT("C")); | |
811 | + wxSetlocale(LC_NUMERIC, wxString(wxT("C"))); | |
812 | ||
813 | nyx_init(); | |
814 | nyx_set_os_callback(StaticOSCallback, (void *)this); | |
815 | --- a/src/import/ImportRaw.cpp | |
816 | +++ b/src/import/ImportRaw.cpp | |
817 | @@ -324,7 +324,7 @@ | |
818 | ||
819 | if (sf_format_check(&info)) { | |
820 | mEncodingSubtype[mNumEncodings] = subtype; | |
821 | - encodings.Add(LAT1CTOWX(sf_encoding_index_name(i))); | |
822 | + encodings.Add(sf_encoding_index_name(i)); | |
823 | ||
824 | if ((mEncoding & SF_FORMAT_SUBMASK) == subtype) | |
825 | selection = mNumEncodings; | |
826 | --- a/src/ondemand/ODManager.cpp | |
827 | +++ b/src/ondemand/ODManager.cpp | |
828 | @@ -311,7 +311,7 @@ | |
829 | AudacityProject::AllProjectsDeleteLock(); | |
830 | AudacityProject* proj = GetActiveProject(); | |
831 | if(proj) | |
832 | - proj->AddPendingEvent( event ); | |
833 | + proj->GetEventHandler()->AddPendingEvent( event ); | |
834 | AudacityProject::AllProjectsDeleteUnlock(); | |
835 | } | |
836 | mTerminateMutex.Lock(); | |
837 | --- a/src/ondemand/ODTask.cpp | |
838 | +++ b/src/ondemand/ODTask.cpp | |
839 | @@ -158,7 +158,7 @@ | |
840 | if(IsTaskAssociatedWithProject(gAudacityProjects[i])) | |
841 | { | |
842 | //this assumes tasks are only associated with one project. | |
843 | - gAudacityProjects[i]->AddPendingEvent( event ); | |
844 | + gAudacityProjects[i]->GetEventHandler()->AddPendingEvent( event ); | |
845 | //mark the changes so that the project can be resaved. | |
846 | gAudacityProjects[i]->GetUndoManager()->SetODChangesFlag(); | |
847 | break; | |
848 | --- a/src/prefs/KeyConfigPrefs.cpp | |
849 | +++ b/src/prefs/KeyConfigPrefs.cpp | |
850 | @@ -992,7 +992,7 @@ | |
851 | nevent.SetDirection(!e.ShiftDown()); | |
852 | nevent.SetEventObject(t); | |
853 | nevent.SetCurrentFocus(t); | |
854 | - t->GetParent()->ProcessEvent(nevent); | |
855 | + t->GetParent()->GetEventHandler()->ProcessEvent(nevent); | |
856 | ||
857 | return; | |
858 | } | |
859 | --- a/src/toolbars/DeviceToolBar.cpp | |
860 | +++ b/src/toolbars/DeviceToolBar.cpp | |
861 | @@ -71,9 +71,7 @@ | |
862 | { | |
863 | ToolBar::Create(parent); | |
864 | ||
865 | - // Simulate a size event to set initial meter placement/size | |
866 | - wxSizeEvent dummy; | |
867 | - OnSize(dummy); | |
868 | + Layout(); | |
869 | } | |
870 | ||
871 | void DeviceToolBar::RecreateTipWindows() | |
872 | @@ -618,7 +616,7 @@ | |
873 | name = _("2 (Stereo) Input Channels"); | |
874 | } | |
875 | else { | |
876 | - name = wxString::Format(wxT("%d"), j + 1); | |
877 | + name = wxString::Format(wxT("%lld"), j + 1); | |
878 | } | |
879 | mInputChannels->Append(name); | |
880 | } | |
881 | --- a/src/toolbars/ToolsToolBar.cpp | |
882 | +++ b/src/toolbars/ToolsToolBar.cpp | |
883 | @@ -59,7 +59,7 @@ | |
884 | ||
885 | // Strings to convert a tool number into a status message | |
886 | // These MUST be in the same order as the ids above. | |
887 | -static const wxChar * MessageOfTool[numTools] = { | |
888 | +static const wxString MessageOfTool[numTools] = { | |
889 | wxTRANSLATE("Click and drag to select audio"), | |
890 | wxTRANSLATE("Click and drag to edit the amplitude envelope"), | |
891 | wxTRANSLATE("Click and drag to edit the samples"), | |
892 | --- a/src/widgets/ASlider.cpp | |
893 | +++ b/src/widgets/ASlider.cpp | |
894 | @@ -1191,7 +1191,7 @@ | |
895 | nevent.SetDirection( !event.ShiftDown() ); | |
896 | nevent.SetEventObject( mParent ); | |
897 | nevent.SetCurrentFocus( mParent ); | |
898 | - mParent->GetParent()->ProcessEvent( nevent ); | |
899 | + mParent->GetParent()->GetEventHandler()->ProcessEvent( nevent ); | |
900 | } | |
901 | break; | |
902 | ||
903 | @@ -1203,7 +1203,7 @@ | |
904 | if (def && def->IsEnabled()) { | |
905 | wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED, | |
906 | def->GetId()); | |
907 | - mParent->ProcessEvent(cevent); | |
908 | + mParent->GetEventHandler()->ProcessEvent(cevent); | |
909 | } | |
910 | } | |
911 | ||
912 | @@ -1228,7 +1228,7 @@ | |
913 | int intValue = (int)( ( mCurrentValue - mMinValue ) * 1000.0f / | |
914 | ( mMaxValue - mMinValue ) ); | |
915 | e.SetInt( intValue ); | |
916 | - mParent->ProcessEvent( e ); | |
917 | + mParent->GetEventHandler()->ProcessEvent( e ); | |
918 | } | |
919 | ||
920 | int LWSlider::ValueToPosition(float val) | |
921 | --- a/src/widgets/ExpandingToolBar.cpp | |
922 | +++ b/src/widgets/ExpandingToolBar.cpp | |
923 | @@ -72,6 +72,7 @@ | |
924 | #include <wx/window.h> | |
925 | #endif | |
926 | ||
927 | +#include <wx/dcclient.h> | |
928 | #include <wx/dcmemory.h> | |
929 | #include <wx/log.h> | |
930 | #include <wx/dragimag.h> | |
931 | --- a/src/widgets/Grabber.cpp | |
932 | +++ b/src/widgets/Grabber.cpp | |
933 | @@ -89,7 +89,7 @@ | |
934 | e.SetEventObject(parent); | |
935 | ||
936 | // Queue the event | |
937 | - parent->AddPendingEvent(e); | |
938 | + parent->GetEventHandler()->AddPendingEvent(e); | |
939 | } | |
940 | ||
941 | // | |
942 | --- a/src/widgets/Grid.cpp | |
943 | +++ b/src/widgets/Grid.cpp | |
944 | @@ -77,7 +77,8 @@ | |
945 | { | |
946 | wxGridTableBase *table = grid->GetTable(); | |
947 | ||
948 | - table->GetValue(row, col).ToDouble(&mOld); | |
949 | + mOldString = table->GetValue(row, col); | |
950 | + mOldString.ToDouble(&mOld); | |
951 | ||
952 | GetTimeCtrl()->SetTimeValue(mOld); | |
953 | GetTimeCtrl()->EnableMenu(); | |
954 | @@ -87,16 +88,32 @@ | |
955 | ||
956 | bool TimeEditor::EndEdit(int row, int col, wxGrid *grid) | |
957 | { | |
958 | + wxString newvalue; | |
959 | + bool changed = EndEdit(row, col, grid, mOldString, &newvalue); | |
960 | + if (changed) { | |
961 | + ApplyEdit(row, col, grid); | |
962 | + } | |
963 | + return changed; | |
964 | +} | |
965 | + | |
966 | +bool TimeEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) | |
967 | +{ | |
968 | double newtime = GetTimeCtrl()->GetTimeValue(); | |
969 | bool changed = newtime != mOld; | |
970 | ||
971 | if (changed) { | |
972 | - grid->GetTable()->SetValue(row, col, wxString::Format(wxT("%g"), newtime)); | |
973 | + mValueAsString = wxString::Format(wxT("%g"), newtime); | |
974 | + *newval = mValueAsString; | |
975 | } | |
976 | ||
977 | return changed; | |
978 | } | |
979 | ||
980 | +void TimeEditor::ApplyEdit(int row, int col, wxGrid *grid) | |
981 | +{ | |
982 | + grid->GetTable()->SetValue(row, col, mValueAsString); | |
983 | +} | |
984 | + | |
985 | void TimeEditor::Reset() | |
986 | { | |
987 | GetTimeCtrl()->SetTimeValue(mOld); | |
988 | @@ -303,8 +320,19 @@ | |
989 | Choice()->SetFocus(); | |
990 | } | |
991 | ||
992 | +bool ChoiceEditor::EndEdit(int row, int col, wxGrid *grid) | |
993 | +{ | |
994 | + wxString newvalue; | |
995 | + bool changed = EndEdit(row, col, grid, mOld, &newvalue); | |
996 | + if (changed) { | |
997 | + ApplyEdit(row, col, grid); | |
998 | + } | |
999 | + return changed; | |
1000 | +} | |
1001 | + | |
1002 | bool ChoiceEditor::EndEdit(int row, int col, | |
1003 | - wxGrid* grid) | |
1004 | + const wxGrid* grid, | |
1005 | + const wxString &oldval, wxString *newval) | |
1006 | { | |
1007 | int sel = Choice()->GetSelection(); | |
1008 | ||
1009 | @@ -315,12 +343,20 @@ | |
1010 | } | |
1011 | ||
1012 | wxString val = mChoices[sel]; | |
1013 | - if (val == mOld) | |
1014 | - return false; | |
1015 | + bool changed = val != mOld; | |
1016 | + | |
1017 | + if (changed) | |
1018 | + { | |
1019 | + mValueAsString = val; | |
1020 | + *newval = val; | |
1021 | + } | |
1022 | ||
1023 | - grid->GetTable()->SetValue(row, col, val); | |
1024 | + return changed; | |
1025 | +} | |
1026 | ||
1027 | - return true; | |
1028 | +void ChoiceEditor::ApplyEdit(int row, int col, wxGrid *grid) | |
1029 | +{ | |
1030 | + grid->GetTable()->SetValue(row, col, mValueAsString); | |
1031 | } | |
1032 | ||
1033 | void ChoiceEditor::Reset() | |
1034 | @@ -499,7 +535,7 @@ | |
1035 | if (def && def->IsEnabled()) { | |
1036 | wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED, | |
1037 | def->GetId()); | |
1038 | - GetParent()->ProcessEvent(cevent); | |
1039 | + GetParent()->GetEventHandler()->ProcessEvent(cevent); | |
1040 | } | |
1041 | } | |
1042 | else { | |
1043 | --- a/src/widgets/Grid.h | |
1044 | +++ b/src/widgets/Grid.h | |
1045 | @@ -52,8 +52,13 @@ | |
1046 | void SetSize(const wxRect &rect); | |
1047 | ||
1048 | void BeginEdit(int row, int col, wxGrid *grid); | |
1049 | + | |
1050 | bool EndEdit(int row, int col, wxGrid *grid); | |
1051 | ||
1052 | + bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval); | |
1053 | + | |
1054 | + void ApplyEdit(int row, int col, wxGrid *grid); | |
1055 | + | |
1056 | void Reset(); | |
1057 | ||
1058 | wxString GetFormat(); | |
1059 | @@ -65,12 +70,14 @@ | |
1060 | wxString GetValue() const; | |
1061 | ||
1062 | TimeTextCtrl *GetTimeCtrl() const { return (TimeTextCtrl *)m_control; }; | |
1063 | - | |
1064 | + | |
1065 | private: | |
1066 | ||
1067 | wxString mFormat; | |
1068 | double mRate; | |
1069 | double mOld; | |
1070 | + wxString mOldString; | |
1071 | + wxString mValueAsString; | |
1072 | }; | |
1073 | ||
1074 | // ---------------------------------------------------------------------------- | |
1075 | @@ -124,8 +131,13 @@ | |
1076 | void SetSize(const wxRect &rect); | |
1077 | ||
1078 | void BeginEdit(int row, int col, wxGrid *grid); | |
1079 | + | |
1080 | bool EndEdit(int row, int col, wxGrid *grid); | |
1081 | ||
1082 | + bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval); | |
1083 | + | |
1084 | + void ApplyEdit(int row, int col, wxGrid *grid); | |
1085 | + | |
1086 | void Reset(); | |
1087 | ||
1088 | wxGridCellEditor *Clone() const; | |
1089 | @@ -159,6 +171,7 @@ | |
1090 | ||
1091 | wxArrayString mChoices; | |
1092 | wxString mOld; | |
1093 | + wxString mValueAsString; | |
1094 | }; | |
1095 | ||
1096 | // ---------------------------------------------------------------------------- | |
1097 | --- a/src/widgets/ImageRoll.cpp | |
1098 | +++ b/src/widgets/ImageRoll.cpp | |
1099 | @@ -299,7 +299,7 @@ | |
1100 | } | |
1101 | ||
1102 | void ImageRoll::DrawBitmap(wxDC &dc, wxBitmap &bitmap, | |
1103 | - int x, int y, int logicalFunc) | |
1104 | + int x, int y, wxRasterOperationMode logicalFunc) | |
1105 | { | |
1106 | if (logicalFunc == wxCOPY) | |
1107 | dc.DrawBitmap(bitmap, x, y); | |
1108 | @@ -311,7 +311,7 @@ | |
1109 | } | |
1110 | } | |
1111 | ||
1112 | -void ImageRoll::Draw(wxDC &dc, wxRect rect, int WXUNUSED(logicalFunc)) | |
1113 | +void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logicalFunc)) | |
1114 | { | |
1115 | int width = rect.width; | |
1116 | int height = rect.height; | |
1117 | @@ -434,7 +434,7 @@ | |
1118 | mImageRoll.GetMaxSize()); | |
1119 | } | |
1120 | ||
1121 | -void ImageRollPanel::SetLogicalFunction(int func) | |
1122 | +void ImageRollPanel::SetLogicalFunction(wxRasterOperationMode func) | |
1123 | { | |
1124 | mLogicalFunction = func; | |
1125 | } | |
1126 | --- a/src/widgets/ImageRoll.h | |
1127 | +++ b/src/widgets/ImageRoll.h | |
1128 | @@ -12,9 +12,18 @@ | |
1129 | #ifndef __AUDACITY_IMAGE_ROLL__ | |
1130 | #define __AUDACITY_IMAGE_ROLL__ | |
1131 | ||
1132 | +#include <wx/dc.h> | |
1133 | +#include <wx/dcclient.h> | |
1134 | #include <wx/defs.h> | |
1135 | #include <wx/dynarray.h> | |
1136 | #include <wx/panel.h> | |
1137 | +#include <wx/version.h> | |
1138 | + | |
1139 | + | |
1140 | +#if wxMAJOR_VERSION < 3 | |
1141 | +# define wxRasterOperationMode int | |
1142 | +#endif | |
1143 | + | |
1144 | ||
1145 | WX_DECLARE_OBJARRAY(wxBitmap, BitmapArray); | |
1146 | WX_DECLARE_OBJARRAY(wxImage, ImageArray); | |
1147 | @@ -40,7 +49,7 @@ | |
1148 | wxSize GetMaxSize() const { return mMaxSize; } | |
1149 | ||
1150 | void Draw(wxDC &dc, wxRect rect, | |
1151 | - int logicalFunc = wxCOPY); | |
1152 | + wxRasterOperationMode logicalFunc = wxCOPY); | |
1153 | ||
1154 | static ImageArray SplitH(const wxImage &src, wxColour magicColor); | |
1155 | static ImageArray SplitV(const wxImage &src, wxColour magicColor); | |
1156 | @@ -48,7 +57,7 @@ | |
1157 | protected: | |
1158 | ||
1159 | void DrawBitmap(wxDC &dc, wxBitmap &bitmap, | |
1160 | - int x, int y, int logicalFunc = wxCOPY); | |
1161 | + int x, int y, wxRasterOperationMode logicalFunc = wxCOPY); | |
1162 | ||
1163 | void Init(RollType type, const wxImage &src, wxColour magicColor); | |
1164 | ||
1165 | @@ -72,7 +81,7 @@ | |
1166 | const wxSize& size = wxDefaultSize, | |
1167 | long style = wxTAB_TRAVERSAL); | |
1168 | ||
1169 | - void SetLogicalFunction(int func); | |
1170 | + void SetLogicalFunction(wxRasterOperationMode func); | |
1171 | ||
1172 | void OnPaint(wxPaintEvent &evt); | |
1173 | void OnSize(wxSizeEvent &evt); | |
1174 | @@ -80,7 +89,7 @@ | |
1175 | protected: | |
1176 | ImageRoll mImageRoll; | |
1177 | ||
1178 | - int mLogicalFunction; | |
1179 | + wxRasterOperationMode mLogicalFunction; | |
1180 | ||
1181 | DECLARE_EVENT_TABLE(); | |
1182 | ||
1183 | --- a/src/widgets/TimeTextCtrl.cpp | |
1184 | +++ b/src/widgets/TimeTextCtrl.cpp | |
1185 | @@ -168,6 +168,7 @@ | |
1186 | ||
1187 | #include <math.h> | |
1188 | ||
1189 | +#include <wx/dcclient.h> | |
1190 | #include <wx/dcmemory.h> | |
1191 | #include <wx/font.h> | |
1192 | #include <wx/intl.h> | |
1193 | @@ -1160,7 +1161,7 @@ | |
1194 | nevent.SetDirection(!event.ShiftDown()); | |
1195 | nevent.SetEventObject(parent); | |
1196 | nevent.SetCurrentFocus(parent); | |
1197 | - GetParent()->ProcessEvent(nevent); | |
1198 | + GetParent()->GetEventHandler()->ProcessEvent(nevent); | |
1199 | } | |
1200 | ||
1201 | else if (keyCode == WXK_RETURN || keyCode == WXK_NUMPAD_ENTER) { | |
1202 | @@ -1169,7 +1170,7 @@ | |
1203 | if (def && def->IsEnabled()) { | |
1204 | wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED, | |
1205 | def->GetId()); | |
1206 | - GetParent()->ProcessEvent(cevent); | |
1207 | + GetParent()->GetEventHandler()->ProcessEvent(cevent); | |
1208 | } | |
1209 | } | |
1210 | ||
1211 | --- a/src/xml/XMLWriter.cpp | |
1212 | +++ b/src/xml/XMLWriter.cpp | |
1213 | @@ -246,7 +246,7 @@ | |
1214 | mHasKids[0] = true; | |
1215 | } | |
1216 | ||
1217 | - Write(value.c_str()); | |
1218 | + Write(value); | |
1219 | } | |
1220 | ||
1221 | void XMLWriter::WriteSubTree(const wxChar *value) | |
1222 | --- a/src/widgets/FileHistory.cpp | |
1223 | +++ b/src/widgets/FileHistory.cpp | |
1224 | @@ -142,7 +142,7 @@ | |
1225 | // Stored in reverse order | |
1226 | int n = mHistory.GetCount() - 1; | |
1227 | for (size_t i = 1; i <= mHistory.GetCount(); i++) { | |
1228 | - config.Write(wxString::Format(wxT("file%02d"), i), mHistory[n--]); | |
1229 | + config.Write(wxString::Format(wxT("file%02lld"), i), mHistory[n--]); | |
1230 | } | |
1231 | ||
1232 | config.SetPath(wxT("..")); | |
1233 | --- a/src/effects/ladspa/LoadLadspa.cpp | |
1234 | +++ b/src/effects/ladspa/LoadLadspa.cpp | |
1235 | @@ -147,7 +147,7 @@ | |
1236 | data = mainFn(index); | |
1237 | while(data) { | |
1238 | ||
1239 | - wxString uniqid = wxString::Format(wxT("%08x-%s"), data->UniqueID, LAT1CTOWX(data->Label).c_str()); | |
1240 | + wxString uniqid = wxString::Format(wxT("%08x-%s"), (unsigned int) data->UniqueID, LAT1CTOWX(data->Label).c_str()); | |
1241 | if (uniq.Index(uniqid) == wxNOT_FOUND) { | |
1242 | uniq.Add(uniqid); | |
1243 | std::set<wxString> categories; | |
1244 | --- a/src/import/Import.cpp | |
1245 | +++ b/src/import/Import.cpp | |
1246 | @@ -288,7 +288,7 @@ | |
1247 | more to delete.*/ | |
1248 | i = this->mExtImportItems->Count(); | |
1249 | do { | |
1250 | - name.Printf (wxT("/ExtImportItems/Item%d"), i); | |
1251 | + name.Printf (wxT("/ExtImportItems/Item%lld"), i); | |
1252 | // No item to delete? Then it's time to finish. | |
1253 | if (!gPrefs->Read(name, &val)) | |
1254 | break; | |
1255 | --- a/src/effects/ladspa/LadspaEffect.cpp | |
1256 | +++ b/src/effects/ladspa/LadspaEffect.cpp | |
1257 | @@ -518,16 +518,14 @@ | |
1258 | this->mData = data; | |
1259 | this->inputControls = inputControls; | |
1260 | this->sampleRate = sampleRate; | |
1261 | - #ifdef __WXMSW__ | |
1262 | - // On Windows, for some reason, wxWidgets calls OnTextCtrl during creation | |
1263 | - // of the text control, and LadspaEffectDialog::OnTextCtrl calls HandleText, | |
1264 | - // which assumes all the fields have been initialized. | |
1265 | - // This can give us a bad pointer crash, so manipulate inSlider to | |
1266 | - // no-op HandleText during creation. | |
1267 | - inSlider = true; | |
1268 | - #else | |
1269 | - inSlider = false; | |
1270 | - #endif | |
1271 | + | |
1272 | + // wxWidgets calls OnTextCtrl during creation | |
1273 | + // of the text control, and LadspaEffectDialog::OnTextCtrl calls HandleText, | |
1274 | + // which assumes all the fields have been initialized. | |
1275 | + // This can give us a bad pointer crash, so manipulate inSlider to | |
1276 | + // no-op HandleText during creation. | |
1277 | + inSlider = true; | |
1278 | + | |
1279 | inText = false; | |
1280 | ||
1281 | toggles = new wxCheckBox*[mData->PortCount]; | |
1282 | --- a/src/prefs/PrefsDialog.cpp | |
1283 | +++ b/src/prefs/PrefsDialog.cpp | |
1284 | @@ -185,8 +185,6 @@ | |
1285 | Fit(); | |
1286 | wxSize sz = GetSize(); | |
1287 | ||
1288 | - wxASSERT_MSG(sz.x <= 800 && sz.y <= 600, wxT("Preferences dialog exceeds max size")); | |
1289 | - | |
1290 | if (sz.x > 800) { | |
1291 | sz.x = 800; | |
1292 | } | |
1293 | --- a/src/prefs/QualityPrefs.cpp | |
1294 | +++ b/src/prefs/QualityPrefs.cpp | |
1295 | @@ -162,13 +162,13 @@ | |
1296 | { | |
1297 | S.StartMultiColumn(2, wxEXPAND); | |
1298 | { | |
1299 | - S.SetStretchyCol(2); | |
1300 | + S.SetStretchyCol(1); // 2nd column (= index 1) is stretchy | |
1301 | ||
1302 | S.TieChoice(_("Sample Rate Con&verter:"), | |
1303 | Resample::GetFastMethodKey(), | |
1304 | Resample::GetFastMethodDefault(), | |
1305 | mConverterNames, | |
1306 | - mConverterLabels), | |
1307 | + mConverterLabels); | |
1308 | S.SetSizeHints(mConverterNames); | |
1309 | ||
1310 | S.TieChoice(_("&Dither:"), | |
1311 | --- a/src/Project.h | |
1312 | +++ b/src/Project.h | |
1313 | @@ -253,6 +253,7 @@ | |
1314 | void OnMouseEvent(wxMouseEvent & event); | |
1315 | void OnIconize(wxIconizeEvent &event); | |
1316 | void OnSize(wxSizeEvent & event); | |
1317 | + void OnShow(wxShowEvent & event); | |
1318 | void OnMove(wxMoveEvent & event); | |
1319 | void OnScroll(wxScrollEvent & event); | |
1320 | void OnCloseWindow(wxCloseEvent & event); | |
1321 | @@ -487,6 +488,8 @@ | |
1322 | // dialog for missing alias warnings | |
1323 | wxDialog *mAliasMissingWarningDialog; | |
1324 | ||
1325 | + bool mShownOnce; | |
1326 | + | |
1327 | public: | |
1328 | ToolManager *mToolManager; | |
1329 | bool mShowSplashScreen; |