KiCad PCB EDA Suite
Loading...
Searching...
No Matches
scintilla_tricks.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020-2023 KiCad Developers, see change_log.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24
25#include <string_utils.h>
26#include <scintilla_tricks.h>
27#include <widgets/wx_grid.h>
28#include <widgets/ui_common.h>
29#include <wx/stc/stc.h>
30#include <gal/color4d.h>
31#include <dialog_shim.h>
32#include <wx/clipbrd.h>
33#include <wx/log.h>
34#include <wx/settings.h>
35#include <confirm.h>
36
37SCINTILLA_TRICKS::SCINTILLA_TRICKS( wxStyledTextCtrl* aScintilla, const wxString& aBraces,
38 bool aSingleLine,
39 std::function<void( wxKeyEvent& )> onAcceptFn,
40 std::function<void( wxStyledTextEvent& )> onCharAddedFn ) :
41 m_te( aScintilla ),
42 m_braces( aBraces ),
43 m_lastCaretPos( -1 ),
44 m_lastSelStart( -1 ),
45 m_lastSelEnd( -1 ),
46 m_suppressAutocomplete( false ),
47 m_singleLine( aSingleLine ),
48 m_onAcceptFn( std::move( onAcceptFn ) ),
49 m_onCharAddedFn( std::move( onCharAddedFn ) )
50{
51 // Always use LF as eol char, regardless the platform
52 m_te->SetEOLMode( wxSTC_EOL_LF );
53
54 // A hack which causes Scintilla to auto-size the text editor canvas
55 // See: https://github.com/jacobslusser/ScintillaNET/issues/216
56 m_te->SetScrollWidth( 1 );
57 m_te->SetScrollWidthTracking( true );
58
59 if( m_singleLine )
60 {
61 m_te->SetUseVerticalScrollBar( false );
62 m_te->SetUseHorizontalScrollBar( false );
63 }
64
66
67 // Set up autocomplete
68 m_te->AutoCompSetIgnoreCase( true );
69 m_te->AutoCompSetMaxHeight( 20 );
70
71 if( aBraces.Length() >= 2 )
72 m_te->AutoCompSetFillUps( m_braces[1] );
73
74 // Hook up events
75 m_te->Bind( wxEVT_STC_UPDATEUI, &SCINTILLA_TRICKS::onScintillaUpdateUI, this );
76 m_te->Bind( wxEVT_STC_MODIFIED, &SCINTILLA_TRICKS::onModified, this );
77
78 // Handle autocomplete
79 m_te->Bind( wxEVT_STC_CHARADDED, &SCINTILLA_TRICKS::onChar, this );
80 m_te->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED, &SCINTILLA_TRICKS::onChar, this );
81
82 // Dispatch command-keys in Scintilla control.
83 m_te->Bind( wxEVT_CHAR_HOOK, &SCINTILLA_TRICKS::onCharHook, this );
84
85 m_te->Bind( wxEVT_SYS_COLOUR_CHANGED,
86 wxSysColourChangedEventHandler( SCINTILLA_TRICKS::onThemeChanged ), this );
87}
88
89
90void SCINTILLA_TRICKS::onThemeChanged( wxSysColourChangedEvent &aEvent )
91{
93
94 aEvent.Skip();
95}
96
97
99{
100 wxTextCtrl dummy( m_te->GetParent(), wxID_ANY );
101 KIGFX::COLOR4D foreground = dummy.GetForegroundColour();
102 KIGFX::COLOR4D background = dummy.GetBackgroundColour();
103 KIGFX::COLOR4D highlight = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT );
104 KIGFX::COLOR4D highlightText = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
105
106 m_te->StyleSetForeground( wxSTC_STYLE_DEFAULT, foreground.ToColour() );
107 m_te->StyleSetBackground( wxSTC_STYLE_DEFAULT, background.ToColour() );
108 m_te->StyleClearAll();
109
110 // Scintilla doesn't handle alpha channel, which at least OSX uses in some highlight colours,
111 // such as "graphite".
112 highlight = highlight.Mix( background, highlight.a ).WithAlpha( 1.0 );
113 highlightText = highlightText.Mix( background, highlightText.a ).WithAlpha( 1.0 );
114
115 m_te->SetSelForeground( true, highlightText.ToColour() );
116 m_te->SetSelBackground( true, highlight.ToColour() );
117 m_te->SetCaretForeground( foreground.ToColour() );
118
119 if( !m_singleLine )
120 {
121 // Set a monospace font with a tab width of 4. This is the closest we can get to having
122 // Scintilla mimic the stroke font's tab positioning.
123 wxFont fixedFont = KIUI::GetMonospacedUIFont();
124
125 for( size_t i = 0; i < wxSTC_STYLE_MAX; ++i )
126 m_te->StyleSetFont( i, fixedFont );
127
128 m_te->SetTabWidth( 4 );
129 }
130
131 // Set up the brace highlighting. Scintilla doesn't handle alpha, so we construct our own
132 // 20% wash by blending with the background.
133 KIGFX::COLOR4D braceText = foreground;
134 KIGFX::COLOR4D braceHighlight = braceText.Mix( background, 0.2 );
135
136 m_te->StyleSetForeground( wxSTC_STYLE_BRACELIGHT, highlightText.ToColour() );
137 m_te->StyleSetBackground( wxSTC_STYLE_BRACELIGHT, braceHighlight.ToColour() );
138 m_te->StyleSetForeground( wxSTC_STYLE_BRACEBAD, *wxRED );
139}
140
141
142bool isCtrlSlash( wxKeyEvent& aEvent )
143{
144 if( !aEvent.ControlDown() || aEvent.MetaDown() )
145 return false;
146
147 if( aEvent.GetUnicodeKey() == '/' )
148 return true;
149
150 // OK, now the wxWidgets hacks start.
151 // (We should abandon these if https://trac.wxwidgets.org/ticket/18911 gets resolved.)
152
153 // Many Latin America and European keyboars have have the / over the 7. We know that
154 // wxWidgets messes this up and returns Shift+7 through GetUnicodeKey(). However, other
155 // keyboards (such as France and Belgium) have 7 in the shifted position, so a Shift+7
156 // *could* be legitimate.
157
158 // However, we *are* checking Ctrl, so to assume any Shift+7 is a Ctrl-/ really only
159 // disallows Ctrl+Shift+7 from doing something else, which is probably OK. (This routine
160 // is only used in the Scintilla editor, not in the rest of Kicad.)
161
162 // The other main shifted loation of / is over : (France and Belgium), so we'll sacrifice
163 // Ctrl+Shift+: too.
164
165 if( aEvent.ShiftDown() && ( aEvent.GetUnicodeKey() == '7' || aEvent.GetUnicodeKey() == ':' ) )
166 return true;
167
168 // A few keyboards have / in an Alt position. Since we're expressly not checking Alt for
169 // up or down, those should work. However, if they don't, there's room below for yet
170 // another hack....
171
172 return false;
173}
174
175
176void SCINTILLA_TRICKS::onChar( wxStyledTextEvent& aEvent )
177{
178 m_onCharAddedFn( aEvent );
179}
180
181
182void SCINTILLA_TRICKS::onModified( wxStyledTextEvent& aEvent )
183{
184 if( m_singleLine )
185 {
186 wxString curr_text = m_te->GetText();
187
188 if( curr_text.Contains( wxS( "\n" ) ) || curr_text.Contains( wxS( "\r" ) ) )
189 {
190 // Scintilla won't allow us to call SetText() from within this event processor,
191 // so we have to delay the processing.
192 CallAfter( [this]()
193 {
194 wxString text = m_te->GetText();
195 int currpos = m_te->GetCurrentPos();
196
197 text.Replace( wxS( "\n" ), wxS( "" ) );
198 text.Replace( wxS( "\r" ), wxS( "" ) );
199 m_te->SetText( text );
200 m_te->GotoPos( currpos-1 );
201 } );
202 }
203 }
204}
205
206
207void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
208{
209 wxString c = aEvent.GetUnicodeKey();
210
211 if( m_te->AutoCompActive() )
212 {
213 if( aEvent.GetKeyCode() == WXK_ESCAPE )
214 {
215 m_te->AutoCompCancel();
216 m_suppressAutocomplete = true; // Don't run autocomplete again on the next char...
217 }
218 else if( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
219 {
220 m_te->AutoCompComplete();
221 }
222 else
223 {
224 aEvent.Skip();
225 }
226
227 return;
228 }
229
230#ifdef __WXMAC__
231 if( aEvent.GetModifiers() == wxMOD_RAW_CONTROL && aEvent.GetKeyCode() == WXK_SPACE )
232#else
233 if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == WXK_SPACE )
234#endif
235 {
237
238 wxStyledTextEvent event;
239 event.SetKey( ' ' );
240 event.SetModifiers( wxMOD_CONTROL );
241 m_onCharAddedFn( event );
242
243 return;
244 }
245
246 if( !isalpha( aEvent.GetKeyCode() ) )
248
249 if( ( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
250 && ( m_singleLine || aEvent.ShiftDown() ) )
251 {
252 m_onAcceptFn( aEvent );
253 }
254 else if( ConvertSmartQuotesAndDashes( &c ) )
255 {
256 m_te->AddText( c );
257 }
258 else if( aEvent.GetKeyCode() == WXK_TAB )
259 {
260 wxWindow* ancestor = m_te->GetParent();
261
262 while( ancestor && !dynamic_cast<WX_GRID*>( ancestor ) )
263 ancestor = ancestor->GetParent();
264
265 if( aEvent.ControlDown() )
266 {
267 int flags = 0;
268
269 if( !aEvent.ShiftDown() )
270 flags |= wxNavigationKeyEvent::IsForward;
271
272 if( DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( wxGetTopLevelParent( m_te ) ) )
273 dlg->NavigateIn( flags );
274 }
275 else if( dynamic_cast<WX_GRID*>( ancestor ) )
276 {
277 WX_GRID* grid = static_cast<WX_GRID*>( ancestor );
278 int row = grid->GetGridCursorRow();
279 int col = grid->GetGridCursorCol();
280
281 if( aEvent.ShiftDown() )
282 {
283 if( col > 0 )
284 {
285 col--;
286 }
287 else if( row > 0 )
288 {
289 col = (int) grid->GetNumberCols() - 1;
290
291 if( row > 0 )
292 row--;
293 else
294 row = (int) grid->GetNumberRows() - 1;
295 }
296 }
297 else
298 {
299 if( col < (int) grid->GetNumberCols() - 1 )
300 {
301 col++;
302 }
303 else if( row < grid->GetNumberRows() - 1 )
304 {
305 col = 0;
306
307 if( row < grid->GetNumberRows() - 1 )
308 row++;
309 else
310 row = 0;
311 }
312 }
313
314 grid->SetGridCursor( row, col );
315 }
316 else
317 {
318 m_te->Tab();
319 }
320 }
321 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'Z' )
322 {
323 m_te->Undo();
324 }
325 else if( ( aEvent.GetModifiers() == wxMOD_SHIFT+wxMOD_CONTROL && aEvent.GetKeyCode() == 'Z' )
326 || ( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'Y' ) )
327 {
328 m_te->Redo();
329 }
330 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'A' )
331 {
332 m_te->SelectAll();
333 }
334 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'X' )
335 {
336 m_te->Cut();
337
338 if( wxTheClipboard->Open() )
339 {
340 wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
341 wxTheClipboard->Close();
342 }
343 }
344 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'C' )
345 {
346 m_te->Copy();
347
348 if( wxTheClipboard->Open() )
349 {
350 wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
351 wxTheClipboard->Close();
352 }
353 }
354 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'V' )
355 {
356 if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() )
357 m_te->DeleteBack();
358
359 wxLogNull doNotLog; // disable logging of failed clipboard actions
360
361 if( wxTheClipboard->Open() )
362 {
363 if( wxTheClipboard->IsSupported( wxDF_TEXT ) ||
364 wxTheClipboard->IsSupported( wxDF_UNICODETEXT ) )
365 {
366 wxTextDataObject data;
367 wxString str;
368
369 wxTheClipboard->GetData( data );
370 str = data.GetText();
371
373
374 if( m_singleLine )
375 {
376 str.Replace( wxS( "\n" ), wxEmptyString );
377 str.Replace( wxS( "\r" ), wxEmptyString );
378 }
379
380 m_te->BeginUndoAction();
381 m_te->AddText( str );
382 m_te->EndUndoAction();
383 }
384
385 wxTheClipboard->Close();
386 }
387 }
388 else if( aEvent.GetKeyCode() == WXK_BACK )
389 {
390 if( aEvent.GetModifiers() == wxMOD_CONTROL )
391#ifdef __WXMAC__
392 m_te->HomeExtend();
393 else if( aEvent.GetModifiers() == wxMOD_ALT )
394#endif
395 m_te->WordLeftExtend();
396
397 m_te->DeleteBack();
398 }
399 else if( aEvent.GetKeyCode() == WXK_DELETE )
400 {
401 if( m_te->GetSelectionEnd() == m_te->GetSelectionStart() )
402 m_te->CharRightExtend();
403
404 if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() )
405 m_te->DeleteBack();
406 }
407 else if( isCtrlSlash( aEvent ) )
408 {
409 int startLine = m_te->LineFromPosition( m_te->GetSelectionStart() );
410 int endLine = m_te->LineFromPosition( m_te->GetSelectionEnd() );
411 bool comment = firstNonWhitespace( startLine ) != '#';
412 int whitespaceCount;
413
414 m_te->BeginUndoAction();
415
416 for( int ii = startLine; ii <= endLine; ++ii )
417 {
418 if( comment )
419 m_te->InsertText( m_te->PositionFromLine( ii ), wxT( "#" ) );
420 else if( firstNonWhitespace( ii, &whitespaceCount ) == '#' )
421 m_te->DeleteRange( m_te->PositionFromLine( ii ) + whitespaceCount, 1 );
422 }
423
424 m_te->SetSelection( m_te->PositionFromLine( startLine ),
425 m_te->PositionFromLine( endLine ) + m_te->GetLineLength( endLine ) );
426
427 m_te->EndUndoAction();
428 }
429#ifdef __WXMAC__
430 else if( aEvent.GetModifiers() == wxMOD_RAW_CONTROL && aEvent.GetKeyCode() == 'A' )
431 {
432 m_te->HomeWrap();
433 }
434 else if( aEvent.GetModifiers() == wxMOD_RAW_CONTROL && aEvent.GetKeyCode() == 'E' )
435 {
436 m_te->LineEndWrap();
437 }
438 else if( ( aEvent.GetModifiers() & wxMOD_RAW_CONTROL ) && aEvent.GetKeyCode() == 'B' )
439 {
440 if( aEvent.GetModifiers() & wxMOD_ALT )
441 m_te->WordLeft();
442 else
443 m_te->CharLeft();
444 }
445 else if( ( aEvent.GetModifiers() & wxMOD_RAW_CONTROL ) && aEvent.GetKeyCode() == 'F' )
446 {
447 if( aEvent.GetModifiers() & wxMOD_ALT )
448 m_te->WordRight();
449 else
450 m_te->CharRight();
451 }
452 else if( aEvent.GetModifiers() == wxMOD_RAW_CONTROL && aEvent.GetKeyCode() == 'D' )
453 {
454 if( m_te->GetSelectionEnd() == m_te->GetSelectionStart() )
455 m_te->CharRightExtend();
456
457 if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() )
458 m_te->DeleteBack();
459 }
460#endif
461 else if( aEvent.GetKeyCode() == WXK_SPECIAL20 )
462 {
463 // Proxy for a wxSysColourChangedEvent
464 setupStyles();
465 }
466 else
467 {
468 aEvent.Skip();
469 }
470}
471
472
473int SCINTILLA_TRICKS::firstNonWhitespace( int aLine, int* aWhitespaceCharCount )
474{
475 int lineStart = m_te->PositionFromLine( aLine );
476
477 if( aWhitespaceCharCount )
478 *aWhitespaceCharCount = 0;
479
480 for( int ii = 0; ii < m_te->GetLineLength( aLine ); ++ii )
481 {
482 int c = m_te->GetCharAt( lineStart + ii );
483
484 if( c == ' ' || c == '\t' )
485 {
486 if( aWhitespaceCharCount )
487 *aWhitespaceCharCount += 1;
488
489 continue;
490 }
491 else
492 {
493 return c;
494 }
495 }
496
497 return '\r';
498}
499
500
501void SCINTILLA_TRICKS::onScintillaUpdateUI( wxStyledTextEvent& aEvent )
502{
503 auto isBrace = [this]( int c ) -> bool
504 {
505 return m_braces.Find( (wxChar) c ) >= 0;
506 };
507
508 // Has the caret changed position?
509 int caretPos = m_te->GetCurrentPos();
510 int selStart = m_te->GetSelectionStart();
511 int selEnd = m_te->GetSelectionEnd();
512
513 if( m_lastCaretPos != caretPos || m_lastSelStart != selStart || m_lastSelEnd != selEnd )
514 {
515 m_lastCaretPos = caretPos;
516 m_lastSelStart = selStart;
517 m_lastSelEnd = selEnd;
518 int bracePos1 = -1;
519 int bracePos2 = -1;
520
521 // Is there a brace to the left or right?
522 if( caretPos > 0 && isBrace( m_te->GetCharAt( caretPos-1 ) ) )
523 bracePos1 = ( caretPos - 1 );
524 else if( isBrace( m_te->GetCharAt( caretPos ) ) )
525 bracePos1 = caretPos;
526
527 if( bracePos1 >= 0 )
528 {
529 // Find the matching brace
530 bracePos2 = m_te->BraceMatch( bracePos1 );
531
532 if( bracePos2 == -1 )
533 {
534 m_te->BraceBadLight( bracePos1 );
535 m_te->SetHighlightGuide( 0 );
536 }
537 else
538 {
539 m_te->BraceHighlight( bracePos1, bracePos2 );
540 m_te->SetHighlightGuide( m_te->GetColumn( bracePos1 ) );
541 }
542 }
543 else
544 {
545 // Turn off brace matching
546 m_te->BraceHighlight( -1, -1 );
547 m_te->SetHighlightGuide( 0 );
548 }
549 }
550}
551
552
554 const std::function<void( const wxString& xRef, wxArrayString* tokens )>& getTokensFn )
555{
556 wxArrayString autocompleteTokens;
557 int text_pos = m_te->GetCurrentPos();
558 int start = m_te->WordStartPosition( text_pos, true );
559 wxString partial;
560
561 auto textVarRef =
562 [&]( int pos )
563 {
564 return pos >= 2 && m_te->GetCharAt( pos-2 ) == '$' && m_te->GetCharAt( pos-1 ) == '{';
565 };
566
567 // Check for cross-reference
568 if( start > 1 && m_te->GetCharAt( start-1 ) == ':' )
569 {
570 int refStart = m_te->WordStartPosition( start-1, true );
571
572 if( textVarRef( refStart ) )
573 {
574 partial = m_te->GetRange( start, text_pos );
575 getTokensFn( m_te->GetRange( refStart, start-1 ), &autocompleteTokens );
576 }
577 }
578 else if( textVarRef( start ) )
579 {
580 partial = m_te->GetTextRange( start, text_pos );
581 getTokensFn( wxEmptyString, &autocompleteTokens );
582 }
583
584 DoAutocomplete( partial, autocompleteTokens );
585 m_te->SetFocus();
586}
587
588
589void SCINTILLA_TRICKS::DoAutocomplete( const wxString& aPartial, const wxArrayString& aTokens )
590{
592 return;
593
594 wxArrayString matchedTokens;
595
596 wxString filter = wxT( "*" ) + aPartial.Lower() + wxT( "*" );
597
598 for( const wxString& token : aTokens )
599 {
600 if( token.Lower().Matches( filter ) )
601 matchedTokens.push_back( token );
602 }
603
604 if( matchedTokens.size() > 0 )
605 {
606 // NB: tokens MUST be in alphabetical order because the Scintilla engine is going
607 // to do a binary search on them
608 matchedTokens.Sort( []( const wxString& first, const wxString& second ) -> int
609 {
610 return first.CmpNoCase( second );
611 });
612
613 m_te->AutoCompShow( aPartial.size(), wxJoin( matchedTokens, m_te->AutoCompGetSeparator() ) );
614 }
615}
616
617
619{
620 m_te->AutoCompCancel();
621}
622
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:88
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition: color4d.h:311
double a
Alpha component.
Definition: color4d.h:395
wxColour ToColour() const
Definition: color4d.cpp:220
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:295
void onChar(wxStyledTextEvent &aEvent)
int firstNonWhitespace(int aLine, int *aWhitespaceCount=nullptr)
virtual void onCharHook(wxKeyEvent &aEvent)
std::function< void(wxKeyEvent &aEvent)> m_onAcceptFn
void onThemeChanged(wxSysColourChangedEvent &aEvent)
void DoAutocomplete(const wxString &aPartial, const wxArrayString &aTokens)
void onScintillaUpdateUI(wxStyledTextEvent &aEvent)
void DoTextVarAutocomplete(const std::function< void(const wxString &xRef, wxArrayString *tokens)> &getTokensFn)
std::function< void(wxStyledTextEvent &aEvent)> m_onCharAddedFn
void onModified(wxStyledTextEvent &aEvent)
SCINTILLA_TRICKS(wxStyledTextCtrl *aScintilla, const wxString &aBraces, bool aSingleLine, std::function< void(wxKeyEvent &)> onAcceptHandler=[](wxKeyEvent &aEvent) { }, std::function< void(wxStyledTextEvent &)> onCharAddedHandler=[](wxStyledTextEvent &) { })
wxStyledTextCtrl * m_te
This file is part of the common library.
KICOMMON_API wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:92
STL namespace.
bool isCtrlSlash(wxKeyEvent &aEvent)
std::vector< FAB_LAYER_COLOR > dummy
bool ConvertSmartQuotesAndDashes(wxString *aString)
Convert curly quotes and em/en dashes to straight quotes and dashes.
Functions to provide common constants and other functions to assist in making a consistent UI.