Commit Graph

69 Commits

Author SHA1 Message Date
Paul Licameli c5ebc396eb Audacity.h has shrunk to nothing, now remove it! 2021-05-10 00:05:23 -05:00
freddii 534359de6c
Fix minor typos (#720)
Co-authored-by: freddii <https://freddii@github.com>
2021-01-12 11:56:09 +00:00
Paul Licameli 8ce72748bf CommandManager stores only stripped menu names (no & characters)...
... Keyboard preference dialog does not need to repeat the stripping
2020-05-23 22:42:21 -04:00
Paul Licameli 1b2d4e26ba Consistently compare to translation of "Command" in KeyView.cpp...
... note that "cat" compared with it is concatenated with _("Menu") and
stored in KeyNode::category, which is also compared elsewhere with
CommandTranslated.  So this change in one comparison is the right one.
2020-05-22 13:07:50 -04:00
Paul Licameli 30ac43e195 Fix more comments ("it's" -> "its") 2020-04-12 18:49:22 -04:00
Yuri Chornoivan d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
David Bailes 46a6d21585 Bug 2299 - Keyboard preferences: names of commands contain &
Caused by this commit: 0021a98091 : Remove another unnecessary stripping of accelerators from labels

Unfortunately, the stripping was necessary.

Fix:
Reinstate stripping.

Derives from tag: Audacity-2.3.3 + 94 commits
2020-01-31 15:11:18 +00:00
Paul Licameli 5639f834c8 CommandManager stores labels as TranslatableString 2019-12-16 10:58:05 -05:00
Paul Licameli 0021a98091 Remove another unnecessary stripping of accelerators from labels 2019-12-16 07:09:04 -05:00
Paul Licameli a8de4d9e50 Construct MenuItem with untranslated label, so it can be static...
... and other storage of TranslatableString instead of naked wxString, for
management of menu items, in CommandManager
2019-12-12 15:49:00 -05:00
David Bailes 5b277dc9f8 Bug 1723 - Keyboard Preferences: Closing subtrees.
Closing sub trees can leave the wrong item selected.
If a node near the bottom of the tree is closed, the node may move
down, and no longer be under the mouse pointer. If further processing
is allowed, then the line at the mouse position is incorrectly selected.

Fix: Don't allow further processing and call SetFocus() ourselves.
2019-07-30 11:35:46 +01:00
David Bailes f327fef80b Bug 2146: Keyboard preferences: mouse can select wrong item
My previous fix for this bug, commit 4b437b8, did not work on Mac.
This bug was introduced by my commit b62ed73. This commit was to ensure that when the keyview was the focus, there was always one item selected. This ensures that the focus is indicated visually, and that the Narrator screen reader reads the keyview.

The failed fix, selected an item if necessary when the keyview became the focus.

The current fix reverts b62ed73 and 4b437b8, and ensures that an item is selected each time the items are updated.
2019-07-05 12:16:04 +01:00
David Bailes 4b437b8cb9 Bug 2146: Keyboard preferences: mouse can select wrong item
Steps to reproduce:
1. Open preferences
2. Select the keyboard category
3. Scroll down the list by any amount
4. Select an item using the mouse. The list scrolls to the top and the wrong item is selected.

The problem occurs because if the list of shortcuts is currently not the focus, then after a left mouse click, KeyView::OnSetFocus() is called, and setting the selection in that function interferes with the mouse selection.

Fix: In KeyView::OnSetFocus(), if there has been a left down event, don't select anything.
2019-07-01 11:48:56 +01:00
David Bailes 6da84b0adc Keyboard prefs accessibility: Narrator can misread the radio buttons.
Problem. If an item in the list is selected, then if a different view by radio button is selected, Narrator reads the selected item rather than the radio button.
KeyViewAx::SetCurrentLine(int line) can be called when the KeyView is not the focus, and send a focus event.

Fix: In KeyViewAx::SetCurrentLine(int line), only send focus event if the KeyView is the focus.
2019-05-17 08:33:33 +01:00
Paul Licameli 6c57948d8f Remove unnecessary #include-s from .cpp files...
... Unnecessary because transitively included.

But each .cpp file still includes its own .h file near the top to ensure
that it compiles indenendently, even if it is reincluded transitively later.
2019-05-16 17:21:00 -04:00
Paul Licameli 9bf29f5582 CommandManager keys by CommandId, not plain wxString 2019-05-16 12:30:29 -04:00
Paul Licameli 11c8377460 NormalizedKeyString redefined as TaggedIdentifier 2019-05-16 12:30:29 -04:00
Paul Licameli ed29ab89f8 Many WindowAccessible subclasses moved out of header files 2019-03-31 13:27:18 -04:00
David Bailes 62f1711cdd KeyView: fix focus issue
Problem: A user can tab to the list, and none of the items is the focus. The list itself is still the focus. As a result, there is no visual indication of the focus, and an additional keystroke is needed to make any item the focus.

Fix: When the list gains focus, if no items are selected, select the first item, if there is one.
2019-03-29 11:10:14 +00:00
Paul Licameli a915a510bd include <wx/setup.h> in all files where wxUSE* macros are used...
... even if it's redundant; improving on what was done at b47e2f9
2019-03-23 14:56:02 -04:00
Paul Licameli 0dd0a5cb5a Remove <wx/menu.h> from CommandManager.h, moving inline functions out 2019-03-23 10:56:43 -04:00
Paul Licameli 5e7d41ec07 Each .cpp/.mm file includes corresponding header before any other...
... except Audacity.h

This forces us to make each header contain all forward declarations or nested
headers that it requires, rather than depend on context.
2019-03-17 22:54:52 -04:00
Paul Licameli e6324e86ac Fix cross-platform one-pixel differences in line drawing...
... Make all line drawing go through our AColor which wraps the wxDC
line-drawing functions.

Despite what wxWidgets documentation says, the functions still don't
consistently include the first point and omit the last point of a line.  I
observed inclusion of both on Mac, while on Windows, omission sometimes of the
first point instead of the last.

Discrepancies could be observed in 2.3.0 between Windows and Mac, using the
Window magnifier or command+alt+ +, zooming in closely on the ends of the
shadow lines below and right of tracks, or at the bottom-right corners of the
bevels drawn around vertical rulers.

So where there is an observable one-pixel difference of drawing between
platforms, there is the question, which was the intent when the drawing code
was written?  Should the coordinates be corrected by one or not?

I reviewed each case and used my judgment.

Most of the calls are in drawing rulers.  Major tick lines were drawn five
pixels long, and minor, three, on Mac.  I keep this behavior, but you might
argue for making them four and two.

On the other hand the drawing of ruler grid lines, which you can see in
the equalization and frequency analysis windows, did need a one-pixel correction
to avoid straying out of bounds.
2019-03-16 07:51:28 -04:00
Paul Licameli 5fd6965925 Use type aliases CommandID, CommandIDs...
... for identifiers of menu commands and macros, and for vectors thereof
2019-03-15 15:18:11 -04:00
Paul Licameli b8c0125143 Replace comparisons against wxEmptyString with empty() 2019-03-14 16:20:18 -04:00
Paul Licameli 795b6a2e42 More std:: style for wxString and wxArrayString...
... Replacing:

Insert => insert
RemoveAt => erase
Remove => erase
IsSameAs => operator == or operator !=
   (but only when second argument was true or default)
2019-03-10 14:45:12 -04:00
Paul Licameli c68e336247 More use of std:: style members of wxString...
... replacing:

Length => length
Len => length
2019-03-10 14:44:54 -04:00
Paul Licameli 2db49dc1f0 Use standard library style members of wxArrayString (and wxString) ...
... which will make it easier to change the types of those containers to
std::vectors of other string-like classes

for wxString,

IsEmpty => empty
Clear => clear
Alloc => reserve

for wxArrayString,

Count => size
GetCount => size
IsEmpty => empty
Add => push_back
Clear => clear
Empty => clear
Sort => std::sort (only with default comparator)
SetCount => resize
Last => back
Item => operator []
Alloc => reserve
2019-03-10 14:43:57 -04:00
James Crook 121fdc5703 Fix non-ASCII characters in wxLogDebug
The LogDebugs aren't needed now, as we can get the info via Scripting.
2018-04-15 15:09:15 +01:00
David Bailes f027708fe1 Fix an issue caused by the accessibility changes in wxWidgets 3.1.1
The main change in wx accessibility is this:
7dab555f71 (diff-04f5191d86f95b1c4d5d9c979da65878)

However wxWindowAccessible has not been updated to take into account of that change. In particular wxWindowAccessible::GetParent() was always wrong, but it was consistent with the rest of the framework. Now it's wrong and inconsistent. This function should return an object with role window, and which has the same name.

The fix is to introduce class WindowAccessible, which is effectively our own version of wxWindowAccessible. This class does not override GetParent(), and so just relies on a standard accessible object to to the right thing in wxIAccessible::get_accParent() (which is does). This class also allows us to have our own version of GetName(), which allows us to set the accessibility names of buttons.

These changes will break the accessibility of Audacity if it is built with wxWidgets 3.0.X. If this is a problem, then there could be some #if stuff in WindowAccessible.h to turn the WindowAccessible class into one which simply inherits from wxWindowAccessible, and doesn't override anything.
2018-04-03 14:57:59 +01:00
Paul Licameli e5052a1973 Use a type distinction for key strings in normalized form...
... Such are not for display to the user.  They are appended to menu item
names to identify accelerators, and wxWidgets transforms them appropriately
for the operating system.
2018-02-25 14:56:17 -05:00
Paul Licameli 080dd34e61 Get rid of wx object arrays, use std::vector 2018-02-21 19:33:27 -05:00
Paul Licameli c6696f1b49 Move definition of _ and related into Internat.h 2018-01-06 21:03:32 -05:00
Paul Licameli aa5c3f12a3 easy change key bindings 2018-01-05 09:27:11 -05:00
Paul Licameli 7fd78183d2 Remove needless uses of wxString::c_str() in wxString::Format...
... and similar wx "variadics," which all treat wxString smartly enough that
you don't need this.

Don't need c_str either to convert wxString to const wxChar * because
wxString has a conversion operator that does the same.
2018-01-01 20:34:33 -05:00
James Crook f463eda36c Clean up some dead code and MSVC warnings.
- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
2017-12-08 15:20:39 +00:00
James Crook f3dcccb144 Bug 1165 - Enh: Keyboard preference key bindings can be way over to right
Fixed by putting key bindings on the left in all three views.
I also elevated EXPERIMENTAL_KEY_VIEW to no longer experimental, by excising the old code which we don't need any more.
2017-08-19 16:48:45 +01:00
James Crook de0cc3ecff Bug 1699 - Selected keyboard prefs line unreadable in 3 of 4 themes on Mac
The focus rect in key prefs is not very helpful.  It was setting the background colour too,
but that is now using system colours again.
2017-07-22 11:08:15 +01:00
James Crook 597ddbfa52 Further speed up to showing preferences.
We now don't sort the list until a view is selected.  Also we create it with nodes open, rather than creating with nodes closed and then separately opening them.  Instead of 3 sorts at initialisation only one happens now.  AX info is only updated after a sort, so this may be 3x faster for screen reader users too.
2017-05-25 15:46:55 +01:00
James Crook 8afeed5f78 Faster opening of preferences.
The slow opening was caused by sorting lists of commands.  The comparison function was slow because it created new strings, entailing malloc/free and used translation in the function.  Comparison function was being called about 4,000 times.
2017-05-24 22:08:43 +01:00
James Crook 031f8413f4 Organise the occult commands in the Preferences Key View. 2017-04-21 15:50:25 +01:00
James Crook 649e52d348 Improved logging of command list. 2017-04-19 21:44:35 +01:00
James Crook 78149bc3da Disable command-list capture code, by default.
Also added a comment to say what it is.
2017-03-23 18:48:00 +00:00
James Crook 3ffcc29bf6 Add code to capture command List
Capture the commands and key bindings to debug channel:
a) From the menus
b) from the preferences.
2017-03-23 18:42:54 +00:00
Paul Licameli 5036583549 Fewer inclusions of AudacityApp.h 2017-03-17 17:52:24 -04:00
Paul Licameli db137ddf76 wxWindow takes ownership of its wxAccessible, so we can use safenew. 2016-05-06 21:03:37 -04:00
Paul Licameli 7c4c45a0d5 "new"->"NEW" in comments, easier to find remaining naked operator new 2016-02-14 18:52:41 -05:00
Leland Lucius ab5eb8a558 Fix for bug #1102 2015-08-27 02:30:46 -05:00
Leland Lucius 6a9dae20f5 Appearance on OSX is now back to normal or better
Some additional wx3 cleanup as well.
2015-08-23 20:25:01 -05:00
Leland Lucius a4802f48b1 Fix wx3 related crash and remove wx2 ifdef'd code 2015-08-19 00:37:03 -05:00