Remove wxUSE_UNICODE checks as they're always true now

Also remove all code guarded by "#if !wxUSE_UNICODE".
This commit is contained in:
Vadim Zeitlin 2022-10-27 02:43:51 +01:00
parent 5c49448c75
commit 4519d8e08a
195 changed files with 400 additions and 3509 deletions

View file

@ -823,10 +823,10 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel,
m_music_model = new MyMusicTreeModel;
m_ctrl[Page_Music]->AssociateModel( m_music_model.get() );
#if wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
#if wxUSE_DRAG_AND_DROP
m_ctrl[Page_Music]->EnableDragSource( wxDF_UNICODETEXT );
m_ctrl[Page_Music]->EnableDropTarget( wxDF_UNICODETEXT );
#endif // wxUSE_DRAG_AND_DROP && wxUSE_UNICODE
#endif // wxUSE_DRAG_AND_DROP
// column 0 of the view control:
@ -1768,12 +1768,9 @@ void MyFrame::OnSorted( wxDataViewEvent &event )
void MyFrame::OnDataViewChar(wxKeyEvent& event)
{
wxString key;
#if wxUSE_UNICODE
if ( event.GetUnicodeKey() != WXK_NONE )
key.Printf("\"%c\"", event.GetUnicodeKey());
else
#endif
if ( event.GetKeyCode() != WXK_NONE )
else if ( event.GetKeyCode() != WXK_NONE )
key.Printf("wxKeyCode(%d)", event.GetKeyCode());
else
key = "unknown key";

View file

@ -38,11 +38,9 @@ protected:
s += wxString(static_cast<const char *>(data), size);
break;
#if wxUSE_UNICODE
case wxIPC_UNICODETEXT:
s += wxString(static_cast<const wchar_t *>(data), size);
break;
#endif // wxUSE_UNICODE
case wxIPC_UTF8TEXT:
s += wxString::FromUTF8(static_cast<const char *>(data), size);

View file

@ -531,11 +531,9 @@ wxString GetKeyName(const wxKeyEvent &event)
if ( keycode >= 32 && keycode < 128 )
return wxString::Format("'%c'", (unsigned char)keycode);
#if wxUSE_UNICODE
int uc = event.GetUnicodeKey();
if ( uc != WXK_NONE )
return wxString::Format("'%c'", uc);
#endif
return "unknown";
}
@ -546,11 +544,7 @@ void MyFrame::LogEvent(const wxString& name, wxKeyEvent& event)
wxString msg;
// event key_name KeyCode modifiers Unicode raw_code raw_flags pos
msg.Printf("%7s %15s %5d %c%c%c%c"
#if wxUSE_UNICODE
"%5d (U+%04x)"
#else
" none "
#endif
#ifdef wxHAS_RAW_KEY_CODES
" %7lu 0x%08lx"
#else
@ -566,10 +560,8 @@ void MyFrame::LogEvent(const wxString& name, wxKeyEvent& event)
event.AltDown() ? 'A' : '-',
event.ShiftDown() ? 'S' : '-',
event.MetaDown() ? 'M' : '-'
#if wxUSE_UNICODE
, event.GetUnicodeKey()
, event.GetUnicodeKey()
#endif
#ifdef wxHAS_RAW_KEY_CODES
, (unsigned long) event.GetRawKeyCode()
, (unsigned long) event.GetRawKeyFlags()

View file

@ -159,11 +159,9 @@ void MyApp::Draw(wxDC&dc)
dc.DrawRotatedText( "This\nis\na multi-line\ntext", dc.FromDIP(170), dc.FromDIP(100), -m_angle/1.5);
#if wxUSE_UNICODE
const char *test = "Hebrew שלום -- Japanese (日本語)";
wxString tmp = wxConvUTF8.cMB2WC( test );
dc.DrawText( tmp, dc.FromDIP(10), dc.FromDIP(200) );
#endif
wxPoint points[5];
points[0].x = 0;

View file

@ -2713,15 +2713,11 @@ void FormMain::OnAbout(wxCommandEvent& WXUNUSED(event))
wxString msg;
msg.Printf( "wxPropertyGrid Sample"
#if wxUSE_UNICODE
#if defined(wxUSE_UNICODE_UTF8) && wxUSE_UNICODE_UTF8
" <utf-8>"
#else
" <unicode>"
#endif
#else
" <ansi>"
#endif
#ifdef __WXDEBUG__
" <debug>"
#else

View file

@ -717,9 +717,7 @@ void MyTextCtrl::LogKeyEvent(const wxString& name, wxKeyEvent& event) const
}
}
#if wxUSE_UNICODE
key += wxString::Format(" (Unicode: %#04x)", event.GetUnicodeKey());
#endif // wxUSE_UNICODE
wxLogMessage( "%s event: %s (flags = %c%c%c%c)",
name,
@ -1184,11 +1182,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_horizontal->SetFont(wxFontInfo(18)
.Family(wxFONTFAMILY_SWISS)
.Encoding(wxFONTENCODING_CP1251));
#if wxUSE_UNICODE
m_horizontal->AppendText(L"\x0412\x0430\x0434\x0438\x043c \x0426");
#else
m_horizontal->AppendText("\313\301\326\305\324\323\321 \325\304\301\336\316\331\315");
#endif
}
}
else

View file

@ -45,9 +45,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(MyApp, wxApp);
wxBEGIN_EVENT_TABLE(MyApp, wxApp)
EVT_MENU(TYPES_VARIANT, MyApp::DoVariantDemo)
EVT_MENU(TYPES_BYTEORDER, MyApp::DoByteOrderDemo)
#if wxUSE_UNICODE
EVT_MENU(TYPES_UNICODE, MyApp::DoUnicodeDemo)
#endif // wxUSE_UNICODE
EVT_MENU(TYPES_STREAM, MyApp::DoStreamDemo)
EVT_MENU(TYPES_STREAM2, MyApp::DoStreamDemo2)
EVT_MENU(TYPES_STREAM3, MyApp::DoStreamDemo3)
@ -83,9 +81,7 @@ bool MyApp::OnInit()
wxMenu *test_menu = new wxMenu;
test_menu->Append(TYPES_VARIANT, "&Variant test");
test_menu->Append(TYPES_BYTEORDER, "&Byteorder test");
#if wxUSE_UNICODE
test_menu->Append(TYPES_UNICODE, "&Unicode test");
#endif // wxUSE_UNICODE
test_menu->Append(TYPES_STREAM, "&Stream test");
test_menu->Append(TYPES_STREAM2, "&Stream seek test");
test_menu->Append(TYPES_STREAM3, "&Stream error test");
@ -870,7 +866,6 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event))
textCtrl.WriteText( str );
}
#if wxUSE_UNICODE
void MyApp::DoUnicodeDemo(wxCommandEvent& WXUNUSED(event))
{
wxTextCtrl& textCtrl = * GetTextCtrl();
@ -889,7 +884,6 @@ void MyApp::DoUnicodeDemo(wxCommandEvent& WXUNUSED(event))
puts( str.mbc_str() );
}
#endif
void MyApp::DoMIMEDemo(wxCommandEvent& WXUNUSED(event))
{

View file

@ -29,9 +29,7 @@ public:
void DoStreamDemo5(wxCommandEvent& event);
void DoStreamDemo6(wxCommandEvent& event);
void DoStreamDemo7(wxCommandEvent& event);
#if wxUSE_UNICODE
void DoUnicodeDemo(wxCommandEvent& event);
#endif // wxUSE_UNICODE
void DoMIMEDemo(wxCommandEvent& event);
wxTextCtrl* GetTextCtrl() const { return m_textCtrl; }

View file

@ -39,11 +39,7 @@ using namespace std;
struct wxObjectCodeReaderCallback::wxObjectCodeReaderCallbackInternal
{
#if wxUSE_UNICODE
map<int,wstring> m_objectNames;
#else
map<int,string> m_objectNames;
#endif
void SetObjectName(int objectID, const wxString &name )
{