Commit graph

74483 commits

Author SHA1 Message Date
Vadim Zeitlin
35c35c235e Remove wxUSE_STL which is not really used any longer
wxString is always based on std::[w]string since 2c0c727f49 (Remove wx
own wxStringImpl implementation, 2022-11-16) and all containers use
standard containers by default too now -- and there is a separate
wxUSE_STD_CONTAINERS for this anyhow.

The only remaining use of wxUSE_STL was as the default value for
wxUSE_STD_STRING_CONV_IN_WXSTRING option, but it's not really needed
for this neither, and this option can just be set to 0 by default.

Also add wxUSE_CHAR_CONV_IN_WXSTRING which can now be set to 0 too to
disable all unwanted implicit conversions (even "safe" ones, to wide
strings, in addition to the unsafe ones to narrow strings that could be
already disabled with wxUSE_UNSAFE_WXSTRING_CONV) to allow people who
don't want to have any implicit conversions at all to do it.

Keep --enable-stl configure option for compatibility, but warn if it is
used to tell people that it is not needed any longer.
2023-04-15 17:22:09 +02:00
Vadim Zeitlin
d65eed50fa Replace some occurrences of wxUSE_STL with wxUSE_STD_CONTAINERS
The latter option will remain, while the former one won't be used at all
any longer soon, so prefer using the latter whenever possible.
2023-04-15 15:14:41 +01:00
Vadim Zeitlin
4c8bf1e9e7 Don't mention wxString::GetWriteBuf() in the documentation
This function doesn't exist any longer since 5e2da5a106 (Get rid of v2.8
code, 2022-08-01).

Remove documentation of this function and its UngetWriteBuf()
counterpart and don't refer to them in wxStringBuffer[Length]
documentation.
2023-04-15 15:08:37 +01:00
Vadim Zeitlin
fb17a5ac38 Merge branch 'use-std-cont-1'
Set wxUSE_STD_CONTAINERS=1 by default.

See #23439.
2023-04-15 15:46:08 +02:00
Vadim Zeitlin
5e7b08f9ea Correct wxDC::GetContentScaleFactor() documentation
Document that it returns the same value as GetDPIScaleFactor() wxWindow
method and _not_ the wxWindow method with the same name.

This is very confusing, but there doesn't seem to be anything to be done
about it by now.

See #23441.
2023-04-13 15:07:32 +02:00
Vadim Zeitlin
030dd6d79b Document that applications are always DPI-aware with wxGTK
Also mention that fractional scaling is not currently supported under
this platform.

See #23441.
2023-04-13 14:57:16 +02:00
Vadim Zeitlin
71a64c25fa Merge branch 'im/choiceperf' of https://github.com/imciner2/wxWidgets
Improve performance of inserting many items in wxComboBox in wxGTK.

See #23443.
2023-04-12 19:33:11 +02:00
Vadim Zeitlin
6485e0200f Define __WXGTK20__ again for wxGTK 3 builds
This was accidentally broken in fb4f0b590c (Remove wxGTK1 port and GPE
support, 2022-10-16): even though the commit message explicitly said
that __WXGTK20__ was still defined, it actually wasn't any more.

Fix this now by just doing it always when using wxGTK. This allows to
drop WXGTK2 variable entirely, as it's not used any longer and we don't
need to set it.

Closes #23444.
2023-04-12 19:30:57 +02:00
Ian McInerney
01e61f6e7f Remove GTKInsertComboBoxTextItem completely
Instead of having a special function for this, collapse it down into the
DoInsertItems function to allow for only querying the model once from
the combobox.

This function is considered private because of the GTK prefix, so its
removal isn't API-breaking.
2023-04-12 17:55:27 +01:00
Ian McInerney
1ef312a0be Remove overriden GTKInsertComboBoxTextItem from bitmap combobox
The base function now has this exact functionality, but is faster.
2023-04-12 17:55:27 +01:00
Ian McInerney
983608c0f2 Replace gtk_combo_box_text_insert_text with direct model insertion
There is a lot of overhead in the gtk_combo_box_text_insert_text
function, so adding a lot of items to a choicebox can be an expensive
operation when it is used. Instead directly access the underlying data
model and add the items to it.

Experiments show that for adding 10000 items to a wxChoice, the amount
of time spent in wxChoice::DoInsertItems for each method are:
    gtk_combo_box_text_insert_text: 6.75s
    gtk_list_store_insert_with_values: 438.2ms
2023-04-12 17:55:27 +01:00
Vadim Zeitlin
d6fc5230e0 Remove src/msw/gdiobj.cpp which seems to have been never used
Somewhat incredibly, this file, added back in 2bda0e1738 (added some
wxMSW stuff, 1998-05-20), never contained anything but some commented
out code and so was always totally useless.

Finally remove it.
2023-04-12 17:28:45 +02:00
Vadim Zeitlin
bc3acf429e Fix formatting in wxDisplay::GetPPI() documentation
Avoid putting wxSize(0,0) on two lines.
2023-04-12 17:02:07 +02:00
Vadim Zeitlin
0fc251bfca Remove support for using X fonts
This was used by wxGTK 1, which is not supported any longer, and wxX11,
which now always uses Pango instead, so all this code became completely
unused and can be removed to simplify things.

Closes #23442.
2023-04-12 16:44:55 +02:00
Vadim Zeitlin
102600eb37 Fix deleting taskbar icon in wxMSW wxNotificationMessage
Previously, the taskbar icon could remain shown in the taskbar after
wxNotificationMessage was destroyed, as wxEVT_TASKBAR_BALLOON_TIMEOUT
handler was called on an already dead object.

Weirdly enough this didn't result in the crashes, but it definitely
didn't work correctly neither.

Fix this by binding a separate handler for this event, not using the
wxNotificationMessage object at all, which is responsible for destroying
the icon when it times out.

This also seems to make it completely unnecessary to have a separate
m_active flag in wxNotificationMessageImpl, as we can now just delete
the "impl" object too directly when the main object itself is deleted.

Closes #23432.
2023-04-12 16:44:11 +02:00
Vadim Zeitlin
8fd4f5e79d Merge branch 'to-from-chars' into drop-x-fonts
Use C++17 std::{to,from}_chars() for conversions between wxString and
numbers in C locale.

See #23422.
2023-04-12 16:42:03 +02:00
Vadim Zeitlin
0964b93ccd Add a CI build using wx implementation of container classes
As long as we support building with wxUSE_STD_CONTAINERS==0, we need to
test that this build still works.
2023-04-10 20:40:00 +01:00
Vadim Zeitlin
89e4f51f62 Update documentation after setting wxUSE_STD_CONTAINERS=1
Explain that the legacy container classes now inherit from the standard
classes by default and also how to update the existing code to compile
when using standard library-based implementations.
2023-04-10 20:39:50 +01:00
Vadim Zeitlin
3335be1362 Document WX_DECLARE_LIST and WX_DEFINE_LIST macros
Even though they're deprecated, they should still be documented, just as
similar WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY are.
2023-04-10 20:31:47 +01:00
Vadim Zeitlin
50261bb88f Disable use of std::unordered_map<> with gcc 4.8 for wx hash maps
Due to a bug in gcc 4.8 standard library, inheriting from the standard
class doesn't work, so we can't use it as the base class for our own
containers with this compiler.
2023-04-10 18:51:12 +01:00
Vadim Zeitlin
b934a6f27e Add special define allowing to check for gcc 4.8
This will allow to find all the places with the workarounds for this
ancient compiler version more easily in the future, when we drop support
for it.
2023-04-10 18:50:27 +01:00
Vadim Zeitlin
e273d45c9b Enable use of the standard container classes by default
This is mostly, even if not completely, compatible with the previous
default build using wxUSE_STD_CONTAINERS=0, so try enabling this by
default again. Hopefully it should work better now than the last time we
tried it, see 01871bf642 (Add wxUSE_STD_CONTAINERS and turn it on by
default., 2011-03-30) and the subsequent 7311debd0d (Don't use the
standard containers by default., 2011-05-13).

See #22718.
2023-04-10 17:00:32 +01:00
Vadim Zeitlin
de1dca5ff1 Remove an unnecessary test for wxUSE_STD_CONTAINERS
Remove the extra initialization which was supposed to avoid a compiler
warning that doesn't seem to happen any more.
2023-04-10 17:00:32 +01:00
Vadim Zeitlin
3a96c34e12 Make wxStack an alias template instead of a macro in STL build
Just avoid the unnecessary use of the preprocessor.
2023-04-10 17:00:32 +01:00
Vadim Zeitlin
1e9b84cd27 Remove unnecessary <numeric> inclusion from wxPropGrid header
This isn't needed any longer since the changes of 4c463c416d (Use
std::vector instead of wxVector in wxPropertyGrid, 2023-01-22).

No real changes.
2023-04-10 17:00:32 +01:00
Vadim Zeitlin
bbb5d1b637 Deprecate useless wxResourceCache class
This is just a trivial wrapper for wxList, which is itself obsolete, so
deprecate it and schedule for removal in wx 3.6.

Also move it entirely inline and don't export it from the DLL any longer
both because this avoids generating any code for it if it's not used (as
should be the case for 99.99% of wx applications) and because we
currently can't use wxDEPRECATED_MSG() and WXDLLIMPEXP_CORE together in
the same declaration.
2023-04-10 16:59:05 +01:00
Vadim Zeitlin
61f2fb078b Merge branch 'remove-wxT-from-docs'
Remove most occurrences of wxT() from the docs.

See #23436.
2023-04-10 16:22:42 +02:00
Vadim Zeitlin
15936efed9 Merge branch 'use-stl-tweaks'
Minor changes related to wxUSE_STL.

See #23435.
2023-04-10 16:21:36 +02:00
Vadim Zeitlin
58a7b7b31b Merge branch 'arrstr-from-vector'
Improve interoperability between wxArrayString and std::vector.

See #23434, #23036.
2023-04-10 16:20:16 +02:00
Vadim Zeitlin
60dacae204 Make it more clear that wxT_2() is obsolete
Say it explicitly and remove example of its use which shouldn't needed
any longer.
2023-04-10 14:25:27 +02:00
Vadim Zeitlin
41d0313f52 Update wxT() documentation after ASCII build removal
Explain that this macro always expands into a wide-string now.
2023-04-10 14:25:02 +02:00
PB
d378444010 Remove most occurrences of wxT() from the docs
wxT() macro rarely needed now, so do not use it in the docs
unless it is required.
2023-04-09 20:35:49 +02:00
Vadim Zeitlin
6ea0589ed3 Remove unnecessary wxUSE_STL test from HTML parser benchmark
The same code can be used in STL and non-STL builds.
2023-04-09 02:33:22 +02:00
Vadim Zeitlin
36009b02b3 Always catch std::exception, not just in STL build
There is no reason not to do it even when wxUSE_STL==0 any longer.
2023-04-09 02:33:22 +02:00
Vadim Zeitlin
bf3d6374d6 Recommend against using wxList in the new code
Make it clear that it's yet another legacy class.
2023-04-09 02:33:22 +02:00
Vadim Zeitlin
e9527ee5a2 Define wxArchiveIterator in all builds, not just STL one
Doing this doesn't introduce any backwards compatibility problems, so do
it always, and not only when wxUSE_STL==1.
2023-04-09 02:33:22 +02:00
Vadim Zeitlin
e832ebbacc Add wxArrayString::AsVector() too
This provides the conversion in the other direction, which is needed
less often but it's still arguably better to have it than not to.
2023-04-08 22:45:11 +01:00
Vadim Zeitlin
23981273df Document that wxArrayString is a legacy class
Explain that it's only needed in order to pass a bunch of strings to the
existing function and also mention that it doesn't even need to be
created explicitly in most cases.
2023-04-08 22:29:12 +01:00
Vadim Zeitlin
a8abdee9a4 Remove wxArrayString::Init() in non-STL build
Replace it with member initialization in declaration.

This simplifies the code and allows to get rid of several conditional
compilation directives.

No real changes.
2023-04-08 22:17:20 +01:00
Vadim Zeitlin
cee7611c6a Add wxArrayString ctor from std::vector
Allow constructing wxArrayString from vectors of any compatible type,
including wxString itself as well as std::string or std::wstring.
2023-04-08 20:22:48 +02:00
Vadim Zeitlin
ae2e0f41b5 Stop defining wxArrayStringBase in STL build
It seems to be completely unnecessary, just use wxBaseArray<wxString>
directly.

Also remove some very old mention of wxArrayStringBase from ifacecheck
which is surely not needed any longer now (and probably wasn't since
quite some time already).

No real changes.
2023-04-08 20:18:58 +02:00
Vadim Zeitlin
208d751e9c Remove unnecessary includes from wx/arrstr.h
Both standard headers are already included from wx/dynarray.h, so there
is no need to include them again here.
2023-04-08 20:18:24 +02:00
Vadim Zeitlin
d0e892ac09 Merge branch 'toolbar-docs'
Improve wxToolBar documentation.

See #23427.
2023-04-08 16:35:51 +02:00
Vadim Zeitlin
a459580052 Fix remark about labels under Mac in wxToolBar::AddControl()
Use "new" (only used since 292e5e1f17 (OSX renaming round 2, 2008-07-30)
name of the preprocessor constant and mention that it's enabled by
default.
2023-04-08 16:32:03 +02:00
Vadim Zeitlin
4799785b6d Improve code in gtk_window_key_press_callback()
Don't use isalpha() in it as this was potentially incorrect, both
because the key code could be not in the supported range and because
isalpha() might return unexpected result in non C locale, and also
inconsistent with AdjustCharEventKeyCodes().

Just check that the code is in a..z or A..Z range explicitly instead.

See #23379.
2023-04-08 16:26:53 +02:00
Vadim Zeitlin
435efa8b5a Mark new language constants as being new since wx 3.3.1
Add a convenient @since_wx alias which is more appropriate for
single-line comments than the standard @since, which would expand into
two paragraphs.

See #23426.
2023-04-08 14:50:47 +02:00
utelle
c8d2244c63 Update language database and fix some problems in it
Update the list of known languages/locales to match the list of known
locales in Windows 11, adding support for a number of new locales.

Additionally, the issues mentioned in #23419 are fixed, except the
native descriptions of Northern Luri (Luri translations of the
territories are not known).

Closes #23419.

Closes #23426.
2023-04-08 14:47:48 +02:00
PB
17b25122e2 Update wxToolBar documentation
Remove information relevant only for Pocket PC and also fix a
mistyped word.
2023-04-07 09:51:06 +02:00
Vadim Zeitlin
c4fc9d3444 Improve "Hello world" documentation page
Try to explain important things better, notably mention that all
pointers are owned by wxWidgets and why is wxIMPLEMENT_APP() macro
needed.
2023-04-06 22:07:32 +02:00
Vadim Zeitlin
dd45844670 Don't rely on wxUILocale in wxString::{To,From}CDouble()
This didn't work correctly if the global C locale was changed without
passing by wxUILocale and also was slower than just falling back on
using comma if the current locale doesn't use period as decimal
separator.

Now just try both period and comma as, de facto, these are the only
possible decimal separators.

Closes #23287.
2023-04-05 21:01:59 +02:00