Merge of SOC2010_RTC_IMAGES branch.
Added floating images and image property dialog to wxRichTextCtrl, by Mingquan Yang as part of GSOC 2010. Also changed image block creation to use a memory stream instead of creating a temporary file. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9bc95da04c
commit
cdaed652d7
21
Makefile.in
21
Makefile.in
@ -1882,7 +1882,8 @@ RICHTEXTDLL_OBJECTS = \
|
||||
richtextdll_richtextformatdlg.o \
|
||||
richtextdll_richtextsymboldlg.o \
|
||||
richtextdll_richtextstyledlg.o \
|
||||
richtextdll_richtextprint.o
|
||||
richtextdll_richtextprint.o \
|
||||
richtextdll_richtextimagedlg.o
|
||||
RICHTEXTDLL_ODEP = $(_____pch_wxprec_richtextdll_wx_wxprec_h_gch___depname)
|
||||
RICHTEXTLIB_CXXFLAGS = $(__richtextlib_PCH_INC) -D__WX$(TOOLKIT)__ \
|
||||
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
|
||||
@ -1898,7 +1899,8 @@ RICHTEXTLIB_OBJECTS = \
|
||||
richtextlib_richtextformatdlg.o \
|
||||
richtextlib_richtextsymboldlg.o \
|
||||
richtextlib_richtextstyledlg.o \
|
||||
richtextlib_richtextprint.o
|
||||
richtextlib_richtextprint.o \
|
||||
richtextlib_richtextimagedlg.o
|
||||
RICHTEXTLIB_ODEP = $(_____pch_wxprec_richtextlib_wx_wxprec_h_gch___depname)
|
||||
STCDLL_CXXFLAGS = $(__stcdll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||
@ -4132,6 +4134,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
|
||||
wx/richtext/richtextsymboldlg.h \
|
||||
wx/richtext/richtextstyledlg.h \
|
||||
wx/richtext/richtextprint.h \
|
||||
wx/richtext/richtextimagedlg.h \
|
||||
wx/stc/stc.h
|
||||
@COND_USE_GUI_1@ALL_GUI_HEADERS = $(COND_USE_GUI_1_ALL_GUI_HEADERS)
|
||||
COND_MONOLITHIC_1_SHARED_1___monodll___depname = \
|
||||
@ -4426,6 +4429,7 @@ COND_USE_GUI_1___MONOLIB_GUI_SRC_OBJECTS = \
|
||||
monodll_richtextsymboldlg.o \
|
||||
monodll_richtextstyledlg.o \
|
||||
monodll_richtextprint.o \
|
||||
monodll_richtextimagedlg.o \
|
||||
monodll_stc.o \
|
||||
monodll_PlatWX.o \
|
||||
monodll_ScintillaWX.o
|
||||
@ -6299,6 +6303,7 @@ COND_USE_GUI_1___MONOLIB_GUI_SRC_OBJECTS_1 = \
|
||||
monolib_richtextsymboldlg.o \
|
||||
monolib_richtextstyledlg.o \
|
||||
monolib_richtextprint.o \
|
||||
monolib_richtextimagedlg.o \
|
||||
monolib_stc.o \
|
||||
monolib_PlatWX.o \
|
||||
monolib_ScintillaWX.o
|
||||
@ -17148,6 +17153,9 @@ monodll_richtextstyledlg.o: $(srcdir)/src/richtext/richtextstyledlg.cpp $(MONODL
|
||||
monodll_richtextprint.o: $(srcdir)/src/richtext/richtextprint.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/richtext/richtextprint.cpp
|
||||
|
||||
monodll_richtextimagedlg.o: $(srcdir)/src/richtext/richtextimagedlg.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/richtext/richtextimagedlg.cpp
|
||||
|
||||
monodll_stc.o: $(srcdir)/src/stc/stc.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/stc/stc.cpp
|
||||
|
||||
@ -22368,6 +22376,9 @@ monolib_richtextstyledlg.o: $(srcdir)/src/richtext/richtextstyledlg.cpp $(MONOLI
|
||||
monolib_richtextprint.o: $(srcdir)/src/richtext/richtextprint.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/richtext/richtextprint.cpp
|
||||
|
||||
monolib_richtextimagedlg.o: $(srcdir)/src/richtext/richtextimagedlg.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/richtext/richtextimagedlg.cpp
|
||||
|
||||
monolib_stc.o: $(srcdir)/src/stc/stc.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/stc/stc.cpp
|
||||
|
||||
@ -36024,6 +36035,9 @@ richtextdll_richtextstyledlg.o: $(srcdir)/src/richtext/richtextstyledlg.cpp $(RI
|
||||
richtextdll_richtextprint.o: $(srcdir)/src/richtext/richtextprint.cpp $(RICHTEXTDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(RICHTEXTDLL_CXXFLAGS) $(srcdir)/src/richtext/richtextprint.cpp
|
||||
|
||||
richtextdll_richtextimagedlg.o: $(srcdir)/src/richtext/richtextimagedlg.cpp $(RICHTEXTDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(RICHTEXTDLL_CXXFLAGS) $(srcdir)/src/richtext/richtextimagedlg.cpp
|
||||
|
||||
richtextlib_richtextctrl.o: $(srcdir)/src/richtext/richtextctrl.cpp $(RICHTEXTLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(RICHTEXTLIB_CXXFLAGS) $(srcdir)/src/richtext/richtextctrl.cpp
|
||||
|
||||
@ -36051,6 +36065,9 @@ richtextlib_richtextstyledlg.o: $(srcdir)/src/richtext/richtextstyledlg.cpp $(RI
|
||||
richtextlib_richtextprint.o: $(srcdir)/src/richtext/richtextprint.cpp $(RICHTEXTLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(RICHTEXTLIB_CXXFLAGS) $(srcdir)/src/richtext/richtextprint.cpp
|
||||
|
||||
richtextlib_richtextimagedlg.o: $(srcdir)/src/richtext/richtextimagedlg.cpp $(RICHTEXTLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(RICHTEXTLIB_CXXFLAGS) $(srcdir)/src/richtext/richtextimagedlg.cpp
|
||||
|
||||
stcdll_version_rc.o: $(srcdir)/src/msw/version.rc $(STCDLL_ODEP)
|
||||
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_63) $(__DEBUG_DEFINE_p_61) $(__EXCEPTIONS_DEFINE_p_61) $(__RTTI_DEFINE_p_61) $(__THREAD_DEFINE_p_61) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include $(__INC_TIFF_BUILD_p_62) $(__INC_TIFF_p_62) $(__INC_JPEG_p_62) $(__INC_PNG_p_61) $(__INC_ZLIB_p_63) $(__INC_REGEX_p_61) $(__INC_EXPAT_p_61) --include-dir $(top_srcdir)/src/stc/scintilla/include --include-dir $(top_srcdir)/src/stc/scintilla/src --define __WX__ --define SCI_LEXER --define LINK_LEXERS --define WXUSINGDLL --define WXMAKINGDLL_STC
|
||||
|
||||
|
@ -3596,6 +3596,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/richtext/richtextsymboldlg.cpp
|
||||
src/richtext/richtextstyledlg.cpp
|
||||
src/richtext/richtextprint.cpp
|
||||
src/richtext/richtextimagedlg.cpp
|
||||
</set>
|
||||
<set var="RICHTEXT_HDR" hints="files">
|
||||
wx/richtext/richtextctrl.h
|
||||
@ -3607,6 +3608,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/richtext/richtextsymboldlg.h
|
||||
wx/richtext/richtextstyledlg.h
|
||||
wx/richtext/richtextprint.h
|
||||
wx/richtext/richtextimagedlg.h
|
||||
</set>
|
||||
|
||||
|
||||
|
@ -1399,7 +1399,8 @@ RICHTEXTDLL_OBJECTS = \
|
||||
$(OBJS)\richtextdll_richtextformatdlg.obj \
|
||||
$(OBJS)\richtextdll_richtextsymboldlg.obj \
|
||||
$(OBJS)\richtextdll_richtextstyledlg.obj \
|
||||
$(OBJS)\richtextdll_richtextprint.obj
|
||||
$(OBJS)\richtextdll_richtextprint.obj \
|
||||
$(OBJS)\richtextdll_richtextimagedlg.obj
|
||||
RICHTEXTLIB_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
|
||||
$(__OPTIMIZEFLAG) $(__THREADSFLAG) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
|
||||
@ -1419,7 +1420,8 @@ RICHTEXTLIB_OBJECTS = \
|
||||
$(OBJS)\richtextlib_richtextformatdlg.obj \
|
||||
$(OBJS)\richtextlib_richtextsymboldlg.obj \
|
||||
$(OBJS)\richtextlib_richtextstyledlg.obj \
|
||||
$(OBJS)\richtextlib_richtextprint.obj
|
||||
$(OBJS)\richtextlib_richtextprint.obj \
|
||||
$(OBJS)\richtextlib_richtextimagedlg.obj
|
||||
STCDLL_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
|
||||
$(__OPTIMIZEFLAG) $(__THREADSFLAG) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
|
||||
@ -1663,6 +1665,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_richtextsymboldlg.obj \
|
||||
$(OBJS)\monodll_richtextstyledlg.obj \
|
||||
$(OBJS)\monodll_richtextprint.obj \
|
||||
$(OBJS)\monodll_richtextimagedlg.obj \
|
||||
$(OBJS)\monodll_stc.obj \
|
||||
$(OBJS)\monodll_PlatWX.obj \
|
||||
$(OBJS)\monodll_ScintillaWX.obj
|
||||
@ -2383,6 +2386,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_richtextsymboldlg.obj \
|
||||
$(OBJS)\monolib_richtextstyledlg.obj \
|
||||
$(OBJS)\monolib_richtextprint.obj \
|
||||
$(OBJS)\monolib_richtextimagedlg.obj \
|
||||
$(OBJS)\monolib_stc.obj \
|
||||
$(OBJS)\monolib_PlatWX.obj \
|
||||
$(OBJS)\monolib_ScintillaWX.obj
|
||||
@ -6793,6 +6797,9 @@ $(OBJS)\monodll_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cpp
|
||||
$(OBJS)\monodll_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\monodll_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\monodll_stc.obj: ..\..\src\stc\stc.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\stc\stc.cpp
|
||||
|
||||
@ -9028,6 +9035,9 @@ $(OBJS)\monolib_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cpp
|
||||
$(OBJS)\monolib_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\monolib_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\monolib_stc.obj: ..\..\src\stc\stc.cpp
|
||||
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\stc\stc.cpp
|
||||
|
||||
@ -14633,6 +14643,9 @@ $(OBJS)\richtextdll_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cp
|
||||
$(OBJS)\richtextdll_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -q -c -P -o$@ $(RICHTEXTDLL_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\richtextdll_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -q -c -P -o$@ $(RICHTEXTDLL_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\richtextlib_dummy.obj: ..\..\src\common\dummy.cpp
|
||||
$(CXX) -q -c -P -o$@ $(RICHTEXTLIB_CXXFLAGS) -H ..\..\src\common\dummy.cpp
|
||||
|
||||
@ -14663,6 +14676,9 @@ $(OBJS)\richtextlib_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cp
|
||||
$(OBJS)\richtextlib_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -q -c -P -o$@ $(RICHTEXTLIB_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\richtextlib_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -q -c -P -o$@ $(RICHTEXTLIB_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\stcdll_dummy.obj: ..\..\src\common\dummy.cpp
|
||||
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) -H ..\..\src\common\dummy.cpp
|
||||
|
||||
|
@ -1402,7 +1402,8 @@ RICHTEXTDLL_OBJECTS = \
|
||||
$(OBJS)\richtextdll_richtextformatdlg.o \
|
||||
$(OBJS)\richtextdll_richtextsymboldlg.o \
|
||||
$(OBJS)\richtextdll_richtextstyledlg.o \
|
||||
$(OBJS)\richtextdll_richtextprint.o
|
||||
$(OBJS)\richtextdll_richtextprint.o \
|
||||
$(OBJS)\richtextdll_richtextimagedlg.o
|
||||
RICHTEXTLIB_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \
|
||||
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
|
||||
@ -1422,7 +1423,8 @@ RICHTEXTLIB_OBJECTS = \
|
||||
$(OBJS)\richtextlib_richtextformatdlg.o \
|
||||
$(OBJS)\richtextlib_richtextsymboldlg.o \
|
||||
$(OBJS)\richtextlib_richtextstyledlg.o \
|
||||
$(OBJS)\richtextlib_richtextprint.o
|
||||
$(OBJS)\richtextlib_richtextprint.o \
|
||||
$(OBJS)\richtextlib_richtextimagedlg.o
|
||||
STCDLL_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \
|
||||
-DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
|
||||
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||
@ -1673,6 +1675,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_richtextsymboldlg.o \
|
||||
$(OBJS)\monodll_richtextstyledlg.o \
|
||||
$(OBJS)\monodll_richtextprint.o \
|
||||
$(OBJS)\monodll_richtextimagedlg.o \
|
||||
$(OBJS)\monodll_stc.o \
|
||||
$(OBJS)\monodll_PlatWX.o \
|
||||
$(OBJS)\monodll_ScintillaWX.o
|
||||
@ -2399,6 +2402,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_richtextsymboldlg.o \
|
||||
$(OBJS)\monolib_richtextstyledlg.o \
|
||||
$(OBJS)\monolib_richtextprint.o \
|
||||
$(OBJS)\monolib_richtextimagedlg.o \
|
||||
$(OBJS)\monolib_stc.o \
|
||||
$(OBJS)\monolib_PlatWX.o \
|
||||
$(OBJS)\monolib_ScintillaWX.o
|
||||
@ -6943,6 +6947,9 @@ $(OBJS)\monodll_richtextstyledlg.o: ../../src/richtext/richtextstyledlg.cpp
|
||||
$(OBJS)\monodll_richtextprint.o: ../../src/richtext/richtextprint.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monodll_richtextimagedlg.o: ../../src/richtext/richtextimagedlg.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monodll_stc.o: ../../src/stc/stc.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
@ -9178,6 +9185,9 @@ $(OBJS)\monolib_richtextstyledlg.o: ../../src/richtext/richtextstyledlg.cpp
|
||||
$(OBJS)\monolib_richtextprint.o: ../../src/richtext/richtextprint.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monolib_richtextimagedlg.o: ../../src/richtext/richtextimagedlg.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monolib_stc.o: ../../src/stc/stc.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
@ -14783,6 +14793,9 @@ $(OBJS)\richtextdll_richtextstyledlg.o: ../../src/richtext/richtextstyledlg.cpp
|
||||
$(OBJS)\richtextdll_richtextprint.o: ../../src/richtext/richtextprint.cpp
|
||||
$(CXX) -c -o $@ $(RICHTEXTDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\richtextdll_richtextimagedlg.o: ../../src/richtext/richtextimagedlg.cpp
|
||||
$(CXX) -c -o $@ $(RICHTEXTDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\richtextlib_dummy.o: ../../src/common/dummy.cpp
|
||||
$(CXX) -c -o $@ $(RICHTEXTLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
@ -14813,6 +14826,9 @@ $(OBJS)\richtextlib_richtextstyledlg.o: ../../src/richtext/richtextstyledlg.cpp
|
||||
$(OBJS)\richtextlib_richtextprint.o: ../../src/richtext/richtextprint.cpp
|
||||
$(CXX) -c -o $@ $(RICHTEXTLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\richtextlib_richtextimagedlg.o: ../../src/richtext/richtextimagedlg.cpp
|
||||
$(CXX) -c -o $@ $(RICHTEXTLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\stcdll_dummy.o: ../../src/common/dummy.cpp
|
||||
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
@ -1502,7 +1502,8 @@ RICHTEXTDLL_OBJECTS = \
|
||||
$(OBJS)\richtextdll_richtextformatdlg.obj \
|
||||
$(OBJS)\richtextdll_richtextsymboldlg.obj \
|
||||
$(OBJS)\richtextdll_richtextstyledlg.obj \
|
||||
$(OBJS)\richtextdll_richtextprint.obj
|
||||
$(OBJS)\richtextdll_richtextprint.obj \
|
||||
$(OBJS)\richtextdll_richtextimagedlg.obj
|
||||
RICHTEXTDLL_RESOURCES = \
|
||||
$(OBJS)\richtextdll_version.res
|
||||
RICHTEXTLIB_CXXFLAGS = /M$(__RUNTIME_LIBS_534)$(__DEBUGRUNTIME) /DWIN32 \
|
||||
@ -1526,7 +1527,8 @@ RICHTEXTLIB_OBJECTS = \
|
||||
$(OBJS)\richtextlib_richtextformatdlg.obj \
|
||||
$(OBJS)\richtextlib_richtextsymboldlg.obj \
|
||||
$(OBJS)\richtextlib_richtextstyledlg.obj \
|
||||
$(OBJS)\richtextlib_richtextprint.obj
|
||||
$(OBJS)\richtextlib_richtextprint.obj \
|
||||
$(OBJS)\richtextlib_richtextimagedlg.obj
|
||||
STCDLL_CXXFLAGS = /M$(__RUNTIME_LIBS_550)$(__DEBUGRUNTIME) /DWIN32 \
|
||||
$(__DEBUGINFO) \
|
||||
/Fd$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc_vc$(VENDORTAG).pdb \
|
||||
@ -1871,6 +1873,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_OBJECTS = \
|
||||
$(OBJS)\monodll_richtextsymboldlg.obj \
|
||||
$(OBJS)\monodll_richtextstyledlg.obj \
|
||||
$(OBJS)\monodll_richtextprint.obj \
|
||||
$(OBJS)\monodll_richtextimagedlg.obj \
|
||||
$(OBJS)\monodll_stc.obj \
|
||||
$(OBJS)\monodll_PlatWX.obj \
|
||||
$(OBJS)\monodll_ScintillaWX.obj
|
||||
@ -2597,6 +2600,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS = \
|
||||
$(OBJS)\monolib_richtextsymboldlg.obj \
|
||||
$(OBJS)\monolib_richtextstyledlg.obj \
|
||||
$(OBJS)\monolib_richtextprint.obj \
|
||||
$(OBJS)\monolib_richtextimagedlg.obj \
|
||||
$(OBJS)\monolib_stc.obj \
|
||||
$(OBJS)\monolib_PlatWX.obj \
|
||||
$(OBJS)\monolib_ScintillaWX.obj
|
||||
@ -7373,6 +7377,9 @@ $(OBJS)\monodll_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cpp
|
||||
$(OBJS)\monodll_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\monodll_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\monodll_stc.obj: ..\..\src\stc\stc.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\stc\stc.cpp
|
||||
|
||||
@ -9608,6 +9615,9 @@ $(OBJS)\monolib_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cpp
|
||||
$(OBJS)\monolib_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\monolib_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\monolib_stc.obj: ..\..\src\stc\stc.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\stc\stc.cpp
|
||||
|
||||
@ -15213,6 +15223,9 @@ $(OBJS)\richtextdll_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cp
|
||||
$(OBJS)\richtextdll_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(RICHTEXTDLL_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\richtextdll_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(RICHTEXTDLL_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\richtextlib_dummy.obj: ..\..\src\common\dummy.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(RICHTEXTLIB_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp
|
||||
|
||||
@ -15243,6 +15256,9 @@ $(OBJS)\richtextlib_richtextstyledlg.obj: ..\..\src\richtext\richtextstyledlg.cp
|
||||
$(OBJS)\richtextlib_richtextprint.obj: ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(RICHTEXTLIB_CXXFLAGS) ..\..\src\richtext\richtextprint.cpp
|
||||
|
||||
$(OBJS)\richtextlib_richtextimagedlg.obj: ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(RICHTEXTLIB_CXXFLAGS) ..\..\src\richtext\richtextimagedlg.cpp
|
||||
|
||||
$(OBJS)\stcdll_dummy.obj: ..\..\src\common\dummy.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp
|
||||
|
||||
|
@ -231,6 +231,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_OBJECTS = &
|
||||
$(OBJS)\monodll_richtextsymboldlg.obj &
|
||||
$(OBJS)\monodll_richtextstyledlg.obj &
|
||||
$(OBJS)\monodll_richtextprint.obj &
|
||||
$(OBJS)\monodll_richtextimagedlg.obj &
|
||||
$(OBJS)\monodll_stc.obj &
|
||||
$(OBJS)\monodll_PlatWX.obj &
|
||||
$(OBJS)\monodll_ScintillaWX.obj
|
||||
@ -962,6 +963,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS = &
|
||||
$(OBJS)\monolib_richtextsymboldlg.obj &
|
||||
$(OBJS)\monolib_richtextstyledlg.obj &
|
||||
$(OBJS)\monolib_richtextprint.obj &
|
||||
$(OBJS)\monolib_richtextimagedlg.obj &
|
||||
$(OBJS)\monolib_stc.obj &
|
||||
$(OBJS)\monolib_PlatWX.obj &
|
||||
$(OBJS)\monolib_ScintillaWX.obj
|
||||
@ -4653,7 +4655,8 @@ RICHTEXTDLL_OBJECTS = &
|
||||
$(OBJS)\richtextdll_richtextformatdlg.obj &
|
||||
$(OBJS)\richtextdll_richtextsymboldlg.obj &
|
||||
$(OBJS)\richtextdll_richtextstyledlg.obj &
|
||||
$(OBJS)\richtextdll_richtextprint.obj
|
||||
$(OBJS)\richtextdll_richtextprint.obj &
|
||||
$(OBJS)\richtextdll_richtextimagedlg.obj
|
||||
RICHTEXTLIB_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) &
|
||||
$(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) &
|
||||
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) &
|
||||
@ -4673,7 +4676,8 @@ RICHTEXTLIB_OBJECTS = &
|
||||
$(OBJS)\richtextlib_richtextformatdlg.obj &
|
||||
$(OBJS)\richtextlib_richtextsymboldlg.obj &
|
||||
$(OBJS)\richtextlib_richtextstyledlg.obj &
|
||||
$(OBJS)\richtextlib_richtextprint.obj
|
||||
$(OBJS)\richtextlib_richtextprint.obj &
|
||||
$(OBJS)\richtextlib_richtextimagedlg.obj
|
||||
STCDLL_CXXFLAGS = -bd $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) &
|
||||
$(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) &
|
||||
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) &
|
||||
@ -7202,6 +7206,9 @@ $(OBJS)\monodll_richtextstyledlg.obj : .AUTODEPEND ..\..\src\richtext\richtexts
|
||||
$(OBJS)\monodll_richtextprint.obj : .AUTODEPEND ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\monodll_richtextimagedlg.obj : .AUTODEPEND ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\monodll_stc.obj : .AUTODEPEND ..\..\src\stc\stc.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
|
||||
|
||||
@ -9437,6 +9444,9 @@ $(OBJS)\monolib_richtextstyledlg.obj : .AUTODEPEND ..\..\src\richtext\richtexts
|
||||
$(OBJS)\monolib_richtextprint.obj : .AUTODEPEND ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\monolib_richtextimagedlg.obj : .AUTODEPEND ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\monolib_stc.obj : .AUTODEPEND ..\..\src\stc\stc.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
|
||||
|
||||
@ -15042,6 +15052,9 @@ $(OBJS)\richtextdll_richtextstyledlg.obj : .AUTODEPEND ..\..\src\richtext\richt
|
||||
$(OBJS)\richtextdll_richtextprint.obj : .AUTODEPEND ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(RICHTEXTDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\richtextdll_richtextimagedlg.obj : .AUTODEPEND ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(RICHTEXTDLL_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\richtextlib_dummy.obj : .AUTODEPEND ..\..\src\common\dummy.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(RICHTEXTLIB_CXXFLAGS) $<
|
||||
|
||||
@ -15072,6 +15085,9 @@ $(OBJS)\richtextlib_richtextstyledlg.obj : .AUTODEPEND ..\..\src\richtext\richt
|
||||
$(OBJS)\richtextlib_richtextprint.obj : .AUTODEPEND ..\..\src\richtext\richtextprint.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(RICHTEXTLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\richtextlib_richtextimagedlg.obj : .AUTODEPEND ..\..\src\richtext\richtextimagedlg.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(RICHTEXTLIB_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\stcdll_dummy.obj : .AUTODEPEND ..\..\src\common\dummy.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
|
@ -6529,6 +6529,10 @@ SOURCE=..\..\include\wx\richtext\richtexthtml.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\wx\richtext\richtextimagedlg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\wx\richtext\richtextprint.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -546,6 +546,10 @@ SOURCE=..\..\include\wx\richtext\richtexthtml.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\wx\richtext\richtextimagedlg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\wx\richtext\richtextprint.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -586,6 +590,10 @@ SOURCE=..\..\src\richtext\richtexthtml.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\richtext\richtextimagedlg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\richtext\richtextprint.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -5491,6 +5491,9 @@
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtexthtml.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextimagedlg.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextprint.h">
|
||||
</File>
|
||||
|
@ -791,6 +791,9 @@
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtexthtml.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextimagedlg.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextprint.h">
|
||||
</File>
|
||||
@ -823,6 +826,9 @@
|
||||
<File
|
||||
RelativePath="..\..\src\richtext\richtexthtml.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\richtext\richtextimagedlg.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\richtext\richtextprint.cpp">
|
||||
</File>
|
||||
|
@ -7339,6 +7339,10 @@
|
||||
RelativePath="..\..\include\wx\richtext\richtexthtml.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextimagedlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextprint.h"
|
||||
>
|
||||
|
@ -1074,6 +1074,10 @@
|
||||
RelativePath="..\..\include\wx\richtext\richtexthtml.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextimagedlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextprint.h"
|
||||
>
|
||||
@ -1116,6 +1120,10 @@
|
||||
RelativePath="..\..\src\richtext\richtexthtml.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\richtext\richtextimagedlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\richtext\richtextprint.cpp"
|
||||
>
|
||||
|
@ -7335,6 +7335,10 @@
|
||||
RelativePath="..\..\include\wx\richtext\richtexthtml.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextimagedlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextprint.h"
|
||||
>
|
||||
|
@ -1070,6 +1070,10 @@
|
||||
RelativePath="..\..\include\wx\richtext\richtexthtml.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextimagedlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\wx\richtext\richtextprint.h"
|
||||
>
|
||||
@ -1112,6 +1116,10 @@
|
||||
RelativePath="..\..\src\richtext\richtexthtml.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\richtext\richtextimagedlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\richtext\richtextprint.cpp"
|
||||
>
|
||||
|
@ -113,6 +113,7 @@ enum wxRichTextFileType
|
||||
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObject;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextImage;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCacheObject;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine;
|
||||
@ -123,6 +124,8 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer;
|
||||
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAnchoredObject;
|
||||
class wxRichTextFloatCollector;
|
||||
|
||||
/*!
|
||||
* Flags determining the available space, passed to Layout
|
||||
@ -232,6 +235,69 @@ enum wxRichTextHitTestFlags
|
||||
|
||||
#define wxSCRIPT_MUL_FACTOR 1.5
|
||||
|
||||
// Image align/floating
|
||||
#define wxRICHTEXT_LEFT 0x00
|
||||
#define wxRICHTEXT_CENTRE 0x01
|
||||
#define wxRICHTEXT_RIGHT 0x02
|
||||
|
||||
#define wxRICHTEXT_FLOAT_NONE 0x00
|
||||
#define wxRICHTEXT_FLOAT_LEFT 0x01
|
||||
#define wxRICHTEXT_FLOAT_RIGHT 0x02
|
||||
|
||||
// Image width/height scale
|
||||
#define wxRICHTEXT_PX 0x00
|
||||
#define wxRICHTEXT_MM 0x01
|
||||
|
||||
/*!
|
||||
* wxRichTextAnchoredObjectAttr class declaration
|
||||
*/
|
||||
class WXDLLIMPEXP_RICHTEXT wxRichTextAnchoredObjectAttr
|
||||
{
|
||||
public:
|
||||
wxRichTextAnchoredObjectAttr() { Init(); }
|
||||
wxRichTextAnchoredObjectAttr(const wxRichTextAnchoredObjectAttr& attr) { Copy(attr); }
|
||||
|
||||
void Init();
|
||||
|
||||
void operator= (const wxRichTextAnchoredObjectAttr& attr) { Copy(attr); }
|
||||
void Copy(const wxRichTextAnchoredObjectAttr& attr);
|
||||
|
||||
/// Is this anchored? TODO: difference between anchored and floating?
|
||||
bool IsAnchored() const { return m_floating != wxRICHTEXT_FLOAT_NONE; }
|
||||
|
||||
/// Is this floating?
|
||||
bool IsFloating() const { return m_floating != wxRICHTEXT_FLOAT_NONE; }
|
||||
void SetFloatingMode(int floating) { m_floating = floating; }
|
||||
|
||||
int GetAlignment() const { return m_align; }
|
||||
void SetAlignment(int align) { m_align = align; }
|
||||
|
||||
int GetOffset() const { return m_offset; }
|
||||
void SetOffset(int offset) { m_offset = offset; }
|
||||
|
||||
int GetUnitsOffset() const { return m_unitsOffset; }
|
||||
void SetUnitsOffset(int offset) { m_unitsOffset = offset; }
|
||||
|
||||
int GetUnitsW() const { return m_unitsW; }
|
||||
void SetUnitsW(int u) { m_unitsW = u; }
|
||||
|
||||
int GetUnitsH() const { return m_unitsH; }
|
||||
void SetUnitsH(int u) { m_unitsH = u; }
|
||||
|
||||
int GetWidth() const { return m_width; }
|
||||
void SetWidth(int w) { m_width = w; }
|
||||
|
||||
int GetHeight() const { return m_height; }
|
||||
void SetHeight(int h) { m_height = h; }
|
||||
|
||||
int m_align;
|
||||
int m_floating;
|
||||
int m_offset;
|
||||
int m_unitsOffset;
|
||||
int m_unitsW, m_unitsH;
|
||||
int m_width, m_height;
|
||||
};
|
||||
|
||||
/*!
|
||||
* wxRichTextFontTable
|
||||
* Manages quick access to a pool of fonts for rendering rich text
|
||||
@ -377,6 +443,18 @@ public:
|
||||
/// Returns true if the object is empty
|
||||
virtual bool IsEmpty() const { return false; }
|
||||
|
||||
/// Whether this object floatable
|
||||
virtual bool IsFloatable() const { return false; }
|
||||
|
||||
/// Whether this object is currently floating
|
||||
virtual bool IsFloating() const { return false; }
|
||||
|
||||
/// Whether this object is a place holding one
|
||||
// virtual bool IsPlaceHolding() const { return false; }
|
||||
|
||||
/// Floating direction
|
||||
virtual int GetFloatDirection() const { return wxRICHTEXT_FLOAT_NONE; }
|
||||
|
||||
/// Get any text in this object for the given range
|
||||
virtual wxString GetTextForRange(const wxRichTextRange& WXUNUSED(range)) const { return wxEmptyString; }
|
||||
|
||||
@ -389,6 +467,12 @@ public:
|
||||
|
||||
/// Dump to output stream for debugging
|
||||
virtual void Dump(wxTextOutputStream& stream);
|
||||
|
||||
/// Can we edit properties via a GUI?
|
||||
virtual bool CanEditProperties() const { return false; }
|
||||
|
||||
/// Edit properties via a GUI
|
||||
virtual bool EditProperties(wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) { return false; }
|
||||
|
||||
// Accessors
|
||||
|
||||
@ -455,7 +539,7 @@ public:
|
||||
void Dereference();
|
||||
|
||||
/// Convert units in tenths of a millimetre to device units
|
||||
int ConvertTenthsMMToPixels(wxDC& dc, int units);
|
||||
int ConvertTenthsMMToPixels(wxDC& dc, int units) const;
|
||||
static int ConvertTenthsMMToPixels(int ppi, int units);
|
||||
|
||||
protected:
|
||||
@ -617,9 +701,14 @@ public:
|
||||
|
||||
wxRichTextParagraphLayoutBox(wxRichTextObject* parent = NULL);
|
||||
wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox& obj): wxRichTextBox() { Init(); Copy(obj); }
|
||||
~wxRichTextParagraphLayoutBox();
|
||||
|
||||
// Overrideables
|
||||
|
||||
/// Hit-testing: returns a flag indicating hit test details, plus
|
||||
/// information about position
|
||||
virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition);
|
||||
|
||||
/// Draw the item
|
||||
virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style);
|
||||
|
||||
@ -653,6 +742,11 @@ public:
|
||||
virtual wxRichTextStyleSheet* GetStyleSheet() const { return NULL; }
|
||||
|
||||
// Operations
|
||||
/// Draw the floats of this buffer
|
||||
void DrawFloats(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style);
|
||||
|
||||
/// Move an anchored object to another paragraph
|
||||
void MoveAnchoredObjectToParagraph(wxRichTextParagraph* from, wxRichTextParagraph* to, wxRichTextAnchoredObject* obj);
|
||||
|
||||
/// Initialize the object.
|
||||
void Init();
|
||||
@ -726,6 +820,9 @@ public:
|
||||
/// Set text attributes: character and/or paragraph styles.
|
||||
virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
|
||||
|
||||
/// Set image attribute
|
||||
void SetImageStyle(wxRichTextImage *image, const wxRichTextAnchoredObjectAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
|
||||
|
||||
/// Get the conbined text attributes for this position.
|
||||
virtual bool GetStyle(long position, wxTextAttr& style);
|
||||
|
||||
@ -821,10 +918,18 @@ public:
|
||||
|
||||
/// Invalidate the buffer. With no argument, invalidates whole buffer.
|
||||
void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL);
|
||||
|
||||
/// Gather information about floating objects. If untilObj is non-NULL,
|
||||
/// will stop getting information if the current object is this, since we
|
||||
/// will collect the rest later.
|
||||
virtual bool UpdateFloatingObjects(int width, wxRichTextObject* untilObj = NULL);
|
||||
|
||||
/// Get invalid range, rounding to entire paragraphs if argument is true.
|
||||
wxRichTextRange GetInvalidRange(bool wholeParagraphs = false) const;
|
||||
|
||||
/// Get the wxRichTextFloatCollector of this object
|
||||
wxRichTextFloatCollector* GetFloatCollector() { return m_floatCollector; }
|
||||
|
||||
protected:
|
||||
wxRichTextCtrl* m_ctrl;
|
||||
wxTextAttr m_defaultAttributes;
|
||||
@ -834,6 +939,9 @@ protected:
|
||||
|
||||
// Is the last paragraph partial or complete?
|
||||
bool m_partialParagraph;
|
||||
|
||||
// The floating layout state
|
||||
wxRichTextFloatCollector* m_floatCollector;
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -1038,12 +1146,17 @@ public:
|
||||
/// Get default tabstop array
|
||||
static const wxArrayInt& GetDefaultTabs() { return sm_defaultTabs; }
|
||||
|
||||
/// Layout the floats object
|
||||
void LayoutFloat(wxDC& dc, const wxRect& rect, int style, wxRichTextFloatCollector* floatCollector);
|
||||
|
||||
protected:
|
||||
/// The lines that make up the wrapped paragraph
|
||||
wxRichTextLineList m_cachedLines;
|
||||
|
||||
/// Default tabstops
|
||||
static wxArrayInt sm_defaultTabs;
|
||||
|
||||
friend class wxRichTextFloatCollector;
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -1151,6 +1264,12 @@ public:
|
||||
// Make an image block from the wxImage in the given
|
||||
// format.
|
||||
virtual bool MakeImageBlock(wxImage& image, wxBitmapType imageType, int quality = 80);
|
||||
|
||||
// Uses a const wxImage for efficiency, but can't set quality (only relevant for JPEG)
|
||||
virtual bool MakeImageBlockDefaultQuality(const wxImage& image, wxBitmapType imageType);
|
||||
|
||||
// Makes the image block
|
||||
virtual bool DoMakeImageBlock(const wxImage& image, wxBitmapType imageType);
|
||||
|
||||
// Write to a file
|
||||
bool Write(const wxString& filename);
|
||||
@ -1206,22 +1325,58 @@ protected:
|
||||
wxBitmapType m_imageType;
|
||||
};
|
||||
|
||||
/*!
|
||||
* wxRichTextAnchoredObject class declaration
|
||||
* This object is an abstract one that represent some objects which can floats
|
||||
*/
|
||||
class WXDLLIMPEXP_RICHTEXT wxRichTextAnchoredObject: public wxRichTextObject
|
||||
{
|
||||
DECLARE_CLASS(wxRichTextAnchoredObject)
|
||||
public:
|
||||
// Constructors
|
||||
wxRichTextAnchoredObject(wxRichTextObject* parent = NULL, const wxRichTextAnchoredObjectAttr& attr = wxRichTextAnchoredObjectAttr());
|
||||
wxRichTextAnchoredObject(const wxRichTextAnchoredObject& obj) : wxRichTextObject(obj) /* , m_ph(NULL) */ { Copy(obj); }
|
||||
~wxRichTextAnchoredObject();
|
||||
|
||||
// Virtuals
|
||||
virtual bool IsFloatable() const { return true; }
|
||||
|
||||
/// Whether this object is currently floating
|
||||
virtual bool IsFloating() const { return m_anchoredAttr.m_floating != wxRICHTEXT_FLOAT_NONE; }
|
||||
|
||||
virtual void SetParent(wxRichTextObject* parent);
|
||||
|
||||
// Accessors
|
||||
const wxRichTextAnchoredObjectAttr& GetAnchoredAttr() const { return m_anchoredAttr; }
|
||||
void SetAnchoredAttr(const wxRichTextAnchoredObjectAttr& attr);
|
||||
|
||||
/// The floating direction
|
||||
virtual int GetFloatDirection() const { return m_anchoredAttr.m_floating; }
|
||||
|
||||
void operator=(const wxRichTextAnchoredObject&) { wxASSERT("Nobody can reset this object using ="); }
|
||||
|
||||
// Functions
|
||||
void Copy(const wxRichTextAnchoredObject& obj);
|
||||
|
||||
protected:
|
||||
wxRichTextAnchoredObjectAttr m_anchoredAttr;
|
||||
};
|
||||
|
||||
/*!
|
||||
* wxRichTextImage class declaration
|
||||
* This object represents an image.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_RICHTEXT wxRichTextImage: public wxRichTextObject
|
||||
class WXDLLIMPEXP_RICHTEXT wxRichTextImage: public wxRichTextAnchoredObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRichTextImage)
|
||||
public:
|
||||
// Constructors
|
||||
|
||||
wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { }
|
||||
wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextAnchoredObject(parent) { }
|
||||
wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxTextAttr* charStyle = NULL);
|
||||
wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxTextAttr* charStyle = NULL);
|
||||
wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject() { Copy(obj); }
|
||||
wxRichTextImage(const wxRichTextImage& obj): wxRichTextAnchoredObject(obj) { Copy(obj); }
|
||||
|
||||
// Overrideables
|
||||
|
||||
@ -1236,15 +1391,24 @@ public:
|
||||
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
|
||||
|
||||
/// Returns true if the object is empty
|
||||
virtual bool IsEmpty() const { return !m_image.Ok(); }
|
||||
virtual bool IsEmpty() const { return !m_imageBlock.Ok(); }
|
||||
|
||||
/// Can we edit properties via a GUI?
|
||||
virtual bool CanEditProperties() const { return true; }
|
||||
|
||||
/// Edit properties via a GUI
|
||||
virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
|
||||
|
||||
// Accessors
|
||||
|
||||
/// Get the image
|
||||
const wxImage& GetImage() const { return m_image; }
|
||||
/// Get the image cache (scaled bitmap)
|
||||
const wxBitmap& GetImageCache() const { return m_imageCache; }
|
||||
|
||||
/// Set the image
|
||||
void SetImage(const wxImage& image) { m_image = image; }
|
||||
/// Set the image cache
|
||||
void SetImageCache(const wxBitmap& bitmap) { m_imageCache = bitmap; }
|
||||
|
||||
/// Reset the image cache
|
||||
void ResetImageCache() { m_imageCache = wxNullBitmap; }
|
||||
|
||||
/// Get the image block containing the raw data
|
||||
wxRichTextImageBlock& GetImageBlock() { return m_imageBlock; }
|
||||
@ -1257,17 +1421,12 @@ public:
|
||||
/// Clone
|
||||
virtual wxRichTextObject* Clone() const { return new wxRichTextImage(*this); }
|
||||
|
||||
/// Load wxImage from the block
|
||||
virtual bool LoadFromBlock();
|
||||
|
||||
/// Make block from the wxImage
|
||||
virtual bool MakeBlock();
|
||||
/// Create a cached image at the required size
|
||||
virtual bool LoadImageCache(wxDC& dc, bool resetCache = false);
|
||||
|
||||
protected:
|
||||
// TODO: reduce the multiple representations of data
|
||||
wxImage m_image;
|
||||
wxBitmap m_bitmap;
|
||||
wxRichTextImageBlock m_imageBlock;
|
||||
wxBitmap m_imageCache;
|
||||
};
|
||||
|
||||
|
||||
@ -1535,7 +1694,10 @@ public:
|
||||
bool InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int flags = 0);
|
||||
|
||||
/// Submit command to insert the given image
|
||||
bool InsertImageWithUndo(long pos, const wxRichTextImageBlock& imageBlock, wxRichTextCtrl* ctrl, int flags = 0);
|
||||
bool InsertImageWithUndo(long pos, const wxRichTextImageBlock& imageBlock, wxRichTextCtrl* ctrl, int flags = 0, const wxRichTextAnchoredObjectAttr& floatAttr = wxRichTextAnchoredObjectAttr());
|
||||
|
||||
/// Submit command to insert an object
|
||||
bool InsertObjectWithUndo(long pos, wxRichTextObject *object, wxRichTextCtrl* ctrl, int flags);
|
||||
|
||||
/// Submit command to delete this range
|
||||
bool DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl);
|
||||
|
@ -184,6 +184,10 @@ public:
|
||||
long GetSelectionAnchor() const { return m_selectionAnchor; }
|
||||
void SetSelectionAnchor(long anchor) { m_selectionAnchor = anchor; }
|
||||
|
||||
/// The wxRichTextObject object under mouse if any
|
||||
wxRichTextObject* GetCurrentObject() const { return m_currentObject; }
|
||||
void SetCurrentObject(wxRichTextObject* obj) { m_currentObject = obj; }
|
||||
|
||||
// Operations
|
||||
|
||||
// editing
|
||||
@ -222,6 +226,9 @@ public:
|
||||
virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style);
|
||||
virtual bool GetStyle(long position, wxTextAttr& style);
|
||||
|
||||
// Set an image style
|
||||
void SetImageStyle(wxRichTextImage *image, const wxRichTextAnchoredObjectAttr& style);
|
||||
|
||||
// get the common set of styles for the range
|
||||
virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style);
|
||||
// extended style setting operation with flags including:
|
||||
@ -309,17 +316,17 @@ public:
|
||||
|
||||
/// Write an image at the current insertion point. Supply optional type to use
|
||||
/// for internal and file storage of the raw data.
|
||||
virtual bool WriteImage(const wxImage& image, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG);
|
||||
virtual bool WriteImage(const wxImage& image, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG, const wxRichTextAnchoredObjectAttr& attr = wxRichTextAnchoredObjectAttr());
|
||||
|
||||
/// Write a bitmap at the current insertion point. Supply optional type to use
|
||||
/// for internal and file storage of the raw data.
|
||||
virtual bool WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG);
|
||||
virtual bool WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType = wxBITMAP_TYPE_PNG, const wxRichTextAnchoredObjectAttr& attr = wxRichTextAnchoredObjectAttr());
|
||||
|
||||
/// Load an image from file and write at the current insertion point.
|
||||
virtual bool WriteImage(const wxString& filename, wxBitmapType bitmapType);
|
||||
virtual bool WriteImage(const wxString& filename, wxBitmapType bitmapType, const wxRichTextAnchoredObjectAttr& attr = wxRichTextAnchoredObjectAttr());
|
||||
|
||||
/// Write an image block at the current insertion point.
|
||||
virtual bool WriteImage(const wxRichTextImageBlock& imageBlock);
|
||||
virtual bool WriteImage(const wxRichTextImageBlock& imageBlock, const wxRichTextAnchoredObjectAttr& attr = wxRichTextAnchoredObjectAttr());
|
||||
|
||||
/// Insert a newline (actually paragraph) at the current insertion point.
|
||||
virtual bool Newline();
|
||||
@ -621,6 +628,7 @@ public:
|
||||
void OnUndo(wxCommandEvent& event);
|
||||
void OnRedo(wxCommandEvent& event);
|
||||
void OnSelectAll(wxCommandEvent& event);
|
||||
void OnImage(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateCut(wxUpdateUIEvent& event);
|
||||
@ -629,6 +637,7 @@ public:
|
||||
void OnUpdateUndo(wxUpdateUIEvent& event);
|
||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||
void OnUpdateSelectAll(wxUpdateUIEvent& event);
|
||||
void OnUpdateImage(wxUpdateUIEvent& event);
|
||||
void OnUpdateClear(wxUpdateUIEvent& event);
|
||||
|
||||
// Show a context menu for Rich Edit controls (the standard
|
||||
@ -883,6 +892,9 @@ private:
|
||||
wxCursor m_urlCursor;
|
||||
|
||||
static wxArrayString sm_availableFontNames;
|
||||
/// The wxRichTextObject object under mouse if any
|
||||
wxRichTextObject* m_currentObject;
|
||||
long m_imagePropertyId;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
142
include/wx/richtext/richtextimagedlg.h
Normal file
142
include/wx/richtext/richtextimagedlg.h
Normal file
@ -0,0 +1,142 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/richtext/richtextimagedlg.h
|
||||
// Purpose:
|
||||
// Author: Mingquan Yang
|
||||
// Modified by:
|
||||
// Created: Wed 02 Jun 2010 11:27:23 CST
|
||||
// RCS-ID:
|
||||
// Copyright: (c) Mingquan Yang
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _RICHTEXTIMAGEDLG_H_
|
||||
#define _RICHTEXTIMAGEDLG_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||
#pragma interface "wx/richtext/richtextimagedlg.h"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Includes
|
||||
*/
|
||||
#include "wx/richtext/richtextbuffer.h"
|
||||
////@begin includes
|
||||
#include "wx/statline.h"
|
||||
////@end includes
|
||||
|
||||
/*!
|
||||
* Forward declarations
|
||||
*/
|
||||
|
||||
////@begin forward declarations
|
||||
////@end forward declarations
|
||||
|
||||
/*!
|
||||
* Control identifiers
|
||||
*/
|
||||
|
||||
////@begin control identifiers
|
||||
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL
|
||||
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE _("Image Properties")
|
||||
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME ID_WXRICHTEXTIMAGEPAGE
|
||||
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE wxSize(400, 300)
|
||||
#define SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION wxDefaultPosition
|
||||
////@end control identifiers
|
||||
|
||||
|
||||
/*!
|
||||
* wxRichTextImageDialog class declaration
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_RICHTEXT wxRichTextImageDialog: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxRichTextImageDialog )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
/// Constructors
|
||||
wxRichTextImageDialog();
|
||||
wxRichTextImageDialog( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE );
|
||||
|
||||
/// Creation
|
||||
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME, const wxString& caption = SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE );
|
||||
|
||||
/// Destructor
|
||||
~wxRichTextImageDialog();
|
||||
|
||||
/// Initialises member variables
|
||||
void Init();
|
||||
|
||||
/// Creates the controls and sizers
|
||||
void CreateControls();
|
||||
|
||||
////@begin wxRichTextImageDialog event handler declarations
|
||||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_PARA_UP
|
||||
void OnRichtextimagedialogParaUpClick( wxCommandEvent& event );
|
||||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_DOWN
|
||||
void OnRichtextimagedialogDownClick( wxCommandEvent& event );
|
||||
|
||||
////@end wxRichTextImageDialog event handler declarations
|
||||
|
||||
////@begin wxRichTextImageDialog member function declarations
|
||||
|
||||
/// Retrieves bitmap resources
|
||||
wxBitmap GetBitmapResource( const wxString& name );
|
||||
|
||||
/// Retrieves icon resources
|
||||
wxIcon GetIconResource( const wxString& name );
|
||||
////@end wxRichTextImageDialog member function declarations
|
||||
|
||||
/// Should we show tooltips?
|
||||
static bool ShowToolTips();
|
||||
|
||||
/// Set the image attribute
|
||||
void SetImageAttr(const wxRichTextAnchoredObjectAttr& attr);
|
||||
wxRichTextImage* ApplyImageAttr();
|
||||
|
||||
/// Set the anchored object
|
||||
void SetImageObject(wxRichTextImage *image, wxRichTextBuffer* buffer);
|
||||
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual bool TransferDataToWindow();
|
||||
private:
|
||||
/// Convert CM to MM
|
||||
bool ConvertFromString(const wxString& string, int& ret, int scale);
|
||||
private:
|
||||
wxRichTextAnchoredObjectAttr m_attr;
|
||||
////@begin wxRichTextImageDialog member variables
|
||||
wxComboBox* m_alignment;
|
||||
wxComboBox* m_float;
|
||||
wxTextCtrl* m_width;
|
||||
wxComboBox* m_unitsW;
|
||||
wxTextCtrl* m_height;
|
||||
wxComboBox* m_unitsH;
|
||||
wxTextCtrl* m_offset;
|
||||
wxComboBox* m_unitsOffset;
|
||||
wxButton* m_saveButton;
|
||||
wxButton* m_cancelButton;
|
||||
/// Control identifiers
|
||||
enum {
|
||||
ID_WXRICHTEXTIMAGEPAGE = 10015,
|
||||
ID_COMBOBOX_ALIGN = 10016,
|
||||
ID_RICHTEXTIMAGEDIALOG_FLOATING_MODE = 10017,
|
||||
ID_RICHTEXTIMAGEDIALOG_WIDTH = 10018,
|
||||
ID_RICHTEXTIMAGEDIALOG_UNITS_W = 10019,
|
||||
ID_RICHTEXTIMAGEDIALOG_HEIGHT = 10020,
|
||||
ID_RICHTEXTIMAGEDIALOG_UNITS_H = 10021,
|
||||
ID_RICHTEXTIMAGEDIALOG_OFFSET = 10022,
|
||||
ID_RICHTEXTIMAGEDIALOG_OFFSET_UNITS = 10023,
|
||||
ID_RICHTEXTIMAGEDIALOG_PARA_UP = 10024,
|
||||
ID_RICHTEXTIMAGEDIALOG_DOWN = 10025
|
||||
};
|
||||
////@end wxRichTextImageDialog member variables
|
||||
|
||||
wxRichTextBuffer* m_buffer;
|
||||
wxRichTextObject* m_image;
|
||||
wxRichTextObject* m_parent;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _RICHTEXTIMAGEDLG_H_
|
@ -78,6 +78,7 @@
|
||||
#include "wx/richtext/richtextsymboldlg.h"
|
||||
#include "wx/richtext/richtextstyledlg.h"
|
||||
#include "wx/richtext/richtextprint.h"
|
||||
#include "wx/richtext/richtextimagedlg.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// resources
|
||||
@ -145,6 +146,8 @@ public:
|
||||
void OnIndentLess(wxCommandEvent& event);
|
||||
|
||||
void OnFont(wxCommandEvent& event);
|
||||
void OnImage(wxCommandEvent& event);
|
||||
void OnUpdateImage(wxUpdateUIEvent& event);
|
||||
void OnParagraph(wxCommandEvent& event);
|
||||
void OnFormat(wxCommandEvent& event);
|
||||
void OnUpdateFormat(wxUpdateUIEvent& event);
|
||||
@ -181,6 +184,7 @@ public:
|
||||
void OnPreview(wxCommandEvent& event);
|
||||
void OnPageSetup(wxCommandEvent& event);
|
||||
|
||||
void OnInsertImage(wxCommandEvent& event);
|
||||
protected:
|
||||
|
||||
// Forward command events to the current rich text control, if any
|
||||
@ -211,6 +215,7 @@ enum
|
||||
ID_FORMAT_ITALIC,
|
||||
ID_FORMAT_UNDERLINE,
|
||||
ID_FORMAT_FONT,
|
||||
ID_FORMAT_IMAGE,
|
||||
ID_FORMAT_PARAGRAPH,
|
||||
ID_FORMAT_CONTENT,
|
||||
|
||||
@ -218,6 +223,7 @@ enum
|
||||
|
||||
ID_INSERT_SYMBOL,
|
||||
ID_INSERT_URL,
|
||||
ID_INSERT_IMAGE,
|
||||
|
||||
ID_FORMAT_ALIGN_LEFT,
|
||||
ID_FORMAT_ALIGN_CENTRE,
|
||||
@ -286,10 +292,12 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_UPDATE_UI(ID_FORMAT_ALIGN_RIGHT, MyFrame::OnUpdateAlignRight)
|
||||
|
||||
EVT_MENU(ID_FORMAT_FONT, MyFrame::OnFont)
|
||||
EVT_MENU(ID_FORMAT_IMAGE, MyFrame::OnImage)
|
||||
EVT_MENU(ID_FORMAT_PARAGRAPH, MyFrame::OnParagraph)
|
||||
EVT_MENU(ID_FORMAT_CONTENT, MyFrame::OnFormat)
|
||||
EVT_UPDATE_UI(ID_FORMAT_CONTENT, MyFrame::OnUpdateFormat)
|
||||
EVT_UPDATE_UI(ID_FORMAT_FONT, MyFrame::OnUpdateFormat)
|
||||
EVT_UPDATE_UI(ID_FORMAT_IMAGE, MyFrame::OnUpdateImage)
|
||||
EVT_UPDATE_UI(ID_FORMAT_PARAGRAPH, MyFrame::OnUpdateFormat)
|
||||
EVT_MENU(ID_FORMAT_INDENT_MORE, MyFrame::OnIndentMore)
|
||||
EVT_MENU(ID_FORMAT_INDENT_LESS, MyFrame::OnIndentLess)
|
||||
@ -305,6 +313,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
|
||||
EVT_MENU(ID_INSERT_SYMBOL, MyFrame::OnInsertSymbol)
|
||||
EVT_MENU(ID_INSERT_URL, MyFrame::OnInsertURL)
|
||||
EVT_MENU(ID_INSERT_IMAGE, MyFrame::OnInsertImage)
|
||||
|
||||
EVT_MENU(ID_FORMAT_NUMBER_LIST, MyFrame::OnNumberList)
|
||||
EVT_MENU(ID_FORMAT_BULLETS_AND_NUMBERING, MyFrame::OnBulletsAndNumbering)
|
||||
@ -621,6 +630,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
||||
formatMenu->Append(ID_FORMAT_LINE_SPACING_DOUBLE, _("Double Line Spacing"));
|
||||
formatMenu->AppendSeparator();
|
||||
formatMenu->Append(ID_FORMAT_FONT, _("&Font..."));
|
||||
formatMenu->Append(ID_FORMAT_IMAGE, _("Image Property"));
|
||||
formatMenu->Append(ID_FORMAT_PARAGRAPH, _("&Paragraph..."));
|
||||
formatMenu->Append(ID_FORMAT_CONTENT, _("Font and Pa&ragraph...\tShift+Ctrl+F"));
|
||||
formatMenu->AppendSeparator();
|
||||
@ -640,6 +650,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
||||
wxMenu* insertMenu = new wxMenu;
|
||||
insertMenu->Append(ID_INSERT_SYMBOL, _("&Symbol...\tCtrl+I"));
|
||||
insertMenu->Append(ID_INSERT_URL, _("&URL..."));
|
||||
insertMenu->Append(ID_INSERT_IMAGE, _("&Image..."));
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
@ -689,6 +700,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
||||
toolBar->AddTool(ID_FORMAT_INDENT_MORE, wxEmptyString, wxBitmap(indentmore_xpm), _("Indent More"));
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(ID_FORMAT_FONT, wxEmptyString, wxBitmap(font_xpm), _("Font"));
|
||||
toolBar->AddTool(ID_FORMAT_IMAGE, wxString("Im"), wxBitmap(font_xpm), _("Image Property"));
|
||||
|
||||
wxRichTextStyleComboCtrl* combo = new wxRichTextStyleComboCtrl(toolBar, ID_RICHTEXT_STYLE_COMBO, wxDefaultPosition, wxSize(200, -1));
|
||||
toolBar->AddControl(combo);
|
||||
@ -742,6 +754,8 @@ void MyFrame::WriteInitialText()
|
||||
|
||||
r.BeginSuppressUndo();
|
||||
|
||||
r.Freeze();
|
||||
|
||||
r.BeginParagraphSpacing(0, 20);
|
||||
|
||||
r.BeginAlignment(wxTEXT_ALIGNMENT_CENTRE);
|
||||
@ -768,6 +782,18 @@ void MyFrame::WriteInitialText()
|
||||
|
||||
r.EndAlignment();
|
||||
|
||||
r.BeginAlignment(wxTEXT_ALIGNMENT_LEFT);
|
||||
wxRichTextAnchoredObjectAttr anchoredAttr;
|
||||
anchoredAttr.m_floating = wxRICHTEXT_FLOAT_LEFT;
|
||||
r.WriteText(wxString(wxT("This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side.")));
|
||||
r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, anchoredAttr);
|
||||
anchoredAttr.m_floating = wxRICHTEXT_FLOAT_RIGHT;
|
||||
anchoredAttr.m_offset = 200;
|
||||
r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, anchoredAttr);
|
||||
r.WriteText(wxString(wxT("This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side.")));
|
||||
r.EndAlignment();
|
||||
r.Newline();
|
||||
|
||||
r.WriteText(wxT("What can you do with this thing? "));
|
||||
|
||||
r.WriteImage(wxBitmap(smiley_xpm));
|
||||
@ -923,6 +949,8 @@ void MyFrame::WriteInitialText()
|
||||
|
||||
r.EndParagraphSpacing();
|
||||
|
||||
r.Thaw();
|
||||
|
||||
r.EndSuppressUndo();
|
||||
}
|
||||
|
||||
@ -1154,6 +1182,27 @@ void MyFrame::OnFont(wxCommandEvent& WXUNUSED(event))
|
||||
#endif
|
||||
}
|
||||
|
||||
void MyFrame::OnImage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxRichTextRange range;
|
||||
wxASSERT(m_richTextCtrl->HasSelection());
|
||||
|
||||
range = m_richTextCtrl->GetSelectionRange();
|
||||
wxASSERT(range.ToInternal().GetLength() == 1);
|
||||
|
||||
wxRichTextImage* image = wxDynamicCast(m_richTextCtrl->GetBuffer().GetLeafObjectAtPosition(range.GetStart()), wxRichTextImage);
|
||||
if (image)
|
||||
{
|
||||
wxRichTextImageDialog imageDlg(this);
|
||||
imageDlg.SetImageObject(image, &m_richTextCtrl->GetBuffer());
|
||||
|
||||
if (imageDlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
image = imageDlg.ApplyImageAttr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnParagraph(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxRichTextRange range;
|
||||
@ -1197,6 +1246,25 @@ void MyFrame::OnUpdateFormat(wxUpdateUIEvent& event)
|
||||
event.Enable(m_richTextCtrl->HasSelection());
|
||||
}
|
||||
|
||||
void MyFrame::OnUpdateImage(wxUpdateUIEvent& event)
|
||||
{
|
||||
wxRichTextRange range;
|
||||
wxRichTextObject *obj;
|
||||
|
||||
range = m_richTextCtrl->GetSelectionRange();
|
||||
if (range.ToInternal().GetLength() == 1)
|
||||
{
|
||||
obj = m_richTextCtrl->GetBuffer().GetLeafObjectAtPosition(range.GetStart());
|
||||
if (obj && obj->IsKindOf(CLASSINFO(wxRichTextImage)))
|
||||
{
|
||||
event.Enable(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
event.Enable(false);
|
||||
}
|
||||
|
||||
void MyFrame::OnIndentMore(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxRichTextAttr attr;
|
||||
@ -1562,6 +1630,16 @@ void MyFrame::OnInsertURL(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnInsertImage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxFileDialog dialog(this, _("Choose an image"), "", "", "BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png");
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
wxString path = dialog.GetPath();
|
||||
m_richTextCtrl->WriteImage(path, wxBITMAP_TYPE_ANY);
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnURL(wxTextUrlEvent& event)
|
||||
{
|
||||
wxMessageBox(event.GetString());
|
||||
|
54
src/richtext/readme
Normal file
54
src/richtext/readme
Normal file
@ -0,0 +1,54 @@
|
||||
Implement detail of floating layout
|
||||
|
||||
1. Data Structure
|
||||
|
||||
Mainly, we maintain two floating list data for a wxRichTextBuffer.
|
||||
'struct FloatRectMap' is used to represent a floating object's region,
|
||||
and 'class wxFloatCollector' is a container of all 'struct FloatRectMap'.
|
||||
It maintains all the information of the positions of all the floating
|
||||
objects with two list of 'struct FloatRectMap', one for objects floated
|
||||
to left and the other for right.
|
||||
|
||||
wxRichTextAnchoredObject is introduced to represent a kind of objects
|
||||
that can be floated. wxRichTextImage is made to be a child class of
|
||||
this one. In future, we may introduce some other floating object type
|
||||
like wxRichTextTable. And we also introduce a twin object of this one,
|
||||
it is wxRichTextPlaceHoldingObject. When the object is set to be a
|
||||
floating one, we will place a 'placing holding' object in its origin
|
||||
position, this makes us to record the position of the object correctly
|
||||
even if the containing paragraph change its content.
|
||||
|
||||
Also, along with wxRichTextAnchoredObject, we also introduce a
|
||||
wxRichTextAnchoredObjectAttr class, which contains the attributes of
|
||||
floating direction, floating offset and etc. wxRichTextImageAttr is made
|
||||
to be a subclass of this one.
|
||||
|
||||
Finally, wxRichTextImageDlg is a image control dialog, in which users can
|
||||
set the alignment, floating direction, size, offset of the image, in addition,
|
||||
users can also move the image between paragraph with this dialog.
|
||||
|
||||
2. Layout Algorithm
|
||||
|
||||
With floating objects, when we layout a paragraph, wxFloatCollector will
|
||||
firstly collect all the floating objects of the paragraphs before this
|
||||
one. And then, layout the floating objects of this paragraph, then layout
|
||||
the normal objects using the available rect info according the floating
|
||||
objects' state.
|
||||
|
||||
Generally, the basic paragraph layout algorithm:
|
||||
1. All paragraphs before this one is layout well, so use wxFloatCollector
|
||||
to collect the floating objects state;
|
||||
2. Collect all the 'place holding objects' of the paragraph, layout the
|
||||
floating objects with the space available for it;
|
||||
3. For other objects left, make line break as:
|
||||
GetAvailableWidth with a <y, h> pair, where y is the vertical position
|
||||
of the line and h is the minimum height of the line.
|
||||
After we get the width, do line break and normal layout.
|
||||
|
||||
3. Some Note
|
||||
|
||||
If we use floating attributes with list style, it may cause some problems.
|
||||
Something like image/text overlap may happen. Since, list style is applied
|
||||
to the paragraph after its normal layout, in which phrase, floating layout
|
||||
is done, list style will change the position of the paragraph and so may
|
||||
cause some overlap.
|
File diff suppressed because it is too large
Load Diff
@ -300,12 +300,21 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
|
||||
m_contextMenu->AppendSeparator();
|
||||
m_contextMenu->Append(wxID_SELECTALL, _("Select &All"));
|
||||
|
||||
long ids = wxNewId();
|
||||
m_contextMenu->AppendSeparator();
|
||||
m_contextMenu->Append(ids, _("&Properties"));
|
||||
|
||||
Connect(ids, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxRichTextCtrl::OnUpdateImage));
|
||||
Connect(ids, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxRichTextCtrl::OnImage));
|
||||
m_imagePropertyId = ids;
|
||||
return true;
|
||||
}
|
||||
|
||||
wxRichTextCtrl::~wxRichTextCtrl()
|
||||
{
|
||||
GetBuffer().RemoveEventHandler(this);
|
||||
Disconnect(m_imagePropertyId, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxRichTextCtrl::OnUpdateImage));
|
||||
Disconnect(m_imagePropertyId, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxRichTextCtrl::OnImage));
|
||||
|
||||
delete m_contextMenu;
|
||||
}
|
||||
@ -326,6 +335,7 @@ void wxRichTextCtrl::Init()
|
||||
m_fullLayoutSavedPosition = 0;
|
||||
m_delayedLayoutThreshold = wxRICHTEXT_DEFAULT_DELAYED_LAYOUT_THRESHOLD;
|
||||
m_caretPositionForDefaultStyle = -2;
|
||||
m_currentObject = NULL;
|
||||
}
|
||||
|
||||
void wxRichTextCtrl::DoThaw()
|
||||
@ -2387,34 +2397,34 @@ void wxRichTextCtrl::AppendText(const wxString& text)
|
||||
}
|
||||
|
||||
/// Write an image at the current insertion point
|
||||
bool wxRichTextCtrl::WriteImage(const wxImage& image, wxBitmapType bitmapType)
|
||||
bool wxRichTextCtrl::WriteImage(const wxImage& image, wxBitmapType bitmapType, const wxRichTextAnchoredObjectAttr& attr)
|
||||
{
|
||||
wxRichTextImageBlock imageBlock;
|
||||
|
||||
wxImage image2 = image;
|
||||
if (imageBlock.MakeImageBlock(image2, bitmapType))
|
||||
return WriteImage(imageBlock);
|
||||
return WriteImage(imageBlock, attr);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxRichTextCtrl::WriteImage(const wxString& filename, wxBitmapType bitmapType)
|
||||
bool wxRichTextCtrl::WriteImage(const wxString& filename, wxBitmapType bitmapType, const wxRichTextAnchoredObjectAttr& attr)
|
||||
{
|
||||
wxRichTextImageBlock imageBlock;
|
||||
|
||||
wxImage image;
|
||||
if (imageBlock.MakeImageBlock(filename, bitmapType, image, false))
|
||||
return WriteImage(imageBlock);
|
||||
return WriteImage(imageBlock, attr);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxRichTextCtrl::WriteImage(const wxRichTextImageBlock& imageBlock)
|
||||
bool wxRichTextCtrl::WriteImage(const wxRichTextImageBlock& imageBlock, const wxRichTextAnchoredObjectAttr& attr)
|
||||
{
|
||||
return GetBuffer().InsertImageWithUndo(m_caretPosition+1, imageBlock, this);
|
||||
return GetBuffer().InsertImageWithUndo(m_caretPosition+1, imageBlock, this, NULL, attr);
|
||||
}
|
||||
|
||||
bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType)
|
||||
bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType, const wxRichTextAnchoredObjectAttr& attr)
|
||||
{
|
||||
if (bitmap.Ok())
|
||||
{
|
||||
@ -2422,7 +2432,7 @@ bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType)
|
||||
|
||||
wxImage image = bitmap.ConvertToImage();
|
||||
if (image.Ok() && imageBlock.MakeImageBlock(image, bitmapType))
|
||||
return WriteImage(imageBlock);
|
||||
return WriteImage(imageBlock, attr);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -2824,6 +2834,18 @@ void wxRichTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
|
||||
event.Enable(GetLastPosition() > 0);
|
||||
}
|
||||
|
||||
void wxRichTextCtrl::OnImage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (GetCurrentObject() && GetCurrentObject()->CanEditProperties())
|
||||
GetCurrentObject()->EditProperties(this, & GetBuffer());
|
||||
SetCurrentObject(NULL);
|
||||
}
|
||||
|
||||
void wxRichTextCtrl::OnUpdateImage(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(GetCurrentObject() != NULL && GetCurrentObject()->CanEditProperties());
|
||||
}
|
||||
|
||||
void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
|
||||
{
|
||||
if (event.GetEventObject() != this)
|
||||
@ -2832,6 +2854,23 @@ void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
|
||||
return;
|
||||
}
|
||||
|
||||
wxClientDC dc(this);
|
||||
PrepareDC(dc);
|
||||
dc.SetFont(GetFont());
|
||||
|
||||
long position = 0;
|
||||
wxPoint pt = event.GetPosition();
|
||||
wxPoint logicalPt = GetLogicalPoint(ScreenToClient(pt));
|
||||
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
||||
if (hit == wxRICHTEXT_HITTEST_ON || hit == wxRICHTEXT_HITTEST_BEFORE || hit == wxRICHTEXT_HITTEST_AFTER)
|
||||
{
|
||||
m_currentObject = GetBuffer().GetLeafObjectAtPosition(position);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentObject = NULL;
|
||||
}
|
||||
|
||||
if (m_contextMenu)
|
||||
PopupMenu(m_contextMenu);
|
||||
return;
|
||||
@ -2847,6 +2886,11 @@ bool wxRichTextCtrl::SetStyle(const wxRichTextRange& range, const wxTextAttr& st
|
||||
return GetBuffer().SetStyle(range.ToInternal(), style);
|
||||
}
|
||||
|
||||
void wxRichTextCtrl::SetImageStyle(wxRichTextImage *image, const wxRichTextAnchoredObjectAttr& attr)
|
||||
{
|
||||
GetBuffer().SetImageStyle(image, attr);
|
||||
}
|
||||
|
||||
// extended style setting operation with flags including:
|
||||
// wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY.
|
||||
// see richtextbuffer.h for more details.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -470,20 +470,27 @@ void wxRichTextHTMLHandler::WriteImage(wxRichTextImage* image, wxOutputStream& s
|
||||
#if wxUSE_FILESYSTEM
|
||||
if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY)
|
||||
{
|
||||
#if 0
|
||||
if (!image->GetImage().Ok() && image->GetImageBlock().GetData())
|
||||
image->LoadFromBlock();
|
||||
if (image->GetImage().Ok() && !image->GetImageBlock().GetData())
|
||||
image->MakeBlock();
|
||||
#endif
|
||||
|
||||
if (image->GetImage().Ok())
|
||||
if (image->GetImageBlock().IsOk())
|
||||
{
|
||||
wxString ext(image->GetImageBlock().GetExtension());
|
||||
wxString tempFilename(wxString::Format(wxT("image%d.%s"), sm_fileCounter, ext));
|
||||
wxMemoryFSHandler::AddFile(tempFilename, image->GetImage(), image->GetImageBlock().GetImageType());
|
||||
wxImage img;
|
||||
image->GetImageBlock().Load(img);
|
||||
if (img.IsOk())
|
||||
{
|
||||
wxString ext(image->GetImageBlock().GetExtension());
|
||||
wxString tempFilename(wxString::Format(wxT("image%d.%s"), sm_fileCounter, ext));
|
||||
wxMemoryFSHandler::AddFile(tempFilename, img, image->GetImageBlock().GetImageType());
|
||||
|
||||
m_imageLocations.Add(tempFilename);
|
||||
m_imageLocations.Add(tempFilename);
|
||||
|
||||
str << wxT("memory:") << tempFilename;
|
||||
str << wxT("memory:") << tempFilename;
|
||||
}
|
||||
}
|
||||
else
|
||||
str << wxT("memory:?");
|
||||
@ -492,12 +499,14 @@ void wxRichTextHTMLHandler::WriteImage(wxRichTextImage* image, wxOutputStream& s
|
||||
}
|
||||
else if (GetFlags() & wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES)
|
||||
{
|
||||
#if 0
|
||||
if (!image->GetImage().Ok() && image->GetImageBlock().GetData())
|
||||
image->LoadFromBlock();
|
||||
if (image->GetImage().Ok() && !image->GetImageBlock().GetData())
|
||||
image->MakeBlock();
|
||||
#endif
|
||||
|
||||
if (image->GetImage().Ok())
|
||||
if (image->GetImageBlock().Ok())
|
||||
{
|
||||
wxString tempDir(GetTempDir());
|
||||
if (tempDir.IsEmpty())
|
||||
@ -522,14 +531,17 @@ void wxRichTextHTMLHandler::WriteImage(wxRichTextImage* image, wxOutputStream& s
|
||||
str << wxT("data:");
|
||||
str << GetMimeType(image->GetImageBlock().GetImageType());
|
||||
str << wxT(";base64,");
|
||||
|
||||
#if 0
|
||||
if (image->GetImage().Ok() && !image->GetImageBlock().GetData())
|
||||
image->MakeBlock();
|
||||
#endif
|
||||
if (image->GetImageBlock().Ok())
|
||||
{
|
||||
wxChar* data = b64enc( image->GetImageBlock().GetData(), image->GetImageBlock().GetDataSize() );
|
||||
str << data;
|
||||
|
||||
wxChar* data = b64enc( image->GetImageBlock().GetData(), image->GetImageBlock().GetDataSize() );
|
||||
str << data;
|
||||
|
||||
delete[] data;
|
||||
delete[] data;
|
||||
}
|
||||
}
|
||||
|
||||
str << wxT("\" />");
|
||||
|
554
src/richtext/richtextimagedlg.cpp
Normal file
554
src/richtext/richtextimagedlg.cpp
Normal file
@ -0,0 +1,554 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/richtext/richtextimagedlg.cpp
|
||||
// Purpose:
|
||||
// Author: Mingquan Yang
|
||||
// Modified by:
|
||||
// Created: Wed 02 Jun 2010 11:27:23 CST
|
||||
// RCS-ID:
|
||||
// Copyright: (c) Mingquan Yang
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||
#pragma implementation "wx/richtext/richtextimagedlg.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
////@begin includes
|
||||
////@end includes
|
||||
|
||||
#include "wx/richtext/richtextimagedlg.h"
|
||||
#include "wx/richtext/richtextctrl.h"
|
||||
|
||||
////@begin XPM images
|
||||
////@end XPM images
|
||||
|
||||
|
||||
/*!
|
||||
* wxRichTextImageDialog type definition
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( wxRichTextImageDialog, wxDialog )
|
||||
|
||||
|
||||
/*!
|
||||
* wxRichTextImageDialog event table definition
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE( wxRichTextImageDialog, wxDialog )
|
||||
|
||||
////@begin wxRichTextImageDialog event table entries
|
||||
EVT_BUTTON( ID_RICHTEXTIMAGEDIALOG_PARA_UP, wxRichTextImageDialog::OnRichtextimagedialogParaUpClick )
|
||||
|
||||
EVT_BUTTON( ID_RICHTEXTIMAGEDIALOG_DOWN, wxRichTextImageDialog::OnRichtextimagedialogDownClick )
|
||||
|
||||
////@end wxRichTextImageDialog event table entries
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/*!
|
||||
* wxRichTextImageDialog constructors
|
||||
*/
|
||||
|
||||
wxRichTextImageDialog::wxRichTextImageDialog()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
wxRichTextImageDialog::wxRichTextImageDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, caption, pos, size, style);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* wxRichTextImageDlg creator
|
||||
*/
|
||||
|
||||
bool wxRichTextImageDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
////@begin wxRichTextImageDialog creation
|
||||
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
|
||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||
|
||||
CreateControls();
|
||||
if (GetSizer())
|
||||
{
|
||||
GetSizer()->SetSizeHints(this);
|
||||
}
|
||||
Centre();
|
||||
////@end wxRichTextImageDialog creation
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* wxRichTextImageDialog destructor
|
||||
*/
|
||||
|
||||
wxRichTextImageDialog::~wxRichTextImageDialog()
|
||||
{
|
||||
////@begin wxRichTextImageDialog destruction
|
||||
////@end wxRichTextImageDialog destruction
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Member initialisation
|
||||
*/
|
||||
|
||||
void wxRichTextImageDialog::Init()
|
||||
{
|
||||
////@begin wxRichTextImageDialog member initialisation
|
||||
m_alignment = NULL;
|
||||
m_float = NULL;
|
||||
m_width = NULL;
|
||||
m_unitsW = NULL;
|
||||
m_height = NULL;
|
||||
m_unitsH = NULL;
|
||||
m_offset = NULL;
|
||||
m_unitsOffset = NULL;
|
||||
m_saveButton = NULL;
|
||||
m_cancelButton = NULL;
|
||||
////@end wxRichTextImageDialog member initialisation
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Control creation for wxRichTextImageDlg
|
||||
*/
|
||||
|
||||
void wxRichTextImageDialog::CreateControls()
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
SetWindowVariant(wxWINDOW_VARIANT_SMALL);
|
||||
#endif
|
||||
|
||||
////@begin wxRichTextImageDialog content construction
|
||||
wxRichTextImageDialog* itemDialog1 = this;
|
||||
|
||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
||||
itemDialog1->SetSizer(itemBoxSizer2);
|
||||
|
||||
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
|
||||
|
||||
wxFlexGridSizer* itemFlexGridSizer4 = new wxFlexGridSizer(0, 2, 0, 0);
|
||||
itemBoxSizer3->Add(itemFlexGridSizer4, 0, wxALIGN_TOP|wxRIGHT, 5);
|
||||
|
||||
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemStaticText5->Show(false);
|
||||
itemFlexGridSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxArrayString m_alignmentStrings;
|
||||
m_alignmentStrings.Add(_("Left"));
|
||||
m_alignmentStrings.Add(_("Centre"));
|
||||
m_alignmentStrings.Add(_("Right"));
|
||||
m_alignment = new wxComboBox( itemDialog1, ID_COMBOBOX_ALIGN, _("Left"), wxDefaultPosition, wxSize(80, -1), m_alignmentStrings, wxCB_READONLY );
|
||||
m_alignment->SetStringSelection(_("Left"));
|
||||
m_alignment->Show(false);
|
||||
itemFlexGridSizer4->Add(m_alignment, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Floating mode:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemFlexGridSizer4->Add(itemStaticText7, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxArrayString m_floatStrings;
|
||||
m_floatStrings.Add(_("None"));
|
||||
m_floatStrings.Add(_("Left"));
|
||||
m_floatStrings.Add(_("Right"));
|
||||
m_float = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_FLOATING_MODE, _("None"), wxDefaultPosition, wxSize(80, -1), m_floatStrings, wxCB_READONLY );
|
||||
m_float->SetStringSelection(_("None"));
|
||||
m_float->SetHelpText(_("How the image will float relative to the text."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_float->SetToolTip(_("How the image will float relative to the text."));
|
||||
itemFlexGridSizer4->Add(m_float, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemFlexGridSizer4->Add(itemStaticText9, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemFlexGridSizer4->Add(itemBoxSizer10, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
m_width = new wxTextCtrl( itemDialog1, ID_RICHTEXTIMAGEDIALOG_WIDTH, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
|
||||
m_width->SetHelpText(_("The image width to be shown - does not change the source image width."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_width->SetToolTip(_("The image width to be shown - does not change the source image width."));
|
||||
itemBoxSizer10->Add(m_width, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxArrayString m_unitsWStrings;
|
||||
m_unitsWStrings.Add(_("px"));
|
||||
m_unitsWStrings.Add(_("cm"));
|
||||
m_unitsW = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_UNITS_W, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsWStrings, wxCB_READONLY );
|
||||
m_unitsW->SetStringSelection(_("px"));
|
||||
m_unitsW->SetHelpText(_("Units for the image width."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_unitsW->SetToolTip(_("Units for the image width."));
|
||||
itemBoxSizer10->Add(m_unitsW, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Height:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemFlexGridSizer4->Add(itemStaticText13, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemFlexGridSizer4->Add(itemBoxSizer14, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
m_height = new wxTextCtrl( itemDialog1, ID_RICHTEXTIMAGEDIALOG_HEIGHT, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
|
||||
m_height->SetHelpText(_("The image height to be shown - does not change the source image height."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_height->SetToolTip(_("The image height to be shown - does not change the source image height."));
|
||||
itemBoxSizer14->Add(m_height, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxArrayString m_unitsHStrings;
|
||||
m_unitsHStrings.Add(_("px"));
|
||||
m_unitsHStrings.Add(_("cm"));
|
||||
m_unitsH = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_UNITS_H, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsHStrings, wxCB_READONLY );
|
||||
m_unitsH->SetStringSelection(_("px"));
|
||||
m_unitsH->SetHelpText(_("Units for the image height."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_unitsH->SetToolTip(_("Units for the image height."));
|
||||
itemBoxSizer14->Add(m_unitsH, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Image Vertical &Offset:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemFlexGridSizer4->Add(itemStaticText17, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemFlexGridSizer4->Add(itemBoxSizer18, 1, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
m_offset = new wxTextCtrl( itemDialog1, ID_RICHTEXTIMAGEDIALOG_OFFSET, wxEmptyString, wxDefaultPosition, wxSize(65, -1), 0 );
|
||||
m_offset->SetMaxLength(10);
|
||||
m_offset->SetHelpText(_("The vertical offset relative to the paragraph."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_offset->SetToolTip(_("The vertical offset relative to the paragraph."));
|
||||
itemBoxSizer18->Add(m_offset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxArrayString m_unitsOffsetStrings;
|
||||
m_unitsOffsetStrings.Add(_("px"));
|
||||
m_unitsOffsetStrings.Add(_("cm"));
|
||||
m_unitsOffset = new wxComboBox( itemDialog1, ID_RICHTEXTIMAGEDIALOG_OFFSET_UNITS, _("px"), wxDefaultPosition, wxSize(60, -1), m_unitsOffsetStrings, wxCB_READONLY );
|
||||
m_unitsOffset->SetStringSelection(_("px"));
|
||||
m_unitsOffset->SetHelpText(_("Units for the image offset."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_unitsOffset->SetToolTip(_("Units for the image offset."));
|
||||
itemBoxSizer18->Add(m_unitsOffset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxStaticText* itemStaticText21 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Move the image to:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemFlexGridSizer4->Add(itemStaticText21, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemFlexGridSizer4->Add(itemBoxSizer22, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
wxButton* itemButton23 = new wxButton( itemDialog1, ID_RICHTEXTIMAGEDIALOG_PARA_UP, _("&Previous Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton23->SetHelpText(_("Moves the image to the previous paragraph."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
itemButton23->SetToolTip(_("Moves the image to the previous paragraph."));
|
||||
itemBoxSizer22->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxButton* itemButton24 = new wxButton( itemDialog1, ID_RICHTEXTIMAGEDIALOG_DOWN, _("&Next Paragraph"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton24->SetHelpText(_("Moves the image to the next paragraph."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
itemButton24->SetToolTip(_("Moves the image to the next paragraph."));
|
||||
itemBoxSizer22->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
|
||||
|
||||
wxStaticLine* itemStaticLine25 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
itemBoxSizer2->Add(itemStaticLine25, 0, wxGROW|wxALL, 5);
|
||||
|
||||
wxStdDialogButtonSizer* itemStdDialogButtonSizer26 = new wxStdDialogButtonSizer;
|
||||
|
||||
itemBoxSizer2->Add(itemStdDialogButtonSizer26, 0, wxGROW|wxALL, 5);
|
||||
m_saveButton = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_saveButton->SetHelpText(_("Click to confirm your changes."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_saveButton->SetToolTip(_("Click to confirm your changes."));
|
||||
itemStdDialogButtonSizer26->AddButton(m_saveButton);
|
||||
|
||||
m_cancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cancelButton->SetHelpText(_("Click to discard your changes."));
|
||||
if (wxRichTextImageDialog::ShowToolTips())
|
||||
m_cancelButton->SetToolTip(_("Click to discard your changes."));
|
||||
itemStdDialogButtonSizer26->AddButton(m_cancelButton);
|
||||
|
||||
itemStdDialogButtonSizer26->Realize();
|
||||
|
||||
////@end wxRichTextImageDialog content construction
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Should we show tooltips?
|
||||
*/
|
||||
|
||||
bool wxRichTextImageDialog::ShowToolTips()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get bitmap resources
|
||||
*/
|
||||
|
||||
wxBitmap wxRichTextImageDialog::GetBitmapResource( const wxString& name )
|
||||
{
|
||||
// Bitmap retrieval
|
||||
////@begin wxRichTextImageDialog bitmap retrieval
|
||||
wxUnusedVar(name);
|
||||
return wxNullBitmap;
|
||||
////@end wxRichTextImageDialog bitmap retrieval
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get icon resources
|
||||
*/
|
||||
|
||||
wxIcon wxRichTextImageDialog::GetIconResource( const wxString& name )
|
||||
{
|
||||
// Icon retrieval
|
||||
////@begin wxRichTextImageDialog icon retrieval
|
||||
wxUnusedVar(name);
|
||||
return wxNullIcon;
|
||||
////@end wxRichTextImageDialog icon retrieval
|
||||
}
|
||||
|
||||
/*!
|
||||
* Set the image attribute
|
||||
*/
|
||||
void wxRichTextImageDialog::SetImageAttr(const wxRichTextAnchoredObjectAttr& attr)
|
||||
{
|
||||
m_attr = attr;
|
||||
TransferDataToWindow();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Apply the new style
|
||||
*/
|
||||
wxRichTextImage* wxRichTextImageDialog::ApplyImageAttr()
|
||||
{
|
||||
wxRichTextImage* image = wxDynamicCast(m_image, wxRichTextImage);
|
||||
|
||||
TransferDataFromWindow();
|
||||
if (m_buffer->GetRichTextCtrl())
|
||||
{
|
||||
m_buffer->GetRichTextCtrl()->SetImageStyle(image, m_attr);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
void wxRichTextImageDialog::SetImageObject(wxRichTextImage* image, wxRichTextBuffer* buffer)
|
||||
{
|
||||
wxRichTextObject* parent = image->GetParent();
|
||||
|
||||
m_buffer = buffer;
|
||||
m_image = image;
|
||||
m_parent = parent;
|
||||
SetImageAttr(image->GetAnchoredAttr());
|
||||
if (image->GetImageCache().IsOk())
|
||||
{
|
||||
if (m_attr.m_width == -1)
|
||||
{
|
||||
m_attr.m_width = image->GetImageCache().GetWidth();
|
||||
wxASSERT(m_attr.m_unitsW == wxRICHTEXT_PX);
|
||||
|
||||
m_attr.m_unitsW = wxRICHTEXT_PX;
|
||||
}
|
||||
if (m_attr.m_height == -1)
|
||||
{
|
||||
m_attr.m_height = image->GetImageCache().GetHeight();
|
||||
wxASSERT(m_attr.m_unitsH == wxRICHTEXT_PX);
|
||||
|
||||
m_attr.m_unitsH = wxRICHTEXT_PX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool wxRichTextImageDialog::TransferDataToWindow()
|
||||
{
|
||||
int remain = 100;
|
||||
|
||||
m_alignment->SetSelection(m_attr.m_align);
|
||||
m_float->SetSelection(m_attr.m_floating);
|
||||
|
||||
// Update scale
|
||||
m_unitsW->SetSelection(m_attr.m_unitsW);
|
||||
m_unitsH->SetSelection(m_attr.m_unitsH);
|
||||
m_unitsOffset->SetSelection(m_attr.m_unitsOffset);
|
||||
|
||||
// Update metric
|
||||
m_width->Clear();
|
||||
if (m_attr.m_unitsW == wxRICHTEXT_MM)
|
||||
{
|
||||
int remainder = m_attr.m_width % remain;
|
||||
*m_width << m_attr.m_width / remain;
|
||||
if (remainder)
|
||||
{
|
||||
*m_width << '.' << remainder;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*m_width << m_attr.m_width;
|
||||
}
|
||||
|
||||
m_height->Clear();
|
||||
if (m_attr.m_unitsH == wxRICHTEXT_MM)
|
||||
{
|
||||
int remainder = m_attr.m_height % remain;
|
||||
*m_height << m_attr.m_height / remain;
|
||||
if (remainder)
|
||||
{
|
||||
*m_height << '.' << remainder;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*m_height << m_attr.m_height;
|
||||
}
|
||||
|
||||
m_offset->Clear();
|
||||
if (m_attr.m_unitsOffset == wxRICHTEXT_MM)
|
||||
{
|
||||
int remainder = m_attr.m_offset % remain;
|
||||
*m_offset << m_attr.m_offset / remain;
|
||||
if (remainder)
|
||||
{
|
||||
*m_offset << '.' << remainder;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*m_offset << m_attr.m_offset;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRichTextImageDialog::TransferDataFromWindow()
|
||||
{
|
||||
wxString width = m_width->GetValue();
|
||||
wxString height = m_height->GetValue();
|
||||
wxString offset = m_offset->GetValue();
|
||||
int w, h, o;
|
||||
|
||||
m_attr.m_align = m_alignment->GetSelection();
|
||||
m_attr.m_floating = m_float->GetSelection();
|
||||
|
||||
m_attr.m_unitsW = m_unitsW->GetSelection();
|
||||
m_attr.m_unitsH = m_unitsH->GetSelection();
|
||||
m_attr.m_unitsOffset = m_unitsOffset->GetSelection();
|
||||
|
||||
if (ConvertFromString(width, w, m_attr.m_unitsW))
|
||||
m_attr.m_width = w;
|
||||
if (ConvertFromString(height, h, m_attr.m_unitsH))
|
||||
m_attr.m_height = h;
|
||||
if (ConvertFromString(offset, o, m_attr.m_unitsOffset))
|
||||
m_attr.m_offset = o;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxRichTextImageDialog::ConvertFromString(const wxString& string, int& ret, int scale)
|
||||
{
|
||||
const wxChar* chars = string.GetData();
|
||||
int remain = 2;
|
||||
bool dot = false;
|
||||
ret = 0;
|
||||
|
||||
for (unsigned int i = 0; i < string.Len() && remain; i++)
|
||||
{
|
||||
if (!(chars[i] >= '0' && chars[i] <= '9') && !(scale == wxRICHTEXT_MM && chars[i] == '.'))
|
||||
return false;
|
||||
|
||||
if (chars[i] == '.')
|
||||
{
|
||||
dot = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dot)
|
||||
remain--;
|
||||
|
||||
ret = ret * 10 + chars[i] - '0';
|
||||
}
|
||||
|
||||
while (remain-- > 0 && scale == wxRICHTEXT_MM)
|
||||
ret *= 10;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_PARA_UP
|
||||
*/
|
||||
void wxRichTextImageDialog::OnRichtextimagedialogParaUpClick( wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// Before editing this code, remove the block markers.
|
||||
wxRichTextRange range = m_image->GetRange();
|
||||
wxRichTextObjectList::compatibility_iterator iter = m_buffer->GetChildren().GetFirst();
|
||||
if (iter == NULL)
|
||||
return;
|
||||
|
||||
while (iter)
|
||||
{
|
||||
if (iter->GetData() == m_parent)
|
||||
break;
|
||||
iter = iter->GetNext();
|
||||
}
|
||||
|
||||
iter = iter->GetPrevious();
|
||||
if (iter == NULL)
|
||||
return;
|
||||
|
||||
wxRichTextObject *obj = iter->GetData();
|
||||
wxRichTextRange rg = obj->GetRange();
|
||||
m_image = m_image->Clone();
|
||||
|
||||
m_buffer->DeleteRangeWithUndo(range, m_buffer->GetRichTextCtrl());
|
||||
m_buffer->InsertObjectWithUndo(rg.GetEnd(), m_image, m_buffer->GetRichTextCtrl(), 0);
|
||||
m_parent = obj;
|
||||
m_image->SetRange(wxRichTextRange(rg.GetEnd(), rg.GetEnd()));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_PARA_DOWN
|
||||
*/
|
||||
|
||||
void wxRichTextImageDialog::OnRichtextimagedialogDownClick( wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// Before editing this code, remove the block markers.
|
||||
wxRichTextRange range = m_image->GetRange();
|
||||
wxRichTextObjectList::compatibility_iterator iter = m_buffer->GetChildren().GetFirst();
|
||||
if (iter == NULL)
|
||||
return;
|
||||
|
||||
while (iter)
|
||||
{
|
||||
if (iter->GetData() == m_parent)
|
||||
break;
|
||||
iter = iter->GetNext();
|
||||
}
|
||||
|
||||
iter = iter->GetNext();
|
||||
if (iter == NULL)
|
||||
return;
|
||||
|
||||
wxRichTextObject *obj = iter->GetData();
|
||||
wxRichTextRange rg = obj->GetRange();
|
||||
m_image = m_image->Clone();
|
||||
|
||||
m_buffer->DeleteRangeWithUndo(range, m_buffer->GetRichTextCtrl());
|
||||
m_buffer->InsertObjectWithUndo(rg.GetEnd(), m_image, m_buffer->GetRichTextCtrl(), 0);
|
||||
m_parent = obj;
|
||||
m_image->SetRange(wxRichTextRange(rg.GetEnd(), rg.GetEnd()));
|
||||
}
|
||||
|
@ -813,8 +813,8 @@ bool wxRichTextXMLHandler::ExportXML(wxOutputStream& stream, wxMBConv* convMem,
|
||||
|
||||
wxString style = CreateStyle(obj.GetAttributes(), false);
|
||||
|
||||
if (imageObj.GetImage().Ok() && !imageObj.GetImageBlock().Ok())
|
||||
imageObj.MakeBlock();
|
||||
//if (imageObj.GetImage().Ok() && !imageObj.GetImageBlock().Ok())
|
||||
// imageObj.MakeBlock();
|
||||
|
||||
OutputIndentation(stream, indent);
|
||||
OutputString(stream, wxT("<") + objectName, convMem, convFile);
|
||||
|
Loading…
Reference in New Issue
Block a user