From: Julian Smart Date: Wed, 5 Jun 2002 21:06:18 +0000 (+0000) Subject: Added Delete member to wxStringHashTable in order to implement X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/53e112a093bb479c8032fad7467690196c67c2c6 Added Delete member to wxStringHashTable in order to implement wxHelpProvider::RemoveHelp, which is now called from ~wxWindowBase. Without cleaning up the hash tables, reused window addresses will cause the CS help to fail rather comically over time. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/html/faqgen.htm b/docs/html/faqgen.htm index d7fad5bc19..43776e0578 100644 --- a/docs/html/faqgen.htm +++ b/docs/html/faqgen.htm @@ -1,4 +1,3 @@ - @@ -31,6 +30,7 @@ See also top-level FAQ page.
  • How does wxWindows 2 support platform-specific features?
  • Does wxWindows use STL? or the standard string class?
  • Is there a rich edit/markup widget for wxWindows 2? +
  • How to use C++ exceptions with wxWindows?
  • How is wxWindows 2 being developed?
  • How is wxWindows 2 distributed?
  • What are the plans for the future?
  • @@ -172,6 +172,34 @@ no wxWindows wrapper for these (but text attribute functions are being added in

    +

    How to use C++ exceptions with wxWindows?

    + +wxWindows library itself is unfortunately not exception-safe (as its +initial version predates, by far, the addition of the exceptions to the C++ +language). However you can still use the exceptions in your own code and use +the other libraries using the exceptions for the error reporting together with +wxWindows. + +

    +There are a few issues to keep in mind, though: +

    + +

    +

    How is wxWindows 2 being developed?

    We are using the CVS system to develop and maintain wxWindows. This allows diff --git a/docs/html/faqgtk.htm b/docs/html/faqgtk.htm index e89b148d98..54bbdb5c10 100644 --- a/docs/html/faqgtk.htm +++ b/docs/html/faqgtk.htm @@ -28,6 +28,8 @@ See also top-level FAQ page.
  • Does wxGTK have GNOME support?
  • Warning about GTK libraries supplied with RedHat
  • What is wxWindows 2 for GTK?
  • +
  • What range of Intel Linux platforms will a given application binary be usable on?
  • +
    wxWindows 2 for GTK is a port of wxWindows to the
    GTK+ toolkit, @@ -53,6 +55,17 @@ the client will get notified twice, first getting a LOST event and then a CONNEC This problem can be solved by updating GTK with an official distribution of the library.

    +

    What range of Intel Linux platforms will a given application binary be usable on?

    + +Robert Roebling replies:

    + +"The important thing is the libc version that your app +is linked against. The most recent version is 2.2.5 +and programs linked against it will not run with version +2.1.X so that you will fare best if you compile your app +on a 2.1.X system. It will then run on practically all +Linux distros (if you link you app statically against +the image libraries and std C++ lib)." diff --git a/docs/html/faqmac.htm b/docs/html/faqmac.htm index 61fa399ff6..722f83ca55 100644 --- a/docs/html/faqmac.htm +++ b/docs/html/faqmac.htm @@ -25,10 +25,10 @@ See also top-level FAQ page.


    List of questions in this category


    -

    When is wxMac 2.x due to be released?

    -There is a preview available. -The author of this port is Stefan Csomor. -

    - - - - - -
    - - -Please note that the version of wxMac in CVS is more robust and nearly feature-complete compared with the packaged 2.0 release. -Until a new release is made, it is recommended that you download the wxMac 2.3.1 development snapshot or the sources from the CVS trunk. - -
    +

    Where should I download wxMac from?

    +Please see the downloads page. +The version of wxMac in CVS advances quickly so it is recommended that you download the +the sources from the CVS trunk. +There is also a wxMac 2.3.1 development snapshot. +

    +The author of this port is Stefan Csomor.

    Which Mac platforms are supported?

    diff --git a/docs/html/platform.htm b/docs/html/platform.htm index 2bab78399c..f9c96fc26b 100644 --- a/docs/html/platform.htm +++ b/docs/html/platform.htm @@ -1,4 +1,3 @@ - Platforms supported by wxWindows 2.x @@ -118,10 +117,15 @@ often don't work. -IRIX - wxGTKOk
    You may need to use --disable-catch_segvs if you get compiler error in utilsunx.cpp - wxMotif with MIPSPro 7.30OkDavid MarshallOn IRIX 6.5.6 (Indigo2, 64bit), with SGI Motif 1.2 - wxMotif with "CC -mips3 -n32"OkIanYou need to set LD_LIBRARYN32_PATH +IRIX + + Note that all entries use MIPSPro 7.3 compiler on IRIX 6.5.9 with -mips3 -n32 flags if not mentioned otherwise. + Also note that you need to set LD_LIBRARYN32_PATH under IRIX to run wxWindows programs. + + wxGTK 2.2OkIanYou may need to use --disable-catch_segvs if you get compiler error in utilsunx.cpp + wxGTK 2.3OkCarl Godkin
    + wxMotifOkDavid MarshallOn IRIX 6.5.6 (Indigo2, 64bit), with SGI Motif 1.2 + OkIan
    diff --git a/include/wx/cshelp.h b/include/wx/cshelp.h index e53d48efcc..d72a3d9254 100644 --- a/include/wx/cshelp.h +++ b/include/wx/cshelp.h @@ -124,6 +124,9 @@ public: // the application, for example) virtual void AddHelp(wxWindowID id, const wxString& text); + // removes the association + virtual void RemoveHelp(wxWindowBase* window); + // virtual dtor for any base class virtual ~wxHelpProvider(); @@ -142,6 +145,7 @@ public: virtual bool ShowHelp(wxWindowBase *window); virtual void AddHelp(wxWindowBase *window, const wxString& text); virtual void AddHelp(wxWindowID id, const wxString& text); + virtual void RemoveHelp(wxWindowBase* window); protected: // we use 2 hashes for storing the help strings associated with windows diff --git a/include/wx/hash.h b/include/wx/hash.h index 557238d6a4..a42138a438 100644 --- a/include/wx/hash.h +++ b/include/wx/hash.h @@ -127,6 +127,9 @@ public: // and the wasFound is set to FALSE if not NULL wxString Get(long key, bool *wasFound = NULL) const; + // remove the item, returning TRUE if the item was found and deleted + bool Delete(long key) const; + // clean up void Destroy(); diff --git a/src/common/cshelp.cpp b/src/common/cshelp.cpp index 43ebbef496..18b62f6f66 100644 --- a/src/common/cshelp.cpp +++ b/src/common/cshelp.cpp @@ -301,6 +301,11 @@ void wxHelpProvider::AddHelp(wxWindowID WXUNUSED(id), { } +// removes the association +void wxHelpProvider::RemoveHelp(wxWindowBase* WXUNUSED(window)) +{ +} + wxHelpProvider::~wxHelpProvider() { } @@ -329,6 +334,12 @@ void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text) m_hashIds.Put(id, text); } +// removes the association +void wxSimpleHelpProvider::RemoveHelp(wxWindowBase* window) +{ + m_hashWindows.Delete((long)window); +} + bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window) { #if wxUSE_TIPWINDOW diff --git a/src/common/hash.cpp b/src/common/hash.cpp index 1c268e7c97..50d99ed1b2 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp @@ -310,6 +310,30 @@ wxString wxStringHashTable::Get(long key, bool *wasFound) const return _T(""); } +bool wxStringHashTable::Delete(long key) const +{ + wxCHECK_MSG( m_hashSize, FALSE, _T("must call Create() first") ); + + size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); + + wxArrayLong *keys = m_keys[slot]; + if ( keys ) + { + size_t count = keys->GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + if ( keys->Item(n) == key ) + { + keys.RemoveAt(n); + m_values[slot]->RemoveAt(n); + return TRUE; + } + } + } + + return FALSE; +} + // ---------------------------------------------------------------------------- // old not type safe wxHashTable // ----------------------------------------------------------------------------