Added support for tabs in wxRichTextCtrl (Ashish More)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5,12 +5,12 @@ wxWidgets Change Log - For more verbose changes, see the manual
|
||||
INCOMPATIBLE CHANGES SINCE 2.6.x
|
||||
================================
|
||||
|
||||
- wxFontData::GetColour() now returns a const colour
|
||||
- wxFontData::GetColour() now returns a const colour.
|
||||
- wxDC objects can't be created directly now (this never worked, now it doesn't
|
||||
even compile)
|
||||
even compile).
|
||||
- For all wxInputStreams, Eof() becomes true after an attempt has been made
|
||||
to read _past_ the end of file.
|
||||
- wxCHECK family of macros now must be followed by a semicolon
|
||||
- wxCHECK family of macros now must be followed by a semicolon.
|
||||
- wxMBConv::cMB2WC() and cWC2MB() take size of the input buffer and return
|
||||
length of the converted string in all cases now.
|
||||
- wxHtmlWindow::OnCellClicked() now returns bool.
|
||||
@@ -23,17 +23,17 @@ INCOMPATIBLE CHANGES SINCE 2.6.x
|
||||
continue to work with WXWIN_COMPATIBILITY_2_6, but should be rewritten to
|
||||
use GetMouseCursor().
|
||||
- wxHtmlCell::AdjustPagebreak() signature has changed, update your code if you
|
||||
override it
|
||||
override it.
|
||||
- wxFontEnumerator::GetFacenames() and GetEncodings() now return arrays and
|
||||
not pointers to arrays
|
||||
- wxStaticBoxSizer now deletes the associated wxStaticBox when it is deleted
|
||||
not pointers to arrays.
|
||||
- wxStaticBoxSizer now deletes the associated wxStaticBox when it is deleted.
|
||||
|
||||
|
||||
Deprecated methods since 2.6.x and their replacements
|
||||
-----------------------------------------------------
|
||||
|
||||
- wxGetWorkingDirectory() deprecated in favour of wxGetCwd()
|
||||
- wxDC::BeginDrawing() and wxDC::EndDrawing() deprecated, just don't use them
|
||||
- wxGetWorkingDirectory() deprecated in favour of wxGetCwd().
|
||||
- wxDC::BeginDrawing() and wxDC::EndDrawing() deprecated, just don't use them.
|
||||
|
||||
|
||||
2.7.0
|
||||
@@ -41,15 +41,15 @@ Deprecated methods since 2.6.x and their replacements
|
||||
|
||||
All:
|
||||
|
||||
- Added positional parameters support to wxVsnprintf() (Francesco Montorsi)
|
||||
- wx(F)File, wxTextFile and wxInputStreams recognize Unicode BOM now
|
||||
- Many fixes for UTF-16/32 handling in Unicode builds
|
||||
- Added positional parameters support to wxVsnprintf() (Francesco Montorsi).
|
||||
- wx(F)File, wxTextFile and wxInputStreams recognize Unicode BOM now.
|
||||
- Many fixes for UTF-16/32 handling in Unicode builds.
|
||||
- wxLaunchDefaultBrowser() now supports wxBROWSER_NEW_WINDOW flag.
|
||||
- Added wxStandardPaths::GetResourcesDir() and GetLocalizedResourcesDir()
|
||||
- Added wxStandardPaths::GetDocumentsDir() (Ken Thomases)
|
||||
- Added wxStandardPaths::GetDocumentsDir() (Ken Thomases).
|
||||
- Added wxStringTokenizer::GetLastDelimiter(); improved documentation.
|
||||
- Fixed wxTextFile in Unicode build
|
||||
- Added possibility to specify dependencies for a wxModule
|
||||
- Fixed wxTextFile in Unicode build.
|
||||
- Added possibility to specify dependencies for a wxModule.
|
||||
- Speed improvements to wxRegEx when matching is done in a loop such as
|
||||
during a search and replace.
|
||||
- Fix regerror and regfree name conficts when built-in regex and system regex
|
||||
@@ -68,36 +68,36 @@ All:
|
||||
- Added support for wxLongLong in wx stream classes (Mark Junker).
|
||||
- wxSOCKET_REUSEADDR can be used with wxSocketClient.
|
||||
- Overloaded Connect() and SetLocal() methods for binding to local address/port.
|
||||
- Albanian translation added (Besnik Bleta)
|
||||
- Assert messages now show the function in which assert failed
|
||||
- wxApp::OnAssertFailure() should now be used instead the old wxApp::OnAssert()
|
||||
- Fixed several bugs in wxDateTime::ParseDate()
|
||||
- Albanian translation added (Besnik Bleta).
|
||||
- Assert messages now show the function in which assert failed.
|
||||
- wxApp::OnAssertFailure() should now be used instead the old wxApp::OnAssert().
|
||||
- Fixed several bugs in wxDateTime::ParseDate().
|
||||
- The WXK*PRIOR and WXK*NEXT constants are now aliases for WXK*PAGEUP
|
||||
and WXK*PAGEDOWN. If you have switch statements that use both
|
||||
constants from a set then you need to remove the PRIOR/NEXT
|
||||
versions in order to eliminate compiler errors.
|
||||
- Fixed bug where wxDateTime::Now() would sometimes return an incorrect value
|
||||
the first time it was called.
|
||||
- Added wxString::rbegin() and rend()
|
||||
- Added wxString::EndsWith()
|
||||
- Added wxString::rbegin() and rend().
|
||||
- Added wxString::EndsWith().
|
||||
- wxSocket::_Read continues reading from socket after exhausting pushback buffer.
|
||||
Previously, only the buffer would be returned, even if more data was requested.
|
||||
- Added wxPowerEvent (currently MSW-only)
|
||||
- Make wx-config compatible with Bourne shells
|
||||
- Added wxPowerEvent (currently MSW-only).
|
||||
- Make wx-config compatible with Bourne shells.
|
||||
|
||||
All (GUI):
|
||||
|
||||
- Added wxComboCtrl and wxOwnerDrawnComboBox (Jaakko Salli)
|
||||
- Added wxComboCtrl and wxOwnerDrawnComboBox (Jaakko Salli).
|
||||
- Added wxTreebook (uses a wxTreeCtrl to control pages).
|
||||
- Added wxColour/Dir/File/Font/PickerCtrls (Francesco Montorsi)
|
||||
- Added wxDC::GradientFillLinear/Concentric()
|
||||
- Added wxHyperlinkCtrl (Francesco Montorsi)
|
||||
- Added clipboard events (wxEVT_COMMAND_TEXT_COPY/CUT/PASTE)
|
||||
- Allow to reorder wxGrid columns by drag-and-drop (Santiago Palacios)
|
||||
- Added wxRadioBox::SetItemToolTip()
|
||||
- Added support for CMYK JPEG images loading (Robert Wruck)
|
||||
- Added wxListCtrl::GetSubItemRect() and subitem hit testing (Agron Selimaj)
|
||||
- Added wxKeyEvent::GetModifiers()
|
||||
- Added wxColour/Dir/File/Font/PickerCtrls (Francesco Montorsi).
|
||||
- Added wxDC::GradientFillLinear/Concentric().
|
||||
- Added wxHyperlinkCtrl (Francesco Montorsi).
|
||||
- Added clipboard events (wxEVT_COMMAND_TEXT_COPY/CUT/PASTE).
|
||||
- Allow to reorder wxGrid columns by drag-and-drop (Santiago Palacios).
|
||||
- Added wxRadioBox::SetItemToolTip().
|
||||
- Added support for CMYK JPEG images loading (Robert Wruck).
|
||||
- Added wxListCtrl::GetSubItemRect() and subitem hit testing (Agron Selimaj).
|
||||
- Added wxKeyEvent::GetModifiers().
|
||||
- Added wxDialog::SetEscapeId().
|
||||
- wxItemContainerImmutable::FindString unified (affects wxRadioBox, wxListBox,
|
||||
wxComboBox and wxChoice).
|
||||
@@ -115,7 +115,7 @@ All (GUI):
|
||||
- Access to titles through Get/SetTitle is available now only for top level
|
||||
windows (wxDialog, wxFrame).
|
||||
- Fixed memory leak of pending events in wxEvtHandler.
|
||||
- Added wxRadioBox::IsItemEnabled/Shown()
|
||||
- Added wxRadioBox::IsItemEnabled/Shown().
|
||||
- Added space after list item number in wxHTML.
|
||||
- Implemented <sub> and <sup> handling in wxHTML (based on patch
|
||||
by Sandro Sigala).
|
||||
@@ -126,7 +126,7 @@ All (GUI):
|
||||
- wxCalendarCtrl positioning and hit-testing fixes for dimensions other than
|
||||
best size.
|
||||
- wxCalendarCtrl colour schema changed and adjusted to system settings.
|
||||
- wxImage::Mirror() and GetSubBitmap() now support alpha (Mickey Rose)
|
||||
- wxImage::Mirror() and GetSubBitmap() now support alpha (Mickey Rose).
|
||||
- More checking of image validity before loading into wxImage.
|
||||
- Added wxImage::ConvertToGreyscale.
|
||||
- Added ability to use templates with static event tables
|
||||
@@ -146,14 +146,15 @@ All (GUI):
|
||||
- Indices and counts in wxControlWithItems derived API are unsigned.
|
||||
- Added support for links to wxHtmlListBox; use code has to override
|
||||
wxHtmlListBox::OnLinkClicked() to take advantage of it.
|
||||
- Added an easier to use wxMenu::AppendSubMenu()
|
||||
- Added an easier to use wxMenu::AppendSubMenu().
|
||||
- wxString <-> wxColour conversions in wxColour class (Francesco Montorsi).
|
||||
- Fixed bug with ignoring blank lines in multiline wxGrid cell labels
|
||||
- Added wxTextAttr::Merge() (Marcin Simonides)
|
||||
- Added wxTB_NO_TOOLTIPS style (Igor Korot)
|
||||
- Added wxGenericDirCtrl::CollapsePath() (Christian Buhtz)
|
||||
- Fixed bug with ignoring blank lines in multiline wxGrid cell labels.
|
||||
- Added wxTextAttr::Merge() (Marcin Simonides).
|
||||
- Added wxTB_NO_TOOLTIPS style (Igor Korot).
|
||||
- Added wxGenericDirCtrl::CollapsePath() (Christian Buhtz).
|
||||
- Fixed 64-bit issue in wxNotebook causing segfaults on Tru64 Unix.
|
||||
- Made it possible to associate context help to a region of a window
|
||||
- Made it possible to associate context help to a region of a window.
|
||||
- Added support for tabs in wxRichTextCtrl (Ashish More).
|
||||
|
||||
wxMSW:
|
||||
|
||||
@@ -204,8 +205,8 @@ wxMSW:
|
||||
- Fixed wxChoice/wxComboBox slow appending and infinite recursion
|
||||
if its size is set within a paint handler (for example when embedded in a
|
||||
wxHtmlWindow). [Now reverted due to problems in W2K and below.]
|
||||
- wxDC::GetTextExtent() width calculation is more precise for italics fonts now
|
||||
- Warning fixes for VC++ 5.0 (Igor Korot)
|
||||
- wxDC::GetTextExtent() width calculation is more precise for italics fonts now.
|
||||
- Warning fixes for VC++ 5.0 (Igor Korot).
|
||||
|
||||
wxGTK:
|
||||
|
||||
@@ -231,7 +232,7 @@ wxGTK:
|
||||
- Fixed problems with CJK input method.
|
||||
- Implemented ScrollLines/Pages() for all windows (Paul Cornett).
|
||||
- Support underlined fonts in wxTextCtrl.
|
||||
- Support all border styles; wxListBox honours the borders now
|
||||
- Support all border styles; wxListBox honours the borders now.
|
||||
- wxWindow and wxScrolledWindow now generate line, page and thumb-release scroll events.
|
||||
|
||||
wxMac:
|
||||
|
@@ -538,7 +538,7 @@ public:
|
||||
|
||||
/// Get the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const = 0;
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const = 0;
|
||||
|
||||
/// Do a split, returning an object containing the second part, and setting
|
||||
/// the first part in 'this'.
|
||||
@@ -758,7 +758,7 @@ public:
|
||||
|
||||
/// Get/set the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const;
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const;
|
||||
|
||||
// Accessors
|
||||
|
||||
@@ -797,7 +797,7 @@ public:
|
||||
|
||||
/// Get/set the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const;
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const;
|
||||
|
||||
/// Delete range
|
||||
virtual bool DeleteRange(const wxRichTextRange& range);
|
||||
@@ -1102,7 +1102,7 @@ public:
|
||||
|
||||
/// Get/set the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const;
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const;
|
||||
|
||||
/// Finds the absolute position and row height for the given character position
|
||||
virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart);
|
||||
@@ -1197,7 +1197,7 @@ public:
|
||||
|
||||
/// Get/set the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const;
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position/* = wxPoint(0,0)*/) const;
|
||||
|
||||
/// Get any text in this object for the given range
|
||||
virtual wxString GetTextForRange(const wxRichTextRange& range) const;
|
||||
@@ -1240,6 +1240,8 @@ public:
|
||||
|
||||
/// Clone
|
||||
virtual wxRichTextObject* Clone() const { return new wxRichTextPlainText(*this); }
|
||||
private:
|
||||
bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString& str, wxCoord& x, wxCoord& y, bool selected);
|
||||
|
||||
protected:
|
||||
wxString m_text;
|
||||
@@ -1350,7 +1352,7 @@ public:
|
||||
|
||||
/// Get the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const;
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0)) const;
|
||||
|
||||
/// Returns true if the object is empty
|
||||
virtual bool IsEmpty() const { return !m_image.Ok(); }
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.1.9 (http://bakefile.sourceforge.net)
|
||||
# Bakefile 0.2.0 (http://bakefile.sourceforge.net)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
@@ -163,7 +163,7 @@ distclean: clean
|
||||
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
|
||||
|
||||
richtext$(EXEEXT): $(RICHTEXT_OBJECTS) $(__richtext___win32rc)
|
||||
$(CXX) -o $@ $(RICHTEXT_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_ADV_p) $(PLUGIN_ADV_EXTRALIBS) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_ZLIB_p) $(__LIB_ODBC_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(EXTRALIBS_FOR_GUI)
|
||||
$(CXX) -o $@ $(RICHTEXT_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_ADV_p) $(PLUGIN_ADV_EXTRALIBS) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_ODBC_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE)
|
||||
$(__richtext___mac_rezcmd)
|
||||
$(__richtext___mac_setfilecmd)
|
||||
$(__richtext___os2_emxbindcmd)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.1.9 (http://bakefile.sourceforge.net)
|
||||
# Bakefile 0.2.0 (http://bakefile.sourceforge.net)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
@@ -31,7 +31,7 @@ RICHTEXT_CXXFLAGS = $(__RUNTIME_LIBS_7) -I$(BCCDIR)\include $(__DEBUGINFO) \
|
||||
$(__OPTIMIZEFLAG_2) $(__THREADSFLAG_6) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||
$(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \
|
||||
-I.\..\..\include -I$(SETUPHDIR) -I. $(__DLLFLAG_p) -I.\..\..\samples -DNOPCH \
|
||||
-I$(SETUPHDIR) -I.\..\..\include -I. $(__DLLFLAG_p) -I.\..\..\samples -DNOPCH \
|
||||
$(CPPFLAGS) $(CXXFLAGS)
|
||||
RICHTEXT_OBJECTS = \
|
||||
$(OBJS)\richtext_richtext.obj
|
||||
@@ -226,11 +226,11 @@ clean:
|
||||
|
||||
$(OBJS)\richtext.exe: $(RICHTEXT_OBJECTS) $(OBJS)\richtext_sample.res
|
||||
ilink32 -Tpe -q $(LDFLAGS) -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -aa @&&|
|
||||
c0w32.obj $(RICHTEXT_OBJECTS),$@,, $(__WXLIB_HTML_p) $(__WXLIB_ADV_p) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) ole2w32.lib oleacc.lib odbc32.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,, $(OBJS)\richtext_sample.res
|
||||
c0w32.obj $(RICHTEXT_OBJECTS),$@,, $(__WXLIB_HTML_p) $(__WXLIB_ADV_p) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) ole2w32.lib oleacc.lib odbc32.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,, $(OBJS)\richtext_sample.res
|
||||
|
|
||||
|
||||
$(OBJS)\richtext_sample.res: .\..\..\samples\sample.rc
|
||||
brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) -i.\..\..\include -i$(SETUPHDIR) -i. $(__DLLFLAG_p_1) -i.\..\..\samples $**
|
||||
brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) -i$(SETUPHDIR) -i.\..\..\include -i. $(__DLLFLAG_p_1) -i.\..\..\samples $**
|
||||
|
||||
$(OBJS)\richtext_richtext.obj: .\richtext.cpp
|
||||
$(CXX) -q -c -P -o$@ $(RICHTEXT_CXXFLAGS) $**
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.1.9 (http://bakefile.sourceforge.net)
|
||||
# Bakefile 0.2.0 (http://bakefile.sourceforge.net)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
@@ -23,7 +23,7 @@ RICHTEXT_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
|
||||
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||
$(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \
|
||||
-I.\..\..\include -I$(SETUPHDIR) -W -Wall -I. $(__DLLFLAG_p) -I.\..\..\samples \
|
||||
-I$(SETUPHDIR) -I.\..\..\include -W -Wall -I. $(__DLLFLAG_p) -I.\..\..\samples \
|
||||
-DNOPCH $(__RTTIFLAG_5) $(__EXCEPTIONSFLAG_6) -Wno-ctor-dtor-privacy \
|
||||
$(CPPFLAGS) $(CXXFLAGS)
|
||||
RICHTEXT_OBJECTS = \
|
||||
@@ -220,10 +220,10 @@ clean:
|
||||
-if exist $(OBJS)\richtext.exe del $(OBJS)\richtext.exe
|
||||
|
||||
$(OBJS)\richtext.exe: $(RICHTEXT_OBJECTS) $(OBJS)\richtext_sample_rc.o
|
||||
$(CXX) -o $@ $(RICHTEXT_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(__WXLIB_HTML_p) $(__WXLIB_ADV_p) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
|
||||
$(CXX) -o $@ $(RICHTEXT_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(__WXLIB_HTML_p) $(__WXLIB_ADV_p) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
|
||||
|
||||
$(OBJS)\richtext_sample_rc.o: ./../../samples/sample.rc
|
||||
windres --use-temp-file -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) --include-dir ./../../include --include-dir $(SETUPHDIR) --include-dir . $(__DLLFLAG_p_1) --include-dir ./../../samples
|
||||
windres --use-temp-file -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) --include-dir $(SETUPHDIR) --include-dir ./../../include --include-dir . $(__DLLFLAG_p_1) --include-dir ./../../samples
|
||||
|
||||
$(OBJS)\richtext_richtext.o: ./richtext.cpp
|
||||
$(CXX) -c -o $@ $(RICHTEXT_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
@@ -475,7 +475,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
||||
wxFont boldFont = wxFont(12, wxROMAN, wxNORMAL, wxBOLD);
|
||||
wxFont italicFont = wxFont(12, wxROMAN, wxITALIC, wxNORMAL);
|
||||
|
||||
m_richTextCtrl = new wxRichTextCtrl(splitter, wxID_ANY, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxNO_BORDER);
|
||||
m_richTextCtrl = new wxRichTextCtrl(splitter, wxID_ANY, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS);
|
||||
wxFont font(12, wxROMAN, wxNORMAL, wxNORMAL);
|
||||
|
||||
#ifdef __WXMAC__
|
||||
@@ -603,6 +603,19 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
||||
r.EndLineSpacing();
|
||||
r.EndAlignment();
|
||||
|
||||
wxArrayInt tabs;
|
||||
tabs.Add(400);
|
||||
tabs.Add(600);
|
||||
tabs.Add(800);
|
||||
tabs.Add(1000);
|
||||
wxTextAttrEx attr;
|
||||
attr.SetFlags(wxTEXT_ATTR_TABS);
|
||||
attr.SetTabs(tabs);
|
||||
r.SetDefaultStyle(attr);
|
||||
|
||||
r.Newline();
|
||||
r.WriteText(wxT("This line contains tabs:\tFirst tab\tSecond tab\tThird tab"));
|
||||
|
||||
r.Newline();
|
||||
r.WriteText(wxT("Other notable features of wxRichTextCtrl include:"));
|
||||
|
||||
|
@@ -441,13 +441,13 @@ bool wxRichTextBox::Layout(wxDC& dc, const wxRect& rect, int style)
|
||||
}
|
||||
|
||||
/// Get/set the size for the given range. Assume only has one child.
|
||||
bool wxRichTextBox::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const
|
||||
bool wxRichTextBox::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position) const
|
||||
{
|
||||
wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst();
|
||||
if (node)
|
||||
{
|
||||
wxRichTextObject* child = node->GetData();
|
||||
return child->GetRangeSize(range, size, descent, dc, flags);
|
||||
return child->GetRangeSize(range, size, descent, dc, flags, position);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
@@ -657,7 +657,7 @@ void wxRichTextParagraphLayoutBox::Copy(const wxRichTextParagraphLayoutBox& obj)
|
||||
}
|
||||
|
||||
/// Get/set the size for the given range.
|
||||
bool wxRichTextParagraphLayoutBox::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const
|
||||
bool wxRichTextParagraphLayoutBox::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position) const
|
||||
{
|
||||
wxSize sz;
|
||||
|
||||
@@ -713,7 +713,7 @@ bool wxRichTextParagraphLayoutBox::GetRangeSize(const wxRichTextRange& range, wx
|
||||
wxSize childSize;
|
||||
|
||||
int childDescent = 0;
|
||||
child->GetRangeSize(rangeToFind, childSize, childDescent, dc, flags);
|
||||
child->GetRangeSize(rangeToFind, childSize, childDescent, dc, flags, position);
|
||||
|
||||
descent = wxMax(childDescent, descent);
|
||||
|
||||
@@ -1962,7 +1962,7 @@ bool wxRichTextParagraph::Draw(wxDC& dc, const wxRichTextRange& WXUNUSED(range),
|
||||
|
||||
wxSize objectSize;
|
||||
int descent = 0;
|
||||
child->GetRangeSize(objectRange, objectSize, descent, dc, wxRICHTEXT_UNFORMATTED);
|
||||
child->GetRangeSize(objectRange, objectSize, descent, dc, wxRICHTEXT_UNFORMATTED, objectPosition);
|
||||
|
||||
// Use the child object's width, but the whole line's height
|
||||
wxRect childRect(objectPosition, wxSize(objectSize.x, line->GetSize().y));
|
||||
@@ -2075,7 +2075,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
||||
childDescent = child->GetDescent();
|
||||
}
|
||||
else
|
||||
GetRangeSize(wxRichTextRange(lastEndPos+1, child->GetRange().GetEnd()), childSize, childDescent, dc, wxRICHTEXT_UNFORMATTED);
|
||||
GetRangeSize(wxRichTextRange(lastEndPos+1, child->GetRange().GetEnd()), childSize, childDescent, dc, wxRICHTEXT_UNFORMATTED,rect.GetPosition());
|
||||
|
||||
if (childSize.x + currentWidth > availableSpaceForText)
|
||||
{
|
||||
@@ -2310,7 +2310,7 @@ void wxRichTextParagraph::ClearLines()
|
||||
|
||||
/// Get/set the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags) const
|
||||
bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position) const
|
||||
{
|
||||
if (!range.IsWithin(GetRange()))
|
||||
return false;
|
||||
@@ -2334,7 +2334,7 @@ bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& siz
|
||||
rangeToUse.LimitTo(child->GetRange());
|
||||
int childDescent = 0;
|
||||
|
||||
if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, flags))
|
||||
if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, flags, position))
|
||||
{
|
||||
sz.y = wxMax(sz.y, childSize.y);
|
||||
sz.x += childSize.x;
|
||||
@@ -2379,7 +2379,7 @@ bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& siz
|
||||
|
||||
wxSize childSize;
|
||||
int childDescent = 0;
|
||||
if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, flags))
|
||||
if (child->GetRangeSize(rangeToUse, childSize, childDescent, dc, flags, position))
|
||||
{
|
||||
lineSize.y = wxMax(lineSize.y, childSize.y);
|
||||
lineSize.x += childSize.x;
|
||||
@@ -2480,7 +2480,7 @@ bool wxRichTextParagraph::FindPosition(wxDC& dc, long index, wxPoint& pt, int* h
|
||||
// then we can add this size to the line start position and
|
||||
// paragraph start position to find the actual position.
|
||||
|
||||
if (GetRangeSize(r, rangeSize, descent, dc, wxRICHTEXT_UNFORMATTED))
|
||||
if (GetRangeSize(r, rangeSize, descent, dc, wxRICHTEXT_UNFORMATTED, line->GetPosition()+ GetPosition()))
|
||||
{
|
||||
pt.x = line->GetPosition().x + GetPosition().x + rangeSize.x;
|
||||
*height = line->GetSize().y;
|
||||
@@ -2533,7 +2533,7 @@ int wxRichTextParagraph::HitTest(wxDC& dc, const wxPoint& pt, long& textPosition
|
||||
|
||||
wxRichTextRange rangeToUse(lineRange.GetStart(), i);
|
||||
|
||||
GetRangeSize(rangeToUse, childSize, descent, dc, wxRICHTEXT_UNFORMATTED);
|
||||
GetRangeSize(rangeToUse, childSize, descent, dc, wxRICHTEXT_UNFORMATTED, linePos);
|
||||
|
||||
int nextX = childSize.x + linePos.x;
|
||||
|
||||
@@ -2947,7 +2947,7 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
|
||||
|
||||
// (a) All selected.
|
||||
if (selectionRange.GetStart() <= range.GetStart() && selectionRange.GetEnd() >= range.GetEnd())
|
||||
{
|
||||
{/*
|
||||
// Draw all selected
|
||||
dc.SetBrush(*wxBLACK_BRUSH);
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
@@ -2957,15 +2957,18 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
|
||||
dc.DrawRectangle(selRect);
|
||||
dc.SetTextForeground(*wxWHITE);
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
dc.DrawText(stringChunk, x, y);
|
||||
dc.DrawText(stringChunk, x, y);*/
|
||||
DrawTabbedString(dc, rect,stringChunk, x, y, true);
|
||||
}
|
||||
// (b) None selected.
|
||||
else if (selectionRange.GetEnd() < range.GetStart() || selectionRange.GetStart() > range.GetEnd())
|
||||
{
|
||||
// Draw all unselected
|
||||
/*
|
||||
dc.SetTextForeground(GetAttributes().GetTextColour());
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
dc.DrawText(stringChunk, x, y);
|
||||
dc.DrawText(stringChunk, x, y);*/
|
||||
DrawTabbedString(dc, rect,stringChunk, x, y, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2983,13 +2986,14 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
|
||||
if (fragmentLen < 0)
|
||||
wxLogDebug(wxT("Mid(%d, %d"), (int)(r1 - offset), (int)fragmentLen);
|
||||
wxString stringFragment = m_text.Mid(r1 - offset, fragmentLen);
|
||||
|
||||
/*
|
||||
dc.SetTextForeground(GetAttributes().GetTextColour());
|
||||
dc.DrawText(stringFragment, x, y);
|
||||
|
||||
wxCoord w, h;
|
||||
dc.GetTextExtent(stringFragment, & w, & h);
|
||||
x += w;
|
||||
x += w;*/
|
||||
DrawTabbedString(dc, rect,stringFragment, x, y, false);
|
||||
}
|
||||
|
||||
// 2. Selected chunk, if any.
|
||||
@@ -3002,7 +3006,7 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
|
||||
if (fragmentLen < 0)
|
||||
wxLogDebug(wxT("Mid(%d, %d"), (int)(s1 - offset), (int)fragmentLen);
|
||||
wxString stringFragment = m_text.Mid(s1 - offset, fragmentLen);
|
||||
|
||||
/*
|
||||
wxCoord w, h;
|
||||
dc.GetTextExtent(stringFragment, & w, & h);
|
||||
wxRect selRect(x, rect.y, w, rect.GetHeight());
|
||||
@@ -3013,7 +3017,8 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
|
||||
dc.SetTextForeground(*wxWHITE);
|
||||
dc.DrawText(stringFragment, x, y);
|
||||
|
||||
x += w;
|
||||
x += w;*/
|
||||
DrawTabbedString(dc, rect,stringFragment, x, y, true);
|
||||
}
|
||||
|
||||
// 3. Remaining unselected chunk, if any
|
||||
@@ -3026,15 +3031,76 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
|
||||
if (fragmentLen < 0)
|
||||
wxLogDebug(wxT("Mid(%d, %d"), (int)(s2 - offset), (int)fragmentLen);
|
||||
wxString stringFragment = m_text.Mid(s2 - offset, fragmentLen);
|
||||
|
||||
/*
|
||||
dc.SetTextForeground(GetAttributes().GetTextColour());
|
||||
dc.DrawText(stringFragment, x, y);
|
||||
dc.DrawText(stringFragment, x, y);*/
|
||||
DrawTabbedString(dc, rect,stringFragment, x, y, false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRichTextPlainText::DrawTabbedString(wxDC& dc,const wxRect& rect,wxString& str, wxCoord& x, wxCoord& y, bool selected)
|
||||
{
|
||||
wxArrayInt tab_array = GetAttributes().GetTabs();
|
||||
if(tab_array.IsEmpty()){// create a default tab list at 10 mm each.
|
||||
for( int i = 0; i < 20; ++i){
|
||||
tab_array.Add(i*100);
|
||||
}
|
||||
}
|
||||
int map_mode = dc.GetMapMode();
|
||||
dc.SetMapMode(wxMM_LOMETRIC );
|
||||
int num_tabs = tab_array.GetCount();
|
||||
for( int i = 0; i < num_tabs; ++i){
|
||||
tab_array[i] = dc.LogicalToDeviceXRel(tab_array[i]);
|
||||
}
|
||||
dc.SetMapMode(map_mode );
|
||||
int next_tab_pos = -1;
|
||||
int tab_pos = -1;
|
||||
wxCoord w, h;
|
||||
if(selected){
|
||||
dc.SetBrush(*wxBLACK_BRUSH);
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.SetTextForeground(*wxWHITE);
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
}
|
||||
else{
|
||||
dc.SetTextForeground(GetAttributes().GetTextColour());
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
}
|
||||
while(str.Find(wxT('\t')) >= 0){// the string has a tab
|
||||
// break up the string at the Tab
|
||||
wxString stringChunk = str.BeforeFirst(wxT('\t'));
|
||||
str = str.AfterFirst(wxT('\t'));
|
||||
dc.GetTextExtent(stringChunk, & w, & h);
|
||||
tab_pos = x + w;
|
||||
bool not_found = true;
|
||||
for( int i = 0; i < num_tabs && not_found; ++i){
|
||||
next_tab_pos = tab_array.Item(i);
|
||||
if( next_tab_pos > tab_pos){
|
||||
not_found = false;
|
||||
if(selected){
|
||||
w = next_tab_pos - x;
|
||||
wxRect selRect(x, rect.y, w, rect.GetHeight());
|
||||
dc.DrawRectangle(selRect);
|
||||
}
|
||||
dc.DrawText(stringChunk, x, y);
|
||||
x = next_tab_pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dc.GetTextExtent(str, & w, & h);
|
||||
if(selected){
|
||||
wxRect selRect(x, rect.y, w, rect.GetHeight());
|
||||
dc.DrawRectangle(selRect);
|
||||
}
|
||||
dc.DrawText(str, x, y);
|
||||
x += w;
|
||||
return true;
|
||||
|
||||
}
|
||||
/// Lay the item out
|
||||
bool wxRichTextPlainText::Layout(wxDC& dc, const wxRect& WXUNUSED(rect), int WXUNUSED(style))
|
||||
{
|
||||
@@ -3058,7 +3124,7 @@ void wxRichTextPlainText::Copy(const wxRichTextPlainText& obj)
|
||||
|
||||
/// Get/set the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int WXUNUSED(flags)) const
|
||||
bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int WXUNUSED(flags), wxPoint position) const
|
||||
{
|
||||
if (!range.IsWithin(GetRange()))
|
||||
return false;
|
||||
@@ -3074,9 +3140,44 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
|
||||
long len = range.GetLength();
|
||||
wxString stringChunk = m_text.Mid(startPos, (size_t) len);
|
||||
wxCoord w, h;
|
||||
int width = 0;
|
||||
if(stringChunk.Find(wxT('\t')) >= 0){// the string has a tab
|
||||
wxArrayInt tab_array = GetAttributes().GetTabs();
|
||||
if(tab_array.IsEmpty()){// create a default tab list at 10 mm each.
|
||||
for( int i = 0; i < 20; ++i){
|
||||
tab_array.Add(i*100);
|
||||
}
|
||||
}
|
||||
int map_mode = dc.GetMapMode();
|
||||
dc.SetMapMode(wxMM_LOMETRIC );
|
||||
int num_tabs = tab_array.GetCount();
|
||||
for( int i = 0; i < num_tabs; ++i){
|
||||
tab_array[i] = dc.LogicalToDeviceXRel(tab_array[i]);
|
||||
}
|
||||
dc.SetMapMode(map_mode );
|
||||
int next_tab_pos = -1;
|
||||
|
||||
while(stringChunk.Find(wxT('\t')) >= 0){// the string has a tab
|
||||
// break up the string at the Tab
|
||||
wxString stringFragment = stringChunk.BeforeFirst(wxT('\t'));
|
||||
stringChunk = stringChunk.AfterFirst(wxT('\t'));
|
||||
dc.GetTextExtent(stringFragment, & w, & h);
|
||||
width += w;
|
||||
int absolute_width = width + position.x;
|
||||
bool not_found = true;
|
||||
for( int i = 0; i < num_tabs && not_found; ++i){
|
||||
next_tab_pos = tab_array.Item(i);
|
||||
if( next_tab_pos > absolute_width){
|
||||
not_found = false;
|
||||
width = next_tab_pos - position.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dc.GetTextExtent(stringChunk, & w, & h, & descent);
|
||||
size = wxSize(w, dc.GetCharHeight());
|
||||
|
||||
width += w;
|
||||
size = wxSize(width, dc.GetCharHeight());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4260,7 +4361,7 @@ bool wxRichTextImage::Layout(wxDC& WXUNUSED(dc), const wxRect& rect, int WXUNUSE
|
||||
|
||||
/// Get/set the object size for the given range. Returns false if the range
|
||||
/// is invalid for this object.
|
||||
bool wxRichTextImage::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& WXUNUSED(descent), wxDC& WXUNUSED(dc), int WXUNUSED(flags)) const
|
||||
bool wxRichTextImage::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& WXUNUSED(descent), wxDC& WXUNUSED(dc), int WXUNUSED(flags), wxPoint WXUNUSED(position)) const
|
||||
{
|
||||
if (!range.IsWithin(GetRange()))
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user